Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Do not try to attach more ACPI CPUs than the am...



details:   https://anonhg.NetBSD.org/src/rev/1b4d66ac727c
branches:  trunk
changeset: 760793:1b4d66ac727c
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Jan 13 04:18:19 2011 +0000

description:
Do not try to attach more ACPI CPUs than the amount of "real" CPUs.

diffstat:

 sys/dev/acpi/acpi.c     |  22 +++++++++++++---------
 sys/dev/acpi/acpi_cpu.c |   7 +++++--
 2 files changed, 18 insertions(+), 11 deletions(-)

diffs (101 lines):

diff -r ac854bce2757 -r 1b4d66ac727c sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Thu Jan 13 03:45:38 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Thu Jan 13 04:18:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.230 2011/01/11 20:35:24 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.231 2011/01/13 04:18:19 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.230 2011/01/11 20:35:24 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.231 2011/01/13 04:18:19 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -149,15 +149,15 @@
 #endif
 
 /*
- * This is a flag we set when the ACPI subsystem is active.  Machine
- * dependent code may wish to skip other steps (such as attaching
+ * The acpi_active variable is set when the ACPI subsystem is active.
+ * Machine-dependent code may wish to skip other steps (such as attaching
  * subsystems that ACPI supercedes) when ACPI is active.
  */
-int    acpi_active;
-
-int    acpi_force_load = 0;
-int    acpi_suspended = 0;
-int    acpi_verbose_loaded = 0;
+uint32_t       acpi_cpus = 0;
+int            acpi_active = 0;
+int            acpi_suspended = 0;
+int            acpi_force_load = 0;
+int            acpi_verbose_loaded = 0;
 
 struct acpi_softc      *acpi_softc;
 static uint64_t                 acpi_root_pointer;
@@ -847,6 +847,7 @@
 static void
 acpi_rescan_nodes(struct acpi_softc *sc)
 {
+       const uint32_t ncpus = acpi_md_ncpus();
        struct acpi_attach_args aa;
        struct acpi_devnode *ad;
        ACPI_DEVICE_INFO *di;
@@ -883,6 +884,9 @@
                if (di->Type == ACPI_TYPE_POWER)
                        continue;
 
+               if (di->Type == ACPI_TYPE_PROCESSOR && acpi_cpus >= ncpus)
+                       continue;
+
                if (acpi_match_hid(di, acpi_early_ids) != 0)
                        continue;
 
diff -r ac854bce2757 -r 1b4d66ac727c sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Thu Jan 13 03:45:38 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Thu Jan 13 04:18:19 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.24 2010/12/30 12:05:02 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.25 2011/01/13 04:18:19 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.24 2010/12/30 12:05:02 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.25 2011/01/13 04:18:19 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -66,6 +66,7 @@
 static bool              acpicpu_suspend(device_t, const pmf_qual_t *);
 static bool              acpicpu_resume(device_t, const pmf_qual_t *);
 
+extern uint32_t                  acpi_cpus;
 struct acpicpu_softc   **acpicpu_sc = NULL;
 static struct sysctllog         *acpicpu_log = NULL;
 static bool              acpicpu_dynamic = true;
@@ -136,6 +137,7 @@
        aprint_naive("\n");
        aprint_normal(": ACPI CPU\n");
 
+       acpi_cpus++;
        acpicpu_sc[sc->sc_cpuid] = sc;
 
        sc->sc_cap = acpicpu_cap(sc);
@@ -186,6 +188,7 @@
                return rv;
 
        mutex_destroy(&sc->sc_mtx);
+       acpi_cpus--;
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index