From f96eebf9085b2914dbe9dc9a9a2693483ad1114e Mon Sep 17 00:00:00 2001 From: chs Date: Sun, 17 Aug 2003 18:12:34 +0000 Subject: [PATCH] use the value of the "soft-reset" property (if it exists) to locate the reset vector (needed on my shiny new G4). from tsubai. --- sys/arch/macppc/macppc/cpu.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index 1bfbe218875c..9723f42d834f 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.35 2003/08/08 07:15:20 matt Exp $ */ +/* $NetBSD: cpu.c,v 1.36 2003/08/17 18:12:34 chs Exp $ */ /*- * Copyright (c) 2001 Tsubai Masanari. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.35 2003/08/08 07:15:20 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2003/08/17 18:12:34 chs Exp $"); #include "opt_ppcparam.h" #include "opt_multiprocessor.h" @@ -243,9 +243,11 @@ cpu_spinup(self, ci) asm volatile ("sync; isync"); if (openpic_base) { + uint64_t tb; u_int kl_base = 0x80000000; /* XXX */ u_int gpio = kl_base + 0x5c; /* XXX */ - uint64_t tb; + u_int node, off; + char cpupath[32]; *(u_int *)EXC_RST = /* ba cpu_spinup_trampoline */ 0x48000002 | (u_int)cpu_spinup_trampoline; @@ -253,6 +255,17 @@ cpu_spinup(self, ci) h->running = -1; + /* see if there's an OF property for the reset register */ + sprintf(cpupath, "/cpus/@%x", ci->ci_cpuid); + node = OF_finddevice(cpupath); + if (node == -1) { + printf(": no OF node for CPU %d?\n", ci->ci_cpuid); + return -1; + } + if (OF_getprop(node, "soft-reset", &off, 4) == 4) { + gpio = kl_base + off; + } + /* Start secondary cpu. */ out8(gpio, 4); out8(gpio, 5);