MOS Source Code
Loading...
Searching...
No Matches
lapic.c File Reference
+ Include dependency graph for lapic.c:

Go to the source code of this file.

Macros

#define APIC_REG_LAPIC_VERSION   0x30
 
#define APIC_REG_PRIO_TASK   0x80
 
#define APIC_REG_PRIO_ARBITRATION   0x90
 
#define APIC_REG_PRIO_PROCESSOR   0xA0
 
#define APIC_REG_EOI   0xB0
 
#define APIC_REG_REMOTE_READ   0xC0
 
#define APIC_REG_LOGICAL_DEST   0xD0
 
#define APIC_REG_DEST_FORMAT   0xE0
 
#define APIC_REG_SPURIOUS_INTR_VEC   0xF0
 
#define APIC_REG_ERROR_STATUS   0x280
 
#define APIC_REG_TIMER_INITIAL_COUNT   0x380
 
#define APIC_REG_TIMER_CURRENT_COUNT   0x390
 
#define APIC_REG_TIMER_DIVIDE_CONFIG   0x3E0
 
#define APIC_REG_LVT_CMCI_INTR   0x2F0
 
#define APIC_REG_LVT_TIMER   0x320
 
#define APIC_REG_LVT_THERMAL_SENSOR   0x330
 
#define APIC_REG_LVT_PERF_MON_CTR   0x340
 
#define APIC_REG_LVT_LINT0   0x350
 
#define APIC_REG_LVT_LINT1   0x360
 
#define APIC_REG_LVT_ERROR   0x370
 
#define APIC_IN_SERVICE_REG_BEGIN   0x100
 
#define APIC_IN_SERVICE_REG_END   0x170
 
#define APIC_TRIGGER_MODE_REG_BEGIN   0x180
 
#define APIC_TRIGGER_MODE_REG_END   0x1F0
 
#define APIC_TRIGGER_MODE_REG_TMR_BEGIN   0x180
 
#define APIC_TRIGGER_MODE_REG_TMR_END   0x1F0
 
#define APIC_INTERRUPT_REQUEST_REG_BEGIN   0x200
 
#define APIC_INTERRUPT_REQUEST_REG_END   0x270
 
#define APIC_INTERRUPT_COMMAND_REG_BEGIN   0x300
 
#define APIC_INTERRUPT_COMMAND_REG_END   0x310
 
#define IA32_APIC_BASE_MSR   0x1B
 

Functions

u32 lapic_read32 (u32 offset)
 
u64 lapic_read64 (u32 offset)
 
void lapic_write32 (u32 offset, u32 value)
 
void lapic_write64 (u32 offset, u64 value)
 
static void lapic_wait_sent (void)
 
void lapic_interrupt_full (u8 vec, u8 dest, lapic_delivery_mode_t delivery_mode, lapic_dest_mode_t dest_mode, bool level, bool trigger, lapic_shorthand_t shorthand)
 
void lapic_interrupt (u8 vec, u8 dest, lapic_delivery_mode_t delivery_mode, lapic_dest_mode_t dest_mode, lapic_shorthand_t shorthand)
 
static void lapic_memory_setup (void)
 
void lapic_enable (void)
 
void lapic_set_timer (u32 initial_count)
 
void lapic_eoi (void)
 

Variables

static ptr_t lapic_regs = 0
 

Macro Definition Documentation

◆ APIC_REG_LAPIC_VERSION

#define APIC_REG_LAPIC_VERSION   0x30

Definition at line 15 of file lapic.c.

◆ APIC_REG_PRIO_TASK

#define APIC_REG_PRIO_TASK   0x80

Definition at line 16 of file lapic.c.

◆ APIC_REG_PRIO_ARBITRATION

#define APIC_REG_PRIO_ARBITRATION   0x90

Definition at line 17 of file lapic.c.

◆ APIC_REG_PRIO_PROCESSOR

#define APIC_REG_PRIO_PROCESSOR   0xA0

Definition at line 18 of file lapic.c.

◆ APIC_REG_EOI

#define APIC_REG_EOI   0xB0

Definition at line 19 of file lapic.c.

Referenced by lapic_eoi().

◆ APIC_REG_REMOTE_READ

#define APIC_REG_REMOTE_READ   0xC0

Definition at line 20 of file lapic.c.

◆ APIC_REG_LOGICAL_DEST

#define APIC_REG_LOGICAL_DEST   0xD0

Definition at line 21 of file lapic.c.

◆ APIC_REG_DEST_FORMAT

#define APIC_REG_DEST_FORMAT   0xE0

Definition at line 22 of file lapic.c.

◆ APIC_REG_SPURIOUS_INTR_VEC

#define APIC_REG_SPURIOUS_INTR_VEC   0xF0

Definition at line 23 of file lapic.c.

Referenced by lapic_enable().

◆ APIC_REG_ERROR_STATUS

#define APIC_REG_ERROR_STATUS   0x280

Definition at line 24 of file lapic.c.

Referenced by lapic_interrupt_full().

◆ APIC_REG_TIMER_INITIAL_COUNT

#define APIC_REG_TIMER_INITIAL_COUNT   0x380

Definition at line 25 of file lapic.c.

Referenced by lapic_set_timer().

◆ APIC_REG_TIMER_CURRENT_COUNT

#define APIC_REG_TIMER_CURRENT_COUNT   0x390

Definition at line 26 of file lapic.c.

◆ APIC_REG_TIMER_DIVIDE_CONFIG

#define APIC_REG_TIMER_DIVIDE_CONFIG   0x3E0

Definition at line 27 of file lapic.c.

Referenced by lapic_set_timer().

◆ APIC_REG_LVT_CMCI_INTR

#define APIC_REG_LVT_CMCI_INTR   0x2F0

Definition at line 29 of file lapic.c.

◆ APIC_REG_LVT_TIMER

#define APIC_REG_LVT_TIMER   0x320

Definition at line 30 of file lapic.c.

Referenced by lapic_set_timer().

◆ APIC_REG_LVT_THERMAL_SENSOR

#define APIC_REG_LVT_THERMAL_SENSOR   0x330

Definition at line 31 of file lapic.c.

◆ APIC_REG_LVT_PERF_MON_CTR

#define APIC_REG_LVT_PERF_MON_CTR   0x340

Definition at line 32 of file lapic.c.

◆ APIC_REG_LVT_LINT0

#define APIC_REG_LVT_LINT0   0x350

Definition at line 33 of file lapic.c.

◆ APIC_REG_LVT_LINT1

#define APIC_REG_LVT_LINT1   0x360

Definition at line 34 of file lapic.c.

◆ APIC_REG_LVT_ERROR

#define APIC_REG_LVT_ERROR   0x370

Definition at line 35 of file lapic.c.

◆ APIC_IN_SERVICE_REG_BEGIN

#define APIC_IN_SERVICE_REG_BEGIN   0x100

Definition at line 37 of file lapic.c.

◆ APIC_IN_SERVICE_REG_END

#define APIC_IN_SERVICE_REG_END   0x170

Definition at line 38 of file lapic.c.

◆ APIC_TRIGGER_MODE_REG_BEGIN

#define APIC_TRIGGER_MODE_REG_BEGIN   0x180

Definition at line 40 of file lapic.c.

◆ APIC_TRIGGER_MODE_REG_END

#define APIC_TRIGGER_MODE_REG_END   0x1F0

Definition at line 41 of file lapic.c.

◆ APIC_TRIGGER_MODE_REG_TMR_BEGIN

#define APIC_TRIGGER_MODE_REG_TMR_BEGIN   0x180

Definition at line 43 of file lapic.c.

◆ APIC_TRIGGER_MODE_REG_TMR_END

#define APIC_TRIGGER_MODE_REG_TMR_END   0x1F0

Definition at line 44 of file lapic.c.

◆ APIC_INTERRUPT_REQUEST_REG_BEGIN

#define APIC_INTERRUPT_REQUEST_REG_BEGIN   0x200

Definition at line 46 of file lapic.c.

◆ APIC_INTERRUPT_REQUEST_REG_END

#define APIC_INTERRUPT_REQUEST_REG_END   0x270

Definition at line 47 of file lapic.c.

◆ APIC_INTERRUPT_COMMAND_REG_BEGIN

#define APIC_INTERRUPT_COMMAND_REG_BEGIN   0x300

Definition at line 49 of file lapic.c.

Referenced by lapic_interrupt_full(), and lapic_wait_sent().

◆ APIC_INTERRUPT_COMMAND_REG_END

#define APIC_INTERRUPT_COMMAND_REG_END   0x310

Definition at line 50 of file lapic.c.

◆ IA32_APIC_BASE_MSR

#define IA32_APIC_BASE_MSR   0x1B

Definition at line 52 of file lapic.c.

Function Documentation

◆ lapic_read32()

u32 lapic_read32 ( u32 offset)

Definition at line 56 of file lapic.c.

Referenced by lapic_enable(), lapic_get_id(), and lapic_wait_sent().

◆ lapic_read64()

u64 lapic_read64 ( u32 offset)

Definition at line 63 of file lapic.c.

◆ lapic_write32()

void lapic_write32 ( u32 offset,
u32 value )

Definition at line 72 of file lapic.c.

Referenced by lapic_enable(), lapic_eoi(), lapic_interrupt_full(), and lapic_set_timer().

◆ lapic_write64()

void lapic_write64 ( u32 offset,
u64 value )

Definition at line 79 of file lapic.c.

Referenced by lapic_interrupt_full().

◆ lapic_wait_sent()

static void lapic_wait_sent ( void )
static

Definition at line 87 of file lapic.c.

Referenced by lapic_interrupt_full().

+ Here is the call graph for this function:

◆ lapic_interrupt_full()

void lapic_interrupt_full ( u8 vec,
u8 dest,
lapic_delivery_mode_t delivery_mode,
lapic_dest_mode_t dest_mode,
bool level,
bool trigger,
lapic_shorthand_t shorthand )

Definition at line 94 of file lapic.c.

Referenced by lapic_interrupt().

+ Here is the call graph for this function:

◆ lapic_interrupt()

void lapic_interrupt ( u8 vec,
u8 dest,
lapic_delivery_mode_t delivery_mode,
lapic_dest_mode_t dest_mode,
lapic_shorthand_t shorthand )

Definition at line 111 of file lapic.c.

Referenced by platform_ipi_send().

+ Here is the call graph for this function:

◆ lapic_memory_setup()

static void lapic_memory_setup ( void )
static

Definition at line 116 of file lapic.c.

Referenced by lapic_enable().

+ Here is the call graph for this function:

◆ lapic_enable()

void lapic_enable ( void )

Definition at line 136 of file lapic.c.

Referenced by platform_ap_entry(), and platform_startup_late().

+ Here is the call graph for this function:

◆ lapic_set_timer()

void lapic_set_timer ( u32 initial_count)

Definition at line 151 of file lapic.c.

Referenced by x86_setup_lapic_timer().

+ Here is the call graph for this function:

◆ lapic_eoi()

void lapic_eoi ( void )

Definition at line 158 of file lapic.c.

Referenced by x86_handle_irq(), and x86_interrupt_entry().

+ Here is the call graph for this function:

Variable Documentation

◆ lapic_regs

ptr_t lapic_regs = 0
static

Definition at line 54 of file lapic.c.

Referenced by lapic_memory_setup(), lapic_read32(), lapic_read64(), lapic_write32(), and lapic_write64().