diff options
author | John Baldwin <jhb@FreeBSD.org> | 2023-11-24 17:28:00 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2023-11-24 17:28:00 +0000 |
commit | 751615c538446ea0384f8faa9cb2508670c3799a (patch) | |
tree | 36fe1536ad8761ffb0fea52d918e05b02a3c7945 /sys/kern/bus_if.m | |
parent | 73902ed85ab73d455d4be8c77336c88a07512230 (diff) | |
download | src-751615c538446ea0384f8faa9cb2508670c3799a.tar.gz src-751615c538446ea0384f8faa9cb2508670c3799a.zip |
newbus: Add a set of bus resource helpers for nexus-like devices
These routines can be used to implement
bus_alloc/adjust/activate/deactive/release_resource on bus drivers
which suballocate resources from rman(9) resource managers.
These methods require a new bus_get_rman method in the bus driver to
return the suitable rman for a given resource type. The
activate/deactivate helpers also require the bus to implement the
bus_map/ummap_resource methods.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42739
Diffstat (limited to 'sys/kern/bus_if.m')
-rw-r--r-- | sys/kern/bus_if.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 7bd08fb713f8..7078683911b8 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -77,6 +77,12 @@ CODE { { return (0); } + + static struct rman * + null_get_rman(device_t bus, int type, u_int flags) + { + return (NULL); + } }; /** @@ -623,6 +629,24 @@ METHOD struct resource_list * get_resource_list { } DEFAULT bus_generic_get_resource_list; /** + * @brief Return a struct rman. + * + * Used by drivers which use bus_generic_rman_alloc_resource() etc. to + * implement their resource handling. It should return the resource + * manager used for the given resource type. + * + * @param _dev the bus device + * @param _type the resource type + * @param _flags resource flags (@c RF_XXX flags in + * <sys/rman.h>) + */ +METHOD struct rman * get_rman { + device_t _dev; + int _type; + u_int _flags; +} DEFAULT null_get_rman; + +/** * @brief Is the hardware described by @p _child still attached to the * system? * |