summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-09-16 16:33:36 +0000
committermarcel <marcel@FreeBSD.org>2008-09-16 16:33:36 +0000
commit9ed4f7cf0478765954b1294880c1323251fd3493 (patch)
tree3da57d7eb0a5d4c12541cddff024ccd01edaf192 /sys/powerpc
parent253d17b642369be8e775e89b22e66237b0ea1d3c (diff)
downloadFreeBSD-src-9ed4f7cf0478765954b1294880c1323251fd3493.zip
FreeBSD-src-9ed4f7cf0478765954b1294880c1323251fd3493.tar.gz
o Synchronize the APs timebase and decrementer values with the BSP.
o Don't set/get the PIR register. It's CPU dependent. o Also initialize pcpup->pc_curpcb, in case it's dereferenced.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/mp_machdep.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c
index 3e32e43..12962fb 100644
--- a/sys/powerpc/powerpc/mp_machdep.c
+++ b/sys/powerpc/powerpc/mp_machdep.c
@@ -48,6 +48,7 @@ extern struct pcpu __pcpu[MAXCPU];
volatile static int ap_awake;
volatile static u_int ap_state;
volatile static uint32_t ap_decr;
+volatile static uint32_t ap_tbl;
int mp_ipi_test = 0;
@@ -55,19 +56,21 @@ void
machdep_ap_bootstrap(void)
{
- // __asm __volatile("mtspr 1023,%0" :: "r"(PCPU_GET(cpuid)));
- __asm __volatile("mfspr %0,1023" : "=r"(pcpup->pc_pir));
pcpup->pc_awake = 1;
while (ap_state == 0)
;
+ mtspr(SPR_TBL, 0);
+ mtspr(SPR_TBU, 0);
+ mtspr(SPR_TBL, ap_tbl);
__asm __volatile("mtdec %0" :: "r"(ap_decr));
ap_awake++;
/* Initialize curthread. */
PCPU_SET(curthread, PCPU_GET(idlethread));
+ PCPU_SET(curpcb, curthread->td_pcb);
mtmsr(mfmsr() | PSL_EE);
sched_throw(NULL);
@@ -202,8 +205,16 @@ cpu_mp_unleash(void *dummy)
}
ap_awake = 1;
+
+ __asm __volatile("mftb %0" : "=r"(ap_tbl));
+ ap_tbl += 10;
__asm __volatile("mfdec %0" : "=r"(ap_decr));
ap_state++;
+ powerpc_sync();
+
+ mtspr(SPR_TBL, 0);
+ mtspr(SPR_TBU, 0);
+ mtspr(SPR_TBL, ap_tbl);
while (ap_awake < smp_cpus)
;
OpenPOWER on IntegriCloud