dmtable.c 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  1. /******************************************************************************
  2. *
  3. * Module Name: dmtable - Support for ACPI tables that contain no AML code
  4. *
  5. *****************************************************************************/
  6. /******************************************************************************
  7. *
  8. * 1. Copyright Notice
  9. *
  10. * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
  11. * All rights reserved.
  12. *
  13. * 2. License
  14. *
  15. * 2.1. This is your license from Intel Corp. under its intellectual property
  16. * rights. You may have additional license terms from the party that provided
  17. * you this software, covering your right to use that party's intellectual
  18. * property rights.
  19. *
  20. * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  21. * copy of the source code appearing in this file ("Covered Code") an
  22. * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  23. * base code distributed originally by Intel ("Original Intel Code") to copy,
  24. * make derivatives, distribute, use and display any portion of the Covered
  25. * Code in any form, with the right to sublicense such rights; and
  26. *
  27. * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  28. * license (with the right to sublicense), under only those claims of Intel
  29. * patents that are infringed by the Original Intel Code, to make, use, sell,
  30. * offer to sell, and import the Covered Code and derivative works thereof
  31. * solely to the minimum extent necessary to exercise the above copyright
  32. * license, and in no event shall the patent license extend to any additions
  33. * to or modifications of the Original Intel Code. No other license or right
  34. * is granted directly or by implication, estoppel or otherwise;
  35. *
  36. * The above copyright and patent license is granted only if the following
  37. * conditions are met:
  38. *
  39. * 3. Conditions
  40. *
  41. * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  42. * Redistribution of source code of any substantial portion of the Covered
  43. * Code or modification with rights to further distribute source must include
  44. * the above Copyright Notice, the above License, this list of Conditions,
  45. * and the following Disclaimer and Export Compliance provision. In addition,
  46. * Licensee must cause all Covered Code to which Licensee contributes to
  47. * contain a file documenting the changes Licensee made to create that Covered
  48. * Code and the date of any change. Licensee must include in that file the
  49. * documentation of any changes made by any predecessor Licensee. Licensee
  50. * must include a prominent statement that the modification is derived,
  51. * directly or indirectly, from Original Intel Code.
  52. *
  53. * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
  54. * Redistribution of source code of any substantial portion of the Covered
  55. * Code or modification without rights to further distribute source must
  56. * include the following Disclaimer and Export Compliance provision in the
  57. * documentation and/or other materials provided with distribution. In
  58. * addition, Licensee may not authorize further sublicense of source of any
  59. * portion of the Covered Code, and must include terms to the effect that the
  60. * license from Licensee to its licensee is limited to the intellectual
  61. * property embodied in the software Licensee provides to its licensee, and
  62. * not to intellectual property embodied in modifications its licensee may
  63. * make.
  64. *
  65. * 3.3. Redistribution of Executable. Redistribution in executable form of any
  66. * substantial portion of the Covered Code or modification must reproduce the
  67. * above Copyright Notice, and the following Disclaimer and Export Compliance
  68. * provision in the documentation and/or other materials provided with the
  69. * distribution.
  70. *
  71. * 3.4. Intel retains all right, title, and interest in and to the Original
  72. * Intel Code.
  73. *
  74. * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  75. * Intel shall be used in advertising or otherwise to promote the sale, use or
  76. * other dealings in products derived from or relating to the Covered Code
  77. * without prior written authorization from Intel.
  78. *
  79. * 4. Disclaimer and Export Compliance
  80. *
  81. * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  82. * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  83. * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
  84. * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
  85. * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
  86. * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  87. * PARTICULAR PURPOSE.
  88. *
  89. * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  90. * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  91. * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  92. * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  93. * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  94. * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
  95. * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  96. * LIMITED REMEDY.
  97. *
  98. * 4.3. Licensee shall not export, either directly or indirectly, any of this
  99. * software or system incorporating such software without first obtaining any
  100. * required license or other approval from the U. S. Department of Commerce or
  101. * any other agency or department of the United States Government. In the
  102. * event Licensee exports any such software from the United States or
  103. * re-exports any such software from a foreign destination, Licensee shall
  104. * ensure that the distribution and export/re-export of the software is in
  105. * compliance with all laws, regulations, orders, or other restrictions of the
  106. * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  107. * any of its subsidiaries will export/re-export any technical data, process,
  108. * software, or service, directly or indirectly, to any country for which the
  109. * United States government or any agency thereof requires an export license,
  110. * other governmental approval, or letter of assurance, without first obtaining
  111. * such license, approval or letter.
  112. *
  113. *****************************************************************************/
  114. #include "acpi.h"
  115. #include "accommon.h"
  116. #include "acdisasm.h"
  117. #include "actables.h"
  118. #include "aslcompiler.h"
  119. #include "dtcompiler.h"
  120. /* This module used for application-level code only */
  121. #define _COMPONENT ACPI_CA_DISASSEMBLER
  122. ACPI_MODULE_NAME ("dmtable")
  123. const AH_TABLE *
  124. AcpiAhGetTableInfo (
  125. char *Signature);
  126. /* Common format strings for commented values */
  127. #define UINT8_FORMAT "%2.2X [%s]\n"
  128. #define UINT16_FORMAT "%4.4X [%s]\n"
  129. #define UINT32_FORMAT "%8.8X [%s]\n"
  130. #define STRING_FORMAT "[%s]\n"
  131. /* These tables map a subtable type to a description string */
  132. static const char *AcpiDmAsfSubnames[] =
  133. {
  134. "ASF Information",
  135. "ASF Alerts",
  136. "ASF Remote Control",
  137. "ASF RMCP Boot Options",
  138. "ASF Address",
  139. "Unknown Subtable Type" /* Reserved */
  140. };
  141. static const char *AcpiDmDmarSubnames[] =
  142. {
  143. "Hardware Unit Definition",
  144. "Reserved Memory Region",
  145. "Root Port ATS Capability",
  146. "Remapping Hardware Static Affinity",
  147. "ACPI Namespace Device Declaration",
  148. "Unknown Subtable Type" /* Reserved */
  149. };
  150. static const char *AcpiDmDmarScope[] =
  151. {
  152. "Reserved value",
  153. "PCI Endpoint Device",
  154. "PCI Bridge Device",
  155. "IOAPIC Device",
  156. "Message-capable HPET Device",
  157. "Namespace Device",
  158. "Unknown Scope Type" /* Reserved */
  159. };
  160. static const char *AcpiDmEinjActions[] =
  161. {
  162. "Begin Operation",
  163. "Get Trigger Table",
  164. "Set Error Type",
  165. "Get Error Type",
  166. "End Operation",
  167. "Execute Operation",
  168. "Check Busy Status",
  169. "Get Command Status",
  170. "Set Error Type With Address",
  171. "Get Execute Timings",
  172. "Unknown Action"
  173. };
  174. static const char *AcpiDmEinjInstructions[] =
  175. {
  176. "Read Register",
  177. "Read Register Value",
  178. "Write Register",
  179. "Write Register Value",
  180. "Noop",
  181. "Flush Cacheline",
  182. "Unknown Instruction"
  183. };
  184. static const char *AcpiDmErstActions[] =
  185. {
  186. "Begin Write Operation",
  187. "Begin Read Operation",
  188. "Begin Clear Operation",
  189. "End Operation",
  190. "Set Record Offset",
  191. "Execute Operation",
  192. "Check Busy Status",
  193. "Get Command Status",
  194. "Get Record Identifier",
  195. "Set Record Identifier",
  196. "Get Record Count",
  197. "Begin Dummy Write",
  198. "Unused/Unknown Action",
  199. "Get Error Address Range",
  200. "Get Error Address Length",
  201. "Get Error Attributes",
  202. "Execute Timings",
  203. "Unknown Action"
  204. };
  205. static const char *AcpiDmErstInstructions[] =
  206. {
  207. "Read Register",
  208. "Read Register Value",
  209. "Write Register",
  210. "Write Register Value",
  211. "Noop",
  212. "Load Var1",
  213. "Load Var2",
  214. "Store Var1",
  215. "Add",
  216. "Subtract",
  217. "Add Value",
  218. "Subtract Value",
  219. "Stall",
  220. "Stall While True",
  221. "Skip Next If True",
  222. "GoTo",
  223. "Set Source Address",
  224. "Set Destination Address",
  225. "Move Data",
  226. "Unknown Instruction"
  227. };
  228. static const char *AcpiDmGtdtSubnames[] =
  229. {
  230. "Generic Timer Block",
  231. "Generic Watchdog Timer",
  232. "Unknown Subtable Type" /* Reserved */
  233. };
  234. static const char *AcpiDmHestSubnames[] =
  235. {
  236. "IA-32 Machine Check Exception",
  237. "IA-32 Corrected Machine Check",
  238. "IA-32 Non-Maskable Interrupt",
  239. "Unknown SubTable Type", /* 3 - Reserved */
  240. "Unknown SubTable Type", /* 4 - Reserved */
  241. "Unknown SubTable Type", /* 5 - Reserved */
  242. "PCI Express Root Port AER",
  243. "PCI Express AER (AER Endpoint)",
  244. "PCI Express/PCI-X Bridge AER",
  245. "Generic Hardware Error Source",
  246. "Generic Hardware Error Source V2",
  247. "Unknown Subtable Type" /* Reserved */
  248. };
  249. static const char *AcpiDmHestNotifySubnames[] =
  250. {
  251. "Polled",
  252. "External Interrupt",
  253. "Local Interrupt",
  254. "SCI",
  255. "NMI",
  256. "CMCI", /* ACPI 5.0 */
  257. "MCE", /* ACPI 5.0 */
  258. "GPIO", /* ACPI 6.0 */
  259. "SEA", /* ACPI 6.1 */
  260. "SEI", /* ACPI 6.1 */
  261. "GSIV", /* ACPI 6.1 */
  262. "Unknown Notify Type" /* Reserved */
  263. };
  264. static const char *AcpiDmMadtSubnames[] =
  265. {
  266. "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
  267. "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
  268. "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
  269. "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
  270. "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
  271. "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
  272. "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
  273. "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
  274. "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
  275. "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
  276. "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
  277. "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
  278. "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
  279. "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
  280. "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
  281. "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
  282. "Unknown Subtable Type" /* Reserved */
  283. };
  284. static const char *AcpiDmNfitSubnames[] =
  285. {
  286. "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
  287. "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
  288. "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
  289. "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
  290. "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
  291. "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
  292. "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
  293. "Unknown Subtable Type" /* Reserved */
  294. };
  295. static const char *AcpiDmPcctSubnames[] =
  296. {
  297. "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
  298. "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
  299. "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
  300. "Unknown Subtable Type" /* Reserved */
  301. };
  302. static const char *AcpiDmPmttSubnames[] =
  303. {
  304. "Socket", /* ACPI_PMTT_TYPE_SOCKET */
  305. "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
  306. "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
  307. "Unknown Subtable Type" /* Reserved */
  308. };
  309. static const char *AcpiDmSratSubnames[] =
  310. {
  311. "Processor Local APIC/SAPIC Affinity",
  312. "Memory Affinity",
  313. "Processor Local x2APIC Affinity",
  314. "GICC Affinity",
  315. "Unknown Subtable Type" /* Reserved */
  316. };
  317. static const char *AcpiDmIvrsSubnames[] =
  318. {
  319. "Hardware Definition Block",
  320. "Memory Definition Block",
  321. "Unknown Subtable Type" /* Reserved */
  322. };
  323. static const char *AcpiDmLpitSubnames[] =
  324. {
  325. "Native C-state Idle Structure",
  326. "Unknown Subtable Type" /* Reserved */
  327. };
  328. #define ACPI_FADT_PM_RESERVED 9
  329. static const char *AcpiDmFadtProfiles[] =
  330. {
  331. "Unspecified",
  332. "Desktop",
  333. "Mobile",
  334. "Workstation",
  335. "Enterprise Server",
  336. "SOHO Server",
  337. "Appliance PC",
  338. "Performance Server",
  339. "Tablet",
  340. "Unknown Profile Type"
  341. };
  342. #define ACPI_GAS_WIDTH_RESERVED 5
  343. static const char *AcpiDmGasAccessWidth[] =
  344. {
  345. "Undefined/Legacy",
  346. "Byte Access:8",
  347. "Word Access:16",
  348. "DWord Access:32",
  349. "QWord Access:64",
  350. "Unknown Width Encoding"
  351. };
  352. /*******************************************************************************
  353. *
  354. * ACPI Table Data, indexed by signature.
  355. *
  356. * Each entry contains: Signature, Table Info, Handler, DtHandler,
  357. * Template, Description
  358. *
  359. * Simple tables have only a TableInfo structure, complex tables have a
  360. * handler. This table must be NULL terminated. RSDP and FACS are
  361. * special-cased elsewhere.
  362. *
  363. * Note: Any tables added here should be duplicated within AcpiSupportedTables
  364. * in the file common/ahtable.c
  365. *
  366. ******************************************************************************/
  367. const ACPI_DMTABLE_DATA AcpiDmTableData[] =
  368. {
  369. {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
  370. {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
  371. {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
  372. {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
  373. {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
  374. {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
  375. {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
  376. {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
  377. {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
  378. {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
  379. {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
  380. {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
  381. {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
  382. {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
  383. {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
  384. {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
  385. {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
  386. {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
  387. {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
  388. {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
  389. {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
  390. {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
  391. {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
  392. {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
  393. {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
  394. {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
  395. {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
  396. {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
  397. {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
  398. {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
  399. {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
  400. {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
  401. {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
  402. {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
  403. {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
  404. {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
  405. {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
  406. {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
  407. {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
  408. {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
  409. {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
  410. {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
  411. {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
  412. {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
  413. {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
  414. {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
  415. {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
  416. {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
  417. {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
  418. {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
  419. {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
  420. {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
  421. {NULL, NULL, NULL, NULL, NULL}
  422. };
  423. /*******************************************************************************
  424. *
  425. * FUNCTION: AcpiDmGenerateChecksum
  426. *
  427. * PARAMETERS: Table - Pointer to table to be checksummed
  428. * Length - Length of the table
  429. * OriginalChecksum - Value of the checksum field
  430. *
  431. * RETURN: 8 bit checksum of buffer
  432. *
  433. * DESCRIPTION: Computes an 8 bit checksum of the table.
  434. *
  435. ******************************************************************************/
  436. UINT8
  437. AcpiDmGenerateChecksum (
  438. void *Table,
  439. UINT32 Length,
  440. UINT8 OriginalChecksum)
  441. {
  442. UINT8 Checksum;
  443. /* Sum the entire table as-is */
  444. Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
  445. /* Subtract off the existing checksum value in the table */
  446. Checksum = (UINT8) (Checksum - OriginalChecksum);
  447. /* Compute the final checksum */
  448. Checksum = (UINT8) (0 - Checksum);
  449. return (Checksum);
  450. }
  451. /*******************************************************************************
  452. *
  453. * FUNCTION: AcpiDmGetTableData
  454. *
  455. * PARAMETERS: Signature - ACPI signature (4 chars) to match
  456. *
  457. * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
  458. *
  459. * DESCRIPTION: Find a match in the global table of supported ACPI tables
  460. *
  461. ******************************************************************************/
  462. const ACPI_DMTABLE_DATA *
  463. AcpiDmGetTableData (
  464. char *Signature)
  465. {
  466. const ACPI_DMTABLE_DATA *Info;
  467. for (Info = AcpiDmTableData; Info->Signature; Info++)
  468. {
  469. if (ACPI_COMPARE_NAME (Signature, Info->Signature))
  470. {
  471. return (Info);
  472. }
  473. }
  474. return (NULL);
  475. }
  476. /*******************************************************************************
  477. *
  478. * FUNCTION: AcpiDmDumpDataTable
  479. *
  480. * PARAMETERS: Table - An ACPI table
  481. *
  482. * RETURN: None.
  483. *
  484. * DESCRIPTION: Format the contents of an ACPI data table (any table other
  485. * than an SSDT or DSDT that does not contain executable AML code)
  486. *
  487. ******************************************************************************/
  488. void
  489. AcpiDmDumpDataTable (
  490. ACPI_TABLE_HEADER *Table)
  491. {
  492. ACPI_STATUS Status;
  493. const ACPI_DMTABLE_DATA *TableData;
  494. UINT32 Length;
  495. /* Ignore tables that contain AML */
  496. if (AcpiUtIsAmlTable (Table))
  497. {
  498. if (Gbl_VerboseTemplates)
  499. {
  500. /* Dump the raw table data */
  501. Length = Table->Length;
  502. AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
  503. ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
  504. AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
  505. Length, DB_BYTE_DISPLAY, 0);
  506. AcpiOsPrintf (" */\n");
  507. }
  508. return;
  509. }
  510. /*
  511. * Handle tables that don't use the common ACPI table header structure.
  512. * Currently, these are the FACS, RSDP, and S3PT.
  513. */
  514. if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
  515. {
  516. Length = Table->Length;
  517. Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
  518. if (ACPI_FAILURE (Status))
  519. {
  520. return;
  521. }
  522. }
  523. else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
  524. {
  525. Length = AcpiDmDumpRsdp (Table);
  526. }
  527. else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
  528. {
  529. Length = AcpiDmDumpS3pt (Table);
  530. }
  531. else
  532. {
  533. /*
  534. * All other tables must use the common ACPI table header, dump it now
  535. */
  536. Length = Table->Length;
  537. Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
  538. if (ACPI_FAILURE (Status))
  539. {
  540. return;
  541. }
  542. AcpiOsPrintf ("\n");
  543. /* Match signature and dispatch appropriately */
  544. TableData = AcpiDmGetTableData (Table->Signature);
  545. if (!TableData)
  546. {
  547. if (!strncmp (Table->Signature, "OEM", 3))
  548. {
  549. AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
  550. Table->Signature);
  551. }
  552. else
  553. {
  554. AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
  555. Table->Signature);
  556. fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
  557. Table->Signature);
  558. if (!AcpiGbl_ForceAmlDisassembly)
  559. {
  560. fprintf (stderr, "decoding ACPI table header only\n");
  561. }
  562. else
  563. {
  564. fprintf (stderr, "assuming table contains valid AML code\n");
  565. }
  566. }
  567. }
  568. else if (TableData->TableHandler)
  569. {
  570. /* Complex table, has a handler */
  571. TableData->TableHandler (Table);
  572. }
  573. else if (TableData->TableInfo)
  574. {
  575. /* Simple table, just walk the info table */
  576. Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
  577. if (ACPI_FAILURE (Status))
  578. {
  579. return;
  580. }
  581. }
  582. }
  583. if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
  584. {
  585. /* Dump the raw table data */
  586. AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
  587. ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
  588. AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
  589. Length, DB_BYTE_DISPLAY, 0);
  590. }
  591. }
  592. /*******************************************************************************
  593. *
  594. * FUNCTION: AcpiDmLineHeader
  595. *
  596. * PARAMETERS: Offset - Current byte offset, from table start
  597. * ByteLength - Length of the field in bytes, 0 for flags
  598. * Name - Name of this field
  599. *
  600. * RETURN: None
  601. *
  602. * DESCRIPTION: Utility routines for formatting output lines. Displays the
  603. * current table offset in hex and decimal, the field length,
  604. * and the field name.
  605. *
  606. ******************************************************************************/
  607. void
  608. AcpiDmLineHeader (
  609. UINT32 Offset,
  610. UINT32 ByteLength,
  611. char *Name)
  612. {
  613. /* Allow a null name for fields that span multiple lines (large buffers) */
  614. if (!Name)
  615. {
  616. Name = "";
  617. }
  618. if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
  619. {
  620. if (ByteLength)
  621. {
  622. AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
  623. }
  624. else
  625. {
  626. if (*Name)
  627. {
  628. AcpiOsPrintf ("%41s : ", Name);
  629. }
  630. else
  631. {
  632. AcpiOsPrintf ("%41s ", Name);
  633. }
  634. }
  635. }
  636. else /* Normal disassembler or verbose template */
  637. {
  638. if (ByteLength)
  639. {
  640. AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
  641. Offset, Offset, ByteLength, Name);
  642. }
  643. else
  644. {
  645. if (*Name)
  646. {
  647. AcpiOsPrintf ("%44s : ", Name);
  648. }
  649. else
  650. {
  651. AcpiOsPrintf ("%44s ", Name);
  652. }
  653. }
  654. }
  655. }
  656. void
  657. AcpiDmLineHeader2 (
  658. UINT32 Offset,
  659. UINT32 ByteLength,
  660. char *Name,
  661. UINT32 Value)
  662. {
  663. if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
  664. {
  665. if (ByteLength)
  666. {
  667. AcpiOsPrintf ("[%.4d] %30s %3d : ",
  668. ByteLength, Name, Value);
  669. }
  670. else
  671. {
  672. AcpiOsPrintf ("%36s % 3d : ",
  673. Name, Value);
  674. }
  675. }
  676. else /* Normal disassembler or verbose template */
  677. {
  678. if (ByteLength)
  679. {
  680. AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
  681. Offset, Offset, ByteLength, Name, Value);
  682. }
  683. else
  684. {
  685. AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
  686. Offset, Offset, Name, Value);
  687. }
  688. }
  689. }
  690. /*******************************************************************************
  691. *
  692. * FUNCTION: AcpiDmDumpTable
  693. *
  694. * PARAMETERS: TableLength - Length of the entire ACPI table
  695. * TableOffset - Starting offset within the table for this
  696. * sub-descriptor (0 if main table)
  697. * Table - The ACPI table
  698. * SubtableLength - Length of this sub-descriptor
  699. * Info - Info table for this ACPI table
  700. *
  701. * RETURN: Status
  702. *
  703. * DESCRIPTION: Display ACPI table contents by walking the Info table.
  704. *
  705. * Note: This function must remain in sync with DtGetFieldLength.
  706. *
  707. ******************************************************************************/
  708. ACPI_STATUS
  709. AcpiDmDumpTable (
  710. UINT32 TableLength,
  711. UINT32 TableOffset,
  712. void *Table,
  713. UINT32 SubtableLength,
  714. ACPI_DMTABLE_INFO *Info)
  715. {
  716. UINT8 *Target;
  717. UINT32 CurrentOffset;
  718. UINT32 ByteLength;
  719. UINT8 Temp8;
  720. UINT16 Temp16;
  721. UINT32 Temp32;
  722. UINT64 Value;
  723. const AH_TABLE *TableData;
  724. const char *Name;
  725. BOOLEAN LastOutputBlankLine = FALSE;
  726. ACPI_STATUS Status;
  727. char RepairedName[8];
  728. if (!Info)
  729. {
  730. AcpiOsPrintf ("Display not implemented\n");
  731. return (AE_NOT_IMPLEMENTED);
  732. }
  733. /* Walk entire Info table; Null name terminates */
  734. for (; Info->Name; Info++)
  735. {
  736. /*
  737. * Target points to the field within the ACPI Table. CurrentOffset is
  738. * the offset of the field from the start of the main table.
  739. */
  740. Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
  741. CurrentOffset = TableOffset + Info->Offset;
  742. /* Check for beyond subtable end or (worse) beyond EOT */
  743. if (SubtableLength && (Info->Offset >= SubtableLength))
  744. {
  745. AcpiOsPrintf (
  746. "/**** ACPI subtable terminates early - "
  747. "may be older version (dump table) */\n");
  748. /* Move on to next subtable */
  749. return (AE_OK);
  750. }
  751. if (CurrentOffset >= TableLength)
  752. {
  753. AcpiOsPrintf (
  754. "/**** ACPI table terminates "
  755. "in the middle of a data structure! (dump table) */\n");
  756. return (AE_BAD_DATA);
  757. }
  758. /* Generate the byte length for this field */
  759. switch (Info->Opcode)
  760. {
  761. case ACPI_DMT_UINT8:
  762. case ACPI_DMT_CHKSUM:
  763. case ACPI_DMT_SPACEID:
  764. case ACPI_DMT_ACCWIDTH:
  765. case ACPI_DMT_IVRS:
  766. case ACPI_DMT_GTDT:
  767. case ACPI_DMT_MADT:
  768. case ACPI_DMT_PCCT:
  769. case ACPI_DMT_PMTT:
  770. case ACPI_DMT_SRAT:
  771. case ACPI_DMT_ASF:
  772. case ACPI_DMT_HESTNTYP:
  773. case ACPI_DMT_FADTPM:
  774. case ACPI_DMT_EINJACT:
  775. case ACPI_DMT_EINJINST:
  776. case ACPI_DMT_ERSTACT:
  777. case ACPI_DMT_ERSTINST:
  778. case ACPI_DMT_DMAR_SCOPE:
  779. ByteLength = 1;
  780. break;
  781. case ACPI_DMT_UINT16:
  782. case ACPI_DMT_DMAR:
  783. case ACPI_DMT_HEST:
  784. case ACPI_DMT_NFIT:
  785. ByteLength = 2;
  786. break;
  787. case ACPI_DMT_UINT24:
  788. ByteLength = 3;
  789. break;
  790. case ACPI_DMT_UINT32:
  791. case ACPI_DMT_NAME4:
  792. case ACPI_DMT_SIG:
  793. case ACPI_DMT_LPIT:
  794. ByteLength = 4;
  795. break;
  796. case ACPI_DMT_UINT40:
  797. ByteLength = 5;
  798. break;
  799. case ACPI_DMT_UINT48:
  800. case ACPI_DMT_NAME6:
  801. ByteLength = 6;
  802. break;
  803. case ACPI_DMT_UINT56:
  804. case ACPI_DMT_BUF7:
  805. ByteLength = 7;
  806. break;
  807. case ACPI_DMT_UINT64:
  808. case ACPI_DMT_NAME8:
  809. ByteLength = 8;
  810. break;
  811. case ACPI_DMT_BUF10:
  812. ByteLength = 10;
  813. break;
  814. case ACPI_DMT_BUF12:
  815. ByteLength = 12;
  816. break;
  817. case ACPI_DMT_BUF16:
  818. case ACPI_DMT_UUID:
  819. ByteLength = 16;
  820. break;
  821. case ACPI_DMT_BUF128:
  822. ByteLength = 128;
  823. break;
  824. case ACPI_DMT_UNICODE:
  825. case ACPI_DMT_BUFFER:
  826. case ACPI_DMT_RAW_BUFFER:
  827. ByteLength = SubtableLength;
  828. break;
  829. case ACPI_DMT_STRING:
  830. ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
  831. break;
  832. case ACPI_DMT_GAS:
  833. if (!LastOutputBlankLine)
  834. {
  835. AcpiOsPrintf ("\n");
  836. LastOutputBlankLine = TRUE;
  837. }
  838. ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
  839. break;
  840. case ACPI_DMT_HESTNTFY:
  841. if (!LastOutputBlankLine)
  842. {
  843. AcpiOsPrintf ("\n");
  844. LastOutputBlankLine = TRUE;
  845. }
  846. ByteLength = sizeof (ACPI_HEST_NOTIFY);
  847. break;
  848. case ACPI_DMT_IORTMEM:
  849. if (!LastOutputBlankLine)
  850. {
  851. LastOutputBlankLine = FALSE;
  852. }
  853. ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
  854. break;
  855. default:
  856. ByteLength = 0;
  857. break;
  858. }
  859. /* Check if we are beyond a subtable, or (worse) beyond EOT */
  860. if (CurrentOffset + ByteLength > TableLength)
  861. {
  862. if (SubtableLength)
  863. {
  864. AcpiOsPrintf (
  865. "/**** ACPI subtable terminates early - "
  866. "may be older version (dump table) */\n");
  867. /* Move on to next subtable */
  868. return (AE_OK);
  869. }
  870. AcpiOsPrintf (
  871. "/**** ACPI table terminates "
  872. "in the middle of a data structure! */\n");
  873. return (AE_BAD_DATA);
  874. }
  875. if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
  876. {
  877. AcpiOsPrintf ("%s", Info->Name);
  878. continue;
  879. }
  880. /* Start a new line and decode the opcode */
  881. AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
  882. switch (Info->Opcode)
  883. {
  884. /* Single-bit Flag fields. Note: Opcode is the bit position */
  885. case ACPI_DMT_FLAG0:
  886. case ACPI_DMT_FLAG1:
  887. case ACPI_DMT_FLAG2:
  888. case ACPI_DMT_FLAG3:
  889. case ACPI_DMT_FLAG4:
  890. case ACPI_DMT_FLAG5:
  891. case ACPI_DMT_FLAG6:
  892. case ACPI_DMT_FLAG7:
  893. AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
  894. break;
  895. /* 2-bit Flag fields */
  896. case ACPI_DMT_FLAGS0:
  897. AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
  898. break;
  899. case ACPI_DMT_FLAGS1:
  900. AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
  901. break;
  902. case ACPI_DMT_FLAGS2:
  903. AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
  904. break;
  905. case ACPI_DMT_FLAGS4:
  906. AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
  907. break;
  908. /* Integer Data Types */
  909. case ACPI_DMT_UINT8:
  910. case ACPI_DMT_UINT16:
  911. case ACPI_DMT_UINT24:
  912. case ACPI_DMT_UINT32:
  913. case ACPI_DMT_UINT40:
  914. case ACPI_DMT_UINT48:
  915. case ACPI_DMT_UINT56:
  916. case ACPI_DMT_UINT64:
  917. /*
  918. * Dump bytes - high byte first, low byte last.
  919. * Note: All ACPI tables are little-endian.
  920. */
  921. Value = 0;
  922. for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
  923. {
  924. AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
  925. Value |= Target[Temp8 - 1];
  926. Value <<= 8;
  927. }
  928. if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
  929. {
  930. AcpiOsPrintf (" [Optional field not present]");
  931. }
  932. AcpiOsPrintf ("\n");
  933. break;
  934. case ACPI_DMT_BUF7:
  935. case ACPI_DMT_BUF10:
  936. case ACPI_DMT_BUF12:
  937. case ACPI_DMT_BUF16:
  938. case ACPI_DMT_BUF128:
  939. /*
  940. * Buffer: Size depends on the opcode and was set above.
  941. * Each hex byte is separated with a space.
  942. * Multiple lines are separated by line continuation char.
  943. */
  944. for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
  945. {
  946. AcpiOsPrintf ("%2.2X", Target[Temp16]);
  947. if ((UINT32) (Temp16 + 1) < ByteLength)
  948. {
  949. if ((Temp16 > 0) && (!((Temp16+1) % 16)))
  950. {
  951. AcpiOsPrintf (" \\\n"); /* Line continuation */
  952. AcpiDmLineHeader (0, 0, NULL);
  953. }
  954. else
  955. {
  956. AcpiOsPrintf (" ");
  957. }
  958. }
  959. }
  960. AcpiOsPrintf ("\n");
  961. break;
  962. case ACPI_DMT_UUID:
  963. /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
  964. (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
  965. AcpiOsPrintf ("%s\n", MsgBuffer);
  966. break;
  967. case ACPI_DMT_STRING:
  968. AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
  969. break;
  970. /* Fixed length ASCII name fields */
  971. case ACPI_DMT_SIG:
  972. AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
  973. AcpiOsPrintf ("\"%.4s\" ", RepairedName);
  974. TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
  975. if (TableData)
  976. {
  977. AcpiOsPrintf (STRING_FORMAT, TableData->Description);
  978. }
  979. else
  980. {
  981. AcpiOsPrintf ("\n");
  982. }
  983. break;
  984. case ACPI_DMT_NAME4:
  985. AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
  986. AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
  987. break;
  988. case ACPI_DMT_NAME6:
  989. AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
  990. AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
  991. break;
  992. case ACPI_DMT_NAME8:
  993. AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
  994. AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
  995. break;
  996. /* Special Data Types */
  997. case ACPI_DMT_CHKSUM:
  998. /* Checksum, display and validate */
  999. AcpiOsPrintf ("%2.2X", *Target);
  1000. Temp8 = AcpiDmGenerateChecksum (Table,
  1001. ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
  1002. ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
  1003. if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
  1004. {
  1005. AcpiOsPrintf (
  1006. " /* Incorrect checksum, should be %2.2X */", Temp8);
  1007. }
  1008. AcpiOsPrintf ("\n");
  1009. break;
  1010. case ACPI_DMT_SPACEID:
  1011. /* Address Space ID */
  1012. AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
  1013. break;
  1014. case ACPI_DMT_ACCWIDTH:
  1015. /* Encoded Access Width */
  1016. Temp8 = *Target;
  1017. if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
  1018. {
  1019. Temp8 = ACPI_GAS_WIDTH_RESERVED;
  1020. }
  1021. AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
  1022. break;
  1023. case ACPI_DMT_GAS:
  1024. /* Generic Address Structure */
  1025. AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
  1026. Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
  1027. sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
  1028. if (ACPI_FAILURE (Status))
  1029. {
  1030. return (Status);
  1031. }
  1032. AcpiOsPrintf ("\n");
  1033. LastOutputBlankLine = TRUE;
  1034. break;
  1035. case ACPI_DMT_ASF:
  1036. /* ASF subtable types */
  1037. Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
  1038. if (Temp16 > ACPI_ASF_TYPE_RESERVED)
  1039. {
  1040. Temp16 = ACPI_ASF_TYPE_RESERVED;
  1041. }
  1042. AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
  1043. break;
  1044. case ACPI_DMT_DMAR:
  1045. /* DMAR subtable types */
  1046. Temp16 = ACPI_GET16 (Target);
  1047. if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
  1048. {
  1049. Temp16 = ACPI_DMAR_TYPE_RESERVED;
  1050. }
  1051. AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
  1052. AcpiDmDmarSubnames[Temp16]);
  1053. break;
  1054. case ACPI_DMT_DMAR_SCOPE:
  1055. /* DMAR device scope types */
  1056. Temp8 = *Target;
  1057. if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
  1058. {
  1059. Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
  1060. }
  1061. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1062. AcpiDmDmarScope[Temp8]);
  1063. break;
  1064. case ACPI_DMT_EINJACT:
  1065. /* EINJ Action types */
  1066. Temp8 = *Target;
  1067. if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
  1068. {
  1069. Temp8 = ACPI_EINJ_ACTION_RESERVED;
  1070. }
  1071. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1072. AcpiDmEinjActions[Temp8]);
  1073. break;
  1074. case ACPI_DMT_EINJINST:
  1075. /* EINJ Instruction types */
  1076. Temp8 = *Target;
  1077. if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
  1078. {
  1079. Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
  1080. }
  1081. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1082. AcpiDmEinjInstructions[Temp8]);
  1083. break;
  1084. case ACPI_DMT_ERSTACT:
  1085. /* ERST Action types */
  1086. Temp8 = *Target;
  1087. if (Temp8 > ACPI_ERST_ACTION_RESERVED)
  1088. {
  1089. Temp8 = ACPI_ERST_ACTION_RESERVED;
  1090. }
  1091. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1092. AcpiDmErstActions[Temp8]);
  1093. break;
  1094. case ACPI_DMT_ERSTINST:
  1095. /* ERST Instruction types */
  1096. Temp8 = *Target;
  1097. if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
  1098. {
  1099. Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
  1100. }
  1101. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1102. AcpiDmErstInstructions[Temp8]);
  1103. break;
  1104. case ACPI_DMT_GTDT:
  1105. /* GTDT subtable types */
  1106. Temp8 = *Target;
  1107. if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
  1108. {
  1109. Temp8 = ACPI_GTDT_TYPE_RESERVED;
  1110. }
  1111. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1112. AcpiDmGtdtSubnames[Temp8]);
  1113. break;
  1114. case ACPI_DMT_HEST:
  1115. /* HEST subtable types */
  1116. Temp16 = ACPI_GET16 (Target);
  1117. if (Temp16 > ACPI_HEST_TYPE_RESERVED)
  1118. {
  1119. Temp16 = ACPI_HEST_TYPE_RESERVED;
  1120. }
  1121. AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
  1122. AcpiDmHestSubnames[Temp16]);
  1123. break;
  1124. case ACPI_DMT_HESTNTFY:
  1125. AcpiOsPrintf (STRING_FORMAT,
  1126. "Hardware Error Notification Structure");
  1127. Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
  1128. sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
  1129. if (ACPI_FAILURE (Status))
  1130. {
  1131. return (Status);
  1132. }
  1133. AcpiOsPrintf ("\n");
  1134. LastOutputBlankLine = TRUE;
  1135. break;
  1136. case ACPI_DMT_HESTNTYP:
  1137. /* HEST Notify types */
  1138. Temp8 = *Target;
  1139. if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
  1140. {
  1141. Temp8 = ACPI_HEST_NOTIFY_RESERVED;
  1142. }
  1143. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1144. AcpiDmHestNotifySubnames[Temp8]);
  1145. break;
  1146. case ACPI_DMT_IORTMEM:
  1147. AcpiOsPrintf (STRING_FORMAT,
  1148. "IORT Memory Access Properties");
  1149. Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
  1150. sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
  1151. if (ACPI_FAILURE (Status))
  1152. {
  1153. return (Status);
  1154. }
  1155. LastOutputBlankLine = TRUE;
  1156. break;
  1157. case ACPI_DMT_MADT:
  1158. /* MADT subtable types */
  1159. Temp8 = *Target;
  1160. if (Temp8 > ACPI_MADT_TYPE_RESERVED)
  1161. {
  1162. Temp8 = ACPI_MADT_TYPE_RESERVED;
  1163. }
  1164. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1165. AcpiDmMadtSubnames[Temp8]);
  1166. break;
  1167. case ACPI_DMT_NFIT:
  1168. /* NFIT subtable types */
  1169. Temp16 = ACPI_GET16 (Target);
  1170. if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
  1171. {
  1172. Temp16 = ACPI_NFIT_TYPE_RESERVED;
  1173. }
  1174. AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
  1175. AcpiDmNfitSubnames[Temp16]);
  1176. break;
  1177. case ACPI_DMT_PCCT:
  1178. /* PCCT subtable types */
  1179. Temp8 = *Target;
  1180. if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
  1181. {
  1182. Temp8 = ACPI_PCCT_TYPE_RESERVED;
  1183. }
  1184. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1185. AcpiDmPcctSubnames[Temp8]);
  1186. break;
  1187. case ACPI_DMT_PMTT:
  1188. /* PMTT subtable types */
  1189. Temp8 = *Target;
  1190. if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
  1191. {
  1192. Temp8 = ACPI_PMTT_TYPE_RESERVED;
  1193. }
  1194. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1195. AcpiDmPmttSubnames[Temp8]);
  1196. break;
  1197. case ACPI_DMT_UNICODE:
  1198. if (ByteLength == 0)
  1199. {
  1200. AcpiOsPrintf ("/* Zero-length Data */\n");
  1201. break;
  1202. }
  1203. AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
  1204. break;
  1205. case ACPI_DMT_RAW_BUFFER:
  1206. if (ByteLength == 0)
  1207. {
  1208. AcpiOsPrintf ("/* Zero-length Data */\n");
  1209. break;
  1210. }
  1211. AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
  1212. CurrentOffset, NULL);
  1213. break;
  1214. case ACPI_DMT_SRAT:
  1215. /* SRAT subtable types */
  1216. Temp8 = *Target;
  1217. if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
  1218. {
  1219. Temp8 = ACPI_SRAT_TYPE_RESERVED;
  1220. }
  1221. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1222. AcpiDmSratSubnames[Temp8]);
  1223. break;
  1224. case ACPI_DMT_FADTPM:
  1225. /* FADT Preferred PM Profile names */
  1226. Temp8 = *Target;
  1227. if (Temp8 > ACPI_FADT_PM_RESERVED)
  1228. {
  1229. Temp8 = ACPI_FADT_PM_RESERVED;
  1230. }
  1231. AcpiOsPrintf (UINT8_FORMAT, *Target,
  1232. AcpiDmFadtProfiles[Temp8]);
  1233. break;
  1234. case ACPI_DMT_IVRS:
  1235. /* IVRS subtable types */
  1236. Temp8 = *Target;
  1237. switch (Temp8)
  1238. {
  1239. case ACPI_IVRS_TYPE_HARDWARE:
  1240. Name = AcpiDmIvrsSubnames[0];
  1241. break;
  1242. case ACPI_IVRS_TYPE_MEMORY1:
  1243. case ACPI_IVRS_TYPE_MEMORY2:
  1244. case ACPI_IVRS_TYPE_MEMORY3:
  1245. Name = AcpiDmIvrsSubnames[1];
  1246. break;
  1247. default:
  1248. Name = AcpiDmIvrsSubnames[2];
  1249. break;
  1250. }
  1251. AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
  1252. break;
  1253. case ACPI_DMT_LPIT:
  1254. /* LPIT subtable types */
  1255. Temp32 = ACPI_GET32 (Target);
  1256. if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
  1257. {
  1258. Temp32 = ACPI_LPIT_TYPE_RESERVED;
  1259. }
  1260. AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
  1261. AcpiDmLpitSubnames[Temp32]);
  1262. break;
  1263. case ACPI_DMT_EXIT:
  1264. return (AE_OK);
  1265. default:
  1266. ACPI_ERROR ((AE_INFO,
  1267. "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
  1268. return (AE_SUPPORT);
  1269. }
  1270. }
  1271. if (TableOffset && !SubtableLength)
  1272. {
  1273. /*
  1274. * If this table is not the main table, the subtable must have a
  1275. * valid length
  1276. */
  1277. AcpiOsPrintf ("Invalid zero length subtable\n");
  1278. return (AE_BAD_DATA);
  1279. }
  1280. return (AE_OK);
  1281. }