25 #ifndef LIBBSP_ARM_SHARED_ARM_CP15_START_H 26 #define LIBBSP_ARM_SHARED_ARM_CP15_START_H 29 #include <bsp/start.h> 30 #include <bsp/linker-symbols.h> 42 #define ARMV7_CP15_START_DEFAULT_SECTIONS \ 44 .begin = (uint32_t) bsp_section_fast_text_begin, \ 45 .end = (uint32_t) bsp_section_fast_text_end, \ 46 .flags = ARMV7_MMU_CODE_CACHED \ 48 .begin = (uint32_t) bsp_section_fast_data_begin, \ 49 .end = (uint32_t) bsp_section_fast_data_end, \ 50 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 52 .begin = (uint32_t) bsp_section_start_begin, \ 53 .end = (uint32_t) bsp_section_start_end, \ 54 .flags = ARMV7_MMU_CODE_CACHED \ 56 .begin = (uint32_t) bsp_section_vector_begin, \ 57 .end = (uint32_t) bsp_section_vector_end, \ 58 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 60 .begin = (uint32_t) bsp_section_text_begin, \ 61 .end = (uint32_t) bsp_section_text_end, \ 62 .flags = ARMV7_MMU_CODE_CACHED \ 64 .begin = (uint32_t) bsp_section_rodata_begin, \ 65 .end = (uint32_t) bsp_section_rodata_end, \ 66 .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED \ 68 .begin = (uint32_t) bsp_section_data_begin, \ 69 .end = (uint32_t) bsp_section_data_end, \ 70 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 72 .begin = (uint32_t) bsp_section_bss_begin, \ 73 .end = (uint32_t) bsp_section_bss_end, \ 74 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 76 .begin = (uint32_t) bsp_section_work_begin, \ 77 .end = (uint32_t) bsp_section_work_end, \ 78 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 80 .begin = (uint32_t) bsp_section_stack_begin, \ 81 .end = (uint32_t) bsp_section_stack_end, \ 82 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 84 .begin = (uint32_t) bsp_section_nocache_begin, \ 85 .end = (uint32_t) bsp_section_nocache_end, \ 86 .flags = ARMV7_MMU_DEVICE \ 88 .begin = (uint32_t) bsp_section_nocachenoload_begin, \ 89 .end = (uint32_t) bsp_section_nocachenoload_end, \ 90 .flags = ARMV7_MMU_DEVICE \ 92 .begin = (uint32_t) bsp_translation_table_base, \ 93 .end = (uint32_t) bsp_translation_table_end, \ 94 .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED \ 98 arm_cp15_start_mmu_config_table[];
100 BSP_START_DATA_SECTION
extern const size_t 101 arm_cp15_start_mmu_config_table_size;
103 BSP_START_TEXT_SECTION
static inline void 104 arm_cp15_start_set_translation_table_entries(
109 uint32_t i = ARM_MMU_SECT_GET_INDEX(config->begin);
111 ARM_MMU_SECT_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(config->end));
112 uint32_t index_mask = (1U << (32 - ARM_MMU_SECT_BASE_SHIFT)) - 1U;
114 if (config->begin != config->end) {
116 ttb [i] = (i << ARM_MMU_SECT_BASE_SHIFT) | config->flags;
117 i = (i + 1U) & index_mask;
122 BSP_START_TEXT_SECTION
static inline void 123 arm_cp15_start_setup_translation_table(
125 uint32_t client_domain,
130 uint32_t dac = ARM_CP15_DAC_DOMAIN(client_domain, ARM_CP15_DAC_CLIENT);
133 arm_cp15_set_domain_access_control(dac);
134 arm_cp15_set_translation_table_base(ttb);
137 for (i = 0; i < ARM_MMU_TRANSLATION_TABLE_ENTRY_COUNT; ++i) {
141 for (i = 0; i < config_count; ++i) {
142 arm_cp15_start_set_translation_table_entries(ttb, &config_table [i]);
146 BSP_START_TEXT_SECTION
static inline void 147 arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
150 uint32_t client_domain,
155 arm_cp15_start_setup_translation_table(
163 ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M;
165 arm_cp15_set_control(ctrl);
168 BSP_START_TEXT_SECTION
static inline uint32_t
169 arm_cp15_start_setup_mmu_and_cache(uint32_t ctrl_clear, uint32_t ctrl_set)
171 uint32_t ctrl = arm_cp15_get_control();
176 arm_cp15_set_control(ctrl);
178 arm_cp15_tlb_invalidate();
ARM co-processor 15 (CP15) API.
Definition: deflate.c:115
Definition: arm-cp15-start.h:36