arch/powerpc/platforms/pasemi/msi.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pasemi/msi.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pasemi/msi.c- Extension
.c- Size
- 4410 bytes
- Lines
- 163
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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/irq.hlinux/irqdomain.hlinux/msi.hasm/mpic.hasm/hw_irq.hasm/ppc-pci.hasm/msi_bitmap.hsysdev/mpic.h
Detected Declarations
function mpic_pasemi_msi_mask_irqfunction mpic_pasemi_msi_unmask_irqfunction pasemi_msi_teardown_msi_irqsfunction msi_for_each_descfunction pasemi_msi_setup_msi_irqsfunction msi_for_each_descfunction mpic_pasemi_msi_init
Annotated Snippet
if (hwirq < 0) {
pr_debug("pasemi_msi: failed allocating hwirq\n");
return hwirq;
}
virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
if (!virq) {
pr_debug("pasemi_msi: failed mapping hwirq 0x%x\n",
hwirq);
msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq,
ALLOC_CHUNK);
return -ENOSPC;
}
/* Vector on MSI is really an offset, the hardware adds
* it to the value written at the magic address. So set
* it to 0 to remain sane.
*/
mpic_set_vector(virq, 0);
irq_set_msi_desc(virq, entry);
irq_set_chip(virq, &mpic_pasemi_msi_chip);
irq_set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%x) " \
"addr 0x%x\n", virq, hwirq, msg.address_lo);
/* Likewise, the device writes [0...511] into the target
* register to generate MSI [512...1023]
*/
msg.data = hwirq-0x200;
pci_write_msi_msg(virq, &msg);
}
return 0;
}
int __init mpic_pasemi_msi_init(struct mpic *mpic)
{
int rc;
struct pci_controller *phb;
struct device_node *of_node;
of_node = irq_domain_get_of_node(mpic->irqhost);
if (!of_node ||
!of_device_is_compatible(of_node,
"pasemi,pwrficient-openpic"))
return -ENODEV;
rc = mpic_msi_init_allocator(mpic);
if (rc) {
pr_debug("pasemi_msi: Error allocating bitmap!\n");
return rc;
}
pr_debug("pasemi_msi: Registering PA Semi MPIC MSI callbacks\n");
msi_mpic = mpic;
list_for_each_entry(phb, &hose_list, list_node) {
WARN_ON(phb->controller_ops.setup_msi_irqs);
phb->controller_ops.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
phb->controller_ops.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
}
return 0;
}
Annotation
- Immediate include surface: `linux/irq.h`, `linux/irqdomain.h`, `linux/msi.h`, `asm/mpic.h`, `asm/hw_irq.h`, `asm/ppc-pci.h`, `asm/msi_bitmap.h`, `sysdev/mpic.h`.
- Detected declarations: `function mpic_pasemi_msi_mask_irq`, `function mpic_pasemi_msi_unmask_irq`, `function pasemi_msi_teardown_msi_irqs`, `function msi_for_each_desc`, `function pasemi_msi_setup_msi_irqs`, `function msi_for_each_desc`, `function mpic_pasemi_msi_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.