Make resetting the video BIOS in the ACPI wakecode optional. It can be

configured via sysctl machdep.acpi_vbios_reset. Defaults to 1 -- reset vbios
on resume.
This commit is contained in:
jmcneill 2006-06-20 22:36:58 +00:00
parent 5fea743b13
commit 93305d7b62
2 changed files with 54 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_wakecode.S,v 1.7 2006/06/17 17:11:53 jmcneill Exp $ */
/* $NetBSD: acpi_wakecode.S,v 1.8 2006/06/20 22:36:58 jmcneill Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -96,16 +96,18 @@ wakeup_16:
call beepon
/* The following needs to be configurable */
/*#ifdef notyet*/
/* Only reset the VBIOS if machdep.acpi_vbios_reset=1 */
cmpb $1,vbios_reset
jne novbiosreset
/* Kick the VBIOS. */
lcall $0xc000,$3
movw %cs,%ax
movw %ax,%ds
movw %ax,%ss
novbiosreset:
/*#endif*/
call beepoff
/* Get physical address of the code */
@ -251,3 +253,4 @@ previous_fs: .word 0
previous_gs: .word 0
previous_ss: .word 0
where_to_recover: .long 0
vbios_reset: .byte 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_wakeup.c,v 1.26 2006/06/19 02:33:19 jmcneill Exp $ */
/* $NetBSD: acpi_wakeup.c,v 1.27 2006/06/20 22:36:58 jmcneill Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.26 2006/06/19 02:33:19 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.27 2006/06/20 22:36:58 jmcneill Exp $");
/*-
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.26 2006/06/19 02:33:19 jmcneill Ex
#include <sys/kernel.h>
#include <machine/bus.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <uvm/uvm_extern.h>
#include <uvm/uvm_page.h>
@ -98,6 +99,10 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.26 2006/06/19 02:33:19 jmcneill Ex
static paddr_t phys_wakeup = 0;
static int acpi_md_node = CTL_EOL;
static int acpi_md_vbios_reset = 1;
static int sysctl_md_acpi_vbios_reset(SYSCTLFN_ARGS);
uint32_t
acpi_md_get_npages_of_wakecode(void)
@ -357,6 +362,8 @@ acpi_md_sleep(int state)
p_gdt->rd_limit = r_gdt.rd_limit;
p_gdt->rd_base = vtophys(r_gdt.rd_base);
WAKECODE_FIXUP(vbios_reset, uint8_t, acpi_md_vbios_reset);
WAKECODE_FIXUP(previous_cr0, uint32_t, r_cr0);
WAKECODE_FIXUP(previous_cr2, uint32_t, r_cr2);
WAKECODE_FIXUP(previous_cr4, uint32_t, r_cr4);
@ -458,3 +465,41 @@ out:
#undef WAKECODE_FIXUP
#undef WAKECODE_BCOPY
}
SYSCTL_SETUP(sysctl_md_acpi_setup, "acpi i386 sysctl setup")
{
const struct sysctlnode *node;
const struct sysctlnode *ssnode;
if (sysctl_createv(NULL, 0, NULL, &node, CTLFLAG_PERMANENT,
CTLTYPE_NODE, "machdep", NULL, NULL, 0, NULL, 0, CTL_MACHDEP,
CTL_EOL) != 0)
return;
if (sysctl_createv(NULL, 0, &node, &ssnode, CTLFLAG_READWRITE,
CTLTYPE_INT, "acpi_vbios_reset", NULL, sysctl_md_acpi_vbios_reset,
0, NULL, 0, CTL_CREATE, CTL_EOL) != 0)
return;
acpi_md_node = node->sysctl_num;
}
static int
sysctl_md_acpi_vbios_reset(SYSCTLFN_ARGS)
{
int error, t;
struct sysctlnode node;
node = *rnode;
t = acpi_md_vbios_reset;
node.sysctl_data = &t;
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (error || newp == NULL)
return error;
if (t < 0 || t > 1)
return EINVAL;
acpi_md_vbios_reset = t;
return 0;
}