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 *AcpiDmSratSubnames[] =
246 "Processor Local APIC/SAPIC Affinity",
248 "Processor Local x2APIC Affinity",
250 "Unknown SubTable Type" /* Reserved */
253 static const char *AcpiDmIvrsSubnames[] =
255 "Hardware Definition Block",
256 "Memory Definition Block",
257 "Unknown SubTable Type" /* Reserved */
260 static const char *AcpiDmLpitSubnames[] =
262 "Native C-state Idle Structure",
263 "Simple I/O Idle Structure",
264 "Unknown SubTable Type" /* Reserved */
267 #define ACPI_FADT_PM_RESERVED 9
269 static const char *AcpiDmFadtProfiles[] =
278 "Performance Server",
280 "Unknown Profile Type"
283 #define ACPI_GAS_WIDTH_RESERVED 5
285 static const char *AcpiDmGasAccessWidth[] =
292 "Unknown Width Encoding"
296 /*******************************************************************************
298 * ACPI Table Data, indexed by signature.
300 * Each entry contains: Signature, Table Info, Handler, DtHandler,
301 * Template, Description
303 * Simple tables have only a TableInfo structure, complex tables have a
304 * handler. This table must be NULL terminated. RSDP and FACS are
305 * special-cased elsewhere.
307 ******************************************************************************/
309 ACPI_DMTABLE_DATA AcpiDmTableData[] =
311 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
312 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
313 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
314 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
315 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
316 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
317 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"},
318 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
319 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
320 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
321 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
322 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
323 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"},
324 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"},
325 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"},
326 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
327 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
328 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
329 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"},
330 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"},
331 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
332 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
333 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
334 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
335 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm, "Microsoft Data Management table"},
336 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"},
337 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"},
338 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
339 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
340 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"},
341 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"},
342 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"},
343 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"},
344 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"},
345 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
346 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
347 {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
348 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
349 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
350 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"},
351 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
352 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
353 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
354 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"},
355 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"},
356 {NULL, NULL, NULL, NULL, NULL, NULL}
360 /*******************************************************************************
362 * FUNCTION: AcpiDmGenerateChecksum
364 * PARAMETERS: Table - Pointer to table to be checksummed
365 * Length - Length of the table
366 * OriginalChecksum - Value of the checksum field
368 * RETURN: 8 bit checksum of buffer
370 * DESCRIPTION: Computes an 8 bit checksum of the table.
372 ******************************************************************************/
375 AcpiDmGenerateChecksum (
378 UINT8 OriginalChecksum)
383 /* Sum the entire table as-is */
385 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
387 /* Subtract off the existing checksum value in the table */
389 Checksum = (UINT8) (Checksum - OriginalChecksum);
391 /* Compute the final checksum */
393 Checksum = (UINT8) (0 - Checksum);
398 /*******************************************************************************
400 * FUNCTION: AcpiDmGetTableData
402 * PARAMETERS: Signature - ACPI signature (4 chars) to match
404 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
406 * DESCRIPTION: Find a match in the global table of supported ACPI tables
408 ******************************************************************************/
414 ACPI_DMTABLE_DATA *TableData;
417 for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
419 if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
429 /*******************************************************************************
431 * FUNCTION: AcpiDmDumpDataTable
433 * PARAMETERS: Table - An ACPI table
437 * DESCRIPTION: Format the contents of an ACPI data table (any table other
438 * than an SSDT or DSDT that does not contain executable AML code)
440 ******************************************************************************/
443 AcpiDmDumpDataTable (
444 ACPI_TABLE_HEADER *Table)
447 ACPI_DMTABLE_DATA *TableData;
451 /* Ignore tables that contain AML */
453 if (AcpiUtIsAmlTable (Table))
455 if (Gbl_VerboseTemplates)
457 /* Dump the raw table data */
459 Length = Table->Length;
461 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
462 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
463 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
464 Length, DB_BYTE_DISPLAY, 0);
465 AcpiOsPrintf (" */\n");
471 * Handle tables that don't use the common ACPI table header structure.
472 * Currently, these are the FACS, RSDP, and S3PT.
474 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
476 Length = Table->Length;
477 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
479 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
481 Length = AcpiDmDumpRsdp (Table);
483 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
485 Length = AcpiDmDumpS3pt (Table);
490 * All other tables must use the common ACPI table header, dump it now
492 Length = Table->Length;
493 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
494 if (ACPI_FAILURE (Status))
500 /* Match signature and dispatch appropriately */
502 TableData = AcpiDmGetTableData (Table->Signature);
505 if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
507 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
512 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
515 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
518 if (!AcpiGbl_ForceAmlDisassembly)
520 fprintf (stderr, "decoding ACPI table header only\n");
524 fprintf (stderr, "assuming table contains valid AML code\n");
528 else if (TableData->TableHandler)
530 /* Complex table, has a handler */
532 TableData->TableHandler (Table);
534 else if (TableData->TableInfo)
536 /* Simple table, just walk the info table */
538 AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
542 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
544 /* Dump the raw table data */
546 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
547 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
548 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
549 Length, DB_BYTE_DISPLAY, 0);
554 /*******************************************************************************
556 * FUNCTION: AcpiDmLineHeader
558 * PARAMETERS: Offset - Current byte offset, from table start
559 * ByteLength - Length of the field in bytes, 0 for flags
560 * Name - Name of this field
561 * Value - Optional value, displayed on left of ':'
565 * DESCRIPTION: Utility routines for formatting output lines. Displays the
566 * current table offset in hex and decimal, the field length,
567 * and the field name.
569 ******************************************************************************/
578 /* Allow a null name for fields that span multiple lines (large buffers) */
585 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
589 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
595 AcpiOsPrintf ("%41s : ", Name);
599 AcpiOsPrintf ("%41s ", Name);
603 else /* Normal disassembler or verbose template */
607 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
608 Offset, Offset, ByteLength, Name);
614 AcpiOsPrintf ("%44s : ", Name);
618 AcpiOsPrintf ("%44s ", Name);
632 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
636 AcpiOsPrintf ("[%.4d] %30s %3d : ",
637 ByteLength, Name, Value);
641 AcpiOsPrintf ("%36s % 3d : ",
645 else /* Normal disassembler or verbose template */
649 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
650 Offset, Offset, ByteLength, Name, Value);
654 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
655 Offset, Offset, Name, Value);
661 /*******************************************************************************
663 * FUNCTION: AcpiDmDumpTable
665 * PARAMETERS: TableLength - Length of the entire ACPI table
666 * TableOffset - Starting offset within the table for this
667 * sub-descriptor (0 if main table)
668 * Table - The ACPI table
669 * SubtableLength - Length of this sub-descriptor
670 * Info - Info table for this ACPI table
674 * DESCRIPTION: Display ACPI table contents by walking the Info table.
676 * Note: This function must remain in sync with DtGetFieldLength.
678 ******************************************************************************/
685 UINT32 SubtableLength,
686 ACPI_DMTABLE_INFO *Info)
689 UINT32 CurrentOffset;
695 ACPI_DMTABLE_DATA *TableData;
697 BOOLEAN LastOutputBlankLine = FALSE;
698 char RepairedName[8];
703 AcpiOsPrintf ("Display not implemented\n");
704 return (AE_NOT_IMPLEMENTED);
707 /* Walk entire Info table; Null name terminates */
709 for (; Info->Name; Info++)
712 * Target points to the field within the ACPI Table. CurrentOffset is
713 * the offset of the field from the start of the main table.
715 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
716 CurrentOffset = TableOffset + Info->Offset;
718 /* Check for beyond EOT or beyond subtable end */
720 if ((CurrentOffset >= TableLength) ||
721 (SubtableLength && (Info->Offset >= SubtableLength)))
724 "**** ACPI table terminates in the middle of a data structure! (dump table)\n");
725 return (AE_BAD_DATA);
728 /* Generate the byte length for this field */
730 switch (Info->Opcode)
733 case ACPI_DMT_CHKSUM:
734 case ACPI_DMT_SPACEID:
735 case ACPI_DMT_ACCWIDTH:
743 case ACPI_DMT_HESTNTYP:
744 case ACPI_DMT_FADTPM:
745 case ACPI_DMT_EINJACT:
746 case ACPI_DMT_EINJINST:
747 case ACPI_DMT_ERSTACT:
748 case ACPI_DMT_ERSTINST:
749 case ACPI_DMT_DMAR_SCOPE:
754 case ACPI_DMT_UINT16:
761 case ACPI_DMT_UINT24:
766 case ACPI_DMT_UINT32:
774 case ACPI_DMT_UINT40:
779 case ACPI_DMT_UINT48:
785 case ACPI_DMT_UINT56:
791 case ACPI_DMT_UINT64:
808 case ACPI_DMT_BUF128:
813 case ACPI_DMT_BUFFER:
814 case ACPI_DMT_RAW_BUFFER:
816 ByteLength = SubtableLength;
819 case ACPI_DMT_STRING:
821 ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
826 if (!LastOutputBlankLine)
829 LastOutputBlankLine = TRUE;
831 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
834 case ACPI_DMT_HESTNTFY:
836 if (!LastOutputBlankLine)
839 LastOutputBlankLine = TRUE;
841 ByteLength = sizeof (ACPI_HEST_NOTIFY);
850 if (CurrentOffset + ByteLength > TableLength)
853 "**** ACPI table terminates in the middle of a data structure!\n");
854 return (AE_BAD_DATA);
857 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
859 AcpiOsPrintf ("%s", Info->Name);
863 /* Start a new line and decode the opcode */
865 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
867 switch (Info->Opcode)
869 /* Single-bit Flag fields. Note: Opcode is the bit position */
880 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
883 /* 2-bit Flag fields */
885 case ACPI_DMT_FLAGS0:
887 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
890 case ACPI_DMT_FLAGS1:
892 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
895 case ACPI_DMT_FLAGS2:
897 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
900 case ACPI_DMT_FLAGS4:
902 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
905 /* Integer Data Types */
908 case ACPI_DMT_UINT16:
909 case ACPI_DMT_UINT24:
910 case ACPI_DMT_UINT32:
911 case ACPI_DMT_UINT40:
912 case ACPI_DMT_UINT48:
913 case ACPI_DMT_UINT56:
914 case ACPI_DMT_UINT64:
916 * Dump bytes - high byte first, low byte last.
917 * Note: All ACPI tables are little-endian.
920 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
922 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
923 Value |= Target[Temp8 - 1];
927 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
929 AcpiOsPrintf (" [Optional field not present]");
938 case ACPI_DMT_BUF128:
940 * Buffer: Size depends on the opcode and was set above.
941 * Each hex byte is separated with a space.
942 * Multiple lines are separated by line continuation char.
944 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
946 AcpiOsPrintf ("%2.2X", Target[Temp16]);
947 if ((UINT32) (Temp16 + 1) < ByteLength)
949 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
951 AcpiOsPrintf (" \\\n"); /* Line continuation */
952 AcpiDmLineHeader (0, 0, NULL);
965 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
967 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
969 AcpiOsPrintf ("%s\n", MsgBuffer);
972 case ACPI_DMT_STRING:
974 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
977 /* Fixed length ASCII name fields */
981 AcpiDmCheckAscii (Target, RepairedName, 4);
982 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
983 TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
986 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
996 AcpiDmCheckAscii (Target, RepairedName, 4);
997 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1000 case ACPI_DMT_NAME6:
1002 AcpiDmCheckAscii (Target, RepairedName, 6);
1003 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1006 case ACPI_DMT_NAME8:
1008 AcpiDmCheckAscii (Target, RepairedName, 8);
1009 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1012 /* Special Data Types */
1014 case ACPI_DMT_CHKSUM:
1016 /* Checksum, display and validate */
1018 AcpiOsPrintf ("%2.2X", *Target);
1019 Temp8 = AcpiDmGenerateChecksum (Table,
1020 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1021 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1023 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1026 " /* Incorrect checksum, should be %2.2X */", Temp8);
1028 AcpiOsPrintf ("\n");
1031 case ACPI_DMT_SPACEID:
1033 /* Address Space ID */
1035 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1038 case ACPI_DMT_ACCWIDTH:
1040 /* Encoded Access Width */
1043 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1045 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1048 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1053 /* Generic Address Structure */
1055 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1056 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1057 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1058 AcpiOsPrintf ("\n");
1059 LastOutputBlankLine = TRUE;
1064 /* ASF subtable types */
1066 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1067 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1069 Temp16 = ACPI_ASF_TYPE_RESERVED;
1072 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1077 /* DMAR subtable types */
1079 Temp16 = ACPI_GET16 (Target);
1080 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1082 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1085 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1086 AcpiDmDmarSubnames[Temp16]);
1089 case ACPI_DMT_DMAR_SCOPE:
1091 /* DMAR device scope types */
1094 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1096 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1099 AcpiOsPrintf (UINT8_FORMAT, *Target,
1100 AcpiDmDmarScope[Temp8]);
1103 case ACPI_DMT_EINJACT:
1105 /* EINJ Action types */
1108 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1110 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1113 AcpiOsPrintf (UINT8_FORMAT, *Target,
1114 AcpiDmEinjActions[Temp8]);
1117 case ACPI_DMT_EINJINST:
1119 /* EINJ Instruction types */
1122 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1124 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1127 AcpiOsPrintf (UINT8_FORMAT, *Target,
1128 AcpiDmEinjInstructions[Temp8]);
1131 case ACPI_DMT_ERSTACT:
1133 /* ERST Action types */
1136 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1138 Temp8 = ACPI_ERST_ACTION_RESERVED;
1141 AcpiOsPrintf (UINT8_FORMAT, *Target,
1142 AcpiDmErstActions[Temp8]);
1145 case ACPI_DMT_ERSTINST:
1147 /* ERST Instruction types */
1150 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1152 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1155 AcpiOsPrintf (UINT8_FORMAT, *Target,
1156 AcpiDmErstInstructions[Temp8]);
1161 /* GTDT subtable types */
1164 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1166 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1169 AcpiOsPrintf (UINT8_FORMAT, *Target,
1170 AcpiDmGtdtSubnames[Temp8]);
1175 /* HEST subtable types */
1177 Temp16 = ACPI_GET16 (Target);
1178 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1180 Temp16 = ACPI_HEST_TYPE_RESERVED;
1183 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1184 AcpiDmHestSubnames[Temp16]);
1187 case ACPI_DMT_HESTNTFY:
1189 AcpiOsPrintf (STRING_FORMAT,
1190 "Hardware Error Notification Structure");
1192 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1193 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1194 AcpiOsPrintf ("\n");
1195 LastOutputBlankLine = TRUE;
1198 case ACPI_DMT_HESTNTYP:
1200 /* HEST Notify types */
1203 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1205 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1208 AcpiOsPrintf (UINT8_FORMAT, *Target,
1209 AcpiDmHestNotifySubnames[Temp8]);
1214 /* MADT subtable types */
1217 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1219 Temp8 = ACPI_MADT_TYPE_RESERVED;
1222 AcpiOsPrintf (UINT8_FORMAT, *Target,
1223 AcpiDmMadtSubnames[Temp8]);
1228 /* PCCT subtable types */
1231 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1233 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1236 AcpiOsPrintf (UINT8_FORMAT, *Target,
1237 AcpiDmPcctSubnames[Temp8]);
1242 /* PMTT subtable types */
1245 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1247 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1250 AcpiOsPrintf (UINT8_FORMAT, *Target,
1251 AcpiDmPmttSubnames[Temp8]);
1254 case ACPI_DMT_RAW_BUFFER:
1256 * Currently only used for SLIC table
1258 AcpiOsPrintf ("/* Proprietary data structure */ ");
1260 AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER),
1261 ByteLength, sizeof (ACPI_TABLE_HEADER),
1262 "Licensing Data", TRUE);
1263 AcpiOsPrintf ("\n");
1268 /* SRAT subtable types */
1271 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1273 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1276 AcpiOsPrintf (UINT8_FORMAT, *Target,
1277 AcpiDmSratSubnames[Temp8]);
1280 case ACPI_DMT_FADTPM:
1282 /* FADT Preferred PM Profile names */
1285 if (Temp8 > ACPI_FADT_PM_RESERVED)
1287 Temp8 = ACPI_FADT_PM_RESERVED;
1290 AcpiOsPrintf (UINT8_FORMAT, *Target,
1291 AcpiDmFadtProfiles[Temp8]);
1296 /* IVRS subtable types */
1301 case ACPI_IVRS_TYPE_HARDWARE:
1303 Name = AcpiDmIvrsSubnames[0];
1306 case ACPI_IVRS_TYPE_MEMORY1:
1307 case ACPI_IVRS_TYPE_MEMORY2:
1308 case ACPI_IVRS_TYPE_MEMORY3:
1310 Name = AcpiDmIvrsSubnames[1];
1315 Name = AcpiDmIvrsSubnames[2];
1319 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1324 /* LPIT subtable types */
1326 Temp32 = ACPI_GET32 (Target);
1327 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1329 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1332 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1333 AcpiDmLpitSubnames[Temp32]);
1342 ACPI_ERROR ((AE_INFO,
1343 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1344 return (AE_SUPPORT);
1348 if (TableOffset && !SubtableLength)
1351 * If this table is not the main table, the subtable must have a
1354 AcpiOsPrintf ("Invalid zero length subtable\n");
1355 return (AE_BAD_DATA);
1362 /*******************************************************************************
1364 * FUNCTION: AcpiDmCheckAscii
1366 * PARAMETERS: Name - Ascii string
1367 * Count - Number of characters to check
1371 * DESCRIPTION: Ensure that the requested number of characters are printable
1372 * Ascii characters. Sets non-printable and null chars to <space>.
1374 ******************************************************************************/
1385 for (i = 0; i < Count; i++)
1387 RepairedName[i] = (char) Name[i];
1393 if (!isprint (Name[i]))
1395 RepairedName[i] = ' ';