21#define APIC_SPIV 0x0f0
22#define APIC_SPIV_APIC_ENABLED 0x00100
25#define APIC_SIV 0x00020
26#define APIC_RIV 0x00040
29#define APIC_DM_FIXED 0x00000
30#define APIC_DM_NMI 0x00400
31#define APIC_ICR_BUSY 0x01000
32#define APIC_DEST_SELF 0x40000
34#define APIC_ICR2 0x310
35#define APIC_LVTERR 0x370
37#define APIC_DEFAULT_BASE 0xfee00000ul
75 asm volatile (
"rdmsr" :
"=a" (val)
83 asm volatile (
"wrmsr" ::
90 asm volatile (
"wrmsr" ::
100#ifndef TEST_APIC_MODE
101#define TEST_APIC_MODE 0
103#define CUR_APIC_MODE (TEST_APIC_MODE ?: cur_apic_mode)
static uint32_t apic_mmio_read(unsigned int reg)
static void apic_msr_write(unsigned int reg, uint32_t val)
enum apic_mode cur_apic_mode
static void apic_msr_icr_write(uint64_t val)
static void apic_mmio_write(unsigned int reg, uint32_t val)
#define APIC_DEFAULT_BASE
static void apic_icr_write(uint64_t val)
static void apic_mmio_icr_write(uint64_t val)
static uint32_t apic_read(unsigned int reg)
static uint32_t apic_msr_read(unsigned int reg)
static void apic_write(unsigned int reg, uint32_t val)
int apic_init(enum apic_mode mode)
Discover and initialise the local APIC to the requested mode.
#define _p(v)
Express an abitrary integer v as void *.
Common declarations for all tests.