From fbbdf7c7d2218e7b88a095ddd0659e38efbe00ab Mon Sep 17 00:00:00 2001 From: Mitsuru IWASAKI Date: Thu, 30 Oct 2003 16:14:55 +0000 Subject: [PATCH] Add sysctl MIB and loader tunable `hw.acpi.no_reset_video' as the same effect as ACPI_NO_RESET_VIDEO kernel option. --- share/man/man4/acpi.4 | 4 ++++ sys/i386/acpica/acpi_machdep.c | 10 ++++++++++ sys/i386/acpica/acpi_wakecode.S | 4 ++++ sys/i386/acpica/acpi_wakeup.c | 3 +++ 4 files changed, 21 insertions(+) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index 43e6e5cd6b8b..576161064b61 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -319,6 +319,10 @@ the economy power profile. Delay in milliseconds to wait for the EC to respond. Try increasing this number if you get the error .Er AE_NO_HARDWARE_RESPONSE . +.It Va hw.acpi.no_reset_video +Disables calling the VESA reset BIOS vector on the resume path. Some +graphic chips have problems such as LCD white-out after resume. Try +setting this to 1 if necessary. .It Va hw.acpi.os_name Some systems' ASL may have problems because they look for names of Microsoft operating systems. This tunable overrides the diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index 09e095ad71ef..18ffdb49850e 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "acpi.h" @@ -59,6 +61,9 @@ static device_t acpi_dev; #include #endif +u_int32_t acpi_no_reset_video = 0; +TUNABLE_INT("hw.acpi.no_reset_video", &acpi_no_reset_video); + static struct apm_softc apm_softc; static d_open_t apmopen; @@ -327,6 +332,11 @@ acpi_machdep_init(device_t dev) if (intr_model != ACPI_INTR_PIC) acpi_SetIntrModel(intr_model); + + SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), + OID_AUTO, "no_reset_video", CTLFLAG_RD | CTLFLAG_RW, &acpi_no_reset_video, 0, + "Disable calling the VESA reset BIOS vector on the resume path"); + return (0); } diff --git a/sys/i386/acpica/acpi_wakecode.S b/sys/i386/acpica/acpi_wakecode.S index a67f4ad926df..e91a646421d5 100644 --- a/sys/i386/acpica/acpi_wakecode.S +++ b/sys/i386/acpica/acpi_wakecode.S @@ -48,12 +48,15 @@ wakeup_16: * Re-initialize video BIOS. Restore DS and SS from CS in * case the BIOS modified them. */ + cmp $1, no_reset_video + je wakeup_16_gdt lcall $0xc000, $3 movw %cs, %ax movw %ax, %ds movw %ax, %ss #endif +wakeup_16_gdt: /* Load GDT for real mode */ lgdt physical_gdt @@ -211,6 +214,7 @@ physical_esp: .long 0 previous_cr2: .long 0 previous_cr3: .long 0 previous_cr4: .long 0 +no_reset_video: .long 0 /* transfer from real mode to protected mode */ previous_cr0: .long 0 diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index 9a11f42b2816..adf366ecebe7 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #define vm_page_unlock_queues() #endif +extern u_int32_t acpi_no_reset_video; extern void initializecpu(void); static struct region_descriptor r_idt, r_gdt, *p_gdt; @@ -232,6 +233,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) WAKECODE_FIXUP(previous_cr3, u_int32_t, r_cr3); WAKECODE_FIXUP(previous_cr4, u_int32_t, r_cr4); + WAKECODE_FIXUP(no_reset_video, u_int32_t, acpi_no_reset_video); + WAKECODE_FIXUP(previous_tr, u_int16_t, r_tr); WAKECODE_BCOPY(previous_gdt, struct region_descriptor, r_gdt); WAKECODE_FIXUP(previous_ldt, u_int16_t, r_ldt);