aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2011-05-23 15:06:50 +0100
committerJohn Rigby <john.rigby@linaro.org>2012-06-25 12:17:00 -0600
commitdd9aed4be7b2e8b9ae7dc2f41f6024a30e763db9 (patch)
tree164dbd2b6084f19a81c18fc2dd586d117cdd2e0a /arch
parent9f48a3df91755beb271a909f942c38577ab1f3d2 (diff)
UBUNTU: SAUCE: S3 early resume debug via keyboard LEDs
Add support to debug S3 early resume by flashing the keyboard LEDs three times in the realmode path. This is useful to allow one to determine if S3 hangs occur in the BIOS or during the early resume phase. Add kernel parameter acpi_sleep=s3_leds to enable the s3 debugging option. This can also be enabled by writing 8 to /proc/sys/kernel/acpi_video_flags. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/acpi/realmode/wakemain.c27
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
2 files changed, 29 insertions, 0 deletions
diff --git a/arch/x86/kernel/acpi/realmode/wakemain.c b/arch/x86/kernel/acpi/realmode/wakemain.c
index 883962d9eef..1d108be5549 100644
--- a/arch/x86/kernel/acpi/realmode/wakemain.c
+++ b/arch/x86/kernel/acpi/realmode/wakemain.c
@@ -61,6 +61,30 @@ static void send_morse(const char *pattern)
}
}
+#define I8042_STATUS_REG 0x64
+#define I8042_DATA_REG 0x60
+#define I8042_SET_LED_BITS 0xed
+#define I8042_STR_IBF 0x02
+
+static void flash_keyboard_leds(void)
+{
+ int i;
+ unsigned char leds = 7;
+
+ /* Flash keyboard LEDs 3 times */
+ for (i = 0; i < 6; i++) {
+ while (inb(I8042_STATUS_REG) & I8042_STR_IBF)
+ ;
+ outb(I8042_SET_LED_BITS, I8042_DATA_REG);
+ while (inb(I8042_STATUS_REG) & I8042_STR_IBF)
+ ;
+ outb(leds, I8042_DATA_REG);
+ leds ^= 7;
+ udelay(500000);
+ }
+}
+
+
void main(void)
{
/* Kill machine if structures are wrong */
@@ -78,4 +102,7 @@ void main(void)
probe_cards(0);
set_mode(wakeup_header.video_mode);
}
+
+ if (wakeup_header.realmode_flags & 8)
+ flash_keyboard_leds();
}
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 146a49c763a..e973f11c511 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -119,6 +119,8 @@ static int __init acpi_sleep_setup(char *str)
acpi_realmode_flags |= 2;
if (strncmp(str, "s3_beep", 7) == 0)
acpi_realmode_flags |= 4;
+ if (strncmp(str, "s3_leds", 7) == 0)
+ acpi_realmode_flags |= 8;
#ifdef CONFIG_HIBERNATION
if (strncmp(str, "s4_nohwsig", 10) == 0)
acpi_no_s4_hw_signature();