1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, 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")
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 "Unknown SubTable Type" /* Reserved */
93 static const char *AcpiDmEinjActions[] =
102 "Get Command Status",
106 static const char *AcpiDmEinjInstructions[] =
109 "Read Register Value",
111 "Write Register Value",
113 "Unknown Instruction"
116 static const char *AcpiDmErstActions[] =
118 "Begin Write Operation",
119 "Begin Read Operation",
120 "Begin Clear Operation",
125 "Get Command Status",
126 "Get Record Identifier",
127 "Set Record Identifier",
130 "Unused/Unknown Action",
131 "Get Error Address Range",
132 "Get Error Address Length",
133 "Get Error Attributes",
137 static const char *AcpiDmErstInstructions[] =
140 "Read Register Value",
142 "Write Register Value",
155 "Set Source Address",
156 "Set Destination Address",
158 "Unknown Instruction"
161 static const char *AcpiDmHestSubnames[] =
163 "IA-32 Machine Check Exception",
164 "IA-32 Corrected Machine Check",
165 "IA-32 Non-Maskable Interrupt",
166 "Unknown SubTable Type", /* 3 - Reserved */
167 "Unknown SubTable Type", /* 4 - Reserved */
168 "Unknown SubTable Type", /* 5 - Reserved */
169 "PCI Express Root Port AER",
170 "PCI Express AER (AER Endpoint)",
171 "PCI Express/PCI-X Bridge AER",
172 "Generic Hardware Error Source",
173 "Unknown SubTable Type" /* Reserved */
176 static const char *AcpiDmHestNotifySubnames[] =
179 "External Interrupt",
183 "Unknown Notify Type" /* Reserved */
186 static const char *AcpiDmMadtSubnames[] =
188 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
189 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
190 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
191 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
192 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
193 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
194 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
195 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
196 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
197 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
198 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
199 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
200 "Generic Interrupt Distributor",/* ACPI_MADT_GENERIC_DISTRIBUTOR */
201 "Unknown SubTable Type" /* Reserved */
204 static const char *AcpiDmPmttSubnames[] =
206 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
207 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
208 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
209 "Unknown SubTable Type" /* Reserved */
212 static const char *AcpiDmSlicSubnames[] =
214 "Public Key Structure",
215 "Windows Marker Structure",
216 "Unknown SubTable Type" /* Reserved */
219 static const char *AcpiDmSratSubnames[] =
221 "Processor Local APIC/SAPIC Affinity",
223 "Processor Local x2APIC Affinity",
224 "Unknown SubTable Type" /* Reserved */
227 static const char *AcpiDmIvrsSubnames[] =
229 "Hardware Definition Block",
230 "Memory Definition Block",
231 "Unknown SubTable Type" /* Reserved */
235 #define ACPI_FADT_PM_RESERVED 9
237 static const char *AcpiDmFadtProfiles[] =
246 "Performance Server",
248 "Unknown Profile Type"
251 #define ACPI_GAS_WIDTH_RESERVED 5
253 static const char *AcpiDmGasAccessWidth[] =
260 "Unknown Width Encoding"
264 /*******************************************************************************
266 * ACPI Table Data, indexed by signature.
268 * Each entry contains: Signature, Table Info, Handler, DtHandler,
269 * Template, Description
271 * Simple tables have only a TableInfo structure, complex tables have a
272 * handler. This table must be NULL terminated. RSDP and FACS are
273 * special-cased elsewhere.
275 ******************************************************************************/
277 ACPI_DMTABLE_DATA AcpiDmTableData[] =
279 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
280 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
281 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
282 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
283 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
284 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
285 {ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"},
286 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
287 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
288 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
289 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
290 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
291 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"},
292 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"},
293 {ACPI_SIG_GTDT, AcpiDmTableInfoGtdt, NULL, NULL, TemplateGtdt, "Generic Timer Description Table"},
294 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
295 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
296 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
297 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"},
298 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
299 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
300 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
301 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
302 {ACPI_SIG_PCCT, NULL, AcpiDmDumpPcct, NULL, NULL, "Platform Communications Channel Table"},
303 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
304 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
305 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"},
306 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"},
307 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"},
308 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"},
309 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"},
310 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
311 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
312 {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
313 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
314 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
315 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
316 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
317 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
318 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"},
319 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"},
320 {NULL, NULL, NULL, NULL, NULL, NULL}
324 /*******************************************************************************
326 * FUNCTION: AcpiDmGenerateChecksum
328 * PARAMETERS: Table - Pointer to table to be checksummed
329 * Length - Length of the table
330 * OriginalChecksum - Value of the checksum field
332 * RETURN: 8 bit checksum of buffer
334 * DESCRIPTION: Computes an 8 bit checksum of the table.
336 ******************************************************************************/
339 AcpiDmGenerateChecksum (
342 UINT8 OriginalChecksum)
347 /* Sum the entire table as-is */
349 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
351 /* Subtract off the existing checksum value in the table */
353 Checksum = (UINT8) (Checksum - OriginalChecksum);
355 /* Compute the final checksum */
357 Checksum = (UINT8) (0 - Checksum);
362 /*******************************************************************************
364 * FUNCTION: AcpiDmGetTableData
366 * PARAMETERS: Signature - ACPI signature (4 chars) to match
368 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
370 * DESCRIPTION: Find a match in the global table of supported ACPI tables
372 ******************************************************************************/
378 ACPI_DMTABLE_DATA *TableData;
381 for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
383 if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
393 /*******************************************************************************
395 * FUNCTION: AcpiDmDumpDataTable
397 * PARAMETERS: Table - An ACPI table
401 * DESCRIPTION: Format the contents of an ACPI data table (any table other
402 * than an SSDT or DSDT that does not contain executable AML code)
404 ******************************************************************************/
407 AcpiDmDumpDataTable (
408 ACPI_TABLE_HEADER *Table)
411 ACPI_DMTABLE_DATA *TableData;
415 /* Ignore tables that contain AML */
417 if (AcpiUtIsAmlTable (Table))
419 if (Gbl_VerboseTemplates)
421 /* Dump the raw table data */
423 Length = Table->Length;
425 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
426 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
427 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
428 Length, DB_BYTE_DISPLAY, 0);
429 AcpiOsPrintf (" */\n");
435 * Handle tables that don't use the common ACPI table header structure.
436 * Currently, these are the FACS, RSDP, and S3PT.
438 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
440 Length = Table->Length;
441 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
443 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
445 Length = AcpiDmDumpRsdp (Table);
447 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
449 Length = AcpiDmDumpS3pt (Table);
454 * All other tables must use the common ACPI table header, dump it now
456 Length = Table->Length;
457 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
458 if (ACPI_FAILURE (Status))
464 /* Match signature and dispatch appropriately */
466 TableData = AcpiDmGetTableData (Table->Signature);
469 if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
471 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
476 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
480 else if (TableData->TableHandler)
482 /* Complex table, has a handler */
484 TableData->TableHandler (Table);
486 else if (TableData->TableInfo)
488 /* Simple table, just walk the info table */
490 AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
494 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
496 /* Dump the raw table data */
498 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
499 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
500 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
501 Length, DB_BYTE_DISPLAY, 0);
506 /*******************************************************************************
508 * FUNCTION: AcpiDmLineHeader
510 * PARAMETERS: Offset - Current byte offset, from table start
511 * ByteLength - Length of the field in bytes, 0 for flags
512 * Name - Name of this field
513 * Value - Optional value, displayed on left of ':'
517 * DESCRIPTION: Utility routines for formatting output lines. Displays the
518 * current table offset in hex and decimal, the field length,
519 * and the field name.
521 ******************************************************************************/
530 /* Allow a null name for fields that span multiple lines (large buffers) */
537 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
541 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
547 AcpiOsPrintf ("%41s : ", Name);
551 AcpiOsPrintf ("%41s ", Name);
555 else /* Normal disassembler or verbose template */
559 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
560 Offset, Offset, ByteLength, Name);
566 AcpiOsPrintf ("%44s : ", Name);
570 AcpiOsPrintf ("%44s ", Name);
584 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
588 AcpiOsPrintf ("[%.4d] %30s %3d : ",
589 ByteLength, Name, Value);
593 AcpiOsPrintf ("%36s % 3d : ",
597 else /* Normal disassembler or verbose template */
601 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
602 Offset, Offset, ByteLength, Name, Value);
606 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
607 Offset, Offset, Name, Value);
613 /*******************************************************************************
615 * FUNCTION: AcpiDmDumpTable
617 * PARAMETERS: TableLength - Length of the entire ACPI table
618 * TableOffset - Starting offset within the table for this
619 * sub-descriptor (0 if main table)
620 * Table - The ACPI table
621 * SubtableLength - Length of this sub-descriptor
622 * Info - Info table for this ACPI table
626 * DESCRIPTION: Display ACPI table contents by walking the Info table.
628 * Note: This function must remain in sync with DtGetFieldLength.
630 ******************************************************************************/
637 UINT32 SubtableLength,
638 ACPI_DMTABLE_INFO *Info)
641 UINT32 CurrentOffset;
645 ACPI_DMTABLE_DATA *TableData;
647 BOOLEAN LastOutputBlankLine = FALSE;
648 char RepairedName[8];
653 AcpiOsPrintf ("Display not implemented\n");
654 return (AE_NOT_IMPLEMENTED);
657 /* Walk entire Info table; Null name terminates */
659 for (; Info->Name; Info++)
662 * Target points to the field within the ACPI Table. CurrentOffset is
663 * the offset of the field from the start of the main table.
665 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
666 CurrentOffset = TableOffset + Info->Offset;
668 /* Check for beyond EOT or beyond subtable end */
670 if ((CurrentOffset >= TableLength) ||
671 (SubtableLength && (Info->Offset >= SubtableLength)))
673 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
674 return (AE_BAD_DATA);
677 /* Generate the byte length for this field */
679 switch (Info->Opcode)
682 case ACPI_DMT_CHKSUM:
683 case ACPI_DMT_SPACEID:
684 case ACPI_DMT_ACCWIDTH:
690 case ACPI_DMT_HESTNTYP:
691 case ACPI_DMT_FADTPM:
692 case ACPI_DMT_EINJACT:
693 case ACPI_DMT_EINJINST:
694 case ACPI_DMT_ERSTACT:
695 case ACPI_DMT_ERSTINST:
698 case ACPI_DMT_UINT16:
703 case ACPI_DMT_UINT24:
706 case ACPI_DMT_UINT32:
712 case ACPI_DMT_UINT40:
715 case ACPI_DMT_UINT48:
719 case ACPI_DMT_UINT56:
723 case ACPI_DMT_UINT64:
731 case ACPI_DMT_BUF128:
734 case ACPI_DMT_STRING:
735 ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
738 if (!LastOutputBlankLine)
741 LastOutputBlankLine = TRUE;
743 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
745 case ACPI_DMT_HESTNTFY:
746 if (!LastOutputBlankLine)
749 LastOutputBlankLine = TRUE;
751 ByteLength = sizeof (ACPI_HEST_NOTIFY);
758 if (CurrentOffset + ByteLength > TableLength)
760 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
761 return (AE_BAD_DATA);
764 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
766 AcpiOsPrintf ("%s", Info->Name);
770 /* Start a new line and decode the opcode */
772 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
774 switch (Info->Opcode)
776 /* Single-bit Flag fields. Note: Opcode is the bit position */
787 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
790 /* 2-bit Flag fields */
792 case ACPI_DMT_FLAGS0:
794 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
797 case ACPI_DMT_FLAGS1:
799 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
802 case ACPI_DMT_FLAGS2:
804 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
807 case ACPI_DMT_FLAGS4:
809 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
812 /* Integer Data Types */
815 case ACPI_DMT_UINT16:
816 case ACPI_DMT_UINT24:
817 case ACPI_DMT_UINT32:
818 case ACPI_DMT_UINT40:
819 case ACPI_DMT_UINT48:
820 case ACPI_DMT_UINT56:
821 case ACPI_DMT_UINT64:
823 * Dump bytes - high byte first, low byte last.
824 * Note: All ACPI tables are little-endian.
826 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
828 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
835 case ACPI_DMT_BUF128:
838 * Buffer: Size depends on the opcode and was set above.
839 * Each hex byte is separated with a space.
840 * Multiple lines are separated by line continuation char.
842 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
844 AcpiOsPrintf ("%2.2X", Target[Temp16]);
845 if ((UINT32) (Temp16 + 1) < ByteLength)
847 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
849 AcpiOsPrintf (" \\\n"); /* Line continuation */
850 AcpiDmLineHeader (0, 0, NULL);
863 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
865 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
867 AcpiOsPrintf ("%s\n", MsgBuffer);
870 case ACPI_DMT_STRING:
872 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
875 /* Fixed length ASCII name fields */
879 AcpiDmCheckAscii (Target, RepairedName, 4);
880 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
881 TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
884 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
894 AcpiDmCheckAscii (Target, RepairedName, 4);
895 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
900 AcpiDmCheckAscii (Target, RepairedName, 6);
901 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
906 AcpiDmCheckAscii (Target, RepairedName, 8);
907 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
910 /* Special Data Types */
912 case ACPI_DMT_CHKSUM:
914 /* Checksum, display and validate */
916 AcpiOsPrintf ("%2.2X", *Target);
917 Temp8 = AcpiDmGenerateChecksum (Table,
918 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
919 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
920 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
923 " /* Incorrect checksum, should be %2.2X */", Temp8);
928 case ACPI_DMT_SPACEID:
930 /* Address Space ID */
932 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
935 case ACPI_DMT_ACCWIDTH:
937 /* Encoded Access Width */
940 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
942 Temp8 = ACPI_GAS_WIDTH_RESERVED;
945 AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
950 /* Generic Address Structure */
952 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
953 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
954 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
956 LastOutputBlankLine = TRUE;
961 /* ASF subtable types */
963 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
964 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
966 Temp16 = ACPI_ASF_TYPE_RESERVED;
969 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
974 /* DMAR subtable types */
976 Temp16 = ACPI_GET16 (Target);
977 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
979 Temp16 = ACPI_DMAR_TYPE_RESERVED;
982 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
985 case ACPI_DMT_EINJACT:
987 /* EINJ Action types */
990 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
992 Temp8 = ACPI_EINJ_ACTION_RESERVED;
995 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
998 case ACPI_DMT_EINJINST:
1000 /* EINJ Instruction types */
1003 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1005 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1008 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
1011 case ACPI_DMT_ERSTACT:
1013 /* ERST Action types */
1016 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1018 Temp8 = ACPI_ERST_ACTION_RESERVED;
1021 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1024 case ACPI_DMT_ERSTINST:
1026 /* ERST Instruction types */
1029 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1031 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1034 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1039 /* HEST subtable types */
1041 Temp16 = ACPI_GET16 (Target);
1042 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1044 Temp16 = ACPI_HEST_TYPE_RESERVED;
1047 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1050 case ACPI_DMT_HESTNTFY:
1052 AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1053 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1054 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1055 AcpiOsPrintf ("\n");
1056 LastOutputBlankLine = TRUE;
1059 case ACPI_DMT_HESTNTYP:
1061 /* HEST Notify types */
1064 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1066 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1069 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1074 /* MADT subtable types */
1077 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1079 Temp8 = ACPI_MADT_TYPE_RESERVED;
1082 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
1087 /* PMTT subtable types */
1090 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1092 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1095 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
1100 /* SLIC subtable types */
1103 if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1105 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1108 AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1113 /* SRAT subtable types */
1116 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1118 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1121 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
1124 case ACPI_DMT_FADTPM:
1126 /* FADT Preferred PM Profile names */
1129 if (Temp8 > ACPI_FADT_PM_RESERVED)
1131 Temp8 = ACPI_FADT_PM_RESERVED;
1134 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1139 /* IVRS subtable types */
1144 case ACPI_IVRS_TYPE_HARDWARE:
1145 Name = AcpiDmIvrsSubnames[0];
1148 case ACPI_IVRS_TYPE_MEMORY1:
1149 case ACPI_IVRS_TYPE_MEMORY2:
1150 case ACPI_IVRS_TYPE_MEMORY3:
1151 Name = AcpiDmIvrsSubnames[1];
1155 Name = AcpiDmIvrsSubnames[2];
1159 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1166 ACPI_ERROR ((AE_INFO,
1167 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1168 return (AE_SUPPORT);
1172 if (TableOffset && !SubtableLength)
1174 /* If this table is not the main table, subtable must have valid length */
1176 AcpiOsPrintf ("Invalid zero length subtable\n");
1177 return (AE_BAD_DATA);
1184 /*******************************************************************************
1186 * FUNCTION: AcpiDmCheckAscii
1188 * PARAMETERS: Name - Ascii string
1189 * Count - Number of characters to check
1193 * DESCRIPTION: Ensure that the requested number of characters are printable
1194 * Ascii characters. Sets non-printable and null chars to <space>.
1196 ******************************************************************************/
1207 for (i = 0; i < Count; i++)
1209 RepairedName[i] = (char) Name[i];
1215 if (!isprint (Name[i]))
1217 RepairedName[i] = ' ';