x86_64: re-enable legacy PIC and PIT initialisation

This commit is contained in:
2024-09-17 17:48:26 +01:00
parent 3f992d84fb
commit d29b955ee8
6 changed files with 231 additions and 42 deletions

View File

@@ -1,34 +1,33 @@
#include <socks/printk.h>
#include <arch/irq.h>
#include <arch/ports.h>
#include <socks/clock.h>
#include <socks/cpu.h>
#include <arch/ports.h>
#include <arch/irq.h>
#include <socks/printk.h>
#define PIT_COUNTER0 0x40
#define PIT_CMD 0x43
#define PIT_COUNTER0 0x40
#define PIT_CMD 0x43
#define CMD_BINARY 0x00 // Use Binary counter values
#define CMD_BCD 0x01 // Use Binary Coded Decimal counter values
#define CMD_BINARY 0x00 // Use Binary counter values
#define CMD_BCD 0x01 // Use Binary Coded Decimal counter values
#define CMD_MODE0 0x00 // Interrupt on Terminal Count
#define CMD_MODE1 0x02 // Hardware Retriggerable One-Shot
#define CMD_MODE2 0x04 // Rate Generator
#define CMD_MODE3 0x06 // Square Wave
#define CMD_MODE4 0x08 // Software Trigerred Strobe
#define CMD_MODE5 0x0a // Hardware Trigerred Strobe
#define CMD_MODE0 0x00 // Interrupt on Terminal Count
#define CMD_MODE1 0x02 // Hardware Retriggerable One-Shot
#define CMD_MODE2 0x04 // Rate Generator
#define CMD_MODE3 0x06 // Square Wave
#define CMD_MODE4 0x08 // Software Trigerred Strobe
#define CMD_MODE5 0x0a // Hardware Trigerred Strobe
#define CMD_LATCH 0x00
#define CMD_RW_LOW 0x10 // Least Significant Byte
#define CMD_RW_HI 0x20 // Most Significant Byte
#define CMD_RW_BOTH 0x30 // Least followed by Most Significant Byte
#define CMD_LATCH 0x00
#define CMD_RW_LOW 0x10 // Least Significant Byte
#define CMD_RW_HI 0x20 // Most Significant Byte
#define CMD_RW_BOTH 0x30 // Least followed by Most Significant Byte
#define CMD_COUNTER0 0x00
#define CMD_COUNTER1 0x40
#define CMD_COUNTER2 0x80
#define CMD_READBACK 0xc0
#define PIT_FREQUENCY 1193182
#define CMD_COUNTER0 0x00
#define CMD_COUNTER1 0x40
#define CMD_COUNTER2 0x80
#define CMD_READBACK 0xc0
#define PIT_FREQUENCY 1193182
static volatile unsigned long long ticks = 0;
@@ -40,9 +39,7 @@ static int pit_callback(void)
return 0;
}
static struct irq_hook pit_irq_hook = {
.irq_callback = pit_callback
};
static struct irq_hook pit_irq_hook = {.irq_callback = pit_callback};
void pit_start(unsigned int hz)
{