svn commit: r205288 - stable/8/sys/dev/bge

Pyun YongHyeon yongari at FreeBSD.org
Thu Mar 18 18:50:20 UTC 2010


Author: yongari
Date: Thu Mar 18 18:50:20 2010
New Revision: 205288
URL: http://svn.freebsd.org/changeset/base/205288

Log:
  MFC r203358,203716:
  
  r203358:
    PCI express device status register has W1C feature. Writing 0 has
    no effect. Make sure to clear error bits by writing 1. [1]
    While I'm here use predefined value instead of hardcodig magic
    vlaue.
  
    Submitted by:	msaitoh at NetBSD [1]
  
  r203716:
    Move device specific flag configuration to attach routine.
    The softc obtained in device probe wouldn't be the same one used in
    device attach. Drivers should not assume any values stored in softc
    structure in probe routine will be available for its attach routine.

Modified:
  stable/8/sys/dev/bge/if_bge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Thu Mar 18 18:45:45 2010	(r205287)
+++ stable/8/sys/dev/bge/if_bge.c	Thu Mar 18 18:50:20 2010	(r205288)
@@ -1993,10 +1993,6 @@ bge_probe(device_t dev)
 			snprintf(buf, 96, "%s, %sASIC rev. %#08x", model,
 			    br != NULL ? "" : "unknown ", id);
 			device_set_desc_copy(dev, buf);
-			if (pci_get_subvendor(dev) == DELL_VENDORID)
-				sc->bge_flags |= BGE_FLAG_NO_3LED;
-			if (did == BCOM_DEVICEID_BCM5755M)
-				sc->bge_flags |= BGE_FLAG_ADJUST_TRIM;
 			return (0);
 		}
 		t++;
@@ -2607,6 +2603,10 @@ bge_attach(device_t dev)
 		sc->bge_flags |= BGE_FLAG_ADC_BUG;
 	if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0)
 		sc->bge_flags |= BGE_FLAG_5704_A0_BUG;
+	if (pci_get_subvendor(dev) == DELL_VENDORID)
+		sc->bge_flags |= BGE_FLAG_NO_3LED;
+	if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M)
+		sc->bge_flags |= BGE_FLAG_ADJUST_TRIM;
 	if (BGE_IS_5705_PLUS(sc) &&
 	    !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) {
 		if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
@@ -3136,14 +3136,17 @@ bge_reset(struct bge_softc *sc)
 		devctl = pci_read_config(dev,
 		    sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, 2);
 		/* Clear enable no snoop and disable relaxed ordering. */
-		devctl &= ~(0x0010 | 0x0800);
+		devctl &= ~(PCIM_EXP_CTL_RELAXED_ORD_ENABLE |
+		    PCIM_EXP_CTL_NOSNOOP_ENABLE);
 		/* Set PCIE max payload size to 128. */
 		devctl &= ~PCIM_EXP_CTL_MAX_PAYLOAD;
 		pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL,
 		    devctl, 2);
 		/* Clear error status. */
 		pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_STA,
-		    0, 2);
+		    PCIM_EXP_STA_CORRECTABLE_ERROR |
+		    PCIM_EXP_STA_NON_FATAL_ERROR | PCIM_EXP_STA_FATAL_ERROR |
+		    PCIM_EXP_STA_UNSUPPORTED_REQ, 2);
 	}
 
 	/* Reset some of the PCI state that got zapped by reset. */


More information about the svn-src-stable mailing list