x86, 8042: Enable A20 using KBC to fix S3 resume on some MSI laptops
authorOndrej Zary <linux@rainbow-software.org>
Tue, 11 Dec 2012 21:18:05 +0000 (22:18 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 3 Jan 2013 03:33:36 +0000 (03:33 +0000)
commit ad68652412276f68ad4fe3e1ecf5ee6880876783 upstream.

Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable A20
line but resume code assumes that KBC was used.
The laptop will not resume from S3 otherwise but powers off after a while
and then powers on again stuck with a blank screen.

Fix it by enabling A20 using KBC in i8042_platform_init for x86.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Link: http://lkml.kernel.org/r/201212112218.06551.linux@rainbow-software.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/input/serio/i8042-x86ia64io.h

index cd1a843..031270c 100644 (file)
@@ -914,6 +914,7 @@ static int __init i8042_platform_init(void)
        int retval;
 
 #ifdef CONFIG_X86
+       u8 a20_on = 0xdf;
        /* Just return if pre-detection shows no i8042 controller exist */
        if (!x86_platform.i8042_detect())
                return -ENODEV;
@@ -953,6 +954,14 @@ static int __init i8042_platform_init(void)
 
        if (dmi_check_system(i8042_dmi_dritek_table))
                i8042_dritek = true;
+
+       /*
+        * A20 was already enabled during early kernel init. But some buggy
+        * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
+        * resume from S3. So we do it here and hope that nothing breaks.
+        */
+       i8042_command(&a20_on, 0x10d1);
+       i8042_command(NULL, 0x00ff);    /* Null command for SMM firmware */
 #endif /* CONFIG_X86 */
 
        return retval;