Module Name:    src
Committed By:   jruoho
Date:           Tue Feb 22 09:34:13 UTC 2011

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

Log Message:
Only check if the register address in _CST is valid if the ACPI processor
object address is valid. Some systems define the Processor() as:

    Scope (_PR)
    {
        Processor (C000, 0x00, 0x00000410, 0x06) {}
        Processor (C001, 0x01, 0x00000000, 0x00) {}
        Processor (C002, 0x02, 0x00000000, 0x00) {}
        Processor (C003, 0x03, 0x00000000, 0x00) {}
    }

This may be typical to AMD systems that do not seem to use _CST, but instead
operate with HLT (and C1E for the C3-state). The same check is already done
in acpicpu_cstate_fadt(). Note that this violates the specification, given:

   "PBlockAddress provides the system I/O address for the processors
    register block.  Each processor can supply a different such address.
    PBlockLength is the length of the processor register block, in bytes and
    is either 0 (for no P_BLK) or 6.  With one exception, all processors are
    required to have the same PBlockLength.  The exception is that the boot
    processor can have a non-zero PBlockLength when all other processors
    have a zero PBlockLength.  It is valid for every processor to have a
    PBlockLength of 0. (ACPI 4.0, p. 626)"

However, if the above is not satisfied, we simply resort to HALT that should
be available on all supported x86 CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/acpi/acpi_cpu_cstate.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_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.37 src/sys/dev/acpi/acpi_cpu_cstate.c:1.38
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.37	Sun Jan 30 08:55:52 2011
+++ src/sys/dev/acpi/acpi_cpu_cstate.c	Tue Feb 22 09:34:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.37 2011/01/30 08:55:52 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.38 2011/02/22 09:34:13 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_cstate.c,v 1.37 2011/01/30 08:55:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.38 2011/02/22 09:34:13 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -430,9 +430,12 @@
 		 * the offset of P_LVL3 may change depending on whether
 		 * acpiacad(4) is connected or disconnected.
 		 */
-		if (reg->reg_addr > ao->ao_pblkaddr + ao->ao_pblklen) {
-			rv = AE_BAD_ADDRESS;
-			goto out;
+		if (ao->ao_pblkaddr != 0) {
+
+			if (reg->reg_addr > ao->ao_pblkaddr + ao->ao_pblklen) {
+				rv = AE_BAD_ADDRESS;
+				goto out;
+			}
 		}
 
 		state.cs_addr = reg->reg_addr;

Reply via email to