svn commit: r193909 - in head/sys/powerpc: aim powerpc
Peter Grehan
grehan at FreeBSD.org
Wed Jun 10 12:47:55 UTC 2009
Author: grehan
Date: Wed Jun 10 12:47:54 2009
New Revision: 193909
URL: http://svn.freebsd.org/changeset/base/193909
Log:
Get the gdb/psim emulator functioning again.
aim/machdep.c:
- the RI status register bit needs to be set when doing the mtmsrd 64-bit
instruction test
- psim doesn't implement the dcbz instruction so the run-time cacheline
test fails. Set the cachline size to 32 to avoid infinite loops in
future calls to __syncicache()
aim/platform_chrp.c:
- if after iterating through / and a name property of "cpus" still isn't
found, just search directly for '/cpus'.
- psim doesn't put a "reg" property on it's cpu nodes, so assume 0
since it is uniprocessor-only at this point
powerpc/openpic.c
- the number of CPUs reported is 1 too many on psim's openpic
Reviewed by: nwhitehorn
MFC after: 1 week (openpic part)
Modified:
head/sys/powerpc/aim/machdep.c
head/sys/powerpc/aim/platform_chrp.c
head/sys/powerpc/powerpc/openpic.c
Modified: head/sys/powerpc/aim/machdep.c
==============================================================================
--- head/sys/powerpc/aim/machdep.c Wed Jun 10 12:20:11 2009 (r193908)
+++ head/sys/powerpc/aim/machdep.c Wed Jun 10 12:47:54 2009 (r193909)
@@ -359,7 +359,7 @@ powerpc_init(u_int startkernel, u_int en
*/
msr = mfmsr();
- mtmsr(msr & ~(PSL_IR | PSL_DR));
+ mtmsr((msr & ~(PSL_IR | PSL_DR)) | PSL_RI);
isync();
/*
@@ -380,6 +380,12 @@ powerpc_init(u_int startkernel, u_int en
for (cacheline_size = 0; cacheline_size < 0x100 &&
cache_check[cacheline_size] == 0; cacheline_size++);
+ /* Work around psim bug */
+ if (cacheline_size == 0) {
+ printf("WARNING: cacheline size undetermined, setting to 32\n");
+ cacheline_size = 32;
+ }
+
/*
* Figure out whether we need to use the 64 bit PMAP. This works by
* executing an instruction that is only legal on 64-bit PPC (mtmsrd),
Modified: head/sys/powerpc/aim/platform_chrp.c
==============================================================================
--- head/sys/powerpc/aim/platform_chrp.c Wed Jun 10 12:20:11 2009 (r193908)
+++ head/sys/powerpc/aim/platform_chrp.c Wed Jun 10 12:47:54 2009 (r193909)
@@ -102,7 +102,7 @@ static u_long
chrp_timebase_freq(platform_t plat, struct cpuref *cpuref)
{
phandle_t phandle;
- u_long ticks = -1;
+ long ticks = -1;
phandle = cpuref->cr_hwref;
@@ -122,8 +122,14 @@ chrp_smp_fill_cpuref(struct cpuref *cpur
cpuref->cr_hwref = cpu;
res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid));
- if (res < 0)
- return (ENOENT);
+
+ /*
+ * psim doesn't have a reg property, so assume 0 as for the
+ * uniprocessor case in the CHRP spec.
+ */
+ if (res < 0) {
+ cpuid = 0;
+ }
cpuref->cr_cpuid = cpuid & 0xff;
return (0);
@@ -145,10 +151,18 @@ chrp_smp_first_cpu(platform_t plat, stru
break;
dev = OF_peer(dev);
}
- if (dev == 0)
- return (ENOENT);
+ if (dev == 0) {
+ /*
+ * psim doesn't have a name property on the /cpus node,
+ * but it can be found directly
+ */
+ dev = OF_finddevice("/cpus");
+ if (dev == 0)
+ return (ENOENT);
+ }
cpu = OF_child(dev);
+
while (cpu != 0) {
res = OF_getprop(cpu, "device_type", buf, sizeof(buf));
if (res > 0 && strcmp(buf, "cpu") == 0)
Modified: head/sys/powerpc/powerpc/openpic.c
==============================================================================
--- head/sys/powerpc/powerpc/openpic.c Wed Jun 10 12:20:11 2009 (r193908)
+++ head/sys/powerpc/powerpc/openpic.c Wed Jun 10 12:47:54 2009 (r193909)
@@ -122,10 +122,12 @@ openpic_attach(device_t dev)
OPENPIC_FEATURE_LAST_IRQ_SHIFT) + 1;
/*
- * PSIM seems to report 1 too many IRQs
+ * PSIM seems to report 1 too many IRQs and CPUs
*/
- if (sc->sc_psim)
+ if (sc->sc_psim) {
sc->sc_nirq--;
+ sc->sc_ncpu--;
+ }
if (bootverbose)
device_printf(dev,
More information about the svn-src-head
mailing list