From: kettenis Date: Sat, 24 Feb 2018 09:45:10 +0000 (+0000) Subject: Make ncpusfound count the available processors even if they don't attach. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b1ea6db35488525a2ffe2dd6de41eb62b59ac777;p=openbsd Make ncpusfound count the available processors even if they don't attach. ok patrick@ --- diff --git a/sys/arch/arm64/arm64/cpu.c b/sys/arch/arm64/arm64/cpu.c index de474b7cec9..b88d4e81a15 100644 --- a/sys/arch/arm64/arm64/cpu.c +++ b/sys/arch/arm64/arm64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.15 2018/02/23 19:08:56 kettenis Exp $ */ +/* $OpenBSD: cpu.c,v 1.16 2018/02/24 09:45:10 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn @@ -231,20 +231,12 @@ cpu_attach(struct device *parent, struct device *dev, void *aux) } #ifdef MULTIPROCESSOR else { - ncpusfound++; ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO); cpu_info[dev->dv_unit] = ci; ci->ci_next = cpu_info_list->ci_next; cpu_info_list->ci_next = ci; ci->ci_flags |= CPUF_AP; } -#else - else { - ncpusfound++; - printf(" mpidr %llx not configured\n", - faa->fa_reg[0].addr); - return; - } #endif ci->ci_dev = dev; diff --git a/sys/arch/arm64/dev/mainbus.c b/sys/arch/arm64/dev/mainbus.c index 474e2397b17..4205acff7a1 100644 --- a/sys/arch/arm64/dev/mainbus.c +++ b/sys/arch/arm64/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.8 2018/01/04 14:30:08 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.9 2018/02/24 09:45:10 kettenis Exp $ */ /* * Copyright (c) 2016 Patrick Wildt * Copyright (c) 2017 Mark Kettenis @@ -236,6 +236,7 @@ mainbus_attach_cpus(struct device *self, cfmatch_t match) struct mainbus_softc *sc = (struct mainbus_softc *)self; int node = OF_finddevice("/cpus"); int acells, scells; + char buf[32]; if (node == 0) return; @@ -245,8 +246,14 @@ mainbus_attach_cpus(struct device *self, cfmatch_t match) sc->sc_acells = OF_getpropint(node, "#address-cells", 2); sc->sc_scells = OF_getpropint(node, "#size-cells", 0); - for (node = OF_child(node); node != 0; node = OF_peer(node)) + ncpusfound = 0; + for (node = OF_child(node); node != 0; node = OF_peer(node)) { + if (OF_getprop(node, "device_type", buf, sizeof(buf)) > 0 && + strcmp(buf, "cpu") == 0) + ncpusfound++; + mainbus_attach_node(self, node, match); + } sc->sc_acells = acells; sc->sc_scells = scells;