arch/powerpc/platforms/powermac/pic.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powermac/pic.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powermac/pic.c- Extension
.c- Size
- 17835 bytes
- Lines
- 656
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/stddef.hlinux/init.hlinux/sched.hlinux/signal.hlinux/pci.hlinux/interrupt.hlinux/syscore_ops.hlinux/adb.hlinux/minmax.hlinux/pmu.hlinux/irqdomain.hlinux/of_address.hlinux/of_irq.hasm/sections.hasm/io.hasm/smp.hasm/pci-bridge.hasm/time.hasm/pmac_feature.hasm/mpic.hasm/xmon.hpmac.h
Detected Declarations
struct pmac_irq_hwfunction __pmac_retriggerfunction pmac_mask_and_ack_irqfunction pmac_ack_irqfunction __pmac_set_irq_maskfunction pmac_startup_irqfunction pmac_mask_irqfunction pmac_unmask_irqfunction pmac_retriggerfunction gatwick_actionfunction pmac_pic_get_irqfunction pmac_pic_host_matchfunction pmac_pic_host_mapfunction pmac_pic_probe_oldstylefunction of_irq_parse_oldworldfunction parentfunction pmac_pic_setup_mpic_nmifunction pmac_setup_one_mpicfunction pmac_pic_probe_mpicfunction pmac_pic_initfunction controllerfunction for_each_node_with_propertyfunction pmacpic_find_viaintfunction pmacpic_suspendfunction pmacpic_resumefunction init_pmacpic_syscore
Annotated Snippet
struct pmac_irq_hw {
unsigned int event;
unsigned int enable;
unsigned int ack;
unsigned int level;
};
/* Workaround flags for 32bit powermac machines */
unsigned int of_irq_workarounds;
struct device_node *of_irq_dflt_pic;
/* Default addresses */
static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4];
static int max_irqs;
static int max_real_irqs;
static DEFINE_RAW_SPINLOCK(pmac_pic_lock);
/* The max irq number this driver deals with is 128; see max_irqs */
static DECLARE_BITMAP(ppc_lost_interrupts, 128);
static DECLARE_BITMAP(ppc_cached_irq_mask, 128);
static int pmac_irq_cascade = -1;
static struct irq_domain *pmac_pic_host;
static void __pmac_retrigger(unsigned int irq_nr)
{
if (irq_nr >= max_real_irqs && pmac_irq_cascade > 0) {
__set_bit(irq_nr, ppc_lost_interrupts);
irq_nr = pmac_irq_cascade;
mb();
}
if (!__test_and_set_bit(irq_nr, ppc_lost_interrupts)) {
atomic_inc(&ppc_n_lost_interrupts);
set_dec(1);
}
}
static void pmac_mask_and_ack_irq(struct irq_data *d)
{
unsigned int src = irqd_to_hwirq(d);
unsigned long bit = 1UL << (src & 0x1f);
int i = src >> 5;
unsigned long flags;
raw_spin_lock_irqsave(&pmac_pic_lock, flags);
__clear_bit(src, ppc_cached_irq_mask);
if (__test_and_clear_bit(src, ppc_lost_interrupts))
atomic_dec(&ppc_n_lost_interrupts);
out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
out_le32(&pmac_irq_hw[i]->ack, bit);
do {
/* make sure ack gets to controller before we enable
interrupts */
mb();
} while((in_le32(&pmac_irq_hw[i]->enable) & bit)
!= (ppc_cached_irq_mask[i] & bit));
raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
}
static void pmac_ack_irq(struct irq_data *d)
{
unsigned int src = irqd_to_hwirq(d);
unsigned long bit = 1UL << (src & 0x1f);
int i = src >> 5;
unsigned long flags;
raw_spin_lock_irqsave(&pmac_pic_lock, flags);
if (__test_and_clear_bit(src, ppc_lost_interrupts))
atomic_dec(&ppc_n_lost_interrupts);
out_le32(&pmac_irq_hw[i]->ack, bit);
(void)in_le32(&pmac_irq_hw[i]->ack);
raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
}
static void __pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
{
unsigned long bit = 1UL << (irq_nr & 0x1f);
int i = irq_nr >> 5;
if ((unsigned)irq_nr >= max_irqs)
return;
/* enable unmasked interrupts */
out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
do {
/* make sure mask gets to controller before we
return to user */
mb();
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/init.h`, `linux/sched.h`, `linux/signal.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/syscore_ops.h`, `linux/adb.h`.
- Detected declarations: `struct pmac_irq_hw`, `function __pmac_retrigger`, `function pmac_mask_and_ack_irq`, `function pmac_ack_irq`, `function __pmac_set_irq_mask`, `function pmac_startup_irq`, `function pmac_mask_irq`, `function pmac_unmask_irq`, `function pmac_retrigger`, `function gatwick_action`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.