Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_bus.c
Context not available. | |||||
* @param count XXX end-start+1 | * @param count XXX end-start+1 | ||||
*/ | */ | ||||
int | int | ||||
resource_list_add_next(struct resource_list *rl, int type, u_long start, | resource_list_add_next(struct resource_list *rl, int type, rman_res_t start, | ||||
u_long end, u_long count) | rman_res_t end, rman_res_t count) | ||||
{ | { | ||||
int rid; | int rid; | ||||
Context not available. | |||||
*/ | */ | ||||
struct resource_list_entry * | struct resource_list_entry * | ||||
resource_list_add(struct resource_list *rl, int type, int rid, | resource_list_add(struct resource_list *rl, int type, int rid, | ||||
u_long start, u_long end, u_long count) | rman_res_t start, rman_res_t end, rman_res_t count) | ||||
{ | { | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
Context not available. | |||||
* @param type the type of resource to allocate | * @param type the type of resource to allocate | ||||
* @param rid a pointer to the resource identifier | * @param rid a pointer to the resource identifier | ||||
* @param start hint at the start of the resource range - pass | * @param start hint at the start of the resource range - pass | ||||
* @c 0UL for any start address | * @c 0 for any start address | ||||
* @param end hint at the end of the resource range - pass | * @param end hint at the end of the resource range - pass | ||||
* @c ~0UL for any end address | * @c ~0 for any end address | ||||
* @param count hint at the size of range required - pass @c 1 | * @param count hint at the size of range required - pass @c 1 | ||||
* for any size | * for any size | ||||
* @param flags any extra flags to control the resource | * @param flags any extra flags to control the resource | ||||
Context not available. | |||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, | resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, | ||||
int type, int *rid, u_long start, u_long end, u_long count, u_int flags) | int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct resource_list_entry *rle = NULL; | struct resource_list_entry *rle = NULL; | ||||
int passthrough = (device_get_parent(child) != bus); | int passthrough = (device_get_parent(child) != bus); | ||||
Context not available. | |||||
* @param type the type of resource to allocate | * @param type the type of resource to allocate | ||||
* @param rid a pointer to the resource identifier | * @param rid a pointer to the resource identifier | ||||
* @param start hint at the start of the resource range - pass | * @param start hint at the start of the resource range - pass | ||||
* @c 0UL for any start address | * @c 0 for any start address | ||||
* @param end hint at the end of the resource range - pass | * @param end hint at the end of the resource range - pass | ||||
* @c ~0UL for any end address | * @c ~0 for any end address | ||||
* @param count hint at the size of range required - pass @c 1 | * @param count hint at the size of range required - pass @c 1 | ||||
* for any size | * for any size | ||||
* @param flags any extra flags to control the resource | * @param flags any extra flags to control the resource | ||||
Context not available. | |||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, | resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, | ||||
int type, int *rid, u_long start, u_long end, u_long count, u_int flags) | int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct resource_list_entry *rle = NULL; | struct resource_list_entry *rle = NULL; | ||||
int passthrough = (device_get_parent(child) != bus); | int passthrough = (device_get_parent(child) != bus); | ||||
int isdefault = (start == 0UL && end == ~0UL); | int isdefault = (start == 0 && end == ~0); | ||||
if (passthrough) { | if (passthrough) { | ||||
return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, | return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, | ||||
Context not available. | |||||
*/ | */ | ||||
int | int | ||||
bus_generic_adjust_resource(device_t dev, device_t child, int type, | bus_generic_adjust_resource(device_t dev, device_t child, int type, | ||||
struct resource *r, u_long start, u_long end) | struct resource *r, rman_res_t start, rman_res_t end) | ||||
{ | { | ||||
/* Propagate up the bus hierarchy until someone handles it. */ | /* Propagate up the bus hierarchy until someone handles it. */ | ||||
if (dev->parent) | if (dev->parent) | ||||
Context not available. | |||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
bus_generic_alloc_resource(device_t dev, device_t child, int type, int *rid, | bus_generic_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
/* Propagate up the bus hierarchy until someone handles it. */ | /* Propagate up the bus hierarchy until someone handles it. */ | ||||
if (dev->parent) | if (dev->parent) | ||||
Context not available. | |||||
*/ | */ | ||||
int | int | ||||
bus_generic_rl_get_resource(device_t dev, device_t child, int type, int rid, | bus_generic_rl_get_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long *startp, u_long *countp) | rman_res_t *startp, rman_res_t *countp) | ||||
{ | { | ||||
struct resource_list * rl = NULL; | struct resource_list * rl = NULL; | ||||
struct resource_list_entry * rle = NULL; | struct resource_list_entry * rle = NULL; | ||||
Context not available. | |||||
*/ | */ | ||||
int | int | ||||
bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, | bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long start, u_long count) | rman_res_t start, rman_res_t count) | ||||
{ | { | ||||
struct resource_list * rl = NULL; | struct resource_list * rl = NULL; | ||||
Context not available. | |||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, | bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, | ||||
int *rid, u_long start, u_long end, u_long count, u_int flags) | int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct resource_list * rl = NULL; | struct resource_list * rl = NULL; | ||||
Context not available. | |||||
* parent of @p dev. | * parent of @p dev. | ||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end, | bus_alloc_resource(device_t dev, int type, int *rid, rman_res_t start, rman_res_t end, | ||||
u_long count, u_int flags) | rman_res_t count, u_int flags) | ||||
{ | { | ||||
if (dev->parent == NULL) | if (dev->parent == NULL) | ||||
return (NULL); | return (NULL); | ||||
Context not available. | |||||
* parent of @p dev. | * parent of @p dev. | ||||
*/ | */ | ||||
int | int | ||||
bus_adjust_resource(device_t dev, int type, struct resource *r, u_long start, | bus_adjust_resource(device_t dev, int type, struct resource *r, rman_res_t start, | ||||
u_long end) | rman_res_t end) | ||||
{ | { | ||||
if (dev->parent == NULL) | if (dev->parent == NULL) | ||||
return (EINVAL); | return (EINVAL); | ||||
Context not available. | |||||
*/ | */ | ||||
int | int | ||||
bus_set_resource(device_t dev, int type, int rid, | bus_set_resource(device_t dev, int type, int rid, | ||||
u_long start, u_long count) | rman_res_t start, rman_res_t count) | ||||
{ | { | ||||
return (BUS_SET_RESOURCE(device_get_parent(dev), dev, type, rid, | return (BUS_SET_RESOURCE(device_get_parent(dev), dev, type, rid, | ||||
start, count)); | start, count)); | ||||
Context not available. | |||||
*/ | */ | ||||
int | int | ||||
bus_get_resource(device_t dev, int type, int rid, | bus_get_resource(device_t dev, int type, int rid, | ||||
u_long *startp, u_long *countp) | rman_res_t *startp, rman_res_t *countp) | ||||
{ | { | ||||
return (BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | return (BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | ||||
startp, countp)); | startp, countp)); | ||||
Context not available. | |||||
* This function simply calls the BUS_GET_RESOURCE() method of the | * This function simply calls the BUS_GET_RESOURCE() method of the | ||||
* parent of @p dev and returns the start value. | * parent of @p dev and returns the start value. | ||||
*/ | */ | ||||
u_long | rman_res_t | ||||
bus_get_resource_start(device_t dev, int type, int rid) | bus_get_resource_start(device_t dev, int type, int rid) | ||||
{ | { | ||||
u_long start, count; | rman_res_t start; | ||||
rman_res_t count; | |||||
int error; | int error; | ||||
error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | ||||
Context not available. | |||||
* This function simply calls the BUS_GET_RESOURCE() method of the | * This function simply calls the BUS_GET_RESOURCE() method of the | ||||
* parent of @p dev and returns the count value. | * parent of @p dev and returns the count value. | ||||
*/ | */ | ||||
u_long | rman_res_t | ||||
bus_get_resource_count(device_t dev, int type, int rid) | bus_get_resource_count(device_t dev, int type, int rid) | ||||
{ | { | ||||
u_long start, count; | rman_res_t start; | ||||
rman_res_t count; | |||||
int error; | int error; | ||||
error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, | ||||
Context not available. |