aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqdomain.h
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2013-06-08 07:03:59 -0400
committerGrant Likely <grant.likely@linaro.org>2013-06-10 06:52:09 -0400
commit1aa0dd94ca07df818cf14588c9031ab1d7fd84d3 (patch)
tree9305dbac0984fdb76677bf558f545f716d737f40 /include/linux/irqdomain.h
parentcef5075c8c238ffd04c86a77a5a9bdbd18031137 (diff)
irqdomain: Eliminate revmap type
The NOMAP irq_domain type is only used by a handful of interrupt controllers and it unnecessarily complicates the code by adding special cases on how to look up mappings and different revmap functions are used for each type which need to validate the correct type is passed to it before performing the reverse map. Eliminating the revmap_type and making a single reverse mapping function simplifies the code. It also shouldn't be any slower than having separate revmap functions because the type of the revmap needed to be checked anyway. The linear and tree revmap types were already merged in a previous patch. This patch rolls the NOMAP or direct mapping behaviour into the same domain code making is possible for an irq domain to do any mapping type; linear, tree or direct; and that the mapping will be transparent to the interrupt controller driver. With this change, direct mappings will get stored in the linear or tree mapping for consistency. Reverse mapping from the hwirq to virq will go through the normal lookup process. However, any controller using a direct mapping can take advantage of knowing that hwirq==virq for any mapped interrupts skip doing a revmap lookup when handling IRQs. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'include/linux/irqdomain.h')
-rw-r--r--include/linux/irqdomain.h48
1 files changed, 20 insertions, 28 deletions
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 1cbb7413c121..51ef84a3c990 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -73,50 +73,42 @@ struct irq_domain_chip_generic;
73/** 73/**
74 * struct irq_domain - Hardware interrupt number translation object 74 * struct irq_domain - Hardware interrupt number translation object
75 * @link: Element in global irq_domain list. 75 * @link: Element in global irq_domain list.
76 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This 76 * @name: Name of interrupt domain
77 * will be one of the IRQ_DOMAIN_MAP_* values.
78 * @ops: pointer to irq_domain methods 77 * @ops: pointer to irq_domain methods
79 * @host_data: private data pointer for use by owner. Not touched by irq_domain 78 * @host_data: private data pointer for use by owner. Not touched by irq_domain
80 * core code. 79 * core code.
81 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 80 *
82 * of the irq_domain is responsible for allocating the array of 81 * Optional elements
83 * irq_desc structures. 82 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
84 * @nr_irq: Number of irqs managed by the irq domain 83 * when decoding device tree interrupt specifiers.
85 * @hwirq_base: Starting number for hwirqs managed by the irq domain 84 * @gc: Pointer to a list of generic chips. There is a helper function for
86 * @of_node: (optional) Pointer to device tree nodes associated with the 85 * setting up one or more generic chips for interrupt controllers
87 * irq_domain. Used when decoding device tree interrupt specifiers. 86 * drivers using the generic chip library which uses this pointer.
87 *
88 * Revmap data, used internally by irq_domain
89 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
90 * support direct mapping
91 * @revmap_size: Size of the linear map table @linear_revmap[]
92 * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
93 * @linear_revmap: Linear table of hwirq->virq reverse mappings
88 */ 94 */
89struct irq_domain { 95struct irq_domain {
90 struct list_head link; 96 struct list_head link;
91 const char *name; 97 const char *name;
92
93 /* type of reverse mapping_technique */
94 unsigned int revmap_type;
95 struct {
96 struct {
97 unsigned int size;
98 } linear;
99 struct {
100 unsigned int max_irq;
101 } nomap;
102 struct radix_tree_root tree;
103 } revmap_data;
104 const struct irq_domain_ops *ops; 98 const struct irq_domain_ops *ops;
105 void *host_data; 99 void *host_data;
106 irq_hw_number_t inval_irq;
107 100
108 /* Optional device node pointer */ 101 /* Optional data */
109 struct device_node *of_node; 102 struct device_node *of_node;
110 /* Optional pointer to generic interrupt chips */
111 struct irq_domain_chip_generic *gc; 103 struct irq_domain_chip_generic *gc;
112 104
113 /* Linear reverse map */ 105 /* reverse map data. The linear map gets appended to the irq_domain */
106 unsigned int revmap_direct_max_irq;
107 unsigned int revmap_size;
108 struct radix_tree_root revmap_tree;
114 unsigned int linear_revmap[]; 109 unsigned int linear_revmap[];
115}; 110};
116 111
117#define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */
118#define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */
119
120#ifdef CONFIG_IRQ_DOMAIN 112#ifdef CONFIG_IRQ_DOMAIN
121struct irq_domain *irq_domain_add_simple(struct device_node *of_node, 113struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
122 unsigned int size, 114 unsigned int size,