Skip to contentSkip to conversation

Workaround for ACPI sleep problems

PATCH Pavel Machek 1 participant 1 message Sep 25, 2001 ACPI

lore
Share & tools
lore
#0 lore raw

Hi!

Some machines have bad problems with acpi... Toshiba will kill interrupts and mvp3 gives totally incorrect table, meaning that sleeps just will not work.

I figured part of table, but I *know* there's working S1 somewhere out there, so if someone has the correct value to use, please let me know. [If you replace number near /* HERE */ with correct value in 0-15 range, you'll get working S1. It's only 15 tries ;-).]

This fixes acpi on toshiba, and provides at least working poweroff on MVP3.
Pavel

include/asm-i386/system.h +4 -0
@@ -340,4 +340,8 @@
 void disable_hlt(void);
 void enable_hlt(void);
 
+extern unsigned long dmi_broken;
+#define BROKEN_ACPI_Sx		0x0001
+#define BROKEN_INIT_AFTER_S1	0x0002
+
 #endif
arch/i386/kernel/dmi_scan.c +47 -1

66 lines not on this page · raw message

drivers/acpi/hardware/hwregs.c +17 -0
@@ -29,6 +29,7 @@
 #include "acpi.h"
 #include "achware.h"
 #include "acnamesp.h"
+#include <asm/system.h>
 
 #define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwregs")
@@ -162,6 +163,22 @@
 	if ((sleep_state > ACPI_S_STATES_MAX) ||
 		!slp_typ_a || !slp_typ_b) {
 		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	}
+
+	if (dmi_broken & BROKEN_ACPI_Sx) {
+		printk("Attempted to enter %d\n", sleep_state);
+		switch (sleep_state) {
+			/* 0,3,4,6,7,11 is nop */
+			/* 5 is nop, too? No. 5 is some valid state, just not S1 nor S3 (strange). */
+			/* 13 is lockup when used in S1 or S3 context */
+			/* 14 is "keep monitor on and than all goes off when power is pressed in S1 context */
+		case 1:	*slp_typ_a = *slp_typ_b =12 /* HERE */; return_ACPI_STATUS (status);
+		case 3:	*slp_typ_a = *slp_typ_b =14; return_ACPI_STATUS (status);
+		case 4:	*slp_typ_a = *slp_typ_b = 1; return_ACPI_STATUS (status);	/* Seems ok, but it times somehow long to wakeup. Is it possible this is S3? */
+		case 5:	*slp_typ_a = *slp_typ_b =10; return_ACPI_STATUS (status);	/* Seems ok */
+		default: return_ACPI_STATUS (AE_BAD_PARAMETER)
+		}
+		
 	}
 
 	/*
drivers/acpi/ospm/system/sm_osl.c +5 -0
@@ -719,6 +780,11 @@
 	/* TODO: resume devices and restore their state */
 
 	enable();
+
+	if (dmi_broken & BROKEN_INIT_AFTER_S1) {
+		printk("Broken toshiba laptop -> kicking interrupts\n");
+		init_8259A(0);
+	}
 	return status;
 }
 
Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]