diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2008-04-29 03:49:04 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2008-04-29 03:49:04 +0000 |
commit | 49aed15fc23be39ef752c72c0bf29d553c3e70dd (patch) | |
tree | d3655dcbbba69c5920b90bd28cb1245821160aa4 /sys/arch/macppc | |
parent | c96e0d2a23e3dedb59f55dffa34bb4a912a09481 (diff) |
Spin up secondary CPUs on more systems.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/macppc/cpu.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index 0b2ab08fe8f..3b9b289be89 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.49 2008/04/29 00:26:11 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.50 2008/04/29 03:49:03 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -570,6 +570,8 @@ cpu_spinup(struct device *self, struct cpu_info *ci) int size = 0; char *cp; u_char *reset_cpu; + char cpuname[64]; + u_int node; /* * Allocate some contiguous pages for the interrupt stack @@ -603,18 +605,35 @@ cpu_spinup(struct device *self, struct cpu_info *ci) /* XXX OpenPIC */ { uint64_t tb; + int off; *(u_int *)EXC_RST = 0x48000002 | (u_int)cpu_spinup_trampoline; syncicache((void *)EXC_RST, 0x100); h->running = -1; - /* Start secondary CPU. */ - reset_cpu = mapiodev(0x80000000 + 0x5c, 1); - *reset_cpu = 0x4; - __asm volatile ("eieio" ::: "memory"); - *reset_cpu = 0x5; - __asm volatile ("eieio" ::: "memory"); + snprintf(cpuname, sizeof(cpuname), "/cpus/@%x", ci->ci_cpuid); + node = OF_finddevice(cpuname); + if (node == -1) { + printf(": unable to locate OF node %s\n", cpuname); + return -1; + } + if (OF_getprop(node, "soft-reset", &off, 4) == 4) { + printf(" soft-reset at %x:", off); + reset_cpu = mapiodev(0x80000000 + off, 1); + *reset_cpu = 0x4; + __asm volatile ("eieio" ::: "memory"); + *reset_cpu = 0x0; + __asm volatile ("eieio" ::: "memory"); + } else { + printf(" soft-reset not found:"); + /* Start secondary CPU. */ + reset_cpu = mapiodev(0x80000000 + 0x5c, 1); + *reset_cpu = 0x4; + __asm volatile ("eieio" ::: "memory"); + *reset_cpu = 0x0; + __asm volatile ("eieio" ::: "memory"); + } /* Sync timebase. */ tb = ppc_mftb(); |