summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2006-06-08 17:54:10 +0000
committernjl <njl@FreeBSD.org>2006-06-08 17:54:10 +0000
commitb8f1ff9a05a41d766e8d2514638d0f9cecd53602 (patch)
treedbd3175f25a36240b7b72d4681f8abf324579259 /sys/i386
parente9425270e582d662bc242830a257f617c642b6b6 (diff)
downloadFreeBSD-src-b8f1ff9a05a41d766e8d2514638d0f9cecd53602.zip
FreeBSD-src-b8f1ff9a05a41d766e8d2514638d0f9cecd53602.tar.gz
Minor tweaks to the resume code that might help people debug.
* Add hw.acpi.resume_beep tunable and sysctl, default to 0. Beeps the PC speaker soon after waking to diagnose whether the wakeup code is even getting run before other drivers possibly hang the system. To stop the beep, cause another beep (i.e. keyboard bell). Submitted by takawata@, I changed the frequency to be lower. * Use 4096 instead of 4 byte alignment. Might be useful although doesn't seem to be necessary. * Remove a useless assignment to acpi_reset_video. It was overwritten by the default sysctl value anyway.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/acpica/acpi_machdep.c8
-rw-r--r--sys/i386/acpica/acpi_wakecode.S21
-rw-r--r--sys/i386/acpica/acpi_wakeup.c2
3 files changed, 26 insertions, 5 deletions
diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c
index e0d5b67..867c2e6 100644
--- a/sys/i386/acpica/acpi_machdep.c
+++ b/sys/i386/acpica/acpi_machdep.c
@@ -52,7 +52,9 @@ __FBSDID("$FreeBSD$");
#include <i386/bios/apm.h>
-uint32_t acpi_reset_video = 1;
+uint32_t acpi_resume_beep;
+TUNABLE_INT("hw.acpi.resume_beep", &acpi_resume_beep);
+uint32_t acpi_reset_video;
TUNABLE_INT("hw.acpi.reset_video", &acpi_reset_video);
static int intr_model = ACPI_INTR_PIC;
@@ -320,6 +322,10 @@ acpi_machdep_init(device_t dev)
SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx,
SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO,
+ "resume_beep", CTLFLAG_RD | CTLFLAG_RW, &acpi_resume_beep, 0,
+ "Beep the PC speaker when resuming");
+ SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx,
+ SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO,
"reset_video", CTLFLAG_RD | CTLFLAG_RW, &acpi_reset_video, 0,
"Call the VESA reset BIOS vector on the resume path");
diff --git a/sys/i386/acpica/acpi_wakecode.S b/sys/i386/acpica/acpi_wakecode.S
index c2d3039..ecbb4cd 100644
--- a/sys/i386/acpica/acpi_wakecode.S
+++ b/sys/i386/acpica/acpi_wakecode.S
@@ -34,7 +34,7 @@
#include "assym.s"
- .align 4
+ .align 4096
.code16
wakeup_16:
nop
@@ -49,9 +49,21 @@ wakeup_16:
movw %ax,%ss
movw $PAGE_SIZE,%sp
+ /* To debug resume hangs, beep the speaker if the user requested. */
+ cmpl $1,resume_beep
+ jne nobeep
+ movb $0xc0,%al
+ outb %al,$0x42
+ movb $0x04,%al
+ outb %al,$0x42
+ inb $0x61,%al
+ orb $0x3,%al
+ outb %al,$0x61
+nobeep:
+
/* Re-initialize video BIOS if the reset_video tunable is set. */
- cmp $0,reset_video
- je wakeup_16_gdt
+ cmpl $1,reset_video
+ jne nobiosreset
lcall $0xc000,$3
/*
@@ -61,8 +73,8 @@ wakeup_16:
movw %cs,%ax
movw %ax,%ds
movw %ax,%ss
+nobiosreset:
-wakeup_16_gdt:
/* Load GDT for real mode */
lgdt physical_gdt
@@ -220,6 +232,7 @@ physical_esp: .long 0
previous_cr2: .long 0
previous_cr3: .long 0
previous_cr4: .long 0
+resume_beep: .long 0
reset_video: .long 0
/* transfer from real mode to protected mode */
diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c
index dec1088..543c0f2 100644
--- a/sys/i386/acpica/acpi_wakeup.c
+++ b/sys/i386/acpica/acpi_wakeup.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#error this file needs sys/cdefs.h as a prerequisite
#endif
+extern uint32_t acpi_resume_beep;
extern uint32_t acpi_reset_video;
extern void initializecpu(void);
@@ -227,6 +228,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
WAKECODE_FIXUP(previous_cr3, uint32_t, r_cr3);
WAKECODE_FIXUP(previous_cr4, uint32_t, r_cr4);
+ WAKECODE_FIXUP(resume_beep, uint32_t, acpi_resume_beep);
WAKECODE_FIXUP(reset_video, uint32_t, acpi_reset_video);
WAKECODE_FIXUP(previous_tr, uint16_t, r_tr);
OpenPOWER on IntegriCloud