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.
This commit is contained in:
parent
bb34821048
commit
64297e67ab
@ -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;
|
||||
@ -318,6 +320,10 @@ acpi_machdep_init(device_t dev)
|
||||
else
|
||||
acpi_SetIntrModel(intr_model);
|
||||
|
||||
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,
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user