Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Only check if the register address in _CST is v...



details:   https://anonhg.NetBSD.org/src/rev/5325064b779b
branches:  trunk
changeset: 762508:5325064b779b
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Feb 22 09:34:13 2011 +0000

description:
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 it is unclear whether 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)"

diffstat:

 sys/dev/acpi/acpi_cpu_cstate.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r de286ef3dd2e -r 5325064b779b sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c    Tue Feb 22 08:20:20 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c    Tue Feb 22 09:34:13 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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;



Home | Main Index | Thread Index | Old Index