dmtable.c revision 1.1.1.13 1 /******************************************************************************
2 *
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2017, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acdisasm.h"
47 #include "actables.h"
48 #include "aslcompiler.h"
49
50 /* This module used for application-level code only */
51
52 #define _COMPONENT ACPI_CA_DISASSEMBLER
53 ACPI_MODULE_NAME ("dmtable")
54
55 const AH_TABLE *
56 AcpiAhGetTableInfo (
57 char *Signature);
58
59
60 /* Common format strings for commented values */
61
62 #define UINT8_FORMAT "%2.2X [%s]\n"
63 #define UINT16_FORMAT "%4.4X [%s]\n"
64 #define UINT32_FORMAT "%8.8X [%s]\n"
65 #define STRING_FORMAT "[%s]\n"
66
67 /* These tables map a subtable type to a description string */
68
69 static const char *AcpiDmAsfSubnames[] =
70 {
71 "ASF Information",
72 "ASF Alerts",
73 "ASF Remote Control",
74 "ASF RMCP Boot Options",
75 "ASF Address",
76 "Unknown Subtable Type" /* Reserved */
77 };
78
79 static const char *AcpiDmDmarSubnames[] =
80 {
81 "Hardware Unit Definition",
82 "Reserved Memory Region",
83 "Root Port ATS Capability",
84 "Remapping Hardware Static Affinity",
85 "ACPI Namespace Device Declaration",
86 "Unknown Subtable Type" /* Reserved */
87 };
88
89 static const char *AcpiDmDmarScope[] =
90 {
91 "Reserved value",
92 "PCI Endpoint Device",
93 "PCI Bridge Device",
94 "IOAPIC Device",
95 "Message-capable HPET Device",
96 "Namespace Device",
97 "Unknown Scope Type" /* Reserved */
98 };
99
100 static const char *AcpiDmEinjActions[] =
101 {
102 "Begin Operation",
103 "Get Trigger Table",
104 "Set Error Type",
105 "Get Error Type",
106 "End Operation",
107 "Execute Operation",
108 "Check Busy Status",
109 "Get Command Status",
110 "Set Error Type With Address",
111 "Get Execute Timings",
112 "Unknown Action"
113 };
114
115 static const char *AcpiDmEinjInstructions[] =
116 {
117 "Read Register",
118 "Read Register Value",
119 "Write Register",
120 "Write Register Value",
121 "Noop",
122 "Flush Cacheline",
123 "Unknown Instruction"
124 };
125
126 static const char *AcpiDmErstActions[] =
127 {
128 "Begin Write Operation",
129 "Begin Read Operation",
130 "Begin Clear Operation",
131 "End Operation",
132 "Set Record Offset",
133 "Execute Operation",
134 "Check Busy Status",
135 "Get Command Status",
136 "Get Record Identifier",
137 "Set Record Identifier",
138 "Get Record Count",
139 "Begin Dummy Write",
140 "Unused/Unknown Action",
141 "Get Error Address Range",
142 "Get Error Address Length",
143 "Get Error Attributes",
144 "Execute Timings",
145 "Unknown Action"
146 };
147
148 static const char *AcpiDmErstInstructions[] =
149 {
150 "Read Register",
151 "Read Register Value",
152 "Write Register",
153 "Write Register Value",
154 "Noop",
155 "Load Var1",
156 "Load Var2",
157 "Store Var1",
158 "Add",
159 "Subtract",
160 "Add Value",
161 "Subtract Value",
162 "Stall",
163 "Stall While True",
164 "Skip Next If True",
165 "GoTo",
166 "Set Source Address",
167 "Set Destination Address",
168 "Move Data",
169 "Unknown Instruction"
170 };
171
172 static const char *AcpiDmGtdtSubnames[] =
173 {
174 "Generic Timer Block",
175 "Generic Watchdog Timer",
176 "Unknown Subtable Type" /* Reserved */
177 };
178
179 static const char *AcpiDmHestSubnames[] =
180 {
181 "IA-32 Machine Check Exception",
182 "IA-32 Corrected Machine Check",
183 "IA-32 Non-Maskable Interrupt",
184 "Unknown Subtable Type", /* 3 - Reserved */
185 "Unknown Subtable Type", /* 4 - Reserved */
186 "Unknown Subtable Type", /* 5 - Reserved */
187 "PCI Express Root Port AER",
188 "PCI Express AER (AER Endpoint)",
189 "PCI Express/PCI-X Bridge AER",
190 "Generic Hardware Error Source",
191 "Generic Hardware Error Source V2",
192 "IA-32 Deferred Machine Check",
193 "Unknown Subtable Type" /* Reserved */
194 };
195
196 static const char *AcpiDmHestNotifySubnames[] =
197 {
198 "Polled",
199 "External Interrupt",
200 "Local Interrupt",
201 "SCI",
202 "NMI",
203 "CMCI", /* ACPI 5.0 */
204 "MCE", /* ACPI 5.0 */
205 "GPIO", /* ACPI 6.0 */
206 "SEA", /* ACPI 6.1 */
207 "SEI", /* ACPI 6.1 */
208 "GSIV", /* ACPI 6.1 */
209 "Software Delegated Exception", /* ACPI 6.2 */
210 "Unknown Notify Type" /* Reserved */
211 };
212
213 static const char *AcpiDmHmatSubnames[] =
214 {
215 "Memory Subystem Address Range",
216 "System Locality Latency and Bandwidth Information",
217 "Memory Side Cache Information",
218 "Unknown Structure Type" /* Reserved */
219 };
220
221 static const char *AcpiDmMadtSubnames[] =
222 {
223 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
224 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
225 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
226 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
227 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
228 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
229 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
230 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
231 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
232 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
233 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
234 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
235 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
236 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
237 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
238 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
239 "Unknown Subtable Type" /* Reserved */
240 };
241
242 static const char *AcpiDmNfitSubnames[] =
243 {
244 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
245 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
246 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
247 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
248 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
249 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
250 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
251 "Platform Capabilities", /* ACPI_NFIT_TYPE_CAPABILITIES */
252 "Unknown Subtable Type" /* Reserved */
253 };
254
255 static const char *AcpiDmPcctSubnames[] =
256 {
257 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
258 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
259 "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
260 "Extended PCC Master Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */
261 "Extended PCC Slave Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */
262 "Unknown Subtable Type" /* Reserved */
263 };
264
265 static const char *AcpiDmPmttSubnames[] =
266 {
267 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
268 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
269 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
270 "Unknown Subtable Type" /* Reserved */
271 };
272
273 static const char *AcpiDmPpttSubnames[] =
274 {
275 "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */
276 "Cache Type", /* ACPI_PPTT_TYPE_CACHE */
277 "ID", /* ACPI_PPTT_TYPE_ID */
278 "Unknown Subtable Type" /* Reserved */
279 };
280
281 static const char *AcpiDmSdevSubnames[] =
282 {
283 "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
284 "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
285 "Unknown Subtable Type" /* Reserved */
286 };
287
288 static const char *AcpiDmSratSubnames[] =
289 {
290 "Processor Local APIC/SAPIC Affinity",
291 "Memory Affinity",
292 "Processor Local x2APIC Affinity",
293 "GICC Affinity",
294 "GIC ITS Affinity", /* Acpi 6.2 */
295 "Unknown Subtable Type" /* Reserved */
296 };
297
298 static const char *AcpiDmTpm2Subnames[] =
299 {
300 "Illegal Start Method value",
301 "Reserved",
302 "ACPI Start Method",
303 "Reserved",
304 "Reserved",
305 "Reserved",
306 "Memory Mapped I/O",
307 "Command Response Buffer",
308 "Command Response Buffer with ACPI Start Method",
309 "Reserved",
310 "Reserved",
311 "Command Response Buffer with ARM SMC",
312 "Unknown Subtable Type" /* Reserved */
313 };
314
315 static const char *AcpiDmIvrsSubnames[] =
316 {
317 "Hardware Definition Block",
318 "Memory Definition Block",
319 "Unknown Subtable Type" /* Reserved */
320 };
321
322 static const char *AcpiDmLpitSubnames[] =
323 {
324 "Native C-state Idle Structure",
325 "Unknown Subtable Type" /* Reserved */
326 };
327
328 #define ACPI_FADT_PM_RESERVED 9
329
330 static const char *AcpiDmFadtProfiles[] =
331 {
332 "Unspecified",
333 "Desktop",
334 "Mobile",
335 "Workstation",
336 "Enterprise Server",
337 "SOHO Server",
338 "Appliance PC",
339 "Performance Server",
340 "Tablet",
341 "Unknown Profile Type"
342 };
343
344 #define ACPI_GAS_WIDTH_RESERVED 5
345
346 static const char *AcpiDmGasAccessWidth[] =
347 {
348 "Undefined/Legacy",
349 "Byte Access:8",
350 "Word Access:16",
351 "DWord Access:32",
352 "QWord Access:64",
353 "Unknown Width Encoding"
354 };
355
356
357 /*******************************************************************************
358 *
359 * ACPI Table Data, indexed by signature.
360 *
361 * Each entry contains: Signature, Table Info, Handler, DtHandler,
362 * Template, Description
363 *
364 * Simple tables have only a TableInfo structure, complex tables have a
365 * handler. This table must be NULL terminated. RSDP and FACS are
366 * special-cased elsewhere.
367 *
368 * Note: Any tables added here should be duplicated within AcpiSupportedTables
369 * in the file common/ahtable.c
370 *
371 ******************************************************************************/
372
373 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
374 {
375 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
376 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
377 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
378 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
379 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
380 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
381 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
382 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
383 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
384 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
385 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
386 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
387 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
388 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
389 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
390 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
391 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
392 {ACPI_SIG_HMAT, NULL, AcpiDmDumpHmat, DtCompileHmat, TemplateHmat},
393 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
394 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
395 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
396 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
397 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
398 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
399 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
400 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
401 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
402 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
403 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
404 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
405 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
406 {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt},
407 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
408 {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt},
409 {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
410 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
411 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
412 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
413 {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei},
414 {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev},
415 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
416 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
417 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
418 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
419 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
420 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
421 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
422 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2},
423 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
424 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
425 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
426 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
427 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
428 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
429 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
430 {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt, NULL, NULL, TemplateWsmt},
431 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
432 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
433 {NULL, NULL, NULL, NULL, NULL}
434 };
435
436
437 /*******************************************************************************
438 *
439 * FUNCTION: AcpiDmGenerateChecksum
440 *
441 * PARAMETERS: Table - Pointer to table to be checksummed
442 * Length - Length of the table
443 * OriginalChecksum - Value of the checksum field
444 *
445 * RETURN: 8 bit checksum of buffer
446 *
447 * DESCRIPTION: Computes an 8 bit checksum of the table.
448 *
449 ******************************************************************************/
450
451 UINT8
452 AcpiDmGenerateChecksum (
453 void *Table,
454 UINT32 Length,
455 UINT8 OriginalChecksum)
456 {
457 UINT8 Checksum;
458
459
460 /* Sum the entire table as-is */
461
462 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
463
464 /* Subtract off the existing checksum value in the table */
465
466 Checksum = (UINT8) (Checksum - OriginalChecksum);
467
468 /* Compute the final checksum */
469
470 Checksum = (UINT8) (0 - Checksum);
471 return (Checksum);
472 }
473
474
475 /*******************************************************************************
476 *
477 * FUNCTION: AcpiDmGetTableData
478 *
479 * PARAMETERS: Signature - ACPI signature (4 chars) to match
480 *
481 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
482 *
483 * DESCRIPTION: Find a match in the global table of supported ACPI tables
484 *
485 ******************************************************************************/
486
487 const ACPI_DMTABLE_DATA *
488 AcpiDmGetTableData (
489 char *Signature)
490 {
491 const ACPI_DMTABLE_DATA *Info;
492
493
494 for (Info = AcpiDmTableData; Info->Signature; Info++)
495 {
496 if (ACPI_COMPARE_NAME (Signature, Info->Signature))
497 {
498 return (Info);
499 }
500 }
501
502 return (NULL);
503 }
504
505
506 /*******************************************************************************
507 *
508 * FUNCTION: AcpiDmDumpDataTable
509 *
510 * PARAMETERS: Table - An ACPI table
511 *
512 * RETURN: None.
513 *
514 * DESCRIPTION: Format the contents of an ACPI data table (any table other
515 * than an SSDT or DSDT that does not contain executable AML code)
516 *
517 ******************************************************************************/
518
519 void
520 AcpiDmDumpDataTable (
521 ACPI_TABLE_HEADER *Table)
522 {
523 ACPI_STATUS Status;
524 const ACPI_DMTABLE_DATA *TableData;
525 UINT32 Length;
526
527
528 /* Ignore tables that contain AML */
529
530 if (AcpiUtIsAmlTable (Table))
531 {
532 if (Gbl_VerboseTemplates)
533 {
534 /* Dump the raw table data */
535
536 Length = Table->Length;
537
538 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
539 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
540 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
541 Length, DB_BYTE_DISPLAY, 0);
542 AcpiOsPrintf (" */\n");
543 }
544 return;
545 }
546
547 /*
548 * Handle tables that don't use the common ACPI table header structure.
549 * Currently, these are the FACS, RSDP, and S3PT.
550 */
551 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
552 {
553 Length = Table->Length;
554 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
555 if (ACPI_FAILURE (Status))
556 {
557 return;
558 }
559 }
560 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
561 {
562 Length = AcpiDmDumpRsdp (Table);
563 }
564 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
565 {
566 Length = AcpiDmDumpS3pt (Table);
567 }
568 else
569 {
570 /*
571 * All other tables must use the common ACPI table header, dump it now
572 */
573 Length = Table->Length;
574 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
575 if (ACPI_FAILURE (Status))
576 {
577 return;
578 }
579 AcpiOsPrintf ("\n");
580
581 /* Match signature and dispatch appropriately */
582
583 TableData = AcpiDmGetTableData (Table->Signature);
584 if (!TableData)
585 {
586 if (!strncmp (Table->Signature, "OEM", 3))
587 {
588 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
589 Table->Signature);
590 }
591 else
592 {
593 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
594 Table->Signature);
595
596 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
597 Table->Signature);
598
599 if (!AcpiGbl_ForceAmlDisassembly)
600 {
601 fprintf (stderr, "decoding ACPI table header only\n");
602 }
603 else
604 {
605 fprintf (stderr, "assuming table contains valid AML code\n");
606 }
607 }
608 }
609 else if (TableData->TableHandler)
610 {
611 /* Complex table, has a handler */
612
613 TableData->TableHandler (Table);
614 }
615 else if (TableData->TableInfo)
616 {
617 /* Simple table, just walk the info table */
618
619 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
620 if (ACPI_FAILURE (Status))
621 {
622 return;
623 }
624 }
625 }
626
627 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
628 {
629 /* Dump the raw table data */
630
631 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
632 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
633 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
634 Length, DB_BYTE_DISPLAY, 0);
635 }
636 }
637
638
639 /*******************************************************************************
640 *
641 * FUNCTION: AcpiDmLineHeader
642 *
643 * PARAMETERS: Offset - Current byte offset, from table start
644 * ByteLength - Length of the field in bytes, 0 for flags
645 * Name - Name of this field
646 *
647 * RETURN: None
648 *
649 * DESCRIPTION: Utility routines for formatting output lines. Displays the
650 * current table offset in hex and decimal, the field length,
651 * and the field name.
652 *
653 ******************************************************************************/
654
655 void
656 AcpiDmLineHeader (
657 UINT32 Offset,
658 UINT32 ByteLength,
659 char *Name)
660 {
661
662 /* Allow a null name for fields that span multiple lines (large buffers) */
663
664 if (!Name)
665 {
666 Name = "";
667 }
668
669 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
670 {
671 if (ByteLength)
672 {
673 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
674 }
675 else
676 {
677 if (*Name)
678 {
679 AcpiOsPrintf ("%41s : ", Name);
680 }
681 else
682 {
683 AcpiOsPrintf ("%41s ", Name);
684 }
685 }
686 }
687 else /* Normal disassembler or verbose template */
688 {
689 if (ByteLength)
690 {
691 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
692 Offset, Offset, ByteLength, Name);
693 }
694 else
695 {
696 if (*Name)
697 {
698 AcpiOsPrintf ("%44s : ", Name);
699 }
700 else
701 {
702 AcpiOsPrintf ("%44s ", Name);
703 }
704 }
705 }
706 }
707
708 void
709 AcpiDmLineHeader2 (
710 UINT32 Offset,
711 UINT32 ByteLength,
712 char *Name,
713 UINT32 Value)
714 {
715
716 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
717 {
718 if (ByteLength)
719 {
720 AcpiOsPrintf ("[%.4d] %30s %3d : ",
721 ByteLength, Name, Value);
722 }
723 else
724 {
725 AcpiOsPrintf ("%36s % 3d : ",
726 Name, Value);
727 }
728 }
729 else /* Normal disassembler or verbose template */
730 {
731 if (ByteLength)
732 {
733 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
734 Offset, Offset, ByteLength, Name, Value);
735 }
736 else
737 {
738 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
739 Offset, Offset, Name, Value);
740 }
741 }
742 }
743
744
745 /*******************************************************************************
746 *
747 * FUNCTION: AcpiDmDumpTable
748 *
749 * PARAMETERS: TableLength - Length of the entire ACPI table
750 * TableOffset - Starting offset within the table for this
751 * sub-descriptor (0 if main table)
752 * Table - The ACPI table
753 * SubtableLength - Length of this sub-descriptor
754 * Info - Info table for this ACPI table
755 *
756 * RETURN: Status
757 *
758 * DESCRIPTION: Display ACPI table contents by walking the Info table.
759 *
760 * Note: This function must remain in sync with DtGetFieldLength.
761 *
762 ******************************************************************************/
763
764 ACPI_STATUS
765 AcpiDmDumpTable (
766 UINT32 TableLength,
767 UINT32 TableOffset,
768 void *Table,
769 UINT32 SubtableLength,
770 ACPI_DMTABLE_INFO *Info)
771 {
772 UINT8 *Target;
773 UINT32 CurrentOffset;
774 UINT32 ByteLength;
775 UINT8 Temp8;
776 UINT16 Temp16;
777 UINT32 Temp32;
778 UINT64 Value;
779 const AH_TABLE *TableData;
780 const char *Name;
781 BOOLEAN LastOutputBlankLine = FALSE;
782 ACPI_STATUS Status;
783 char RepairedName[8];
784
785
786 if (!Info)
787 {
788 AcpiOsPrintf ("Display not implemented\n");
789 return (AE_NOT_IMPLEMENTED);
790 }
791
792 /* Walk entire Info table; Null name terminates */
793
794 for (; Info->Name; Info++)
795 {
796 /*
797 * Target points to the field within the ACPI Table. CurrentOffset is
798 * the offset of the field from the start of the main table.
799 */
800 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
801 CurrentOffset = TableOffset + Info->Offset;
802
803 /* Check for beyond subtable end or (worse) beyond EOT */
804
805 if (SubtableLength && (Info->Offset >= SubtableLength))
806 {
807 AcpiOsPrintf (
808 "/**** ACPI subtable terminates early - "
809 "may be older version (dump table) */\n");
810
811 /* Move on to next subtable */
812
813 return (AE_OK);
814 }
815
816 if (CurrentOffset >= TableLength)
817 {
818 AcpiOsPrintf (
819 "/**** ACPI table terminates "
820 "in the middle of a data structure! (dump table) */\n");
821 return (AE_BAD_DATA);
822 }
823
824 /* Generate the byte length for this field */
825
826 switch (Info->Opcode)
827 {
828 case ACPI_DMT_UINT8:
829 case ACPI_DMT_CHKSUM:
830 case ACPI_DMT_SPACEID:
831 case ACPI_DMT_ACCWIDTH:
832 case ACPI_DMT_IVRS:
833 case ACPI_DMT_GTDT:
834 case ACPI_DMT_MADT:
835 case ACPI_DMT_PCCT:
836 case ACPI_DMT_PMTT:
837 case ACPI_DMT_PPTT:
838 case ACPI_DMT_SDEV:
839 case ACPI_DMT_SRAT:
840 case ACPI_DMT_ASF:
841 case ACPI_DMT_HESTNTYP:
842 case ACPI_DMT_FADTPM:
843 case ACPI_DMT_EINJACT:
844 case ACPI_DMT_EINJINST:
845 case ACPI_DMT_ERSTACT:
846 case ACPI_DMT_ERSTINST:
847 case ACPI_DMT_DMAR_SCOPE:
848
849 ByteLength = 1;
850 break;
851
852 case ACPI_DMT_UINT16:
853 case ACPI_DMT_DMAR:
854 case ACPI_DMT_HEST:
855 case ACPI_DMT_HMAT:
856 case ACPI_DMT_NFIT:
857
858 ByteLength = 2;
859 break;
860
861 case ACPI_DMT_UINT24:
862
863 ByteLength = 3;
864 break;
865
866 case ACPI_DMT_UINT32:
867 case ACPI_DMT_NAME4:
868 case ACPI_DMT_SIG:
869 case ACPI_DMT_LPIT:
870 case ACPI_DMT_TPM2:
871
872 ByteLength = 4;
873 break;
874
875 case ACPI_DMT_UINT40:
876
877 ByteLength = 5;
878 break;
879
880 case ACPI_DMT_UINT48:
881 case ACPI_DMT_NAME6:
882
883 ByteLength = 6;
884 break;
885
886 case ACPI_DMT_UINT56:
887 case ACPI_DMT_BUF7:
888
889 ByteLength = 7;
890 break;
891
892 case ACPI_DMT_UINT64:
893 case ACPI_DMT_NAME8:
894
895 ByteLength = 8;
896 break;
897
898 case ACPI_DMT_BUF10:
899
900 ByteLength = 10;
901 break;
902
903 case ACPI_DMT_BUF12:
904
905 ByteLength = 12;
906 break;
907
908 case ACPI_DMT_BUF16:
909 case ACPI_DMT_UUID:
910
911 ByteLength = 16;
912 break;
913
914 case ACPI_DMT_BUF128:
915
916 ByteLength = 128;
917 break;
918
919 case ACPI_DMT_UNICODE:
920 case ACPI_DMT_BUFFER:
921 case ACPI_DMT_RAW_BUFFER:
922
923 ByteLength = SubtableLength;
924 break;
925
926 case ACPI_DMT_STRING:
927
928 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
929 break;
930
931 case ACPI_DMT_GAS:
932
933 if (!LastOutputBlankLine)
934 {
935 AcpiOsPrintf ("\n");
936 LastOutputBlankLine = TRUE;
937 }
938
939 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
940 break;
941
942 case ACPI_DMT_HESTNTFY:
943
944 if (!LastOutputBlankLine)
945 {
946 AcpiOsPrintf ("\n");
947 LastOutputBlankLine = TRUE;
948 }
949
950 ByteLength = sizeof (ACPI_HEST_NOTIFY);
951 break;
952
953 case ACPI_DMT_IORTMEM:
954
955 if (!LastOutputBlankLine)
956 {
957 LastOutputBlankLine = FALSE;
958 }
959
960 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
961 break;
962
963 default:
964
965 ByteLength = 0;
966 break;
967 }
968
969 /* Check if we are beyond a subtable, or (worse) beyond EOT */
970
971 if (CurrentOffset + ByteLength > TableLength)
972 {
973 if (SubtableLength)
974 {
975 AcpiOsPrintf (
976 "/**** ACPI subtable terminates early - "
977 "may be older version (dump table) */\n");
978
979 /* Move on to next subtable */
980
981 return (AE_OK);
982 }
983
984 AcpiOsPrintf (
985 "/**** ACPI table terminates "
986 "in the middle of a data structure! */\n");
987 return (AE_BAD_DATA);
988 }
989
990 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
991 {
992 AcpiOsPrintf ("%s", Info->Name);
993 continue;
994 }
995
996 /* Start a new line and decode the opcode */
997
998 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
999
1000 switch (Info->Opcode)
1001 {
1002 /* Single-bit Flag fields. Note: Opcode is the bit position */
1003
1004 case ACPI_DMT_FLAG0:
1005 case ACPI_DMT_FLAG1:
1006 case ACPI_DMT_FLAG2:
1007 case ACPI_DMT_FLAG3:
1008 case ACPI_DMT_FLAG4:
1009 case ACPI_DMT_FLAG5:
1010 case ACPI_DMT_FLAG6:
1011 case ACPI_DMT_FLAG7:
1012
1013 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1014 break;
1015
1016 /* 2-bit Flag fields */
1017
1018 case ACPI_DMT_FLAGS0:
1019
1020 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1021 break;
1022
1023 case ACPI_DMT_FLAGS1:
1024
1025 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1026 break;
1027
1028 case ACPI_DMT_FLAGS2:
1029
1030 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1031 break;
1032
1033 case ACPI_DMT_FLAGS4:
1034
1035 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1036 break;
1037
1038 case ACPI_DMT_FLAGS4_0:
1039
1040 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F);
1041 break;
1042
1043 case ACPI_DMT_FLAGS4_4:
1044
1045 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F);
1046 break;
1047
1048 case ACPI_DMT_FLAGS4_8:
1049
1050 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F);
1051 break;
1052
1053 case ACPI_DMT_FLAGS4_12:
1054
1055 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F);
1056 break;
1057
1058 case ACPI_DMT_FLAGS16_16:
1059
1060 AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF);
1061 break;
1062
1063 /* Integer Data Types */
1064
1065 case ACPI_DMT_UINT8:
1066 case ACPI_DMT_UINT16:
1067 case ACPI_DMT_UINT24:
1068 case ACPI_DMT_UINT32:
1069 case ACPI_DMT_UINT40:
1070 case ACPI_DMT_UINT48:
1071 case ACPI_DMT_UINT56:
1072 case ACPI_DMT_UINT64:
1073 /*
1074 * Dump bytes - high byte first, low byte last.
1075 * Note: All ACPI tables are little-endian.
1076 */
1077 Value = 0;
1078 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1079 {
1080 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1081 Value |= Target[Temp8 - 1];
1082 Value <<= 8;
1083 }
1084
1085 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1086 {
1087 AcpiOsPrintf (" [Optional field not present]");
1088 }
1089
1090 AcpiOsPrintf ("\n");
1091 break;
1092
1093 case ACPI_DMT_BUF7:
1094 case ACPI_DMT_BUF10:
1095 case ACPI_DMT_BUF12:
1096 case ACPI_DMT_BUF16:
1097 case ACPI_DMT_BUF128:
1098 /*
1099 * Buffer: Size depends on the opcode and was set above.
1100 * Each hex byte is separated with a space.
1101 * Multiple lines are separated by line continuation char.
1102 */
1103 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1104 {
1105 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1106 if ((UINT32) (Temp16 + 1) < ByteLength)
1107 {
1108 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1109 {
1110 AcpiOsPrintf (" \\\n"); /* Line continuation */
1111 AcpiDmLineHeader (0, 0, NULL);
1112 }
1113 else
1114 {
1115 AcpiOsPrintf (" ");
1116 }
1117 }
1118 }
1119
1120 AcpiOsPrintf ("\n");
1121 break;
1122
1123 case ACPI_DMT_UUID:
1124
1125 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1126
1127 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1128
1129 AcpiOsPrintf ("%s\n", MsgBuffer);
1130 break;
1131
1132 case ACPI_DMT_STRING:
1133
1134 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1135 break;
1136
1137 /* Fixed length ASCII name fields */
1138
1139 case ACPI_DMT_SIG:
1140
1141 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1142 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1143
1144 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1145 if (TableData)
1146 {
1147 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1148 }
1149 else
1150 {
1151 AcpiOsPrintf ("\n");
1152 }
1153 break;
1154
1155 case ACPI_DMT_NAME4:
1156
1157 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1158 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1159 break;
1160
1161 case ACPI_DMT_NAME6:
1162
1163 AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1164 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1165 break;
1166
1167 case ACPI_DMT_NAME8:
1168
1169 AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1170 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1171 break;
1172
1173 /* Special Data Types */
1174
1175 case ACPI_DMT_CHKSUM:
1176
1177 /* Checksum, display and validate */
1178
1179 AcpiOsPrintf ("%2.2X", *Target);
1180 Temp8 = AcpiDmGenerateChecksum (Table,
1181 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1182 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1183
1184 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1185 {
1186 AcpiOsPrintf (
1187 " /* Incorrect checksum, should be %2.2X */", Temp8);
1188 }
1189
1190 AcpiOsPrintf ("\n");
1191 break;
1192
1193 case ACPI_DMT_SPACEID:
1194
1195 /* Address Space ID */
1196
1197 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1198 break;
1199
1200 case ACPI_DMT_ACCWIDTH:
1201
1202 /* Encoded Access Width */
1203
1204 Temp8 = *Target;
1205 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1206 {
1207 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1208 }
1209
1210 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1211 break;
1212
1213 case ACPI_DMT_GAS:
1214
1215 /* Generic Address Structure */
1216
1217 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1218 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1219 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1220 if (ACPI_FAILURE (Status))
1221 {
1222 return (Status);
1223 }
1224
1225 AcpiOsPrintf ("\n");
1226 LastOutputBlankLine = TRUE;
1227 break;
1228
1229 case ACPI_DMT_ASF:
1230
1231 /* ASF subtable types */
1232
1233 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1234 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1235 {
1236 Temp16 = ACPI_ASF_TYPE_RESERVED;
1237 }
1238
1239 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1240 break;
1241
1242 case ACPI_DMT_DMAR:
1243
1244 /* DMAR subtable types */
1245
1246 Temp16 = ACPI_GET16 (Target);
1247 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1248 {
1249 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1250 }
1251
1252 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1253 AcpiDmDmarSubnames[Temp16]);
1254 break;
1255
1256 case ACPI_DMT_DMAR_SCOPE:
1257
1258 /* DMAR device scope types */
1259
1260 Temp8 = *Target;
1261 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1262 {
1263 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1264 }
1265
1266 AcpiOsPrintf (UINT8_FORMAT, *Target,
1267 AcpiDmDmarScope[Temp8]);
1268 break;
1269
1270 case ACPI_DMT_EINJACT:
1271
1272 /* EINJ Action types */
1273
1274 Temp8 = *Target;
1275 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1276 {
1277 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1278 }
1279
1280 AcpiOsPrintf (UINT8_FORMAT, *Target,
1281 AcpiDmEinjActions[Temp8]);
1282 break;
1283
1284 case ACPI_DMT_EINJINST:
1285
1286 /* EINJ Instruction types */
1287
1288 Temp8 = *Target;
1289 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1290 {
1291 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1292 }
1293
1294 AcpiOsPrintf (UINT8_FORMAT, *Target,
1295 AcpiDmEinjInstructions[Temp8]);
1296 break;
1297
1298 case ACPI_DMT_ERSTACT:
1299
1300 /* ERST Action types */
1301
1302 Temp8 = *Target;
1303 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1304 {
1305 Temp8 = ACPI_ERST_ACTION_RESERVED;
1306 }
1307
1308 AcpiOsPrintf (UINT8_FORMAT, *Target,
1309 AcpiDmErstActions[Temp8]);
1310 break;
1311
1312 case ACPI_DMT_ERSTINST:
1313
1314 /* ERST Instruction types */
1315
1316 Temp8 = *Target;
1317 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1318 {
1319 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1320 }
1321
1322 AcpiOsPrintf (UINT8_FORMAT, *Target,
1323 AcpiDmErstInstructions[Temp8]);
1324 break;
1325
1326 case ACPI_DMT_GTDT:
1327
1328 /* GTDT subtable types */
1329
1330 Temp8 = *Target;
1331 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1332 {
1333 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1334 }
1335
1336 AcpiOsPrintf (UINT8_FORMAT, *Target,
1337 AcpiDmGtdtSubnames[Temp8]);
1338 break;
1339
1340 case ACPI_DMT_HEST:
1341
1342 /* HEST subtable types */
1343
1344 Temp16 = ACPI_GET16 (Target);
1345 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1346 {
1347 Temp16 = ACPI_HEST_TYPE_RESERVED;
1348 }
1349
1350 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1351 AcpiDmHestSubnames[Temp16]);
1352 break;
1353
1354 case ACPI_DMT_HESTNTFY:
1355
1356 AcpiOsPrintf (STRING_FORMAT,
1357 "Hardware Error Notification Structure");
1358
1359 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1360 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1361 if (ACPI_FAILURE (Status))
1362 {
1363 return (Status);
1364 }
1365
1366 AcpiOsPrintf ("\n");
1367 LastOutputBlankLine = TRUE;
1368 break;
1369
1370 case ACPI_DMT_HESTNTYP:
1371
1372 /* HEST Notify types */
1373
1374 Temp8 = *Target;
1375 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1376 {
1377 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1378 }
1379
1380 AcpiOsPrintf (UINT8_FORMAT, *Target,
1381 AcpiDmHestNotifySubnames[Temp8]);
1382 break;
1383
1384 case ACPI_DMT_HMAT:
1385
1386 /* HMAT subtable types */
1387
1388 Temp16 = *Target;
1389 if (Temp16 > ACPI_HMAT_TYPE_RESERVED)
1390 {
1391 Temp16 = ACPI_HMAT_TYPE_RESERVED;
1392 }
1393
1394 AcpiOsPrintf (UINT16_FORMAT, *Target,
1395 AcpiDmHmatSubnames[Temp16]);
1396 break;
1397
1398 case ACPI_DMT_IORTMEM:
1399
1400 AcpiOsPrintf (STRING_FORMAT,
1401 "IORT Memory Access Properties");
1402
1403 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1404 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1405 if (ACPI_FAILURE (Status))
1406 {
1407 return (Status);
1408 }
1409
1410 LastOutputBlankLine = TRUE;
1411 break;
1412
1413 case ACPI_DMT_MADT:
1414
1415 /* MADT subtable types */
1416
1417 Temp8 = *Target;
1418 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1419 {
1420 Temp8 = ACPI_MADT_TYPE_RESERVED;
1421 }
1422
1423 AcpiOsPrintf (UINT8_FORMAT, *Target,
1424 AcpiDmMadtSubnames[Temp8]);
1425 break;
1426
1427 case ACPI_DMT_NFIT:
1428
1429 /* NFIT subtable types */
1430
1431 Temp16 = ACPI_GET16 (Target);
1432 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1433 {
1434 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1435 }
1436
1437 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1438 AcpiDmNfitSubnames[Temp16]);
1439 break;
1440
1441 case ACPI_DMT_PCCT:
1442
1443 /* PCCT subtable types */
1444
1445 Temp8 = *Target;
1446 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1447 {
1448 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1449 }
1450
1451 AcpiOsPrintf (UINT8_FORMAT, *Target,
1452 AcpiDmPcctSubnames[Temp8]);
1453 break;
1454
1455 case ACPI_DMT_PMTT:
1456
1457 /* PMTT subtable types */
1458
1459 Temp8 = *Target;
1460 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1461 {
1462 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1463 }
1464
1465 AcpiOsPrintf (UINT8_FORMAT, *Target,
1466 AcpiDmPmttSubnames[Temp8]);
1467 break;
1468
1469 case ACPI_DMT_PPTT:
1470
1471 /* PPTT subtable types */
1472
1473 Temp8 = *Target;
1474 if (Temp8 > ACPI_PPTT_TYPE_RESERVED)
1475 {
1476 Temp8 = ACPI_PPTT_TYPE_RESERVED;
1477 }
1478
1479 AcpiOsPrintf (UINT8_FORMAT, *Target,
1480 AcpiDmPpttSubnames[Temp8]);
1481 break;
1482
1483 case ACPI_DMT_UNICODE:
1484
1485 if (ByteLength == 0)
1486 {
1487 AcpiOsPrintf ("/* Zero-length Data */\n");
1488 break;
1489 }
1490
1491 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1492 break;
1493
1494 case ACPI_DMT_RAW_BUFFER:
1495
1496 if (ByteLength == 0)
1497 {
1498 AcpiOsPrintf ("/* Zero-length Data */\n");
1499 break;
1500 }
1501
1502 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1503 CurrentOffset, NULL);
1504 break;
1505
1506 case ACPI_DMT_SDEV:
1507
1508 /* SDEV subtable types */
1509
1510 Temp8 = *Target;
1511 if (Temp8 > ACPI_SDEV_TYPE_RESERVED)
1512 {
1513 Temp8 = ACPI_SDEV_TYPE_RESERVED;
1514 }
1515
1516 AcpiOsPrintf (UINT8_FORMAT, *Target,
1517 AcpiDmSdevSubnames[Temp8]);
1518 break;
1519
1520 case ACPI_DMT_SRAT:
1521
1522 /* SRAT subtable types */
1523
1524 Temp8 = *Target;
1525 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1526 {
1527 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1528 }
1529
1530 AcpiOsPrintf (UINT8_FORMAT, *Target,
1531 AcpiDmSratSubnames[Temp8]);
1532 break;
1533
1534 case ACPI_DMT_TPM2:
1535
1536 /* TPM2 Start Method types */
1537
1538 Temp8 = *Target;
1539 if (Temp8 > ACPI_TPM2_RESERVED)
1540 {
1541 Temp8 = ACPI_TPM2_RESERVED;
1542 }
1543
1544 AcpiOsPrintf (UINT8_FORMAT, *Target,
1545 AcpiDmTpm2Subnames[Temp8]);
1546 break;
1547
1548
1549
1550 case ACPI_DMT_FADTPM:
1551
1552 /* FADT Preferred PM Profile names */
1553
1554 Temp8 = *Target;
1555 if (Temp8 > ACPI_FADT_PM_RESERVED)
1556 {
1557 Temp8 = ACPI_FADT_PM_RESERVED;
1558 }
1559
1560 AcpiOsPrintf (UINT8_FORMAT, *Target,
1561 AcpiDmFadtProfiles[Temp8]);
1562 break;
1563
1564 case ACPI_DMT_IVRS:
1565
1566 /* IVRS subtable types */
1567
1568 Temp8 = *Target;
1569 switch (Temp8)
1570 {
1571 case ACPI_IVRS_TYPE_HARDWARE:
1572
1573 Name = AcpiDmIvrsSubnames[0];
1574 break;
1575
1576 case ACPI_IVRS_TYPE_MEMORY1:
1577 case ACPI_IVRS_TYPE_MEMORY2:
1578 case ACPI_IVRS_TYPE_MEMORY3:
1579
1580 Name = AcpiDmIvrsSubnames[1];
1581 break;
1582
1583 default:
1584
1585 Name = AcpiDmIvrsSubnames[2];
1586 break;
1587 }
1588
1589 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1590 break;
1591
1592 case ACPI_DMT_LPIT:
1593
1594 /* LPIT subtable types */
1595
1596 Temp32 = ACPI_GET32 (Target);
1597 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1598 {
1599 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1600 }
1601
1602 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1603 AcpiDmLpitSubnames[Temp32]);
1604 break;
1605
1606 case ACPI_DMT_EXIT:
1607
1608 return (AE_OK);
1609
1610 default:
1611
1612 ACPI_ERROR ((AE_INFO,
1613 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1614 return (AE_SUPPORT);
1615 }
1616 }
1617
1618 if (TableOffset && !SubtableLength)
1619 {
1620 /*
1621 * If this table is not the main table, the subtable must have a
1622 * valid length
1623 */
1624 AcpiOsPrintf ("Invalid zero length subtable\n");
1625 return (AE_BAD_DATA);
1626 }
1627
1628 return (AE_OK);
1629 }
1630