Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/an/if_an.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
an_alloc_port(device_t dev, int rid, int size) | an_alloc_port(device_t dev, int rid, int size) | ||||
{ | { | ||||
struct an_softc *sc = device_get_softc(dev); | struct an_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_rid = rid; | sc->port_rid = rid; | ||||
sc->port_res = res; | sc->port_res = res; | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Allocate a memory resource with the given resource id. | * Allocate a memory resource with the given resource id. | ||||
*/ | */ | ||||
int an_alloc_memory(device_t dev, int rid, int size) | int an_alloc_memory(device_t dev, int rid, int size) | ||||
{ | { | ||||
struct an_softc *sc = device_get_softc(dev); | struct an_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_rid = rid; | sc->mem_rid = rid; | ||||
sc->mem_res = res; | sc->mem_res = res; | ||||
sc->mem_used = size; | sc->mem_used = size; | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Allocate a auxilary memory resource with the given resource id. | * Allocate a auxilary memory resource with the given resource id. | ||||
*/ | */ | ||||
int an_alloc_aux_memory(device_t dev, int rid, int size) | int an_alloc_aux_memory(device_t dev, int rid, int size) | ||||
{ | { | ||||
struct an_softc *sc = device_get_softc(dev); | struct an_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_aux_rid = rid; | sc->mem_aux_rid = rid; | ||||
sc->mem_aux_res = res; | sc->mem_aux_res = res; | ||||
sc->mem_aux_used = size; | sc->mem_aux_used = size; | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |