1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, 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 "Generic Hardware Error Source V2",
200 "Unknown Subtable Type" /* Reserved */
203 static const char *AcpiDmHestNotifySubnames[] =
206 "External Interrupt",
210 "CMCI", /* ACPI 5.0 */
211 "MCE", /* ACPI 5.0 */
212 "Unknown Notify Type" /* Reserved */
215 static const char *AcpiDmMadtSubnames[] =
217 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
218 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
219 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
220 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
221 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
222 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
223 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
224 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
225 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
226 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
227 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
228 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
229 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
230 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
231 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
232 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
233 "Unknown Subtable Type" /* Reserved */
236 static const char *AcpiDmNfitSubnames[] =
238 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
239 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
240 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
241 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
242 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
243 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
244 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
245 "Unknown Subtable Type" /* Reserved */
248 static const char *AcpiDmPcctSubnames[] =
250 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
251 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
252 "Unknown Subtable Type" /* Reserved */
255 static const char *AcpiDmPmttSubnames[] =
257 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
258 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
259 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
260 "Unknown Subtable Type" /* Reserved */
263 static const char *AcpiDmSratSubnames[] =
265 "Processor Local APIC/SAPIC Affinity",
267 "Processor Local x2APIC Affinity",
269 "Unknown Subtable Type" /* Reserved */
272 static const char *AcpiDmIvrsSubnames[] =
274 "Hardware Definition Block",
275 "Memory Definition Block",
276 "Unknown Subtable Type" /* Reserved */
279 static const char *AcpiDmLpitSubnames[] =
281 "Native C-state Idle Structure",
282 "Unknown Subtable Type" /* Reserved */
285 #define ACPI_FADT_PM_RESERVED 9
287 static const char *AcpiDmFadtProfiles[] =
296 "Performance Server",
298 "Unknown Profile Type"
301 #define ACPI_GAS_WIDTH_RESERVED 5
303 static const char *AcpiDmGasAccessWidth[] =
310 "Unknown Width Encoding"
314 /*******************************************************************************
316 * ACPI Table Data, indexed by signature.
318 * Each entry contains: Signature, Table Info, Handler, DtHandler,
319 * Template, Description
321 * Simple tables have only a TableInfo structure, complex tables have a
322 * handler. This table must be NULL terminated. RSDP and FACS are
323 * special-cased elsewhere.
325 * Note: Any tables added here should be duplicated within AcpiSupportedTables
326 * in the file common/ahtable.c
328 ******************************************************************************/
330 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
332 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
333 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
334 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
335 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
336 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
337 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
338 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
339 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
340 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
341 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
342 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
343 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
344 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
345 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
346 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
347 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
348 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
349 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
350 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
351 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
352 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
353 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
354 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
355 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
356 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
357 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
358 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
359 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
360 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
361 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
362 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
363 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
364 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
365 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
366 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
367 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
368 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
369 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
370 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
371 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
372 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
373 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
374 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
375 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
376 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
377 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
378 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
379 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
380 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
381 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
382 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
383 {NULL, NULL, NULL, NULL, NULL}
387 /*******************************************************************************
389 * FUNCTION: AcpiDmGenerateChecksum
391 * PARAMETERS: Table - Pointer to table to be checksummed
392 * Length - Length of the table
393 * OriginalChecksum - Value of the checksum field
395 * RETURN: 8 bit checksum of buffer
397 * DESCRIPTION: Computes an 8 bit checksum of the table.
399 ******************************************************************************/
402 AcpiDmGenerateChecksum (
405 UINT8 OriginalChecksum)
410 /* Sum the entire table as-is */
412 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
414 /* Subtract off the existing checksum value in the table */
416 Checksum = (UINT8) (Checksum - OriginalChecksum);
418 /* Compute the final checksum */
420 Checksum = (UINT8) (0 - Checksum);
425 /*******************************************************************************
427 * FUNCTION: AcpiDmGetTableData
429 * PARAMETERS: Signature - ACPI signature (4 chars) to match
431 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
433 * DESCRIPTION: Find a match in the global table of supported ACPI tables
435 ******************************************************************************/
437 const ACPI_DMTABLE_DATA *
441 const ACPI_DMTABLE_DATA *Info;
444 for (Info = AcpiDmTableData; Info->Signature; Info++)
446 if (ACPI_COMPARE_NAME (Signature, Info->Signature))
456 /*******************************************************************************
458 * FUNCTION: AcpiDmDumpDataTable
460 * PARAMETERS: Table - An ACPI table
464 * DESCRIPTION: Format the contents of an ACPI data table (any table other
465 * than an SSDT or DSDT that does not contain executable AML code)
467 ******************************************************************************/
470 AcpiDmDumpDataTable (
471 ACPI_TABLE_HEADER *Table)
474 const ACPI_DMTABLE_DATA *TableData;
478 /* Ignore tables that contain AML */
480 if (AcpiUtIsAmlTable (Table))
482 if (Gbl_VerboseTemplates)
484 /* Dump the raw table data */
486 Length = Table->Length;
488 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
489 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
490 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
491 Length, DB_BYTE_DISPLAY, 0);
492 AcpiOsPrintf (" */\n");
498 * Handle tables that don't use the common ACPI table header structure.
499 * Currently, these are the FACS, RSDP, and S3PT.
501 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
503 Length = Table->Length;
504 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
505 if (ACPI_FAILURE (Status))
510 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
512 Length = AcpiDmDumpRsdp (Table);
514 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
516 Length = AcpiDmDumpS3pt (Table);
521 * All other tables must use the common ACPI table header, dump it now
523 Length = Table->Length;
524 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
525 if (ACPI_FAILURE (Status))
531 /* Match signature and dispatch appropriately */
533 TableData = AcpiDmGetTableData (Table->Signature);
536 if (!strncmp (Table->Signature, "OEM", 3))
538 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
543 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
546 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
549 if (!AcpiGbl_ForceAmlDisassembly)
551 fprintf (stderr, "decoding ACPI table header only\n");
555 fprintf (stderr, "assuming table contains valid AML code\n");
559 else if (TableData->TableHandler)
561 /* Complex table, has a handler */
563 TableData->TableHandler (Table);
565 else if (TableData->TableInfo)
567 /* Simple table, just walk the info table */
569 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
570 if (ACPI_FAILURE (Status))
577 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
579 /* Dump the raw table data */
581 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
582 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
583 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
584 Length, DB_BYTE_DISPLAY, 0);
589 /*******************************************************************************
591 * FUNCTION: AcpiDmLineHeader
593 * PARAMETERS: Offset - Current byte offset, from table start
594 * ByteLength - Length of the field in bytes, 0 for flags
595 * Name - Name of this field
599 * DESCRIPTION: Utility routines for formatting output lines. Displays the
600 * current table offset in hex and decimal, the field length,
601 * and the field name.
603 ******************************************************************************/
612 /* Allow a null name for fields that span multiple lines (large buffers) */
619 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
623 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
629 AcpiOsPrintf ("%41s : ", Name);
633 AcpiOsPrintf ("%41s ", Name);
637 else /* Normal disassembler or verbose template */
641 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
642 Offset, Offset, ByteLength, Name);
648 AcpiOsPrintf ("%44s : ", Name);
652 AcpiOsPrintf ("%44s ", Name);
666 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
670 AcpiOsPrintf ("[%.4d] %30s %3d : ",
671 ByteLength, Name, Value);
675 AcpiOsPrintf ("%36s % 3d : ",
679 else /* Normal disassembler or verbose template */
683 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
684 Offset, Offset, ByteLength, Name, Value);
688 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
689 Offset, Offset, Name, Value);
695 /*******************************************************************************
697 * FUNCTION: AcpiDmDumpTable
699 * PARAMETERS: TableLength - Length of the entire ACPI table
700 * TableOffset - Starting offset within the table for this
701 * sub-descriptor (0 if main table)
702 * Table - The ACPI table
703 * SubtableLength - Length of this sub-descriptor
704 * Info - Info table for this ACPI table
708 * DESCRIPTION: Display ACPI table contents by walking the Info table.
710 * Note: This function must remain in sync with DtGetFieldLength.
712 ******************************************************************************/
719 UINT32 SubtableLength,
720 ACPI_DMTABLE_INFO *Info)
723 UINT32 CurrentOffset;
729 const AH_TABLE *TableData;
731 BOOLEAN LastOutputBlankLine = FALSE;
733 char RepairedName[8];
738 AcpiOsPrintf ("Display not implemented\n");
739 return (AE_NOT_IMPLEMENTED);
742 /* Walk entire Info table; Null name terminates */
744 for (; Info->Name; Info++)
747 * Target points to the field within the ACPI Table. CurrentOffset is
748 * the offset of the field from the start of the main table.
750 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
751 CurrentOffset = TableOffset + Info->Offset;
753 /* Check for beyond subtable end or (worse) beyond EOT */
755 if (SubtableLength && (Info->Offset >= SubtableLength))
758 "/**** ACPI subtable terminates early - "
759 "may be older version (dump table) */\n");
761 /* Move on to next subtable */
766 if (CurrentOffset >= TableLength)
769 "/**** ACPI table terminates "
770 "in the middle of a data structure! (dump table) */\n");
771 return (AE_BAD_DATA);
774 /* Generate the byte length for this field */
776 switch (Info->Opcode)
779 case ACPI_DMT_CHKSUM:
780 case ACPI_DMT_SPACEID:
781 case ACPI_DMT_ACCWIDTH:
789 case ACPI_DMT_HESTNTYP:
790 case ACPI_DMT_FADTPM:
791 case ACPI_DMT_EINJACT:
792 case ACPI_DMT_EINJINST:
793 case ACPI_DMT_ERSTACT:
794 case ACPI_DMT_ERSTINST:
795 case ACPI_DMT_DMAR_SCOPE:
800 case ACPI_DMT_UINT16:
808 case ACPI_DMT_UINT24:
813 case ACPI_DMT_UINT32:
821 case ACPI_DMT_UINT40:
826 case ACPI_DMT_UINT48:
832 case ACPI_DMT_UINT56:
838 case ACPI_DMT_UINT64:
855 case ACPI_DMT_BUF128:
860 case ACPI_DMT_UNICODE:
861 case ACPI_DMT_BUFFER:
862 case ACPI_DMT_RAW_BUFFER:
864 ByteLength = SubtableLength;
867 case ACPI_DMT_STRING:
869 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
874 if (!LastOutputBlankLine)
877 LastOutputBlankLine = TRUE;
880 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
883 case ACPI_DMT_HESTNTFY:
885 if (!LastOutputBlankLine)
888 LastOutputBlankLine = TRUE;
891 ByteLength = sizeof (ACPI_HEST_NOTIFY);
894 case ACPI_DMT_IORTMEM:
896 if (!LastOutputBlankLine)
898 LastOutputBlankLine = FALSE;
901 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
910 /* Check if we are beyond a subtable, or (worse) beyond EOT */
912 if (CurrentOffset + ByteLength > TableLength)
917 "/**** ACPI subtable terminates early - "
918 "may be older version (dump table) */\n");
920 /* Move on to next subtable */
926 "/**** ACPI table terminates "
927 "in the middle of a data structure! */\n");
928 return (AE_BAD_DATA);
931 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
933 AcpiOsPrintf ("%s", Info->Name);
937 /* Start a new line and decode the opcode */
939 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
941 switch (Info->Opcode)
943 /* Single-bit Flag fields. Note: Opcode is the bit position */
954 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
957 /* 2-bit Flag fields */
959 case ACPI_DMT_FLAGS0:
961 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
964 case ACPI_DMT_FLAGS1:
966 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
969 case ACPI_DMT_FLAGS2:
971 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
974 case ACPI_DMT_FLAGS4:
976 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
979 /* Integer Data Types */
982 case ACPI_DMT_UINT16:
983 case ACPI_DMT_UINT24:
984 case ACPI_DMT_UINT32:
985 case ACPI_DMT_UINT40:
986 case ACPI_DMT_UINT48:
987 case ACPI_DMT_UINT56:
988 case ACPI_DMT_UINT64:
990 * Dump bytes - high byte first, low byte last.
991 * Note: All ACPI tables are little-endian.
994 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
996 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
997 Value |= Target[Temp8 - 1];
1001 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1003 AcpiOsPrintf (" [Optional field not present]");
1006 AcpiOsPrintf ("\n");
1010 case ACPI_DMT_BUF10:
1011 case ACPI_DMT_BUF16:
1012 case ACPI_DMT_BUF128:
1014 * Buffer: Size depends on the opcode and was set above.
1015 * Each hex byte is separated with a space.
1016 * Multiple lines are separated by line continuation char.
1018 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1020 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1021 if ((UINT32) (Temp16 + 1) < ByteLength)
1023 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1025 AcpiOsPrintf (" \\\n"); /* Line continuation */
1026 AcpiDmLineHeader (0, 0, NULL);
1035 AcpiOsPrintf ("\n");
1040 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1042 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1044 AcpiOsPrintf ("%s\n", MsgBuffer);
1047 case ACPI_DMT_STRING:
1049 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1052 /* Fixed length ASCII name fields */
1056 AcpiDmCheckAscii (Target, RepairedName, 4);
1057 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1059 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1062 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1066 AcpiOsPrintf ("\n");
1070 case ACPI_DMT_NAME4:
1072 AcpiDmCheckAscii (Target, RepairedName, 4);
1073 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1076 case ACPI_DMT_NAME6:
1078 AcpiDmCheckAscii (Target, RepairedName, 6);
1079 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1082 case ACPI_DMT_NAME8:
1084 AcpiDmCheckAscii (Target, RepairedName, 8);
1085 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1088 /* Special Data Types */
1090 case ACPI_DMT_CHKSUM:
1092 /* Checksum, display and validate */
1094 AcpiOsPrintf ("%2.2X", *Target);
1095 Temp8 = AcpiDmGenerateChecksum (Table,
1096 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1097 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1099 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1102 " /* Incorrect checksum, should be %2.2X */", Temp8);
1105 AcpiOsPrintf ("\n");
1108 case ACPI_DMT_SPACEID:
1110 /* Address Space ID */
1112 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1115 case ACPI_DMT_ACCWIDTH:
1117 /* Encoded Access Width */
1120 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1122 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1125 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1130 /* Generic Address Structure */
1132 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1133 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1134 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1135 if (ACPI_FAILURE (Status))
1140 AcpiOsPrintf ("\n");
1141 LastOutputBlankLine = TRUE;
1146 /* ASF subtable types */
1148 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1149 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1151 Temp16 = ACPI_ASF_TYPE_RESERVED;
1154 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1159 /* DMAR subtable types */
1161 Temp16 = ACPI_GET16 (Target);
1162 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1164 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1167 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1168 AcpiDmDmarSubnames[Temp16]);
1171 case ACPI_DMT_DMAR_SCOPE:
1173 /* DMAR device scope types */
1176 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1178 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1181 AcpiOsPrintf (UINT8_FORMAT, *Target,
1182 AcpiDmDmarScope[Temp8]);
1185 case ACPI_DMT_EINJACT:
1187 /* EINJ Action types */
1190 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1192 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1195 AcpiOsPrintf (UINT8_FORMAT, *Target,
1196 AcpiDmEinjActions[Temp8]);
1199 case ACPI_DMT_EINJINST:
1201 /* EINJ Instruction types */
1204 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1206 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1209 AcpiOsPrintf (UINT8_FORMAT, *Target,
1210 AcpiDmEinjInstructions[Temp8]);
1213 case ACPI_DMT_ERSTACT:
1215 /* ERST Action types */
1218 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1220 Temp8 = ACPI_ERST_ACTION_RESERVED;
1223 AcpiOsPrintf (UINT8_FORMAT, *Target,
1224 AcpiDmErstActions[Temp8]);
1227 case ACPI_DMT_ERSTINST:
1229 /* ERST Instruction types */
1232 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1234 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1237 AcpiOsPrintf (UINT8_FORMAT, *Target,
1238 AcpiDmErstInstructions[Temp8]);
1243 /* GTDT subtable types */
1246 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1248 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1251 AcpiOsPrintf (UINT8_FORMAT, *Target,
1252 AcpiDmGtdtSubnames[Temp8]);
1257 /* HEST subtable types */
1259 Temp16 = ACPI_GET16 (Target);
1260 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1262 Temp16 = ACPI_HEST_TYPE_RESERVED;
1265 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1266 AcpiDmHestSubnames[Temp16]);
1269 case ACPI_DMT_HESTNTFY:
1271 AcpiOsPrintf (STRING_FORMAT,
1272 "Hardware Error Notification Structure");
1274 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1275 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1276 if (ACPI_FAILURE (Status))
1281 AcpiOsPrintf ("\n");
1282 LastOutputBlankLine = TRUE;
1285 case ACPI_DMT_HESTNTYP:
1287 /* HEST Notify types */
1290 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1292 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1295 AcpiOsPrintf (UINT8_FORMAT, *Target,
1296 AcpiDmHestNotifySubnames[Temp8]);
1299 case ACPI_DMT_IORTMEM:
1301 AcpiOsPrintf (STRING_FORMAT,
1302 "IORT Memory Access Properties");
1304 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1305 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1306 if (ACPI_FAILURE (Status))
1311 LastOutputBlankLine = TRUE;
1316 /* MADT subtable types */
1319 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1321 Temp8 = ACPI_MADT_TYPE_RESERVED;
1324 AcpiOsPrintf (UINT8_FORMAT, *Target,
1325 AcpiDmMadtSubnames[Temp8]);
1330 /* NFIT subtable types */
1332 Temp16 = ACPI_GET16 (Target);
1333 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1335 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1338 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1339 AcpiDmNfitSubnames[Temp16]);
1344 /* PCCT subtable types */
1347 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1349 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1352 AcpiOsPrintf (UINT8_FORMAT, *Target,
1353 AcpiDmPcctSubnames[Temp8]);
1358 /* PMTT subtable types */
1361 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1363 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1366 AcpiOsPrintf (UINT8_FORMAT, *Target,
1367 AcpiDmPmttSubnames[Temp8]);
1370 case ACPI_DMT_UNICODE:
1372 if (ByteLength == 0)
1374 AcpiOsPrintf ("/* Zero-length Data */\n");
1378 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1381 case ACPI_DMT_RAW_BUFFER:
1383 if (ByteLength == 0)
1385 AcpiOsPrintf ("/* Zero-length Data */\n");
1389 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1390 CurrentOffset, NULL);
1395 /* SRAT subtable types */
1398 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1400 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1403 AcpiOsPrintf (UINT8_FORMAT, *Target,
1404 AcpiDmSratSubnames[Temp8]);
1407 case ACPI_DMT_FADTPM:
1409 /* FADT Preferred PM Profile names */
1412 if (Temp8 > ACPI_FADT_PM_RESERVED)
1414 Temp8 = ACPI_FADT_PM_RESERVED;
1417 AcpiOsPrintf (UINT8_FORMAT, *Target,
1418 AcpiDmFadtProfiles[Temp8]);
1423 /* IVRS subtable types */
1428 case ACPI_IVRS_TYPE_HARDWARE:
1430 Name = AcpiDmIvrsSubnames[0];
1433 case ACPI_IVRS_TYPE_MEMORY1:
1434 case ACPI_IVRS_TYPE_MEMORY2:
1435 case ACPI_IVRS_TYPE_MEMORY3:
1437 Name = AcpiDmIvrsSubnames[1];
1442 Name = AcpiDmIvrsSubnames[2];
1446 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1451 /* LPIT subtable types */
1453 Temp32 = ACPI_GET32 (Target);
1454 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1456 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1459 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1460 AcpiDmLpitSubnames[Temp32]);
1469 ACPI_ERROR ((AE_INFO,
1470 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1471 return (AE_SUPPORT);
1475 if (TableOffset && !SubtableLength)
1478 * If this table is not the main table, the subtable must have a
1481 AcpiOsPrintf ("Invalid zero length subtable\n");
1482 return (AE_BAD_DATA);
1489 /*******************************************************************************
1491 * FUNCTION: AcpiDmCheckAscii
1493 * PARAMETERS: Name - Ascii string
1494 * Count - Number of characters to check
1498 * DESCRIPTION: Ensure that the requested number of characters are printable
1499 * Ascii characters. Sets non-printable and null chars to <space>.
1501 ******************************************************************************/
1512 for (i = 0; i < Count; i++)
1514 RepairedName[i] = (char) Name[i];
1520 if (!isprint (Name[i]))
1522 RepairedName[i] = ' ';