Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/lmc/if_lmc.c
Show First 20 Lines • Show All 4,504 Lines • ▼ Show 20 Lines | fbsd_attach(device_t dev) | ||||
/* Allocate PCI memory or IO resources to access the Tulip chip CSRs. */ | /* Allocate PCI memory or IO resources to access the Tulip chip CSRs. */ | ||||
# if IOREF_CSR | # if IOREF_CSR | ||||
sc->csr_res_id = TLP_CBIO; | sc->csr_res_id = TLP_CBIO; | ||||
sc->csr_res_type = SYS_RES_IOPORT; | sc->csr_res_type = SYS_RES_IOPORT; | ||||
# else | # else | ||||
sc->csr_res_id = TLP_CBMA; | sc->csr_res_id = TLP_CBMA; | ||||
sc->csr_res_type = SYS_RES_MEMORY; | sc->csr_res_type = SYS_RES_MEMORY; | ||||
# endif | # endif | ||||
sc->csr_res = bus_alloc_resource(dev, sc->csr_res_type, &sc->csr_res_id, | sc->csr_res = bus_alloc_resource_any(dev, sc->csr_res_type, &sc->csr_res_id, | ||||
0, ~0, 1, RF_ACTIVE); | RF_ACTIVE); | ||||
if (sc->csr_res == NULL) | if (sc->csr_res == NULL) | ||||
{ | { | ||||
printf("%s: bus_alloc_resource(csr) failed.\n", NAME_UNIT); | printf("%s: bus_alloc_resource(csr) failed.\n", NAME_UNIT); | ||||
return ENXIO; | return ENXIO; | ||||
} | } | ||||
sc->csr_tag = rman_get_bustag(sc->csr_res); | sc->csr_tag = rman_get_bustag(sc->csr_res); | ||||
sc->csr_handle = rman_get_bushandle(sc->csr_res); | sc->csr_handle = rman_get_bushandle(sc->csr_res); | ||||
/* Allocate PCI interrupt resources for the card. */ | /* Allocate PCI interrupt resources for the card. */ | ||||
sc->irq_res_id = 0; | sc->irq_res_id = 0; | ||||
sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_res_id, | sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_res_id, | ||||
0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); | RF_ACTIVE | RF_SHAREABLE); | ||||
if (sc->irq_res == NULL) | if (sc->irq_res == NULL) | ||||
{ | { | ||||
printf("%s: bus_alloc_resource(irq) failed.\n", NAME_UNIT); | printf("%s: bus_alloc_resource(irq) failed.\n", NAME_UNIT); | ||||
fbsd_detach(dev); | fbsd_detach(dev); | ||||
return ENXIO; | return ENXIO; | ||||
} | } | ||||
if ((error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, | if ((error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, | ||||
NULL, bsd_interrupt, sc, &sc->irq_cookie))) | NULL, bsd_interrupt, sc, &sc->irq_cookie))) | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |