Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

475 lines
12 KiB

  1. ;/*
  2. ;++
  3. ;
  4. ; Copyright (c) 1992 Intel Corporation
  5. ; All rights reserved
  6. ;
  7. ; INTEL CORPORATION PROPRIETARY INFORMATION
  8. ;
  9. ; This software is supplied to Microsoft under the terms
  10. ; of a license agreement with Intel Corporation and may not be
  11. ; copied nor disclosed except in accordance with the terms
  12. ; of that agreement.
  13. ;
  14. ;
  15. ; Module Name:
  16. ;
  17. ; pcmp.inc
  18. ;
  19. ; Abstract:
  20. ;
  21. ; include file for PC+MP system.
  22. ;
  23. ; WARNING: This file is included by both ASM and C files.
  24. ;
  25. ; Author:
  26. ;
  27. ; Ron Mosgrove and Rajesh Shah (Intel) 30-July-1993
  28. ;
  29. ;--
  30. ;
  31. if 0 ; Begin C only code */
  32. #pragma pack(1)
  33. //
  34. // IMCR (Interrupt Mode Control Register) access definitions
  35. //
  36. #define ImcrDisableApic 0x00
  37. #define ImcrEnableApic 0x01
  38. #define ImcrRegPortAddr 0x22
  39. #if defined(NEC_98)
  40. #define ImcrDataPortAddr 0x700
  41. #else // defined(NEC_98)
  42. #define ImcrDataPortAddr 0x23
  43. #endif // defined(NEC_98)
  44. #define ImcrPort 0x70
  45. // Physical location where the Extended BIOS Data Area segment adress is stored
  46. #define EBDA_SEGMENT_PTR 0x40e
  47. #define BASE_MEM_PTR 0x413
  48. //
  49. // The PC+MP configuration table Possible Entry Types
  50. //
  51. #define ENTRY_PROCESSOR 0
  52. #define ENTRY_BUS 1
  53. #define ENTRY_IOAPIC 2
  54. #define ENTRY_INTI 3
  55. #define ENTRY_LINTI 4
  56. #define HEADER_SIZE 0x2c
  57. // Number of default configurations for PC+MP version 1.1
  58. #define NUM_DEFAULT_CONFIGS 7
  59. //
  60. // Processor Entry definitions
  61. //
  62. typedef struct _CPUIDENTIFIER {
  63. ULONG Stepping : 4;
  64. ULONG Model : 4;
  65. ULONG Family : 4;
  66. ULONG Reserved : 20;
  67. } CPUIDENTIFIER, *PCPUIDENTIFIER;
  68. //
  69. // Bits used in the CpuFlags field of the Processor entry
  70. //
  71. #define CPU_DISABLED 0x0 // 1 Bit - CPU Disabled
  72. #define CPU_ENABLED 0x1 // 1 Bit - CPU Enabled
  73. #define BSP_CPU 0x2 // Bit #2 - CPU is BSP
  74. //
  75. // APIC Versions used by PC+MP systems - this is used in the
  76. // Processor entries and the IoApic Entries
  77. //
  78. #define APIC_INTEGRATED 0x10 // 8 Bits-Apic Version Register
  79. #define APIC_82489DX 0x0 // 8 Bits-Apic Version Register
  80. typedef struct _PcMpProcessorEntry {
  81. UCHAR EntryType;
  82. UCHAR LocalApicId;
  83. UCHAR LocalApicVersion;
  84. UCHAR CpuFlags;
  85. CPUIDENTIFIER CpuIdentification; // CPU Identification
  86. ULONG FeatureFlags;
  87. UCHAR Reserved[8];
  88. } PCMPPROCESSOR , *PPCMPPROCESSOR;
  89. //
  90. // Bus Entry definitions
  91. //
  92. typedef struct _PcMpBusEntry {
  93. UCHAR EntryType;
  94. UCHAR BusId;
  95. CHAR BusType[6];
  96. } PCMPBUS, *PPCMPBUS;
  97. //
  98. // Io Apic Entry definitions
  99. //
  100. // Valid IoApicFlag values
  101. //
  102. #define IO_APIC_ENABLED 0x1
  103. #define IO_APIC_DISABLED 0x0
  104. //
  105. // Default value for Io Apic ID.
  106. //
  107. #define IOUNIT_APIC_ID 0xE
  108. typedef struct _PcMpIoApicEntry {
  109. UCHAR EntryType;
  110. UCHAR IoApicId;
  111. UCHAR IoApicVersion;
  112. UCHAR IoApicFlag;
  113. PVOID IoApicAddress;
  114. } PCMPIOAPIC, *PPCMPIOAPIC;
  115. //
  116. // Bits that define the Interrupt logically
  117. //
  118. typedef struct _PolarityAndLevel {
  119. USHORT Polarity : 2;
  120. USHORT Level : 2;
  121. USHORT Reserved : 12;
  122. } POLARITYANDLEVEL, *PPOLARITYANDLEVEL;
  123. typedef struct _PcMpApicIntiEntry {
  124. UCHAR EntryType;
  125. UCHAR IntType;
  126. POLARITYANDLEVEL Signal;
  127. UCHAR SourceBusId;
  128. UCHAR SourceBusIrq;
  129. UCHAR IoApicId;
  130. UCHAR IoApicInti;
  131. } PCMPINTI, *PPCMPINTI;
  132. //
  133. // Local Apic Interrupt Entry definitions
  134. //
  135. typedef struct _PcMpLintiEntry {
  136. UCHAR EntryType;
  137. UCHAR IntType;
  138. POLARITYANDLEVEL Signal;
  139. UCHAR SourceBusId;
  140. UCHAR SourceBusIrq;
  141. UCHAR DestLocalApicId;
  142. UCHAR DestLocalApicInti;
  143. } PCMPLINTI, *PPCMPLINTI;
  144. //
  145. // The PC+MP table definition
  146. //
  147. struct PcMpTable {
  148. //
  149. // PC+MP config table HEADER part (HEADER_SIZE bytes long)
  150. //
  151. ULONG Signature; // Must contain "P","C","M","P"
  152. USHORT TableLength; // Length including the header
  153. UCHAR Revision; // Rev 1.0 == 1
  154. UCHAR Checksum; // Entire table including checksum byte
  155. CHAR OemId[8]; // OEM defined
  156. CHAR OemProductId[12]; // OEM defined
  157. PVOID OemTablePtr; // OEM specific data
  158. USHORT OemTableSize; // length in bytes of the OEM table
  159. USHORT NumOfEntries; // Number of entries in the data portion
  160. PVOID LocalApicAddress; // Physical address of Local units
  161. USHORT ExtTableLength; // Extension table size
  162. UCHAR ExtTableChecksum; // Complete checksum including extension table
  163. UCHAR Reserved; // Not Used
  164. };
  165. //
  166. // PC+MP Signature used to verify the PC+MP table
  167. // as valid
  168. //
  169. // "P"=50H,"C"=43H,"M"=4dH,"P"=50H
  170. //
  171. #define PCMP_SIGNATURE 0x504d4350
  172. //
  173. // PC+MP Signature used to identify the floating pointer
  174. // structure (in extended BIOS data segment) that contains
  175. // a pointer to the PC+MP table.
  176. //
  177. // "_"=5fH, "M"=4dH, "P"=50H, "_"=5fH
  178. //
  179. #define MP_PTR_SIGNATURE 0x5f504d5f
  180. //
  181. // This is the floating pointer structure
  182. //
  183. // For PC+MP version 1.0
  184. struct PcMpTableLocator {
  185. ULONG MpPtrSignature; // Must be "_MP_" (0x5f504d5f)
  186. PUCHAR TablePtr; // ptr to the PC+MP Table
  187. UCHAR MpTableLength; // Floating pointer structure length
  188. UCHAR TableRevision; // Rev 1.0 == 1
  189. UCHAR TableChecksum; // Checksum of PcMpTableLocator
  190. UCHAR Pad;
  191. ULONG Reserved;
  192. };
  193. struct FloatPtrStruct {
  194. ULONG MpPtrSignature; // Must be "_MP_" (0x5f504d5f)
  195. PUCHAR TablePtr; // ptr to the PC+MP Table
  196. UCHAR MpTableLength; // Floating pointer structure length
  197. UCHAR TableRevision; // Rev 1.0 == 1
  198. UCHAR TableChecksum; // Checksum of PcMpTableLocator
  199. UCHAR MpFeatureInfoByte1; // MP feature info. byte 1
  200. UCHAR MpFeatureInfoByte2; // MP feature info. byte 2
  201. UCHAR Pad;
  202. USHORT Reserved;
  203. };
  204. //
  205. // Extension table definitions
  206. //
  207. #define EXTTYPE_BUS_ADDRESS_MAP 128
  208. #define EXTTYPE_BUS_HIERARCHY 129
  209. #define EXTTYPE_BUS_COMPATIBLE_MAP 130
  210. #define EXTTYPE_PERSISTENT_STORE 131
  211. typedef struct {
  212. UCHAR Type;
  213. UCHAR Length;
  214. union {
  215. struct {
  216. UCHAR BusId;
  217. UCHAR Type;
  218. LONGLONG Base;
  219. LONGLONG Length;
  220. } AddressMap;
  221. struct {
  222. UCHAR BusId;
  223. UCHAR SubtractiveDecode:1;
  224. UCHAR ParentBusId;
  225. } BusHierarchy;
  226. struct {
  227. LONGLONG Address;
  228. LONGLONG Length;
  229. } PersistentStore;
  230. struct {
  231. UCHAR BusId;
  232. UCHAR Modifier:1;
  233. UCHAR Reserved:7;
  234. ULONG List;
  235. } CompatibleMap;
  236. } u;
  237. } MPS_EXTENTRY, *PMPS_EXTENTRY;
  238. #define MPS_ADDRESS_MAP_IO 0
  239. #define MPS_ADDRESS_MAP_MEMORY 1
  240. #define MPS_ADDRESS_MAP_PREFETCH_MEMORY 2
  241. #define MPS_ADDRESS_MAP_UNDEFINED 9
  242. //
  243. // The System configuration table as used by a PC_MP system
  244. //
  245. //
  246. // The offset is relative to the BIOS starting at f0000H
  247. //
  248. #define PTR_OFFSET 0x0000e6f5
  249. #define BIOS_BASE 0x000f0000
  250. #define PCMP_IMPLEMENTED 0x01 // In MpFeatureInfoByte1
  251. #define PCMP_CONFIG_MASK 0x0e // In MpFeatureInfoByte1
  252. #define IMCR_MASK 0x80 // In MpFeatureInfoByte2
  253. #define MULT_CLOCKS_MASK 0x40 // In MpFeatureInfoByte2
  254. struct SystemConfigTable {
  255. UCHAR Reserved[PTR_OFFSET];
  256. USHORT NumOfBytes; // Table can be variable length.
  257. UCHAR ModelType; // AT=0xfc, unknown board=0xff
  258. UCHAR SubModelType;
  259. UCHAR BIOSRevision; // First release = 0x0
  260. UCHAR FeatureInfoByte[3]; // Standard AT features
  261. UCHAR MpFeatureInfoByte1; // MP feature info. byte 1
  262. UCHAR MpFeatureInfoByte2; // MP feature info. byte 2
  263. } ;
  264. #pragma pack()
  265. NTSTATUS
  266. HalpPci2MpsBusNumber(
  267. IN UCHAR PciBusNumber,
  268. OUT UCHAR *MpsBusNumber
  269. );
  270. PBUS_HANDLER
  271. HalpFindIdeBus(
  272. IN ULONG Vector
  273. );
  274. BOOLEAN
  275. HalpInterruptsDescribedByMpsTable(
  276. IN UCHAR MpsBusNumber
  277. );
  278. NTSTATUS
  279. HalpMpsGetParentBus(
  280. IN UCHAR MpsBus,
  281. OUT UCHAR *ParentMpsBus
  282. );
  283. BOOLEAN
  284. HalpMpsBusIsRootBus(
  285. IN UCHAR MpsBus
  286. );
  287. VOID
  288. HalpMPSPCIChildren (
  289. VOID
  290. );
  291. /*
  292. endif
  293. ;
  294. ; IMCR (Interrupt Mode Control Register) access definitions
  295. ;
  296. ImcrDisableApic equ 00H
  297. ImcrEnableApic equ 01H
  298. ImcrRegPortAddr equ 22H
  299. ifdef NEC_98
  300. ImcrDataPortAddr equ 700H
  301. else ; NEC_98
  302. ImcrDataPortAddr equ 23H
  303. endif ; NEC_98
  304. ImcrPort equ 70H
  305. ;
  306. ; MP Configuration Table - Built by an MP BIOS for OS Support
  307. ;
  308. ; PC+MP Signature used to identify the floating pointer
  309. ; structure (in extended BIOS data segment) that contains
  310. ; a pointer to the PC+MP table.
  311. ;
  312. ; "_"=5fH, "M"=4dH, "P"=50H, "_"=5fH
  313. ;
  314. MP_PTR_SIGNATURE equ 5f504d5fH
  315. ;
  316. ; PC+MP Signature used to verify the PC+MP table
  317. ; as valid
  318. ;
  319. ; "P"=50H,"C"=43H,"M"=4dH,"P"=50H
  320. ;
  321. PCMP_SIGNATURE equ 504d4350H
  322. ;
  323. ; The PC+MP configuration table Possible Entry Types
  324. ;
  325. ENTRY_PROCESSOR equ 0H
  326. ENTRY_BUS equ 1H
  327. ENTRY_IOAPIC equ 2H
  328. ENTRY_INTI equ 3H
  329. ENTRY_LINTI equ 4H
  330. ;
  331. ; Bits used in the CpuFlags field of the Processor entry
  332. ;
  333. CPU_ENABLED equ 01H
  334. CPU_DISABLED equ 00H
  335. BSP_CPU equ 02H
  336. ;
  337. ; APIC Versions used by PC+MP systems - this is used in the
  338. ; Processor entries and the IoApic Entries
  339. ;
  340. APIC_INTEGRATED equ 10H
  341. APIC_82489DX equ 00H
  342. ;
  343. ; Macros used in table definitions
  344. ;
  345. HEADER_SIZE equ 2CH
  346. ; Number of default configurations for PC+MP version 1.1
  347. NUM_DEFAULT_CONFIGS equ 7
  348. ;
  349. ; Io Apic Entry definitions
  350. ;
  351. IO_APIC_ENABLED equ 01H
  352. IO_APIC_DISABLED equ 00H
  353. ;
  354. ; Default value for Io Apic ID.
  355. ;
  356. IOUNIT_APIC_ID equ 0EH ; ID of the IO Unit
  357. PcMpTable struc
  358. ; HEADER portion of the PC+MP config table
  359. ;
  360. Signature db 4 dup (0) ; Must be "P","C","M","P"
  361. TableLength dw 0 ; Length in bytes of table
  362. Revision db 0 ; Table revision #
  363. Checksum db 0 ; Table checksum
  364. OemId db 8 dup (0) ; OemId string
  365. OemProductId db 12 dup (0) ; Oem product id
  366. OemTablePtr dd 0 ; Ptr to OEM table
  367. OemTableSize dw 0 ; Size of OEM table
  368. NumOfEntries dw 0 ; # of entries in table
  369. LocalApicAddress dd 0 ; Physical address of Local units
  370. ExtTableLength dw 0 ; Extension table size
  371. ExtTableChecksum db 0 ; Complete checksum including extension table
  372. Reserved db 0 ; Not Used
  373. PcMpTable ends
  374. ;
  375. ; Bios Constants. The offset is relative to the BIOS starting at
  376. ; f0000H.
  377. ;
  378. PTR_OFFSET equ 0e6f5H
  379. BIOS_BASE equ 0f0000H
  380. PCMP_IMPLEMENTED equ 01H
  381. PCMP_CONFIG_MASK equ 0eH
  382. IMCR_MASK equ 80H
  383. MULT_CLOCKS_MASK equ 40H
  384. PcMpTableLocator struc
  385. MpPtrSignature dd 0 ; Must be "_MP_" (0x5f504d5f)
  386. TablePtr dd 0
  387. MpTableLength db 0
  388. TableRevision db 0
  389. TableChecksum db 0
  390. Pad db 0
  391. Reserved dd 0
  392. PcMpTableLocator ends
  393. SystemConfigTable struc
  394. db PTR_OFFSET dup (0) ;Skip to 0e6f5
  395. NumOfBytes db 2 ; Table Length
  396. ModelType db 0 ; AT=0fc, unknown=0ff
  397. SubModelType db 0
  398. BIOSRevision db 0 ; 00=first release
  399. FeatureInfoByte db 3 dup (0) ; AT features
  400. MpFeatureInfoByte1 db 0 ; MP feature info. byte 1
  401. MpFeatureInfoByte2 db 0 ; MP feature info. byte 2
  402. SystemConfigTable ends
  403. ; */