38#define ICW2_MASTER 0x20
39#define ICW2_SLAVE 0x28
40#define ICW3_MASTER 0x04
41#define ICW3_SLAVE 0x02
53 }
else if (irq < 16) {
57 panic(
"Invalid IRQ number\n");
67 }
else if (irq < 16) {
73 panic(
"Invalid IRQ number\n");
123 return irq < 16 ?
"8259 edge" :
"";
171 printk(
"i8259: Controller not found\n");
175 printk(
"i8259: initializing [Master: %p (%s), Slave: %p (%s)]\n",
static uint8_t io_in8(struct ioaddr *io, uintptr_t off)
Reads an 8-, 16- or 32-bit register.
static void io_out8(struct ioaddr *io, uintptr_t off, uint8_t val)
Writes an 8-, 16- or 32-bit register.
static char * ioaddr_type_str(struct ioaddr *io)
int x86_pic_setup(struct ioaddr *master, struct ioaddr *slave)
Sets up the 8259s, with every IRQ masked.
void x86_pic_disable(void)
Masks every IRQ of the 8259s, when the APIC brings the interrupts.
struct x86_irq_chip x86_pic_chip
static void x86_irq_remap(void)
Initializes the 8259s, with their IRQs at vectors 32 to 47, so that they don't collide with the CPU's...
static void x86_irq_unmask(int irq)
Unmasks an IRQ at its 8259 (for the slave's, the master's IRQ 2 too).
static void pic_chip_eoi(unsigned irq)
Tells the 8259s that an interrupt is handled: the slave too for its own IRQs.
static struct ioaddr slave
static void pic_chip_unmask(unsigned irq)
Unmasks an IRQ, for irq.c.
static int x86_pic_probe(void)
Checks that there is an 8259 at the master's ports: it must keep the mask that was written.
static struct ioaddr master
static void pic_chip_mask(unsigned irq)
Masks an IRQ, for irq.c.
static const char * pic_chip_describe(unsigned irq)
Describes an IRQ's route, for /proc/interrupts.
static void x86_irq_mask(int irq)
Masks an IRQ at its 8259.
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
unsigned short int uint16_t
Where a device's registers are.
An interrupt controller: the 8259s, or the APIC.