Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/macppc use the value of the "soft-reset" pro...



details:   https://anonhg.NetBSD.org/src/rev/6917cf335dc9
branches:  trunk
changeset: 550686:6917cf335dc9
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Aug 17 18:12:34 2003 +0000

description:
use the value of the "soft-reset" property (if it exists) to locate
the reset vector (needed on my shiny new G4).  from tsubai.

diffstat:

 sys/arch/macppc/macppc/cpu.c |  19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 7ceec9c5013d -r 6917cf335dc9 sys/arch/macppc/macppc/cpu.c
--- a/sys/arch/macppc/macppc/cpu.c      Sun Aug 17 18:10:09 2003 +0000
+++ b/sys/arch/macppc/macppc/cpu.c      Sun Aug 17 18:12:34 2003 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
        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 @@
 
                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);



Home | Main Index | Thread Index | Old Index