Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/snc/if_snc.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
snc_alloc_port(device_t dev, int rid) | snc_alloc_port(device_t dev, int rid) | ||||
{ | { | ||||
struct snc_softc *sc = device_get_softc(dev); | struct snc_softc *sc = device_get_softc(dev); | ||||
struct resource *res; | struct resource *res; | ||||
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, | res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, | ||||
0ul, ~0ul, SNEC_NREGS, RF_ACTIVE); | 0, ~0, SNEC_NREGS, RF_ACTIVE); | ||||
if (res) { | if (res) { | ||||
sc->ioport = res; | sc->ioport = res; | ||||
sc->ioport_rid = rid; | sc->ioport_rid = rid; | ||||
sc->sc_iot = rman_get_bustag(res); | sc->sc_iot = rman_get_bustag(res); | ||||
sc->sc_ioh = rman_get_bushandle(res); | sc->sc_ioh = rman_get_bushandle(res); | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
device_printf(dev, "can't assign port\n"); | device_printf(dev, "can't assign port\n"); | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Allocate a memory resource with the given resource id. | * Allocate a memory resource with the given resource id. | ||||
*/ | */ | ||||
int | int | ||||
snc_alloc_memory(device_t dev, int rid) | snc_alloc_memory(device_t dev, int rid) | ||||
{ | { | ||||
struct snc_softc *sc = device_get_softc(dev); | struct snc_softc *sc = device_get_softc(dev); | ||||
struct resource *res; | struct resource *res; | ||||
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, | res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, | ||||
0ul, ~0ul, SNEC_NMEMS, RF_ACTIVE); | 0, ~0, SNEC_NMEMS, RF_ACTIVE); | ||||
if (res) { | if (res) { | ||||
sc->iomem = res; | sc->iomem = res; | ||||
sc->iomem_rid = rid; | sc->iomem_rid = rid; | ||||
sc->sc_memt = rman_get_bustag(res); | sc->sc_memt = rman_get_bustag(res); | ||||
sc->sc_memh = rman_get_bushandle(res); | sc->sc_memh = rman_get_bushandle(res); | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
device_printf(dev, "can't assign memory\n"); | device_printf(dev, "can't assign memory\n"); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |