ReactOS  0.4.14-dev-317-g96040ec
ioapic.h
Go to the documentation of this file.
1 /*
2  *
3  */
4 
5 #pragma once
6 
7 /* I/O APIC Register Address Map */
8 #define IOAPIC_IOREGSEL 0x0000 /* I/O Register Select (index) (R/W) */
9 #define IOAPIC_IOWIN 0x0010 /* I/O window (data) (R/W) */
10 
11 #define IOAPIC_ID 0x0000 /* IO APIC ID (R/W) */
12 #define IOAPIC_VER 0x0001 /* IO APIC Version (R) */
13 #define IOAPIC_ARB 0x0002 /* IO APIC Arbitration ID (R) */
14 #define IOAPIC_REDTBL 0x0010 /* Redirection Table (0-23 64-bit registers) (R/W) */
15 
16 #define IOAPIC_ID_MASK (0xF << 24)
17 #define GET_IOAPIC_ID(x) (((x) & IOAPIC_ID_MASK) >> 24)
18 #define SET_IOAPIC_ID(x) ((x) << 24)
19 
20 #define IOAPIC_VER_MASK (0xFF)
21 #define GET_IOAPIC_VERSION(x) (((x) & IOAPIC_VER_MASK))
22 #define IOAPIC_MRE_MASK (0xFF << 16) /* Maximum Redirection Entry */
23 #define GET_IOAPIC_MRE(x) (((x) & IOAPIC_MRE_MASK) >> 16)
24 
25 #define IOAPIC_ARB_MASK (0xF << 24)
26 #define GET_IOAPIC_ARB(x) (((x) & IOAPIC_ARB_MASK) >> 24)
27 
28 #define IOAPIC_TBL_DELMOD (0x7 << 10) /* Delivery Mode (see APIC_DM_*) */
29 #define IOAPIC_TBL_DM (0x1 << 11) /* Destination Mode */
30 #define IOAPIC_TBL_DS (0x1 << 12) /* Delivery Status */
31 #define IOAPIC_TBL_INTPOL (0x1 << 13) /* Interrupt Input Pin Polarity */
32 #define IOAPIC_TBL_RIRR (0x1 << 14) /* Remote IRR */
33 #define IOAPIC_TBL_TM (0x1 << 15) /* Trigger Mode */
34 #define IOAPIC_TBL_IM (0x1 << 16) /* Interrupt Mask */
35 #define IOAPIC_TBL_DF0 (0xF << 56) /* Destination Field (physical mode) */
36 #define IOAPIC_TBL_DF1 (0xFF<< 56) /* Destination Field (logical mode) */
37 #define IOAPIC_TBL_VECTOR (0xFF << 0) /* Vector (10h - FEh) */
38 
39 #include <pshpack1.h>
40 typedef struct _IOAPIC_ROUTE_ENTRY {
42  delivery_mode : 3, /* 000: FIXED
43  * 001: lowest priority
44  * 111: ExtINT
45  */
46  dest_mode : 1, /* 0: physical, 1: logical */
47  delivery_status : 1,
48  polarity : 1,
49  irr : 1,
50  trigger : 1, /* 0: edge, 1: level */
51  mask : 1, /* 0: enabled, 1: disabled */
52  __reserved_2 : 15;
53 
54  union {
55  struct {
57  physical_dest : 4,
58  __reserved_2 : 4;
59  } physical;
60  struct {
62  logical_dest : 8;
63  } logical;
64  } dest;
66 #include <poppack.h>
67 
68 typedef struct _IOAPIC_INFO
69 {
70  ULONG ApicId; /* APIC ID */
71  ULONG ApicVersion; /* APIC version */
72  ULONG ApicAddress; /* APIC address */
73  ULONG EntryCount; /* Number of redirection entries */
75 
76 #define IOAPIC_DEFAULT_BASE 0xFEC00000 /* Default I/O APIC Base Register Address */
77 
78 extern ULONG IRQCount; /* Number of IRQs */
79 extern UCHAR BUSMap[MAX_BUS]; /* Map of all buses in the system */
80 extern UCHAR PCIBUSMap[MAX_BUS]; /* Map of all PCI buses in the system */
81 extern IOAPIC_INFO IOAPICMap[MAX_IOAPIC]; /* Map of all I/O APICs in the system */
82 extern ULONG IOAPICCount; /* Number of I/O APICs in the system */
83 extern ULONG APICMode; /* APIC mode at startup */
84 extern MP_CONFIGURATION_INTSRC IRQMap[MAX_IRQ_SOURCE]; /* Map of all IRQs */
85 
91 
93 
94 /* For debugging */
96 
97 /* EOF */
struct _IOAPIC_ROUTE_ENTRY::@1429::@1431 logical
ULONG EntryCount
Definition: ioapic.h:73
VOID IOAPICSetupIrqs(VOID)
Definition: ioapic.c:296
#define MAX_BUS
Definition: mps.h:109
struct _IOAPIC_INFO IOAPIC_INFO
ULONG physical_dest
Definition: ioapic.h:56
#define MAX_IRQ_SOURCE
Definition: mps.h:161
VOID IOAPICMaskIrq(ULONG Irq)
Definition: ioapic.c:497
VOID IOAPICDump(VOID)
Definition: ioapic.c:527
struct _IOAPIC_ROUTE_ENTRY IOAPIC_ROUTE_ENTRY
struct _IOAPIC_ROUTE_ENTRY::@1429::@1430 physical
ULONG ApicAddress
Definition: ioapic.h:72
VOID IOAPICEnable(VOID)
Definition: ioapic.c:409
ULONG __reserved_1
Definition: ioapic.h:56
ULONG irr
Definition: ioapic.h:41
ULONG __reserved_2
Definition: ioapic.h:41
ULONG trigger
Definition: ioapic.h:41
ULONG dest_mode
Definition: ioapic.h:41
ULONG IRQCount
Definition: ioapic.c:18
Definition: ioapic.h:40
UCHAR BUSMap[MAX_BUS]
Definition: ioapic.c:21
VOID HaliReconfigurePciInterrupts(VOID)
Definition: ioapic.c:637
ULONG logical_dest
Definition: ioapic.h:61
ULONG ApicVersion
Definition: ioapic.h:71
union _IOAPIC_ROUTE_ENTRY::@1429 dest
struct _IOAPIC_ROUTE_ENTRY * PIOAPIC_ROUTE_ENTRY
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR PCIBUSMap[MAX_BUS]
Definition: ioapic.c:22
ULONG vector
Definition: ioapic.h:41
struct _IOAPIC_INFO * PIOAPIC_INFO
ULONG APICMode
Definition: apic.c:49
IOAPIC_INFO IOAPICMap[MAX_IOAPIC]
Definition: ioapic.c:24
ULONG IOAPICCount
Definition: ioapic.c:25
MP_CONFIGURATION_INTSRC IRQMap[MAX_IRQ_SOURCE]
Definition: ioapic.c:17
VOID IOAPICUnmaskIrq(ULONG Irq)
Definition: ioapic.c:514
ULONG polarity
Definition: ioapic.h:41
#define MAX_IOAPIC
Definition: mps.h:145
unsigned int ULONG
Definition: retypes.h:1
ULONG ApicId
Definition: ioapic.h:70
ULONG delivery_status
Definition: ioapic.h:41
ULONG delivery_mode
Definition: ioapic.h:41
ULONG mask
Definition: ioapic.h:41
VOID IOAPICSetupIds(VOID)
Definition: ioapic.c:432