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 if we have a /cpus node, use it to fi...



details:   https://anonhg.NetBSD.org/src/rev/78536a544427
branches:  trunk
changeset: 1004338:78536a544427
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Oct 24 23:06:25 2019 +0000

description:
if we have a /cpus node, use it to find and attach all CPUs.
Now we find all CPUs on a 4x G5.

diffstat:

 sys/arch/macppc/macppc/mainbus.c |  28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 9fee371ff6cf -r 78536a544427 sys/arch/macppc/macppc/mainbus.c
--- a/sys/arch/macppc/macppc/mainbus.c  Thu Oct 24 23:04:46 2019 +0000
+++ b/sys/arch/macppc/macppc/mainbus.c  Thu Oct 24 23:06:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $        */
+/*     $NetBSD: mainbus.c,v 1.22 2019/10/24 23:06:25 macallan Exp $    */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.22 2019/10/24 23:06:25 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -67,17 +67,29 @@
 {
        struct ofbus_attach_args oba;
        struct confargs ca;
-       int node, i;
+       int node, cpus, i;
        u_int32_t reg[4];
        char name[32];
 
        printf("\n");
 
-       for (i = 0; i < 2; i++) {
-               ca.ca_name = "cpu";
-               ca.ca_reg = reg;
-               reg[0] = i;
-               config_found(self, &ca, NULL);
+       cpus = OF_finddevice("/cpus");
+       if (cpus != 0) {
+               node = OF_child(cpus);
+               while (node != 0) {
+                       ca.ca_name = "cpu";
+                       ca.ca_reg = reg;
+                       ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg));
+                       config_found(self, &ca, NULL);
+                       node = OF_peer(node);
+               }                       
+       } else {
+               for (i = 0; i < 2; i++) {
+                       ca.ca_name = "cpu";
+                       ca.ca_reg = reg;
+                       reg[0] = i;
+                       config_found(self, &ca, NULL);
+               }
        }
 
        pic_finish_setup();



Home | Main Index | Thread Index | Old Index