Linux Audio

Check our new training course

Loading...
v5.9
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * ACPI GSI IRQ layer
  4 *
  5 * Copyright (C) 2015 ARM Ltd.
  6 * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
  7 */
  8#include <linux/acpi.h>
  9#include <linux/irq.h>
 10#include <linux/irqdomain.h>
 11#include <linux/of.h>
 12
 13enum acpi_irq_model_id acpi_irq_model;
 14
 15static struct fwnode_handle *acpi_gsi_domain_id;
 
 16
 17/**
 18 * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI
 19 * @gsi: GSI IRQ number to map
 20 * @irq: pointer where linux IRQ number is stored
 21 *
 22 * irq location updated with irq value [>0 on success, 0 on failure]
 23 *
 24 * Returns: 0 on success
 25 *          -EINVAL on failure
 26 */
 27int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 28{
 29	struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
 30							DOMAIN_BUS_ANY);
 31
 
 
 32	*irq = irq_find_mapping(d, gsi);
 33	/*
 34	 * *irq == 0 means no mapping, that should
 35	 * be reported as a failure
 36	 */
 
 
 
 37	return (*irq > 0) ? 0 : -EINVAL;
 38}
 39EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 40
 41/**
 42 * acpi_register_gsi() - Map a GSI to a linux IRQ number
 43 * @dev: device for which IRQ has to be mapped
 44 * @gsi: GSI IRQ number
 45 * @trigger: trigger type of the GSI number to be mapped
 46 * @polarity: polarity of the GSI to be mapped
 47 *
 48 * Returns: a valid linux IRQ number on success
 49 *          -EINVAL on failure
 50 */
 51int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
 52		      int polarity)
 53{
 54	struct irq_fwspec fwspec;
 55
 56	if (WARN_ON(!acpi_gsi_domain_id)) {
 
 57		pr_warn("GSI: No registered irqchip, giving up\n");
 58		return -EINVAL;
 59	}
 60
 61	fwspec.fwnode = acpi_gsi_domain_id;
 62	fwspec.param[0] = gsi;
 63	fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
 64	fwspec.param_count = 2;
 65
 66	return irq_create_fwspec_mapping(&fwspec);
 67}
 68EXPORT_SYMBOL_GPL(acpi_register_gsi);
 69
 70/**
 71 * acpi_unregister_gsi() - Free a GSI<->linux IRQ number mapping
 72 * @gsi: GSI IRQ number
 73 */
 74void acpi_unregister_gsi(u32 gsi)
 75{
 76	struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
 77							DOMAIN_BUS_ANY);
 78	int irq = irq_find_mapping(d, gsi);
 
 
 79
 
 
 
 80	irq_dispose_mapping(irq);
 81}
 82EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
 83
 84/**
 85 * acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source.
 86 * @source: acpi_resource_source to use for the lookup.
 
 87 *
 88 * Description:
 89 * Retrieve the fwhandle of the device referenced by the given IRQ resource
 90 * source.
 91 *
 92 * Return:
 93 * The referenced device fwhandle or NULL on failure
 94 */
 95static struct fwnode_handle *
 96acpi_get_irq_source_fwhandle(const struct acpi_resource_source *source)
 
 97{
 98	struct fwnode_handle *result;
 99	struct acpi_device *device;
100	acpi_handle handle;
101	acpi_status status;
102
103	if (!source->string_length)
104		return acpi_gsi_domain_id;
105
106	status = acpi_get_handle(NULL, source->string_ptr, &handle);
107	if (WARN_ON(ACPI_FAILURE(status)))
108		return NULL;
109
110	device = acpi_bus_get_acpi_device(handle);
111	if (WARN_ON(!device))
112		return NULL;
113
114	result = &device->fwnode;
115	acpi_bus_put_acpi_device(device);
116	return result;
117}
118
119/*
120 * Context for the resource walk used to lookup IRQ resources.
121 * Contains a return code, the lookup index, and references to the flags
122 * and fwspec where the result is returned.
123 */
124struct acpi_irq_parse_one_ctx {
125	int rc;
126	unsigned int index;
127	unsigned long *res_flags;
128	struct irq_fwspec *fwspec;
129};
130
131/**
132 * acpi_irq_parse_one_match - Handle a matching IRQ resource.
133 * @fwnode: matching fwnode
134 * @hwirq: hardware IRQ number
135 * @triggering: triggering attributes of hwirq
136 * @polarity: polarity attributes of hwirq
137 * @polarity: polarity attributes of hwirq
138 * @shareable: shareable attributes of hwirq
 
139 * @ctx: acpi_irq_parse_one_ctx updated by this function
140 *
141 * Description:
142 * Handle a matching IRQ resource by populating the given ctx with
143 * the information passed.
144 */
145static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
146					    u32 hwirq, u8 triggering,
147					    u8 polarity, u8 shareable,
 
148					    struct acpi_irq_parse_one_ctx *ctx)
149{
150	if (!fwnode)
151		return;
152	ctx->rc = 0;
153	*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable);
154	ctx->fwspec->fwnode = fwnode;
155	ctx->fwspec->param[0] = hwirq;
156	ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity);
157	ctx->fwspec->param_count = 2;
158}
159
160/**
161 * acpi_irq_parse_one_cb - Handle the given resource.
162 * @ares: resource to handle
163 * @context: context for the walk
164 *
165 * Description:
166 * This is called by acpi_walk_resources passing each resource returned by
167 * the _CRS method. We only inspect IRQ resources. Since IRQ resources
168 * might contain multiple interrupts we check if the index is within this
169 * one's interrupt array, otherwise we subtract the current resource IRQ
170 * count from the lookup index to prepare for the next resource.
171 * Once a match is found we call acpi_irq_parse_one_match to populate
172 * the result and end the walk by returning AE_CTRL_TERMINATE.
173 *
174 * Return:
175 * AE_OK if the walk should continue, AE_CTRL_TERMINATE if a matching
176 * IRQ resource was found.
177 */
178static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
179					 void *context)
180{
181	struct acpi_irq_parse_one_ctx *ctx = context;
182	struct acpi_resource_irq *irq;
183	struct acpi_resource_extended_irq *eirq;
184	struct fwnode_handle *fwnode;
185
186	switch (ares->type) {
187	case ACPI_RESOURCE_TYPE_IRQ:
188		irq = &ares->data.irq;
189		if (ctx->index >= irq->interrupt_count) {
190			ctx->index -= irq->interrupt_count;
191			return AE_OK;
192		}
193		fwnode = acpi_gsi_domain_id;
194		acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
195					 irq->triggering, irq->polarity,
196					 irq->shareable, ctx);
197		return AE_CTRL_TERMINATE;
198	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
199		eirq = &ares->data.extended_irq;
200		if (eirq->producer_consumer == ACPI_PRODUCER)
201			return AE_OK;
202		if (ctx->index >= eirq->interrupt_count) {
203			ctx->index -= eirq->interrupt_count;
204			return AE_OK;
205		}
206		fwnode = acpi_get_irq_source_fwhandle(&eirq->resource_source);
 
207		acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index],
208					 eirq->triggering, eirq->polarity,
209					 eirq->shareable, ctx);
210		return AE_CTRL_TERMINATE;
211	}
212
213	return AE_OK;
214}
215
216/**
217 * acpi_irq_parse_one - Resolve an interrupt for a device
218 * @handle: the device whose interrupt is to be resolved
219 * @index: index of the interrupt to resolve
220 * @fwspec: structure irq_fwspec filled by this function
221 * @flags: resource flags filled by this function
222 *
223 * Description:
224 * Resolves an interrupt for a device by walking its CRS resources to find
225 * the appropriate ACPI IRQ resource and populating the given struct irq_fwspec
226 * and flags.
227 *
228 * Return:
229 * The result stored in ctx.rc by the callback, or the default -EINVAL value
230 * if an error occurs.
231 */
232static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
233			      struct irq_fwspec *fwspec, unsigned long *flags)
234{
235	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
236
237	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx);
238	return ctx.rc;
239}
240
241/**
242 * acpi_irq_get - Lookup an ACPI IRQ resource and use it to initialize resource.
243 * @handle: ACPI device handle
244 * @index:  ACPI IRQ resource index to lookup
245 * @res:    Linux IRQ resource to initialize
246 *
247 * Description:
248 * Look for the ACPI IRQ resource with the given index and use it to initialize
249 * the given Linux IRQ resource.
250 *
251 * Return:
252 * 0 on success
253 * -EINVAL if an error occurs
254 * -EPROBE_DEFER if the IRQ lookup/conversion failed
255 */
256int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res)
257{
258	struct irq_fwspec fwspec;
259	struct irq_domain *domain;
260	unsigned long flags;
261	int rc;
262
263	rc = acpi_irq_parse_one(handle, index, &fwspec, &flags);
264	if (rc)
265		return rc;
266
267	domain = irq_find_matching_fwnode(fwspec.fwnode, DOMAIN_BUS_ANY);
268	if (!domain)
269		return -EPROBE_DEFER;
270
271	rc = irq_create_fwspec_mapping(&fwspec);
272	if (rc <= 0)
273		return -EINVAL;
274
275	res->start = rc;
276	res->end = rc;
277	res->flags = flags;
278
279	return 0;
280}
281EXPORT_SYMBOL_GPL(acpi_irq_get);
282
283/**
284 * acpi_set_irq_model - Setup the GSI irqdomain information
285 * @model: the value assigned to acpi_irq_model
286 * @fwnode: the irq_domain identifier for mapping and looking up
287 *          GSI interrupts
288 */
289void __init acpi_set_irq_model(enum acpi_irq_model_id model,
290			       struct fwnode_handle *fwnode)
291{
292	acpi_irq_model = model;
293	acpi_gsi_domain_id = fwnode;
 
 
 
 
 
 
 
 
 
 
294}
295
296/**
297 * acpi_irq_create_hierarchy - Create a hierarchical IRQ domain with the default
298 *                             GSI domain as its parent.
299 * @flags:      Irq domain flags associated with the domain
300 * @size:       Size of the domain.
301 * @fwnode:     Optional fwnode of the interrupt controller
302 * @ops:        Pointer to the interrupt domain callbacks
303 * @host_data:  Controller private data pointer
304 */
305struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags,
306					     unsigned int size,
307					     struct fwnode_handle *fwnode,
308					     const struct irq_domain_ops *ops,
309					     void *host_data)
310{
311	struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
312							DOMAIN_BUS_ANY);
 
 
 
 
 
 
313
314	if (!d)
315		return NULL;
316
317	return irq_domain_create_hierarchy(d, flags, size, fwnode, ops,
318					   host_data);
319}
320EXPORT_SYMBOL_GPL(acpi_irq_create_hierarchy);
v6.2
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * ACPI GSI IRQ layer
  4 *
  5 * Copyright (C) 2015 ARM Ltd.
  6 * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
  7 */
  8#include <linux/acpi.h>
  9#include <linux/irq.h>
 10#include <linux/irqdomain.h>
 11#include <linux/of.h>
 12
 13enum acpi_irq_model_id acpi_irq_model;
 14
 15static struct fwnode_handle *(*acpi_get_gsi_domain_id)(u32 gsi);
 16static u32 (*acpi_gsi_to_irq_fallback)(u32 gsi);
 17
 18/**
 19 * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI
 20 * @gsi: GSI IRQ number to map
 21 * @irq: pointer where linux IRQ number is stored
 22 *
 23 * irq location updated with irq value [>0 on success, 0 on failure]
 24 *
 25 * Returns: 0 on success
 26 *          -EINVAL on failure
 27 */
 28int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 29{
 30	struct irq_domain *d;
 
 31
 32	d = irq_find_matching_fwnode(acpi_get_gsi_domain_id(gsi),
 33					DOMAIN_BUS_ANY);
 34	*irq = irq_find_mapping(d, gsi);
 35	/*
 36	 * *irq == 0 means no mapping, that should be reported as a
 37	 * failure, unless there is an arch-specific fallback handler.
 38	 */
 39	if (!*irq && acpi_gsi_to_irq_fallback)
 40		*irq = acpi_gsi_to_irq_fallback(gsi);
 41
 42	return (*irq > 0) ? 0 : -EINVAL;
 43}
 44EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 45
 46/**
 47 * acpi_register_gsi() - Map a GSI to a linux IRQ number
 48 * @dev: device for which IRQ has to be mapped
 49 * @gsi: GSI IRQ number
 50 * @trigger: trigger type of the GSI number to be mapped
 51 * @polarity: polarity of the GSI to be mapped
 52 *
 53 * Returns: a valid linux IRQ number on success
 54 *          -EINVAL on failure
 55 */
 56int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
 57		      int polarity)
 58{
 59	struct irq_fwspec fwspec;
 60
 61	fwspec.fwnode = acpi_get_gsi_domain_id(gsi);
 62	if (WARN_ON(!fwspec.fwnode)) {
 63		pr_warn("GSI: No registered irqchip, giving up\n");
 64		return -EINVAL;
 65	}
 66
 
 67	fwspec.param[0] = gsi;
 68	fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
 69	fwspec.param_count = 2;
 70
 71	return irq_create_fwspec_mapping(&fwspec);
 72}
 73EXPORT_SYMBOL_GPL(acpi_register_gsi);
 74
 75/**
 76 * acpi_unregister_gsi() - Free a GSI<->linux IRQ number mapping
 77 * @gsi: GSI IRQ number
 78 */
 79void acpi_unregister_gsi(u32 gsi)
 80{
 81	struct irq_domain *d;
 82	int irq;
 83
 84	if (WARN_ON(acpi_irq_model == ACPI_IRQ_MODEL_GIC && gsi < 16))
 85		return;
 86
 87	d = irq_find_matching_fwnode(acpi_get_gsi_domain_id(gsi),
 88				     DOMAIN_BUS_ANY);
 89	irq = irq_find_mapping(d, gsi);
 90	irq_dispose_mapping(irq);
 91}
 92EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
 93
 94/**
 95 * acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source.
 96 * @source: acpi_resource_source to use for the lookup.
 97 * @gsi: GSI IRQ number
 98 *
 99 * Description:
100 * Retrieve the fwhandle of the device referenced by the given IRQ resource
101 * source.
102 *
103 * Return:
104 * The referenced device fwhandle or NULL on failure
105 */
106static struct fwnode_handle *
107acpi_get_irq_source_fwhandle(const struct acpi_resource_source *source,
108			     u32 gsi)
109{
110	struct fwnode_handle *result;
111	struct acpi_device *device;
112	acpi_handle handle;
113	acpi_status status;
114
115	if (!source->string_length)
116		return acpi_get_gsi_domain_id(gsi);
117
118	status = acpi_get_handle(NULL, source->string_ptr, &handle);
119	if (WARN_ON(ACPI_FAILURE(status)))
120		return NULL;
121
122	device = acpi_get_acpi_dev(handle);
123	if (WARN_ON(!device))
124		return NULL;
125
126	result = &device->fwnode;
127	acpi_put_acpi_dev(device);
128	return result;
129}
130
131/*
132 * Context for the resource walk used to lookup IRQ resources.
133 * Contains a return code, the lookup index, and references to the flags
134 * and fwspec where the result is returned.
135 */
136struct acpi_irq_parse_one_ctx {
137	int rc;
138	unsigned int index;
139	unsigned long *res_flags;
140	struct irq_fwspec *fwspec;
141};
142
143/**
144 * acpi_irq_parse_one_match - Handle a matching IRQ resource.
145 * @fwnode: matching fwnode
146 * @hwirq: hardware IRQ number
147 * @triggering: triggering attributes of hwirq
148 * @polarity: polarity attributes of hwirq
149 * @polarity: polarity attributes of hwirq
150 * @shareable: shareable attributes of hwirq
151 * @wake_capable: wake capable attribute of hwirq
152 * @ctx: acpi_irq_parse_one_ctx updated by this function
153 *
154 * Description:
155 * Handle a matching IRQ resource by populating the given ctx with
156 * the information passed.
157 */
158static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
159					    u32 hwirq, u8 triggering,
160					    u8 polarity, u8 shareable,
161					    u8 wake_capable,
162					    struct acpi_irq_parse_one_ctx *ctx)
163{
164	if (!fwnode)
165		return;
166	ctx->rc = 0;
167	*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
168	ctx->fwspec->fwnode = fwnode;
169	ctx->fwspec->param[0] = hwirq;
170	ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity);
171	ctx->fwspec->param_count = 2;
172}
173
174/**
175 * acpi_irq_parse_one_cb - Handle the given resource.
176 * @ares: resource to handle
177 * @context: context for the walk
178 *
179 * Description:
180 * This is called by acpi_walk_resources passing each resource returned by
181 * the _CRS method. We only inspect IRQ resources. Since IRQ resources
182 * might contain multiple interrupts we check if the index is within this
183 * one's interrupt array, otherwise we subtract the current resource IRQ
184 * count from the lookup index to prepare for the next resource.
185 * Once a match is found we call acpi_irq_parse_one_match to populate
186 * the result and end the walk by returning AE_CTRL_TERMINATE.
187 *
188 * Return:
189 * AE_OK if the walk should continue, AE_CTRL_TERMINATE if a matching
190 * IRQ resource was found.
191 */
192static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
193					 void *context)
194{
195	struct acpi_irq_parse_one_ctx *ctx = context;
196	struct acpi_resource_irq *irq;
197	struct acpi_resource_extended_irq *eirq;
198	struct fwnode_handle *fwnode;
199
200	switch (ares->type) {
201	case ACPI_RESOURCE_TYPE_IRQ:
202		irq = &ares->data.irq;
203		if (ctx->index >= irq->interrupt_count) {
204			ctx->index -= irq->interrupt_count;
205			return AE_OK;
206		}
207		fwnode = acpi_get_gsi_domain_id(irq->interrupts[ctx->index]);
208		acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
209					 irq->triggering, irq->polarity,
210					 irq->shareable, irq->wake_capable, ctx);
211		return AE_CTRL_TERMINATE;
212	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
213		eirq = &ares->data.extended_irq;
214		if (eirq->producer_consumer == ACPI_PRODUCER)
215			return AE_OK;
216		if (ctx->index >= eirq->interrupt_count) {
217			ctx->index -= eirq->interrupt_count;
218			return AE_OK;
219		}
220		fwnode = acpi_get_irq_source_fwhandle(&eirq->resource_source,
221						      eirq->interrupts[ctx->index]);
222		acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index],
223					 eirq->triggering, eirq->polarity,
224					 eirq->shareable, eirq->wake_capable, ctx);
225		return AE_CTRL_TERMINATE;
226	}
227
228	return AE_OK;
229}
230
231/**
232 * acpi_irq_parse_one - Resolve an interrupt for a device
233 * @handle: the device whose interrupt is to be resolved
234 * @index: index of the interrupt to resolve
235 * @fwspec: structure irq_fwspec filled by this function
236 * @flags: resource flags filled by this function
237 *
238 * Description:
239 * Resolves an interrupt for a device by walking its CRS resources to find
240 * the appropriate ACPI IRQ resource and populating the given struct irq_fwspec
241 * and flags.
242 *
243 * Return:
244 * The result stored in ctx.rc by the callback, or the default -EINVAL value
245 * if an error occurs.
246 */
247static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
248			      struct irq_fwspec *fwspec, unsigned long *flags)
249{
250	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
251
252	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx);
253	return ctx.rc;
254}
255
256/**
257 * acpi_irq_get - Lookup an ACPI IRQ resource and use it to initialize resource.
258 * @handle: ACPI device handle
259 * @index:  ACPI IRQ resource index to lookup
260 * @res:    Linux IRQ resource to initialize
261 *
262 * Description:
263 * Look for the ACPI IRQ resource with the given index and use it to initialize
264 * the given Linux IRQ resource.
265 *
266 * Return:
267 * 0 on success
268 * -EINVAL if an error occurs
269 * -EPROBE_DEFER if the IRQ lookup/conversion failed
270 */
271int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res)
272{
273	struct irq_fwspec fwspec;
274	struct irq_domain *domain;
275	unsigned long flags;
276	int rc;
277
278	rc = acpi_irq_parse_one(handle, index, &fwspec, &flags);
279	if (rc)
280		return rc;
281
282	domain = irq_find_matching_fwnode(fwspec.fwnode, DOMAIN_BUS_ANY);
283	if (!domain)
284		return -EPROBE_DEFER;
285
286	rc = irq_create_fwspec_mapping(&fwspec);
287	if (rc <= 0)
288		return -EINVAL;
289
290	res->start = rc;
291	res->end = rc;
292	res->flags = flags;
293
294	return 0;
295}
296EXPORT_SYMBOL_GPL(acpi_irq_get);
297
298/**
299 * acpi_set_irq_model - Setup the GSI irqdomain information
300 * @model: the value assigned to acpi_irq_model
301 * @fn: a dispatcher function that will return the domain fwnode
302 *	for a given GSI
303 */
304void __init acpi_set_irq_model(enum acpi_irq_model_id model,
305			       struct fwnode_handle *(*fn)(u32))
306{
307	acpi_irq_model = model;
308	acpi_get_gsi_domain_id = fn;
309}
310
311/**
312 * acpi_set_gsi_to_irq_fallback - Register a GSI transfer
313 * callback to fallback to arch specified implementation.
314 * @fn: arch-specific fallback handler
315 */
316void __init acpi_set_gsi_to_irq_fallback(u32 (*fn)(u32))
317{
318	acpi_gsi_to_irq_fallback = fn;
319}
320
321/**
322 * acpi_irq_create_hierarchy - Create a hierarchical IRQ domain with the default
323 *                             GSI domain as its parent.
324 * @flags:      Irq domain flags associated with the domain
325 * @size:       Size of the domain.
326 * @fwnode:     Optional fwnode of the interrupt controller
327 * @ops:        Pointer to the interrupt domain callbacks
328 * @host_data:  Controller private data pointer
329 */
330struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags,
331					     unsigned int size,
332					     struct fwnode_handle *fwnode,
333					     const struct irq_domain_ops *ops,
334					     void *host_data)
335{
336	struct irq_domain *d;
337
338	/* This only works for the GIC model... */
339	if (acpi_irq_model != ACPI_IRQ_MODEL_GIC)
340		return NULL;
341
342	d = irq_find_matching_fwnode(acpi_get_gsi_domain_id(0),
343				     DOMAIN_BUS_ANY);
344
345	if (!d)
346		return NULL;
347
348	return irq_domain_create_hierarchy(d, flags, size, fwnode, ops,
349					   host_data);
350}
351EXPORT_SYMBOL_GPL(acpi_irq_create_hierarchy);