diff options
-rw-r--r-- | sys/sparc64/include/pcpu.h | 1 | ||||
-rw-r--r-- | sys/sparc64/include/tlb.h | 3 | ||||
-rw-r--r-- | sys/sparc64/sparc64/machdep.c | 35 | ||||
-rw-r--r-- | sys/sparc64/sparc64/mp_machdep.c | 3 | ||||
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 2 | ||||
-rw-r--r-- | sys/sparc64/sparc64/tlb.c | 5 |
6 files changed, 29 insertions, 20 deletions
diff --git a/sys/sparc64/include/pcpu.h b/sys/sparc64/include/pcpu.h index 24d16cf..cb0033b 100644 --- a/sys/sparc64/include/pcpu.h +++ b/sys/sparc64/include/pcpu.h @@ -52,6 +52,7 @@ struct vmspace; struct vmspace *pc_vmspace; \ vm_offset_t pc_addr; \ u_int pc_mid; \ + u_int pc_node; \ u_int pc_tlb_ctx; \ u_int pc_tlb_ctx_max; \ u_int pc_tlb_ctx_min; \ diff --git a/sys/sparc64/include/tlb.h b/sys/sparc64/include/tlb.h index da5f532..8c6ce1a 100644 --- a/sys/sparc64/include/tlb.h +++ b/sys/sparc64/include/tlb.h @@ -88,7 +88,8 @@ struct tlb_entry; extern int kernel_tlb_slots; extern struct tlb_entry *kernel_tlbs; -extern int tlb_slot_count; +extern int tlb_dtlb_entries; +extern int tlb_itlb_entries; void tlb_context_demap(struct pmap *pm); void tlb_page_demap(struct pmap *pm, vm_offset_t va); diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index aef5212..196f067 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -144,22 +144,9 @@ CTASSERT(sizeof(struct pcpu) <= ((PCPU_PAGES * PAGE_SIZE) / 2)); static void cpu_startup(void *arg) { - phandle_t child; - phandle_t root; - char type[8]; u_int clock; - root = OF_peer(0); - for (child = OF_child(root); child != 0; child = OF_peer(child)) { - OF_getprop(child, "device_type", type, sizeof(type)); - if (strcmp(type, "cpu") == 0) - break; - } - if (child == 0) - panic("cpu_startup: no cpu\n"); - OF_getprop(child, "clock-frequency", &clock, sizeof(clock)); - OF_getprop(child, "#dtlb-entries", &tlb_slot_count, - sizeof(tlb_slot_count)); + OF_getprop(PCPU_GET(node), "clock-frequency", &clock, sizeof(clock)); tick_tc.tc_get_timecount = tick_get_timecount; tick_tc.tc_poll_pps = NULL; @@ -169,7 +156,6 @@ cpu_startup(void *arg) tc_init(&tick_tc); cpu_identify(rdpr(ver), clock, PCPU_GET(cpuid)); - cache_init(child); vm_ksubmap_init(&kmi); @@ -205,10 +191,13 @@ tick_get_timecount(struct timecounter *tc) void sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) { + phandle_t child; + phandle_t root; struct pcpu *pc; vm_offset_t end; vm_offset_t va; caddr_t kmdp; + char type[8]; end = 0; kmdp = NULL; @@ -260,6 +249,21 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) end = (vm_offset_t)_end; } + root = OF_peer(0); + for (child = OF_child(root); child != 0; child = OF_peer(child)) { + OF_getprop(child, "device_type", type, sizeof(type)); + if (strcmp(type, "cpu") == 0) + break; + } + if (child == 0) + panic("cpu_startup: no cpu\n"); + OF_getprop(child, "#dtlb-entries", &tlb_dtlb_entries, + sizeof(tlb_dtlb_entries)); + OF_getprop(child, "#itlb-entries", &tlb_itlb_entries, + sizeof(tlb_itlb_entries)); + + cache_init(child); + #ifdef DDB kdb_init(); #endif @@ -314,6 +318,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) pc->pc_curpcb = thread0.td_pcb; pc->pc_mid = UPA_CR_GET_MID(ldxa(0, ASI_UPA_CONFIG_REG)); pc->pc_addr = (vm_offset_t)pcpu0; + pc->pc_node = child; 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; diff --git a/sys/sparc64/sparc64/mp_machdep.c b/sys/sparc64/sparc64/mp_machdep.c index 6fc1750..b5837ba 100644 --- a/sys/sparc64/sparc64/mp_machdep.c +++ b/sys/sparc64/sparc64/mp_machdep.c @@ -264,6 +264,7 @@ cpu_mp_start(void) pcpu_init(pc, cpuid, sizeof(*pc)); pc->pc_addr = va; pc->pc_mid = mid; + pc->pc_node = child; all_cpus |= 1 << cpuid; } @@ -344,7 +345,7 @@ cpu_mp_bootstrap(struct pcpu *pc) * we flush all mappings with a tag of zero, regardless of the lock * and/or valid bits. */ - for (i = 0; i < tlb_slot_count; i++) { + for (i = 0; i < tlb_dtlb_entries; i++) { tag = ldxa(TLB_DAR_SLOT(i), ASI_DTLB_TAG_READ_REG); if (tag == 0) stxa_sync(TLB_DAR_SLOT(i), ASI_DTLB_DATA_ACCESS_REG, 0); diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index fe96c23..3b19bce 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -535,7 +535,7 @@ pmap_context_rollover(void) mtx_assert(&sched_lock, MA_OWNED); CTR0(KTR_PMAP, "pmap_context_rollover"); - for (i = 0; i < tlb_slot_count; i++) { + for (i = 0; i < tlb_dtlb_entries; i++) { /* XXX - cheetah */ data = ldxa(TLB_DAR_SLOT(i), ASI_DTLB_DATA_ACCESS_REG); tag = ldxa(TLB_DAR_SLOT(i), ASI_DTLB_TAG_READ_REG); diff --git a/sys/sparc64/sparc64/tlb.c b/sys/sparc64/sparc64/tlb.c index 982527c..b5e53cf 100644 --- a/sys/sparc64/sparc64/tlb.c +++ b/sys/sparc64/sparc64/tlb.c @@ -39,7 +39,8 @@ #include <machine/smp.h> #include <machine/tlb.h> -int tlb_slot_count; +int tlb_dtlb_entries; +int tlb_itlb_entries; /* * Some tlb operations must be atomic, so no interrupt or trap can be allowed @@ -144,7 +145,7 @@ tlb_dump(void) u_long tag; int slot; - for (slot = 0; slot < tlb_slot_count; slot++) { + for (slot = 0; slot < tlb_dtlb_entries; slot++) { data = ldxa(TLB_DAR_SLOT(slot), ASI_DTLB_DATA_ACCESS_REG); if ((data & TD_V) != 0) { tag = ldxa(TLB_DAR_SLOT(slot), ASI_DTLB_TAG_READ_REG); |