Xen Test Framework
Macros | Enumerations | Functions | Variables
apic.h File Reference

x86 Local APIC register definitions and utility functions. More...

#include <xtf/types.h>
#include <xen/errno.h>
#include <arch/msr-index.h>
+ Include dependency graph for apic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APIC_ID   0x020
 
#define APIC_LVR   0x030
 
#define APIC_SPIV   0x0f0
 
#define APIC_SPIV_APIC_ENABLED   0x00100
 
#define APIC_ICR   0x300
 
#define APIC_DM_NMI   0x00400
 
#define APIC_ICR_BUSY   0x01000
 
#define APIC_DEST_SELF   0x40000
 
#define APIC_ICR2   0x310
 
#define APIC_DEFAULT_BASE   0xfee00000ul
 

Enumerations

enum  apic_mode {
  APIC_MODE_UNKNOWN, APIC_MODE_NONE, APIC_MODE_DISABLED, APIC_MODE_XAPIC,
  APIC_MODE_X2APIC
}
 

Functions

int apic_init (enum apic_mode mode)
 Discover and initialise the local APIC to the requested mode. More...
 
static uint32_t apic_mmio_read (unsigned int reg)
 
static void apic_mmio_write (unsigned int reg, uint32_t val)
 
static void apic_mmio_icr_write (uint64_t val)
 
static uint32_t apic_msr_read (unsigned int reg)
 
static void apic_msr_write (unsigned int reg, uint32_t val)
 
static void apic_msr_icr_write (uint64_t val)
 
static uint32_t apic_read (unsigned int reg)
 
static void apic_write (unsigned int reg, uint32_t val)
 
static void apic_icr_write (uint64_t val)
 

Variables

enum apic_mode cur_apic_mode
 

Detailed Description

x86 Local APIC register definitions and utility functions.

The xAPIC MMIO window is expected to be in its default location for the benefit of unpaged environments.

Definition in file apic.h.

Macro Definition Documentation

◆ APIC_ID

#define APIC_ID   0x020

Definition at line 19 of file apic.h.

◆ APIC_LVR

#define APIC_LVR   0x030

Definition at line 20 of file apic.h.

◆ APIC_SPIV

#define APIC_SPIV   0x0f0

Definition at line 21 of file apic.h.

◆ APIC_SPIV_APIC_ENABLED

#define APIC_SPIV_APIC_ENABLED   0x00100

Definition at line 22 of file apic.h.

◆ APIC_ICR

#define APIC_ICR   0x300

Definition at line 24 of file apic.h.

◆ APIC_DM_NMI

#define APIC_DM_NMI   0x00400

Definition at line 25 of file apic.h.

◆ APIC_ICR_BUSY

#define APIC_ICR_BUSY   0x01000

Definition at line 26 of file apic.h.

◆ APIC_DEST_SELF

#define APIC_DEST_SELF   0x40000

Definition at line 27 of file apic.h.

◆ APIC_ICR2

#define APIC_ICR2   0x310

Definition at line 29 of file apic.h.

◆ APIC_DEFAULT_BASE

#define APIC_DEFAULT_BASE   0xfee00000ul

Definition at line 31 of file apic.h.

Enumeration Type Documentation

◆ apic_mode

enum apic_mode
Enumerator
APIC_MODE_UNKNOWN 
APIC_MODE_NONE 
APIC_MODE_DISABLED 
APIC_MODE_XAPIC 
APIC_MODE_X2APIC 

Definition at line 35 of file apic.h.

Function Documentation

◆ apic_init()

int apic_init ( enum apic_mode  mode)

Discover and initialise the local APIC to the requested mode.

May fail if there is no APIC, or the requested mode is not available.

Definition at line 33 of file apic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apic_mmio_read()

static uint32_t apic_mmio_read ( unsigned int  reg)
inlinestatic

Definition at line 49 of file apic.h.

+ Here is the caller graph for this function:

◆ apic_mmio_write()

static void apic_mmio_write ( unsigned int  reg,
uint32_t  val 
)
inlinestatic

Definition at line 54 of file apic.h.

+ Here is the caller graph for this function:

◆ apic_mmio_icr_write()

static void apic_mmio_icr_write ( uint64_t  val)
inlinestatic

Definition at line 59 of file apic.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apic_msr_read()

static uint32_t apic_msr_read ( unsigned int  reg)
inlinestatic

Definition at line 65 of file apic.h.

+ Here is the caller graph for this function:

◆ apic_msr_write()

static void apic_msr_write ( unsigned int  reg,
uint32_t  val 
)
inlinestatic

Definition at line 75 of file apic.h.

+ Here is the caller graph for this function:

◆ apic_msr_icr_write()

static void apic_msr_icr_write ( uint64_t  val)
inlinestatic

Definition at line 82 of file apic.h.

+ Here is the caller graph for this function:

◆ apic_read()

static uint32_t apic_read ( unsigned int  reg)
inlinestatic

Definition at line 91 of file apic.h.

+ Here is the call graph for this function:

◆ apic_write()

static void apic_write ( unsigned int  reg,
uint32_t  val 
)
inlinestatic

Definition at line 99 of file apic.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apic_icr_write()

static void apic_icr_write ( uint64_t  val)
inlinestatic

Definition at line 107 of file apic.h.

+ Here is the call graph for this function:

Variable Documentation

◆ cur_apic_mode

enum apic_mode cur_apic_mode

Definition at line 13 of file apic.c.