Remove PIC support; disable it on boot

This commit is contained in:
Jozef Nagy 2023-11-29 18:42:16 +01:00
parent b89286facf
commit 2803a4ec40
No known key found for this signature in database
GPG Key ID: 5F72C3BF3BD614D8
4 changed files with 3 additions and 118 deletions

View File

@ -9,95 +9,6 @@
#include <xtos.h> #include <xtos.h>
/**
* Initializes the 8259 PIC.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlInitializePic(VOID)
{
/* Start in cascade mode */
HlWritePic(PIC1_CONTROL_PORT, PIC_ICW1_INIT | PIC_ICW1_ICW4);
HlWritePic(PIC2_CONTROL_PORT, PIC_ICW1_INIT | PIC_ICW1_ICW4);
/* PIC Vector offset */
HlWritePic(PIC1_DATA_PORT, 0x20);
HlWritePic(PIC2_DATA_PORT, 0x28);
/* Tell Master PIC that there is a Slave PIC */
HlWritePic(PIC1_DATA_PORT, 4);
/* Tell Slave PIC its cascade identity */
HlWritePic(PIC2_DATA_PORT, 2);
/* Tell PIC to use 8086 mode */
HlWritePic(PIC1_DATA_PORT, PIC_ICW4_8086);
HlWritePic(PIC2_DATA_PORT, PIC_ICW4_8086);
/* Mask all IRQs by default */
/* This makes sure we don't get any interrupts we can't handle yet. */
for (UCHAR Irq = 0; Irq < 16; Irq++)
{
HlSetMaskIrqPic(Irq);
}
}
/**
* Masks an IRQ in the 8259 PIC.
*
* @param Irq
* Supplies the IRQ number to be masked.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlSetMaskIrqPic(UCHAR Irq)
{
UINT Port;
if(Irq < 8) {
Port = PIC1_DATA_PORT;
} else {
Port = PIC2_DATA_PORT;
Irq -= 8;
}
HlWritePic(Port, HlIoPortInByte(Port) | (1 << Irq));
}
/**
* Clears an IRQ mask in the 8259 PIC.
*
* @param Irq
* Supplies the IRQ number to be unmasked.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlClearMaskIrqPic(UCHAR Irq)
{
UINT Port;
if(Irq < 8) {
Port = PIC1_DATA_PORT;
} else {
Port = PIC2_DATA_PORT;
Irq -= 8;
}
HlWritePic(Port, HlIoPortInByte(Port) & ~(1 << Irq));
}
/** /**
* Disables the 8259 PIC. * Disables the 8259 PIC.
* *
@ -113,17 +24,6 @@ HlDisablePic(VOID)
HlIoPortOutByte(PIC2_DATA_PORT, 0xFF); HlIoPortOutByte(PIC2_DATA_PORT, 0xFF);
} }
XTFASTCALL
VOID
HlWritePic(IN UCHAR Register, IN UCHAR Value)
{
/* Send data */
HlIoPortOutByte(Register, Value);
/* Wait for some time to make sure PIC has processed the data */
HlIoPortOutByte(0x80, 0x00);
}
/** /**
* Reads from the APIC register. * Reads from the APIC register.
* *

View File

@ -11,28 +11,11 @@
#include <xtos.h> #include <xtos.h>
/* HAL library routines forward references */ /* HAL library routines forward references */
XTCDECL
VOID
HlInitializePic(VOID);
XTCDECL
VOID
HlSetMaskIrqPic(UCHAR Irq);
XTCDECL
VOID
HlClearMaskIrqPic(UCHAR Irq);
XTCDECL XTCDECL
VOID VOID
HlDisablePic(VOID); HlDisablePic(VOID);
XTFASTCALL
VOID
HlWritePic(IN UCHAR Register, IN UCHAR Value);
XTAPI XTAPI
VOID VOID
HlClearScreen(VOID); HlClearScreen(VOID);

View File

@ -71,7 +71,6 @@ KepInitializeMachine(VOID)
HlIoPortOutByte(0x3F6, 0); HlIoPortOutByte(0x3F6, 0);
/* Disable the legacy PIC */ /* Disable the legacy PIC */
HlInitializePic();
HlDisablePic(); HlDisablePic();
} }

View File

@ -69,6 +69,9 @@ KepInitializeMachine(VOID)
/* Re-enable IDE interrupts */ /* Re-enable IDE interrupts */
HlIoPortOutByte(0x376, 0); HlIoPortOutByte(0x376, 0);
HlIoPortOutByte(0x3F6, 0); HlIoPortOutByte(0x3F6, 0);
/* Disable the legacy PIC */
HlDisablePic();
} }
/** /**