mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
- 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.
This commit is contained in:
parent
c047e5b1a9
commit
533294b956
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113545
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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().
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user