Module Name:    src
Committed By:   jakllsch
Date:           Sat Aug  6 21:57:04 UTC 2016

Modified Files:
        src/sys/arch/x86/pci: ichlpcib.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/ichlpcib.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/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.50 src/sys/arch/x86/pci/ichlpcib.c:1.51
--- src/sys/arch/x86/pci/ichlpcib.c:1.50	Sun May 17 04:59:43 2015
+++ src/sys/arch/x86/pci/ichlpcib.c	Sat Aug  6 21:57:04 2016
@@ -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 @@ static struct lpcib_device {
 };
 
 /*
+ * 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 @@ lpcib_gpio_configure(device_t self)
 	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;

Reply via email to