1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdisasm.h>
47 #include <contrib/dev/acpica/include/actables.h>
48 #include <contrib/dev/acpica/compiler/aslcompiler.h>
49 #include <contrib/dev/acpica/compiler/dtcompiler.h>
51 /* This module used for application-level code only */
53 #define _COMPONENT ACPI_CA_DISASSEMBLER
54 ACPI_MODULE_NAME ("dmtable")
61 /* Common format strings for commented values */
63 #define UINT8_FORMAT "%2.2X [%s]\n"
64 #define UINT16_FORMAT "%4.4X [%s]\n"
65 #define UINT32_FORMAT "%8.8X [%s]\n"
66 #define STRING_FORMAT "[%s]\n"
68 /* These tables map a subtable type to a description string */
70 static const char *AcpiDmAsfSubnames[] =
75 "ASF RMCP Boot Options",
77 "Unknown Subtable Type" /* Reserved */
80 static const char *AcpiDmDmarSubnames[] =
82 "Hardware Unit Definition",
83 "Reserved Memory Region",
84 "Root Port ATS Capability",
85 "Remapping Hardware Static Affinity",
86 "ACPI Namespace Device Declaration",
87 "Unknown Subtable Type" /* Reserved */
90 static const char *AcpiDmDmarScope[] =
93 "PCI Endpoint Device",
96 "Message-capable HPET Device",
98 "Unknown Scope Type" /* Reserved */
101 static const char *AcpiDmEinjActions[] =
110 "Get Command Status",
111 "Set Error Type With Address",
112 "Get Execute Timings",
116 static const char *AcpiDmEinjInstructions[] =
119 "Read Register Value",
121 "Write Register Value",
124 "Unknown Instruction"
127 static const char *AcpiDmErstActions[] =
129 "Begin Write Operation",
130 "Begin Read Operation",
131 "Begin Clear Operation",
136 "Get Command Status",
137 "Get Record Identifier",
138 "Set Record Identifier",
141 "Unused/Unknown Action",
142 "Get Error Address Range",
143 "Get Error Address Length",
144 "Get Error Attributes",
149 static const char *AcpiDmErstInstructions[] =
152 "Read Register Value",
154 "Write Register Value",
167 "Set Source Address",
168 "Set Destination Address",
170 "Unknown Instruction"
173 static const char *AcpiDmGtdtSubnames[] =
175 "Generic Timer Block",
176 "Generic Watchdog Timer",
177 "Unknown Subtable Type" /* Reserved */
180 static const char *AcpiDmHestSubnames[] =
182 "IA-32 Machine Check Exception",
183 "IA-32 Corrected Machine Check",
184 "IA-32 Non-Maskable Interrupt",
185 "Unknown SubTable Type", /* 3 - Reserved */
186 "Unknown SubTable Type", /* 4 - Reserved */
187 "Unknown SubTable Type", /* 5 - Reserved */
188 "PCI Express Root Port AER",
189 "PCI Express AER (AER Endpoint)",
190 "PCI Express/PCI-X Bridge AER",
191 "Generic Hardware Error Source",
192 "Generic Hardware Error Source V2",
193 "Unknown Subtable Type" /* Reserved */
196 static const char *AcpiDmHestNotifySubnames[] =
199 "External Interrupt",
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 "Unknown Notify Type" /* Reserved */
212 static const char *AcpiDmMadtSubnames[] =
214 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
215 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
216 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
217 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
218 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
219 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
220 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
221 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
222 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
223 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
224 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
225 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
226 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
227 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
228 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
229 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
230 "Unknown Subtable Type" /* Reserved */
233 static const char *AcpiDmNfitSubnames[] =
235 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
236 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
237 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
238 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
239 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
240 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
241 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
242 "Unknown Subtable Type" /* Reserved */
245 static const char *AcpiDmPcctSubnames[] =
247 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
248 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
249 "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
250 "Unknown Subtable Type" /* Reserved */
253 static const char *AcpiDmPmttSubnames[] =
255 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
256 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
257 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
258 "Unknown Subtable Type" /* Reserved */
261 static const char *AcpiDmSratSubnames[] =
263 "Processor Local APIC/SAPIC Affinity",
265 "Processor Local x2APIC Affinity",
267 "Unknown Subtable Type" /* Reserved */
270 static const char *AcpiDmIvrsSubnames[] =
272 "Hardware Definition Block",
273 "Memory Definition Block",
274 "Unknown Subtable Type" /* Reserved */
277 static const char *AcpiDmLpitSubnames[] =
279 "Native C-state Idle Structure",
280 "Unknown Subtable Type" /* Reserved */
283 #define ACPI_FADT_PM_RESERVED 9
285 static const char *AcpiDmFadtProfiles[] =
294 "Performance Server",
296 "Unknown Profile Type"
299 #define ACPI_GAS_WIDTH_RESERVED 5
301 static const char *AcpiDmGasAccessWidth[] =
308 "Unknown Width Encoding"
312 /*******************************************************************************
314 * ACPI Table Data, indexed by signature.
316 * Each entry contains: Signature, Table Info, Handler, DtHandler,
317 * Template, Description
319 * Simple tables have only a TableInfo structure, complex tables have a
320 * handler. This table must be NULL terminated. RSDP and FACS are
321 * special-cased elsewhere.
323 * Note: Any tables added here should be duplicated within AcpiSupportedTables
324 * in the file common/ahtable.c
326 ******************************************************************************/
328 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
330 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
331 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
332 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
333 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
334 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
335 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
336 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
337 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
338 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
339 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
340 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
341 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
342 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
343 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
344 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
345 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
346 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
347 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
348 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
349 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
350 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
351 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
352 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
353 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
354 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
355 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
356 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
357 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
358 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
359 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
360 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
361 {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
362 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
363 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
364 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
365 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
366 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
367 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
368 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
369 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
370 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
371 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
372 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
373 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
374 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
375 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
376 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
377 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
378 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
379 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
380 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
381 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
382 {NULL, NULL, NULL, NULL, NULL}
386 /*******************************************************************************
388 * FUNCTION: AcpiDmGenerateChecksum
390 * PARAMETERS: Table - Pointer to table to be checksummed
391 * Length - Length of the table
392 * OriginalChecksum - Value of the checksum field
394 * RETURN: 8 bit checksum of buffer
396 * DESCRIPTION: Computes an 8 bit checksum of the table.
398 ******************************************************************************/
401 AcpiDmGenerateChecksum (
404 UINT8 OriginalChecksum)
409 /* Sum the entire table as-is */
411 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
413 /* Subtract off the existing checksum value in the table */
415 Checksum = (UINT8) (Checksum - OriginalChecksum);
417 /* Compute the final checksum */
419 Checksum = (UINT8) (0 - Checksum);
424 /*******************************************************************************
426 * FUNCTION: AcpiDmGetTableData
428 * PARAMETERS: Signature - ACPI signature (4 chars) to match
430 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
432 * DESCRIPTION: Find a match in the global table of supported ACPI tables
434 ******************************************************************************/
436 const ACPI_DMTABLE_DATA *
440 const ACPI_DMTABLE_DATA *Info;
443 for (Info = AcpiDmTableData; Info->Signature; Info++)
445 if (ACPI_COMPARE_NAME (Signature, Info->Signature))
455 /*******************************************************************************
457 * FUNCTION: AcpiDmDumpDataTable
459 * PARAMETERS: Table - An ACPI table
463 * DESCRIPTION: Format the contents of an ACPI data table (any table other
464 * than an SSDT or DSDT that does not contain executable AML code)
466 ******************************************************************************/
469 AcpiDmDumpDataTable (
470 ACPI_TABLE_HEADER *Table)
473 const ACPI_DMTABLE_DATA *TableData;
477 /* Ignore tables that contain AML */
479 if (AcpiUtIsAmlTable (Table))
481 if (Gbl_VerboseTemplates)
483 /* Dump the raw table data */
485 Length = Table->Length;
487 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
488 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
489 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
490 Length, DB_BYTE_DISPLAY, 0);
491 AcpiOsPrintf (" */\n");
497 * Handle tables that don't use the common ACPI table header structure.
498 * Currently, these are the FACS, RSDP, and S3PT.
500 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
502 Length = Table->Length;
503 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
504 if (ACPI_FAILURE (Status))
509 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
511 Length = AcpiDmDumpRsdp (Table);
513 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
515 Length = AcpiDmDumpS3pt (Table);
520 * All other tables must use the common ACPI table header, dump it now
522 Length = Table->Length;
523 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
524 if (ACPI_FAILURE (Status))
530 /* Match signature and dispatch appropriately */
532 TableData = AcpiDmGetTableData (Table->Signature);
535 if (!strncmp (Table->Signature, "OEM", 3))
537 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
542 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
545 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
548 if (!AcpiGbl_ForceAmlDisassembly)
550 fprintf (stderr, "decoding ACPI table header only\n");
554 fprintf (stderr, "assuming table contains valid AML code\n");
558 else if (TableData->TableHandler)
560 /* Complex table, has a handler */
562 TableData->TableHandler (Table);
564 else if (TableData->TableInfo)
566 /* Simple table, just walk the info table */
568 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
569 if (ACPI_FAILURE (Status))
576 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
578 /* Dump the raw table data */
580 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
581 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
582 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
583 Length, DB_BYTE_DISPLAY, 0);
588 /*******************************************************************************
590 * FUNCTION: AcpiDmLineHeader
592 * PARAMETERS: Offset - Current byte offset, from table start
593 * ByteLength - Length of the field in bytes, 0 for flags
594 * Name - Name of this field
598 * DESCRIPTION: Utility routines for formatting output lines. Displays the
599 * current table offset in hex and decimal, the field length,
600 * and the field name.
602 ******************************************************************************/
611 /* Allow a null name for fields that span multiple lines (large buffers) */
618 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
622 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
628 AcpiOsPrintf ("%41s : ", Name);
632 AcpiOsPrintf ("%41s ", Name);
636 else /* Normal disassembler or verbose template */
640 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
641 Offset, Offset, ByteLength, Name);
647 AcpiOsPrintf ("%44s : ", Name);
651 AcpiOsPrintf ("%44s ", Name);
665 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
669 AcpiOsPrintf ("[%.4d] %30s %3d : ",
670 ByteLength, Name, Value);
674 AcpiOsPrintf ("%36s % 3d : ",
678 else /* Normal disassembler or verbose template */
682 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
683 Offset, Offset, ByteLength, Name, Value);
687 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
688 Offset, Offset, Name, Value);
694 /*******************************************************************************
696 * FUNCTION: AcpiDmDumpTable
698 * PARAMETERS: TableLength - Length of the entire ACPI table
699 * TableOffset - Starting offset within the table for this
700 * sub-descriptor (0 if main table)
701 * Table - The ACPI table
702 * SubtableLength - Length of this sub-descriptor
703 * Info - Info table for this ACPI table
707 * DESCRIPTION: Display ACPI table contents by walking the Info table.
709 * Note: This function must remain in sync with DtGetFieldLength.
711 ******************************************************************************/
718 UINT32 SubtableLength,
719 ACPI_DMTABLE_INFO *Info)
722 UINT32 CurrentOffset;
728 const AH_TABLE *TableData;
730 BOOLEAN LastOutputBlankLine = FALSE;
732 char RepairedName[8];
737 AcpiOsPrintf ("Display not implemented\n");
738 return (AE_NOT_IMPLEMENTED);
741 /* Walk entire Info table; Null name terminates */
743 for (; Info->Name; Info++)
746 * Target points to the field within the ACPI Table. CurrentOffset is
747 * the offset of the field from the start of the main table.
749 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
750 CurrentOffset = TableOffset + Info->Offset;
752 /* Check for beyond subtable end or (worse) beyond EOT */
754 if (SubtableLength && (Info->Offset >= SubtableLength))
757 "/**** ACPI subtable terminates early - "
758 "may be older version (dump table) */\n");
760 /* Move on to next subtable */
765 if (CurrentOffset >= TableLength)
768 "/**** ACPI table terminates "
769 "in the middle of a data structure! (dump table) */\n");
770 return (AE_BAD_DATA);
773 /* Generate the byte length for this field */
775 switch (Info->Opcode)
778 case ACPI_DMT_CHKSUM:
779 case ACPI_DMT_SPACEID:
780 case ACPI_DMT_ACCWIDTH:
788 case ACPI_DMT_HESTNTYP:
789 case ACPI_DMT_FADTPM:
790 case ACPI_DMT_EINJACT:
791 case ACPI_DMT_EINJINST:
792 case ACPI_DMT_ERSTACT:
793 case ACPI_DMT_ERSTINST:
794 case ACPI_DMT_DMAR_SCOPE:
799 case ACPI_DMT_UINT16:
807 case ACPI_DMT_UINT24:
812 case ACPI_DMT_UINT32:
820 case ACPI_DMT_UINT40:
825 case ACPI_DMT_UINT48:
831 case ACPI_DMT_UINT56:
837 case ACPI_DMT_UINT64:
859 case ACPI_DMT_BUF128:
864 case ACPI_DMT_UNICODE:
865 case ACPI_DMT_BUFFER:
866 case ACPI_DMT_RAW_BUFFER:
868 ByteLength = SubtableLength;
871 case ACPI_DMT_STRING:
873 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
878 if (!LastOutputBlankLine)
881 LastOutputBlankLine = TRUE;
884 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
887 case ACPI_DMT_HESTNTFY:
889 if (!LastOutputBlankLine)
892 LastOutputBlankLine = TRUE;
895 ByteLength = sizeof (ACPI_HEST_NOTIFY);
898 case ACPI_DMT_IORTMEM:
900 if (!LastOutputBlankLine)
902 LastOutputBlankLine = FALSE;
905 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
914 /* Check if we are beyond a subtable, or (worse) beyond EOT */
916 if (CurrentOffset + ByteLength > TableLength)
921 "/**** ACPI subtable terminates early - "
922 "may be older version (dump table) */\n");
924 /* Move on to next subtable */
930 "/**** ACPI table terminates "
931 "in the middle of a data structure! */\n");
932 return (AE_BAD_DATA);
935 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
937 AcpiOsPrintf ("%s", Info->Name);
941 /* Start a new line and decode the opcode */
943 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
945 switch (Info->Opcode)
947 /* Single-bit Flag fields. Note: Opcode is the bit position */
958 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
961 /* 2-bit Flag fields */
963 case ACPI_DMT_FLAGS0:
965 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
968 case ACPI_DMT_FLAGS1:
970 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
973 case ACPI_DMT_FLAGS2:
975 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
978 case ACPI_DMT_FLAGS4:
980 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
983 /* Integer Data Types */
986 case ACPI_DMT_UINT16:
987 case ACPI_DMT_UINT24:
988 case ACPI_DMT_UINT32:
989 case ACPI_DMT_UINT40:
990 case ACPI_DMT_UINT48:
991 case ACPI_DMT_UINT56:
992 case ACPI_DMT_UINT64:
994 * Dump bytes - high byte first, low byte last.
995 * Note: All ACPI tables are little-endian.
998 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1000 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1001 Value |= Target[Temp8 - 1];
1005 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1007 AcpiOsPrintf (" [Optional field not present]");
1010 AcpiOsPrintf ("\n");
1014 case ACPI_DMT_BUF10:
1015 case ACPI_DMT_BUF12:
1016 case ACPI_DMT_BUF16:
1017 case ACPI_DMT_BUF128:
1019 * Buffer: Size depends on the opcode and was set above.
1020 * Each hex byte is separated with a space.
1021 * Multiple lines are separated by line continuation char.
1023 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1025 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1026 if ((UINT32) (Temp16 + 1) < ByteLength)
1028 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1030 AcpiOsPrintf (" \\\n"); /* Line continuation */
1031 AcpiDmLineHeader (0, 0, NULL);
1040 AcpiOsPrintf ("\n");
1045 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1047 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1049 AcpiOsPrintf ("%s\n", MsgBuffer);
1052 case ACPI_DMT_STRING:
1054 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1057 /* Fixed length ASCII name fields */
1061 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1062 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1064 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1067 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1071 AcpiOsPrintf ("\n");
1075 case ACPI_DMT_NAME4:
1077 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1078 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1081 case ACPI_DMT_NAME6:
1083 AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1084 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1087 case ACPI_DMT_NAME8:
1089 AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1090 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1093 /* Special Data Types */
1095 case ACPI_DMT_CHKSUM:
1097 /* Checksum, display and validate */
1099 AcpiOsPrintf ("%2.2X", *Target);
1100 Temp8 = AcpiDmGenerateChecksum (Table,
1101 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1102 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1104 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1107 " /* Incorrect checksum, should be %2.2X */", Temp8);
1110 AcpiOsPrintf ("\n");
1113 case ACPI_DMT_SPACEID:
1115 /* Address Space ID */
1117 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1120 case ACPI_DMT_ACCWIDTH:
1122 /* Encoded Access Width */
1125 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1127 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1130 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1135 /* Generic Address Structure */
1137 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1138 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1139 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1140 if (ACPI_FAILURE (Status))
1145 AcpiOsPrintf ("\n");
1146 LastOutputBlankLine = TRUE;
1151 /* ASF subtable types */
1153 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1154 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1156 Temp16 = ACPI_ASF_TYPE_RESERVED;
1159 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1164 /* DMAR subtable types */
1166 Temp16 = ACPI_GET16 (Target);
1167 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1169 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1172 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1173 AcpiDmDmarSubnames[Temp16]);
1176 case ACPI_DMT_DMAR_SCOPE:
1178 /* DMAR device scope types */
1181 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1183 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1186 AcpiOsPrintf (UINT8_FORMAT, *Target,
1187 AcpiDmDmarScope[Temp8]);
1190 case ACPI_DMT_EINJACT:
1192 /* EINJ Action types */
1195 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1197 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1200 AcpiOsPrintf (UINT8_FORMAT, *Target,
1201 AcpiDmEinjActions[Temp8]);
1204 case ACPI_DMT_EINJINST:
1206 /* EINJ Instruction types */
1209 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1211 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1214 AcpiOsPrintf (UINT8_FORMAT, *Target,
1215 AcpiDmEinjInstructions[Temp8]);
1218 case ACPI_DMT_ERSTACT:
1220 /* ERST Action types */
1223 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1225 Temp8 = ACPI_ERST_ACTION_RESERVED;
1228 AcpiOsPrintf (UINT8_FORMAT, *Target,
1229 AcpiDmErstActions[Temp8]);
1232 case ACPI_DMT_ERSTINST:
1234 /* ERST Instruction types */
1237 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1239 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1242 AcpiOsPrintf (UINT8_FORMAT, *Target,
1243 AcpiDmErstInstructions[Temp8]);
1248 /* GTDT subtable types */
1251 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1253 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1256 AcpiOsPrintf (UINT8_FORMAT, *Target,
1257 AcpiDmGtdtSubnames[Temp8]);
1262 /* HEST subtable types */
1264 Temp16 = ACPI_GET16 (Target);
1265 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1267 Temp16 = ACPI_HEST_TYPE_RESERVED;
1270 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1271 AcpiDmHestSubnames[Temp16]);
1274 case ACPI_DMT_HESTNTFY:
1276 AcpiOsPrintf (STRING_FORMAT,
1277 "Hardware Error Notification Structure");
1279 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1280 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1281 if (ACPI_FAILURE (Status))
1286 AcpiOsPrintf ("\n");
1287 LastOutputBlankLine = TRUE;
1290 case ACPI_DMT_HESTNTYP:
1292 /* HEST Notify types */
1295 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1297 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1300 AcpiOsPrintf (UINT8_FORMAT, *Target,
1301 AcpiDmHestNotifySubnames[Temp8]);
1304 case ACPI_DMT_IORTMEM:
1306 AcpiOsPrintf (STRING_FORMAT,
1307 "IORT Memory Access Properties");
1309 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1310 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1311 if (ACPI_FAILURE (Status))
1316 LastOutputBlankLine = TRUE;
1321 /* MADT subtable types */
1324 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1326 Temp8 = ACPI_MADT_TYPE_RESERVED;
1329 AcpiOsPrintf (UINT8_FORMAT, *Target,
1330 AcpiDmMadtSubnames[Temp8]);
1335 /* NFIT subtable types */
1337 Temp16 = ACPI_GET16 (Target);
1338 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1340 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1343 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1344 AcpiDmNfitSubnames[Temp16]);
1349 /* PCCT subtable types */
1352 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1354 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1357 AcpiOsPrintf (UINT8_FORMAT, *Target,
1358 AcpiDmPcctSubnames[Temp8]);
1363 /* PMTT subtable types */
1366 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1368 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1371 AcpiOsPrintf (UINT8_FORMAT, *Target,
1372 AcpiDmPmttSubnames[Temp8]);
1375 case ACPI_DMT_UNICODE:
1377 if (ByteLength == 0)
1379 AcpiOsPrintf ("/* Zero-length Data */\n");
1383 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1386 case ACPI_DMT_RAW_BUFFER:
1388 if (ByteLength == 0)
1390 AcpiOsPrintf ("/* Zero-length Data */\n");
1394 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1395 CurrentOffset, NULL);
1400 /* SRAT subtable types */
1403 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1405 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1408 AcpiOsPrintf (UINT8_FORMAT, *Target,
1409 AcpiDmSratSubnames[Temp8]);
1412 case ACPI_DMT_FADTPM:
1414 /* FADT Preferred PM Profile names */
1417 if (Temp8 > ACPI_FADT_PM_RESERVED)
1419 Temp8 = ACPI_FADT_PM_RESERVED;
1422 AcpiOsPrintf (UINT8_FORMAT, *Target,
1423 AcpiDmFadtProfiles[Temp8]);
1428 /* IVRS subtable types */
1433 case ACPI_IVRS_TYPE_HARDWARE:
1435 Name = AcpiDmIvrsSubnames[0];
1438 case ACPI_IVRS_TYPE_MEMORY1:
1439 case ACPI_IVRS_TYPE_MEMORY2:
1440 case ACPI_IVRS_TYPE_MEMORY3:
1442 Name = AcpiDmIvrsSubnames[1];
1447 Name = AcpiDmIvrsSubnames[2];
1451 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1456 /* LPIT subtable types */
1458 Temp32 = ACPI_GET32 (Target);
1459 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1461 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1464 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1465 AcpiDmLpitSubnames[Temp32]);
1474 ACPI_ERROR ((AE_INFO,
1475 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1476 return (AE_SUPPORT);
1480 if (TableOffset && !SubtableLength)
1483 * If this table is not the main table, the subtable must have a
1486 AcpiOsPrintf ("Invalid zero length subtable\n");
1487 return (AE_BAD_DATA);