diff --git a/sys/boot/sparc64/loader/locore.S b/sys/boot/sparc64/loader/locore.S index 920171a34a1e..9ad5346be692 100644 --- a/sys/boot/sparc64/loader/locore.S +++ b/sys/boot/sparc64/loader/locore.S @@ -86,18 +86,16 @@ ENTRY(dtlb_va_to_pa) not %o0 /* - * %o0 = slot number - * %o1 = vpn - * %o2 = tte data + * %o0 = vpn + * %o1 = tte data */ ENTRY(itlb_enter) rdpr %pstate, %o4 wrpr %o4, PSTATE_IE, %pstate - sllx %o0, 3, %o0 - sllx %o1, PAGE_SHIFT, %o1 + sllx %o0, PAGE_SHIFT, %o0 mov AA_IMMU_TAR, %o3 - stxa %o1, [%o3] ASI_IMMU - stxa %o2, [%o0] ASI_ITLB_DATA_ACCESS_REG + stxa %o0, [%o3] ASI_IMMU + stxa %o1, [%g0] ASI_ITLB_DATA_IN_REG membar #Sync retl wrpr %o4, 0, %pstate @@ -105,11 +103,10 @@ ENTRY(itlb_enter) ENTRY(dtlb_enter) rdpr %pstate, %o4 wrpr %o4, PSTATE_IE, %pstate - sllx %o0, 3, %o0 - sllx %o1, PAGE_SHIFT, %o1 + sllx %o0, PAGE_SHIFT, %o0 mov AA_DMMU_TAR, %o3 - stxa %o1, [%o3] ASI_DMMU - stxa %o2, [%o0] ASI_DTLB_DATA_ACCESS_REG + stxa %o0, [%o3] ASI_DMMU + stxa %o1, [%g0] ASI_DTLB_DATA_IN_REG membar #Sync retl wrpr %o4, 0, %pstate diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index b85286b3a74f..a73b6c0c255c 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -52,8 +52,8 @@ struct memory_slice { typedef void kernel_entry_t(vm_offset_t mdp, u_long o1, u_long o2, u_long o3, void *openfirmware); -extern void itlb_enter(int slot, u_long vpn, u_long data); -extern void dtlb_enter(int slot, u_long vpn, u_long data); +extern void itlb_enter(u_long vpn, u_long data); +extern void dtlb_enter(u_long vpn, u_long data); extern vm_offset_t itlb_va_to_pa(vm_offset_t); extern vm_offset_t dtlb_va_to_pa(vm_offset_t); extern vm_offset_t md_load(char *, vm_offset_t *); @@ -242,10 +242,6 @@ mmu_mapin(vm_offset_t va, vm_size_t len) vm_offset_t pa, mva; struct tte tte; - if (dtlb_slot < 0) - panic("mmu_mapin: out of dtlb_slots"); - if (itlb_slot < 0) - panic("mmu_mapin: out of itlb_slots"); if (va + len > curkva) curkva = va + len; @@ -271,13 +267,21 @@ mmu_mapin(vm_offset_t va, vm_size_t len) /* The mappings may have changed, be paranoid. */ continue; } + /* + * Actually, we can only allocate two pages less at + * most (depending on the kernel TSB size). + */ + if (dtlb_slot >= dtlb_slot_max) + panic("mmu_mapin: out of dtlb_slots"); + if (itlb_slot >= itlb_slot_max) + panic("mmu_mapin: out of itlb_slots"); tte.tte_vpn = TV_VPN(va); tte.tte_data = TD_V | TD_4M | TD_PA(pa) | TD_L | TD_CP | TD_CV | TD_P | TD_W; - dtlb_store[--dtlb_slot] = tte; - itlb_store[--itlb_slot] = tte; - dtlb_enter(dtlb_slot, tte.tte_vpn, tte.tte_data); - itlb_enter(itlb_slot, tte.tte_vpn, tte.tte_data); + dtlb_store[dtlb_slot++] = tte; + itlb_store[itlb_slot++] = tte; + dtlb_enter(tte.tte_vpn, tte.tte_data); + itlb_enter(tte.tte_vpn, tte.tte_data); pa = (vm_offset_t)-1; } len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len; @@ -336,8 +340,6 @@ tlb_init(void) itlb_store = malloc(itlb_slot_max * sizeof(*itlb_store)); if (dtlb_store == NULL || itlb_store == NULL) panic("init_tlb: malloc"); - dtlb_slot = dtlb_slot_max; - itlb_slot = itlb_slot_max; } int diff --git a/sys/boot/sparc64/loader/metadata.c b/sys/boot/sparc64/loader/metadata.c index e5307924c719..bb2e47e151c5 100644 --- a/sys/boot/sparc64/loader/metadata.c +++ b/sys/boot/sparc64/loader/metadata.c @@ -319,9 +319,9 @@ md_load(char *args, vm_offset_t *modulep) file_addmetadata(kfp, MODINFOMD_DTLB_SLOTS, sizeof dtlb_slots, &dtlb_slots); file_addmetadata(kfp, MODINFOMD_ITLB_SLOTS, sizeof itlb_slots, &itlb_slots); file_addmetadata(kfp, MODINFOMD_DTLB, dtlb_slots * sizeof(struct tte), - &dtlb_store[dtlb_slot]); + dtlb_store); file_addmetadata(kfp, MODINFOMD_ITLB, itlb_slots * sizeof(struct tte), - &itlb_store[itlb_slot]); + itlb_store); *modulep = addr; size = md_copymodules(0);