Changes in boot/arch/arm32/src/mm.c [b5a3b50:2e55443] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/mm.c
rb5a3b50 r2e55443 38 38 #include <arch/mm.h> 39 39 40 /** Disable the MMU */ 41 static void disable_paging(void) 42 { 43 asm volatile ( 44 "mrc p15, 0, r0, c1, c0, 0\n" 45 "bic r0, r0, #1\n" 46 "mcr p15, 0, r0, c1, c0, 0\n" 47 ::: "r0" 48 ); 49 } 50 40 51 /** Check if caching can be enabled for a given memory section. 41 52 * … … 56 67 else 57 68 return 1; 58 #else 69 #elif defined MACHINE_beagleboardxm 70 const unsigned long address = section << PTE_SECTION_SHIFT; 71 if (address >= BBXM_RAM_START && address < BBXM_RAM_END) 72 return 1; 73 #elif defined MACHINE_beaglebone 74 const unsigned long address = section << PTE_SECTION_SHIFT; 75 if (address >= AM335x_RAM_START && address < AM335x_RAM_END) 76 return 1; 77 #endif 59 78 return 0; 60 #endif61 79 } 62 80 … … 85 103 pte->tex = 0; 86 104 pte->access_permission_1 = 0; 105 pte->shareable = 0; 87 106 pte->non_global = 0; 88 107 pte->should_be_zero_2 = 0; … … 99 118 for (page = 0; page < split_page; page++) 100 119 init_ptl0_section(&boot_pt[page], page); 101 102 /*103 * Create 1:1 virtual-physical mapping in kernel space104 * (upper 2 GB), physical addresses start from 0.105 */106 /* BeagleBoard-xM (DM37x) memory starts at 2GB border,107 * thus mapping only lower 2GB is not not enough.108 * Map entire AS 1:1 instead and hope it works. */109 for (page = split_page; page < PTL0_ENTRIES; page++)110 #ifndef MACHINE_beagleboardxm111 init_ptl0_section(&boot_pt[page], page - split_page);112 #else113 init_ptl0_section(&boot_pt[page], page);114 #endif115 120 116 121 asm volatile ( … … 129 134 "ldr r0, =0x55555555\n" 130 135 "mcr p15, 0, r0, c3, c0, 0\n" 131 132 #ifdef PROCESSOR_armv7_a 133 /* Read Auxiliary control register */ 134 "mrc p15, 0, r0, c1, c0, 1\n" 135 /* Mask to enable L2 cache */ 136 "ldr r1, =0x00000002\n" 137 "orr r0, r0, r1\n" 138 /* Store Auxiliary control register */ 139 "mrc p15, 0, r0, c1, c0, 1\n" 140 #endif 136 141 137 /* Current settings */ 142 138 "mrc p15, 0, r0, c1, c0, 0\n" 143 139 144 #ifdef PROCESSOR_armv7_a 145 /* Mask to enable paging, caching */ 146 "ldr r1, =0x00000005\n" 147 #else 148 #ifdef MACHINE_gta02 149 /* Mask to enable paging (bit 0), 150 D-cache (bit 2), I-cache (bit 12) */ 151 "ldr r1, =0x00001005\n" 152 #else 153 /* Mask to enable paging */ 154 "ldr r1, =0x00000001\n" 155 #endif 156 #endif 140 /* Enable ICache, DCache, BPredictors and MMU, 141 * we disable caches before jumping to kernel 142 * so this is safe for all archs. 143 */ 144 "ldr r1, =0x00001805\n" 145 157 146 "orr r0, r0, r1\n" 147 148 /* Invalidate the TLB content before turning on the MMU. 149 * ARMv7-A Reference manual, B3.10.3 150 */ 151 "mcr p15, 0, r0, c8, c7, 0\n" 158 152 159 /* Store settings */153 /* Store settings, enable the MMU */ 160 154 "mcr p15, 0, r0, c1, c0, 0\n" 161 155 ::: "r0", "r1" … … 165 159 /** Start the MMU - initialize page table and enable paging. */ 166 160 void mmu_start() { 161 disable_paging(); 167 162 init_boot_pt(); 168 163 enable_paging();
Note:
See TracChangeset
for help on using the changeset viewer.