Module Name:    src
Committed By:   jruoho
Date:           Thu Jan 13 04:18:19 UTC 2011

Modified Files:
        src/sys/dev/acpi: acpi.c acpi_cpu.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.230 src/sys/dev/acpi/acpi.c:1.231
--- src/sys/dev/acpi/acpi.c:1.230	Tue Jan 11 20:35:24 2011
+++ src/sys/dev/acpi/acpi.c	Thu Jan 13 04:18:19 2011
@@ -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;
 

Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.24 src/sys/dev/acpi/acpi_cpu.c:1.25
--- src/sys/dev/acpi/acpi_cpu.c:1.24	Thu Dec 30 12:05:02 2010
+++ src/sys/dev/acpi/acpi_cpu.c	Thu Jan 13 04:18:19 2011
@@ -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 <jruoho...@iki.fi>
@@ -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;
 }

Reply via email to