CVS commit: [netbsd-5-1] src/sys/dev/pci

2011-03-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Mar  7 04:15:02 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1544):
sys/dev/pci/if_wm.c: revision 1.219
wm_gmii_reset(): restore generic reset delays to what they were before
rev 1.186. This makes the following hardware find its PHY again, and I can't
see how these larger delays could be a problem for other hardware:
wm0 at pci6 dev 7 function 0: Intel i82541GI 1000BASE-T Ethernet, rev. 5
wm0: interrupting at ioapic2 pin 0, event channel 5
wm0: 32-bit 66MHz PCI bus
wm0: 65536 word (16 address bits) SPI EEPROM
wm0: Ethernet address 00:13:72:54:ee:13
igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.162.4.13 -r1.162.4.13.2.1 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.162.4.13 src/sys/dev/pci/if_wm.c:1.162.4.13.2.1
--- src/sys/dev/pci/if_wm.c:1.162.4.13	Thu Feb 25 10:59:58 2010
+++ src/sys/dev/pci/if_wm.c	Mon Mar  7 04:15:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.162.4.13 2010/02/25 10:59:58 sborrill Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.162.4.13.2.1 2011/03/07 04:15:01 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.162.4.13 2010/02/25 10:59:58 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.162.4.13.2.1 2011/03/07 04:15:01 riz Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -4914,9 +4914,9 @@
 	case WM_T_80003:
 		/* generic reset */
 		CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl | CTRL_PHY_RESET);
-		delay((sc->sc_type >= WM_T_82571) ? 100 : 10*1000);
+		delay(2);
 		CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
-		delay(150);
+		delay(2);
 
 		if ((sc->sc_type == WM_T_82541)
 		|| (sc->sc_type == WM_T_82541_2)



CVS commit: [netbsd-5-1] src/sys/dev/pci

2011-02-16 Thread Manuel Bouyer
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 
-__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, ®)) {



CVS commit: [netbsd-5-1] src/sys/dev/pci

2014-08-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 27 06:17:32 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1922):
sys/dev/pci/pci_usrreq.c1.26 via patch

Fix to make pci(4) reject unaligned configuration register reads and writes
before feeding them to a kassert in pci_conf_read/write or to a trap in the
hardware itself.


To generate a diff of this commit:
cvs rdiff -u -r1.16.6.3 -r1.16.6.3.2.1 src/sys/dev/pci/pci_usrreq.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_usrreq.c
diff -u src/sys/dev/pci/pci_usrreq.c:1.16.6.3 src/sys/dev/pci/pci_usrreq.c:1.16.6.3.2.1
--- src/sys/dev/pci/pci_usrreq.c:1.16.6.3	Tue Sep 15 06:48:49 2009
+++ src/sys/dev/pci/pci_usrreq.c	Wed Aug 27 06:17:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_usrreq.c,v 1.16.6.3 2009/09/15 06:48:49 snj Exp $	*/
+/*	$NetBSD: pci_usrreq.c,v 1.16.6.3.2.1 2014/08/27 06:17:31 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_usrreq.c,v 1.16.6.3 2009/09/15 06:48:49 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_usrreq.c,v 1.16.6.3.2.1 2014/08/27 06:17:31 msaitoh Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ pciioctl(dev_t dev, u_long cmd, void *da
 	case PCI_IOC_BDF_CFGREAD:
 	case PCI_IOC_BDF_CFGWRITE:
 		if (bdfr->bus > 255 || bdfr->device >= sc->sc_maxndevs ||
-		bdfr->function > 7)
+		bdfr->function > 7 || ISSET(bdfr->cfgreg.reg, 3))
 			return (EINVAL);
 		tag = pci_make_tag(sc->sc_pc, bdfr->bus, bdfr->device,
 		bdfr->function);