1#ifndef _PLATFORM_MISC_H
2#define _PLATFORM_MISC_H
13#define X86_IRQ_TIMER 48
14#define X86_TIMER_VECTOR 0xF0
15#define X86_TLB_VECTOR 0xF1
16#define X86_WAKE_VECTOR 0xF2
17#define X86_SPURIOUS_VECTOR 0xFF
22 void (*
mask)(
unsigned irq);
24 void (*
eoi)(
unsigned irq);
25 const char *(*describe)(
unsigned irq);
void x86_smp_init(void)
Starts the other CPUs, at boot, unless the kernel's command line says smp=off.
void(*) irq_handler_t(void *arg)
void x86_irq_gates_setup(void)
Sets the IDT's gates for the interrupts: vectors 32 to 79, the local APIC's timer,...
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.
int x86_clock_precise(void)
Says whether the clock counts finer than the ticks.
uint32_t x86_lapic_timer_setup(uint32_t period_ns, irq_handler_t handler)
Starts the scheduler's tick with the local APIC's timer, calibrated first.
void x86_irq_tick_switch(void)
Asks for a thread switch once the current interrupt is done: the tick calls it.
struct x86_irq_chip x86_pic_chip
int x86_irq_alloc(struct x86_irq_chip *chip)
Gives a free IRQ with a controller of its own, for an MSI.
uint32_t x86_pit_period_set(uint32_t period_ns)
Makes channel 0 interrupt periodically, for the scheduler's tick.
int x86_hpet_init(void)
Finds the HPET and starts its counter.
void x86_lapic_eoi(void)
Tells the running CPU's local APIC that its interrupt (an IPI) is handled.
uint64_t x86_hpet_read(void)
Reads the HPET's 64-bit counter.
void * x86_acpi_table(const char *signature)
Finds one of ACPI's tables, by its signature.
void x86_irq_chip_set(struct x86_irq_chip *chip)
Sets the system's interrupt controller.
uint32_t x86_hpet_read32(void)
Reads the low half of the HPET's counter only: a single read, which matters because each read is slow...
const char * x86_irq_chip_name(void)
Returns the name of the system's interrupt controller.
int x86_apic_setup(void)
Sets up the APIC to bring the interrupts, if the CPU has one, the MADT describes it,...
int x86_pit_setup(struct ioaddr *io)
Sets where the PIT's ports are.
uint64_t x86_hpet_period_fs(void)
Returns the HPET counter's period.
void x86_pit_delay(uint32_t us)
Waits us microseconds, at most 54 ms, busy.
int x86_apic_cpus(uint32_t *ids, int max)
Lists the CPUs' local APIC IDs, the boot CPU's among them.
void x86_lapic_ipi(uint32_t id, uint32_t icr)
Sends an IPI to a CPU, and waits until it is delivered.
void x86_irq_alloc_from(unsigned first)
Sets the first IRQ that x86_irq_alloc() may give: past the I/O APICs' last pin.
void x86_acpi_poweroff(void)
Powers the machine off, by entering ACPI's S5 sleep state.
int x86_cmos_setup(struct ioaddr *ioaddr)
Sets where the CMOS's ports are.
void x86_lapic_timer_cpu_start(void)
Starts the running CPU's local APIC timer, with the boot CPU's calibration, once it has been done.
void x86_lapic_cpu_setup(void)
Sets up the running CPU's local APIC: enabled, with the spurious vector 0xFF, its timer off,...
unsigned long long int uint64_t
An installed handler, on its interrupt's list.
Where a device's registers are.
An interrupt controller: the 8259s, or the APIC.
void(*) unmask(unsigned irq)
void(*) eoi(unsigned irq)
void(*) mask(unsigned irq)