arch/m68k/amiga/cia.c
Source file repositories/reference/linux-study-clean/arch/m68k/amiga/cia.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/amiga/cia.c- Extension
.c- Size
- 4633 bytes
- Lines
- 196
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- 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/types.hlinux/kernel.hlinux/sched.hlinux/errno.hlinux/kernel_stat.hlinux/init.hlinux/seq_file.hlinux/interrupt.hlinux/irq.hasm/irq.hasm/amigahw.hasm/amigaints.h
Detected Declarations
struct ciabasefunction cia_set_irqfunction cia_able_irqfunction cia_handlerfunction cia_irq_enablefunction cia_irq_disablefunction auto_irq_enablefunction auto_irq_disablefunction cia_init_IRQ
Annotated Snippet
struct ciabase {
volatile struct CIA *cia;
unsigned char icr_mask, icr_data;
unsigned short int_mask;
int handler_irq, cia_irq, server_irq;
char *name;
} ciaa_base = {
.cia = &ciaa,
.int_mask = IF_PORTS,
.handler_irq = IRQ_AMIGA_PORTS,
.cia_irq = IRQ_AMIGA_CIAA,
.name = "CIAA"
}, ciab_base = {
.cia = &ciab,
.int_mask = IF_EXTER,
.handler_irq = IRQ_AMIGA_EXTER,
.cia_irq = IRQ_AMIGA_CIAB,
.name = "CIAB"
};
/*
* Cause or clear CIA interrupts, return old interrupt status.
*/
unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
{
unsigned char old;
old = (base->icr_data |= base->cia->icr);
if (mask & CIA_ICR_SETCLR)
base->icr_data |= mask;
else
base->icr_data &= ~mask;
if (base->icr_data & base->icr_mask)
amiga_custom.intreq = IF_SETCLR | base->int_mask;
return old & base->icr_mask;
}
/*
* Enable or disable CIA interrupts, return old interrupt mask,
*/
unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
{
unsigned char old;
old = base->icr_mask;
base->icr_data |= base->cia->icr;
base->cia->icr = mask;
if (mask & CIA_ICR_SETCLR)
base->icr_mask |= mask;
else
base->icr_mask &= ~mask;
base->icr_mask &= CIA_ICR_ALL;
if (base->icr_data & base->icr_mask)
amiga_custom.intreq = IF_SETCLR | base->int_mask;
return old;
}
static irqreturn_t cia_handler(int irq, void *dev_id)
{
struct ciabase *base = dev_id;
int mach_irq;
unsigned char ints;
unsigned long flags;
/* Interrupts get disabled while the timer irq flag is cleared and
* the timer interrupt serviced.
*/
mach_irq = base->cia_irq;
local_irq_save(flags);
ints = cia_set_irq(base, CIA_ICR_ALL);
amiga_custom.intreq = base->int_mask;
if (ints & 1)
generic_handle_irq(mach_irq);
local_irq_restore(flags);
mach_irq++, ints >>= 1;
for (; ints; mach_irq++, ints >>= 1) {
if (ints & 1)
generic_handle_irq(mach_irq);
}
return IRQ_HANDLED;
}
static void cia_irq_enable(struct irq_data *data)
{
unsigned int irq = data->irq;
unsigned char mask;
if (irq >= IRQ_AMIGA_CIAB) {
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/sched.h`, `linux/errno.h`, `linux/kernel_stat.h`, `linux/init.h`, `linux/seq_file.h`, `linux/interrupt.h`.
- Detected declarations: `struct ciabase`, `function cia_set_irq`, `function cia_able_irq`, `function cia_handler`, `function cia_irq_enable`, `function cia_irq_disable`, `function auto_irq_enable`, `function auto_irq_disable`, `function cia_init_IRQ`.
- Atlas domain: Architecture Layer / arch/m68k.
- 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.