Make the beep on resume optional. It gets controlled by

machdep.acpi_beep_on_reset.
This commit is contained in:
joerg 2007-04-28 14:03:00 +00:00
parent e7c552f22e
commit 22ee755a55
3 changed files with 95 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_wakecode.S,v 1.8 2006/06/20 22:36:58 jmcneill Exp $ */
/* $NetBSD: acpi_wakecode.S,v 1.9 2007/04/28 14:03:00 joerg Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -94,7 +94,11 @@ wakeup_16:
pushl $0
popfl
/* Only beep on reset if machdep.acpi_beep_on_reset=1 */
cmpb $1,beep_on_reset
jne nobeepon
call beepon
nobeepon:
/* Only reset the VBIOS if machdep.acpi_vbios_reset=1 */
cmpb $1,vbios_reset
@ -108,7 +112,11 @@ wakeup_16:
movw %ax,%ss
novbiosreset:
/* Only beep on reset if machdep.acpi_beep_on_reset=1 */
cmpb $1,beep_on_reset
jne nobeepoff
call beepoff
nobeepoff:
/* Get physical address of the code */
xorl %esi,%esi
@ -254,3 +262,4 @@ previous_gs: .word 0
previous_ss: .word 0
where_to_recover: .long 0
vbios_reset: .byte 0
beep_on_reset: .byte 0

View File

@ -1,65 +1,70 @@
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. */
/* from: NetBSD: acpi_wakecode.S,v 1.8 2006/06/20 22:36:58 jmcneill Exp */
/* $NetBSD: acpi_wakecode.h,v 1.7 2006/06/20 22:37:14 jmcneill Exp $ */
/* $NetBSD: acpi_wakecode.h,v 1.8 2007/04/28 14:03:00 joerg Exp $ */
#define wakeup_16 0x00000000
#define novbiosreset 0x00000026
#define wakeup_sw32 0x0000005f
#define wakeup_32 0x00000070
#define beepon 0x00000107
#define beepoff 0x00000116
#define tmp_gdt 0x00000120
#define tmp_gdtable 0x00000128
#define physical_gdt 0x00000140
#define previous_cr2 0x00000146
#define previous_cr3 0x0000014a
#define previous_cr4 0x0000014e
#define previous_cr0 0x00000152
#define previous_tr 0x00000156
#define previous_gdt 0x00000158
#define previous_ldt 0x0000015e
#define previous_idt 0x00000160
#define previous_ds 0x00000166
#define previous_es 0x00000168
#define previous_fs 0x0000016a
#define previous_gs 0x0000016c
#define previous_ss 0x0000016e
#define where_to_recover 0x00000170
#define vbios_reset 0x00000174
#define nobeepon 0x0000001b
#define novbiosreset 0x0000002d
#define nobeepoff 0x00000037
#define wakeup_sw32 0x0000006d
#define wakeup_32 0x00000080
#define beepon 0x00000117
#define beepoff 0x00000126
#define tmp_gdt 0x00000130
#define tmp_gdtable 0x00000138
#define physical_gdt 0x00000150
#define previous_cr2 0x00000156
#define previous_cr3 0x0000015a
#define previous_cr4 0x0000015e
#define previous_cr0 0x00000162
#define previous_tr 0x00000166
#define previous_gdt 0x00000168
#define previous_ldt 0x0000016e
#define previous_idt 0x00000170
#define previous_ds 0x00000176
#define previous_es 0x00000178
#define previous_fs 0x0000017a
#define previous_gs 0x0000017c
#define previous_ss 0x0000017e
#define where_to_recover 0x00000180
#define vbios_reset 0x00000184
#define beep_on_reset 0x00000185
static const unsigned char wakecode[] = {
0x90, 0xfa, 0xfc, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e,
0xd0, 0xbc, 0x00, 0x10, 0x66, 0x6a, 0x00, 0x66,
0x9d, 0xe8, 0xf3, 0x00, 0x80, 0x3e, 0x74, 0x01,
0x01, 0x75, 0x0b, 0x9a, 0x03, 0x00, 0x00, 0xc0,
0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xd0, 0xe8, 0xed,
0x00, 0x66, 0x31, 0xf6, 0x8c, 0xce, 0x66, 0xc1,
0xe6, 0x04, 0x66, 0x89, 0xf0, 0x66, 0x05, 0x70,
0x00, 0x00, 0x00, 0x66, 0xa3, 0x61, 0x00, 0xeb,
0x00, 0xeb, 0x00, 0x66, 0x89, 0xf0, 0x66, 0x05,
0x28, 0x01, 0x00, 0x00, 0x66, 0xa3, 0x22, 0x01,
0x0f, 0x01, 0x16, 0x20, 0x01, 0x0f, 0x20, 0xc0,
0x66, 0x83, 0xc8, 0x01, 0x0f, 0x22, 0xc0, 0x66,
0xea, 0x78, 0x56, 0x34, 0x12, 0x08, 0x00, 0x89,
0xf6, 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, 0x00,
0x9d, 0x80, 0x3e, 0x85, 0x01, 0x01, 0x75, 0x03,
0xe8, 0xfc, 0x00, 0x80, 0x3e, 0x84, 0x01, 0x01,
0x75, 0x0b, 0x9a, 0x03, 0x00, 0x00, 0xc0, 0x8c,
0xc8, 0x8e, 0xd8, 0x8e, 0xd0, 0x80, 0x3e, 0x85,
0x01, 0x01, 0x75, 0x03, 0xe8, 0xef, 0x00, 0x66,
0x31, 0xf6, 0x8c, 0xce, 0x66, 0xc1, 0xe6, 0x04,
0x66, 0x89, 0xf0, 0x66, 0x05, 0x80, 0x00, 0x00,
0x00, 0x66, 0xa3, 0x6f, 0x00, 0xeb, 0x00, 0xeb,
0x00, 0x66, 0x89, 0xf0, 0x66, 0x05, 0x38, 0x01,
0x00, 0x00, 0x66, 0xa3, 0x32, 0x01, 0x0f, 0x01,
0x16, 0x30, 0x01, 0x0f, 0x20, 0xc0, 0x66, 0x83,
0xc8, 0x01, 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x78,
0x56, 0x34, 0x12, 0x08, 0x00, 0x8d, 0x74, 0x26,
0x00, 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, 0x00,
0x90, 0x66, 0xb8, 0x10, 0x00, 0x8e, 0xd8, 0x8e,
0xc0, 0x8e, 0xe8, 0x8e, 0xd0, 0x8e, 0xe0, 0x8b,
0x9e, 0x42, 0x01, 0x00, 0x00, 0x66, 0x0f, 0xb7,
0x8e, 0x56, 0x01, 0x00, 0x00, 0x8d, 0x04, 0x0b,
0x80, 0x60, 0x05, 0xf9, 0x8b, 0x86, 0x4a, 0x01,
0x00, 0x00, 0x0f, 0x22, 0xd8, 0x8b, 0x86, 0x52,
0x9e, 0x52, 0x01, 0x00, 0x00, 0x66, 0x0f, 0xb7,
0x8e, 0x66, 0x01, 0x00, 0x00, 0x8d, 0x04, 0x0b,
0x80, 0x60, 0x05, 0xf9, 0x8b, 0x86, 0x5a, 0x01,
0x00, 0x00, 0x0f, 0x22, 0xd8, 0x8b, 0x86, 0x62,
0x01, 0x00, 0x00, 0x0f, 0x22, 0xc0, 0xeb, 0x00,
0xeb, 0x00, 0x90, 0x0f, 0x01, 0x96, 0x58, 0x01,
0x00, 0x00, 0x0f, 0x01, 0x9e, 0x60, 0x01, 0x00,
0x00, 0x0f, 0x00, 0x96, 0x5e, 0x01, 0x00, 0x00,
0x8b, 0x86, 0x46, 0x01, 0x00, 0x00, 0x0f, 0x22,
0xd0, 0x8b, 0x86, 0x4e, 0x01, 0x00, 0x00, 0x0f,
0x22, 0xe0, 0x66, 0x8b, 0x86, 0x68, 0x01, 0x00,
0x00, 0x8e, 0xc0, 0x66, 0x8b, 0x86, 0x6a, 0x01,
0x00, 0x00, 0x8e, 0xe0, 0x66, 0x8b, 0x86, 0x6c,
0xeb, 0x00, 0x90, 0x0f, 0x01, 0x96, 0x68, 0x01,
0x00, 0x00, 0x0f, 0x01, 0x9e, 0x70, 0x01, 0x00,
0x00, 0x0f, 0x00, 0x96, 0x6e, 0x01, 0x00, 0x00,
0x8b, 0x86, 0x56, 0x01, 0x00, 0x00, 0x0f, 0x22,
0xd0, 0x8b, 0x86, 0x5e, 0x01, 0x00, 0x00, 0x0f,
0x22, 0xe0, 0x66, 0x8b, 0x86, 0x78, 0x01, 0x00,
0x00, 0x8e, 0xc0, 0x66, 0x8b, 0x86, 0x7a, 0x01,
0x00, 0x00, 0x8e, 0xe0, 0x66, 0x8b, 0x86, 0x7c,
0x01, 0x00, 0x00, 0x8e, 0xe8, 0x66, 0x8b, 0x86,
0x6e, 0x01, 0x00, 0x00, 0x8e, 0xd0, 0x8b, 0x9e,
0x70, 0x01, 0x00, 0x00, 0x66, 0x8b, 0x86, 0x66,
0x7e, 0x01, 0x00, 0x00, 0x8e, 0xd0, 0x8b, 0x9e,
0x80, 0x01, 0x00, 0x00, 0x66, 0x8b, 0x86, 0x76,
0x01, 0x00, 0x00, 0x8e, 0xd8, 0xff, 0xe3, 0xb0,
0xc0, 0xe6, 0x42, 0xb0, 0x04, 0xe6, 0x42, 0xe4,
0x61, 0x0c, 0x03, 0xe6, 0x61, 0xc3, 0xe4, 0x61,

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_wakeup.c,v 1.35 2007/03/04 05:59:56 christos Exp $ */
/* $NetBSD: acpi_wakeup.c,v 1.36 2007/04/28 14:03:00 joerg 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.35 2007/03/04 05:59:56 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.36 2007/04/28 14:03:00 joerg Exp $");
/*-
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
@ -100,8 +100,10 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.35 2007/03/04 05:59:56 christos Ex
static paddr_t phys_wakeup = 0;
static int acpi_md_node = CTL_EOL;
static int acpi_md_vbios_reset = 1;
static int acpi_md_beep_on_reset = 1;
static int sysctl_md_acpi_vbios_reset(SYSCTLFN_ARGS);
static int sysctl_md_acpi_beep_on_reset(SYSCTLFN_ARGS);
uint32_t
acpi_md_get_npages_of_wakecode(void)
@ -366,6 +368,7 @@ acpi_md_sleep(int state)
p_gdt->rd_base = vtophys(r_gdt.rd_base);
WAKECODE_FIXUP(vbios_reset, uint8_t, acpi_md_vbios_reset);
WAKECODE_FIXUP(beep_on_reset, uint8_t, acpi_md_beep_on_reset);
WAKECODE_FIXUP(previous_cr0, uint32_t, r_cr0);
WAKECODE_FIXUP(previous_cr2, uint32_t, r_cr2);
@ -484,6 +487,10 @@ SYSCTL_SETUP(sysctl_md_acpi_setup, "acpi i386 sysctl setup")
CTLTYPE_INT, "acpi_vbios_reset", NULL, sysctl_md_acpi_vbios_reset,
0, NULL, 0, CTL_CREATE, CTL_EOL) != 0)
return;
if (sysctl_createv(NULL, 0, &node, &ssnode, CTLFLAG_READWRITE,
CTLTYPE_INT, "acpi_beep_on_reset", NULL, sysctl_md_acpi_beep_on_reset,
0, NULL, 0, CTL_CREATE, CTL_EOL) != 0)
return;
acpi_md_node = node->sysctl_num;
}
@ -508,3 +515,24 @@ sysctl_md_acpi_vbios_reset(SYSCTLFN_ARGS)
return 0;
}
static int
sysctl_md_acpi_beep_on_reset(SYSCTLFN_ARGS)
{
int error, t;
struct sysctlnode node;
node = *rnode;
t = acpi_md_beep_on_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_beep_on_reset = t;
return 0;
}