Patch for 2.3.18 to ignore bogus APM error codes

Nick Holloway (alfie@alfie.demon.co.uk)
Sat, 11 Sep 1999 19:22:16 +0100


--cNdxnHkX5QqsyA0e
Content-Type: text/plain; charset=us-ascii

I have an aging ThinkPad 755C, which has a broken APM BIOS. When it
blanks or unblanks the screen, the message "unknown error code 0x53"
is reported.

To work around the fact that the APM BIOS reported an error, but the
operation works, the contents of eax (which is supposed to hold the error
code) is compared with the supplied value of eax. If they are identical,
then the error indication is ignored.

I have only added the behaviour to apm_bios_call_simple, as in my case,
it is only set_power_state calls that are affected.

The patch adds a new config option CONFIG_APM_IGNORE_BOGUS_ERROR to enable
this behaviour, to ensure that it doesn't impact anyone but those that
need it.

-- 
 `O O'  | Home: Nick.Holloway@alfie.demon.co.uk  http://www.alfie.demon.co.uk/
// ^ \\ | Work: Nick.Holloway@parallax.co.uk

--cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="apm-2.3.diff"

--- linux-2.3/arch/i386/kernel/apm.c~ Sat Sep 11 13:13:56 1999 +++ linux-2.3/arch/i386/kernel/apm.c Sat Sep 11 13:17:38 1999 @@ -496,6 +496,11 @@ } APM_DO_RESTORE_SEGS; __restore_flags(flags); +#ifdef CONFIG_APM_IGNORE_BOGUS_ERROR + /* Ignore error reported by APM BIOS if error code was set */ + if (error && *eax == eax_in) + return 0; +#endif return error; } --- linux-2.3/arch/i386/config.in~ Sat Sep 11 13:19:36 1999 +++ linux-2.3/arch/i386/config.in Sat Sep 11 13:18:35 1999 @@ -106,6 +106,7 @@ bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT bool ' Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS + bool ' Ignore bogus error returns' CONFIG_APM_IGNORE_BOGUS_ERROR fi endmenu --- linux-2.3/Documentation/Configure.help~ Sat Sep 11 13:54:29 1999 +++ linux-2.3/Documentation/Configure.help Sat Sep 11 13:10:50 1999 @@ -9350,6 +9350,14 @@ many of the newer IBM Thinkpads. If you experience hangs when you suspend, try setting this to Y. Otherwise, say N. +Ignore bogus error returns from APM BIOS. +CONFIG_APM_IGNORE_BOGUS_ERROR + This option is necessary on the IBM Thinkpad 755C (and maybe others). + Without this, you get "unknown error code 0x53" reported on suspend and + display blank. If you say Y here, when the call to the BIOS reports an + error, but no error code has been set, then the BIOS call is considered + to have been successful. + Watchdog Timer Support CONFIG_WATCHDOG If you say Y here (and to one of the following options) and create a

--cNdxnHkX5QqsyA0e--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/