Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Fix a bug where the S1 state was exited via Acp...



details:   https://anonhg.NetBSD.org/src/rev/56aa272e0a62
branches:  trunk
changeset: 765588:56aa272e0a62
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue May 31 14:27:44 2011 +0000

description:
Fix a bug where the S1 state was exited via AcpiLeaveSleepState() with
interrupts being off at machine-level. Also add some comments.

diffstat:

 sys/dev/acpi/acpi.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r e61ffbe7cdfb -r 56aa272e0a62 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Tue May 31 13:22:56 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Tue May 31 14:27:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.240 2011/02/27 17:10:33 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.241 2011/05/31 14:27:44 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.240 2011/02/27 17:10:33 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.241 2011/05/31 14:27:44 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -1300,7 +1300,12 @@
 
                if (state == ACPI_STATE_S1) {
 
-                       /* Just enter the state. */
+                       /*
+                        * Enter the state. Note that interrupts must
+                        * be off before calling AcpiEnterSleepState().
+                        * Conversely, AcpiLeaveSleepState() should
+                        * always be called with interrupts enabled.
+                        */
                        acpi_md_OsDisableInterrupt();
                        rv = AcpiEnterSleepState(state);
 
@@ -1308,7 +1313,8 @@
                                aprint_error_dev(sc->sc_dev, "failed to "
                                    "enter S1: %s\n", AcpiFormatException(rv));
 
-                       (void)AcpiLeaveSleepState(state);
+                       acpi_md_OsEnableInterrupt();
+                       rv = AcpiLeaveSleepState(state);
 
                } else {
 
@@ -1323,6 +1329,9 @@
                        (void)pmf_system_resume(PMF_Q_NONE);
                }
 
+               /*
+                * No wake GPEs should be enabled at runtime.
+                */
                acpi_wakedev_commit(sc, ACPI_STATE_S0);
                break;
 



Home | Main Index | Thread Index | Old Index