summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-04-16 03:16:57 +0000
committermdodd <mdodd@FreeBSD.org>2003-04-16 03:16:57 +0000
commit74c95b7f29ae970fc99cad21e8ea772eb2557bd1 (patch)
tree43770c3696a3adbe67787f9d9f8ff9d3bb30a425 /sys/pci
parentac7452631f13ef6bbb59e825e8e3ebb14d8e9a46 (diff)
downloadFreeBSD-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/pci')
-rw-r--r--sys/pci/if_dc.c17
-rw-r--r--sys/pci/if_pcn.c21
-rw-r--r--sys/pci/if_rl.c18
-rw-r--r--sys/pci/if_sf.c18
-rw-r--r--sys/pci/if_sis.c17
-rw-r--r--sys/pci/if_sk.c18
-rw-r--r--sys/pci/if_ste.c18
-rw-r--r--sys/pci/if_ti.c9
-rw-r--r--sys/pci/if_tl.c9
-rw-r--r--sys/pci/if_vr.c18
-rw-r--r--sys/pci/if_wb.c18
-rw-r--r--sys/pci/if_xl.c10
12 files changed, 5 insertions, 186 deletions
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index 86fd9d5..f39e612 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/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/pci/if_pcn.c b/sys/pci/if_pcn.c
index 3c60e0f..eb92207 100644
--- a/sys/pci/if_pcn.c
+++ b/sys/pci/if_pcn.c
@@ -543,23 +543,12 @@ pcn_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 PCN_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- printf("pcn%d: failed to enable I/O ports!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#else
- if (!(command & PCIM_CMD_MEMEN)) {
- printf("pcn%d: failed to enable memory mapping!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#endif
+ /* Retreive the chip ID */
+ command = pcn_chip_id(dev);
+ sc->pcn_type = (command >>= 12) & PART_MASK;
+ device_printf(dev, "Chip ID %04x (%s)\n",
+ sc->pcn_type, pcn_chipid_name(sc->pcn_type));
rid = PCN_RID;
sc->pcn_res = bus_alloc_resource(dev, PCN_RES, &rid,
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index 0996597..7664dd59 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -861,7 +861,6 @@ rl_attach(dev)
device_t dev;
{
u_char eaddr[ETHER_ADDR_LEN];
- u_int32_t command;
u_int16_t as[3];
struct rl_softc *sc;
struct ifnet *ifp;
@@ -903,23 +902,6 @@ rl_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 RL_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- printf("rl%d: failed to enable I/O ports!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#else
- if (!(command & PCIM_CMD_MEMEN)) {
- printf("rl%d: failed to enable memory mapping!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#endif
rid = RL_RID;
sc->rl_res = bus_alloc_resource(dev, RL_RES, &rid,
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index ea3cf3e..a7ebb01 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/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/pci/if_sis.c b/sys/pci/if_sis.c
index dfbb560..05e9575 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -1094,23 +1094,6 @@ sis_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 SIS_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- printf("sis%d: failed to enable I/O ports!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#else
- if (!(command & PCIM_CMD_MEMEN)) {
- printf("sis%d: failed to enable memory mapping!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#endif
rid = SIS_RID;
sc->sis_res = bus_alloc_resource(dev, SIS_RES, &rid,
diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c
index 8b15c5c..1093f34 100644
--- a/sys/pci/if_sk.c
+++ b/sys/pci/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/pci/if_ste.c b/sys/pci/if_ste.c
index d6e505b..67f16f4 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -909,7 +909,6 @@ static int
ste_attach(dev)
device_t dev;
{
- u_int32_t command;
struct ste_softc *sc;
struct ifnet *ifp;
int unit, error = 0, rid;
@@ -958,23 +957,6 @@ ste_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 STE_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- printf("ste%d: failed to enable I/O ports!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#else
- if (!(command & PCIM_CMD_MEMEN)) {
- printf("ste%d: failed to enable memory mapping!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#endif
rid = STE_RID;
sc->ste_res = bus_alloc_resource(dev, STE_RES, &rid,
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c
index c8a1c63..c1b5796 100644
--- a/sys/pci/if_ti.c
+++ b/sys/pci/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/pci/if_tl.c b/sys/pci/if_tl.c
index c546ad9..cbd7bb2 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -1114,7 +1114,6 @@ tl_attach(dev)
device_t dev;
{
int i;
- u_int32_t command;
u_int16_t did, vid;
struct tl_type *t;
struct ifnet *ifp;
@@ -1145,16 +1144,8 @@ tl_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 TL_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- device_printf(dev, "failed to enable I/O ports!\n");
- error = ENXIO;
- goto fail;
- }
rid = TL_PCI_LOIO;
sc->tl_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c
index f5dc39d..793ae64 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/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);
diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c
index 61c2674..b540e00 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -820,7 +820,6 @@ wb_attach(dev)
device_t dev;
{
u_char eaddr[ETHER_ADDR_LEN];
- u_int32_t command;
struct wb_softc *sc;
struct ifnet *ifp;
int unit, error = 0, rid;
@@ -859,23 +858,6 @@ wb_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 WB_USEIOSPACE
- if (!(command & PCIM_CMD_PORTEN)) {
- printf("wb%d: failed to enable I/O ports!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#else
- if (!(command & PCIM_CMD_MEMEN)) {
- printf("wb%d: failed to enable memory mapping!\n", unit);
- error = ENXIO;
- goto fail;
- }
-#endif
rid = WB_RID;
sc->wb_res = bus_alloc_resource(dev, WB_RES, &rid,
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index 88797d4..eeb635d 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -1297,7 +1297,6 @@ xl_attach(dev)
device_t dev;
{
u_char eaddr[ETHER_ADDR_LEN];
- u_int32_t command;
u_int16_t xcvr[2];
struct xl_softc *sc;
struct ifnet *ifp;
@@ -1389,15 +1388,6 @@ xl_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);
-
- if (!(command & PCIM_CMD_PORTEN) && !(command & PCIM_CMD_MEMEN)) {
- printf("xl%d: failed to enable I/O ports and memory mappings!\n", unit);
- error = ENXIO;
- goto fail;
- }
rid = XL_PCI_LOMEM;
res = SYS_RES_MEMORY;
OpenPOWER on IntegriCloud