Module Name:    src
Committed By:   bouyer
Date:           Wed Feb 16 20:32:15 UTC 2011

Modified Files:
        src/sys/dev/pci [netbsd-5-1]: pci.c

Log Message:
Pull up following revision(s) (requested by dyoung in ticket #1540):
        sys/dev/pci/pci.c: revision 1.131
During shutdown, restore the each PCI device's bus-mastering enable to
the state that we found it in before attaching a driver to it.


To generate a diff of this commit:
cvs rdiff -u -r1.119.4.1 -r1.119.4.1.6.1 src/sys/dev/pci/pci.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/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.119.4.1 src/sys/dev/pci/pci.c:1.119.4.1.6.1
--- src/sys/dev/pci/pci.c:1.119.4.1	Thu Nov 20 02:40:59 2008
+++ src/sys/dev/pci/pci.c	Wed Feb 16 20:32:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.119.4.1 2008/11/20 02:40:59 snj Exp $	*/
+/*	$NetBSD: pci.c,v 1.119.4.1.6.1 2011/02/16 20:32:15 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.119.4.1 2008/11/20 02:40:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.119.4.1.6.1 2011/02/16 20:32:15 bouyer Exp $");
 
 #include "opt_pci.h"
 
@@ -869,6 +869,7 @@
 	int p_pm_offset;
 	pcireg_t p_pm_cap;
 	pcireg_t p_class;
+	pcireg_t p_csr;
 };
 
 static bool
@@ -922,9 +923,10 @@
 	struct pci_child_power *priv = device_pmf_bus_private(dv);
 	pcireg_t csr;
 
-	/* disable busmastering */
+	/* restore original bus-mastering state */
 	csr = pci_conf_read(priv->p_pc, priv->p_tag, PCI_COMMAND_STATUS_REG);
 	csr &= ~PCI_COMMAND_MASTER_ENABLE;
+	csr |= priv->p_csr & PCI_COMMAND_MASTER_ENABLE;
 	pci_conf_write(priv->p_pc, priv->p_tag, PCI_COMMAND_STATUS_REG, csr);
 	return true;
 }
@@ -955,6 +957,8 @@
 	priv->p_tag = pci_make_tag(priv->p_pc, sc->sc_bus, device,
 	    function);
 	priv->p_class = pci_conf_read(priv->p_pc, priv->p_tag, PCI_CLASS_REG);
+	priv->p_csr = pci_conf_read(priv->p_pc, priv->p_tag,
+	    PCI_COMMAND_STATUS_REG);
 
 	if (pci_get_capability(priv->p_pc, priv->p_tag,
 			       PCI_CAP_PWRMGMT, &off, &reg)) {

Reply via email to