ReactOS  0.4.14-dev-593-g1793dcc
apic.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  _APIC_BASE_ADRESS_REGISTER
 
union  _APIC_SPURIOUS_INERRUPT_REGISTER
 
union  APIC_VERSION_REGISTER
 
union  APIC_EXTENDED_CONTROL_REGISTER
 
union  _APIC_COMMAND_REGISTER
 
union  LVT_REGISTER
 
union  _IOAPIC_REDIRECTION_REGISTER
 

Macros

#define IOAPIC_BASE   0xFFFE1000
 
#define ZERO_VECTOR   0x00
 
#define APIC_SPURIOUS_VECTOR   0x1f
 
#define APC_VECTOR   0x3D
 
#define DISPATCH_VECTOR   0x41
 
#define APIC_GENERIC_VECTOR   0xC1
 
#define APIC_CLOCK_VECTOR   0xD1
 
#define APIC_SYNCH_VECTOR   0xD1
 
#define APIC_IPI_VECTOR   0xE1
 
#define APIC_ERROR_VECTOR   0xE3
 
#define POWERFAIL_VECTOR   0xEF
 
#define APIC_PROFILE_VECTOR   0xFD
 
#define APIC_NMI_VECTOR   0xFF
 
#define IrqlToTpr(Irql)   (HalpIRQLtoTPR[Irql])
 
#define IrqlToSoftVector(Irql)   IrqlToTpr(Irql)
 
#define TprToIrql(Tpr)   (HalVectorToIRQL[Tpr >> 4])
 
#define MSR_APIC_BASE   0x0000001B
 
#define IOAPIC_PHYS_BASE   0xFEC00000
 
#define APIC_CLOCK_INDEX   8
 
#define ApicLogicalId(Cpu)   ((UCHAR)(1<< Cpu))
 
#define APIC_ID   0x0020 /* Local APIC ID Register (R/W) */
 
#define APIC_VER   0x0030 /* Local APIC Version Register (R) */
 
#define APIC_TPR   0x0080 /* Task Priority Register (R/W) */
 
#define APIC_APR   0x0090 /* Arbitration Priority Register (R) */
 
#define APIC_PPR   0x00A0 /* Processor Priority Register (R) */
 
#define APIC_EOI   0x00B0 /* EOI Register (W) */
 
#define APIC_RRR   0x00C0 /* Remote Read Register () */
 
#define APIC_LDR   0x00D0 /* Logical Destination Register (R/W) */
 
#define APIC_DFR   0x00E0 /* Destination Format Register (0-27 R, 28-31 R/W) */
 
#define APIC_SIVR   0x00F0 /* Spurious Interrupt Vector Register (0-3 R, 4-9 R/W) */
 
#define APIC_ISR   0x0100 /* Interrupt Service Register 0-255 (R) */
 
#define APIC_TMR   0x0180 /* Trigger Mode Register 0-255 (R) */
 
#define APIC_IRR   0x0200 /* Interrupt Request Register 0-255 (r) */
 
#define APIC_ESR   0x0280 /* Error Status Register (R) */
 
#define APIC_ICR0   0x0300 /* Interrupt Command Register 0-31 (R/W) */
 
#define APIC_ICR1   0x0310 /* Interrupt Command Register 32-63 (R/W) */
 
#define APIC_TMRLVTR   0x0320 /* Timer Local Vector Table (R/W) */
 
#define APIC_THRMLVTR   0x0330 /* Thermal Local Vector Table */
 
#define APIC_PCLVTR   0x0340 /* Performance Counter Local Vector Table (R/W) */
 
#define APIC_LINT0   0x0350 /* LINT0 Local Vector Table (R/W) */
 
#define APIC_LINT1   0x0360 /* LINT1 Local Vector Table (R/W) */
 
#define APIC_ERRLVTR   0x0370 /* Error Local Vector Table (R/W) */
 
#define APIC_TICR   0x0380 /* Initial Count Register for Timer (R/W) */
 
#define APIC_TCCR   0x0390 /* Current Count Register for Timer (R) */
 
#define APIC_TDCR   0x03E0 /* Timer Divide Configuration Register (R/W) */
 
#define APIC_EAFR   0x0400 /* extended APIC Feature register (R/W) */
 
#define APIC_EACR   0x0410 /* Extended APIC Control Register (R/W) */
 
#define APIC_SEOI   0x0420 /* Specific End Of Interrupt Register (W) */
 
#define APIC_EXT0LVTR   0x0500 /* Extended Interrupt 0 Local Vector Table */
 
#define APIC_EXT1LVTR   0x0510 /* Extended Interrupt 1 Local Vector Table */
 
#define APIC_EXT2LVTR   0x0520 /* Extended Interrupt 2 Local Vector Table */
 
#define APIC_EXT3LVTR   0x0530 /* Extended Interrupt 3 Local Vector Table */
 

Typedefs

typedef union _APIC_BASE_ADRESS_REGISTER APIC_BASE_ADRESS_REGISTER
 
typedef union _APIC_SPURIOUS_INERRUPT_REGISTER APIC_SPURIOUS_INERRUPT_REGISTER
 
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER
 
typedef union _IOAPIC_REDIRECTION_REGISTER IOAPIC_REDIRECTION_REGISTER
 

Enumerations

enum  {
  APIC_MT_Fixed = 0, APIC_MT_LowestPriority = 1, APIC_MT_SMI = 2, APIC_MT_RemoteRead = 3,
  APIC_MT_NMI = 4, APIC_MT_INIT = 5, APIC_MT_Startup = 6, APIC_MT_ExtInt = 7
}
 
enum  { APIC_TGM_Edge, APIC_TGM_Level }
 
enum  { APIC_DM_Physical, APIC_DM_Logical }
 
enum  { APIC_DSH_Destination, APIC_DSH_Self, APIC_DSH_AllIncludingSelf, APIC_DSH_AllExclusingSelf }
 
enum  { APIC_DF_Flat = 0xFFFFFFFF, APIC_DF_Cluster = 0x0FFFFFFF }
 
enum  {
  TIMER_DV_DivideBy2 = 0, TIMER_DV_DivideBy4 = 1, TIMER_DV_DivideBy8 = 2, TIMER_DV_DivideBy16 = 3,
  TIMER_DV_DivideBy32 = 8, TIMER_DV_DivideBy64 = 9, TIMER_DV_DivideBy128 = 10, TIMER_DV_DivideBy1 = 11
}
 
enum  { IOAPIC_IOREGSEL = 0x00, IOAPIC_IOWIN = 0x10 }
 
enum  { IOAPIC_ID = 0x00, IOAPIC_VER = 0x01, IOAPIC_ARB = 0x02, IOAPIC_REDTBL = 0x10 }
 

Functions

FORCEINLINE ULONG ApicRead (ULONG Offset)
 
FORCEINLINE VOID ApicWrite (ULONG Offset, ULONG Value)
 
VOID NTAPI ApicInitializeTimer (ULONG Cpu)
 
VOID NTAPI HalInitializeProfiling (VOID)
 
VOID __cdecl ApicSpuriousService (VOID)
 

Macro Definition Documentation

◆ APC_VECTOR

#define APC_VECTOR   0x3D

Definition at line 26 of file apic.h.

◆ APIC_APR

#define APIC_APR   0x0090 /* Arbitration Priority Register (R) */

Definition at line 51 of file apic.h.

◆ APIC_CLOCK_INDEX

#define APIC_CLOCK_INDEX   8

Definition at line 43 of file apic.h.

◆ APIC_CLOCK_VECTOR

#define APIC_CLOCK_VECTOR   0xD1

Definition at line 29 of file apic.h.

◆ APIC_DFR

#define APIC_DFR   0x00E0 /* Destination Format Register (0-27 R, 28-31 R/W) */

Definition at line 56 of file apic.h.

◆ APIC_EACR

#define APIC_EACR   0x0410 /* Extended APIC Control Register (R/W) */

Definition at line 74 of file apic.h.

◆ APIC_EAFR

#define APIC_EAFR   0x0400 /* extended APIC Feature register (R/W) */

Definition at line 73 of file apic.h.

◆ APIC_EOI

#define APIC_EOI   0x00B0 /* EOI Register (W) */

Definition at line 53 of file apic.h.

◆ APIC_ERRLVTR

#define APIC_ERRLVTR   0x0370 /* Error Local Vector Table (R/W) */

Definition at line 69 of file apic.h.

◆ APIC_ERROR_VECTOR

#define APIC_ERROR_VECTOR   0xE3

Definition at line 32 of file apic.h.

◆ APIC_ESR

#define APIC_ESR   0x0280 /* Error Status Register (R) */

Definition at line 61 of file apic.h.

◆ APIC_EXT0LVTR

#define APIC_EXT0LVTR   0x0500 /* Extended Interrupt 0 Local Vector Table */

Definition at line 76 of file apic.h.

◆ APIC_EXT1LVTR

#define APIC_EXT1LVTR   0x0510 /* Extended Interrupt 1 Local Vector Table */

Definition at line 77 of file apic.h.

◆ APIC_EXT2LVTR

#define APIC_EXT2LVTR   0x0520 /* Extended Interrupt 2 Local Vector Table */

Definition at line 78 of file apic.h.

◆ APIC_EXT3LVTR

#define APIC_EXT3LVTR   0x0530 /* Extended Interrupt 3 Local Vector Table */

Definition at line 79 of file apic.h.

◆ APIC_GENERIC_VECTOR

#define APIC_GENERIC_VECTOR   0xC1

Definition at line 28 of file apic.h.

◆ APIC_ICR0

#define APIC_ICR0   0x0300 /* Interrupt Command Register 0-31 (R/W) */

Definition at line 62 of file apic.h.

◆ APIC_ICR1

#define APIC_ICR1   0x0310 /* Interrupt Command Register 32-63 (R/W) */

Definition at line 63 of file apic.h.

◆ APIC_ID

#define APIC_ID   0x0020 /* Local APIC ID Register (R/W) */

Definition at line 48 of file apic.h.

◆ APIC_IPI_VECTOR

#define APIC_IPI_VECTOR   0xE1

Definition at line 31 of file apic.h.

◆ APIC_IRR

#define APIC_IRR   0x0200 /* Interrupt Request Register 0-255 (r) */

Definition at line 60 of file apic.h.

◆ APIC_ISR

#define APIC_ISR   0x0100 /* Interrupt Service Register 0-255 (R) */

Definition at line 58 of file apic.h.

◆ APIC_LDR

#define APIC_LDR   0x00D0 /* Logical Destination Register (R/W) */

Definition at line 55 of file apic.h.

◆ APIC_LINT0

#define APIC_LINT0   0x0350 /* LINT0 Local Vector Table (R/W) */

Definition at line 67 of file apic.h.

◆ APIC_LINT1

#define APIC_LINT1   0x0360 /* LINT1 Local Vector Table (R/W) */

Definition at line 68 of file apic.h.

◆ APIC_NMI_VECTOR

#define APIC_NMI_VECTOR   0xFF

Definition at line 35 of file apic.h.

◆ APIC_PCLVTR

#define APIC_PCLVTR   0x0340 /* Performance Counter Local Vector Table (R/W) */

Definition at line 66 of file apic.h.

◆ APIC_PPR

#define APIC_PPR   0x00A0 /* Processor Priority Register (R) */

Definition at line 52 of file apic.h.

◆ APIC_PROFILE_VECTOR

#define APIC_PROFILE_VECTOR   0xFD

Definition at line 34 of file apic.h.

◆ APIC_RRR

#define APIC_RRR   0x00C0 /* Remote Read Register () */

Definition at line 54 of file apic.h.

◆ APIC_SEOI

#define APIC_SEOI   0x0420 /* Specific End Of Interrupt Register (W) */

Definition at line 75 of file apic.h.

◆ APIC_SIVR

#define APIC_SIVR   0x00F0 /* Spurious Interrupt Vector Register (0-3 R, 4-9 R/W) */

Definition at line 57 of file apic.h.

◆ APIC_SPURIOUS_VECTOR

#define APIC_SPURIOUS_VECTOR   0x1f

Definition at line 25 of file apic.h.

◆ APIC_SYNCH_VECTOR

#define APIC_SYNCH_VECTOR   0xD1

Definition at line 30 of file apic.h.

◆ APIC_TCCR

#define APIC_TCCR   0x0390 /* Current Count Register for Timer (R) */

Definition at line 71 of file apic.h.

◆ APIC_TDCR

#define APIC_TDCR   0x03E0 /* Timer Divide Configuration Register (R/W) */

Definition at line 72 of file apic.h.

◆ APIC_THRMLVTR

#define APIC_THRMLVTR   0x0330 /* Thermal Local Vector Table */

Definition at line 65 of file apic.h.

◆ APIC_TICR

#define APIC_TICR   0x0380 /* Initial Count Register for Timer (R/W) */

Definition at line 70 of file apic.h.

◆ APIC_TMR

#define APIC_TMR   0x0180 /* Trigger Mode Register 0-255 (R) */

Definition at line 59 of file apic.h.

◆ APIC_TMRLVTR

#define APIC_TMRLVTR   0x0320 /* Timer Local Vector Table (R/W) */

Definition at line 64 of file apic.h.

◆ APIC_TPR

#define APIC_TPR   0x0080 /* Task Priority Register (R/W) */

Definition at line 50 of file apic.h.

◆ APIC_VER

#define APIC_VER   0x0030 /* Local APIC Version Register (R) */

Definition at line 49 of file apic.h.

◆ ApicLogicalId

#define ApicLogicalId (   Cpu)    ((UCHAR)(1<< Cpu))

Definition at line 45 of file apic.h.

◆ DISPATCH_VECTOR

#define DISPATCH_VECTOR   0x41

Definition at line 27 of file apic.h.

◆ IOAPIC_BASE

#define IOAPIC_BASE   0xFFFE1000

Definition at line 23 of file apic.h.

◆ IOAPIC_PHYS_BASE

#define IOAPIC_PHYS_BASE   0xFEC00000

Definition at line 42 of file apic.h.

◆ IrqlToSoftVector

#define IrqlToSoftVector (   Irql)    IrqlToTpr(Irql)

Definition at line 37 of file apic.h.

◆ IrqlToTpr

#define IrqlToTpr (   Irql)    (HalpIRQLtoTPR[Irql])

Definition at line 36 of file apic.h.

◆ MSR_APIC_BASE

#define MSR_APIC_BASE   0x0000001B

Definition at line 41 of file apic.h.

◆ POWERFAIL_VECTOR

#define POWERFAIL_VECTOR   0xEF

Definition at line 33 of file apic.h.

◆ TprToIrql

#define TprToIrql (   Tpr)    (HalVectorToIRQL[Tpr >> 4])

Definition at line 38 of file apic.h.

◆ ZERO_VECTOR

#define ZERO_VECTOR   0x00

Definition at line 24 of file apic.h.

Typedef Documentation

◆ APIC_BASE_ADRESS_REGISTER

◆ APIC_COMMAND_REGISTER

◆ APIC_SPURIOUS_INERRUPT_REGISTER

◆ IOAPIC_REDIRECTION_REGISTER

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
APIC_MT_Fixed 
APIC_MT_LowestPriority 
APIC_MT_SMI 
APIC_MT_RemoteRead 
APIC_MT_NMI 
APIC_MT_INIT 
APIC_MT_Startup 
APIC_MT_ExtInt 

Definition at line 81 of file apic.h.

82 {
83  APIC_MT_Fixed = 0,
85  APIC_MT_SMI = 2,
87  APIC_MT_NMI = 4,
88  APIC_MT_INIT = 5,
89  APIC_MT_Startup = 6,
90  APIC_MT_ExtInt = 7,
91 };

◆ anonymous enum

anonymous enum
Enumerator
APIC_TGM_Edge 
APIC_TGM_Level 

Definition at line 93 of file apic.h.

94 {
97 };

◆ anonymous enum

anonymous enum
Enumerator
APIC_DM_Physical 
APIC_DM_Logical 

Definition at line 99 of file apic.h.

100 {
103 };

◆ anonymous enum

anonymous enum
Enumerator
APIC_DSH_Destination 
APIC_DSH_Self 
APIC_DSH_AllIncludingSelf 
APIC_DSH_AllExclusingSelf 

Definition at line 105 of file apic.h.

◆ anonymous enum

anonymous enum
Enumerator
APIC_DF_Flat 
APIC_DF_Cluster 

Definition at line 113 of file apic.h.

114 {
115  APIC_DF_Flat = 0xFFFFFFFF,
116  APIC_DF_Cluster = 0x0FFFFFFF
117 };

◆ anonymous enum

anonymous enum
Enumerator
TIMER_DV_DivideBy2 
TIMER_DV_DivideBy4 
TIMER_DV_DivideBy8 
TIMER_DV_DivideBy16 
TIMER_DV_DivideBy32 
TIMER_DV_DivideBy64 
TIMER_DV_DivideBy128 
TIMER_DV_DivideBy1 

Definition at line 119 of file apic.h.

◆ anonymous enum

anonymous enum
Enumerator
IOAPIC_IOREGSEL 
IOAPIC_IOWIN 

Definition at line 226 of file apic.h.

227 {
228  IOAPIC_IOREGSEL = 0x00,
229  IOAPIC_IOWIN = 0x10
230 };

◆ anonymous enum

anonymous enum
Enumerator
IOAPIC_ID 
IOAPIC_VER 
IOAPIC_ARB 
IOAPIC_REDTBL 

Definition at line 232 of file apic.h.

233 {
234  IOAPIC_ID = 0x00,
235  IOAPIC_VER = 0x01,
236  IOAPIC_ARB = 0x02,
237  IOAPIC_REDTBL = 0x10
238 };

Function Documentation

◆ ApicInitializeTimer()

VOID NTAPI ApicInitializeTimer ( ULONG  Cpu)

Definition at line 51 of file apictimer.c.

52 {
53 
54  /* Initialize the TSC */
55  //HalpInitializeTsc();
56 
57  /* Set clock multiplier to 1 */
59 
61 
62 // KeSetTimeIncrement
63 }
VOID NTAPI ApicSetTimerInterval(ULONG MicroSeconds)
Definition: apictimer.c:29
#define APIC_TDCR
Definition: apic.h:33
FORCEINLINE VOID ApicWrite(ULONG Offset, ULONG Value)
Definition: apic.h:272

◆ ApicRead()

FORCEINLINE ULONG ApicRead ( ULONG  Offset)

Definition at line 265 of file apic.h.

266 {
267  return *(volatile ULONG *)(APIC_BASE + Offset);
268 }
#define APIC_BASE
Definition: mboot.c:45
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned int ULONG
Definition: retypes.h:1

Referenced by ApicGetCurrentIrql(), ApicGetProcessorIrql(), ApicInitializeIOApic(), and ApicInitializeLocalApic().

◆ ApicSpuriousService()

VOID __cdecl ApicSpuriousService ( VOID  )

Referenced by ApicInitializeLocalApic().

◆ ApicWrite()

FORCEINLINE VOID ApicWrite ( ULONG  Offset,
ULONG  Value 
)

Definition at line 272 of file apic.h.

273 {
274  *(volatile ULONG *)(APIC_BASE + Offset) = Value;
275 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define APIC_BASE
Definition: mboot.c:45
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned int ULONG
Definition: retypes.h:1

Referenced by ApicInitializeLocalApic(), ApicInitializeTimer(), ApicLowerIrql(), ApicRequestInterrupt(), ApicSetIrql(), ApicSetTimerInterval(), HalBeginSystemInterrupt(), HalSetProfileInterval(), HalStartProfileInterrupt(), and HalStopProfileInterrupt().

◆ HalInitializeProfiling()

VOID NTAPI HalInitializeProfiling ( VOID  )

Definition at line 70 of file apictimer.c.

71 {
73  KeGetPcr()->HalReserved[HAL_PROFILING_MULTIPLIER] = 1; /* TODO: HACK */
74 }
#define KeGetPcr()
Definition: ke.h:25
ULONGLONG HalCurProfileInterval
Definition: apictimer.c:21
#define HAL_PROFILING_MULTIPLIER
Definition: halp.h:47
#define HAL_PROFILING_INTERVAL
Definition: halp.h:46

Referenced by HalpInitProcessor().