summaryrefslogtreecommitdiffstats
path: root/sys/dev/ste/if_ste.c
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2010-08-09 01:47:09 +0000
committeryongari <yongari@FreeBSD.org>2010-08-09 01:47:09 +0000
commitf0e5a03c1591762c5e41ee125b56c09ce578e635 (patch)
tree13da83a9dfdc5e08326d52b2b44948d84cda803a /sys/dev/ste/if_ste.c
parentfcb01044827f23ad69069d690a291bff2866683c (diff)
downloadFreeBSD-src-f0e5a03c1591762c5e41ee125b56c09ce578e635.zip
FreeBSD-src-f0e5a03c1591762c5e41ee125b56c09ce578e635.tar.gz
It seems some old Sundace(now IC Plus Corp.) controllers do not
like memory mapped register access. Typical problem from the issue was MII access returned unreliable values. I'm not sure this comes from lack of register flushing in MII access after accessing STE_PHYCTL register though. To address the issue, read hints data that controls which type of memory mapping should be used in driver. ste(4) still prefers memory mapping to io mapping but honor hints entered by user except for controllers that have problems with memory mapping. The hint to use iomapping could be given by adding the following line to /boot/device.hints file. hint.ste.0.prefer_iomap="1" PR: kern/149285 MFC after: 5 days
Diffstat (limited to 'sys/dev/ste/if_ste.c')
-rw-r--r--sys/dev/ste/if_ste.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/sys/dev/ste/if_ste.c b/sys/dev/ste/if_ste.c
index 78c0290..e3297e6 100644
--- a/sys/dev/ste/if_ste.c
+++ b/sys/dev/ste/if_ste.c
@@ -1059,7 +1059,7 @@ ste_attach(device_t dev)
struct ste_softc *sc;
struct ifnet *ifp;
uint16_t eaddr[ETHER_ADDR_LEN / 2];
- int error = 0, pmc, rid;
+ int error = 0, pmc, prefer_iomap, rid;
sc = device_get_softc(dev);
sc->ste_dev = dev;
@@ -1081,12 +1081,25 @@ ste_attach(device_t dev)
*/
pci_enable_busmaster(dev);
- /* Prefer memory space register mapping over IO space. */
- sc->ste_res_id = PCIR_BAR(1);
- sc->ste_res_type = SYS_RES_MEMORY;
- sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,
- &sc->ste_res_id, RF_ACTIVE);
- if (sc->ste_res == NULL) {
+ /*
+ * Prefer memory space register mapping over IO space but use
+ * IO space for a device that is known to have issues on memory
+ * mapping.
+ */
+ prefer_iomap = 0;
+ if (pci_get_device(dev) == ST_DEVICEID_ST201_1)
+ prefer_iomap = 1;
+ else
+ resource_int_value(device_get_name(sc->ste_dev),
+ device_get_unit(sc->ste_dev), "prefer_iomap",
+ &prefer_iomap);
+ if (prefer_iomap == 0) {
+ sc->ste_res_id = PCIR_BAR(1);
+ sc->ste_res_type = SYS_RES_MEMORY;
+ sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,
+ &sc->ste_res_id, RF_ACTIVE);
+ }
+ if (prefer_iomap || sc->ste_res == NULL) {
sc->ste_res_id = PCIR_BAR(0);
sc->ste_res_type = SYS_RES_IOPORT;
sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,
OpenPOWER on IntegriCloud