Port-i386 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
ACPI S1 state
This patch helps my ancient HP Pavilion N3270 enter/leave S1 state.
(The N3270 does not have an S3 state.) I can put the system to sleep
with 'sysctl -w machdep.sleep_state=1', and I can wake it by tapping
the power button.
If I do not put the devices to sleep, then the system hangs instead
of waking up. It seems to have something to do with interrupts from
PCI devices.
The lid switch produces "pressed" and "released" events. I got powerd(8)
to run 'sysctl -w machdep.sleep_state=1' when it sees the "pressed" event.
I cannot wake the system after putting it to sleep by closing the lid.
Opening the lid has no effect. Neither does tapping the power button.
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 278-3933 ext 24
Index: arch/x86/include/acpi_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/acpi_machdep.h,v
retrieving revision 1.4
diff -p -u -u -p -r1.4 acpi_machdep.h
--- arch/x86/include/acpi_machdep.h 15 Dec 2007 11:26:40 -0000 1.4
+++ arch/x86/include/acpi_machdep.h 11 Jun 2008 08:13:15 -0000
@@ -68,6 +68,7 @@ ACPI_STATUS acpi_md_OsGetPhysicalAddress
BOOLEAN acpi_md_OsReadable(void *, UINT32);
BOOLEAN acpi_md_OsWritable(void *, UINT32);
void acpi_md_OsDisableInterrupt(void);
+void acpi_md_OsEnableInterrupt(void);
int acpi_md_sleep(int);
void acpi_md_sleep_init(void);
Index: arch/x86/x86/acpi_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/acpi_machdep.c,v
retrieving revision 1.21
diff -p -u -u -p -r1.21 acpi_machdep.c
--- arch/x86/x86/acpi_machdep.c 30 May 2008 19:03:10 -0000 1.21
+++ arch/x86/x86/acpi_machdep.c 11 Jun 2008 08:13:15 -0000
@@ -269,6 +269,12 @@ acpi_md_OsWritable(void *Pointer, UINT32
}
void
+acpi_md_OsEnableInterrupt(void)
+{
+ x86_enable_intr();
+}
+
+void
acpi_md_OsDisableInterrupt(void)
{
x86_disable_intr();
Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.117
diff -p -u -u -p -r1.117 acpi.c
--- dev/acpi/acpi.c 1 Jun 2008 19:01:57 -0000 1.117
+++ dev/acpi/acpi.c 11 Jun 2008 08:13:16 -0000
@@ -1221,7 +1221,7 @@ acpi_enter_sleep_state(struct acpi_softc
break;
}
- if (state != ACPI_STATE_S1 && !pmf_system_suspend(PMF_F_NONE)) {
+ if (!pmf_system_suspend(PMF_F_NONE)) {
aprint_error_dev(sc->sc_dev, "aborting suspend\n");
break;
}
@@ -1236,14 +1236,19 @@ acpi_enter_sleep_state(struct acpi_softc
acpi_sleepstate = state;
if (state == ACPI_STATE_S1) {
+ int s;
/* just enter the state */
+ s = splhigh();
acpi_md_OsDisableInterrupt();
ret = AcpiEnterSleepState((UINT8)state);
if (ACPI_FAILURE(ret))
aprint_error_dev(sc->sc_dev,
"failed to enter sleep state S1: %s\n",
AcpiFormatException(ret));
+ acpi_md_OsEnableInterrupt();
+ splx(s);
AcpiLeaveSleepState((UINT8)state);
+ pmf_system_resume(PMF_F_NONE);
} else {
err = acpi_md_sleep(state);
if (state == ACPI_STATE_S4)
Home |
Main Index |
Thread Index |
Old Index