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_ESR   0x280
 
#define APIC_SIV   0x00020 /* Send Illegal Vector */
 
#define APIC_RIV   0x00040 /* Recieve Illegal Vector */
 
#define APIC_ICR   0x300
 
#define APIC_DM_FIXED   0x00000
 
#define APIC_DM_NMI   0x00400
 
#define APIC_ICR_BUSY   0x01000
 
#define APIC_DEST_SELF   0x40000
 
#define APIC_ICR2   0x310
 
#define APIC_LVTERR   0x370
 
#define APIC_DEFAULT_BASE   0xfee00000ul
 
#define TEST_APIC_MODE   0
 
#define CUR_APIC_MODE   (TEST_APIC_MODE ?: cur_apic_mode)
 

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_ESR

#define APIC_ESR   0x280

Definition at line 24 of file apic.h.

◆ APIC_SIV

#define APIC_SIV   0x00020 /* Send Illegal Vector */

Definition at line 25 of file apic.h.

◆ APIC_RIV

#define APIC_RIV   0x00040 /* Recieve Illegal Vector */

Definition at line 26 of file apic.h.

◆ APIC_ICR

#define APIC_ICR   0x300

Definition at line 28 of file apic.h.

◆ APIC_DM_FIXED

#define APIC_DM_FIXED   0x00000

Definition at line 29 of file apic.h.

◆ APIC_DM_NMI

#define APIC_DM_NMI   0x00400

Definition at line 30 of file apic.h.

◆ APIC_ICR_BUSY

#define APIC_ICR_BUSY   0x01000

Definition at line 31 of file apic.h.

◆ APIC_DEST_SELF

#define APIC_DEST_SELF   0x40000

Definition at line 32 of file apic.h.

◆ APIC_ICR2

#define APIC_ICR2   0x310

Definition at line 34 of file apic.h.

◆ APIC_LVTERR

#define APIC_LVTERR   0x370

Definition at line 35 of file apic.h.

◆ APIC_DEFAULT_BASE

#define APIC_DEFAULT_BASE   0xfee00000ul

Definition at line 37 of file apic.h.

◆ TEST_APIC_MODE

#define TEST_APIC_MODE   0

Definition at line 101 of file apic.h.

◆ CUR_APIC_MODE

#define CUR_APIC_MODE   (TEST_APIC_MODE ?: cur_apic_mode)

Definition at line 103 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 41 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 55 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 60 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 65 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 71 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 81 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 88 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 105 of file apic.h.

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

◆ apic_write()

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

Definition at line 113 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 121 of file apic.h.

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

Variable Documentation

◆ cur_apic_mode

enum apic_mode cur_apic_mode
extern

Definition at line 13 of file apic.c.