drivers/acpi/irq.c
Source file repositories/reference/linux-study-clean/drivers/acpi/irq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/irq.c- Extension
.c- Size
- 10826 bytes
- Lines
- 388
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/irq.hlinux/irqdomain.hlinux/of.h
Detected Declarations
struct acpi_irq_parse_one_ctxfunction acpi_gsi_to_irqfunction acpi_register_gsifunction acpi_unregister_gsifunction acpi_get_irq_source_fwhandlefunction acpi_irq_parse_one_matchfunction acpi_irq_parse_one_cbfunction acpi_irq_parse_onefunction acpi_irq_getfunction acpi_set_irq_modelfunction acpi_get_gsi_dispatcherfunction acpi_set_gsi_to_irq_fallbackexport acpi_gsi_to_irqexport acpi_register_gsiexport acpi_unregister_gsiexport acpi_irq_getexport acpi_get_gsi_dispatcherexport acpi_irq_create_hierarchy
Annotated Snippet
struct acpi_irq_parse_one_ctx {
int rc;
unsigned int index;
unsigned long *res_flags;
struct irq_fwspec *fwspec;
};
/**
* acpi_irq_parse_one_match - Handle a matching IRQ resource.
* @fwnode: matching fwnode
* @hwirq: hardware IRQ number
* @triggering: triggering attributes of hwirq
* @polarity: polarity attributes of hwirq
* @polarity: polarity attributes of hwirq
* @shareable: shareable attributes of hwirq
* @wake_capable: wake capable attribute of hwirq
* @ctx: acpi_irq_parse_one_ctx updated by this function
*
* Description:
* Handle a matching IRQ resource by populating the given ctx with
* the information passed.
*/
static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
u32 hwirq, u8 triggering,
u8 polarity, u8 shareable,
u8 wake_capable,
struct acpi_irq_parse_one_ctx *ctx)
{
if (!fwnode)
return;
ctx->rc = 0;
*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
ctx->fwspec->fwnode = fwnode;
ctx->fwspec->param[0] = hwirq;
ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity);
ctx->fwspec->param_count = 2;
}
/**
* acpi_irq_parse_one_cb - Handle the given resource.
* @ares: resource to handle
* @context: context for the walk
*
* Description:
* This is called by acpi_walk_resources passing each resource returned by
* the _CRS method. We only inspect IRQ resources. Since IRQ resources
* might contain multiple interrupts we check if the index is within this
* one's interrupt array, otherwise we subtract the current resource IRQ
* count from the lookup index to prepare for the next resource.
* Once a match is found we call acpi_irq_parse_one_match to populate
* the result and end the walk by returning AE_CTRL_TERMINATE.
*
* Return:
* AE_OK if the walk should continue, AE_CTRL_TERMINATE if a matching
* IRQ resource was found.
*/
static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
void *context)
{
struct acpi_irq_parse_one_ctx *ctx = context;
struct acpi_resource_irq *irq;
struct acpi_resource_extended_irq *eirq;
struct fwnode_handle *fwnode;
switch (ares->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = &ares->data.irq;
if (ctx->index >= irq->interrupt_count) {
ctx->index -= irq->interrupt_count;
return AE_OK;
}
fwnode = acpi_get_gsi_domain_id(irq->interrupts[ctx->index]);
acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
irq->triggering, irq->polarity,
irq->shareable, irq->wake_capable, ctx);
return AE_CTRL_TERMINATE;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
eirq = &ares->data.extended_irq;
if (eirq->producer_consumer == ACPI_PRODUCER)
return AE_OK;
if (ctx->index >= eirq->interrupt_count) {
ctx->index -= eirq->interrupt_count;
return AE_OK;
}
fwnode = acpi_get_irq_source_fwhandle(&eirq->resource_source,
eirq->interrupts[ctx->index]);
acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index],
eirq->triggering, eirq->polarity,
eirq->shareable, eirq->wake_capable, ctx);
return AE_CTRL_TERMINATE;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/of.h`.
- Detected declarations: `struct acpi_irq_parse_one_ctx`, `function acpi_gsi_to_irq`, `function acpi_register_gsi`, `function acpi_unregister_gsi`, `function acpi_get_irq_source_fwhandle`, `function acpi_irq_parse_one_match`, `function acpi_irq_parse_one_cb`, `function acpi_irq_parse_one`, `function acpi_irq_get`, `function acpi_set_irq_model`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.