arch/powerpc/sysdev/i8259.c
Source file repositories/reference/linux-study-clean/arch/powerpc/sysdev/i8259.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/sysdev/i8259.c- Extension
.c- Size
- 7076 bytes
- Lines
- 284
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ioport.hlinux/interrupt.hlinux/irqdomain.hlinux/kernel.hlinux/delay.hasm/io.hasm/i8259.h
Detected Declarations
function i8259_irqfunction i8259_mask_and_ack_irqfunction i8259_set_irq_maskfunction i8259_mask_irqfunction i8259_unmask_irqfunction i8259_host_matchfunction i8259_host_mapfunction i8259_host_xlatefunction i8259_get_hostfunction i8259_init
Annotated Snippet
if (irq == 2 ) {
/*
* Interrupt is cascaded so perform interrupt
* acknowledge on controller 2.
*/
outb(0x0C, 0xA0); /* prepare for poll */
irq = (inb(0xA0) & 7) + 8;
}
}
if (irq == 7) {
/*
* This may be a spurious interrupt.
*
* Read the interrupt status register (ISR). If the most
* significant bit is not set then there is no valid
* interrupt.
*/
if (!pci_intack)
outb(0x0B, 0x20); /* ISR register */
if(~inb(0x20) & 0x80)
irq = 0;
} else if (irq == 0xff)
irq = 0;
if (lock)
raw_spin_unlock(&i8259_lock);
return irq;
}
static void i8259_mask_and_ack_irq(struct irq_data *d)
{
unsigned long flags;
raw_spin_lock_irqsave(&i8259_lock, flags);
if (d->irq > 7) {
cached_A1 |= 1 << (d->irq-8);
inb(0xA1); /* DUMMY */
outb(cached_A1, 0xA1);
outb(0x20, 0xA0); /* Non-specific EOI */
outb(0x20, 0x20); /* Non-specific EOI to cascade */
} else {
cached_21 |= 1 << d->irq;
inb(0x21); /* DUMMY */
outb(cached_21, 0x21);
outb(0x20, 0x20); /* Non-specific EOI */
}
raw_spin_unlock_irqrestore(&i8259_lock, flags);
}
static void i8259_set_irq_mask(int irq_nr)
{
outb(cached_A1,0xA1);
outb(cached_21,0x21);
}
static void i8259_mask_irq(struct irq_data *d)
{
unsigned long flags;
pr_debug("i8259_mask_irq(%d)\n", d->irq);
raw_spin_lock_irqsave(&i8259_lock, flags);
if (d->irq < 8)
cached_21 |= 1 << d->irq;
else
cached_A1 |= 1 << (d->irq-8);
i8259_set_irq_mask(d->irq);
raw_spin_unlock_irqrestore(&i8259_lock, flags);
}
static void i8259_unmask_irq(struct irq_data *d)
{
unsigned long flags;
pr_debug("i8259_unmask_irq(%d)\n", d->irq);
raw_spin_lock_irqsave(&i8259_lock, flags);
if (d->irq < 8)
cached_21 &= ~(1 << d->irq);
else
cached_A1 &= ~(1 << (d->irq-8));
i8259_set_irq_mask(d->irq);
raw_spin_unlock_irqrestore(&i8259_lock, flags);
}
static struct irq_chip i8259_pic = {
.name = "i8259",
.irq_mask = i8259_mask_irq,
.irq_disable = i8259_mask_irq,
Annotation
- Immediate include surface: `linux/ioport.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/kernel.h`, `linux/delay.h`, `asm/io.h`, `asm/i8259.h`.
- Detected declarations: `function i8259_irq`, `function i8259_mask_and_ack_irq`, `function i8259_set_irq_mask`, `function i8259_mask_irq`, `function i8259_unmask_irq`, `function i8259_host_match`, `function i8259_host_map`, `function i8259_host_xlate`, `function i8259_get_host`, `function i8259_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.