37#ifndef LIBBSP_AARCH64_SHARED_AARCH64_MMU_H
38#define LIBBSP_AARCH64_SHARED_AARCH64_MMU_H
58#define AARCH64_MMU_DEFAULT_SECTIONS \
60 .begin = (uintptr_t) bsp_section_fast_text_begin, \
61 .end = (uintptr_t) bsp_section_fast_text_end, \
62 .flags = AARCH64_MMU_CODE_CACHED \
64 .begin = (uintptr_t) bsp_section_fast_data_begin, \
65 .end = (uintptr_t) bsp_section_fast_data_end, \
66 .flags = AARCH64_MMU_DATA_RW_CACHED \
68 .begin = (uintptr_t) bsp_section_start_begin, \
69 .end = (uintptr_t) bsp_section_start_end, \
70 .flags = AARCH64_MMU_CODE_CACHED \
72 .begin = (uintptr_t) bsp_section_vector_begin, \
73 .end = (uintptr_t) bsp_section_vector_end, \
74 .flags = AARCH64_MMU_DATA_RW_CACHED \
76 .begin = (uintptr_t) bsp_section_text_begin, \
77 .end = (uintptr_t) bsp_section_text_end, \
78 .flags = AARCH64_MMU_CODE_CACHED \
80 .begin = (uintptr_t) bsp_section_rodata_begin, \
81 .end = (uintptr_t) bsp_section_rodata_end, \
82 .flags = AARCH64_MMU_DATA_RO_CACHED \
84 .begin = (uintptr_t) bsp_section_data_begin, \
85 .end = (uintptr_t) bsp_section_data_end, \
86 .flags = AARCH64_MMU_DATA_RW_CACHED \
88 .begin = (uintptr_t) bsp_section_bss_begin, \
89 .end = (uintptr_t) bsp_section_bss_end, \
90 .flags = AARCH64_MMU_DATA_RW_CACHED \
92 .begin = (uintptr_t) bsp_section_rtemsstack_begin, \
93 .end = (uintptr_t) bsp_section_rtemsstack_end, \
94 .flags = AARCH64_MMU_DATA_RW_CACHED \
96 .begin = (uintptr_t) bsp_section_noinit_begin, \
97 .end = (uintptr_t) bsp_section_noinit_end, \
98 .flags = AARCH64_MMU_DATA_RW_CACHED \
100 .begin = (uintptr_t) bsp_section_work_begin, \
101 .end = (uintptr_t) bsp_section_work_end, \
102 .flags = AARCH64_MMU_DATA_RW_CACHED \
104 .begin = (uintptr_t) bsp_section_stack_begin, \
105 .end = (uintptr_t) bsp_section_stack_end, \
106 .flags = AARCH64_MMU_DATA_RW_CACHED \
108 .begin = (uintptr_t) bsp_section_nocache_begin, \
109 .end = (uintptr_t) bsp_section_nocache_end, \
110 .flags = AARCH64_MMU_DEVICE \
112 .begin = (uintptr_t) bsp_section_nocachenoload_begin, \
113 .end = (uintptr_t) bsp_section_nocachenoload_end, \
114 .flags = AARCH64_MMU_DEVICE \
116 .begin = (uintptr_t) bsp_translation_table_base, \
117 .end = (uintptr_t) bsp_translation_table_end, \
118 .flags = AARCH64_MMU_DATA_RW_CACHED \
124 .begin = (uintptr_t) bsp_start_vector_table_begin, \
125 .end = (uintptr_t) bsp_start_vector_table_end, \
126 .flags = AARCH64_MMU_CODE_RW_CACHED \
160 size_t used_page_tables;
213BSP_START_TEXT_SECTION
static inline void
223 _AArch64_Write_ttbr0_el1( (uintptr_t)
control->ttb );
224 _AARCH64_Instruction_synchronization_barrier();
227 sctlr = _AArch64_Read_sctlr_el1();
228 sctlr |= AARCH64_SCTLR_EL1_I | AARCH64_SCTLR_EL1_C | AARCH64_SCTLR_EL1_M;
229 _AArch64_Write_sctlr_el1( sctlr );
232BSP_START_TEXT_SECTION
static inline void
233aarch64_mmu_disable(
void )
244 sctlr = _AArch64_Read_sctlr_el1();
245 sctlr &= ~(AARCH64_SCTLR_EL1_M);
246 _AArch64_Write_sctlr_el1( sctlr );
249BSP_START_TEXT_SECTION
static inline void aarch64_mmu_setup(
void )
253 _AArch64_Write_tcr_el1(
254 AARCH64_TCR_EL1_T0SZ( 0x10 ) | AARCH64_TCR_EL1_IRGN0( 0x1 ) |
255 AARCH64_TCR_EL1_ORGN0( 0x1 ) | AARCH64_TCR_EL1_SH0( 0x3 ) |
256 AARCH64_TCR_EL1_TG0( 0x0 ) | AARCH64_TCR_EL1_IPS( 0x5ULL ) |
261 _AArch64_Write_mair_el1(
262 AARCH64_MAIR_EL1_ATTR0( 0x0 ) | AARCH64_MAIR_EL1_ATTR1( 0x4 ) |
263 AARCH64_MAIR_EL1_ATTR2( 0x44 ) | AARCH64_MAIR_EL1_ATTR3( 0xFF )
aarch64_mmu_control aarch64_mmu_instance
This object is used to maintain the MMU translation tables.
Definition: mmu-setup.c:45
const aarch64_mmu_config_entry aarch64_mmu_config_table[]
This is the AArch64 MMU configuration table.
Definition: mmu-config.c:44
rtems_status_code aarch64_mmu_set_translation_table_entries(aarch64_mmu_control *control, const aarch64_mmu_config_entry *config)
Sets the MMU translation table entries associated with the memory region.
Definition: mmu-setup.c:260
void aarch64_mmu_setup_translation_table(aarch64_mmu_control *control, const aarch64_mmu_config_entry *config_table, size_t config_count)
Sets up the MMU translation table.
Definition: mmu-setup.c:294
const size_t aarch64_mmu_config_table_size
This is the count of entries in the AArch64 MMU configuration table.
Definition: mmu-config.c:70
This header file provides the API to read and write the AArch64 system registers.
This header file provides fatal codes for RTEMS_FATAL_SOURCE_BSP.
void rtems_cache_flush_entire_data(void)
Flushes the entire data cache.
Definition: cacheimpl.h:213
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
This header file provides utility macros for BSPs.
This header file provides interfaces to BSP-specific linker symbols and sections.
Definitions used in MMU setup.
Definition: aarch64-mmu.h:52
This structure represents the state to maintain the MMU translation tables.
Definition: aarch64-mmu.h:146
Definition: deflate.c:114
Definition: intercom.c:87