Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenapic.h
Go to the documentation of this file.
00001 00002 #ifdef _M_AMD64 00003 #define IOAPIC_BASE 0xFFFFFFFFFFFE1000ULL // checkme 00004 #define ZERO_VECTOR 0x00 // IRQL 00 00005 #define APC_VECTOR 0x3D // IRQL 01 00006 #define APIC_SPURIOUS_VECTOR 0x3f 00007 #define DISPATCH_VECTOR 0x41 // IRQL 02 00008 #define APIC_GENERIC_VECTOR 0xC1 // IRQL 27 00009 #define APIC_CLOCK_VECTOR 0xD1 // IRQL 28 00010 #define APIC_SYNCH_VECTOR 0xD1 // IRQL 28 00011 #define APIC_IPI_VECTOR 0xE1 // IRQL 29 00012 #define APIC_ERROR_VECTOR 0xE3 00013 #define POWERFAIL_VECTOR 0xEF // IRQL 30 00014 #define APIC_PROFILE_VECTOR 0xFD // IRQL 31 00015 #define APIC_NMI_VECTOR 0xFF 00016 #define IrqlToTpr(Irql) (Irql << 4) 00017 #define IrqlToSoftVector(Irql) ((Irql << 4)|0xf) 00018 #define TprToIrql(Tpr) ((KIRQL)(Tpr >> 4)) 00019 #define CLOCK2_LEVEL CLOCK_LEVEL 00020 #else 00021 #define IOAPIC_BASE 0xFFFE1000 // checkme 00022 #define ZERO_VECTOR 0x00 // IRQL 00 00023 #define APIC_SPURIOUS_VECTOR 0x1f 00024 #define APC_VECTOR 0x3D // IRQL 01 00025 #define DISPATCH_VECTOR 0x41 // IRQL 02 00026 #define APIC_GENERIC_VECTOR 0xC1 // IRQL 27 00027 #define APIC_CLOCK_VECTOR 0xD1 // IRQL 28 00028 #define APIC_SYNCH_VECTOR 0xD1 // IRQL 28 00029 #define APIC_IPI_VECTOR 0xE1 // IRQL 29 00030 #define APIC_ERROR_VECTOR 0xE3 00031 #define POWERFAIL_VECTOR 0xEF // IRQL 30 00032 #define APIC_PROFILE_VECTOR 0xFD // IRQL 31 00033 #define APIC_NMI_VECTOR 0xFF 00034 #define IrqlToTpr(Irql) (HalpIRQLtoTPR[Irql]) 00035 #define IrqlToSoftVector(Irql) IrqlToTpr(Irql) 00036 #define TprToIrql(Tpr) (HalVectorToIRQL[Tpr >> 4]) 00037 #endif 00038 00039 #define MSR_APIC_BASE 0x0000001B 00040 #define IOAPIC_PHYS_BASE 0xFEC00000 00041 #define APIC_CLOCK_INDEX 8 00042 00043 #define ApicLogicalId(Cpu) ((UCHAR)(1<< Cpu)) 00044 00045 /* APIC Register Address Map */ 00046 #define APIC_ID 0x0020 /* Local APIC ID Register (R/W) */ 00047 #define APIC_VER 0x0030 /* Local APIC Version Register (R) */ 00048 #define APIC_TPR 0x0080 /* Task Priority Register (R/W) */ 00049 #define APIC_APR 0x0090 /* Arbitration Priority Register (R) */ 00050 #define APIC_PPR 0x00A0 /* Processor Priority Register (R) */ 00051 #define APIC_EOI 0x00B0 /* EOI Register (W) */ 00052 #define APIC_RRR 0x00C0 /* Remote Read Register () */ 00053 #define APIC_LDR 0x00D0 /* Logical Destination Register (R/W) */ 00054 #define APIC_DFR 0x00E0 /* Destination Format Register (0-27 R, 28-31 R/W) */ 00055 #define APIC_SIVR 0x00F0 /* Spurious Interrupt Vector Register (0-3 R, 4-9 R/W) */ 00056 #define APIC_ISR 0x0100 /* Interrupt Service Register 0-255 (R) */ 00057 #define APIC_TMR 0x0180 /* Trigger Mode Register 0-255 (R) */ 00058 #define APIC_IRR 0x0200 /* Interrupt Request Register 0-255 (r) */ 00059 #define APIC_ESR 0x0280 /* Error Status Register (R) */ 00060 #define APIC_ICR0 0x0300 /* Interrupt Command Register 0-31 (R/W) */ 00061 #define APIC_ICR1 0x0310 /* Interrupt Command Register 32-63 (R/W) */ 00062 #define APIC_TMRLVTR 0x0320 /* Timer Local Vector Table (R/W) */ 00063 #define APIC_THRMLVTR 0x0330 /* Thermal Local Vector Table */ 00064 #define APIC_PCLVTR 0x0340 /* Performance Counter Local Vector Table (R/W) */ 00065 #define APIC_LINT0 0x0350 /* LINT0 Local Vector Table (R/W) */ 00066 #define APIC_LINT1 0x0360 /* LINT1 Local Vector Table (R/W) */ 00067 #define APIC_ERRLVTR 0x0370 /* Error Local Vector Table (R/W) */ 00068 #define APIC_TICR 0x0380 /* Initial Count Register for Timer (R/W) */ 00069 #define APIC_TCCR 0x0390 /* Current Count Register for Timer (R) */ 00070 #define APIC_TDCR 0x03E0 /* Timer Divide Configuration Register (R/W) */ 00071 #define APIC_EAFR 0x0400 /* extended APIC Feature register (R/W) */ 00072 #define APIC_EACR 0x0410 /* Extended APIC Control Register (R/W) */ 00073 #define APIC_SEOI 0x0420 /* Specific End Of Interrupt Register (W) */ 00074 #define APIC_EXT0LVTR 0x0500 /* Extended Interrupt 0 Local Vector Table */ 00075 #define APIC_EXT1LVTR 0x0510 /* Extended Interrupt 1 Local Vector Table */ 00076 #define APIC_EXT2LVTR 0x0520 /* Extended Interrupt 2 Local Vector Table */ 00077 #define APIC_EXT3LVTR 0x0530 /* Extended Interrupt 3 Local Vector Table */ 00078 00079 enum 00080 { 00081 APIC_MT_Fixed = 0, 00082 APIC_MT_LowestPriority = 1, 00083 APIC_MT_SMI = 2, 00084 APIC_MT_RemoteRead = 3, 00085 APIC_MT_NMI = 4, 00086 APIC_MT_INIT = 5, 00087 APIC_MT_Startup = 6, 00088 APIC_MT_ExtInt = 7, 00089 }; 00090 00091 enum 00092 { 00093 APIC_TGM_Edge, 00094 APIC_TGM_Level 00095 }; 00096 00097 enum 00098 { 00099 APIC_DM_Physical, 00100 APIC_DM_Logical 00101 }; 00102 00103 enum 00104 { 00105 APIC_DSH_Destination, 00106 APIC_DSH_Self, 00107 APIC_DSH_AllIncludingSelf, 00108 APIC_DSH_AllExclusingSelf 00109 }; 00110 00111 enum 00112 { 00113 APIC_DF_Flat = 0xFFFFFFFF, 00114 APIC_DF_Cluster = 0x0FFFFFFF 00115 }; 00116 00117 enum 00118 { 00119 TIMER_DV_DivideBy2 = 0, 00120 TIMER_DV_DivideBy4 = 1, 00121 TIMER_DV_DivideBy8 = 2, 00122 TIMER_DV_DivideBy16 = 3, 00123 TIMER_DV_DivideBy32 = 8, 00124 TIMER_DV_DivideBy64 = 9, 00125 TIMER_DV_DivideBy128 = 10, 00126 TIMER_DV_DivideBy1 = 11, 00127 }; 00128 00129 00130 typedef union _APIC_BASE_ADRESS_REGISTER 00131 { 00132 ULONG64 Long; 00133 struct 00134 { 00135 ULONG64 Reserved1:8; 00136 ULONG64 BootStrapCPUCore:1; 00137 ULONG64 Reserved2:2; 00138 ULONG64 Enable:1; 00139 ULONG64 BaseAddress:40; 00140 ULONG64 ReservedMBZ:12; 00141 }; 00142 } APIC_BASE_ADRESS_REGISTER; 00143 00144 typedef union _APIC_SPURIOUS_INERRUPT_REGISTER 00145 { 00146 ULONG Long; 00147 struct 00148 { 00149 ULONG Vector:8; 00150 ULONG SoftwareEnable:1; 00151 ULONG FocusCPUCoreChecking:1; 00152 ULONG ReservedMBZ:22; 00153 }; 00154 } APIC_SPURIOUS_INERRUPT_REGISTER; 00155 00156 typedef union 00157 { 00158 ULONG Long; 00159 struct 00160 { 00161 ULONG Version:8; 00162 ULONG ReservedMBZ:8; 00163 ULONG MaxLVT:8; 00164 ULONG ReservedMBZ1:7; 00165 ULONG ExtRegSpacePresent:1; 00166 }; 00167 } APIC_VERSION_REGISTER; 00168 00169 typedef union 00170 { 00171 ULONG Long; 00172 struct 00173 { 00174 ULONG Version:1; 00175 ULONG SEOIEnable:1; 00176 ULONG ExtApicIdEnable:1; 00177 ULONG ReservedMBZ:29; 00178 }; 00179 } APIC_EXTENDED_CONTROL_REGISTER; 00180 00181 typedef union _APIC_COMMAND_REGISTER 00182 { 00183 ULONGLONG LongLong; 00184 struct 00185 { 00186 ULONG Long0; 00187 ULONG Long1; 00188 }; 00189 struct 00190 { 00191 ULONGLONG Vector:8; 00192 ULONGLONG MessageType:3; 00193 ULONGLONG DestinationMode:1; 00194 ULONGLONG DeliveryStatus:1; 00195 ULONGLONG ReservedMBZ:1; 00196 ULONGLONG Level:1; 00197 ULONGLONG TriggerMode:1; 00198 ULONGLONG RemoteReadStatus:2; 00199 ULONGLONG DestinationShortHand:2; 00200 ULONGLONG Reserved2MBZ:36; 00201 ULONGLONG Destination:8; 00202 }; 00203 } APIC_COMMAND_REGISTER; 00204 00205 typedef union 00206 { 00207 ULONG Long; 00208 struct 00209 { 00210 ULONG Vector:8; 00211 ULONG MessageType:3; 00212 ULONG ReservedMBZ:1; 00213 ULONG DeliveryStatus:1; 00214 ULONG Reserved1MBZ:1; 00215 ULONG RemoteIRR:1; 00216 ULONG TriggerMode:1; 00217 ULONG Mask:1; 00218 ULONG TimerMode:1; 00219 ULONG Reserved2MBZ:13; 00220 }; 00221 } LVT_REGISTER; 00222 00223 00224 enum 00225 { 00226 IOAPIC_IOREGSEL = 0x00, 00227 IOAPIC_IOWIN = 0x10 00228 }; 00229 00230 enum 00231 { 00232 IOAPIC_ID = 0x00, 00233 IOAPIC_VER = 0x01, 00234 IOAPIC_ARB = 0x02, 00235 IOAPIC_REDTBL = 0x10 00236 }; 00237 00238 typedef union _IOAPIC_REDIRECTION_REGISTER 00239 { 00240 ULONGLONG LongLong; 00241 struct 00242 { 00243 ULONG Long0; 00244 ULONG Long1; 00245 }; 00246 struct 00247 { 00248 ULONGLONG Vector:8; 00249 ULONGLONG DeliveryMode:3; 00250 ULONGLONG DestinationMode:1; 00251 ULONGLONG DeliveryStatus:1; 00252 ULONGLONG Polarity:1; 00253 ULONGLONG RemoteIRR:1; 00254 ULONGLONG TriggerMode:1; 00255 ULONGLONG Mask:1; 00256 ULONGLONG Reserved:39; 00257 ULONGLONG Destination:8; 00258 }; 00259 } IOAPIC_REDIRECTION_REGISTER; 00260 00261 ULONG 00262 FORCEINLINE 00263 ApicRead(ULONG Offset) 00264 { 00265 return *(volatile ULONG *)(APIC_BASE + Offset); 00266 } 00267 00268 VOID 00269 FORCEINLINE 00270 ApicWrite(ULONG Offset, ULONG Value) 00271 { 00272 *(volatile ULONG *)(APIC_BASE + Offset) = Value; 00273 } 00274 00275 VOID 00276 NTAPI 00277 ApicInitializeTimer(ULONG Cpu); 00278 00279 VOID ApicSpuriousService(VOID); 00280 Generated on Sat May 26 2012 04:27:17 for ReactOS by
1.7.6.1
|