path: root/sys/sys/bus.h
diff options
authorSvatopluk Kraus <skra@FreeBSD.org>2016-06-05 16:07:57 +0000
committerSvatopluk Kraus <skra@FreeBSD.org>2016-06-05 16:07:57 +0000
commit0869297dd95ab9f013c21a078e8e53c68dd3cf9a (patch)
treeedef6ff23cc230265caf9e9744514c720d3ddcaa /sys/sys/bus.h
parent16bf528dc243f86776a443cba84866cfd7d2027e (diff)
(1) Add a new bus method to get a mapping data for an interrupt.
BUS_MAP_INTR() is used to get an interrupt mapping data according to provided hints. The hints could be modified afterwards, but only if mapping data was allocated. This method is intended to be called before BUS_ALLOC_RESOURCE(). An interrupt mapping data describes an interrupt - hardware number, type, configuration, cpu binding, and whatever is needed to setup it. (2) Introduce a method which allows storing of an additional data in struct resource to be available for bus drivers. This method is convenient in two ways: - there is no need to rework existing bus drivers as they can simply be extended to provide an additional data, - there is no need to modify any existing bus methods as struct resource is already passed to them as argument and thus stored data is simply accessible by other bus drivers. For now, implement this method only for INTRNG. This is motivated by needs of modern SOCs where hardware initialization is not straightforward and resources descriptions are complex, opaque for everyone but provider, and may vary from SOC to SOC. Typical situation is that one bus driver can fetch a resource description for its child device, but it's opaque for this driver. Another bus driver knows a provider for this kind of resource and can pass this resource description to it. In fact, something like device IVARS would be perfect for that if implemented generally enough. Unfortunatelly, IVARS are usable only by their owners now. Only owner knows its IVARS layout, thus other bus drivers are not able to use them. Differential Revision: https://reviews.freebsd.org/D6632
Notes: svn path=/head/; revision=301451
Diffstat (limited to 'sys/sys/bus.h')
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 4e7d37563ec2..1d5f683824a8 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -272,6 +272,17 @@ enum intr_polarity {
+enum intr_map_data_type {
+struct intr_map_data {
+ enum intr_map_data_type type;
+ void (*destruct)(struct intr_map_data *);
* CPU sets supported by bus_get_cpus(). Note that not all sets may be
* supported for a given device. If a request is not supported by a
@@ -448,6 +459,9 @@ int bus_generic_release_resource(device_t bus, device_t child,
int type, int rid, struct resource *r);
int bus_generic_resume(device_t dev);
int bus_generic_resume_child(device_t dev, device_t child);
+int bus_generic_map_intr(device_t dev, device_t child, int *rid,
+ rman_res_t *start, rman_res_t *end,
+ rman_res_t *count, struct intr_map_data **imd);
int bus_generic_setup_intr(device_t dev, device_t child,
struct resource *irq, int flags,
driver_filter_t *filter, driver_intr_t *intr,