Changeset f6f22cdb in mainline for boot/arch/sparc32/src/mm.c
- Timestamp:
- 2013-12-27T18:45:56Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 32e8cd1
- Parents:
- e47ed05
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc32/src/mm.c
re47ed05 rf6f22cdb 50 50 #include <inflate.h> 51 51 52 #define OFF2SEC(_addr)((_addr) >> PTL0_SHIFT)53 #define SEC2OFF(_sec)((_sec) << PTL0_SHIFT)52 #define OFF2SEC(_addr) ((_addr) >> PTL0_SHIFT) 53 #define SEC2OFF(_sec) ((_sec) << PTL0_SHIFT) 54 54 55 55 static section_mapping_t mappings[] = { … … 60 60 }; 61 61 62 extern uintptr_t boot_ctx_table; 63 64 static void mmu_enable() 62 static void mmu_enable(void) 65 63 { 66 boot_ctx_table = ((uintptr_t) &boot_pt[0] >> 4) | PTE_ET_DESCRIPTOR;67 64 boot_ctx_table = ((uintptr_t) &boot_pt[0] >> 4) | PTE_ET_DESCRIPTOR; 65 68 66 /* Set Context Table Pointer register */ 69 asi_u32_write(ASI_MMUREGS, 0x100, ((uint32_t) &boot_ctx_table) >> 4);70 67 asi_u32_write(ASI_MMUREGS, 0x100, ((uint32_t) &boot_ctx_table) >> 4); 68 71 69 /* Select context 0 */ 72 70 asi_u32_write(ASI_MMUREGS, 0x200, 0); 73 71 74 72 /* Enable MMU */ 75 73 uint32_t cr = asi_u32_read(ASI_MMUREGS, 0x000); … … 85 83 } 86 84 87 void mmu_init( )85 void mmu_init(void) 88 86 { 89 87 mmu_disable(); 90 91 for ( int i = 0; mappings[i].size != 0; i++) {92 int ptr = 0;93 for (uint32_t sec = OFF2SEC(mappings[i].va); 94 95 88 89 for (unsigned int i = 0; mappings[i].size != 0; i++) { 90 unsigned int ptr = 0; 91 for (uint32_t sec = OFF2SEC(mappings[i].va); 92 sec < OFF2SEC(mappings[i].va + mappings[i].size); 93 sec++) { 96 94 boot_pt[sec].ppn = ((mappings[i].pa + SEC2OFF(ptr++)) >> 12) & 0xffffff; 97 95 boot_pt[sec].cacheable = mappings[i].cacheable; … … 100 98 } 101 99 } 102 100 103 101 mmu_enable(); 104 102 }
Note:
See TracChangeset
for help on using the changeset viewer.