xref: /freebsd/sys/contrib/dev/acpica/common/dmtable.c (revision a9d8d09c46ec699e45f3fd46ca9abcf02e5baca9)
11a39cfb0SJung-uk Kim /******************************************************************************
21a39cfb0SJung-uk Kim  *
31a39cfb0SJung-uk Kim  * Module Name: dmtable - Support for ACPI tables that contain no AML code
41a39cfb0SJung-uk Kim  *
51a39cfb0SJung-uk Kim  *****************************************************************************/
61a39cfb0SJung-uk Kim 
7d244b227SJung-uk Kim /*
8efcc2a30SJung-uk Kim  * Copyright (C) 2000 - 2013, Intel Corp.
91a39cfb0SJung-uk Kim  * All rights reserved.
101a39cfb0SJung-uk Kim  *
11d244b227SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
12d244b227SJung-uk Kim  * modification, are permitted provided that the following conditions
13d244b227SJung-uk Kim  * are met:
14d244b227SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
15d244b227SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
16d244b227SJung-uk Kim  *    without modification.
17d244b227SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18d244b227SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
19d244b227SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
20d244b227SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
21d244b227SJung-uk Kim  *    binary redistribution.
22d244b227SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
23d244b227SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
24d244b227SJung-uk Kim  *    from this software without specific prior written permission.
251a39cfb0SJung-uk Kim  *
26d244b227SJung-uk Kim  * Alternatively, this software may be distributed under the terms of the
27d244b227SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
28d244b227SJung-uk Kim  * Software Foundation.
291a39cfb0SJung-uk Kim  *
30d244b227SJung-uk Kim  * NO WARRANTY
31d244b227SJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32d244b227SJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33d244b227SJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34d244b227SJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35d244b227SJung-uk Kim  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36d244b227SJung-uk Kim  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37d244b227SJung-uk Kim  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38d244b227SJung-uk Kim  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39d244b227SJung-uk Kim  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40d244b227SJung-uk Kim  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41d244b227SJung-uk Kim  * POSSIBILITY OF SUCH DAMAGES.
42d244b227SJung-uk Kim  */
431a39cfb0SJung-uk Kim 
44ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
45ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
46ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h>
47ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/actables.h>
48a88e22b7SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
49a88e22b7SJung-uk Kim #include <contrib/dev/acpica/compiler/dtcompiler.h>
501a39cfb0SJung-uk Kim 
511a39cfb0SJung-uk Kim /* This module used for application-level code only */
521a39cfb0SJung-uk Kim 
531a39cfb0SJung-uk Kim #define _COMPONENT          ACPI_CA_DISASSEMBLER
541a39cfb0SJung-uk Kim         ACPI_MODULE_NAME    ("dmtable")
551a39cfb0SJung-uk Kim 
561a39cfb0SJung-uk Kim /* Local Prototypes */
571a39cfb0SJung-uk Kim 
581a39cfb0SJung-uk Kim static void
591a39cfb0SJung-uk Kim AcpiDmCheckAscii (
601a39cfb0SJung-uk Kim     UINT8                   *Target,
61d6dd1baeSJung-uk Kim     char                    *RepairedName,
621a39cfb0SJung-uk Kim     UINT32                  Count);
631a39cfb0SJung-uk Kim 
641a39cfb0SJung-uk Kim 
65d052a1ccSJung-uk Kim /* Common format strings for commented values */
66d052a1ccSJung-uk Kim 
67d052a1ccSJung-uk Kim #define UINT8_FORMAT        "%2.2X [%s]\n"
68d052a1ccSJung-uk Kim #define UINT16_FORMAT       "%4.4X [%s]\n"
69d052a1ccSJung-uk Kim #define UINT32_FORMAT       "%8.8X [%s]\n"
70d052a1ccSJung-uk Kim #define STRING_FORMAT       "[%s]\n"
71d052a1ccSJung-uk Kim 
721a39cfb0SJung-uk Kim /* These tables map a subtable type to a description string */
731a39cfb0SJung-uk Kim 
74a9f12690SJung-uk Kim static const char           *AcpiDmAsfSubnames[] =
75a9f12690SJung-uk Kim {
76a9f12690SJung-uk Kim     "ASF Information",
77a9f12690SJung-uk Kim     "ASF Alerts",
78a9f12690SJung-uk Kim     "ASF Remote Control",
79a9f12690SJung-uk Kim     "ASF RMCP Boot Options",
80a9f12690SJung-uk Kim     "ASF Address",
81a9f12690SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
82a9f12690SJung-uk Kim };
83a9f12690SJung-uk Kim 
841a39cfb0SJung-uk Kim static const char           *AcpiDmDmarSubnames[] =
851a39cfb0SJung-uk Kim {
861a39cfb0SJung-uk Kim     "Hardware Unit Definition",
871a39cfb0SJung-uk Kim     "Reserved Memory Region",
88a9f12690SJung-uk Kim     "Root Port ATS Capability",
89d6dd1baeSJung-uk Kim     "Remapping Hardware Static Affinity",
901a39cfb0SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
911a39cfb0SJung-uk Kim };
921a39cfb0SJung-uk Kim 
93a88e22b7SJung-uk Kim static const char           *AcpiDmEinjActions[] =
94a88e22b7SJung-uk Kim {
95a88e22b7SJung-uk Kim     "Begin Operation",
96a88e22b7SJung-uk Kim     "Get Trigger Table",
97a88e22b7SJung-uk Kim     "Set Error Type",
98a88e22b7SJung-uk Kim     "Get Error Type",
99a88e22b7SJung-uk Kim     "End Operation",
100a88e22b7SJung-uk Kim     "Execute Operation",
101a88e22b7SJung-uk Kim     "Check Busy Status",
102a88e22b7SJung-uk Kim     "Get Command Status",
103a88e22b7SJung-uk Kim     "Unknown Action"
104a88e22b7SJung-uk Kim };
105a88e22b7SJung-uk Kim 
106a88e22b7SJung-uk Kim static const char           *AcpiDmEinjInstructions[] =
107a88e22b7SJung-uk Kim {
108a88e22b7SJung-uk Kim     "Read Register",
109a88e22b7SJung-uk Kim     "Read Register Value",
110a88e22b7SJung-uk Kim     "Write Register",
111a88e22b7SJung-uk Kim     "Write Register Value",
112a88e22b7SJung-uk Kim     "Noop",
113a88e22b7SJung-uk Kim     "Unknown Instruction"
114a88e22b7SJung-uk Kim };
115a88e22b7SJung-uk Kim 
116a88e22b7SJung-uk Kim static const char           *AcpiDmErstActions[] =
117a88e22b7SJung-uk Kim {
118a88e22b7SJung-uk Kim     "Begin Write Operation",
119a88e22b7SJung-uk Kim     "Begin Read Operation",
120a88e22b7SJung-uk Kim     "Begin Clear Operation",
121a88e22b7SJung-uk Kim     "End Operation",
122a88e22b7SJung-uk Kim     "Set Record Offset",
123a88e22b7SJung-uk Kim     "Execute Operation",
124a88e22b7SJung-uk Kim     "Check Busy Status",
125a88e22b7SJung-uk Kim     "Get Command Status",
126a88e22b7SJung-uk Kim     "Get Record Identifier",
127a88e22b7SJung-uk Kim     "Set Record Identifier",
128a88e22b7SJung-uk Kim     "Get Record Count",
129a88e22b7SJung-uk Kim     "Begin Dummy Write",
130a88e22b7SJung-uk Kim     "Unused/Unknown Action",
131a88e22b7SJung-uk Kim     "Get Error Address Range",
132a88e22b7SJung-uk Kim     "Get Error Address Length",
133a88e22b7SJung-uk Kim     "Get Error Attributes",
134a88e22b7SJung-uk Kim     "Unknown Action"
135a88e22b7SJung-uk Kim };
136a88e22b7SJung-uk Kim 
137a88e22b7SJung-uk Kim static const char           *AcpiDmErstInstructions[] =
138a88e22b7SJung-uk Kim {
139a88e22b7SJung-uk Kim     "Read Register",
140a88e22b7SJung-uk Kim     "Read Register Value",
141a88e22b7SJung-uk Kim     "Write Register",
142a88e22b7SJung-uk Kim     "Write Register Value",
143a88e22b7SJung-uk Kim     "Noop",
144a88e22b7SJung-uk Kim     "Load Var1",
145a88e22b7SJung-uk Kim     "Load Var2",
146a88e22b7SJung-uk Kim     "Store Var1",
147a88e22b7SJung-uk Kim     "Add",
148a88e22b7SJung-uk Kim     "Subtract",
149a88e22b7SJung-uk Kim     "Add Value",
150a88e22b7SJung-uk Kim     "Subtract Value",
151a88e22b7SJung-uk Kim     "Stall",
152a88e22b7SJung-uk Kim     "Stall While True",
153a88e22b7SJung-uk Kim     "Skip Next If True",
154a88e22b7SJung-uk Kim     "GoTo",
155a88e22b7SJung-uk Kim     "Set Source Address",
156a88e22b7SJung-uk Kim     "Set Destination Address",
157a88e22b7SJung-uk Kim     "Move Data",
158a88e22b7SJung-uk Kim     "Unknown Instruction"
159a88e22b7SJung-uk Kim };
160a88e22b7SJung-uk Kim 
161a9f12690SJung-uk Kim static const char           *AcpiDmHestSubnames[] =
162a9f12690SJung-uk Kim {
163d6dd1baeSJung-uk Kim     "IA-32 Machine Check Exception",
164d6dd1baeSJung-uk Kim     "IA-32 Corrected Machine Check",
165d6dd1baeSJung-uk Kim     "IA-32 Non-Maskable Interrupt",
166d6dd1baeSJung-uk Kim     "Unknown SubTable Type",        /* 3 - Reserved */
167d6dd1baeSJung-uk Kim     "Unknown SubTable Type",        /* 4 - Reserved */
168d6dd1baeSJung-uk Kim     "Unknown SubTable Type",        /* 5 - Reserved */
169a9f12690SJung-uk Kim     "PCI Express Root Port AER",
170a9f12690SJung-uk Kim     "PCI Express AER (AER Endpoint)",
171a9f12690SJung-uk Kim     "PCI Express/PCI-X Bridge AER",
172a9f12690SJung-uk Kim     "Generic Hardware Error Source",
173a9f12690SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
174a9f12690SJung-uk Kim };
175a9f12690SJung-uk Kim 
176a9f12690SJung-uk Kim static const char           *AcpiDmHestNotifySubnames[] =
177a9f12690SJung-uk Kim {
178a9f12690SJung-uk Kim     "Polled",
179a9f12690SJung-uk Kim     "External Interrupt",
180a9f12690SJung-uk Kim     "Local Interrupt",
181a9f12690SJung-uk Kim     "SCI",
182a9f12690SJung-uk Kim     "NMI",
183a9f12690SJung-uk Kim     "Unknown Notify Type"           /* Reserved */
184a9f12690SJung-uk Kim };
185a9f12690SJung-uk Kim 
1861a39cfb0SJung-uk Kim static const char           *AcpiDmMadtSubnames[] =
1871a39cfb0SJung-uk Kim {
1881a39cfb0SJung-uk Kim     "Processor Local APIC",         /* ACPI_MADT_TYPE_LOCAL_APIC */
1891a39cfb0SJung-uk Kim     "I/O APIC",                     /* ACPI_MADT_TYPE_IO_APIC */
1901a39cfb0SJung-uk Kim     "Interrupt Source Override",    /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
1911a39cfb0SJung-uk Kim     "NMI Source",                   /* ACPI_MADT_TYPE_NMI_SOURCE */
1921a39cfb0SJung-uk Kim     "Local APIC NMI",               /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
1931a39cfb0SJung-uk Kim     "Local APIC Address Override",  /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
1941a39cfb0SJung-uk Kim     "I/O SAPIC",                    /* ACPI_MADT_TYPE_IO_SAPIC */
1951a39cfb0SJung-uk Kim     "Local SAPIC",                  /* ACPI_MADT_TYPE_LOCAL_SAPIC */
1961a39cfb0SJung-uk Kim     "Platform Interrupt Sources",   /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
197a9f12690SJung-uk Kim     "Processor Local x2APIC",       /* ACPI_MADT_TYPE_LOCAL_X2APIC */
198a9f12690SJung-uk Kim     "Local x2APIC NMI",             /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
1993f0275a0SJung-uk Kim     "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
2003f0275a0SJung-uk Kim     "Generic Interrupt Distributor",/* ACPI_MADT_GENERIC_DISTRIBUTOR */
2013f0275a0SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
2023f0275a0SJung-uk Kim };
2033f0275a0SJung-uk Kim 
2043f0275a0SJung-uk Kim static const char           *AcpiDmPmttSubnames[] =
2053f0275a0SJung-uk Kim {
2063f0275a0SJung-uk Kim     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
2073f0275a0SJung-uk Kim     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
2083f0275a0SJung-uk Kim     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM  */
2091a39cfb0SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
2101a39cfb0SJung-uk Kim };
2111a39cfb0SJung-uk Kim 
212dcbce41eSJung-uk Kim static const char           *AcpiDmSlicSubnames[] =
213dcbce41eSJung-uk Kim {
214dcbce41eSJung-uk Kim     "Public Key Structure",
215dcbce41eSJung-uk Kim     "Windows Marker Structure",
216dcbce41eSJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
217dcbce41eSJung-uk Kim };
218dcbce41eSJung-uk Kim 
2191a39cfb0SJung-uk Kim static const char           *AcpiDmSratSubnames[] =
2201a39cfb0SJung-uk Kim {
2211a39cfb0SJung-uk Kim     "Processor Local APIC/SAPIC Affinity",
2221a39cfb0SJung-uk Kim     "Memory Affinity",
223a9f12690SJung-uk Kim     "Processor Local x2APIC Affinity",
2241a39cfb0SJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
2251a39cfb0SJung-uk Kim };
2261a39cfb0SJung-uk Kim 
227d6dd1baeSJung-uk Kim static const char           *AcpiDmIvrsSubnames[] =
228d6dd1baeSJung-uk Kim {
229d6dd1baeSJung-uk Kim     "Hardware Definition Block",
230d6dd1baeSJung-uk Kim     "Memory Definition Block",
231d6dd1baeSJung-uk Kim     "Unknown SubTable Type"         /* Reserved */
232d6dd1baeSJung-uk Kim };
233d6dd1baeSJung-uk Kim 
234d6dd1baeSJung-uk Kim 
235ec3fc72fSJung-uk Kim #define ACPI_FADT_PM_RESERVED       9
236a9f12690SJung-uk Kim 
237a9f12690SJung-uk Kim static const char           *AcpiDmFadtProfiles[] =
238a9f12690SJung-uk Kim {
239a9f12690SJung-uk Kim     "Unspecified",
240a9f12690SJung-uk Kim     "Desktop",
241a9f12690SJung-uk Kim     "Mobile",
242a9f12690SJung-uk Kim     "Workstation",
243a9f12690SJung-uk Kim     "Enterprise Server",
244a9f12690SJung-uk Kim     "SOHO Server",
245a9f12690SJung-uk Kim     "Appliance PC",
246a9f12690SJung-uk Kim     "Performance Server",
247ec3fc72fSJung-uk Kim     "Tablet",
248a9f12690SJung-uk Kim     "Unknown Profile Type"
249a9f12690SJung-uk Kim };
250a9f12690SJung-uk Kim 
2515a77b11bSJung-uk Kim #define ACPI_GAS_WIDTH_RESERVED     5
2525a77b11bSJung-uk Kim 
2535a77b11bSJung-uk Kim static const char           *AcpiDmGasAccessWidth[] =
2545a77b11bSJung-uk Kim {
2555a77b11bSJung-uk Kim     "Undefined/Legacy",
2565a77b11bSJung-uk Kim     "Byte Access:8",
2575a77b11bSJung-uk Kim     "Word Access:16",
2585a77b11bSJung-uk Kim     "DWord Access:32",
2595a77b11bSJung-uk Kim     "QWord Access:64",
2605a77b11bSJung-uk Kim     "Unknown Width Encoding"
2615a77b11bSJung-uk Kim };
2625a77b11bSJung-uk Kim 
2635a77b11bSJung-uk Kim 
2641a39cfb0SJung-uk Kim /*******************************************************************************
2651a39cfb0SJung-uk Kim  *
2661a39cfb0SJung-uk Kim  * ACPI Table Data, indexed by signature.
2671a39cfb0SJung-uk Kim  *
268a88e22b7SJung-uk Kim  * Each entry contains: Signature, Table Info, Handler, DtHandler,
269a88e22b7SJung-uk Kim  *  Template, Description
270d6dd1baeSJung-uk Kim  *
271a88e22b7SJung-uk Kim  * Simple tables have only a TableInfo structure, complex tables have a
272a88e22b7SJung-uk Kim  * handler. This table must be NULL terminated. RSDP and FACS are
273a88e22b7SJung-uk Kim  * special-cased elsewhere.
2741a39cfb0SJung-uk Kim  *
2751a39cfb0SJung-uk Kim  ******************************************************************************/
2761a39cfb0SJung-uk Kim 
277a88e22b7SJung-uk Kim ACPI_DMTABLE_DATA    AcpiDmTableData[] =
2781a39cfb0SJung-uk Kim {
279a88e22b7SJung-uk Kim     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf,    "Alert Standard Format table"},
280a88e22b7SJung-uk Kim     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert,   "Boot Error Record Table"},
2813f0275a0SJung-uk Kim     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt,   "Boot Graphics Resource Table"},
2821df130f1SJung-uk Kim     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot,   "Simple Boot Flag Table"},
283a88e22b7SJung-uk Kim     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep,   "Corrected Platform Error Polling table"},
284efcc2a30SJung-uk Kim     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt,   "Core System Resource Table"},
2851df130f1SJung-uk Kim     {ACPI_SIG_DBG2, NULL,                   AcpiDmDumpDbg2, NULL,           NULL,           "Debug Port table type 2"},
286a88e22b7SJung-uk Kim     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp,   "Debug Port table"},
287a88e22b7SJung-uk Kim     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar,   "DMA Remapping table"},
288a88e22b7SJung-uk Kim     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt,   "Embedded Controller Boot Resources Table"},
289a88e22b7SJung-uk Kim     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj,   "Error Injection table"},
290a88e22b7SJung-uk Kim     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst,   "Error Record Serialization Table"},
2911df130f1SJung-uk Kim     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt,   "Fixed ACPI Description Table (FADT)"},
2923f0275a0SJung-uk Kim     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt,   "Firmware Performance Data Table"},
2933f0275a0SJung-uk Kim     {ACPI_SIG_GTDT, AcpiDmTableInfoGtdt,    NULL,           NULL,           TemplateGtdt,   "Generic Timer Description Table"},
294a88e22b7SJung-uk Kim     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest,   "Hardware Error Source Table"},
295a88e22b7SJung-uk Kim     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet,   "High Precision Event Timer table"},
296a88e22b7SJung-uk Kim     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs,   "I/O Virtualization Reporting Structure"},
2971df130f1SJung-uk Kim     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt,   "Multiple APIC Description Table (MADT)"},
298a88e22b7SJung-uk Kim     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg,   "Memory Mapped Configuration table"},
299a88e22b7SJung-uk Kim     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi,   "Management Controller Host Interface table"},
3003f0275a0SJung-uk Kim     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst,   "Memory Power State Table"},
301a88e22b7SJung-uk Kim     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct,   "Maximum System Characteristics Table"},
3029c48c75eSJung-uk Kim     {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr,   "MID Timer Table"},
3033f0275a0SJung-uk Kim     {ACPI_SIG_PCCT, NULL,                   AcpiDmDumpPcct, NULL,           NULL,           "Platform Communications Channel Table"},
3043f0275a0SJung-uk Kim     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt,   "Platform Memory Topology Table"},
305a88e22b7SJung-uk Kim     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"},
3063f0275a0SJung-uk Kim     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt,   "S3 Performance Table"},
307a88e22b7SJung-uk Kim     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst,   "Smart Battery Specification Table"},
308dcbce41eSJung-uk Kim     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic,   "Software Licensing Description Table"},
309a88e22b7SJung-uk Kim     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit,   "System Locality Information Table"},
310a88e22b7SJung-uk Kim     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr,   "Serial Port Console Redirection table"},
311a88e22b7SJung-uk Kim     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi,   "Server Platform Management Interface table"},
312a88e22b7SJung-uk Kim     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat,   "System Resource Affinity Table"},
313a88e22b7SJung-uk Kim     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},
314efcc2a30SJung-uk Kim     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2,   "Trusted Platform Module hardware interface table"},
315d244b227SJung-uk Kim     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
3169c48c75eSJung-uk Kim     {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc,   "Virtual Real-Time Clock Table"},
317a88e22b7SJung-uk Kim     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
318a88e22b7SJung-uk Kim     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
319a88e22b7SJung-uk Kim     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
320a88e22b7SJung-uk Kim     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
321a88e22b7SJung-uk Kim     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
322a88e22b7SJung-uk Kim     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
3231a39cfb0SJung-uk Kim };
3241a39cfb0SJung-uk Kim 
3251a39cfb0SJung-uk Kim 
3261a39cfb0SJung-uk Kim /*******************************************************************************
3271a39cfb0SJung-uk Kim  *
328a88e22b7SJung-uk Kim  * FUNCTION:    AcpiDmGenerateChecksum
3291a39cfb0SJung-uk Kim  *
330a88e22b7SJung-uk Kim  * PARAMETERS:  Table               - Pointer to table to be checksummed
331a88e22b7SJung-uk Kim  *              Length              - Length of the table
332a88e22b7SJung-uk Kim  *              OriginalChecksum    - Value of the checksum field
3331a39cfb0SJung-uk Kim  *
3341a39cfb0SJung-uk Kim  * RETURN:      8 bit checksum of buffer
3351a39cfb0SJung-uk Kim  *
3361a39cfb0SJung-uk Kim  * DESCRIPTION: Computes an 8 bit checksum of the table.
3371a39cfb0SJung-uk Kim  *
3381a39cfb0SJung-uk Kim  ******************************************************************************/
3391a39cfb0SJung-uk Kim 
3401a39cfb0SJung-uk Kim UINT8
341a88e22b7SJung-uk Kim AcpiDmGenerateChecksum (
342a88e22b7SJung-uk Kim     void                    *Table,
343a88e22b7SJung-uk Kim     UINT32                  Length,
344a88e22b7SJung-uk Kim     UINT8                   OriginalChecksum)
3451a39cfb0SJung-uk Kim {
3461a39cfb0SJung-uk Kim     UINT8                   Checksum;
3471a39cfb0SJung-uk Kim 
3481a39cfb0SJung-uk Kim 
3491a39cfb0SJung-uk Kim     /* Sum the entire table as-is */
3501a39cfb0SJung-uk Kim 
351a88e22b7SJung-uk Kim     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
3521a39cfb0SJung-uk Kim 
3531a39cfb0SJung-uk Kim     /* Subtract off the existing checksum value in the table */
3541a39cfb0SJung-uk Kim 
355a88e22b7SJung-uk Kim     Checksum = (UINT8) (Checksum - OriginalChecksum);
3561a39cfb0SJung-uk Kim 
3571a39cfb0SJung-uk Kim     /* Compute the final checksum */
3581a39cfb0SJung-uk Kim 
3591a39cfb0SJung-uk Kim     Checksum = (UINT8) (0 - Checksum);
3601a39cfb0SJung-uk Kim     return (Checksum);
3611a39cfb0SJung-uk Kim }
3621a39cfb0SJung-uk Kim 
3631a39cfb0SJung-uk Kim 
3641a39cfb0SJung-uk Kim /*******************************************************************************
3651a39cfb0SJung-uk Kim  *
3661a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmGetTableData
3671a39cfb0SJung-uk Kim  *
3681a39cfb0SJung-uk Kim  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
3691a39cfb0SJung-uk Kim  *
3701a39cfb0SJung-uk Kim  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
3711a39cfb0SJung-uk Kim  *
3721a39cfb0SJung-uk Kim  * DESCRIPTION: Find a match in the global table of supported ACPI tables
3731a39cfb0SJung-uk Kim  *
3741a39cfb0SJung-uk Kim  ******************************************************************************/
3751a39cfb0SJung-uk Kim 
376a88e22b7SJung-uk Kim ACPI_DMTABLE_DATA *
3771a39cfb0SJung-uk Kim AcpiDmGetTableData (
3781a39cfb0SJung-uk Kim     char                    *Signature)
3791a39cfb0SJung-uk Kim {
3801a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
3811a39cfb0SJung-uk Kim 
3821a39cfb0SJung-uk Kim 
3831a39cfb0SJung-uk Kim     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
3841a39cfb0SJung-uk Kim     {
3851a39cfb0SJung-uk Kim         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
3861a39cfb0SJung-uk Kim         {
3871a39cfb0SJung-uk Kim             return (TableData);
3881a39cfb0SJung-uk Kim         }
3891a39cfb0SJung-uk Kim     }
3901a39cfb0SJung-uk Kim 
3911a39cfb0SJung-uk Kim     return (NULL);
3921a39cfb0SJung-uk Kim }
3931a39cfb0SJung-uk Kim 
3941a39cfb0SJung-uk Kim 
3951a39cfb0SJung-uk Kim /*******************************************************************************
3961a39cfb0SJung-uk Kim  *
3971a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpDataTable
3981a39cfb0SJung-uk Kim  *
3991a39cfb0SJung-uk Kim  * PARAMETERS:  Table               - An ACPI table
4001a39cfb0SJung-uk Kim  *
4011a39cfb0SJung-uk Kim  * RETURN:      None.
4021a39cfb0SJung-uk Kim  *
4031a39cfb0SJung-uk Kim  * DESCRIPTION: Format the contents of an ACPI data table (any table other
4041a39cfb0SJung-uk Kim  *              than an SSDT or DSDT that does not contain executable AML code)
4051a39cfb0SJung-uk Kim  *
4061a39cfb0SJung-uk Kim  ******************************************************************************/
4071a39cfb0SJung-uk Kim 
4081a39cfb0SJung-uk Kim void
4091a39cfb0SJung-uk Kim AcpiDmDumpDataTable (
4101a39cfb0SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
4111a39cfb0SJung-uk Kim {
412a9f12690SJung-uk Kim     ACPI_STATUS             Status;
4131a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
4141a39cfb0SJung-uk Kim     UINT32                  Length;
4151a39cfb0SJung-uk Kim 
4161a39cfb0SJung-uk Kim 
4171a39cfb0SJung-uk Kim     /* Ignore tables that contain AML */
4181a39cfb0SJung-uk Kim 
4191a39cfb0SJung-uk Kim     if (AcpiUtIsAmlTable (Table))
4201a39cfb0SJung-uk Kim     {
4218ef1a331SJung-uk Kim         if (Gbl_VerboseTemplates)
4228ef1a331SJung-uk Kim         {
4238ef1a331SJung-uk Kim             /* Dump the raw table data */
4248ef1a331SJung-uk Kim 
4258ef1a331SJung-uk Kim             Length = Table->Length;
4268ef1a331SJung-uk Kim 
4278ef1a331SJung-uk Kim             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
4288ef1a331SJung-uk Kim                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
4298ef1a331SJung-uk Kim             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
4308ef1a331SJung-uk Kim                 Length, DB_BYTE_DISPLAY, 0);
4318ef1a331SJung-uk Kim             AcpiOsPrintf (" */\n");
4328ef1a331SJung-uk Kim         }
4331a39cfb0SJung-uk Kim         return;
4341a39cfb0SJung-uk Kim     }
4351a39cfb0SJung-uk Kim 
4361a39cfb0SJung-uk Kim     /*
4371a39cfb0SJung-uk Kim      * Handle tables that don't use the common ACPI table header structure.
4383f0275a0SJung-uk Kim      * Currently, these are the FACS, RSDP, and S3PT.
4391a39cfb0SJung-uk Kim      */
4401a39cfb0SJung-uk Kim     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
4411a39cfb0SJung-uk Kim     {
4421a39cfb0SJung-uk Kim         Length = Table->Length;
4431a39cfb0SJung-uk Kim         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
4441a39cfb0SJung-uk Kim     }
4451a39cfb0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
4461a39cfb0SJung-uk Kim     {
4471a39cfb0SJung-uk Kim         Length = AcpiDmDumpRsdp (Table);
4481a39cfb0SJung-uk Kim     }
4493f0275a0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
4503f0275a0SJung-uk Kim     {
4513f0275a0SJung-uk Kim         Length = AcpiDmDumpS3pt (Table);
4523f0275a0SJung-uk Kim     }
4531a39cfb0SJung-uk Kim     else
4541a39cfb0SJung-uk Kim     {
4551a39cfb0SJung-uk Kim         /*
4561a39cfb0SJung-uk Kim          * All other tables must use the common ACPI table header, dump it now
4571a39cfb0SJung-uk Kim          */
4581a39cfb0SJung-uk Kim         Length = Table->Length;
459a9f12690SJung-uk Kim         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
460a9f12690SJung-uk Kim         if (ACPI_FAILURE (Status))
461a9f12690SJung-uk Kim         {
462a9f12690SJung-uk Kim             return;
463a9f12690SJung-uk Kim         }
4641a39cfb0SJung-uk Kim         AcpiOsPrintf ("\n");
4651a39cfb0SJung-uk Kim 
4661a39cfb0SJung-uk Kim         /* Match signature and dispatch appropriately */
4671a39cfb0SJung-uk Kim 
4681a39cfb0SJung-uk Kim         TableData = AcpiDmGetTableData (Table->Signature);
4691a39cfb0SJung-uk Kim         if (!TableData)
4701a39cfb0SJung-uk Kim         {
4711a39cfb0SJung-uk Kim             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
4721a39cfb0SJung-uk Kim             {
4731a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
4741a39cfb0SJung-uk Kim                     Table->Signature);
4751a39cfb0SJung-uk Kim             }
4761a39cfb0SJung-uk Kim             else
4771a39cfb0SJung-uk Kim             {
4781a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
4791a39cfb0SJung-uk Kim                     Table->Signature);
4809c48c75eSJung-uk Kim                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
4819c48c75eSJung-uk Kim                     Table->Signature);
4821a39cfb0SJung-uk Kim             }
4831a39cfb0SJung-uk Kim         }
4841a39cfb0SJung-uk Kim         else if (TableData->TableHandler)
4851a39cfb0SJung-uk Kim         {
4861a39cfb0SJung-uk Kim             /* Complex table, has a handler */
4871a39cfb0SJung-uk Kim 
4881a39cfb0SJung-uk Kim             TableData->TableHandler (Table);
4891a39cfb0SJung-uk Kim         }
4901a39cfb0SJung-uk Kim         else if (TableData->TableInfo)
4911a39cfb0SJung-uk Kim         {
4921a39cfb0SJung-uk Kim             /* Simple table, just walk the info table */
4931a39cfb0SJung-uk Kim 
4941a39cfb0SJung-uk Kim             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
4951a39cfb0SJung-uk Kim         }
4961a39cfb0SJung-uk Kim     }
4971a39cfb0SJung-uk Kim 
498a88e22b7SJung-uk Kim     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
499a88e22b7SJung-uk Kim     {
500a88e22b7SJung-uk Kim         /* Dump the raw table data */
5011a39cfb0SJung-uk Kim 
502d244b227SJung-uk Kim         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
503d244b227SJung-uk Kim             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
5048ef1a331SJung-uk Kim         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
5058ef1a331SJung-uk Kim             Length, DB_BYTE_DISPLAY, 0);
5061a39cfb0SJung-uk Kim     }
507a88e22b7SJung-uk Kim }
5081a39cfb0SJung-uk Kim 
5091a39cfb0SJung-uk Kim 
5101a39cfb0SJung-uk Kim /*******************************************************************************
5111a39cfb0SJung-uk Kim  *
5121a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmLineHeader
5131a39cfb0SJung-uk Kim  *
5141a39cfb0SJung-uk Kim  * PARAMETERS:  Offset              - Current byte offset, from table start
5151a39cfb0SJung-uk Kim  *              ByteLength          - Length of the field in bytes, 0 for flags
5161a39cfb0SJung-uk Kim  *              Name                - Name of this field
5171a39cfb0SJung-uk Kim  *              Value               - Optional value, displayed on left of ':'
5181a39cfb0SJung-uk Kim  *
5191a39cfb0SJung-uk Kim  * RETURN:      None
5201a39cfb0SJung-uk Kim  *
5211a39cfb0SJung-uk Kim  * DESCRIPTION: Utility routines for formatting output lines. Displays the
5221a39cfb0SJung-uk Kim  *              current table offset in hex and decimal, the field length,
5231a39cfb0SJung-uk Kim  *              and the field name.
5241a39cfb0SJung-uk Kim  *
5251a39cfb0SJung-uk Kim  ******************************************************************************/
5261a39cfb0SJung-uk Kim 
5271a39cfb0SJung-uk Kim void
5281a39cfb0SJung-uk Kim AcpiDmLineHeader (
5291a39cfb0SJung-uk Kim     UINT32                  Offset,
5301a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5311a39cfb0SJung-uk Kim     char                    *Name)
5321a39cfb0SJung-uk Kim {
5331a39cfb0SJung-uk Kim 
534dcbce41eSJung-uk Kim     /* Allow a null name for fields that span multiple lines (large buffers) */
535dcbce41eSJung-uk Kim 
536dcbce41eSJung-uk Kim     if (!Name)
537dcbce41eSJung-uk Kim     {
538dcbce41eSJung-uk Kim         Name = "";
539dcbce41eSJung-uk Kim     }
540dcbce41eSJung-uk Kim 
541a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
542a88e22b7SJung-uk Kim     {
543a88e22b7SJung-uk Kim         if (ByteLength)
544a88e22b7SJung-uk Kim         {
545dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
546a88e22b7SJung-uk Kim         }
547a88e22b7SJung-uk Kim         else
548a88e22b7SJung-uk Kim         {
549d052a1ccSJung-uk Kim             if (*Name)
550d052a1ccSJung-uk Kim             {
551dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%41s : ", Name);
552a88e22b7SJung-uk Kim             }
553d052a1ccSJung-uk Kim             else
554d052a1ccSJung-uk Kim             {
555d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%41s   ", Name);
556d052a1ccSJung-uk Kim             }
557d052a1ccSJung-uk Kim         }
558a88e22b7SJung-uk Kim     }
559a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
560a88e22b7SJung-uk Kim     {
5611a39cfb0SJung-uk Kim         if (ByteLength)
5621a39cfb0SJung-uk Kim         {
563dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
5641a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name);
5651a39cfb0SJung-uk Kim         }
5661a39cfb0SJung-uk Kim         else
5671a39cfb0SJung-uk Kim         {
568d052a1ccSJung-uk Kim             if (*Name)
569d052a1ccSJung-uk Kim             {
570dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%44s : ", Name);
5711a39cfb0SJung-uk Kim             }
572d052a1ccSJung-uk Kim             else
573d052a1ccSJung-uk Kim             {
574d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%44s   ", Name);
575d052a1ccSJung-uk Kim             }
576d052a1ccSJung-uk Kim         }
5771a39cfb0SJung-uk Kim     }
578a88e22b7SJung-uk Kim }
5791a39cfb0SJung-uk Kim 
5801a39cfb0SJung-uk Kim void
5811a39cfb0SJung-uk Kim AcpiDmLineHeader2 (
5821a39cfb0SJung-uk Kim     UINT32                  Offset,
5831a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5841a39cfb0SJung-uk Kim     char                    *Name,
5851a39cfb0SJung-uk Kim     UINT32                  Value)
5861a39cfb0SJung-uk Kim {
5871a39cfb0SJung-uk Kim 
588a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
589a88e22b7SJung-uk Kim     {
590a88e22b7SJung-uk Kim         if (ByteLength)
591a88e22b7SJung-uk Kim         {
592d052a1ccSJung-uk Kim             AcpiOsPrintf ("[%.4d] %30s %3d : ",
593a88e22b7SJung-uk Kim                 ByteLength, Name, Value);
594a88e22b7SJung-uk Kim         }
595a88e22b7SJung-uk Kim         else
596a88e22b7SJung-uk Kim         {
597a88e22b7SJung-uk Kim             AcpiOsPrintf ("%36s % 3d : ",
598a88e22b7SJung-uk Kim                 Name, Value);
599a88e22b7SJung-uk Kim         }
600a88e22b7SJung-uk Kim     }
601a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
602a88e22b7SJung-uk Kim     {
6031a39cfb0SJung-uk Kim         if (ByteLength)
6041a39cfb0SJung-uk Kim         {
605a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
6061a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name, Value);
6071a39cfb0SJung-uk Kim         }
6081a39cfb0SJung-uk Kim         else
6091a39cfb0SJung-uk Kim         {
610a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
6111a39cfb0SJung-uk Kim                 Offset, Offset, Name, Value);
6121a39cfb0SJung-uk Kim         }
6131a39cfb0SJung-uk Kim     }
614a88e22b7SJung-uk Kim }
6151a39cfb0SJung-uk Kim 
6161a39cfb0SJung-uk Kim 
6171a39cfb0SJung-uk Kim /*******************************************************************************
6181a39cfb0SJung-uk Kim  *
6191a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpTable
6201a39cfb0SJung-uk Kim  *
6211a39cfb0SJung-uk Kim  * PARAMETERS:  TableLength         - Length of the entire ACPI table
6221a39cfb0SJung-uk Kim  *              TableOffset         - Starting offset within the table for this
6231a39cfb0SJung-uk Kim  *                                    sub-descriptor (0 if main table)
6241a39cfb0SJung-uk Kim  *              Table               - The ACPI table
625a9f12690SJung-uk Kim  *              SubtableLength      - Length of this sub-descriptor
6261a39cfb0SJung-uk Kim  *              Info                - Info table for this ACPI table
6271a39cfb0SJung-uk Kim  *
6281a39cfb0SJung-uk Kim  * RETURN:      None
6291a39cfb0SJung-uk Kim  *
6301a39cfb0SJung-uk Kim  * DESCRIPTION: Display ACPI table contents by walking the Info table.
6311a39cfb0SJung-uk Kim  *
632a88e22b7SJung-uk Kim  * Note: This function must remain in sync with DtGetFieldLength.
633a88e22b7SJung-uk Kim  *
6341a39cfb0SJung-uk Kim  ******************************************************************************/
6351a39cfb0SJung-uk Kim 
636a9f12690SJung-uk Kim ACPI_STATUS
6371a39cfb0SJung-uk Kim AcpiDmDumpTable (
6381a39cfb0SJung-uk Kim     UINT32                  TableLength,
6391a39cfb0SJung-uk Kim     UINT32                  TableOffset,
6401a39cfb0SJung-uk Kim     void                    *Table,
6411a39cfb0SJung-uk Kim     UINT32                  SubtableLength,
6421a39cfb0SJung-uk Kim     ACPI_DMTABLE_INFO       *Info)
6431a39cfb0SJung-uk Kim {
6441a39cfb0SJung-uk Kim     UINT8                   *Target;
6451a39cfb0SJung-uk Kim     UINT32                  CurrentOffset;
6461a39cfb0SJung-uk Kim     UINT32                  ByteLength;
6471a39cfb0SJung-uk Kim     UINT8                   Temp8;
6481a39cfb0SJung-uk Kim     UINT16                  Temp16;
6491a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
650d6dd1baeSJung-uk Kim     const char              *Name;
651a9f12690SJung-uk Kim     BOOLEAN                 LastOutputBlankLine = FALSE;
652d6dd1baeSJung-uk Kim     char                    RepairedName[8];
6531a39cfb0SJung-uk Kim 
6541a39cfb0SJung-uk Kim 
6551a39cfb0SJung-uk Kim     if (!Info)
6561a39cfb0SJung-uk Kim     {
6571a39cfb0SJung-uk Kim         AcpiOsPrintf ("Display not implemented\n");
658a9f12690SJung-uk Kim         return (AE_NOT_IMPLEMENTED);
6591a39cfb0SJung-uk Kim     }
6601a39cfb0SJung-uk Kim 
6611a39cfb0SJung-uk Kim     /* Walk entire Info table; Null name terminates */
6621a39cfb0SJung-uk Kim 
6631a39cfb0SJung-uk Kim     for (; Info->Name; Info++)
6641a39cfb0SJung-uk Kim     {
6651a39cfb0SJung-uk Kim         /*
6661a39cfb0SJung-uk Kim          * Target points to the field within the ACPI Table. CurrentOffset is
6671a39cfb0SJung-uk Kim          * the offset of the field from the start of the main table.
6681a39cfb0SJung-uk Kim          */
6691a39cfb0SJung-uk Kim         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
6701a39cfb0SJung-uk Kim         CurrentOffset = TableOffset + Info->Offset;
6711a39cfb0SJung-uk Kim 
6721a39cfb0SJung-uk Kim         /* Check for beyond EOT or beyond subtable end */
6731a39cfb0SJung-uk Kim 
6741a39cfb0SJung-uk Kim         if ((CurrentOffset >= TableLength) ||
6751a39cfb0SJung-uk Kim             (SubtableLength && (Info->Offset >= SubtableLength)))
6761a39cfb0SJung-uk Kim         {
677a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
678a9f12690SJung-uk Kim             return (AE_BAD_DATA);
6791a39cfb0SJung-uk Kim         }
6801a39cfb0SJung-uk Kim 
6811a39cfb0SJung-uk Kim         /* Generate the byte length for this field */
6821a39cfb0SJung-uk Kim 
6831a39cfb0SJung-uk Kim         switch (Info->Opcode)
6841a39cfb0SJung-uk Kim         {
6851a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
6861a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
6871a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
6885a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
689d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
6901a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
6913f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
6921a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
693a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
694a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
695a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
696a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
697a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
698a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
699a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
700*a9d8d09cSJung-uk Kim 
7011a39cfb0SJung-uk Kim             ByteLength = 1;
7021a39cfb0SJung-uk Kim             break;
703*a9d8d09cSJung-uk Kim 
7041a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
7051a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
706a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
707*a9d8d09cSJung-uk Kim 
7081a39cfb0SJung-uk Kim             ByteLength = 2;
7091a39cfb0SJung-uk Kim             break;
710*a9d8d09cSJung-uk Kim 
7111a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
712*a9d8d09cSJung-uk Kim 
7131a39cfb0SJung-uk Kim             ByteLength = 3;
7141a39cfb0SJung-uk Kim             break;
715*a9d8d09cSJung-uk Kim 
7161a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
7171a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
7181a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
719dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
720*a9d8d09cSJung-uk Kim 
7211a39cfb0SJung-uk Kim             ByteLength = 4;
7221a39cfb0SJung-uk Kim             break;
723*a9d8d09cSJung-uk Kim 
7243f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
725*a9d8d09cSJung-uk Kim 
7263f0275a0SJung-uk Kim             ByteLength = 5;
7273f0275a0SJung-uk Kim             break;
728*a9d8d09cSJung-uk Kim 
7293f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
7301a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
731*a9d8d09cSJung-uk Kim 
7321a39cfb0SJung-uk Kim             ByteLength = 6;
7331a39cfb0SJung-uk Kim             break;
734*a9d8d09cSJung-uk Kim 
7351a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
7360b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
737*a9d8d09cSJung-uk Kim 
7381a39cfb0SJung-uk Kim             ByteLength = 7;
7391a39cfb0SJung-uk Kim             break;
740*a9d8d09cSJung-uk Kim 
7411a39cfb0SJung-uk Kim         case ACPI_DMT_UINT64:
7421a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
743*a9d8d09cSJung-uk Kim 
7441a39cfb0SJung-uk Kim             ByteLength = 8;
7451a39cfb0SJung-uk Kim             break;
746*a9d8d09cSJung-uk Kim 
747d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
748d244b227SJung-uk Kim         case ACPI_DMT_UUID:
749*a9d8d09cSJung-uk Kim 
750d6dd1baeSJung-uk Kim             ByteLength = 16;
751d6dd1baeSJung-uk Kim             break;
752*a9d8d09cSJung-uk Kim 
753dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
754*a9d8d09cSJung-uk Kim 
755dcbce41eSJung-uk Kim             ByteLength = 128;
756dcbce41eSJung-uk Kim             break;
757*a9d8d09cSJung-uk Kim 
7581a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
759*a9d8d09cSJung-uk Kim 
7601a39cfb0SJung-uk Kim             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
7611a39cfb0SJung-uk Kim             break;
762*a9d8d09cSJung-uk Kim 
7631a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
764*a9d8d09cSJung-uk Kim 
765a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
766a9f12690SJung-uk Kim             {
7671a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
768a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
769a9f12690SJung-uk Kim             }
7701a39cfb0SJung-uk Kim             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
7711a39cfb0SJung-uk Kim             break;
772*a9d8d09cSJung-uk Kim 
773a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
774*a9d8d09cSJung-uk Kim 
775a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
776a9f12690SJung-uk Kim             {
777a9f12690SJung-uk Kim                 AcpiOsPrintf ("\n");
778a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
779a9f12690SJung-uk Kim             }
780a9f12690SJung-uk Kim             ByteLength = sizeof (ACPI_HEST_NOTIFY);
781a9f12690SJung-uk Kim             break;
782*a9d8d09cSJung-uk Kim 
7831a39cfb0SJung-uk Kim         default:
784*a9d8d09cSJung-uk Kim 
7851a39cfb0SJung-uk Kim             ByteLength = 0;
7861a39cfb0SJung-uk Kim             break;
7871a39cfb0SJung-uk Kim         }
7881a39cfb0SJung-uk Kim 
789a9f12690SJung-uk Kim         if (CurrentOffset + ByteLength > TableLength)
790a9f12690SJung-uk Kim         {
791a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
792a9f12690SJung-uk Kim             return (AE_BAD_DATA);
793a9f12690SJung-uk Kim         }
794a9f12690SJung-uk Kim 
7953f0275a0SJung-uk Kim         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
7963f0275a0SJung-uk Kim         {
7973f0275a0SJung-uk Kim             AcpiOsPrintf ("%s", Info->Name);
7983f0275a0SJung-uk Kim             continue;
7993f0275a0SJung-uk Kim         }
8003f0275a0SJung-uk Kim 
8011a39cfb0SJung-uk Kim         /* Start a new line and decode the opcode */
8021a39cfb0SJung-uk Kim 
8031a39cfb0SJung-uk Kim         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
8041a39cfb0SJung-uk Kim 
8051a39cfb0SJung-uk Kim         switch (Info->Opcode)
8061a39cfb0SJung-uk Kim         {
8071a39cfb0SJung-uk Kim         /* Single-bit Flag fields. Note: Opcode is the bit position */
8081a39cfb0SJung-uk Kim 
8091a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG0:
8101a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG1:
8111a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG2:
8121a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG3:
8131a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG4:
8141a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG5:
8151a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG6:
8161a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG7:
8171a39cfb0SJung-uk Kim 
8181a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
8191a39cfb0SJung-uk Kim             break;
8201a39cfb0SJung-uk Kim 
8211a39cfb0SJung-uk Kim         /* 2-bit Flag fields */
8221a39cfb0SJung-uk Kim 
8231a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS0:
8241a39cfb0SJung-uk Kim 
8251a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
8261a39cfb0SJung-uk Kim             break;
8271a39cfb0SJung-uk Kim 
8283f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS1:
8293f0275a0SJung-uk Kim 
8303f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
8313f0275a0SJung-uk Kim             break;
8323f0275a0SJung-uk Kim 
8331a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS2:
8341a39cfb0SJung-uk Kim 
8351a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
8361a39cfb0SJung-uk Kim             break;
8371a39cfb0SJung-uk Kim 
8383f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS4:
8393f0275a0SJung-uk Kim 
8403f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
8413f0275a0SJung-uk Kim             break;
8423f0275a0SJung-uk Kim 
8433f0275a0SJung-uk Kim         /* Integer Data Types */
8441a39cfb0SJung-uk Kim 
8451a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
8461a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
8471a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
8481a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
8493f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
8503f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
8511a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
8523f0275a0SJung-uk Kim         case ACPI_DMT_UINT64:
8533f0275a0SJung-uk Kim             /*
8543f0275a0SJung-uk Kim              * Dump bytes - high byte first, low byte last.
8553f0275a0SJung-uk Kim              * Note: All ACPI tables are little-endian.
8563f0275a0SJung-uk Kim              */
8573f0275a0SJung-uk Kim             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
858a9f12690SJung-uk Kim             {
8593f0275a0SJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
860a9f12690SJung-uk Kim             }
861a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
8621a39cfb0SJung-uk Kim             break;
8631a39cfb0SJung-uk Kim 
8640b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
865d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
866dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
8670b94ba42SJung-uk Kim             /*
8680b94ba42SJung-uk Kim              * Buffer: Size depends on the opcode and was set above.
8690b94ba42SJung-uk Kim              * Each hex byte is separated with a space.
870d052a1ccSJung-uk Kim              * Multiple lines are separated by line continuation char.
8710b94ba42SJung-uk Kim              */
872dcbce41eSJung-uk Kim             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
873d6dd1baeSJung-uk Kim             {
874dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
875dcbce41eSJung-uk Kim                 if ((UINT32) (Temp16 + 1) < ByteLength)
876dcbce41eSJung-uk Kim                 {
877dcbce41eSJung-uk Kim                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
878dcbce41eSJung-uk Kim                     {
879d052a1ccSJung-uk Kim                         AcpiOsPrintf (" \\\n"); /* Line continuation */
880dcbce41eSJung-uk Kim                         AcpiDmLineHeader (0, 0, NULL);
881dcbce41eSJung-uk Kim                     }
882dcbce41eSJung-uk Kim                     else
883a88e22b7SJung-uk Kim                     {
8840b94ba42SJung-uk Kim                         AcpiOsPrintf (" ");
885a88e22b7SJung-uk Kim                     }
886d6dd1baeSJung-uk Kim                 }
887dcbce41eSJung-uk Kim             }
888d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\n");
889d6dd1baeSJung-uk Kim             break;
890d6dd1baeSJung-uk Kim 
891d244b227SJung-uk Kim         case ACPI_DMT_UUID:
892d244b227SJung-uk Kim 
893d244b227SJung-uk Kim             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
894d244b227SJung-uk Kim 
895d244b227SJung-uk Kim             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
896d244b227SJung-uk Kim 
897d244b227SJung-uk Kim             AcpiOsPrintf ("%s\n", MsgBuffer);
898d244b227SJung-uk Kim             break;
899d244b227SJung-uk Kim 
9001a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
9011a39cfb0SJung-uk Kim 
902d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
9031a39cfb0SJung-uk Kim             break;
9041a39cfb0SJung-uk Kim 
9051a39cfb0SJung-uk Kim         /* Fixed length ASCII name fields */
9061a39cfb0SJung-uk Kim 
9071a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
9081a39cfb0SJung-uk Kim 
909d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
910d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
9111a39cfb0SJung-uk Kim             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
9121a39cfb0SJung-uk Kim             if (TableData)
9131a39cfb0SJung-uk Kim             {
914d052a1ccSJung-uk Kim                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
9151a39cfb0SJung-uk Kim             }
916d052a1ccSJung-uk Kim             else
917d052a1ccSJung-uk Kim             {
9181a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
919d052a1ccSJung-uk Kim             }
9201a39cfb0SJung-uk Kim             break;
9211a39cfb0SJung-uk Kim 
9221a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
9231a39cfb0SJung-uk Kim 
924d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
925d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
9261a39cfb0SJung-uk Kim             break;
9271a39cfb0SJung-uk Kim 
9281a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
9291a39cfb0SJung-uk Kim 
930d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 6);
931d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
9321a39cfb0SJung-uk Kim             break;
9331a39cfb0SJung-uk Kim 
9341a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
9351a39cfb0SJung-uk Kim 
936d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 8);
937d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
9381a39cfb0SJung-uk Kim             break;
9391a39cfb0SJung-uk Kim 
9401a39cfb0SJung-uk Kim         /* Special Data Types */
9411a39cfb0SJung-uk Kim 
9421a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
9431a39cfb0SJung-uk Kim 
9441a39cfb0SJung-uk Kim             /* Checksum, display and validate */
9451a39cfb0SJung-uk Kim 
9461a39cfb0SJung-uk Kim             AcpiOsPrintf ("%2.2X", *Target);
947a88e22b7SJung-uk Kim             Temp8 = AcpiDmGenerateChecksum (Table,
948a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
949a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
9501a39cfb0SJung-uk Kim             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
9511a39cfb0SJung-uk Kim             {
9521a39cfb0SJung-uk Kim                 AcpiOsPrintf (
9531a39cfb0SJung-uk Kim                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
9541a39cfb0SJung-uk Kim             }
9551a39cfb0SJung-uk Kim             AcpiOsPrintf ("\n");
9561a39cfb0SJung-uk Kim             break;
9571a39cfb0SJung-uk Kim 
9581a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
9591a39cfb0SJung-uk Kim 
9601a39cfb0SJung-uk Kim             /* Address Space ID */
9611a39cfb0SJung-uk Kim 
962d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
9631a39cfb0SJung-uk Kim             break;
9641a39cfb0SJung-uk Kim 
9655a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
9665a77b11bSJung-uk Kim 
9675a77b11bSJung-uk Kim             /* Encoded Access Width */
9685a77b11bSJung-uk Kim 
9695a77b11bSJung-uk Kim             Temp8 = *Target;
9705a77b11bSJung-uk Kim             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
9715a77b11bSJung-uk Kim             {
9725a77b11bSJung-uk Kim                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
9735a77b11bSJung-uk Kim             }
9745a77b11bSJung-uk Kim 
975d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
9765a77b11bSJung-uk Kim             break;
9775a77b11bSJung-uk Kim 
9781a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
9791a39cfb0SJung-uk Kim 
9801a39cfb0SJung-uk Kim             /* Generic Address Structure */
9811a39cfb0SJung-uk Kim 
982d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
983d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
984d6dd1baeSJung-uk Kim                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
985a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
986a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
987a9f12690SJung-uk Kim             break;
988a9f12690SJung-uk Kim 
989a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
990a9f12690SJung-uk Kim 
991a9f12690SJung-uk Kim             /* ASF subtable types */
992a9f12690SJung-uk Kim 
993a9f12690SJung-uk Kim             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
994a9f12690SJung-uk Kim             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
995a9f12690SJung-uk Kim             {
996a9f12690SJung-uk Kim                 Temp16 = ACPI_ASF_TYPE_RESERVED;
997a9f12690SJung-uk Kim             }
998a9f12690SJung-uk Kim 
999d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
10001a39cfb0SJung-uk Kim             break;
10011a39cfb0SJung-uk Kim 
10021a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
10031a39cfb0SJung-uk Kim 
10041a39cfb0SJung-uk Kim             /* DMAR subtable types */
10051a39cfb0SJung-uk Kim 
1006a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
10071a39cfb0SJung-uk Kim             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
10081a39cfb0SJung-uk Kim             {
10091a39cfb0SJung-uk Kim                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
10101a39cfb0SJung-uk Kim             }
10111a39cfb0SJung-uk Kim 
1012d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
10131a39cfb0SJung-uk Kim             break;
10141a39cfb0SJung-uk Kim 
1015a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
1016a88e22b7SJung-uk Kim 
1017a88e22b7SJung-uk Kim             /* EINJ Action types */
1018a88e22b7SJung-uk Kim 
1019a88e22b7SJung-uk Kim             Temp8 = *Target;
1020a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1021a88e22b7SJung-uk Kim             {
1022a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1023a88e22b7SJung-uk Kim             }
1024a88e22b7SJung-uk Kim 
1025d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
1026a88e22b7SJung-uk Kim             break;
1027a88e22b7SJung-uk Kim 
1028a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
1029a88e22b7SJung-uk Kim 
1030a88e22b7SJung-uk Kim             /* EINJ Instruction types */
1031a88e22b7SJung-uk Kim 
1032a88e22b7SJung-uk Kim             Temp8 = *Target;
1033a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1034a88e22b7SJung-uk Kim             {
1035a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1036a88e22b7SJung-uk Kim             }
1037a88e22b7SJung-uk Kim 
1038d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
1039a88e22b7SJung-uk Kim             break;
1040a88e22b7SJung-uk Kim 
1041a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
1042a88e22b7SJung-uk Kim 
1043a88e22b7SJung-uk Kim             /* ERST Action types */
1044a88e22b7SJung-uk Kim 
1045a88e22b7SJung-uk Kim             Temp8 = *Target;
1046a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1047a88e22b7SJung-uk Kim             {
1048a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1049a88e22b7SJung-uk Kim             }
1050a88e22b7SJung-uk Kim 
1051d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1052a88e22b7SJung-uk Kim             break;
1053a88e22b7SJung-uk Kim 
1054a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
1055a88e22b7SJung-uk Kim 
1056a88e22b7SJung-uk Kim             /* ERST Instruction types */
1057a88e22b7SJung-uk Kim 
1058a88e22b7SJung-uk Kim             Temp8 = *Target;
1059a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1060a88e22b7SJung-uk Kim             {
1061a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1062a88e22b7SJung-uk Kim             }
1063a88e22b7SJung-uk Kim 
1064d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1065a88e22b7SJung-uk Kim             break;
1066a88e22b7SJung-uk Kim 
1067a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
1068a9f12690SJung-uk Kim 
1069a9f12690SJung-uk Kim             /* HEST subtable types */
1070a9f12690SJung-uk Kim 
1071a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
1072a9f12690SJung-uk Kim             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1073a9f12690SJung-uk Kim             {
1074a9f12690SJung-uk Kim                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1075a9f12690SJung-uk Kim             }
1076a9f12690SJung-uk Kim 
1077d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1078a9f12690SJung-uk Kim             break;
1079a9f12690SJung-uk Kim 
1080a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
1081a9f12690SJung-uk Kim 
1082d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1083d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1084d6dd1baeSJung-uk Kim                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1085a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
1086a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
1087a9f12690SJung-uk Kim             break;
1088a9f12690SJung-uk Kim 
1089a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
1090a9f12690SJung-uk Kim 
1091a9f12690SJung-uk Kim             /* HEST Notify types */
1092a9f12690SJung-uk Kim 
1093a9f12690SJung-uk Kim             Temp8 = *Target;
1094a9f12690SJung-uk Kim             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1095a9f12690SJung-uk Kim             {
1096a9f12690SJung-uk Kim                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1097a9f12690SJung-uk Kim             }
1098a9f12690SJung-uk Kim 
1099d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1100a9f12690SJung-uk Kim             break;
1101a9f12690SJung-uk Kim 
11021a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
11031a39cfb0SJung-uk Kim 
11041a39cfb0SJung-uk Kim             /* MADT subtable types */
11051a39cfb0SJung-uk Kim 
11061a39cfb0SJung-uk Kim             Temp8 = *Target;
11071a39cfb0SJung-uk Kim             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
11081a39cfb0SJung-uk Kim             {
11091a39cfb0SJung-uk Kim                 Temp8 = ACPI_MADT_TYPE_RESERVED;
11101a39cfb0SJung-uk Kim             }
11111a39cfb0SJung-uk Kim 
1112d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
11131a39cfb0SJung-uk Kim             break;
11141a39cfb0SJung-uk Kim 
11153f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
11163f0275a0SJung-uk Kim 
11173f0275a0SJung-uk Kim             /* PMTT subtable types */
11183f0275a0SJung-uk Kim 
11193f0275a0SJung-uk Kim             Temp8 = *Target;
11203f0275a0SJung-uk Kim             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
11213f0275a0SJung-uk Kim             {
11223f0275a0SJung-uk Kim                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
11233f0275a0SJung-uk Kim             }
11243f0275a0SJung-uk Kim 
11253f0275a0SJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
11263f0275a0SJung-uk Kim             break;
11273f0275a0SJung-uk Kim 
1128dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
1129dcbce41eSJung-uk Kim 
1130dcbce41eSJung-uk Kim             /* SLIC subtable types */
1131dcbce41eSJung-uk Kim 
1132dcbce41eSJung-uk Kim             Temp8 = *Target;
1133dcbce41eSJung-uk Kim             if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1134dcbce41eSJung-uk Kim             {
1135dcbce41eSJung-uk Kim                 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1136dcbce41eSJung-uk Kim             }
1137dcbce41eSJung-uk Kim 
1138d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1139dcbce41eSJung-uk Kim             break;
1140dcbce41eSJung-uk Kim 
11411a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
11421a39cfb0SJung-uk Kim 
11431a39cfb0SJung-uk Kim             /* SRAT subtable types */
11441a39cfb0SJung-uk Kim 
11451a39cfb0SJung-uk Kim             Temp8 = *Target;
11461a39cfb0SJung-uk Kim             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
11471a39cfb0SJung-uk Kim             {
11481a39cfb0SJung-uk Kim                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
11491a39cfb0SJung-uk Kim             }
11501a39cfb0SJung-uk Kim 
1151d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
11521a39cfb0SJung-uk Kim             break;
11531a39cfb0SJung-uk Kim 
1154a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
1155a9f12690SJung-uk Kim 
1156a9f12690SJung-uk Kim             /* FADT Preferred PM Profile names */
1157a9f12690SJung-uk Kim 
1158a9f12690SJung-uk Kim             Temp8 = *Target;
1159a9f12690SJung-uk Kim             if (Temp8 > ACPI_FADT_PM_RESERVED)
1160a9f12690SJung-uk Kim             {
1161a9f12690SJung-uk Kim                 Temp8 = ACPI_FADT_PM_RESERVED;
1162a9f12690SJung-uk Kim             }
1163a9f12690SJung-uk Kim 
1164d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1165a9f12690SJung-uk Kim             break;
1166a9f12690SJung-uk Kim 
1167d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
1168d6dd1baeSJung-uk Kim 
1169d6dd1baeSJung-uk Kim             /* IVRS subtable types */
1170d6dd1baeSJung-uk Kim 
1171d6dd1baeSJung-uk Kim             Temp8 = *Target;
1172d6dd1baeSJung-uk Kim             switch (Temp8)
1173d6dd1baeSJung-uk Kim             {
1174d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_HARDWARE:
1175*a9d8d09cSJung-uk Kim 
1176d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[0];
1177d6dd1baeSJung-uk Kim                 break;
1178d6dd1baeSJung-uk Kim 
1179d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY1:
1180d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY2:
1181d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY3:
1182*a9d8d09cSJung-uk Kim 
1183d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[1];
1184d6dd1baeSJung-uk Kim                 break;
1185d6dd1baeSJung-uk Kim 
1186d6dd1baeSJung-uk Kim             default:
1187*a9d8d09cSJung-uk Kim 
1188d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[2];
1189d6dd1baeSJung-uk Kim                 break;
1190d6dd1baeSJung-uk Kim             }
1191d6dd1baeSJung-uk Kim 
1192d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1193d6dd1baeSJung-uk Kim             break;
1194d6dd1baeSJung-uk Kim 
11951a39cfb0SJung-uk Kim         case ACPI_DMT_EXIT:
1196*a9d8d09cSJung-uk Kim 
1197a9f12690SJung-uk Kim             return (AE_OK);
11981a39cfb0SJung-uk Kim 
11991a39cfb0SJung-uk Kim         default:
1200*a9d8d09cSJung-uk Kim 
12011a39cfb0SJung-uk Kim             ACPI_ERROR ((AE_INFO,
1202ca3cf4faSJung-uk Kim                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1203a9f12690SJung-uk Kim             return (AE_SUPPORT);
12041a39cfb0SJung-uk Kim         }
12051a39cfb0SJung-uk Kim     }
1206a9f12690SJung-uk Kim 
1207a9f12690SJung-uk Kim     if (TableOffset && !SubtableLength)
1208a9f12690SJung-uk Kim     {
1209a9f12690SJung-uk Kim         /* If this table is not the main table, subtable must have valid length */
1210a9f12690SJung-uk Kim 
1211a9f12690SJung-uk Kim         AcpiOsPrintf ("Invalid zero length subtable\n");
1212a9f12690SJung-uk Kim         return (AE_BAD_DATA);
1213a9f12690SJung-uk Kim     }
1214a9f12690SJung-uk Kim 
1215a9f12690SJung-uk Kim     return (AE_OK);
12161a39cfb0SJung-uk Kim }
12171a39cfb0SJung-uk Kim 
12181a39cfb0SJung-uk Kim 
12191a39cfb0SJung-uk Kim /*******************************************************************************
12201a39cfb0SJung-uk Kim  *
12211a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmCheckAscii
12221a39cfb0SJung-uk Kim  *
12231a39cfb0SJung-uk Kim  * PARAMETERS:  Name                - Ascii string
12241a39cfb0SJung-uk Kim  *              Count               - Number of characters to check
12251a39cfb0SJung-uk Kim  *
12261a39cfb0SJung-uk Kim  * RETURN:      None
12271a39cfb0SJung-uk Kim  *
12281a39cfb0SJung-uk Kim  * DESCRIPTION: Ensure that the requested number of characters are printable
12291a39cfb0SJung-uk Kim  *              Ascii characters. Sets non-printable and null chars to <space>.
12301a39cfb0SJung-uk Kim  *
12311a39cfb0SJung-uk Kim  ******************************************************************************/
12321a39cfb0SJung-uk Kim 
12331a39cfb0SJung-uk Kim static void
12341a39cfb0SJung-uk Kim AcpiDmCheckAscii (
12351a39cfb0SJung-uk Kim     UINT8                   *Name,
1236d6dd1baeSJung-uk Kim     char                    *RepairedName,
12371a39cfb0SJung-uk Kim     UINT32                  Count)
12381a39cfb0SJung-uk Kim {
12391a39cfb0SJung-uk Kim     UINT32                  i;
12401a39cfb0SJung-uk Kim 
12411a39cfb0SJung-uk Kim 
12421a39cfb0SJung-uk Kim     for (i = 0; i < Count; i++)
12431a39cfb0SJung-uk Kim     {
1244f556842eSJung-uk Kim         RepairedName[i] = (char) Name[i];
1245d6dd1baeSJung-uk Kim 
1246d6dd1baeSJung-uk Kim         if (!Name[i])
12471a39cfb0SJung-uk Kim         {
1248d6dd1baeSJung-uk Kim             return;
1249d6dd1baeSJung-uk Kim         }
1250d6dd1baeSJung-uk Kim         if (!isprint (Name[i]))
1251d6dd1baeSJung-uk Kim         {
1252d6dd1baeSJung-uk Kim             RepairedName[i] = ' ';
12531a39cfb0SJung-uk Kim         }
12541a39cfb0SJung-uk Kim     }
12551a39cfb0SJung-uk Kim }
1256