diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-19 17:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-19 17:53:40 +0000 |
commit | 90fdb320e64210bdbea1cbe460e0fd5a61de71ad (patch) | |
tree | d58d3e0e09bd2abce80e0a9ed2d88472969ba063 /sys/arch | |
parent | c9eacd92073efd8ad00f150bc65934fcd0b10192 (diff) |
Count number of cpus found (potentially not attached) and store that
in sysctl hw.ncpufound; ok miod kettenis
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/mpbios.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mainbus.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 10 |
3 files changed, 15 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/mpbios.c b/sys/arch/amd64/amd64/mpbios.c index fcd933ca661..ea9c270d1da 100644 --- a/sys/arch/amd64/amd64/mpbios.c +++ b/sys/arch/amd64/amd64/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.16 2009/01/13 19:38:44 grange Exp $ */ +/* $OpenBSD: mpbios.c,v 1.17 2009/04/19 17:53:39 deraadt Exp $ */ /* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */ /*- @@ -692,8 +692,10 @@ mpbios_cpu(const u_int8_t *ent, struct device *self) /* check for BSP flag */ if (entry->cpu_flags & PROCENTRY_FLAG_BP) caa.cpu_role = CPU_ROLE_BP; - else + else { caa.cpu_role = CPU_ROLE_AP; + ncpusfound++; + } caa.caa_name = "cpu"; caa.cpu_number = entry->apic_id; diff --git a/sys/arch/macppc/macppc/mainbus.c b/sys/arch/macppc/macppc/mainbus.c index 17979431d74..25887a56cae 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.20 2007/10/14 17:29:04 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.21 2009/04/19 17:53:39 deraadt Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -123,6 +123,7 @@ mbattach(struct device *parent, struct device *self, void *aux) */ cpucnt = 0; + ncpusfound = 0; node = OF_finddevice("/cpus"); if (node != -1) { for (node = OF_child(node); node != 0; node = OF_peer(node)) { @@ -135,6 +136,7 @@ mbattach(struct device *parent, struct device *self, void *aux) nca.ca_reg = reg; reg[0] = cpucnt; config_found(self, &nca, mbprint); + ncpusfound++; cpucnt++; } } @@ -144,6 +146,7 @@ mbattach(struct device *parent, struct device *self, void *aux) nca.ca_bus = &sc->sc_bus; nca.ca_reg = reg; reg[0] = 0; + ncpusfound++; config_found(self, &nca, mbprint); } @@ -167,6 +170,7 @@ mbattach(struct device *parent, struct device *self, void *aux) nca.ca_bus = &sc->sc_bus; nca.ca_reg = reg; reg[0] = 1; + ncpusfound++; config_found(self, &nca, mbprint); } } diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 06cbd43b8cd..143f29289e1 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.104 2009/04/12 14:53:15 kettenis Exp $ */ +/* $OpenBSD: autoconf.c,v 1.105 2009/04/19 17:53:39 deraadt Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -215,7 +215,6 @@ str2hex(char *str, long *vp) int get_ncpus(void) { -#ifdef MULTIPROCESSOR int node, child, stack[4], depth, ncpus; char buf[32]; @@ -228,7 +227,7 @@ get_ncpus(void) if (node == 0 || node == -1) { if (--depth < 0) - return (ncpus); + goto done; stack[depth] = OF_peer(stack[depth]); continue; @@ -245,7 +244,10 @@ get_ncpus(void) stack[depth] = OF_peer(stack[depth]); } - return (0); +done: + ncpusfound = ncpus; +#ifdef MULTIPROCESSOR + return (ncpus); #else return (1); #endif |