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.

357 lines
10 KiB

  1. /*** fmtdata.h - Format Data
  2. *
  3. * This module contains all the format data.
  4. *
  5. * Copyright (c) 1999 Microsoft Corporation
  6. * Author: Michael Tsang (MikeTs)
  7. * Created 04/08/99
  8. *
  9. * MODIFICATION HISTORY
  10. */
  11. //
  12. // Common Strings
  13. //
  14. char szReserved[] = "Reserved";
  15. char szLabelReserved[] = "Reserved =";
  16. char szNull[] = "";
  17. char szDecFmt[] = SZ_FMT_DEC;
  18. char szHexFmt[] = SZ_FMT_HEX;
  19. char szByteFmt[] = SZ_FMT_HEX_BYTE;
  20. char szWordFmt[] = SZ_FMT_HEX_WORD;
  21. char szDWordFmt[] = SZ_FMT_HEX_DWORD;
  22. char szOffsetFmt[] = "%02x: ";
  23. char szSectFmt[] = "\n[%08lx: %s]\n";
  24. //
  25. // Common Formats
  26. //
  27. FMTNUM fmtHexByteNoEOL =
  28. {
  29. {FMT_NUMBER, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA | FMTF_NO_EOL, 1, NULL, NULL,
  30. NULL},
  31. 0xff, 0, szByteFmt
  32. };
  33. FMTNUM fmtHexByte =
  34. {
  35. {FMT_NUMBER, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  36. 0xff, 0, szByteFmt
  37. };
  38. FMTNUM fmt3HexByte =
  39. {
  40. {FMT_NUMBER, UNIT_BYTE, 3, FMTF_NO_PRINT_DATA | FMTF_NO_RAW_DATA, 1, NULL,
  41. NULL, NULL},
  42. 0xff, 0, szByteFmt
  43. };
  44. FMTNUM fmtHexWord =
  45. {
  46. {FMT_NUMBER, UNIT_WORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  47. 0xffff, 0, szWordFmt
  48. };
  49. FMTNUM fmtHexDWord =
  50. {
  51. {FMT_NUMBER, UNIT_DWORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  52. 0xffffffff, 0, szDWordFmt
  53. };
  54. FMTNUM fmt2HexDWord =
  55. {
  56. {FMT_NUMBER, UNIT_DWORD, 2, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  57. 0xffffffff, 0, szDWordFmt
  58. };
  59. FMTNUM fmt4HexDWord =
  60. {
  61. {FMT_NUMBER, UNIT_DWORD, 4, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  62. 0xffffffff, 0, szDWordFmt
  63. };
  64. FMTNUM fmt6HexDWord =
  65. {
  66. {FMT_NUMBER, UNIT_DWORD, 6, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  67. 0xffffffff, 0, szDWordFmt
  68. };
  69. FMTNUM fmt8HexDWord =
  70. {
  71. {FMT_NUMBER, UNIT_DWORD, 8, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  72. 0xffffffff, 0, szDWordFmt
  73. };
  74. FMTNUM fmtDecNum =
  75. {
  76. {FMT_NUMBER, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  77. 0xff, 0, szDecFmt
  78. };
  79. FMTSTR fmtChar4 =
  80. {
  81. {FMT_STRING, UNIT_BYTE, 4, FMTF_NO_PRINT_DATA | FMTF_NO_RAW_DATA, 1, NULL,
  82. NULL, NULL}
  83. };
  84. FMTSTR fmtChar6 =
  85. {
  86. {FMT_STRING, UNIT_BYTE, 6, FMTF_NO_PRINT_DATA | FMTF_NO_RAW_DATA, 1, NULL,
  87. NULL, NULL}
  88. };
  89. FMTSTR fmtChar8 =
  90. {
  91. {FMT_STRING, UNIT_BYTE, 8, FMTF_NO_PRINT_DATA | FMTF_NO_RAW_DATA, 1, NULL,
  92. NULL, NULL}
  93. };
  94. //
  95. // RSD PTR Table
  96. //
  97. FMT afmtRSDPTR[] =
  98. {
  99. {"Signature =", (PFMTHDR)&fmtChar8, NULL},
  100. {"Checksum =", (PFMTHDR)&fmtHexByte, NULL},
  101. {"OEMID =", (PFMTHDR)&fmtChar6, NULL},
  102. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  103. {"RSDTAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  104. {NULL, NULL, NULL}
  105. };
  106. //
  107. // Common Table Header
  108. //
  109. FMT afmtTableHdr[] =
  110. {
  111. {"Signature =", (PFMTHDR)&fmtChar4, NULL},
  112. {"Length =", (PFMTHDR)&fmtHexDWord, NULL},
  113. {"Revision =", (PFMTHDR)&fmtHexByte, NULL},
  114. {"Checksum =", (PFMTHDR)&fmtHexByte, NULL},
  115. {"OEMID =", (PFMTHDR)&fmtChar6, NULL},
  116. {"OEMTableID =", (PFMTHDR)&fmtChar8, NULL},
  117. {"OEMTableRev =", (PFMTHDR)&fmtHexDWord, NULL},
  118. {"CreatorID =", (PFMTHDR)&fmtChar4, NULL},
  119. {"CreatorRev =", (PFMTHDR)&fmtHexDWord, NULL},
  120. {NULL, NULL, NULL}
  121. };
  122. //
  123. // Generic Register Address Structure
  124. //
  125. char *ppszAddrSpaceNames[] = {"SystemMemory", "SystemIO", "PCIConfigSpace"};
  126. FMTENUM fmtAddrSpaceID =
  127. {
  128. {FMT_ENUM, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  129. 0xff, 0, 0, 2, ppszAddrSpaceNames, szReserved
  130. };
  131. FMT afmtGRASCommon[] =
  132. {
  133. {"RegAddrSpce =", (PFMTHDR)&fmtAddrSpaceID, NULL},
  134. {"RegBitWidth =", (PFMTHDR)&fmtHexByte, NULL},
  135. {"RegBitOffset =", (PFMTHDR)&fmtHexByte, NULL},
  136. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  137. {NULL, NULL, NULL}
  138. };
  139. FMT afmtGRASPCICS[] =
  140. {
  141. {szLabelReserved, (PFMTHDR)&fmtHexWord, NULL},
  142. {"DeviceNum =", (PFMTHDR)&fmtHexWord, NULL},
  143. {"FunctionNum =", (PFMTHDR)&fmtHexWord, NULL},
  144. {"CfgSpaceOffset =", (PFMTHDR)&fmtHexWord, NULL},
  145. {NULL, NULL, NULL}
  146. };
  147. FMT afmtGRASRegAddr[] =
  148. {
  149. {"RegAddrLo =", (PFMTHDR)&fmtHexDWord, NULL},
  150. {"RegAddrHi =", (PFMTHDR)&fmtHexDWord, NULL},
  151. {NULL, NULL, NULL}
  152. };
  153. //
  154. // FACP Table
  155. //
  156. char *ppszIntModelNames[] = {"DualPIC", "MultipleAPIC"};
  157. FMTENUM fmtIntModel =
  158. {
  159. {FMT_ENUM, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  160. 0xff, 0, 0, 0x01, ppszIntModelNames, szReserved
  161. };
  162. char *ppszBootArchFlagNames[] = {"8042", "LegacyDevices"};
  163. FMTBITS fmtBootArch =
  164. {
  165. {FMT_BITS, UNIT_WORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  166. 0x0003, ppszBootArchFlagNames, NULL
  167. };
  168. char *ppszFACPFlagNames[] = {"ResetRegSupported", "DckCap", "TmrValExt",
  169. "RTCS4", "FixRTC", "SlpButton", "PwrButton",
  170. "PLvl2UP", "ProcC1", "WBINVDFlush", "WBINVD"};
  171. FMTBITS fmtFACPFlags =
  172. {
  173. {FMT_BITS, UNIT_DWORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  174. 0x000007ff, ppszFACPFlagNames, NULL
  175. };
  176. FMT afmtFACP[] =
  177. {
  178. {"FACSAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  179. {"DSDTAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  180. {"IntModel =", (PFMTHDR)&fmtIntModel, NULL},
  181. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  182. {"SCIInt =", (PFMTHDR)&fmtHexWord, NULL},
  183. {"SMICmdAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  184. {"ACPIEnableValue =", (PFMTHDR)&fmtHexByte, NULL},
  185. {"ACPIDisableValue=", (PFMTHDR)&fmtHexByte, NULL},
  186. {"S4BIOSReqValue =", (PFMTHDR)&fmtHexByte, NULL},
  187. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  188. {"PM1aEvtBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  189. {"PM1bEvtBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  190. {"PM1aCtrlBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  191. {"PM1bCtrlBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  192. {"PM2CtrlBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  193. {"PMTmrBlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  194. {"GPE0BlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  195. {"GPE1BlkAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  196. {"PM1EvtBlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  197. {"PM1CtrlBlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  198. {"PM2CtrlBlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  199. {"PMTmrBlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  200. {"GPE0BlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  201. {"GPE1BlkLen =", (PFMTHDR)&fmtHexByte, NULL},
  202. {"GPE1BaseOffset =", (PFMTHDR)&fmtHexByte, NULL},
  203. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  204. {"PLvl2Latency =", (PFMTHDR)&fmtHexWord, NULL},
  205. {"PLvl3Latency =", (PFMTHDR)&fmtHexWord, NULL},
  206. {"FlushSize =", (PFMTHDR)&fmtHexWord, NULL},
  207. {"FlushStride =", (PFMTHDR)&fmtHexWord, NULL},
  208. {"DutyOffset =", (PFMTHDR)&fmtHexByte, NULL},
  209. {"DutyWidth =", (PFMTHDR)&fmtHexByte, NULL},
  210. {"DayAlarmIndex =", (PFMTHDR)&fmtHexByte, NULL},
  211. {"MonthAlarmIndex =", (PFMTHDR)&fmtHexByte, NULL},
  212. {"CenturyIndex =", (PFMTHDR)&fmtHexByte, NULL},
  213. {"BootArchFlags =", (PFMTHDR)&fmtBootArch, NULL},
  214. {szLabelReserved, (PFMTHDR)&fmtHexByte, NULL},
  215. {"Flags =", (PFMTHDR)&fmtFACPFlags, NULL},
  216. {NULL, NULL, NULL}
  217. };
  218. FMT afmtFACP2[] =
  219. {
  220. {"ResetValue =", (PFMTHDR)&fmtHexByte, NULL},
  221. {szLabelReserved, (PFMTHDR)&fmt3HexByte, NULL},
  222. {NULL, NULL, NULL}
  223. };
  224. //
  225. // FACS Table
  226. //
  227. char *ppszGLNames[] = {"Owned", "Pending"};
  228. FMTBITS fmtGlobalLock =
  229. {
  230. {FMT_BITS, UNIT_DWORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  231. 0x00000003, ppszGLNames, NULL
  232. };
  233. char *ppszFACSFlagNames[] = {"S4BIOS"};
  234. FMTBITS fmtFACSFlags =
  235. {
  236. {FMT_BITS, UNIT_DWORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  237. 0x00000001, ppszFACSFlagNames, NULL
  238. };
  239. FMT afmtFACS[] =
  240. {
  241. {"Signature =", (PFMTHDR)&fmtChar4, NULL},
  242. {"Length =", (PFMTHDR)&fmtHexDWord, NULL},
  243. {"HWSignature =", (PFMTHDR)&fmtHexDWord, NULL},
  244. {"FirmwareWakeVect=", (PFMTHDR)&fmtHexDWord, NULL},
  245. {"GlobalLock =", (PFMTHDR)&fmtGlobalLock, NULL},
  246. {"Flags =", (PFMTHDR)&fmtFACSFlags, NULL},
  247. {szNull, (PFMTHDR)&fmt2HexDWord, NULL},
  248. {szNull, (PFMTHDR)&fmt8HexDWord, NULL},
  249. {NULL, NULL, NULL}
  250. };
  251. //
  252. // APIC Table
  253. //
  254. char *ppszAPICFlagNames[] = {"PCATCompat"};
  255. FMTBITS fmtAPICFlags =
  256. {
  257. {FMT_BITS, UNIT_DWORD, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  258. 0x00000001, ppszAPICFlagNames, NULL
  259. };
  260. FMT afmtAPIC[] =
  261. {
  262. {"LocalAPICAddr =", (PFMTHDR)&fmtHexDWord, NULL},
  263. {"Flags =", (PFMTHDR)&fmtAPICFlags, NULL},
  264. {NULL, NULL, NULL}
  265. };
  266. //
  267. // SBST Table
  268. //
  269. FMT afmtSBST[] =
  270. {
  271. {"WarnEnergyLevel =", (PFMTHDR)&fmtHexDWord, NULL},
  272. {"LowEnergyLevel =", (PFMTHDR)&fmtHexDWord, NULL},
  273. {"CritEnergyLevel =", (PFMTHDR)&fmtHexDWord, NULL},
  274. {NULL, NULL, NULL}
  275. };
  276. //
  277. // BOOT Table
  278. //
  279. FMT afmtBOOT[] =
  280. {
  281. {"CMOSOffset =", (PFMTHDR)&fmtHexByte, NULL},
  282. {szLabelReserved, (PFMTHDR)&fmt3HexByte, NULL},
  283. {NULL, NULL, NULL}
  284. };
  285. //
  286. // DBGP Table
  287. //
  288. char *ppszInterfaceNames[] = {"16550Full", "16550Subset"};
  289. FMTENUM fmtInterfaceType =
  290. {
  291. {FMT_ENUM, UNIT_BYTE, 1, FMTF_NO_PRINT_DATA, 1, NULL, NULL, NULL},
  292. 0xff, 0, 0, 0x01, ppszIntModelNames, szReserved
  293. };
  294. FMT afmtDBGP[] =
  295. {
  296. {"InterfaceType =", (PFMTHDR)&fmtInterfaceType,NULL},
  297. {szLabelReserved, (PFMTHDR)&fmt3HexByte, NULL},
  298. {NULL, NULL, NULL}
  299. };
  300. typedef struct _fmtentry
  301. {
  302. DWORD dwTableSig;
  303. DWORD dwFlags;
  304. PFMT pfmt;
  305. } FMTENTRY, *PFMTENTRY;
  306. #define TF_NOHDR 0x00000001
  307. #define SIG_DBGP 'PGBD'
  308. FMTENTRY FmtTable[] = {
  309. {FADT_SIGNATURE, 0, afmtFACP},
  310. {FACS_SIGNATURE, TF_NOHDR, afmtFACS},
  311. {APIC_SIGNATURE, 0, afmtAPIC},
  312. {SBST_SIGNATURE, 0, afmtSBST},
  313. {SIG_BOOT, 0, afmtBOOT},
  314. {SIG_DBGP, 0, afmtDBGP},
  315. {RSDT_SIGNATURE, 0, NULL},
  316. {DSDT_SIGNATURE, 0, NULL},
  317. {PSDT_SIGNATURE, 0, NULL},
  318. {SSDT_SIGNATURE, 0, NULL},
  319. {0, 0, NULL}
  320. };