Index: sys/kern/bus_if.m =================================================================== --- sys/kern/bus_if.m +++ sys/kern/bus_if.m @@ -284,6 +284,35 @@ } DEFAULT null_alloc_resource; /** + * @brief Extend a system resource + * + * This method is called to extend a resource with data that describes it. + * + * @param _dev the parent device of @p _child + * @param _child the device which is requesting extension + * @param _type the type of resource to extend + * @param _rid a pointer to the resource identifier + * @param _start hint at the start of the resource range - pass + * @c 0 for any start address + * @param _end hint at the end of the resource range - pass + * @c ~0 for any end address + * @param _count hint at the size of range required - pass @c 1 + * for any size + * + * @returns interrupt data to extend the resource with or @c NULL if no + * extension could be made + */ +METHOD struct intr_map_data * extend_resource { + device_t _dev; + device_t _child; + int _type; + int *_rid; + rman_res_t _start; + rman_res_t _end; + rman_res_t _count; +} DEFAULT bus_generic_extend_resource; + +/** * @brief Activate a resource * * Activate a resource previously allocated with Index: sys/kern/subr_bus.c =================================================================== --- sys/kern/subr_bus.c +++ sys/kern/subr_bus.c @@ -4036,6 +4036,23 @@ } /** + * @brief Helper function for implementing BUS_EXTEND_RESOURCE(). + * + * This simple implementation of BUS_EXTEND_RESOURCE() simply calls the + * BUS_EXTEND_RESOURCE() method of the parent of @p dev. + */ +struct intr_map_data * +bus_generic_extend_resource(device_t dev, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count) +{ + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_EXTEND_RESOURCE(dev->parent, child, type, rid, + start, end, count)); + return (NULL); +} + +/** * @brief Helper function for implementing BUS_RELEASE_RESOURCE(). * * This simple implementation of BUS_RELEASE_RESOURCE() simply calls the @@ -4425,8 +4442,6 @@ #ifdef INTRNG /** * @internal - * - * This can be converted to bus method later. (XXX) */ static struct intr_map_data * bus_extend_resource(device_t dev, int type, int *rid, rman_res_t *start, @@ -4436,6 +4451,11 @@ struct resource_list *rl; int rv; + imd = BUS_EXTEND_RESOURCE(dev->parent, dev, type, rid, *start, *end, + *count); + if (imd) + return (imd); + if (dev->parent == NULL) return (NULL); if (type != SYS_RES_IRQ) Index: sys/sys/bus.h =================================================================== --- sys/sys/bus.h +++ sys/sys/bus.h @@ -421,6 +421,10 @@ bus_generic_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); +struct intr_map_data * + bus_generic_extend_resource(device_t dev, device_t child, int type, + int *rid, rman_res_t start, rman_res_t end, + rman_res_t count); int bus_generic_attach(device_t dev); int bus_generic_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu);