Changes in boot/arch/arm32/src/mm.c [2e55443:b5a3b50] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/mm.c
r2e55443 rb5a3b50 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 51 40 /** Check if caching can be enabled for a given memory section. 52 41 * … … 67 56 else 68 57 return 1; 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; 58 #else 59 return 0; 77 60 #endif 78 return 0;79 61 } 80 62 … … 103 85 pte->tex = 0; 104 86 pte->access_permission_1 = 0; 105 pte->shareable = 0;106 87 pte->non_global = 0; 107 88 pte->should_be_zero_2 = 0; … … 118 99 for (page = 0; page < split_page; page++) 119 100 init_ptl0_section(&boot_pt[page], page); 101 102 /* 103 * Create 1:1 virtual-physical mapping in kernel space 104 * (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_beagleboardxm 111 init_ptl0_section(&boot_pt[page], page - split_page); 112 #else 113 init_ptl0_section(&boot_pt[page], page); 114 #endif 120 115 121 116 asm volatile ( … … 134 129 "ldr r0, =0x55555555\n" 135 130 "mcr p15, 0, r0, c3, c0, 0\n" 136 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 137 141 /* Current settings */ 138 142 "mrc p15, 0, r0, c1, c0, 0\n" 139 143 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" 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 157 "orr r0, r0, r1\n" 145 158 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" 152 153 /* Store settings, enable the MMU */ 159 /* Store settings */ 154 160 "mcr p15, 0, r0, c1, c0, 0\n" 155 161 ::: "r0", "r1" … … 159 165 /** Start the MMU - initialize page table and enable paging. */ 160 166 void mmu_start() { 161 disable_paging();162 167 init_boot_pt(); 163 168 enable_paging();
Note:
See TracChangeset
for help on using the changeset viewer.