Changeset 10b890b in mainline
- Timestamp:
- 2006-07-13T22:11:26Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c6e314a
- Parents:
- a5f76758
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/boot.S
ra5f76758 r10b890b 74 74 nop 75 75 76 .align 1676 .align STACK_ALIGNMENT 77 77 initial_stack: 78 78 .space INITIAL_STACK_SIZE -
kernel/arch/sparc64/include/arch.h
ra5f76758 r10b890b 27 27 */ 28 28 29 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 36 36 #define __sparc64_ARCH_H__ 37 37 38 #include <arch/types.h> 39 40 extern void take_over_tlb_and_tt(uintptr_t base); 41 38 42 #endif 39 43 40 44 /** @} 41 45 */ 42 46 -
kernel/arch/sparc64/include/mm/asid.h
ra5f76758 r10b890b 27 27 */ 28 28 29 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __sparc64_ASID_H__36 #define __sparc64_ASID_H__35 #ifndef KERN_sparc64_ASID_H_ 36 #define KERN_sparc64_ASID_H_ 37 37 38 38 #include <arch/types.h> … … 47 47 #endif 48 48 49 49 /** @} 50 50 */ 51 -
kernel/arch/sparc64/include/trap/trap.h
ra5f76758 r10b890b 42 42 static inline void trap_switch_trap_table(void) 43 43 { 44 /* Point TBA to kernel copy of OFW'strap table. */44 /* Point TBA to kernel trap table. */ 45 45 tba_write((uint64_t) trap_table); 46 46 } -
kernel/arch/sparc64/src/mm/tlb.c
ra5f76758 r10b890b 27 27 */ 28 28 29 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 58 58 }; 59 59 60 /** Initialize ITLB and DTLB.61 *62 * The goal of this function is to disable MMU63 * so that both TLBs can be purged and new64 * kernel 4M locked entry can be installed.65 * After TLB is initialized, MMU is enabled66 * again.67 *68 * Switching MMU off imposes the requirement for69 * the kernel to run in identity mapped environment.70 */71 60 void tlb_arch_init(void) 72 61 { 73 tlb_tag_access_reg_t tag;74 tlb_data_t data;75 frame_address_t fr;76 page_address_t pg;77 78 fr.address = config.base;79 pg.address = config.base;80 81 immu_disable();82 dmmu_disable();83 84 /*85 * Demap everything, especially OpenFirmware.86 */87 itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);88 dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);89 90 /*91 * We do identity mapping of 4M-page at 4M.92 */93 tag.value = ASID_KERNEL;94 tag.vpn = pg.vpn;95 96 itlb_tag_access_write(tag.value);97 dtlb_tag_access_write(tag.value);98 99 data.value = 0;100 data.v = true;101 data.size = PAGESIZE_4M;102 data.pfn = fr.pfn;103 data.l = true;104 data.cp = 1;105 data.cv = 1;106 data.p = true;107 data.w = true;108 data.g = true;109 110 itlb_data_in_write(data.value);111 dtlb_data_in_write(data.value);112 113 /*114 * Register window traps can occur before MMU is enabled again.115 * This ensures that any such traps will be handled from116 * kernel identity mapped trap handler.117 */118 trap_switch_trap_table();119 120 tlb_invalidate_all();121 122 dmmu_enable();123 immu_enable();124 62 } 125 63 … … 280 218 } 281 219 282 /** @} 283 */ 284 220 /** @} 221 */ -
kernel/arch/sparc64/src/sparc64.c
ra5f76758 r10b890b 41 41 #include <console/console.h> 42 42 #include <arch/boot/boot.h> 43 #include <arch/arch.h> 44 #include <arch/mm/tlb.h> 45 #include <mm/asid.h> 43 46 44 47 bootinfo_t bootinfo; … … 89 92 } 90 93 94 /** Take over TLB and trap table. 95 * 96 * Initialize ITLB and DTLB and switch to kernel 97 * trap table. 98 * 99 * The goal of this function is to disable MMU 100 * so that both TLBs can be purged and new 101 * kernel 4M locked entry can be installed. 102 * After TLB is initialized, MMU is enabled 103 * again. 104 * 105 * Switching MMU off imposes the requirement for 106 * the kernel to run in identity mapped environment. 107 * 108 * @param base Base address that will be hardwired in both TLBs. 109 */ 110 void take_over_tlb_and_tt(uintptr_t base) 111 { 112 tlb_tag_access_reg_t tag; 113 tlb_data_t data; 114 frame_address_t fr; 115 page_address_t pg; 116 117 fr.address = base; 118 pg.address = base; 119 120 immu_disable(); 121 dmmu_disable(); 122 123 /* 124 * Demap everything, especially OpenFirmware. 125 */ 126 itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0); 127 dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0); 128 129 /* 130 * We do identity mapping of 4M-page at 4M. 131 */ 132 tag.value = ASID_KERNEL; 133 tag.vpn = pg.vpn; 134 135 itlb_tag_access_write(tag.value); 136 dtlb_tag_access_write(tag.value); 137 138 data.value = 0; 139 data.v = true; 140 data.size = PAGESIZE_4M; 141 data.pfn = fr.pfn; 142 data.l = true; 143 data.cp = 1; 144 data.cv = 1; 145 data.p = true; 146 data.w = true; 147 data.g = true; 148 149 itlb_data_in_write(data.value); 150 dtlb_data_in_write(data.value); 151 152 /* 153 * Register window traps can occur before MMU is enabled again. 154 * This ensures that any such traps will be handled from 155 * kernel identity mapped trap handler. 156 */ 157 trap_switch_trap_table(); 158 159 tlb_invalidate_all(); 160 161 dmmu_enable(); 162 immu_enable(); 163 } 164 91 165 /** @} 92 166 */ -
kernel/arch/sparc64/src/start.S
ra5f76758 r10b890b 41 41 * 42 42 * The registers are expected to be in this state: 43 * %o0 bootinfo structure address 44 * %o1 bootinfo structure size 43 * - %o0 bootinfo structure address 44 * - %o1 bootinfo structure size 45 * 46 * Moreover, we depend on boot having established the 47 * following environment: 48 * - TLBs are on 49 * - identity mapping for the kernel image 50 * - identity mapping for memory stack 45 51 */ 46 52 … … 66 72 nop 67 73 74 /* 75 * Take over control of identity mapping. 76 * Take over control of trap table. 77 * 78 * After this call, the kernel is entirely self-sufficient 79 * and independent on OpenFirmware. 80 */ 81 set kernel_image_start, %o0 82 call take_over_tlb_and_tt 83 nop 84 68 85 wrpr %r0, 0, %pil 69 86
Note:
See TracChangeset
for help on using the changeset viewer.