aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/bus_if.m
diff options
context:
space:
mode:
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/kern/bus_if.m
parent16bf528dc243f86776a443cba84866cfd7d2027e (diff)
downloadsrc-0869297dd95ab9f013c21a078e8e53c68dd3cf9a.tar.gz
src-0869297dd95ab9f013c21a078e8e53c68dd3cf9a.zip
(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
Notes: svn path=/head/; revision=301451
Diffstat (limited to 'sys/kern/bus_if.m')
-rw-r--r--sys/kern/bus_if.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index 2b754387136f..d5a0c45db75a 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -418,6 +418,35 @@ METHOD int release_resource {
};
/**
+ * @brief Map an interrupt
+ *
+ * This method 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().
+ *
+ * @param _dev the parent device of @p _child
+ * @param _child the device which is requesting an allocation
+ * @param _rid a pointer to the resource identifier
+ * @param _start a pointer to the hint at the start of the resource
+ * range - pass @c 0 for any start address
+ * @param _end a pointer to the hint at the end of the resource
+ * range - pass @c ~0 for any end address
+ * @param _count a pointer to the hint at the size of resource
+ * range required - pass @c 1 for any size
+ * @param _imd a pointer to the interrupt mapping data which was
+ * allocated
+ */
+METHOD int 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;
+} DEFAULT bus_generic_map_intr;
+
+/**
* @brief Install an interrupt handler
*
* This method is used to associate an interrupt handler function with