Skip disabled cpus (usually service cpus without full functionality).
authorderaadt <deraadt@openbsd.org>
Sun, 20 Jun 2021 16:51:37 +0000 (16:51 +0000)
committerderaadt <deraadt@openbsd.org>
Sun, 20 Jun 2021 16:51:37 +0000 (16:51 +0000)
cpumatch will also ignore them, but skipping them here avoids increment
of hw.cpusfound
ok jsg

sys/arch/riscv64/dev/mainbus.c

index 75b72e9..d68acbd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mainbus.c,v 1.7 2021/05/14 06:48:52 jsg Exp $ */
+/*     $OpenBSD: mainbus.c,v 1.8 2021/06/20 16:51:37 deraadt Exp $ */
 
 /*
  * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
@@ -303,6 +303,10 @@ mainbus_attach_cpus(struct device *self, cfmatch_t match)
 
        ncpusfound = 0;
        for (node = OF_child(node); node != 0; node = OF_peer(node)) {
+               if (OF_getprop(node, "status", buf, sizeof(buf)) > 0 &&
+                   strcmp(buf, "disabled") == 0)
+                       continue;
+
                if (OF_getprop(node, "device_type", buf, sizeof(buf)) > 0 &&
                    strcmp(buf, "cpu") == 0)
                        ncpusfound++;