Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci Disable gpio(4) attachment to ichlpcib(4) b...



details:   https://anonhg.NetBSD.org/src/rev/585455dad93a
branches:  trunk
changeset: 346914:585455dad93a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Aug 06 21:57:04 2016 +0000

description:
Disable gpio(4) attachment to ichlpcib(4) by default.

The GPIO lines on an ICH are usually connected to opaque platform-
defined functionality, and may be manipulated by the ACPI DSDT or other
mechanisms behind our backs.  In one instance, it was found this
in combiation with gpio_resume() sabotaged repeated suspend/resume cycles.

GPIO functionality can be enabled by setting ichlpcib_gpio_disable to 0,
for instance with `gdb -write`.

diffstat:

 sys/arch/x86/pci/ichlpcib.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 0b24e0282d82 -r 585455dad93a sys/arch/x86/pci/ichlpcib.c
--- a/sys/arch/x86/pci/ichlpcib.c       Sat Aug 06 21:39:48 2016 +0000
+++ b/sys/arch/x86/pci/ichlpcib.c       Sat Aug 06 21:57:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ichlpcib.c,v 1.50 2015/05/17 04:59:43 msaitoh Exp $    */
+/*     $NetBSD: ichlpcib.c,v 1.51 2016/08/06 21:57:04 jakllsch Exp $   */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.50 2015/05/17 04:59:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.51 2016/08/06 21:57:04 jakllsch Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -277,6 +277,14 @@
 };
 
 /*
+ * Allow user to enable GPIO functionality if they really need it.  The
+ * vast majority of systems with an ICH should not expose GPIO to the
+ * kernel or user.  In at least one instance the gpio_resume() handler
+ * on ICH GPIO was found to sabotage S3 suspend/resume.
+ */
+int    ichlpcib_gpio_disable = 1;
+
+/*
  * Autoconf callbacks.
  */
 static int
@@ -888,6 +896,9 @@
        int pin, shift, base_reg, cntl_reg, reg;
        int rv;
 
+       if (ichlpcib_gpio_disable != 0)
+               return;
+
        /* this implies ICH >= 6, and thus different mapreg */
        if (sc->sc_has_rcba) {
                base_reg = LPCIB_PCI_GPIO_BASE_ICH6;



Home | Main Index | Thread Index | Old Index