Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2008 04:12:54 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 137679 for review
Message-ID:  <200803140412.m2E4CsWW080922@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=137679

Change 137679 by marcel@marcel_xcllnt on 2008/03/14 04:12:39

	Make the soft reset of the AP work. We actually get to
	the EXC_RST vector on the second CPU:
	
	Waking up CPU 1 (dev=ff880bc8)
	XXX: 48000015 00000000 00000000 00000000 00000000 7c6802a6
	XXX: 48000015 00000104 00043010 0000c000 00001000 7c6802a6
	
	Most importantly: MSR=PSL_ME

Affected files ...

.. //depot/projects/powerpc/sys/powerpc/aim/mp_cpudep.c#2 edit

Differences ...

==== //depot/projects/powerpc/sys/powerpc/aim/mp_cpudep.c#2 (text+ko) ====

@@ -38,10 +38,13 @@
 #include <machine/cpu.h>
 #include <machine/intr_machdep.h>
 #include <machine/smp.h>
+#include <machine/trap_aim.h>
 
 #include <dev/ofw/openfirm.h>
 #include <machine/ofw_machdep.h>
 
+extern void *rstcode;
+
 static int
 powerpc_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu)
 {
@@ -127,10 +130,25 @@
 	return (powerpc_smp_fill_cpuref(cpuref, bsp));
 }
 
+static void
+dump_rstvec(void)
+{
+	uint32_t buf[6];
+
+	mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
+	isync();
+	bcopy((void *)EXC_RST, buf, sizeof(buf));
+	mtmsr(mfmsr() | PSL_IR | PSL_DR);
+
+	printf("XXX: %08x %08x %08x %08x %08x %08x\n", buf[0], buf[1], buf[2],
+	    buf[3], buf[4], buf[5]);
+}
+
 int
 powerpc_smp_start_cpu(struct pcpu *pc)
 {
 	phandle_t cpu;
+	volatile uint8_t *rstvec;
 	int res, reset;
 
 	cpu = pc->pc_hwref;
@@ -138,8 +156,19 @@
 	if (res < 0)
 		return (ENXIO);
 
-	printf("XXX: reset=%d\n", reset);
-	*(u_char *)(0x80000000 + reset) = 4;
-	*(u_char *)(0x80000000 + reset) = 5;
+	dump_rstvec();
+
+	rstvec = (uint8_t *)(0x80000000 + reset);
+
+	*rstvec = 4;
+	__asm __volatile("sync");
+	DELAY(1);
+	*rstvec = 0;
+	__asm __volatile("sync");
+
+	DELAY(1000);
+
+	dump_rstvec();
+
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803140412.m2E4CsWW080922>