From d1550cb9388f4823ba8c189b399d734ebf8e0ba0 Mon Sep 17 00:00:00 2001 From: thorpej Date: Tue, 23 Oct 2001 22:52:14 +0000 Subject: [PATCH] For systems (like the briQ) that don't have a "/cpus", look for CPUs in the OFW top-level. --- sys/arch/ofppc/ofppc/mainbus.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/arch/ofppc/ofppc/mainbus.c b/sys/arch/ofppc/ofppc/mainbus.c index 5b53e3c5b636..32205602d203 100644 --- a/sys/arch/ofppc/ofppc/mainbus.c +++ b/sys/arch/ofppc/ofppc/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.6 2001/10/22 23:01:17 thorpej Exp $ */ +/* $NetBSD: mainbus.c,v 1.7 2001/10/23 22:52:14 thorpej Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -114,12 +114,40 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) oba.oba_phandle = node; (void) config_found(self, &oba, mainbus_print); } + } else { + /* + * No /cpus node; assume they're all children of the + * root OFW node. + */ + for (node = OF_child(OF_peer(0)); node != 0; + node = OF_peer(node)) { + if (OF_getprop(node, "device_type", + buf, sizeof(buf)) <= 0) + continue; + if (strcmp(buf, "cpu") != 0) + continue; + oba.oba_busname = "cpu"; + oba.oba_phandle = node; + (void) config_found(self, &oba, mainbus_print); + } } /* * Now attach the rest of the devices on the system. */ for (node = OF_child(OF_peer(0)); node != 0; node = OF_peer(node)) { + /* + * Make sure it's not a CPU (we've already attached + * those). + */ + if (OF_getprop(node, "device_type", + buf, sizeof(buf)) > 0 && + strcmp(buf, "cpu") == 0) + continue; + + /* + * Make sure this isn't one of our "special" child nodes. + */ OF_getprop(node, "name", buf, sizeof(buf)); for (ssp = openfirmware_special; (sp = *ssp) != NULL; ssp++) { if (strcmp(buf, sp) == 0)