Module Name:    src
Committed By:   jmcneill
Date:           Wed Sep 21 00:00:07 UTC 2016

Modified Files:
        src/sys/arch/x86/acpi: acpi_machdep.c
        src/sys/arch/x86/include: autoconf.h
        src/sys/arch/x86/x86: x86_autoconf.c x86_stub.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/acpi/acpi_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/x86_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.12 src/sys/arch/x86/acpi/acpi_machdep.c:1.13
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.12	Thu Jan 28 23:50:04 2016
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Wed Sep 21 00:00:06 2016
@@ -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
 
 #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
 #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

Index: src/sys/arch/x86/include/autoconf.h
diff -u src/sys/arch/x86/include/autoconf.h:1.3 src/sys/arch/x86/include/autoconf.h:1.4
--- src/sys/arch/x86/include/autoconf.h:1.3	Tue Oct 18 23:25:20 2011
+++ src/sys/arch/x86/include/autoconf.h	Wed Sep 21 00:00:07 2016
@@ -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_ */

Index: src/sys/arch/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.74 src/sys/arch/x86/x86/x86_autoconf.c:1.75
--- src/sys/arch/x86/x86/x86_autoconf.c:1.74	Sun May 10 22:21:38 2015
+++ src/sys/arch/x86/x86/x86_autoconf.c	Wed Sep 21 00:00:07 2016
@@ -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);
 

Index: src/sys/arch/x86/x86/x86_stub.c
diff -u src/sys/arch/x86/x86/x86_stub.c:1.4 src/sys/arch/x86/x86/x86_stub.c:1.5
--- src/sys/arch/x86/x86/x86_stub.c:1.4	Wed Oct 19 05:01:43 2011
+++ src/sys/arch/x86/x86/x86_stub.c	Wed Sep 21 00:00:07 2016
@@ -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);

Reply via email to