1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2015, 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.
48 #include "aslcompiler.h"
49 #include "dtcompiler.h"
51 /* This module used for application-level code only */
53 #define _COMPONENT ACPI_CA_DISASSEMBLER
54 ACPI_MODULE_NAME ("dmtable")
61 /* Local Prototypes */
70 /* Common format strings for commented values */
72 #define UINT8_FORMAT "%2.2X [%s]\n"
73 #define UINT16_FORMAT "%4.4X [%s]\n"
74 #define UINT32_FORMAT "%8.8X [%s]\n"
75 #define STRING_FORMAT "[%s]\n"
77 /* These tables map a subtable type to a description string */
79 static const char *AcpiDmAsfSubnames[] =
84 "ASF RMCP Boot Options",
86 "Unknown Subtable Type" /* Reserved */
89 static const char *AcpiDmDmarSubnames[] =
91 "Hardware Unit Definition",
92 "Reserved Memory Region",
93 "Root Port ATS Capability",
94 "Remapping Hardware Static Affinity",
95 "ACPI Namespace Device Declaration",
96 "Unknown Subtable Type" /* Reserved */
99 static const char *AcpiDmDmarScope[] =
102 "PCI Endpoint Device",
105 "Message-capable HPET Device",
107 "Unknown Scope Type" /* Reserved */
110 static const char *AcpiDmEinjActions[] =
119 "Get Command Status",
120 "Set Error Type With Address",
124 static const char *AcpiDmEinjInstructions[] =
127 "Read Register Value",
129 "Write Register Value",
132 "Unknown Instruction"
135 static const char *AcpiDmErstActions[] =
137 "Begin Write Operation",
138 "Begin Read Operation",
139 "Begin Clear Operation",
144 "Get Command Status",
145 "Get Record Identifier",
146 "Set Record Identifier",
149 "Unused/Unknown Action",
150 "Get Error Address Range",
151 "Get Error Address Length",
152 "Get Error Attributes",
156 static const char *AcpiDmErstInstructions[] =
159 "Read Register Value",
161 "Write Register Value",
174 "Set Source Address",
175 "Set Destination Address",
177 "Unknown Instruction"
180 static const char *AcpiDmGtdtSubnames[] =
182 "Generic Timer Block",
183 "Generic Watchdog Timer",
184 "Unknown Subtable Type" /* Reserved */
187 static const char *AcpiDmHestSubnames[] =
189 "IA-32 Machine Check Exception",
190 "IA-32 Corrected Machine Check",
191 "IA-32 Non-Maskable Interrupt",
192 "Unknown SubTable Type", /* 3 - Reserved */
193 "Unknown SubTable Type", /* 4 - Reserved */
194 "Unknown SubTable Type", /* 5 - Reserved */
195 "PCI Express Root Port AER",
196 "PCI Express AER (AER Endpoint)",
197 "PCI Express/PCI-X Bridge AER",
198 "Generic Hardware Error Source",
199 "Unknown Subtable Type" /* Reserved */
202 static const char *AcpiDmHestNotifySubnames[] =
205 "External Interrupt",
209 "CMCI", /* ACPI 5.0 */
210 "MCE", /* ACPI 5.0 */
211 "Unknown Notify Type" /* Reserved */
214 static const char *AcpiDmMadtSubnames[] =
216 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
217 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
218 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
219 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
220 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
221 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
222 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
223 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
224 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
225 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
226 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
227 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
228 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
229 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
230 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
231 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
232 "Unknown Subtable Type" /* Reserved */
235 static const char *AcpiDmNfitSubnames[] =
237 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
238 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
239 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
240 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
241 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
242 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
243 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
244 "Unknown Subtable Type" /* Reserved */
247 static const char *AcpiDmPcctSubnames[] =
249 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
250 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
251 "Unknown Subtable Type" /* Reserved */
254 static const char *AcpiDmPmttSubnames[] =
256 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
257 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
258 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
259 "Unknown Subtable Type" /* Reserved */
262 static const char *AcpiDmSratSubnames[] =
264 "Processor Local APIC/SAPIC Affinity",
266 "Processor Local x2APIC Affinity",
268 "Unknown Subtable Type" /* Reserved */
271 static const char *AcpiDmIvrsSubnames[] =
273 "Hardware Definition Block",
274 "Memory Definition Block",
275 "Unknown Subtable Type" /* Reserved */
278 static const char *AcpiDmLpitSubnames[] =
280 "Native C-state Idle Structure",
281 "Unknown Subtable Type" /* Reserved */
284 #define ACPI_FADT_PM_RESERVED 9
286 static const char *AcpiDmFadtProfiles[] =
295 "Performance Server",
297 "Unknown Profile Type"
300 #define ACPI_GAS_WIDTH_RESERVED 5
302 static const char *AcpiDmGasAccessWidth[] =
309 "Unknown Width Encoding"
313 /*******************************************************************************
315 * ACPI Table Data, indexed by signature.
317 * Each entry contains: Signature, Table Info, Handler, DtHandler,
318 * Template, Description
320 * Simple tables have only a TableInfo structure, complex tables have a
321 * handler. This table must be NULL terminated. RSDP and FACS are
322 * special-cased elsewhere.
324 * Note: Any tables added here should be duplicated within AcpiSupportedTables
325 * in the file common/ahtable.c
327 ******************************************************************************/
329 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
331 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
332 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
333 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
334 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
335 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
336 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
337 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
338 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
339 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
340 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
341 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
342 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
343 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
344 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
345 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
346 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
347 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
348 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
349 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
350 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
351 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
352 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
353 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
354 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
355 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
356 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
357 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
358 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
359 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
360 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
361 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
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, AcpiDmTableInfoTcpa, NULL, NULL, 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 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
505 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
507 Length = AcpiDmDumpRsdp (Table);
509 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
511 Length = AcpiDmDumpS3pt (Table);
516 * All other tables must use the common ACPI table header, dump it now
518 Length = Table->Length;
519 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
520 if (ACPI_FAILURE (Status))
526 /* Match signature and dispatch appropriately */
528 TableData = AcpiDmGetTableData (Table->Signature);
531 if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
533 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
538 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
541 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
544 if (!AcpiGbl_ForceAmlDisassembly)
546 fprintf (stderr, "decoding ACPI table header only\n");
550 fprintf (stderr, "assuming table contains valid AML code\n");
554 else if (TableData->TableHandler)
556 /* Complex table, has a handler */
558 TableData->TableHandler (Table);
560 else if (TableData->TableInfo)
562 /* Simple table, just walk the info table */
564 AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
568 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
570 /* Dump the raw table data */
572 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
573 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
574 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
575 Length, DB_BYTE_DISPLAY, 0);
580 /*******************************************************************************
582 * FUNCTION: AcpiDmLineHeader
584 * PARAMETERS: Offset - Current byte offset, from table start
585 * ByteLength - Length of the field in bytes, 0 for flags
586 * Name - Name of this field
590 * DESCRIPTION: Utility routines for formatting output lines. Displays the
591 * current table offset in hex and decimal, the field length,
592 * and the field name.
594 ******************************************************************************/
603 /* Allow a null name for fields that span multiple lines (large buffers) */
610 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
614 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
620 AcpiOsPrintf ("%41s : ", Name);
624 AcpiOsPrintf ("%41s ", Name);
628 else /* Normal disassembler or verbose template */
632 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
633 Offset, Offset, ByteLength, Name);
639 AcpiOsPrintf ("%44s : ", Name);
643 AcpiOsPrintf ("%44s ", Name);
657 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
661 AcpiOsPrintf ("[%.4d] %30s %3d : ",
662 ByteLength, Name, Value);
666 AcpiOsPrintf ("%36s % 3d : ",
670 else /* Normal disassembler or verbose template */
674 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
675 Offset, Offset, ByteLength, Name, Value);
679 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
680 Offset, Offset, Name, Value);
686 /*******************************************************************************
688 * FUNCTION: AcpiDmDumpTable
690 * PARAMETERS: TableLength - Length of the entire ACPI table
691 * TableOffset - Starting offset within the table for this
692 * sub-descriptor (0 if main table)
693 * Table - The ACPI table
694 * SubtableLength - Length of this sub-descriptor
695 * Info - Info table for this ACPI table
699 * DESCRIPTION: Display ACPI table contents by walking the Info table.
701 * Note: This function must remain in sync with DtGetFieldLength.
703 ******************************************************************************/
710 UINT32 SubtableLength,
711 ACPI_DMTABLE_INFO *Info)
714 UINT32 CurrentOffset;
720 const AH_TABLE *TableData;
722 BOOLEAN LastOutputBlankLine = FALSE;
723 char RepairedName[8];
728 AcpiOsPrintf ("Display not implemented\n");
729 return (AE_NOT_IMPLEMENTED);
732 /* Walk entire Info table; Null name terminates */
734 for (; Info->Name; Info++)
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.
740 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
741 CurrentOffset = TableOffset + Info->Offset;
743 /* Check for beyond subtable end or (worse) beyond EOT */
745 if (SubtableLength && (Info->Offset >= SubtableLength))
748 "/**** ACPI subtable terminates early - "
749 "may be older version (dump table) */\n");
751 /* Move on to next subtable */
756 if (CurrentOffset >= TableLength)
759 "/**** ACPI table terminates "
760 "in the middle of a data structure! (dump table) */\n");
761 return (AE_BAD_DATA);
764 /* Generate the byte length for this field */
766 switch (Info->Opcode)
769 case ACPI_DMT_CHKSUM:
770 case ACPI_DMT_SPACEID:
771 case ACPI_DMT_ACCWIDTH:
779 case ACPI_DMT_HESTNTYP:
780 case ACPI_DMT_FADTPM:
781 case ACPI_DMT_EINJACT:
782 case ACPI_DMT_EINJINST:
783 case ACPI_DMT_ERSTACT:
784 case ACPI_DMT_ERSTINST:
785 case ACPI_DMT_DMAR_SCOPE:
790 case ACPI_DMT_UINT16:
798 case ACPI_DMT_UINT24:
803 case ACPI_DMT_UINT32:
811 case ACPI_DMT_UINT40:
816 case ACPI_DMT_UINT48:
822 case ACPI_DMT_UINT56:
828 case ACPI_DMT_UINT64:
845 case ACPI_DMT_BUF128:
850 case ACPI_DMT_UNICODE:
851 case ACPI_DMT_BUFFER:
852 case ACPI_DMT_RAW_BUFFER:
854 ByteLength = SubtableLength;
857 case ACPI_DMT_STRING:
859 ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
864 if (!LastOutputBlankLine)
867 LastOutputBlankLine = TRUE;
869 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
872 case ACPI_DMT_HESTNTFY:
874 if (!LastOutputBlankLine)
877 LastOutputBlankLine = TRUE;
879 ByteLength = sizeof (ACPI_HEST_NOTIFY);
882 case ACPI_DMT_IORTMEM:
884 if (!LastOutputBlankLine)
886 LastOutputBlankLine = FALSE;
888 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
897 /* Check if we are beyond a subtable, or (worse) beyond EOT */
899 if (CurrentOffset + ByteLength > TableLength)
904 "/**** ACPI subtable terminates early - "
905 "may be older version (dump table) */\n");
907 /* Move on to next subtable */
913 "/**** ACPI table terminates "
914 "in the middle of a data structure! */\n");
915 return (AE_BAD_DATA);
918 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
920 AcpiOsPrintf ("%s", Info->Name);
924 /* Start a new line and decode the opcode */
926 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
928 switch (Info->Opcode)
930 /* Single-bit Flag fields. Note: Opcode is the bit position */
941 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
944 /* 2-bit Flag fields */
946 case ACPI_DMT_FLAGS0:
948 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
951 case ACPI_DMT_FLAGS1:
953 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
956 case ACPI_DMT_FLAGS2:
958 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
961 case ACPI_DMT_FLAGS4:
963 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
966 /* Integer Data Types */
969 case ACPI_DMT_UINT16:
970 case ACPI_DMT_UINT24:
971 case ACPI_DMT_UINT32:
972 case ACPI_DMT_UINT40:
973 case ACPI_DMT_UINT48:
974 case ACPI_DMT_UINT56:
975 case ACPI_DMT_UINT64:
977 * Dump bytes - high byte first, low byte last.
978 * Note: All ACPI tables are little-endian.
981 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
983 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
984 Value |= Target[Temp8 - 1];
988 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
990 AcpiOsPrintf (" [Optional field not present]");
999 case ACPI_DMT_BUF128:
1001 * Buffer: Size depends on the opcode and was set above.
1002 * Each hex byte is separated with a space.
1003 * Multiple lines are separated by line continuation char.
1005 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1007 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1008 if ((UINT32) (Temp16 + 1) < ByteLength)
1010 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1012 AcpiOsPrintf (" \\\n"); /* Line continuation */
1013 AcpiDmLineHeader (0, 0, NULL);
1021 AcpiOsPrintf ("\n");
1026 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1028 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1030 AcpiOsPrintf ("%s\n", MsgBuffer);
1033 case ACPI_DMT_STRING:
1035 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1038 /* Fixed length ASCII name fields */
1042 AcpiDmCheckAscii (Target, RepairedName, 4);
1043 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1044 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1047 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1051 AcpiOsPrintf ("\n");
1055 case ACPI_DMT_NAME4:
1057 AcpiDmCheckAscii (Target, RepairedName, 4);
1058 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1061 case ACPI_DMT_NAME6:
1063 AcpiDmCheckAscii (Target, RepairedName, 6);
1064 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1067 case ACPI_DMT_NAME8:
1069 AcpiDmCheckAscii (Target, RepairedName, 8);
1070 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1073 /* Special Data Types */
1075 case ACPI_DMT_CHKSUM:
1077 /* Checksum, display and validate */
1079 AcpiOsPrintf ("%2.2X", *Target);
1080 Temp8 = AcpiDmGenerateChecksum (Table,
1081 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1082 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1084 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1087 " /* Incorrect checksum, should be %2.2X */", Temp8);
1089 AcpiOsPrintf ("\n");
1092 case ACPI_DMT_SPACEID:
1094 /* Address Space ID */
1096 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1099 case ACPI_DMT_ACCWIDTH:
1101 /* Encoded Access Width */
1104 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1106 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1109 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1114 /* Generic Address Structure */
1116 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1117 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1118 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1119 AcpiOsPrintf ("\n");
1120 LastOutputBlankLine = TRUE;
1125 /* ASF subtable types */
1127 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1128 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1130 Temp16 = ACPI_ASF_TYPE_RESERVED;
1133 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1138 /* DMAR subtable types */
1140 Temp16 = ACPI_GET16 (Target);
1141 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1143 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1146 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1147 AcpiDmDmarSubnames[Temp16]);
1150 case ACPI_DMT_DMAR_SCOPE:
1152 /* DMAR device scope types */
1155 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1157 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1160 AcpiOsPrintf (UINT8_FORMAT, *Target,
1161 AcpiDmDmarScope[Temp8]);
1164 case ACPI_DMT_EINJACT:
1166 /* EINJ Action types */
1169 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1171 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1174 AcpiOsPrintf (UINT8_FORMAT, *Target,
1175 AcpiDmEinjActions[Temp8]);
1178 case ACPI_DMT_EINJINST:
1180 /* EINJ Instruction types */
1183 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1185 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1188 AcpiOsPrintf (UINT8_FORMAT, *Target,
1189 AcpiDmEinjInstructions[Temp8]);
1192 case ACPI_DMT_ERSTACT:
1194 /* ERST Action types */
1197 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1199 Temp8 = ACPI_ERST_ACTION_RESERVED;
1202 AcpiOsPrintf (UINT8_FORMAT, *Target,
1203 AcpiDmErstActions[Temp8]);
1206 case ACPI_DMT_ERSTINST:
1208 /* ERST Instruction types */
1211 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1213 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1216 AcpiOsPrintf (UINT8_FORMAT, *Target,
1217 AcpiDmErstInstructions[Temp8]);
1222 /* GTDT subtable types */
1225 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1227 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1230 AcpiOsPrintf (UINT8_FORMAT, *Target,
1231 AcpiDmGtdtSubnames[Temp8]);
1236 /* HEST subtable types */
1238 Temp16 = ACPI_GET16 (Target);
1239 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1241 Temp16 = ACPI_HEST_TYPE_RESERVED;
1244 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1245 AcpiDmHestSubnames[Temp16]);
1248 case ACPI_DMT_HESTNTFY:
1250 AcpiOsPrintf (STRING_FORMAT,
1251 "Hardware Error Notification Structure");
1253 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1254 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1255 AcpiOsPrintf ("\n");
1256 LastOutputBlankLine = TRUE;
1259 case ACPI_DMT_HESTNTYP:
1261 /* HEST Notify types */
1264 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1266 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1269 AcpiOsPrintf (UINT8_FORMAT, *Target,
1270 AcpiDmHestNotifySubnames[Temp8]);
1273 case ACPI_DMT_IORTMEM:
1275 AcpiOsPrintf (STRING_FORMAT,
1276 "IORT Memory Access Properties");
1278 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1279 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1280 LastOutputBlankLine = TRUE;
1285 /* MADT subtable types */
1288 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1290 Temp8 = ACPI_MADT_TYPE_RESERVED;
1293 AcpiOsPrintf (UINT8_FORMAT, *Target,
1294 AcpiDmMadtSubnames[Temp8]);
1299 /* NFIT subtable types */
1301 Temp16 = ACPI_GET16 (Target);
1302 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1304 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1307 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1308 AcpiDmNfitSubnames[Temp16]);
1313 /* PCCT subtable types */
1316 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1318 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1321 AcpiOsPrintf (UINT8_FORMAT, *Target,
1322 AcpiDmPcctSubnames[Temp8]);
1327 /* PMTT subtable types */
1330 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1332 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1335 AcpiOsPrintf (UINT8_FORMAT, *Target,
1336 AcpiDmPmttSubnames[Temp8]);
1339 case ACPI_DMT_UNICODE:
1341 if (ByteLength == 0)
1343 AcpiOsPrintf ("/* Zero-length Data */\n");
1347 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1350 case ACPI_DMT_RAW_BUFFER:
1352 if (ByteLength == 0)
1354 AcpiOsPrintf ("/* Zero-length Data */\n");
1358 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1359 CurrentOffset, NULL);
1364 /* SRAT subtable types */
1367 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1369 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1372 AcpiOsPrintf (UINT8_FORMAT, *Target,
1373 AcpiDmSratSubnames[Temp8]);
1376 case ACPI_DMT_FADTPM:
1378 /* FADT Preferred PM Profile names */
1381 if (Temp8 > ACPI_FADT_PM_RESERVED)
1383 Temp8 = ACPI_FADT_PM_RESERVED;
1386 AcpiOsPrintf (UINT8_FORMAT, *Target,
1387 AcpiDmFadtProfiles[Temp8]);
1392 /* IVRS subtable types */
1397 case ACPI_IVRS_TYPE_HARDWARE:
1399 Name = AcpiDmIvrsSubnames[0];
1402 case ACPI_IVRS_TYPE_MEMORY1:
1403 case ACPI_IVRS_TYPE_MEMORY2:
1404 case ACPI_IVRS_TYPE_MEMORY3:
1406 Name = AcpiDmIvrsSubnames[1];
1411 Name = AcpiDmIvrsSubnames[2];
1415 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1420 /* LPIT subtable types */
1422 Temp32 = ACPI_GET32 (Target);
1423 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1425 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1428 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1429 AcpiDmLpitSubnames[Temp32]);
1438 ACPI_ERROR ((AE_INFO,
1439 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1440 return (AE_SUPPORT);
1444 if (TableOffset && !SubtableLength)
1447 * If this table is not the main table, the subtable must have a
1450 AcpiOsPrintf ("Invalid zero length subtable\n");
1451 return (AE_BAD_DATA);
1458 /*******************************************************************************
1460 * FUNCTION: AcpiDmCheckAscii
1462 * PARAMETERS: Name - Ascii string
1463 * Count - Number of characters to check
1467 * DESCRIPTION: Ensure that the requested number of characters are printable
1468 * Ascii characters. Sets non-printable and null chars to <space>.
1470 ******************************************************************************/
1481 for (i = 0; i < Count; i++)
1483 RepairedName[i] = (char) Name[i];
1489 if (!isprint (Name[i]))
1491 RepairedName[i] = ' ';