diff options
author | mdodd <mdodd@FreeBSD.org> | 2003-04-16 03:16:57 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2003-04-16 03:16:57 +0000 |
commit | 74c95b7f29ae970fc99cad21e8ea772eb2557bd1 (patch) | |
tree | 43770c3696a3adbe67787f9d9f8ff9d3bb30a425 /sys/dev | |
parent | ac7452631f13ef6bbb59e825e8e3ebb14d8e9a46 (diff) | |
download | FreeBSD-src-74c95b7f29ae970fc99cad21e8ea772eb2557bd1.zip FreeBSD-src-74c95b7f29ae970fc99cad21e8ea772eb2557bd1.tar.gz |
- Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
bus code will do this now.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/bge/if_bge.c | 9 | ||||
-rw-r--r-- | sys/dev/dc/if_dc.c | 17 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 14 | ||||
-rw-r--r-- | sys/dev/gem/if_gem_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/hea/hea_pci.c | 13 | ||||
-rw-r--r-- | sys/dev/hfa/hfa_pci.c | 13 | ||||
-rw-r--r-- | sys/dev/hme/if_hme_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/lge/if_lge.c | 18 | ||||
-rw-r--r-- | sys/dev/nge/if_nge.c | 18 | ||||
-rw-r--r-- | sys/dev/pdq/if_fpa.c | 15 | ||||
-rw-r--r-- | sys/dev/sf/if_sf.c | 18 | ||||
-rw-r--r-- | sys/dev/sk/if_sk.c | 18 | ||||
-rw-r--r-- | sys/dev/sound/pci/ich.c | 1 | ||||
-rw-r--r-- | sys/dev/sound/pci/via8233.c | 1 | ||||
-rw-r--r-- | sys/dev/ti/if_ti.c | 9 | ||||
-rw-r--r-- | sys/dev/txp/if_txp.c | 18 | ||||
-rw-r--r-- | sys/dev/vr/if_vr.c | 18 |
17 files changed, 4 insertions, 198 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index aa89e70..19201b3 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -1448,7 +1448,6 @@ bge_attach(dev) device_t dev; { int s; - u_int32_t command; struct ifnet *ifp; struct bge_softc *sc; u_int32_t hwcfg = 0; @@ -1466,14 +1465,6 @@ bge_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - - if (!(command & PCIM_CMD_MEMEN)) { - printf("bge%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } rid = BGE_PCI_BAR0; sc->bge_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 86fd9d5..f39e612 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1916,23 +1916,6 @@ dc_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef DC_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("dc%d: failed to enable I/O ports!\n", unit); - error = ENXIO; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("dc%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } -#endif rid = DC_RID; sc->dc_res = bus_alloc_resource(dev, DC_RES, &rid, diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index c84c29a..4dcb7c2 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -391,8 +391,6 @@ fxp_attach(device_t dev) * BIOS/Prom forgot about it. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); val = pci_read_config(dev, PCIR_COMMAND, 2); fxp_powerstate_d0(dev); @@ -411,14 +409,11 @@ fxp_attach(device_t dev) m2 = PCIM_CMD_MEMEN; } - if (val & m1) { - sc->rtp = - (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; - sc->rgd = (m1 == PCIM_CMD_MEMEN)? FXP_PCI_MMBA : FXP_PCI_IOBA; - sc->mem = bus_alloc_resource(dev, sc->rtp, &sc->rgd, + sc->rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; + sc->rgd = (m1 == PCIM_CMD_MEMEN)? FXP_PCI_MMBA : FXP_PCI_IOBA; + sc->mem = bus_alloc_resource(dev, sc->rtp, &sc->rgd, 0, ~0, 1, RF_ACTIVE); - } - if (sc->mem == NULL && (val & m2)) { + if (sc->mem == NULL) { sc->rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; sc->rgd = (m2 == PCIM_CMD_MEMEN)? FXP_PCI_MMBA : FXP_PCI_IOBA; @@ -427,7 +422,6 @@ fxp_attach(device_t dev) } if (!sc->mem) { - device_printf(dev, "could not map device registers\n"); error = ENXIO; goto fail; } diff --git a/sys/dev/gem/if_gem_pci.c b/sys/dev/gem/if_gem_pci.c index 7c8146a..03fa1d4 100644 --- a/sys/dev/gem/if_gem_pci.c +++ b/sys/dev/gem/if_gem_pci.c @@ -163,7 +163,6 @@ gem_pci_attach(dev) * cases not do this for us on sparc64 machines. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); sc->sc_dev = dev; sc->sc_pci = 1; /* XXX */ diff --git a/sys/dev/hea/hea_pci.c b/sys/dev/hea/hea_pci.c index 8432f58..8d40b48 100644 --- a/sys/dev/hea/hea_pci.c +++ b/sys/dev/hea/hea_pci.c @@ -154,19 +154,6 @@ hea_pci_attach (dev) error = 0; pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); - - command = pci_read_config(dev, PCIR_COMMAND, 2); - if ((command & PCIM_CMD_BUSMASTEREN) == 0) { - device_printf(dev, "Unable to enable PCI busmastering.\n"); - error = ENXIO; - goto fail; - } - if ((command & PCIM_CMD_MEMEN) == 0) { - device_printf(dev, "Unable to enable PCI memory resources.\n"); - error = ENXIO; - goto fail; - } sc->mem_rid = PCIR_MAPS; sc->mem_type = SYS_RES_MEMORY; diff --git a/sys/dev/hfa/hfa_pci.c b/sys/dev/hfa/hfa_pci.c index c5c9bd4..f5f448f 100644 --- a/sys/dev/hfa/hfa_pci.c +++ b/sys/dev/hfa/hfa_pci.c @@ -129,19 +129,6 @@ hfa_pci_attach (dev) error = 0; pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); - - command = pci_read_config(dev, PCIR_COMMAND, 2); - if ((command & PCIM_CMD_BUSMASTEREN) == 0) { - device_printf(dev, "Unable to enable PCI busmastering.\n"); - error = ENXIO; - goto fail; - } - if ((command & PCIM_CMD_MEMEN) == 0) { - device_printf(dev, "Unable to enable PCI memory resources.\n"); - error = ENXIO; - goto fail; - } sc->mem_rid = PCA200E_PCI_MEMBASE; sc->mem_type = SYS_RES_MEMORY; diff --git a/sys/dev/hme/if_hme_pci.c b/sys/dev/hme/if_hme_pci.c index 5c06c61..8a89b6b 100644 --- a/sys/dev/hme/if_hme_pci.c +++ b/sys/dev/hme/if_hme_pci.c @@ -137,7 +137,6 @@ hme_pci_attach(device_t dev) * gross; but the hme comes up with neither enabled. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); sc->sc_pci = 1; /* XXXXX should all be done in bus_dma. */ sc->sc_dev = dev; diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index 18a22af..703f46d 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -492,7 +492,6 @@ lge_attach(dev) { int s; u_char eaddr[ETHER_ADDR_LEN]; - u_int32_t command; struct lge_softc *sc; struct ifnet *ifp; int unit, error = 0, rid; @@ -530,23 +529,6 @@ lge_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef LGE_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("lge%d: failed to enable I/O ports!\n", unit); - error = ENXIO;; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("lge%d: failed to enable memory mapping!\n", unit); - error = ENXIO;; - goto fail; - } -#endif rid = LGE_RID; sc->lge_res = bus_alloc_resource(dev, LGE_RES, &rid, diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 0c30ab2..5c9e3c6 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -822,7 +822,6 @@ nge_attach(dev) { int s; u_char eaddr[ETHER_ADDR_LEN]; - u_int32_t command; struct nge_softc *sc; struct ifnet *ifp; int unit, error = 0, rid; @@ -864,23 +863,6 @@ nge_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef NGE_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("nge%d: failed to enable I/O ports!\n", unit); - error = ENXIO;; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("nge%d: failed to enable memory mapping!\n", unit); - error = ENXIO;; - goto fail; - } -#endif rid = NGE_RID; sc->nge_res = bus_alloc_resource(dev, NGE_RES, &rid, diff --git a/sys/dev/pdq/if_fpa.c b/sys/dev/pdq/if_fpa.c index a8941ff..619a227 100644 --- a/sys/dev/pdq/if_fpa.c +++ b/sys/dev/pdq/if_fpa.c @@ -119,21 +119,6 @@ pdq_pci_attach(device_t dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - - if (!(command & PCIM_CMD_PORTEN)) { - device_printf(dev, "Failed to enable PCI I/O ports.\n"); - error = ENXIO; - goto bad; - } - - if (!(command & PCIM_CMD_MEMEN)) { - device_printf(dev, "Failed to enable PCI memory mapping.\n"); - error = ENXIO; - goto bad; - } command = pci_read_config(dev, PCIR_LATTIMER, 1); if (command < DEFPA_LATENCY) { diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index ea3cf3e..a7ebb01 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -672,7 +672,6 @@ sf_attach(dev) device_t dev; { int i; - u_int32_t command; struct sf_softc *sc; struct ifnet *ifp; int unit, rid, error = 0; @@ -710,23 +709,6 @@ sf_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef SF_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("sf%d: failed to enable I/O ports!\n", unit); - error = ENXIO; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("sf%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } -#endif rid = SF_RID; sc->sf_res = bus_alloc_resource(dev, SF_RES, &rid, diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 8b15c5c..1093f34 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1201,7 +1201,6 @@ static int sk_attach(dev) device_t dev; { - u_int32_t command; struct sk_softc *sc; int unit, error = 0, rid, *port; @@ -1238,23 +1237,6 @@ sk_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef SK_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("skc%d: failed to enable I/O ports!\n", unit); - error = ENXIO; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("skc%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } -#endif rid = SK_RID; sc->sk_res = bus_alloc_resource(dev, SK_RES, &rid, diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index 610dee4..aa5e856 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -685,7 +685,6 @@ ich_pci_attach(device_t dev) pci_write_config(dev, PCIR_ICH_LEGACY, ICH_LEGACY_ENABLE, 1); } - pci_enable_io(dev, SYS_RES_IOPORT); /* * Enable bus master. On ich4 this may prevent the detection of * the primary codec becoming ready in ich_init(). diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index 3988445..883012c 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -739,7 +739,6 @@ via_attach(device_t dev) return ENXIO; } - pci_enable_io(dev, SYS_RES_IOPORT); pci_set_powerstate(dev, PCI_POWERSTATE_D0); pci_enable_busmaster(dev); diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index c8a1c63..c1b5796 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -2092,7 +2092,6 @@ static int ti_attach(dev) device_t dev; { - u_int32_t command; struct ifnet *ifp; struct ti_softc *sc; int unit, error = 0, rid; @@ -2123,14 +2122,6 @@ ti_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - - if (!(command & PCIM_CMD_MEMEN)) { - printf("ti%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } rid = TI_PCI_LOMEM; sc->ti_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index fb85927..542f692 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -212,7 +212,6 @@ txp_attach(dev) { struct txp_softc *sc; struct ifnet *ifp; - u_int32_t command; u_int16_t p1; u_int32_t p2; int unit, error = 0, rid; @@ -251,23 +250,6 @@ txp_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); - -#ifdef TXP_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - device_printf(dev, "failed to enable I/O ports!\n"); - error = ENXIO; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - device_printf(dev, "failed to enable memory mapping!\n"); - error = ENXIO; - goto fail; - } -#endif rid = TXP_RID; sc->sc_res = bus_alloc_resource(dev, TXP_RES, &rid, diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index f5dc39d..793ae64 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -735,7 +735,6 @@ vr_attach(dev) { int i; u_char eaddr[ETHER_ADDR_LEN]; - u_int32_t command; struct vr_softc *sc; struct ifnet *ifp; int unit, error = 0, rid; @@ -773,25 +772,8 @@ vr_attach(dev) * Map control/status registers. */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); - pci_enable_io(dev, SYS_RES_MEMORY); - command = pci_read_config(dev, PCIR_COMMAND, 4); sc->vr_revid = pci_read_config(dev, VR_PCI_REVID, 4) & 0x000000FF; -#ifdef VR_USEIOSPACE - if (!(command & PCIM_CMD_PORTEN)) { - printf("vr%d: failed to enable I/O ports!\n", unit); - error = ENXIO; - goto fail; - } -#else - if (!(command & PCIM_CMD_MEMEN)) { - printf("vr%d: failed to enable memory mapping!\n", unit); - error = ENXIO; - goto fail; - } -#endif - rid = VR_RID; sc->vr_res = bus_alloc_resource(dev, VR_RES, &rid, 0, ~0, 1, RF_ACTIVE); |