diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/sparc64/loader/locore.S | 2 | ||||
-rw-r--r-- | sys/boot/sparc64/loader/main.c | 21 | ||||
-rw-r--r-- | sys/boot/sparc64/loader/metadata.c | 13 | ||||
-rw-r--r-- | sys/sparc64/include/metadata.h | 5 | ||||
-rw-r--r-- | sys/sparc64/include/tlb.h | 4 | ||||
-rw-r--r-- | sys/sparc64/sparc64/machdep.c | 4 | ||||
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 5 |
7 files changed, 31 insertions, 23 deletions
diff --git a/sys/boot/sparc64/loader/locore.S b/sys/boot/sparc64/loader/locore.S index 9ad5346..c1b3e2b 100644 --- a/sys/boot/sparc64/loader/locore.S +++ b/sys/boot/sparc64/loader/locore.S @@ -92,7 +92,6 @@ ENTRY(dtlb_va_to_pa) ENTRY(itlb_enter) rdpr %pstate, %o4 wrpr %o4, PSTATE_IE, %pstate - sllx %o0, PAGE_SHIFT, %o0 mov AA_IMMU_TAR, %o3 stxa %o0, [%o3] ASI_IMMU stxa %o1, [%g0] ASI_ITLB_DATA_IN_REG @@ -103,7 +102,6 @@ ENTRY(itlb_enter) ENTRY(dtlb_enter) rdpr %pstate, %o4 wrpr %o4, PSTATE_IE, %pstate - sllx %o0, PAGE_SHIFT, %o0 mov AA_DMMU_TAR, %o3 stxa %o0, [%o3] ASI_DMMU stxa %o1, [%g0] ASI_DTLB_DATA_IN_REG diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index c07f138..3d6fffb 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -63,8 +63,8 @@ static int mmu_mapin(vm_offset_t, vm_size_t); char __progname[] = "FreeBSD/sparc64 loader"; -struct tte *dtlb_store; -struct tte *itlb_store; +struct tlb_entry *dtlb_store; +struct tlb_entry *itlb_store; int dtlb_slot; int itlb_slot; @@ -240,7 +240,7 @@ static int mmu_mapin(vm_offset_t va, vm_size_t len) { vm_offset_t pa, mva; - struct tte tte; + u_long data; if (va + len > curkva) curkva = va + len; @@ -275,13 +275,16 @@ mmu_mapin(vm_offset_t va, vm_size_t len) 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 | + 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(tte.tte_vpn, tte.tte_data); - itlb_enter(tte.tte_vpn, tte.tte_data); + dtlb_store[dtlb_slot].te_pa = pa; + dtlb_store[dtlb_slot].te_va = va; + itlb_store[itlb_slot].te_pa = pa; + itlb_store[itlb_slot].te_va = va; + dtlb_slot++; + itlb_slot++; + dtlb_enter(va, data); + itlb_enter(va, data); pa = (vm_offset_t)-1; } len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len; diff --git a/sys/boot/sparc64/loader/metadata.c b/sys/boot/sparc64/loader/metadata.c index bb2e47e..88364e3 100644 --- a/sys/boot/sparc64/loader/metadata.c +++ b/sys/boot/sparc64/loader/metadata.c @@ -31,15 +31,14 @@ #include <sys/param.h> #include <sys/reboot.h> #include <sys/linker.h> -#include <machine/tte.h> #include <machine/metadata.h> #include "bootstrap.h" #include "libofw.h" -extern struct tte *dtlb_store; -extern struct tte *itlb_store; +extern struct tlb_entry *dtlb_store; +extern struct tlb_entry *itlb_store; extern int dtlb_slot; extern int itlb_slot; @@ -318,10 +317,10 @@ md_load(char *args, vm_offset_t *modulep) file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); 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); - file_addmetadata(kfp, MODINFOMD_ITLB, itlb_slots * sizeof(struct tte), - itlb_store); + file_addmetadata(kfp, MODINFOMD_DTLB, + dtlb_slots * sizeof(*dtlb_store), dtlb_store); + file_addmetadata(kfp, MODINFOMD_ITLB, + itlb_slots * sizeof(*itlb_store), itlb_store); *modulep = addr; size = md_copymodules(0); diff --git a/sys/sparc64/include/metadata.h b/sys/sparc64/include/metadata.h index 11f99c7..a475403 100644 --- a/sys/sparc64/include/metadata.h +++ b/sys/sparc64/include/metadata.h @@ -37,6 +37,11 @@ #define MODINFOMD_DTLB 0x1006 #define MODINFOMD_ITLB 0x1007 +struct tlb_entry { + vm_offset_t te_pa; + vm_offset_t te_va; +}; + #define MD_FETCH(mdp, info, type) ({ \ type *__p; \ __p = (type *)preload_search_info((mdp), MODINFO_METADATA | (info)); \ diff --git a/sys/sparc64/include/tlb.h b/sys/sparc64/include/tlb.h index d92af31..126af86 100644 --- a/sys/sparc64/include/tlb.h +++ b/sys/sparc64/include/tlb.h @@ -80,8 +80,10 @@ #define MMU_SFSR_W (1L << MMU_SFSR_W_SHIFT) +struct tlb_entry; + extern int kernel_tlb_slots; -extern struct tte *kernel_ttes; +extern struct tlb_entry *kernel_tlbs; void tlb_context_demap(struct pmap *pm); void tlb_page_demap(u_int tlb, struct pmap *pm, vm_offset_t va); diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 962929b..477e745 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -107,7 +107,7 @@ typedef int ofw_vec_t(void *); -struct tte *kernel_ttes; +struct tlb_entry *kernel_tlbs; int kernel_tlb_slots; int physmem; @@ -229,7 +229,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); kernel_tlb_slots = MD_FETCH(kmdp, MODINFOMD_DTLB_SLOTS, int); - kernel_ttes = (struct tte *)preload_search_info(kmdp, + kernel_tlbs = (void *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_DTLB); } } diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 27b4ae2..8ef2eb8 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -94,6 +94,7 @@ #include <machine/cache.h> #include <machine/frame.h> #include <machine/md_var.h> +#include <machine/metadata.h> #include <machine/pv.h> #include <machine/smp.h> #include <machine/tlb.h> @@ -310,8 +311,8 @@ pmap_bootstrap(vm_offset_t ekva) * pmap_kextract() will work for them. */ for (i = 0; i < kernel_tlb_slots; i++) { - va = TTE_GET_VA(&kernel_ttes[i]); - pa = TTE_GET_PA(&kernel_ttes[i]); + pa = kernel_tlbs[i].te_pa; + va = kernel_tlbs[i].te_va; for (off = 0; off < PAGE_SIZE_4M; off += PAGE_SIZE) { tp = tsb_kvtotte(va + off); tp->tte_vpn = TV_VPN(va + off); |