Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/bus_if.m
Show All 38 Lines | |||||
INTERFACE bus; | INTERFACE bus; | ||||
# | # | ||||
# Default implementations of some methods. | # Default implementations of some methods. | ||||
# | # | ||||
CODE { | CODE { | ||||
static struct resource * | static struct resource * | ||||
null_alloc_resource(device_t dev, device_t child, | null_alloc_resource(device_t dev, device_t child, | ||||
int type, int *rid, u_long start, u_long end, | 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) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
null_remap_intr(device_t bus, device_t dev, u_int irq) | null_remap_intr(device_t bus, device_t dev, u_int irq) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
* activated immediately, the caller is responsible for calling | * activated immediately, the caller is responsible for calling | ||||
* BUS_ACTIVATE_RESOURCE() when it actually uses the resource. | * BUS_ACTIVATE_RESOURCE() when it actually uses the resource. | ||||
* | * | ||||
* @param _dev the parent device of @p _child | * @param _dev the parent device of @p _child | ||||
* @param _child the device which is requesting an allocation | * @param _child the device which is requesting an allocation | ||||
* @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 | ||||
* allocation - see @c RF_XXX flags in | * allocation - see @c RF_XXX flags in | ||||
* <sys/rman.h> for details | * <sys/rman.h> for details | ||||
* | * | ||||
* @returns the resource which was allocated or @c NULL if no | * @returns the resource which was allocated or @c NULL if no | ||||
* resource could be allocated | * resource could be allocated | ||||
*/ | */ | ||||
METHOD struct resource * alloc_resource { | METHOD struct resource * alloc_resource { | ||||
device_t _dev; | device_t _dev; | ||||
device_t _child; | device_t _child; | ||||
int _type; | int _type; | ||||
int *_rid; | int *_rid; | ||||
u_long _start; | rman_res_t _start; | ||||
u_long _end; | rman_res_t _end; | ||||
u_long _count; | rman_res_t _count; | ||||
u_int _flags; | u_int _flags; | ||||
} DEFAULT null_alloc_resource; | } DEFAULT null_alloc_resource; | ||||
/** | /** | ||||
* @brief Activate a resource | * @brief Activate a resource | ||||
* | * | ||||
* Activate a resource previously allocated with | * Activate a resource previously allocated with | ||||
* BUS_ALLOC_RESOURCE(). This may for instance map a memory region | * BUS_ALLOC_RESOURCE(). This may for instance map a memory region | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
* @param _start the new starting address of the resource range | * @param _start the new starting address of the resource range | ||||
* @param _end the new ending address of the resource range | * @param _end the new ending address of the resource range | ||||
*/ | */ | ||||
METHOD int adjust_resource { | METHOD int adjust_resource { | ||||
device_t _dev; | device_t _dev; | ||||
device_t _child; | device_t _child; | ||||
int _type; | int _type; | ||||
struct resource *_res; | struct resource *_res; | ||||
u_long _start; | rman_res_t _start; | ||||
u_long _end; | rman_res_t _end; | ||||
}; | }; | ||||
/** | /** | ||||
* @brief Release a resource | * @brief Release a resource | ||||
* | * | ||||
* Free a resource allocated by the BUS_ALLOC_RESOURCE. The @p _rid | * Free a resource allocated by the BUS_ALLOC_RESOURCE. The @p _rid | ||||
* value must be the same as the one returned by BUS_ALLOC_RESOURCE() | * value must be the same as the one returned by BUS_ALLOC_RESOURCE() | ||||
* (which is not necessarily the same as the one the client passed). | * (which is not necessarily the same as the one the client passed). | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
* @param _start the start of the resource range | * @param _start the start of the resource range | ||||
* @param _count the size of the resource range | * @param _count the size of the resource range | ||||
*/ | */ | ||||
METHOD int set_resource { | METHOD int set_resource { | ||||
device_t _dev; | device_t _dev; | ||||
device_t _child; | device_t _child; | ||||
int _type; | int _type; | ||||
int _rid; | int _rid; | ||||
u_long _start; | rman_res_t _start; | ||||
u_long _count; | rman_res_t _count; | ||||
}; | }; | ||||
/** | /** | ||||
* @brief Describe a resource | * @brief Describe a resource | ||||
* | * | ||||
* This method allows a driver to examine the range used for a given | * This method allows a driver to examine the range used for a given | ||||
* resource without actually allocating it. | * resource without actually allocating it. | ||||
* | * | ||||
* @param _dev the parent device of @p _child | * @param _dev the parent device of @p _child | ||||
* @param _child the device which owns the resource | * @param _child the device which owns the resource | ||||
* @param _type the type of resource | * @param _type the type of resource | ||||
* @param _rid the resource identifier | * @param _rid the resource identifier | ||||
* @param _start the address of a location to recieve the start | * @param _start the address of a location to recieve the start | ||||
* index of the resource range | * index of the resource range | ||||
* @param _count the address of a location to recieve the size | * @param _count the address of a location to recieve the size | ||||
* of the resource range | * of the resource range | ||||
*/ | */ | ||||
METHOD int get_resource { | METHOD int get_resource { | ||||
device_t _dev; | device_t _dev; | ||||
device_t _child; | device_t _child; | ||||
int _type; | int _type; | ||||
int _rid; | int _rid; | ||||
u_long *_startp; | rman_res_t *_startp; | ||||
u_long *_countp; | rman_res_t *_countp; | ||||
}; | }; | ||||
/** | /** | ||||
* @brief Delete a resource. | * @brief Delete a resource. | ||||
* | * | ||||
* Use this to delete a resource (possibly one previously added with | * Use this to delete a resource (possibly one previously added with | ||||
* BUS_SET_RESOURCE()). | * BUS_SET_RESOURCE()). | ||||
* | * | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |