Module Name:    src
Committed By:   jruoho
Date:           Mon Jun 20 15:39:54 UTC 2011

Modified Files:
        src/sys/arch/x86/acpi: acpi_pdc.c

Log Message:
Use acpi_match_cpu_handle() from acpi_util.c and only evaluate
the _PDC control method for CPUs that are enabled in the MADT.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/acpi/acpi_pdc.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/arch/x86/acpi/acpi_pdc.c
diff -u src/sys/arch/x86/acpi/acpi_pdc.c:1.1 src/sys/arch/x86/acpi/acpi_pdc.c:1.2
--- src/sys/arch/x86/acpi/acpi_pdc.c:1.1	Sun Jun 12 10:11:52 2011
+++ src/sys/arch/x86/acpi/acpi_pdc.c	Mon Jun 20 15:39:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pdc.c,v 1.1 2011/06/12 10:11:52 jruoho Exp $ */
+/* $NetBSD: acpi_pdc.c,v 1.2 2011/06/20 15:39:54 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruoho...@iki.fi>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pdc.c,v 1.1 2011/06/12 10:11:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pdc.c,v 1.2 2011/06/20 15:39:54 jruoho Exp $");
 
 #include <sys/param.h>
 
@@ -47,12 +47,11 @@
 static uint32_t		flags = 0;
 
 static ACPI_STATUS	acpi_md_pdc_walk(ACPI_HANDLE, uint32_t,void *,void **);
-static ACPI_STATUS	acpi_md_pdc_set(ACPI_HANDLE, uint32_t);
+static void		acpi_md_pdc_set(ACPI_HANDLE, uint32_t);
 
 uint32_t
 acpi_md_pdc(void)
 {
-	char *hid = __UNCONST("ACPI0007");
 	struct cpu_info *ci = curcpu();
 	uint32_t regs[4];
 
@@ -104,21 +103,26 @@
 	 * As the _PDC must be evaluated before the internal namespace
 	 * is built, we have no option but to walk with the interpreter.
 	 */
-	(void)AcpiGetDevices(hid, acpi_md_pdc_walk, NULL, NULL);
-
-	(void)AcpiWalkNamespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
+	(void)AcpiWalkNamespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
 	    UINT32_MAX, acpi_md_pdc_walk, NULL, NULL, NULL);
 
 	return flags;
 }
 
 static ACPI_STATUS
-acpi_md_pdc_walk(ACPI_HANDLE hdl, uint32_t level, void *context, void **status)
+acpi_md_pdc_walk(ACPI_HANDLE hdl, uint32_t level, void *aux, void **sta)
 {
-	return acpi_md_pdc_set(hdl, flags);
+	struct cpu_info *ci;
+
+	ci = acpi_match_cpu_handle(hdl);
+
+	if (ci != NULL)
+		acpi_md_pdc_set(hdl, flags);
+
+	return AE_OK;
 }
 
-static ACPI_STATUS
+static void
 acpi_md_pdc_set(ACPI_HANDLE hdl, uint32_t val)
 {
 	ACPI_OBJECT_LIST arg;
@@ -137,6 +141,4 @@
 	obj.Buffer.Pointer = (void *)cap;
 
 	(void)AcpiEvaluateObject(hdl, "_PDC", &arg, NULL);
-
-	return AE_OK;
 }

Reply via email to