From patchwork Mon May 23 14:06:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 96946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id CBB37B6FB3 for ; Tue, 24 May 2011 00:06:59 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QOVmY-0004k9-3q; Mon, 23 May 2011 14:06:54 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QOVmV-0004jn-ON for kernel-team@lists.ubuntu.com; Mon, 23 May 2011 14:06:51 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QOVmV-0000et-LS for ; Mon, 23 May 2011 14:06:51 +0000 Received: from cpc7-craw6-2-0-cust128.croy.cable.virginmedia.com ([94.172.219.129] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QOVmV-0007AN-GE for kernel-team@lists.ubuntu.com; Mon, 23 May 2011 14:06:51 +0000 From: Colin King To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] UBUNTU: SAUCE: S3 early resume debug via keyboard LEDs Date: Mon, 23 May 2011 15:06:50 +0100 Message-Id: <1306159610-10909-2-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306159610-10909-1-git-send-email-colin.king@canonical.com> References: <1306159610-10909-1-git-send-email-colin.king@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Colin Ian King 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 Acked-by: John Johansen --- Documentation/kernel-parameters.txt | 5 ++++- arch/x86/kernel/acpi/realmode/wakemain.c | 27 +++++++++++++++++++++++++++ arch/x86/kernel/acpi/sleep.c | 2 ++ 3 files changed, 33 insertions(+), 1 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index cc85a92..9f36ff4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -244,12 +244,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. For broken nForce2 BIOS resulting in XT-PIC timer. acpi_sleep= [HW,ACPI] Sleep options - Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, + Format: { s3_bios, s3_mode, s3_beep, s3_leds, s4_nohwsig, old_ordering, s4_nonvs, sci_force_enable } See Documentation/power/video.txt for information on s3_bios and s3_mode. s3_beep is for debugging; it makes the PC's speaker beep as soon as the kernel's real-mode entry point is called. + s3_leds is for debugging; it flashes the keyboard LEDs + 3 times as soon as the kernel's real-mode entry point is + called. s4_nohwsig prevents ACPI hardware signature from being used during resume from hibernation. old_ordering causes the ACPI 1.0 ordering of the _PTS diff --git a/arch/x86/kernel/acpi/realmode/wakemain.c b/arch/x86/kernel/acpi/realmode/wakemain.c index 883962d..1d108be 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 ff93bc1..182617c 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c @@ -109,6 +109,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();