summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-09-14 16:33:48 +0000
committermdodd <mdodd@FreeBSD.org>2003-09-14 16:33:48 +0000
commit62212eee0646e55d33e181d0c92a4bef127c5ce0 (patch)
tree445a01dfa7515342c2007c33a6cba85e534d3ae7
parentb81e6a864402855a649403bcad99618c6aef8efc (diff)
downloadFreeBSD-src-62212eee0646e55d33e181d0c92a4bef127c5ce0.zip
FreeBSD-src-62212eee0646e55d33e181d0c92a4bef127c5ce0.tar.gz
- Avoid calling pci_get_device() more than once in a single function.
- Provide a mechanism to prevent the use of MMIO. - Prevent the use of MMIO for all 3c575 cardbus cards.
-rw-r--r--sys/pci/if_xl.c61
-rw-r--r--sys/pci/if_xlreg.h1
2 files changed, 40 insertions, 22 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index 5d83aca..f8841f4 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -1311,6 +1311,7 @@ xl_attach(dev)
struct ifnet *ifp;
int media = IFM_ETHER|IFM_100_TX|IFM_FDX;
int unit, error = 0, rid, res;
+ uint16_t did;
sc = device_get_softc(dev);
unit = device_get_unit(dev);
@@ -1319,41 +1320,54 @@ xl_attach(dev)
MTX_DEF | MTX_RECURSE);
ifmedia_init(&sc->ifmedia, 0, xl_ifmedia_upd, xl_ifmedia_sts);
+ did = pci_get_device(dev);
+
sc->xl_flags = 0;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_555)
+ if (did == TC_DEVICEID_HURRICANE_555)
sc->xl_flags |= XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_PHYOK;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_556 ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_556B)
+ if (did == TC_DEVICEID_HURRICANE_556 ||
+ did == TC_DEVICEID_HURRICANE_556B)
sc->xl_flags |= XL_FLAG_FUNCREG | XL_FLAG_PHYOK |
XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_WEIRDRESET |
XL_FLAG_INVERT_LED_PWR | XL_FLAG_INVERT_MII_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_555 ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_556)
+ if (did == TC_DEVICEID_HURRICANE_555 ||
+ did == TC_DEVICEID_HURRICANE_556)
sc->xl_flags |= XL_FLAG_8BITROM;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_556B)
+ if (did == TC_DEVICEID_HURRICANE_556B)
sc->xl_flags |= XL_FLAG_NO_XCVR_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_575A ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_575B ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_575C ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_656B ||
- pci_get_device(dev) == TC_DEVICEID_TORNADO_656C)
+ if (did == TC_DEVICEID_HURRICANE_575A ||
+ did == TC_DEVICEID_HURRICANE_575B ||
+ did == TC_DEVICEID_HURRICANE_575C ||
+ did == TC_DEVICEID_HURRICANE_656B ||
+ did == TC_DEVICEID_TORNADO_656C)
sc->xl_flags |= XL_FLAG_FUNCREG | XL_FLAG_PHYOK |
XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_656)
+ if (did == TC_DEVICEID_HURRICANE_656)
sc->xl_flags |= XL_FLAG_FUNCREG | XL_FLAG_PHYOK;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_575B)
+ if (did == TC_DEVICEID_HURRICANE_575B)
sc->xl_flags |= XL_FLAG_INVERT_LED_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_575C)
+ if (did == TC_DEVICEID_HURRICANE_575C)
sc->xl_flags |= XL_FLAG_INVERT_MII_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_TORNADO_656C)
+ if (did == TC_DEVICEID_TORNADO_656C)
sc->xl_flags |= XL_FLAG_INVERT_MII_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_656 ||
- pci_get_device(dev) == TC_DEVICEID_HURRICANE_656B)
+ if (did == TC_DEVICEID_HURRICANE_656 ||
+ did == TC_DEVICEID_HURRICANE_656B)
sc->xl_flags |= XL_FLAG_INVERT_MII_PWR |
XL_FLAG_INVERT_LED_PWR;
- if (pci_get_device(dev) == TC_DEVICEID_TORNADO_10_100BT_920B)
+ if (did == TC_DEVICEID_TORNADO_10_100BT_920B)
sc->xl_flags |= XL_FLAG_PHYOK;
+
+ switch (did) {
+ case TC_DEVICEID_HURRICANE_575A:
+ case TC_DEVICEID_HURRICANE_575B:
+ case TC_DEVICEID_HURRICANE_575C:
+ sc->xl_flags |= XL_FLAG_NO_MMIO;
+ break;
+ default:
+ break;
+ }
+
#ifndef BURN_BRIDGES
/*
* If this is a 3c905B, we have to check one extra thing.
@@ -1394,16 +1408,19 @@ xl_attach(dev)
pci_write_config(dev, XL_PCI_INTLINE, irq, 4);
}
#endif
+
/*
* Map control/status registers.
*/
pci_enable_busmaster(dev);
- rid = XL_PCI_LOMEM;
- res = SYS_RES_MEMORY;
+ if ((sc->xl_flags & XL_FLAG_NO_MMIO) == 0) {
+ rid = XL_PCI_LOMEM;
+ res = SYS_RES_MEMORY;
- sc->xl_res = bus_alloc_resource(dev, res, &rid,
- 0, ~0, 1, RF_ACTIVE);
+ sc->xl_res = bus_alloc_resource(dev, res, &rid,
+ 0, ~0, 1, RF_ACTIVE);
+ }
if (sc->xl_res != NULL) {
sc->xl_flags |= XL_FLAG_USE_MMIO;
diff --git a/sys/pci/if_xlreg.h b/sys/pci/if_xlreg.h
index 9778f26..d32d636 100644
--- a/sys/pci/if_xlreg.h
+++ b/sys/pci/if_xlreg.h
@@ -572,6 +572,7 @@ struct xl_mii_frame {
#define XL_FLAG_INVERT_MII_PWR 0x0040
#define XL_FLAG_NO_XCVR_PWR 0x0080
#define XL_FLAG_USE_MMIO 0x0100
+#define XL_FLAG_NO_MMIO 0x0200
#define XL_NO_XCVR_PWR_MAGICBITS 0x0900
OpenPOWER on IntegriCloud