1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
117 #include "accommon.h"
118 #include "acdisasm.h"
119 #include "actables.h"
120 #include "aslcompiler.h"
121 #include "dtcompiler.h"
123 /* This module used for application-level code only */
125 #define _COMPONENT ACPI_CA_DISASSEMBLER
126 ACPI_MODULE_NAME ("dmtable")
128 /* Local Prototypes */
137 /* Common format strings for commented values */
139 #define UINT8_FORMAT "%2.2X [%s]\n"
140 #define UINT16_FORMAT "%4.4X [%s]\n"
141 #define UINT32_FORMAT "%8.8X [%s]\n"
142 #define STRING_FORMAT "[%s]\n"
144 /* These tables map a subtable type to a description string */
146 static const char *AcpiDmAsfSubnames
[] =
150 "ASF Remote Control",
151 "ASF RMCP Boot Options",
153 "Unknown SubTable Type" /* Reserved */
156 static const char *AcpiDmDmarSubnames
[] =
158 "Hardware Unit Definition",
159 "Reserved Memory Region",
160 "Root Port ATS Capability",
161 "Remapping Hardware Static Affinity",
162 "ACPI Namespace Device Declaration",
163 "Unknown SubTable Type" /* Reserved */
166 static const char *AcpiDmDmarScope
[] =
169 "PCI Endpoint Device",
172 "Message-capable HPET Device",
174 "Unknown Scope Type" /* Reserved */
177 static const char *AcpiDmEinjActions
[] =
186 "Get Command Status",
187 "Set Error Type With Address",
191 static const char *AcpiDmEinjInstructions
[] =
194 "Read Register Value",
196 "Write Register Value",
199 "Unknown Instruction"
202 static const char *AcpiDmErstActions
[] =
204 "Begin Write Operation",
205 "Begin Read Operation",
206 "Begin Clear Operation",
211 "Get Command Status",
212 "Get Record Identifier",
213 "Set Record Identifier",
216 "Unused/Unknown Action",
217 "Get Error Address Range",
218 "Get Error Address Length",
219 "Get Error Attributes",
223 static const char *AcpiDmErstInstructions
[] =
226 "Read Register Value",
228 "Write Register Value",
241 "Set Source Address",
242 "Set Destination Address",
244 "Unknown Instruction"
247 static const char *AcpiDmGtdtSubnames
[] =
249 "Generic Timer Block",
250 "Generic Watchdog Timer",
251 "Unknown SubTable Type" /* Reserved */
254 static const char *AcpiDmHestSubnames
[] =
256 "IA-32 Machine Check Exception",
257 "IA-32 Corrected Machine Check",
258 "IA-32 Non-Maskable Interrupt",
259 "Unknown SubTable Type", /* 3 - Reserved */
260 "Unknown SubTable Type", /* 4 - Reserved */
261 "Unknown SubTable Type", /* 5 - Reserved */
262 "PCI Express Root Port AER",
263 "PCI Express AER (AER Endpoint)",
264 "PCI Express/PCI-X Bridge AER",
265 "Generic Hardware Error Source",
266 "Unknown SubTable Type" /* Reserved */
269 static const char *AcpiDmHestNotifySubnames
[] =
272 "External Interrupt",
276 "CMCI", /* ACPI 5.0 */
277 "MCE", /* ACPI 5.0 */
278 "Unknown Notify Type" /* Reserved */
281 static const char *AcpiDmMadtSubnames
[] =
283 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
284 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
285 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
286 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
287 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
288 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
289 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
290 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
291 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
292 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
293 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
294 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
295 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
296 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
297 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
298 "Unknown SubTable Type" /* Reserved */
301 static const char *AcpiDmPcctSubnames
[] =
303 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
304 "HW-Reduced Communications Subspace",
305 "Unknown SubTable Type" /* Reserved */
308 static const char *AcpiDmPmttSubnames
[] =
310 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
311 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
312 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
313 "Unknown SubTable Type" /* Reserved */
316 static const char *AcpiDmSlicSubnames
[] =
318 "Public Key Structure",
319 "Windows Marker Structure",
320 "Unknown SubTable Type" /* Reserved */
323 static const char *AcpiDmSratSubnames
[] =
325 "Processor Local APIC/SAPIC Affinity",
327 "Processor Local x2APIC Affinity",
328 "Unknown SubTable Type" /* Reserved */
331 static const char *AcpiDmIvrsSubnames
[] =
333 "Hardware Definition Block",
334 "Memory Definition Block",
335 "Unknown SubTable Type" /* Reserved */
338 static const char *AcpiDmLpitSubnames
[] =
340 "Native C-state Idle Structure",
341 "Simple I/O Idle Structure",
342 "Unknown SubTable Type" /* Reserved */
345 #define ACPI_FADT_PM_RESERVED 9
347 static const char *AcpiDmFadtProfiles
[] =
356 "Performance Server",
358 "Unknown Profile Type"
361 #define ACPI_GAS_WIDTH_RESERVED 5
363 static const char *AcpiDmGasAccessWidth
[] =
370 "Unknown Width Encoding"
374 /*******************************************************************************
376 * ACPI Table Data, indexed by signature.
378 * Each entry contains: Signature, Table Info, Handler, DtHandler,
379 * Template, Description
381 * Simple tables have only a TableInfo structure, complex tables have a
382 * handler. This table must be NULL terminated. RSDP and FACS are
383 * special-cased elsewhere.
385 ******************************************************************************/
387 ACPI_DMTABLE_DATA AcpiDmTableData
[] =
389 {ACPI_SIG_ASF
, NULL
, AcpiDmDumpAsf
, DtCompileAsf
, TemplateAsf
, "Alert Standard Format table"},
390 {ACPI_SIG_BERT
, AcpiDmTableInfoBert
, NULL
, NULL
, TemplateBert
, "Boot Error Record Table"},
391 {ACPI_SIG_BGRT
, AcpiDmTableInfoBgrt
, NULL
, NULL
, TemplateBgrt
, "Boot Graphics Resource Table"},
392 {ACPI_SIG_BOOT
, AcpiDmTableInfoBoot
, NULL
, NULL
, TemplateBoot
, "Simple Boot Flag Table"},
393 {ACPI_SIG_CPEP
, NULL
, AcpiDmDumpCpep
, DtCompileCpep
, TemplateCpep
, "Corrected Platform Error Polling table"},
394 {ACPI_SIG_CSRT
, NULL
, AcpiDmDumpCsrt
, DtCompileCsrt
, TemplateCsrt
, "Core System Resource Table"},
395 {ACPI_SIG_DBG2
, AcpiDmTableInfoDbg2
, AcpiDmDumpDbg2
, DtCompileDbg2
, TemplateDbg2
, "Debug Port table type 2"},
396 {ACPI_SIG_DBGP
, AcpiDmTableInfoDbgp
, NULL
, NULL
, TemplateDbgp
, "Debug Port table"},
397 {ACPI_SIG_DMAR
, NULL
, AcpiDmDumpDmar
, DtCompileDmar
, TemplateDmar
, "DMA Remapping table"},
398 {ACPI_SIG_ECDT
, AcpiDmTableInfoEcdt
, NULL
, NULL
, TemplateEcdt
, "Embedded Controller Boot Resources Table"},
399 {ACPI_SIG_EINJ
, NULL
, AcpiDmDumpEinj
, DtCompileEinj
, TemplateEinj
, "Error Injection table"},
400 {ACPI_SIG_ERST
, NULL
, AcpiDmDumpErst
, DtCompileErst
, TemplateErst
, "Error Record Serialization Table"},
401 {ACPI_SIG_FADT
, NULL
, AcpiDmDumpFadt
, DtCompileFadt
, TemplateFadt
, "Fixed ACPI Description Table (FADT)"},
402 {ACPI_SIG_FPDT
, NULL
, AcpiDmDumpFpdt
, DtCompileFpdt
, TemplateFpdt
, "Firmware Performance Data Table"},
403 {ACPI_SIG_GTDT
, NULL
, AcpiDmDumpGtdt
, DtCompileGtdt
, TemplateGtdt
, "Generic Timer Description Table"},
404 {ACPI_SIG_HEST
, NULL
, AcpiDmDumpHest
, DtCompileHest
, TemplateHest
, "Hardware Error Source Table"},
405 {ACPI_SIG_HPET
, AcpiDmTableInfoHpet
, NULL
, NULL
, TemplateHpet
, "High Precision Event Timer table"},
406 {ACPI_SIG_IVRS
, NULL
, AcpiDmDumpIvrs
, DtCompileIvrs
, TemplateIvrs
, "I/O Virtualization Reporting Structure"},
407 {ACPI_SIG_LPIT
, NULL
, AcpiDmDumpLpit
, DtCompileLpit
, TemplateLpit
, "Low Power Idle Table"},
408 {ACPI_SIG_MADT
, NULL
, AcpiDmDumpMadt
, DtCompileMadt
, TemplateMadt
, "Multiple APIC Description Table (MADT)"},
409 {ACPI_SIG_MCFG
, NULL
, AcpiDmDumpMcfg
, DtCompileMcfg
, TemplateMcfg
, "Memory Mapped Configuration table"},
410 {ACPI_SIG_MCHI
, AcpiDmTableInfoMchi
, NULL
, NULL
, TemplateMchi
, "Management Controller Host Interface table"},
411 {ACPI_SIG_MPST
, AcpiDmTableInfoMpst
, AcpiDmDumpMpst
, DtCompileMpst
, TemplateMpst
, "Memory Power State Table"},
412 {ACPI_SIG_MSCT
, NULL
, AcpiDmDumpMsct
, DtCompileMsct
, TemplateMsct
, "Maximum System Characteristics Table"},
413 {ACPI_SIG_MTMR
, NULL
, AcpiDmDumpMtmr
, DtCompileMtmr
, TemplateMtmr
, "MID Timer Table"},
414 {ACPI_SIG_PCCT
, AcpiDmTableInfoPcct
, AcpiDmDumpPcct
, DtCompilePcct
, TemplatePcct
, "Platform Communications Channel Table"},
415 {ACPI_SIG_PMTT
, NULL
, AcpiDmDumpPmtt
, DtCompilePmtt
, TemplatePmtt
, "Platform Memory Topology Table"},
416 {ACPI_SIG_RSDT
, NULL
, AcpiDmDumpRsdt
, DtCompileRsdt
, TemplateRsdt
, "Root System Description Table"},
417 {ACPI_SIG_S3PT
, NULL
, NULL
, NULL
, TemplateS3pt
, "S3 Performance Table"},
418 {ACPI_SIG_SBST
, AcpiDmTableInfoSbst
, NULL
, NULL
, TemplateSbst
, "Smart Battery Specification Table"},
419 {ACPI_SIG_SLIC
, NULL
, AcpiDmDumpSlic
, DtCompileSlic
, TemplateSlic
, "Software Licensing Description Table"},
420 {ACPI_SIG_SLIT
, NULL
, AcpiDmDumpSlit
, DtCompileSlit
, TemplateSlit
, "System Locality Information Table"},
421 {ACPI_SIG_SPCR
, AcpiDmTableInfoSpcr
, NULL
, NULL
, TemplateSpcr
, "Serial Port Console Redirection table"},
422 {ACPI_SIG_SPMI
, AcpiDmTableInfoSpmi
, NULL
, NULL
, TemplateSpmi
, "Server Platform Management Interface table"},
423 {ACPI_SIG_SRAT
, NULL
, AcpiDmDumpSrat
, DtCompileSrat
, TemplateSrat
, "System Resource Affinity Table"},
424 {ACPI_SIG_TCPA
, AcpiDmTableInfoTcpa
, NULL
, NULL
, TemplateTcpa
, "Trusted Computing Platform Alliance table"},
425 {ACPI_SIG_TPM2
, AcpiDmTableInfoTpm2
, NULL
, NULL
, TemplateTpm2
, "Trusted Platform Module hardware interface table"},
426 {ACPI_SIG_UEFI
, AcpiDmTableInfoUefi
, NULL
, DtCompileUefi
, TemplateUefi
, "UEFI Boot Optimization Table"},
427 {ACPI_SIG_VRTC
, AcpiDmTableInfoVrtc
, AcpiDmDumpVrtc
, DtCompileVrtc
, TemplateVrtc
, "Virtual Real-Time Clock Table"},
428 {ACPI_SIG_WAET
, AcpiDmTableInfoWaet
, NULL
, NULL
, TemplateWaet
, "Windows ACPI Emulated Devices Table"},
429 {ACPI_SIG_WDAT
, NULL
, AcpiDmDumpWdat
, DtCompileWdat
, TemplateWdat
, "Watchdog Action Table"},
430 {ACPI_SIG_WDDT
, AcpiDmTableInfoWddt
, NULL
, NULL
, TemplateWddt
, "Watchdog Description Table"},
431 {ACPI_SIG_WDRT
, AcpiDmTableInfoWdrt
, NULL
, NULL
, TemplateWdrt
, "Watchdog Resource Table"},
432 {ACPI_SIG_XSDT
, NULL
, AcpiDmDumpXsdt
, DtCompileXsdt
, TemplateXsdt
, "Extended System Description Table"},
433 {NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
437 /*******************************************************************************
439 * FUNCTION: AcpiDmGenerateChecksum
441 * PARAMETERS: Table - Pointer to table to be checksummed
442 * Length - Length of the table
443 * OriginalChecksum - Value of the checksum field
445 * RETURN: 8 bit checksum of buffer
447 * DESCRIPTION: Computes an 8 bit checksum of the table.
449 ******************************************************************************/
452 AcpiDmGenerateChecksum (
455 UINT8 OriginalChecksum
)
460 /* Sum the entire table as-is */
462 Checksum
= AcpiTbChecksum ((UINT8
*) Table
, Length
);
464 /* Subtract off the existing checksum value in the table */
466 Checksum
= (UINT8
) (Checksum
- OriginalChecksum
);
468 /* Compute the final checksum */
470 Checksum
= (UINT8
) (0 - Checksum
);
475 /*******************************************************************************
477 * FUNCTION: AcpiDmGetTableData
479 * PARAMETERS: Signature - ACPI signature (4 chars) to match
481 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
483 * DESCRIPTION: Find a match in the global table of supported ACPI tables
485 ******************************************************************************/
491 ACPI_DMTABLE_DATA
*TableData
;
494 for (TableData
= AcpiDmTableData
; TableData
->Signature
; TableData
++)
496 if (ACPI_COMPARE_NAME (Signature
, TableData
->Signature
))
506 /*******************************************************************************
508 * FUNCTION: AcpiDmDumpDataTable
510 * PARAMETERS: Table - An ACPI table
514 * DESCRIPTION: Format the contents of an ACPI data table (any table other
515 * than an SSDT or DSDT that does not contain executable AML code)
517 ******************************************************************************/
520 AcpiDmDumpDataTable (
521 ACPI_TABLE_HEADER
*Table
)
524 ACPI_DMTABLE_DATA
*TableData
;
528 /* Ignore tables that contain AML */
530 if (AcpiUtIsAmlTable (Table
))
532 if (Gbl_VerboseTemplates
)
534 /* Dump the raw table data */
536 Length
= Table
->Length
;
538 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
539 ACPI_RAW_TABLE_DATA_HEADER
, Length
, Length
);
540 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8
, Table
),
541 Length
, DB_BYTE_DISPLAY
, 0);
542 AcpiOsPrintf (" */\n");
548 * Handle tables that don't use the common ACPI table header structure.
549 * Currently, these are the FACS, RSDP, and S3PT.
551 if (ACPI_COMPARE_NAME (Table
->Signature
, ACPI_SIG_FACS
))
553 Length
= Table
->Length
;
554 AcpiDmDumpTable (Length
, 0, Table
, 0, AcpiDmTableInfoFacs
);
556 else if (ACPI_VALIDATE_RSDP_SIG (Table
->Signature
))
558 Length
= AcpiDmDumpRsdp (Table
);
560 else if (ACPI_COMPARE_NAME (Table
->Signature
, ACPI_SIG_S3PT
))
562 Length
= AcpiDmDumpS3pt (Table
);
567 * All other tables must use the common ACPI table header, dump it now
569 Length
= Table
->Length
;
570 Status
= AcpiDmDumpTable (Length
, 0, Table
, 0, AcpiDmTableInfoHeader
);
571 if (ACPI_FAILURE (Status
))
577 /* Match signature and dispatch appropriately */
579 TableData
= AcpiDmGetTableData (Table
->Signature
);
582 if (!ACPI_STRNCMP (Table
->Signature
, "OEM", 3))
584 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
589 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
591 fprintf (stderr
, "Unknown ACPI table signature [%4.4s], decoding header only\n",
595 else if (TableData
->TableHandler
)
597 /* Complex table, has a handler */
599 TableData
->TableHandler (Table
);
601 else if (TableData
->TableInfo
)
603 /* Simple table, just walk the info table */
605 AcpiDmDumpTable (Length
, 0, Table
, 0, TableData
->TableInfo
);
609 if (!Gbl_DoTemplates
|| Gbl_VerboseTemplates
)
611 /* Dump the raw table data */
613 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
614 ACPI_RAW_TABLE_DATA_HEADER
, Length
, Length
);
615 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8
, Table
),
616 Length
, DB_BYTE_DISPLAY
, 0);
621 /*******************************************************************************
623 * FUNCTION: AcpiDmLineHeader
625 * PARAMETERS: Offset - Current byte offset, from table start
626 * ByteLength - Length of the field in bytes, 0 for flags
627 * Name - Name of this field
628 * Value - Optional value, displayed on left of ':'
632 * DESCRIPTION: Utility routines for formatting output lines. Displays the
633 * current table offset in hex and decimal, the field length,
634 * and the field name.
636 ******************************************************************************/
645 /* Allow a null name for fields that span multiple lines (large buffers) */
652 if (Gbl_DoTemplates
&& !Gbl_VerboseTemplates
) /* Terse template */
656 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength
, Name
);
662 AcpiOsPrintf ("%41s : ", Name
);
666 AcpiOsPrintf ("%41s ", Name
);
670 else /* Normal disassembler or verbose template */
674 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
675 Offset
, Offset
, ByteLength
, Name
);
681 AcpiOsPrintf ("%44s : ", Name
);
685 AcpiOsPrintf ("%44s ", Name
);
699 if (Gbl_DoTemplates
&& !Gbl_VerboseTemplates
) /* Terse template */
703 AcpiOsPrintf ("[%.4d] %30s %3d : ",
704 ByteLength
, Name
, Value
);
708 AcpiOsPrintf ("%36s % 3d : ",
712 else /* Normal disassembler or verbose template */
716 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
717 Offset
, Offset
, ByteLength
, Name
, Value
);
721 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
722 Offset
, Offset
, Name
, Value
);
728 /*******************************************************************************
730 * FUNCTION: AcpiDmDumpTable
732 * PARAMETERS: TableLength - Length of the entire ACPI table
733 * TableOffset - Starting offset within the table for this
734 * sub-descriptor (0 if main table)
735 * Table - The ACPI table
736 * SubtableLength - Length of this sub-descriptor
737 * Info - Info table for this ACPI table
741 * DESCRIPTION: Display ACPI table contents by walking the Info table.
743 * Note: This function must remain in sync with DtGetFieldLength.
745 ******************************************************************************/
752 UINT32 SubtableLength
,
753 ACPI_DMTABLE_INFO
*Info
)
756 UINT32 CurrentOffset
;
761 ACPI_DMTABLE_DATA
*TableData
;
763 BOOLEAN LastOutputBlankLine
= FALSE
;
764 char RepairedName
[8];
769 AcpiOsPrintf ("Display not implemented\n");
770 return (AE_NOT_IMPLEMENTED
);
773 /* Walk entire Info table; Null name terminates */
775 for (; Info
->Name
; Info
++)
778 * Target points to the field within the ACPI Table. CurrentOffset is
779 * the offset of the field from the start of the main table.
781 Target
= ACPI_ADD_PTR (UINT8
, Table
, Info
->Offset
);
782 CurrentOffset
= TableOffset
+ Info
->Offset
;
784 /* Check for beyond EOT or beyond subtable end */
786 if ((CurrentOffset
>= TableLength
) ||
787 (SubtableLength
&& (Info
->Offset
>= SubtableLength
)))
789 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
790 return (AE_BAD_DATA
);
793 /* Generate the byte length for this field */
795 switch (Info
->Opcode
)
798 case ACPI_DMT_CHKSUM
:
799 case ACPI_DMT_SPACEID
:
800 case ACPI_DMT_ACCWIDTH
:
808 case ACPI_DMT_HESTNTYP
:
809 case ACPI_DMT_FADTPM
:
810 case ACPI_DMT_EINJACT
:
811 case ACPI_DMT_EINJINST
:
812 case ACPI_DMT_ERSTACT
:
813 case ACPI_DMT_ERSTINST
:
814 case ACPI_DMT_DMAR_SCOPE
:
819 case ACPI_DMT_UINT16
:
826 case ACPI_DMT_UINT24
:
831 case ACPI_DMT_UINT32
:
840 case ACPI_DMT_UINT40
:
845 case ACPI_DMT_UINT48
:
851 case ACPI_DMT_UINT56
:
857 case ACPI_DMT_UINT64
:
874 case ACPI_DMT_BUF128
:
879 case ACPI_DMT_STRING
:
881 ByteLength
= ACPI_STRLEN (ACPI_CAST_PTR (char, Target
)) + 1;
886 if (!LastOutputBlankLine
)
889 LastOutputBlankLine
= TRUE
;
891 ByteLength
= sizeof (ACPI_GENERIC_ADDRESS
);
894 case ACPI_DMT_HESTNTFY
:
896 if (!LastOutputBlankLine
)
899 LastOutputBlankLine
= TRUE
;
901 ByteLength
= sizeof (ACPI_HEST_NOTIFY
);
910 if (CurrentOffset
+ ByteLength
> TableLength
)
912 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
913 return (AE_BAD_DATA
);
916 if (Info
->Opcode
== ACPI_DMT_EXTRA_TEXT
)
918 AcpiOsPrintf ("%s", Info
->Name
);
922 /* Start a new line and decode the opcode */
924 AcpiDmLineHeader (CurrentOffset
, ByteLength
, Info
->Name
);
926 switch (Info
->Opcode
)
928 /* Single-bit Flag fields. Note: Opcode is the bit position */
939 AcpiOsPrintf ("%1.1X\n", (*Target
>> Info
->Opcode
) & 0x01);
942 /* 2-bit Flag fields */
944 case ACPI_DMT_FLAGS0
:
946 AcpiOsPrintf ("%1.1X\n", *Target
& 0x03);
949 case ACPI_DMT_FLAGS1
:
951 AcpiOsPrintf ("%1.1X\n", (*Target
>> 1) & 0x03);
954 case ACPI_DMT_FLAGS2
:
956 AcpiOsPrintf ("%1.1X\n", (*Target
>> 2) & 0x03);
959 case ACPI_DMT_FLAGS4
:
961 AcpiOsPrintf ("%1.1X\n", (*Target
>> 4) & 0x03);
964 /* Integer Data Types */
967 case ACPI_DMT_UINT16
:
968 case ACPI_DMT_UINT24
:
969 case ACPI_DMT_UINT32
:
970 case ACPI_DMT_UINT40
:
971 case ACPI_DMT_UINT48
:
972 case ACPI_DMT_UINT56
:
973 case ACPI_DMT_UINT64
:
975 * Dump bytes - high byte first, low byte last.
976 * Note: All ACPI tables are little-endian.
979 for (Temp8
= (UINT8
) ByteLength
; Temp8
> 0; Temp8
--)
981 AcpiOsPrintf ("%2.2X", Target
[Temp8
- 1]);
982 Value
|= Target
[Temp8
- 1];
986 if (!Value
&& (Info
->Flags
& DT_DESCRIBES_OPTIONAL
))
988 AcpiOsPrintf (" [Optional field not present]");
997 case ACPI_DMT_BUF128
:
999 * Buffer: Size depends on the opcode and was set above.
1000 * Each hex byte is separated with a space.
1001 * Multiple lines are separated by line continuation char.
1003 for (Temp16
= 0; Temp16
< ByteLength
; Temp16
++)
1005 AcpiOsPrintf ("%2.2X", Target
[Temp16
]);
1006 if ((UINT32
) (Temp16
+ 1) < ByteLength
)
1008 if ((Temp16
> 0) && (!((Temp16
+1) % 16)))
1010 AcpiOsPrintf (" \\\n"); /* Line continuation */
1011 AcpiDmLineHeader (0, 0, NULL
);
1019 AcpiOsPrintf ("\n");
1024 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1026 (void) AuConvertUuidToString ((char *) Target
, MsgBuffer
);
1028 AcpiOsPrintf ("%s\n", MsgBuffer
);
1031 case ACPI_DMT_STRING
:
1033 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target
));
1036 /* Fixed length ASCII name fields */
1040 AcpiDmCheckAscii (Target
, RepairedName
, 4);
1041 AcpiOsPrintf ("\"%.4s\" ", RepairedName
);
1042 TableData
= AcpiDmGetTableData (ACPI_CAST_PTR (char, Target
));
1045 AcpiOsPrintf (STRING_FORMAT
, TableData
->Name
);
1049 AcpiOsPrintf ("\n");
1053 case ACPI_DMT_NAME4
:
1055 AcpiDmCheckAscii (Target
, RepairedName
, 4);
1056 AcpiOsPrintf ("\"%.4s\"\n", RepairedName
);
1059 case ACPI_DMT_NAME6
:
1061 AcpiDmCheckAscii (Target
, RepairedName
, 6);
1062 AcpiOsPrintf ("\"%.6s\"\n", RepairedName
);
1065 case ACPI_DMT_NAME8
:
1067 AcpiDmCheckAscii (Target
, RepairedName
, 8);
1068 AcpiOsPrintf ("\"%.8s\"\n", RepairedName
);
1071 /* Special Data Types */
1073 case ACPI_DMT_CHKSUM
:
1075 /* Checksum, display and validate */
1077 AcpiOsPrintf ("%2.2X", *Target
);
1078 Temp8
= AcpiDmGenerateChecksum (Table
,
1079 ACPI_CAST_PTR (ACPI_TABLE_HEADER
, Table
)->Length
,
1080 ACPI_CAST_PTR (ACPI_TABLE_HEADER
, Table
)->Checksum
);
1081 if (Temp8
!= ACPI_CAST_PTR (ACPI_TABLE_HEADER
, Table
)->Checksum
)
1084 " /* Incorrect checksum, should be %2.2X */", Temp8
);
1086 AcpiOsPrintf ("\n");
1089 case ACPI_DMT_SPACEID
:
1091 /* Address Space ID */
1093 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiUtGetRegionName (*Target
));
1096 case ACPI_DMT_ACCWIDTH
:
1098 /* Encoded Access Width */
1101 if (Temp8
> ACPI_GAS_WIDTH_RESERVED
)
1103 Temp8
= ACPI_GAS_WIDTH_RESERVED
;
1106 AcpiOsPrintf (UINT8_FORMAT
, Temp8
, AcpiDmGasAccessWidth
[Temp8
]);
1111 /* Generic Address Structure */
1113 AcpiOsPrintf (STRING_FORMAT
, "Generic Address Structure");
1114 AcpiDmDumpTable (TableLength
, CurrentOffset
, Target
,
1115 sizeof (ACPI_GENERIC_ADDRESS
), AcpiDmTableInfoGas
);
1116 AcpiOsPrintf ("\n");
1117 LastOutputBlankLine
= TRUE
;
1122 /* ASF subtable types */
1124 Temp16
= (UINT16
) ((*Target
) & 0x7F); /* Top bit can be zero or one */
1125 if (Temp16
> ACPI_ASF_TYPE_RESERVED
)
1127 Temp16
= ACPI_ASF_TYPE_RESERVED
;
1130 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmAsfSubnames
[Temp16
]);
1135 /* DMAR subtable types */
1137 Temp16
= ACPI_GET16 (Target
);
1138 if (Temp16
> ACPI_DMAR_TYPE_RESERVED
)
1140 Temp16
= ACPI_DMAR_TYPE_RESERVED
;
1143 AcpiOsPrintf (UINT16_FORMAT
, ACPI_GET16 (Target
), AcpiDmDmarSubnames
[Temp16
]);
1146 case ACPI_DMT_DMAR_SCOPE
:
1148 /* DMAR device scope types */
1151 if (Temp8
> ACPI_DMAR_SCOPE_TYPE_RESERVED
)
1153 Temp8
= ACPI_DMAR_SCOPE_TYPE_RESERVED
;
1156 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmDmarScope
[Temp8
]);
1159 case ACPI_DMT_EINJACT
:
1161 /* EINJ Action types */
1164 if (Temp8
> ACPI_EINJ_ACTION_RESERVED
)
1166 Temp8
= ACPI_EINJ_ACTION_RESERVED
;
1169 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmEinjActions
[Temp8
]);
1172 case ACPI_DMT_EINJINST
:
1174 /* EINJ Instruction types */
1177 if (Temp8
> ACPI_EINJ_INSTRUCTION_RESERVED
)
1179 Temp8
= ACPI_EINJ_INSTRUCTION_RESERVED
;
1182 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmEinjInstructions
[Temp8
]);
1185 case ACPI_DMT_ERSTACT
:
1187 /* ERST Action types */
1190 if (Temp8
> ACPI_ERST_ACTION_RESERVED
)
1192 Temp8
= ACPI_ERST_ACTION_RESERVED
;
1195 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmErstActions
[Temp8
]);
1198 case ACPI_DMT_ERSTINST
:
1200 /* ERST Instruction types */
1203 if (Temp8
> ACPI_ERST_INSTRUCTION_RESERVED
)
1205 Temp8
= ACPI_ERST_INSTRUCTION_RESERVED
;
1208 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmErstInstructions
[Temp8
]);
1213 /* GTDT subtable types */
1216 if (Temp8
> ACPI_GTDT_TYPE_RESERVED
)
1218 Temp8
= ACPI_GTDT_TYPE_RESERVED
;
1221 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmGtdtSubnames
[Temp8
]);
1226 /* HEST subtable types */
1228 Temp16
= ACPI_GET16 (Target
);
1229 if (Temp16
> ACPI_HEST_TYPE_RESERVED
)
1231 Temp16
= ACPI_HEST_TYPE_RESERVED
;
1234 AcpiOsPrintf (UINT16_FORMAT
, ACPI_GET16 (Target
), AcpiDmHestSubnames
[Temp16
]);
1237 case ACPI_DMT_HESTNTFY
:
1239 AcpiOsPrintf (STRING_FORMAT
, "Hardware Error Notification Structure");
1240 AcpiDmDumpTable (TableLength
, CurrentOffset
, Target
,
1241 sizeof (ACPI_HEST_NOTIFY
), AcpiDmTableInfoHestNotify
);
1242 AcpiOsPrintf ("\n");
1243 LastOutputBlankLine
= TRUE
;
1246 case ACPI_DMT_HESTNTYP
:
1248 /* HEST Notify types */
1251 if (Temp8
> ACPI_HEST_NOTIFY_RESERVED
)
1253 Temp8
= ACPI_HEST_NOTIFY_RESERVED
;
1256 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmHestNotifySubnames
[Temp8
]);
1261 /* MADT subtable types */
1264 if (Temp8
> ACPI_MADT_TYPE_RESERVED
)
1266 Temp8
= ACPI_MADT_TYPE_RESERVED
;
1269 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmMadtSubnames
[Temp8
]);
1274 /* PCCT subtable types */
1277 if (Temp8
> ACPI_PCCT_TYPE_RESERVED
)
1279 Temp8
= ACPI_PCCT_TYPE_RESERVED
;
1282 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmPcctSubnames
[Temp8
]);
1287 /* PMTT subtable types */
1290 if (Temp8
> ACPI_PMTT_TYPE_RESERVED
)
1292 Temp8
= ACPI_PMTT_TYPE_RESERVED
;
1295 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmPmttSubnames
[Temp8
]);
1300 /* SLIC subtable types */
1303 if (Temp8
> ACPI_SLIC_TYPE_RESERVED
)
1305 Temp8
= ACPI_SLIC_TYPE_RESERVED
;
1308 AcpiOsPrintf (UINT32_FORMAT
, *Target
, AcpiDmSlicSubnames
[Temp8
]);
1313 /* SRAT subtable types */
1316 if (Temp8
> ACPI_SRAT_TYPE_RESERVED
)
1318 Temp8
= ACPI_SRAT_TYPE_RESERVED
;
1321 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmSratSubnames
[Temp8
]);
1324 case ACPI_DMT_FADTPM
:
1326 /* FADT Preferred PM Profile names */
1329 if (Temp8
> ACPI_FADT_PM_RESERVED
)
1331 Temp8
= ACPI_FADT_PM_RESERVED
;
1334 AcpiOsPrintf (UINT8_FORMAT
, *Target
, AcpiDmFadtProfiles
[Temp8
]);
1339 /* IVRS subtable types */
1344 case ACPI_IVRS_TYPE_HARDWARE
:
1346 Name
= AcpiDmIvrsSubnames
[0];
1349 case ACPI_IVRS_TYPE_MEMORY1
:
1350 case ACPI_IVRS_TYPE_MEMORY2
:
1351 case ACPI_IVRS_TYPE_MEMORY3
:
1353 Name
= AcpiDmIvrsSubnames
[1];
1358 Name
= AcpiDmIvrsSubnames
[2];
1362 AcpiOsPrintf (UINT8_FORMAT
, *Target
, Name
);
1367 /* LPIT subtable types */
1372 case ACPI_LPIT_TYPE_NATIVE_CSTATE
:
1374 Name
= AcpiDmLpitSubnames
[0];
1377 case ACPI_LPIT_TYPE_SIMPLE_IO
:
1379 Name
= AcpiDmLpitSubnames
[1];
1384 Name
= AcpiDmLpitSubnames
[2];
1388 AcpiOsPrintf (UINT32_FORMAT
, *Target
, Name
);
1397 ACPI_ERROR ((AE_INFO
,
1398 "**** Invalid table opcode [0x%X] ****\n", Info
->Opcode
));
1399 return (AE_SUPPORT
);
1403 if (TableOffset
&& !SubtableLength
)
1405 /* If this table is not the main table, subtable must have valid length */
1407 AcpiOsPrintf ("Invalid zero length subtable\n");
1408 return (AE_BAD_DATA
);
1415 /*******************************************************************************
1417 * FUNCTION: AcpiDmCheckAscii
1419 * PARAMETERS: Name - Ascii string
1420 * Count - Number of characters to check
1424 * DESCRIPTION: Ensure that the requested number of characters are printable
1425 * Ascii characters. Sets non-printable and null chars to <space>.
1427 ******************************************************************************/
1438 for (i
= 0; i
< Count
; i
++)
1440 RepairedName
[i
] = (char) Name
[i
];
1446 if (!isprint (Name
[i
]))
1448 RepairedName
[i
] = ' ';