Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Convert an aprint_error_dev() to ACPI_DEBUG_PRI...



details:   https://anonhg.NetBSD.org/src/rev/1f6c027510b7
branches:  trunk
changeset: 755418:1f6c027510b7
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Jun 05 07:59:13 2010 +0000

description:
Convert an aprint_error_dev() to ACPI_DEBUG_PRINT in acpi_power_set().

This "fixes" the issue observed by dyoung@. Since the AML may not keep any
state by itself, it is possible that the firmware tries to continuously put
a device into a power state where the device already is (e.g. D3 -> D3).

XXX: The code (like the old power resource code) rests on the assumption
     that it is possible to reliably obtain the power state of a device
     either directly via _PSC or indirectly via _STA. However, because there
     is some evidence that few broken systems implement these methods
     incorrectly (e.g. always returns D0 as a constant, even if the state
     would be D3 in reality), we may need to revisit this by always setting
     the power state, even if it is impossible to get the power state.

diffstat:

 sys/dev/acpi/acpi_power.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 8d28d6221a89 -r 1f6c027510b7 sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Sat Jun 05 06:07:12 2010 +0000
+++ b/sys/dev/acpi/acpi_power.c Sat Jun 05 07:59:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.13 2010/05/31 20:10:56 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.14 2010/06/05 07:59:13 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.13 2010/05/31 20:10:56 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.14 2010/06/05 07:59:13 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -379,8 +379,8 @@
        KASSERT(ad != NULL && ad->ad_root != NULL);
 
        if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
-               ad->ad_state = ACPI_STATE_ERROR;
-               return false;
+               rv = AE_SUPPORT;
+               goto fail;
        }
 
        if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3) {
@@ -443,8 +443,8 @@
 fail:
        ad->ad_state = ACPI_STATE_ERROR;
 
-       aprint_error_dev(ad->ad_root, "failed to set power state to D%d "
-           "for %s: %s\n", state, ad->ad_name, AcpiFormatException(rv));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "failed to set power state to D%d "
+               "for %s: %s\n", state, ad->ad_name, AcpiFormatException(rv)));
 
        return false;
 }



Home | Main Index | Thread Index | Old Index