drivers/bus/fsl-mc/fsl-mc-msi.c
Source file repositories/reference/linux-study-clean/drivers/bus/fsl-mc/fsl-mc-msi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/fsl-mc/fsl-mc-msi.c- Extension
.c- Size
- 3197 bytes
- Lines
- 118
- Domain
- Driver Families
- Bucket
- drivers/bus
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/of_irq.hlinux/irq.hlinux/irqdomain.hlinux/msi.hlinux/acpi_iort.hfsl-mc-private.h
Detected Declarations
function Complexfunction fsl_mc_msi_domain_alloc_irqsfunction fsl_mc_msi_domain_free_irqsfunction fsl_mc_get_msi_id
Annotated Snippet
if (error < 0) {
dev_err(&owner_mc_dev->dev,
"dprc_set_irq() failed: %d\n", error);
}
} else {
/*
* IRQ is for for a child device of mc_bus_dev
*/
error = dprc_set_obj_irq(mc_bus_dev->mc_io,
MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI,
mc_bus_dev->mc_handle,
owner_mc_dev->obj_desc.type,
owner_mc_dev->obj_desc.id,
mc_dev_irq->dev_irq_index,
&irq_cfg);
if (error < 0) {
dev_err(&owner_mc_dev->dev,
"dprc_obj_set_irq() failed: %d\n", error);
}
}
}
struct irq_domain *fsl_mc_get_msi_parent(struct device *dev)
{
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
struct device *root_dprc_dev;
struct device *bus_dev;
fsl_mc_get_root_dprc(dev, &root_dprc_dev);
bus_dev = root_dprc_dev->parent;
return (bus_dev->of_node ?
of_msi_get_domain(bus_dev, bus_dev->of_node, DOMAIN_BUS_NEXUS) :
iort_get_device_domain(bus_dev, mc_dev->icid, DOMAIN_BUS_NEXUS));
}
int fsl_mc_msi_domain_alloc_irqs(struct device *dev, unsigned int irq_count)
{
int error = msi_setup_device_data(dev);
if (error)
return error;
error = platform_device_msi_init_and_alloc_irqs(dev, irq_count, fsl_mc_write_msi_msg);
if (error)
dev_err(dev, "Failed to allocate IRQs\n");
return error;
}
void fsl_mc_msi_domain_free_irqs(struct device *dev)
{
msi_domain_free_irqs_all(dev, MSI_DEFAULT_DOMAIN);
}
u32 fsl_mc_get_msi_id(struct device *dev)
{
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
struct device *root_dprc_dev;
fsl_mc_get_root_dprc(dev, &root_dprc_dev);
return (root_dprc_dev->parent->of_node ?
of_msi_xlate(dev, NULL, mc_dev->icid) :
iort_msi_map_id(dev, mc_dev->icid));
}
Annotation
- Immediate include surface: `linux/of_irq.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/msi.h`, `linux/acpi_iort.h`, `fsl-mc-private.h`.
- Detected declarations: `function Complex`, `function fsl_mc_msi_domain_alloc_irqs`, `function fsl_mc_msi_domain_free_irqs`, `function fsl_mc_get_msi_id`.
- Atlas domain: Driver Families / drivers/bus.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.