Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86 Set hw.acpi.sleep.vbios when a non-HW accelerat...



details:   https://anonhg.NetBSD.org/src/rev/88c13559e1d7
branches:  trunk
changeset: 347880:88c13559e1d7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Sep 21 00:00:06 2016 +0000

description:
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

diffstat:

 sys/arch/x86/acpi/acpi_machdep.c |  38 ++++++++++++++++++++++++++++++++++++--
 sys/arch/x86/include/autoconf.h  |   3 ++-
 sys/arch/x86/x86/x86_autoconf.c  |   6 ++++--
 sys/arch/x86/x86/x86_stub.c      |   5 +++--
 4 files changed, 45 insertions(+), 7 deletions(-)

diffs (134 lines):

diff -r bada0c80793c -r 88c13559e1d7 sys/arch/x86/acpi/acpi_machdep.c
--- a/sys/arch/x86/acpi/acpi_machdep.c  Tue Sep 20 21:18:08 2016 +0000
+++ b/sys/arch/x86/acpi/acpi_machdep.c  Wed Sep 21 00:00:06 2016 +0000
@@ -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 @@
 
 #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 @@
 #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 @@
 
        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
diff -r bada0c80793c -r 88c13559e1d7 sys/arch/x86/include/autoconf.h
--- a/sys/arch/x86/include/autoconf.h   Tue Sep 20 21:18:08 2016 +0000
+++ b/sys/arch/x86/include/autoconf.h   Wed Sep 21 00:00:06 2016 +0000
@@ -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_ */
diff -r bada0c80793c -r 88c13559e1d7 sys/arch/x86/x86/x86_autoconf.c
--- a/sys/arch/x86/x86/x86_autoconf.c   Tue Sep 20 21:18:08 2016 +0000
+++ b/sys/arch/x86/x86/x86_autoconf.c   Wed Sep 21 00:00:06 2016 +0000
@@ -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_t isaboot, pciboot;
 
+       device_acpi_register(dev, aux);
+
        isaboot = device_isa_register(dev, aux);
        pciboot = device_pci_register(dev, aux);
 
diff -r bada0c80793c -r 88c13559e1d7 sys/arch/x86/x86/x86_stub.c
--- a/sys/arch/x86/x86/x86_stub.c       Tue Sep 20 21:18:08 2016 +0000
+++ b/sys/arch/x86/x86/x86_stub.c       Wed Sep 21 00:00:06 2016 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index