From 907164660ad40bae0e52c14dbe6fc2d9ba10a877 Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Mon, 4 Mar 2002 07:07:10 +0000 Subject: [PATCH] Dig the information about which tlb slots were used to map the kernel out of the metadata passed by the loader. --- sys/sparc64/include/tlb.h | 3 +++ sys/sparc64/sparc64/machdep.c | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/sys/sparc64/include/tlb.h b/sys/sparc64/include/tlb.h index d3697e524e5f..db10429ed75e 100644 --- a/sys/sparc64/include/tlb.h +++ b/sys/sparc64/include/tlb.h @@ -85,6 +85,9 @@ #define MMU_SFSR_W (1L << MMU_SFSR_W_SHIFT) +extern int kernel_tlb_slots; +extern struct tte *kernel_ttes; + /* * Some tlb operations must be atomical, so no interrupt or trap can be allowed * while they are in progress. Traps should not happen, but interrupts need to diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 50e1daf733d5..3da515fd9eda 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -63,11 +63,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -98,16 +100,14 @@ #include #include #include +#include #include -#define MD_FETCH(mdp, info, type) ({ \ - type *__p; \ - __p = (type *)preload_search_info((mdp), MODINFO_METADATA | (info)); \ - __p ? *__p : 0; \ -}) - typedef int ofw_vec_t(void *); +struct tte *kernel_ttes; +int kernel_tlb_slots; + int physmem; int cold = 1; long dumplo; @@ -131,7 +131,7 @@ u_long ofw_tba; static struct timecounter tick_tc; static timecounter_get_t tick_get_timecount; -void sparc64_init(caddr_t mdp, u_int *state, u_int mid, u_int bootmid, +void sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec); void sparc64_shutdown_final(void *dummy, int howto); @@ -194,8 +194,7 @@ tick_get_timecount(struct timecounter *tc) } void -sparc64_init(caddr_t mdp, u_int *state, u_int mid, u_int bootmid, - ofw_vec_t *vec) +sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) { struct pcpu *pc; vm_offset_t end; @@ -221,6 +220,10 @@ sparc64_init(caddr_t mdp, u_int *state, u_int mid, u_int bootmid, boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); 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, + MODINFO_METADATA | MODINFOMD_DTLB); } } @@ -252,6 +255,10 @@ sparc64_init(caddr_t mdp, u_int *state, u_int mid, u_int bootmid, kdb_init(); #endif +#ifdef SMP + mp_tramp = mp_tramp_alloc(); +#endif + /* * Initialize virtual memory and calculate physmem. */ @@ -296,7 +303,8 @@ sparc64_init(caddr_t mdp, u_int *state, u_int mid, u_int bootmid, pcpu_init(pc, 0, sizeof(struct pcpu)); pc->pc_curthread = &thread0; pc->pc_curpcb = thread0.td_pcb; - pc->pc_mid = mid; + pc->pc_mid = UPA_CR_GET_MID(ldxa(0, ASI_UPA_CONFIG_REG)); + pc->pc_addr = (vm_offset_t)pcpu0; pc->pc_tlb_ctx = TLB_CTX_USER_MIN; pc->pc_tlb_ctx_min = TLB_CTX_USER_MIN; pc->pc_tlb_ctx_max = TLB_CTX_USER_MAX;