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")
56 /* Local Prototypes */
65 /* Common format strings for commented values */
67 #define UINT8_FORMAT "%2.2X [%s]\n"
68 #define UINT16_FORMAT "%4.4X [%s]\n"
69 #define UINT32_FORMAT "%8.8X [%s]\n"
70 #define STRING_FORMAT "[%s]\n"
72 /* These tables map a subtable type to a description string */
74 static const char *AcpiDmAsfSubnames[] =
79 "ASF RMCP Boot Options",
81 "Unknown SubTable Type" /* Reserved */
84 static const char *AcpiDmDmarSubnames[] =
86 "Hardware Unit Definition",
87 "Reserved Memory Region",
88 "Root Port ATS Capability",
89 "Remapping Hardware Static Affinity",
90 "ACPI Namespace Device Declaration",
91 "Unknown SubTable Type" /* Reserved */
94 static const char *AcpiDmDmarScope[] =
97 "PCI Endpoint Device",
100 "Message-capable HPET Device",
102 "Unknown Scope Type" /* Reserved */
105 static const char *AcpiDmEinjActions[] =
114 "Get Command Status",
115 "Set Error Type With Address",
119 static const char *AcpiDmEinjInstructions[] =
122 "Read Register Value",
124 "Write Register Value",
127 "Unknown Instruction"
130 static const char *AcpiDmErstActions[] =
132 "Begin Write Operation",
133 "Begin Read Operation",
134 "Begin Clear Operation",
139 "Get Command Status",
140 "Get Record Identifier",
141 "Set Record Identifier",
144 "Unused/Unknown Action",
145 "Get Error Address Range",
146 "Get Error Address Length",
147 "Get Error Attributes",
151 static const char *AcpiDmErstInstructions[] =
154 "Read Register Value",
156 "Write Register Value",
169 "Set Source Address",
170 "Set Destination Address",
172 "Unknown Instruction"
175 static const char *AcpiDmGtdtSubnames[] =
177 "Generic Timer Block",
178 "Generic Watchdog Timer",
179 "Unknown SubTable Type" /* Reserved */
182 static const char *AcpiDmHestSubnames[] =
184 "IA-32 Machine Check Exception",
185 "IA-32 Corrected Machine Check",
186 "IA-32 Non-Maskable Interrupt",
187 "Unknown SubTable Type", /* 3 - Reserved */
188 "Unknown SubTable Type", /* 4 - Reserved */
189 "Unknown SubTable Type", /* 5 - Reserved */
190 "PCI Express Root Port AER",
191 "PCI Express AER (AER Endpoint)",
192 "PCI Express/PCI-X Bridge AER",
193 "Generic Hardware Error Source",
194 "Unknown SubTable Type" /* Reserved */
197 static const char *AcpiDmHestNotifySubnames[] =
200 "External Interrupt",
204 "CMCI", /* ACPI 5.0 */
205 "MCE", /* ACPI 5.0 */
206 "Unknown Notify Type" /* Reserved */
209 static const char *AcpiDmMadtSubnames[] =
211 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
212 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
213 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
214 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
215 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
216 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
217 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
218 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
219 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
220 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
221 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
222 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
223 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
224 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
225 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
226 "Unknown SubTable Type" /* Reserved */
229 static const char *AcpiDmPcctSubnames[] =
231 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
232 "HW-Reduced Communications Subspace",
233 "Unknown SubTable Type" /* Reserved */
236 static const char *AcpiDmPmttSubnames[] =
238 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
239 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
240 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
241 "Unknown SubTable Type" /* Reserved */
244 static const char *AcpiDmSlicSubnames[] =
246 "Public Key Structure",
247 "Windows Marker Structure",
248 "Unknown SubTable Type" /* Reserved */
251 static const char *AcpiDmSratSubnames[] =
253 "Processor Local APIC/SAPIC Affinity",
255 "Processor Local x2APIC Affinity",
257 "Unknown SubTable Type" /* Reserved */
260 static const char *AcpiDmIvrsSubnames[] =
262 "Hardware Definition Block",
263 "Memory Definition Block",
264 "Unknown SubTable Type" /* Reserved */
267 static const char *AcpiDmLpitSubnames[] =
269 "Native C-state Idle Structure",
270 "Simple I/O Idle Structure",
271 "Unknown SubTable Type" /* Reserved */
274 #define ACPI_FADT_PM_RESERVED 9
276 static const char *AcpiDmFadtProfiles[] =
285 "Performance Server",
287 "Unknown Profile Type"
290 #define ACPI_GAS_WIDTH_RESERVED 5
292 static const char *AcpiDmGasAccessWidth[] =
299 "Unknown Width Encoding"
303 /*******************************************************************************
305 * ACPI Table Data, indexed by signature.
307 * Each entry contains: Signature, Table Info, Handler, DtHandler,
308 * Template, Description
310 * Simple tables have only a TableInfo structure, complex tables have a
311 * handler. This table must be NULL terminated. RSDP and FACS are
312 * special-cased elsewhere.
314 ******************************************************************************/
316 ACPI_DMTABLE_DATA AcpiDmTableData[] =
318 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
319 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
320 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
321 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
322 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
323 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
324 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"},
325 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
326 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
327 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
328 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
329 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
330 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"},
331 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"},
332 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"},
333 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
334 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
335 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
336 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"},
337 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"},
338 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
339 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
340 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
341 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
342 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"},
343 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"},
344 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
345 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
346 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"},
347 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"},
348 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"},
349 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"},
350 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"},
351 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
352 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
353 {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
354 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
355 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
356 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"},
357 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
358 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
359 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
360 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"},
361 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"},
362 {NULL, NULL, NULL, NULL, NULL, NULL}
366 /*******************************************************************************
368 * FUNCTION: AcpiDmGenerateChecksum
370 * PARAMETERS: Table - Pointer to table to be checksummed
371 * Length - Length of the table
372 * OriginalChecksum - Value of the checksum field
374 * RETURN: 8 bit checksum of buffer
376 * DESCRIPTION: Computes an 8 bit checksum of the table.
378 ******************************************************************************/
381 AcpiDmGenerateChecksum (
384 UINT8 OriginalChecksum)
389 /* Sum the entire table as-is */
391 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
393 /* Subtract off the existing checksum value in the table */
395 Checksum = (UINT8) (Checksum - OriginalChecksum);
397 /* Compute the final checksum */
399 Checksum = (UINT8) (0 - Checksum);
404 /*******************************************************************************
406 * FUNCTION: AcpiDmGetTableData
408 * PARAMETERS: Signature - ACPI signature (4 chars) to match
410 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
412 * DESCRIPTION: Find a match in the global table of supported ACPI tables
414 ******************************************************************************/
420 ACPI_DMTABLE_DATA *TableData;
423 for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
425 if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
435 /*******************************************************************************
437 * FUNCTION: AcpiDmDumpDataTable
439 * PARAMETERS: Table - An ACPI table
443 * DESCRIPTION: Format the contents of an ACPI data table (any table other
444 * than an SSDT or DSDT that does not contain executable AML code)
446 ******************************************************************************/
449 AcpiDmDumpDataTable (
450 ACPI_TABLE_HEADER *Table)
453 ACPI_DMTABLE_DATA *TableData;
457 /* Ignore tables that contain AML */
459 if (AcpiUtIsAmlTable (Table))
461 if (Gbl_VerboseTemplates)
463 /* Dump the raw table data */
465 Length = Table->Length;
467 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
468 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
469 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
470 Length, DB_BYTE_DISPLAY, 0);
471 AcpiOsPrintf (" */\n");
477 * Handle tables that don't use the common ACPI table header structure.
478 * Currently, these are the FACS, RSDP, and S3PT.
480 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
482 Length = Table->Length;
483 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
485 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
487 Length = AcpiDmDumpRsdp (Table);
489 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
491 Length = AcpiDmDumpS3pt (Table);
496 * All other tables must use the common ACPI table header, dump it now
498 Length = Table->Length;
499 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
500 if (ACPI_FAILURE (Status))
506 /* Match signature and dispatch appropriately */
508 TableData = AcpiDmGetTableData (Table->Signature);
511 if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
513 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
518 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
520 fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
524 else if (TableData->TableHandler)
526 /* Complex table, has a handler */
528 TableData->TableHandler (Table);
530 else if (TableData->TableInfo)
532 /* Simple table, just walk the info table */
534 AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
538 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
540 /* Dump the raw table data */
542 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
543 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
544 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
545 Length, DB_BYTE_DISPLAY, 0);
550 /*******************************************************************************
552 * FUNCTION: AcpiDmLineHeader
554 * PARAMETERS: Offset - Current byte offset, from table start
555 * ByteLength - Length of the field in bytes, 0 for flags
556 * Name - Name of this field
557 * Value - Optional value, displayed on left of ':'
561 * DESCRIPTION: Utility routines for formatting output lines. Displays the
562 * current table offset in hex and decimal, the field length,
563 * and the field name.
565 ******************************************************************************/
574 /* Allow a null name for fields that span multiple lines (large buffers) */
581 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
585 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
591 AcpiOsPrintf ("%41s : ", Name);
595 AcpiOsPrintf ("%41s ", Name);
599 else /* Normal disassembler or verbose template */
603 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
604 Offset, Offset, ByteLength, Name);
610 AcpiOsPrintf ("%44s : ", Name);
614 AcpiOsPrintf ("%44s ", Name);
628 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
632 AcpiOsPrintf ("[%.4d] %30s %3d : ",
633 ByteLength, Name, Value);
637 AcpiOsPrintf ("%36s % 3d : ",
641 else /* Normal disassembler or verbose template */
645 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
646 Offset, Offset, ByteLength, Name, Value);
650 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
651 Offset, Offset, Name, Value);
657 /*******************************************************************************
659 * FUNCTION: AcpiDmDumpTable
661 * PARAMETERS: TableLength - Length of the entire ACPI table
662 * TableOffset - Starting offset within the table for this
663 * sub-descriptor (0 if main table)
664 * Table - The ACPI table
665 * SubtableLength - Length of this sub-descriptor
666 * Info - Info table for this ACPI table
670 * DESCRIPTION: Display ACPI table contents by walking the Info table.
672 * Note: This function must remain in sync with DtGetFieldLength.
674 ******************************************************************************/
681 UINT32 SubtableLength,
682 ACPI_DMTABLE_INFO *Info)
685 UINT32 CurrentOffset;
690 ACPI_DMTABLE_DATA *TableData;
692 BOOLEAN LastOutputBlankLine = FALSE;
693 char RepairedName[8];
698 AcpiOsPrintf ("Display not implemented\n");
699 return (AE_NOT_IMPLEMENTED);
702 /* Walk entire Info table; Null name terminates */
704 for (; Info->Name; Info++)
707 * Target points to the field within the ACPI Table. CurrentOffset is
708 * the offset of the field from the start of the main table.
710 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
711 CurrentOffset = TableOffset + Info->Offset;
713 /* Check for beyond EOT or beyond subtable end */
715 if ((CurrentOffset >= TableLength) ||
716 (SubtableLength && (Info->Offset >= SubtableLength)))
718 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
719 return (AE_BAD_DATA);
722 /* Generate the byte length for this field */
724 switch (Info->Opcode)
727 case ACPI_DMT_CHKSUM:
728 case ACPI_DMT_SPACEID:
729 case ACPI_DMT_ACCWIDTH:
737 case ACPI_DMT_HESTNTYP:
738 case ACPI_DMT_FADTPM:
739 case ACPI_DMT_EINJACT:
740 case ACPI_DMT_EINJINST:
741 case ACPI_DMT_ERSTACT:
742 case ACPI_DMT_ERSTINST:
743 case ACPI_DMT_DMAR_SCOPE:
748 case ACPI_DMT_UINT16:
755 case ACPI_DMT_UINT24:
760 case ACPI_DMT_UINT32:
769 case ACPI_DMT_UINT40:
774 case ACPI_DMT_UINT48:
780 case ACPI_DMT_UINT56:
786 case ACPI_DMT_UINT64:
803 case ACPI_DMT_BUF128:
808 case ACPI_DMT_STRING:
810 ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
815 if (!LastOutputBlankLine)
818 LastOutputBlankLine = TRUE;
820 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
823 case ACPI_DMT_HESTNTFY:
825 if (!LastOutputBlankLine)
828 LastOutputBlankLine = TRUE;
830 ByteLength = sizeof (ACPI_HEST_NOTIFY);
839 if (CurrentOffset + ByteLength > TableLength)
841 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
842 return (AE_BAD_DATA);
845 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
847 AcpiOsPrintf ("%s", Info->Name);
851 /* Start a new line and decode the opcode */
853 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
855 switch (Info->Opcode)
857 /* Single-bit Flag fields. Note: Opcode is the bit position */
868 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
871 /* 2-bit Flag fields */
873 case ACPI_DMT_FLAGS0:
875 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
878 case ACPI_DMT_FLAGS1:
880 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
883 case ACPI_DMT_FLAGS2:
885 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
888 case ACPI_DMT_FLAGS4:
890 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
893 /* Integer Data Types */
896 case ACPI_DMT_UINT16:
897 case ACPI_DMT_UINT24:
898 case ACPI_DMT_UINT32:
899 case ACPI_DMT_UINT40:
900 case ACPI_DMT_UINT48:
901 case ACPI_DMT_UINT56:
902 case ACPI_DMT_UINT64:
904 * Dump bytes - high byte first, low byte last.
905 * Note: All ACPI tables are little-endian.
908 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
910 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
911 Value |= Target[Temp8 - 1];
915 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
917 AcpiOsPrintf (" [Optional field not present]");
926 case ACPI_DMT_BUF128:
928 * Buffer: Size depends on the opcode and was set above.
929 * Each hex byte is separated with a space.
930 * Multiple lines are separated by line continuation char.
932 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
934 AcpiOsPrintf ("%2.2X", Target[Temp16]);
935 if ((UINT32) (Temp16 + 1) < ByteLength)
937 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
939 AcpiOsPrintf (" \\\n"); /* Line continuation */
940 AcpiDmLineHeader (0, 0, NULL);
953 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
955 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
957 AcpiOsPrintf ("%s\n", MsgBuffer);
960 case ACPI_DMT_STRING:
962 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
965 /* Fixed length ASCII name fields */
969 AcpiDmCheckAscii (Target, RepairedName, 4);
970 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
971 TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
974 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
984 AcpiDmCheckAscii (Target, RepairedName, 4);
985 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
990 AcpiDmCheckAscii (Target, RepairedName, 6);
991 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
996 AcpiDmCheckAscii (Target, RepairedName, 8);
997 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1000 /* Special Data Types */
1002 case ACPI_DMT_CHKSUM:
1004 /* Checksum, display and validate */
1006 AcpiOsPrintf ("%2.2X", *Target);
1007 Temp8 = AcpiDmGenerateChecksum (Table,
1008 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1009 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1010 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1013 " /* Incorrect checksum, should be %2.2X */", Temp8);
1015 AcpiOsPrintf ("\n");
1018 case ACPI_DMT_SPACEID:
1020 /* Address Space ID */
1022 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1025 case ACPI_DMT_ACCWIDTH:
1027 /* Encoded Access Width */
1030 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1032 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1035 AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
1040 /* Generic Address Structure */
1042 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1043 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1044 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1045 AcpiOsPrintf ("\n");
1046 LastOutputBlankLine = TRUE;
1051 /* ASF subtable types */
1053 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1054 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1056 Temp16 = ACPI_ASF_TYPE_RESERVED;
1059 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1064 /* DMAR subtable types */
1066 Temp16 = ACPI_GET16 (Target);
1067 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1069 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1072 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
1075 case ACPI_DMT_DMAR_SCOPE:
1077 /* DMAR device scope types */
1080 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1082 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1085 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmDmarScope[Temp8]);
1088 case ACPI_DMT_EINJACT:
1090 /* EINJ Action types */
1093 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1095 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1098 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
1101 case ACPI_DMT_EINJINST:
1103 /* EINJ Instruction types */
1106 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1108 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1111 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
1114 case ACPI_DMT_ERSTACT:
1116 /* ERST Action types */
1119 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1121 Temp8 = ACPI_ERST_ACTION_RESERVED;
1124 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1127 case ACPI_DMT_ERSTINST:
1129 /* ERST Instruction types */
1132 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1134 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1137 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1142 /* GTDT subtable types */
1145 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1147 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1150 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGtdtSubnames[Temp8]);
1155 /* HEST subtable types */
1157 Temp16 = ACPI_GET16 (Target);
1158 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1160 Temp16 = ACPI_HEST_TYPE_RESERVED;
1163 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1166 case ACPI_DMT_HESTNTFY:
1168 AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1169 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1170 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1171 AcpiOsPrintf ("\n");
1172 LastOutputBlankLine = TRUE;
1175 case ACPI_DMT_HESTNTYP:
1177 /* HEST Notify types */
1180 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1182 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1185 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1190 /* MADT subtable types */
1193 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1195 Temp8 = ACPI_MADT_TYPE_RESERVED;
1198 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
1203 /* PCCT subtable types */
1206 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1208 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1211 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPcctSubnames[Temp8]);
1216 /* PMTT subtable types */
1219 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1221 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1224 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
1229 /* SLIC subtable types */
1232 if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1234 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1237 AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1242 /* SRAT subtable types */
1245 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1247 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1250 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
1253 case ACPI_DMT_FADTPM:
1255 /* FADT Preferred PM Profile names */
1258 if (Temp8 > ACPI_FADT_PM_RESERVED)
1260 Temp8 = ACPI_FADT_PM_RESERVED;
1263 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1268 /* IVRS subtable types */
1273 case ACPI_IVRS_TYPE_HARDWARE:
1275 Name = AcpiDmIvrsSubnames[0];
1278 case ACPI_IVRS_TYPE_MEMORY1:
1279 case ACPI_IVRS_TYPE_MEMORY2:
1280 case ACPI_IVRS_TYPE_MEMORY3:
1282 Name = AcpiDmIvrsSubnames[1];
1287 Name = AcpiDmIvrsSubnames[2];
1291 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1296 /* LPIT subtable types */
1301 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
1303 Name = AcpiDmLpitSubnames[0];
1306 case ACPI_LPIT_TYPE_SIMPLE_IO:
1308 Name = AcpiDmLpitSubnames[1];
1313 Name = AcpiDmLpitSubnames[2];
1317 AcpiOsPrintf (UINT32_FORMAT, *Target, Name);
1326 ACPI_ERROR ((AE_INFO,
1327 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1328 return (AE_SUPPORT);
1332 if (TableOffset && !SubtableLength)
1334 /* If this table is not the main table, subtable must have valid length */
1336 AcpiOsPrintf ("Invalid zero length subtable\n");
1337 return (AE_BAD_DATA);
1344 /*******************************************************************************
1346 * FUNCTION: AcpiDmCheckAscii
1348 * PARAMETERS: Name - Ascii string
1349 * Count - Number of characters to check
1353 * DESCRIPTION: Ensure that the requested number of characters are printable
1354 * Ascii characters. Sets non-printable and null chars to <space>.
1356 ******************************************************************************/
1367 for (i = 0; i < Count; i++)
1369 RepairedName[i] = (char) Name[i];
1375 if (!isprint (Name[i]))
1377 RepairedName[i] = ' ';