diff options
author | Danny Holman <dholman@gymli.org> | 2022-01-21 12:10:05 -0600 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2022-01-21 12:10:05 -0600 |
commit | 8cd22309667cf3da9c357e5b7dca43e8b6a2f9c0 (patch) | |
tree | 05a7e450a702a5fc744b4bd1f96abf1952ece566 /arch/i386/boot/pic.c | |
parent | 5fe27abd6204dd17787d7d0046015777444357ff (diff) |
arch: i386: move non-critial files out of boot
Move all files not needed for the bootstrap process out of boot and into
the main x86 source directory.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/boot/pic.c')
-rw-r--r-- | arch/i386/boot/pic.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/arch/i386/boot/pic.c b/arch/i386/boot/pic.c deleted file mode 100644 index 69a0785..0000000 --- a/arch/i386/boot/pic.c +++ /dev/null @@ -1,67 +0,0 @@ -#include <kernel/pic.h> - -void pic_eoi(unsigned char irq) { - if (irq >= 8) - outb(PIC2_COMMAND, 0x20); - outb(PIC1_COMMAND, 0x20); -} - -void pic_remap(void) { - unsigned char a1 = inb(PIC1_DATA); - unsigned char a2 = inb(PIC2_DATA); - - outb(PIC1_COMMAND, ICW1_INIT | ICW1_ICW4); - outb(PIC2_COMMAND, ICW1_INIT | ICW1_ICW4); - outb(PIC1_DATA, PIC1); - outb(PIC2_DATA, PIC2); - outb(PIC1_DATA, 4); - outb(PIC2_DATA, 2); - outb(PIC1_DATA, ICW4_8086); - outb(PIC2_DATA, ICW4_8086); - outb(PIC1_DATA, a1); - outb(PIC2_DATA, a2); -} - -static uint16_t __pic_get_irq_reg(int ocw3) { - outb(PIC1_COMMAND, ocw3); - outb(PIC2_COMMAND, ocw3); - return (inb(PIC2_COMMAND) << 8) | inb(PIC1_COMMAND); -} - -uint16_t pic_get_irr(void) { - return __pic_get_irq_reg(PIC_READ_IRR); -} - -uint16_t pic_get_isr(void) { - return __pic_get_irq_reg(PIC_READ_ISR); -} - -void irq_set_mask(uint8_t irq) { - uint16_t port; - uint8_t data; - - if (irq < 8) { - port = PIC1_DATA; - } else { - port = PIC2_DATA; - irq -= 8; - } - - data = inb(port) | (1 << irq); - outb(port, data); -} - -void irq_clear_mask(uint8_t irq) { - uint16_t port; - uint8_t data; - - if (irq < 8) { - port = PIC1_DATA; - } else { - port = PIC2_DATA; - irq -= 8; - } - - data = inb(port) & ~(1 << irq); - outb(port, data); -} |