Set hw.acpi.sleep.vbios when a non-HW accelerated VGA driver attaches.

If the VGA_POST option is present in the kernel the default value is 2,
otherwise 1. PR kern/50781

Reviewed by:    agc, mrg
This commit is contained in:
jmcneill 2016-09-21 00:00:06 +00:00
parent 471f5c28ab
commit 8b9bb61b71
4 changed files with 45 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_machdep.c,v 1.12 2016/01/28 23:50:04 htodd Exp $ */
/* $NetBSD: acpi_machdep.c,v 1.13 2016/09/21 00:00:06 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.12 2016/01/28 23:50:04 htodd Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.13 2016/09/21 00:00:06 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.12 2016/01/28 23:50:04 htodd Exp
#include <machine/cpufunc.h>
#include <machine/bootinfo.h>
#include <machine/autoconf.h>
#include <dev/acpi/acpica.h>
#include <dev/acpi/acpivar.h>
@ -76,6 +77,16 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.12 2016/01/28 23:50:04 htodd Exp
#include "acpica.h"
#include "opt_mpbios.h"
#include "opt_acpi.h"
#include "opt_vga.h"
/*
* Default VBIOS reset method for non-HW accelerated VGA drivers.
*/
#ifdef VGA_POST
# define VBIOS_RESET_DEFAULT 2
#else
# define VBIOS_RESET_DEFAULT 1
#endif
ACPI_STATUS
acpi_md_OsInitialize(void)
@ -455,3 +466,26 @@ acpi_md_callback(struct acpi_softc *sc)
acpimcfg_init(x86_bus_space_mem, &acpi_md_mcfg_ops);
}
#ifndef XEN
void
device_acpi_register(device_t dev, void *aux)
{
device_t parent;
bool device_is_vga, device_is_pci, device_is_isa;
parent = device_parent(dev);
if (parent == NULL)
return;
device_is_vga = device_is_a(dev, "vga") || device_is_a(dev, "genfb");
device_is_pci = device_is_a(parent, "pci");
device_is_isa = device_is_a(parent, "isa");
if (device_is_vga && (device_is_pci || device_is_isa)) {
extern int acpi_md_vbios_reset;
acpi_md_vbios_reset = VBIOS_RESET_DEFAULT;
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.h,v 1.3 2011/10/18 23:25:20 dyoung Exp $ */
/* $NetBSD: autoconf.h,v 1.4 2016/09/21 00:00:07 jmcneill Exp $ */
#ifndef _X86_AUTOCONF_H_
#define _X86_AUTOCONF_H_
@ -7,5 +7,6 @@
void device_pci_props_register(device_t, void *);
device_t device_pci_register(device_t, void *);
device_t device_isa_register(device_t, void *);
void device_acpi_register(device_t, void *);
#endif /* _X86_AUTOCONF_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: x86_autoconf.c,v 1.74 2015/05/10 22:21:38 mlelstv Exp $ */
/* $NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.74 2015/05/10 22:21:38 mlelstv Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -542,6 +542,8 @@ device_register(device_t dev, void *aux)
{
device_t isaboot, pciboot;
device_acpi_register(dev, aux);
isaboot = device_isa_register(dev, aux);
pciboot = device_pci_register(dev, aux);

View File

@ -1,7 +1,7 @@
/* $NetBSD: x86_stub.c,v 1.4 2011/10/19 05:01:43 dyoung Exp $ */
/* $NetBSD: x86_stub.c,v 1.5 2016/09/21 00:00:07 jmcneill Exp $ */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_stub.c,v 1.4 2011/10/19 05:01:43 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_stub.c,v 1.5 2016/09/21 00:00:07 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -31,6 +31,7 @@ x86_zeroop(void)
return 0;
}
__weak_alias(device_acpi_register, x86_nullop);
__weak_alias(device_isa_register, x86_nullop);
__weak_alias(device_pci_props_register, x86_voidop);
__weak_alias(device_pci_register, x86_nullop);