Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ed/if_ed.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
ed_alloc_port(device_t dev, int rid, int size) | ed_alloc_port(device_t dev, int rid, int size) | ||||
{ | { | ||||
struct ed_softc *sc = device_get_softc(dev); | struct ed_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, size, RF_ACTIVE); | 0, ~0, size, RF_ACTIVE); | ||||
if (res) { | if (res) { | ||||
sc->port_res = res; | sc->port_res = res; | ||||
sc->port_used = size; | sc->port_used = size; | ||||
sc->port_bst = rman_get_bustag(res); | sc->port_bst = rman_get_bustag(res); | ||||
sc->port_bsh = rman_get_bushandle(res); | sc->port_bsh = rman_get_bushandle(res); | ||||
return (0); | return (0); | ||||
} | } | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
/* | /* | ||||
* Allocate a memory resource with the given resource id. | * Allocate a memory resource with the given resource id. | ||||
*/ | */ | ||||
int | int | ||||
ed_alloc_memory(device_t dev, int rid, int size) | ed_alloc_memory(device_t dev, int rid, int size) | ||||
{ | { | ||||
struct ed_softc *sc = device_get_softc(dev); | struct ed_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, size, RF_ACTIVE); | 0, ~0, size, RF_ACTIVE); | ||||
if (res) { | if (res) { | ||||
sc->mem_res = res; | sc->mem_res = res; | ||||
sc->mem_used = size; | sc->mem_used = size; | ||||
sc->mem_bst = rman_get_bustag(res); | sc->mem_bst = rman_get_bustag(res); | ||||
sc->mem_bsh = rman_get_bushandle(res); | sc->mem_bsh = rman_get_bushandle(res); | ||||
return (0); | return (0); | ||||
} | } | ||||
return (ENOENT); | return (ENOENT); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |