File indexing completed on 2025-05-11 08:22:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include <bsp.h>
0037 #include <bsp/start.h>
0038 #include <bsp/aarch64-mmu.h>
0039 #include <libcpu/mmu-vmsav8-64.h>
0040
0041 #include <rtems/malloc.h>
0042 #include <rtems/sysinit.h>
0043
0044 BSP_START_DATA_SECTION static const aarch64_mmu_config_entry
0045 versal_mmu_config_table[] = {
0046 AARCH64_MMU_DEFAULT_SECTIONS,
0047 {
0048 .begin = 0xf1000000U,
0049 .end = 0xf2000000U,
0050 .flags = AARCH64_MMU_DEVICE
0051 }, {
0052 .begin = 0xf9000000U,
0053 .end = 0xf90c0000U,
0054 .flags = AARCH64_MMU_DEVICE
0055 }, {
0056 .begin = 0xfd000000U,
0057 .end = 0xfe000000U,
0058 .flags = AARCH64_MMU_DEVICE
0059 }, {
0060 .begin = 0xfe000000U,
0061 .end = 0xfe800000U,
0062 .flags = AARCH64_MMU_DEVICE
0063 }, {
0064 .begin = 0xff000000U,
0065 .end = 0xffc00000U,
0066 .flags = AARCH64_MMU_DEVICE
0067 }, {
0068 .begin = (uintptr_t) bsp_r1_ram_base,
0069 .end = (uintptr_t) bsp_r1_ram_end,
0070 .flags = AARCH64_MMU_DATA_RW_CACHED
0071 }
0072 };
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 static const struct mem_region {
0084 uintptr_t begin;
0085 uintptr_t end;
0086 } bsp_r1_region[] = {
0087 {
0088 .begin = (uintptr_t) bsp_r1_ram_base,
0089 .end = (uintptr_t) bsp_r1_ram_end,
0090 }
0091 };
0092
0093
0094
0095
0096 BSP_START_TEXT_SECTION void
0097 versal_setup_mmu_and_cache( void ) __attribute__ ((weak));
0098
0099 BSP_START_TEXT_SECTION void
0100 versal_setup_mmu_and_cache( void )
0101 {
0102 aarch64_mmu_control *control = &aarch64_mmu_instance;
0103
0104 aarch64_mmu_setup();
0105
0106 aarch64_mmu_setup_translation_table(
0107 control,
0108 &versal_mmu_config_table[ 0 ],
0109 RTEMS_ARRAY_SIZE( versal_mmu_config_table )
0110 );
0111
0112 aarch64_mmu_enable( control );
0113 }
0114
0115 void bsp_r1_heap_extend(void);
0116 void bsp_r1_heap_extend(void)
0117 {
0118 const struct mem_region* r1 = &bsp_r1_region[0];
0119 if (r1->begin != r1->end) {
0120 rtems_status_code sc =
0121 rtems_heap_extend((void*) r1->begin, r1->end - r1->begin);
0122 if (sc != RTEMS_SUCCESSFUL) {
0123 bsp_fatal(BSP_FATAL_HEAP_EXTEND_ERROR);
0124 }
0125 }
0126 }
0127
0128
0129
0130
0131
0132 RTEMS_SYSINIT_ITEM(
0133 bsp_r1_heap_extend,
0134 RTEMS_SYSINIT_IDLE_THREADS,
0135 RTEMS_SYSINIT_ORDER_LAST
0136 );