Module Name: src Committed By: macallan Date: Thu Oct 24 23:06:25 UTC 2019
Modified Files: src/sys/arch/macppc/macppc: mainbus.c Log Message: if we have a /cpus node, use it to find and attach all CPUs. Now we find all CPUs on a 4x G5. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/macppc/mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/macppc/macppc/mainbus.c diff -u src/sys/arch/macppc/macppc/mainbus.c:1.21 src/sys/arch/macppc/macppc/mainbus.c:1.22 --- src/sys/arch/macppc/macppc/mainbus.c:1.21 Sun Jun 5 17:03:16 2011 +++ src/sys/arch/macppc/macppc/mainbus.c Thu Oct 24 23:06:25 2019 @@ -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 @@ mainbus_attach(device_t parent, device_t { 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();