|
|
|
@ -39,6 +39,13 @@ void arch_irq_init(void)
|
|
|
|
|
x86_set_intr_gate(X86_VECT_IRQ(14), _x86_isr_irq14);
|
|
|
|
|
x86_set_intr_gate(X86_VECT_IRQ(15), _x86_isr_irq15);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* disable interrupts to prevent IRQs from being fired
|
|
|
|
|
* immediately after the initialization sequence is complete
|
|
|
|
|
* (we need time to mask all IRQs again first)
|
|
|
|
|
*/
|
|
|
|
|
disable_intr();
|
|
|
|
|
|
|
|
|
|
/* begin initialization sequence in cascade mode */
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC1_CMD, ICW1_INIT | ICW1_ICW4);
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC2_CMD, ICW1_INIT | ICW1_ICW4);
|
|
|
|
@ -57,9 +64,15 @@ void arch_irq_init(void)
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC1_DATA, ICW4_8086);
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC2_DATA, ICW4_8086);
|
|
|
|
|
|
|
|
|
|
/* mask all IRQs */
|
|
|
|
|
/*
|
|
|
|
|
* The initialization sequence is finished now, meaning all IRQ masks
|
|
|
|
|
* have been cleared (they are all enabled). Disable them again.
|
|
|
|
|
*/
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC1_DATA, 0xff);
|
|
|
|
|
x86_outb(X86_PORT_PIC2_DATA, 0xff);
|
|
|
|
|
x86_outb_wait(X86_PORT_PIC2_DATA, 0xff);
|
|
|
|
|
|
|
|
|
|
/* it's safe to turn interrupts back on now */
|
|
|
|
|
enable_intr();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void arch_irq_enable(unsigned int number)
|
|
|
|
@ -92,6 +105,13 @@ void arch_irq_disable(unsigned int number)
|
|
|
|
|
x86_outb(port, mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void x86_irq_ack(unsigned int number)
|
|
|
|
|
{
|
|
|
|
|
if (number >= 8)
|
|
|
|
|
x86_outb(X86_PORT_PIC2_CMD, 0x20);
|
|
|
|
|
x86_outb(X86_PORT_PIC1_CMD, 0x20);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This file is part of GayBSD.
|
|
|
|
|
* Copyright (c) 2021 fef <owo@fef.moe>.
|
|
|
|
|