xref: /freebsd/sys/contrib/dev/acpica/common/dmtable.c (revision efcc2a30547c400649a351e85e6cd97dab8f3817)
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 /*
8*efcc2a30SJung-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"},
284*efcc2a30SJung-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"},
3023f0275a0SJung-uk Kim     {ACPI_SIG_PCCT, NULL,                   AcpiDmDumpPcct, NULL,           NULL,           "Platform Communications Channel Table"},
3033f0275a0SJung-uk Kim     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt,   "Platform Memory Topology Table"},
304a88e22b7SJung-uk Kim     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"},
3053f0275a0SJung-uk Kim     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt,   "S3 Performance Table"},
306a88e22b7SJung-uk Kim     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst,   "Smart Battery Specification Table"},
307dcbce41eSJung-uk Kim     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic,   "Software Licensing Description Table"},
308a88e22b7SJung-uk Kim     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit,   "System Locality Information Table"},
309a88e22b7SJung-uk Kim     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr,   "Serial Port Console Redirection table"},
310a88e22b7SJung-uk Kim     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi,   "Server Platform Management Interface table"},
311a88e22b7SJung-uk Kim     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat,   "System Resource Affinity Table"},
312a88e22b7SJung-uk Kim     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},
313*efcc2a30SJung-uk Kim     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2,   "Trusted Platform Module hardware interface table"},
314d244b227SJung-uk Kim     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
315a88e22b7SJung-uk Kim     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
316a88e22b7SJung-uk Kim     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
317a88e22b7SJung-uk Kim     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
318a88e22b7SJung-uk Kim     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
319a88e22b7SJung-uk Kim     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
320a88e22b7SJung-uk Kim     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
3211a39cfb0SJung-uk Kim };
3221a39cfb0SJung-uk Kim 
3231a39cfb0SJung-uk Kim 
3241a39cfb0SJung-uk Kim /*******************************************************************************
3251a39cfb0SJung-uk Kim  *
326a88e22b7SJung-uk Kim  * FUNCTION:    AcpiDmGenerateChecksum
3271a39cfb0SJung-uk Kim  *
328a88e22b7SJung-uk Kim  * PARAMETERS:  Table               - Pointer to table to be checksummed
329a88e22b7SJung-uk Kim  *              Length              - Length of the table
330a88e22b7SJung-uk Kim  *              OriginalChecksum    - Value of the checksum field
3311a39cfb0SJung-uk Kim  *
3321a39cfb0SJung-uk Kim  * RETURN:      8 bit checksum of buffer
3331a39cfb0SJung-uk Kim  *
3341a39cfb0SJung-uk Kim  * DESCRIPTION: Computes an 8 bit checksum of the table.
3351a39cfb0SJung-uk Kim  *
3361a39cfb0SJung-uk Kim  ******************************************************************************/
3371a39cfb0SJung-uk Kim 
3381a39cfb0SJung-uk Kim UINT8
339a88e22b7SJung-uk Kim AcpiDmGenerateChecksum (
340a88e22b7SJung-uk Kim     void                    *Table,
341a88e22b7SJung-uk Kim     UINT32                  Length,
342a88e22b7SJung-uk Kim     UINT8                   OriginalChecksum)
3431a39cfb0SJung-uk Kim {
3441a39cfb0SJung-uk Kim     UINT8                   Checksum;
3451a39cfb0SJung-uk Kim 
3461a39cfb0SJung-uk Kim 
3471a39cfb0SJung-uk Kim     /* Sum the entire table as-is */
3481a39cfb0SJung-uk Kim 
349a88e22b7SJung-uk Kim     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
3501a39cfb0SJung-uk Kim 
3511a39cfb0SJung-uk Kim     /* Subtract off the existing checksum value in the table */
3521a39cfb0SJung-uk Kim 
353a88e22b7SJung-uk Kim     Checksum = (UINT8) (Checksum - OriginalChecksum);
3541a39cfb0SJung-uk Kim 
3551a39cfb0SJung-uk Kim     /* Compute the final checksum */
3561a39cfb0SJung-uk Kim 
3571a39cfb0SJung-uk Kim     Checksum = (UINT8) (0 - Checksum);
3581a39cfb0SJung-uk Kim     return (Checksum);
3591a39cfb0SJung-uk Kim }
3601a39cfb0SJung-uk Kim 
3611a39cfb0SJung-uk Kim 
3621a39cfb0SJung-uk Kim /*******************************************************************************
3631a39cfb0SJung-uk Kim  *
3641a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmGetTableData
3651a39cfb0SJung-uk Kim  *
3661a39cfb0SJung-uk Kim  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
3671a39cfb0SJung-uk Kim  *
3681a39cfb0SJung-uk Kim  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
3691a39cfb0SJung-uk Kim  *
3701a39cfb0SJung-uk Kim  * DESCRIPTION: Find a match in the global table of supported ACPI tables
3711a39cfb0SJung-uk Kim  *
3721a39cfb0SJung-uk Kim  ******************************************************************************/
3731a39cfb0SJung-uk Kim 
374a88e22b7SJung-uk Kim ACPI_DMTABLE_DATA *
3751a39cfb0SJung-uk Kim AcpiDmGetTableData (
3761a39cfb0SJung-uk Kim     char                    *Signature)
3771a39cfb0SJung-uk Kim {
3781a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
3791a39cfb0SJung-uk Kim 
3801a39cfb0SJung-uk Kim 
3811a39cfb0SJung-uk Kim     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
3821a39cfb0SJung-uk Kim     {
3831a39cfb0SJung-uk Kim         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
3841a39cfb0SJung-uk Kim         {
3851a39cfb0SJung-uk Kim             return (TableData);
3861a39cfb0SJung-uk Kim         }
3871a39cfb0SJung-uk Kim     }
3881a39cfb0SJung-uk Kim 
3891a39cfb0SJung-uk Kim     return (NULL);
3901a39cfb0SJung-uk Kim }
3911a39cfb0SJung-uk Kim 
3921a39cfb0SJung-uk Kim 
3931a39cfb0SJung-uk Kim /*******************************************************************************
3941a39cfb0SJung-uk Kim  *
3951a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpDataTable
3961a39cfb0SJung-uk Kim  *
3971a39cfb0SJung-uk Kim  * PARAMETERS:  Table               - An ACPI table
3981a39cfb0SJung-uk Kim  *
3991a39cfb0SJung-uk Kim  * RETURN:      None.
4001a39cfb0SJung-uk Kim  *
4011a39cfb0SJung-uk Kim  * DESCRIPTION: Format the contents of an ACPI data table (any table other
4021a39cfb0SJung-uk Kim  *              than an SSDT or DSDT that does not contain executable AML code)
4031a39cfb0SJung-uk Kim  *
4041a39cfb0SJung-uk Kim  ******************************************************************************/
4051a39cfb0SJung-uk Kim 
4061a39cfb0SJung-uk Kim void
4071a39cfb0SJung-uk Kim AcpiDmDumpDataTable (
4081a39cfb0SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
4091a39cfb0SJung-uk Kim {
410a9f12690SJung-uk Kim     ACPI_STATUS             Status;
4111a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
4121a39cfb0SJung-uk Kim     UINT32                  Length;
4131a39cfb0SJung-uk Kim 
4141a39cfb0SJung-uk Kim 
4151a39cfb0SJung-uk Kim     /* Ignore tables that contain AML */
4161a39cfb0SJung-uk Kim 
4171a39cfb0SJung-uk Kim     if (AcpiUtIsAmlTable (Table))
4181a39cfb0SJung-uk Kim     {
4198ef1a331SJung-uk Kim         if (Gbl_VerboseTemplates)
4208ef1a331SJung-uk Kim         {
4218ef1a331SJung-uk Kim             /* Dump the raw table data */
4228ef1a331SJung-uk Kim 
4238ef1a331SJung-uk Kim             Length = Table->Length;
4248ef1a331SJung-uk Kim 
4258ef1a331SJung-uk Kim             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
4268ef1a331SJung-uk Kim                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
4278ef1a331SJung-uk Kim             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
4288ef1a331SJung-uk Kim                 Length, DB_BYTE_DISPLAY, 0);
4298ef1a331SJung-uk Kim             AcpiOsPrintf (" */\n");
4308ef1a331SJung-uk Kim         }
4311a39cfb0SJung-uk Kim         return;
4321a39cfb0SJung-uk Kim     }
4331a39cfb0SJung-uk Kim 
4341a39cfb0SJung-uk Kim     /*
4351a39cfb0SJung-uk Kim      * Handle tables that don't use the common ACPI table header structure.
4363f0275a0SJung-uk Kim      * Currently, these are the FACS, RSDP, and S3PT.
4371a39cfb0SJung-uk Kim      */
4381a39cfb0SJung-uk Kim     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
4391a39cfb0SJung-uk Kim     {
4401a39cfb0SJung-uk Kim         Length = Table->Length;
4411a39cfb0SJung-uk Kim         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
4421a39cfb0SJung-uk Kim     }
4431a39cfb0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
4441a39cfb0SJung-uk Kim     {
4451a39cfb0SJung-uk Kim         Length = AcpiDmDumpRsdp (Table);
4461a39cfb0SJung-uk Kim     }
4473f0275a0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
4483f0275a0SJung-uk Kim     {
4493f0275a0SJung-uk Kim         Length = AcpiDmDumpS3pt (Table);
4503f0275a0SJung-uk Kim     }
4511a39cfb0SJung-uk Kim     else
4521a39cfb0SJung-uk Kim     {
4531a39cfb0SJung-uk Kim         /*
4541a39cfb0SJung-uk Kim          * All other tables must use the common ACPI table header, dump it now
4551a39cfb0SJung-uk Kim          */
4561a39cfb0SJung-uk Kim         Length = Table->Length;
457a9f12690SJung-uk Kim         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
458a9f12690SJung-uk Kim         if (ACPI_FAILURE (Status))
459a9f12690SJung-uk Kim         {
460a9f12690SJung-uk Kim             return;
461a9f12690SJung-uk Kim         }
4621a39cfb0SJung-uk Kim         AcpiOsPrintf ("\n");
4631a39cfb0SJung-uk Kim 
4641a39cfb0SJung-uk Kim         /* Match signature and dispatch appropriately */
4651a39cfb0SJung-uk Kim 
4661a39cfb0SJung-uk Kim         TableData = AcpiDmGetTableData (Table->Signature);
4671a39cfb0SJung-uk Kim         if (!TableData)
4681a39cfb0SJung-uk Kim         {
4691a39cfb0SJung-uk Kim             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
4701a39cfb0SJung-uk Kim             {
4711a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
4721a39cfb0SJung-uk Kim                     Table->Signature);
4731a39cfb0SJung-uk Kim             }
4741a39cfb0SJung-uk Kim             else
4751a39cfb0SJung-uk Kim             {
4761a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
4771a39cfb0SJung-uk Kim                     Table->Signature);
4781a39cfb0SJung-uk Kim             }
4791a39cfb0SJung-uk Kim         }
4801a39cfb0SJung-uk Kim         else if (TableData->TableHandler)
4811a39cfb0SJung-uk Kim         {
4821a39cfb0SJung-uk Kim             /* Complex table, has a handler */
4831a39cfb0SJung-uk Kim 
4841a39cfb0SJung-uk Kim             TableData->TableHandler (Table);
4851a39cfb0SJung-uk Kim         }
4861a39cfb0SJung-uk Kim         else if (TableData->TableInfo)
4871a39cfb0SJung-uk Kim         {
4881a39cfb0SJung-uk Kim             /* Simple table, just walk the info table */
4891a39cfb0SJung-uk Kim 
4901a39cfb0SJung-uk Kim             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
4911a39cfb0SJung-uk Kim         }
4921a39cfb0SJung-uk Kim     }
4931a39cfb0SJung-uk Kim 
494a88e22b7SJung-uk Kim     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
495a88e22b7SJung-uk Kim     {
496a88e22b7SJung-uk Kim         /* Dump the raw table data */
4971a39cfb0SJung-uk Kim 
498d244b227SJung-uk Kim         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
499d244b227SJung-uk Kim             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
5008ef1a331SJung-uk Kim         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
5018ef1a331SJung-uk Kim             Length, DB_BYTE_DISPLAY, 0);
5021a39cfb0SJung-uk Kim     }
503a88e22b7SJung-uk Kim }
5041a39cfb0SJung-uk Kim 
5051a39cfb0SJung-uk Kim 
5061a39cfb0SJung-uk Kim /*******************************************************************************
5071a39cfb0SJung-uk Kim  *
5081a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmLineHeader
5091a39cfb0SJung-uk Kim  *
5101a39cfb0SJung-uk Kim  * PARAMETERS:  Offset              - Current byte offset, from table start
5111a39cfb0SJung-uk Kim  *              ByteLength          - Length of the field in bytes, 0 for flags
5121a39cfb0SJung-uk Kim  *              Name                - Name of this field
5131a39cfb0SJung-uk Kim  *              Value               - Optional value, displayed on left of ':'
5141a39cfb0SJung-uk Kim  *
5151a39cfb0SJung-uk Kim  * RETURN:      None
5161a39cfb0SJung-uk Kim  *
5171a39cfb0SJung-uk Kim  * DESCRIPTION: Utility routines for formatting output lines. Displays the
5181a39cfb0SJung-uk Kim  *              current table offset in hex and decimal, the field length,
5191a39cfb0SJung-uk Kim  *              and the field name.
5201a39cfb0SJung-uk Kim  *
5211a39cfb0SJung-uk Kim  ******************************************************************************/
5221a39cfb0SJung-uk Kim 
5231a39cfb0SJung-uk Kim void
5241a39cfb0SJung-uk Kim AcpiDmLineHeader (
5251a39cfb0SJung-uk Kim     UINT32                  Offset,
5261a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5271a39cfb0SJung-uk Kim     char                    *Name)
5281a39cfb0SJung-uk Kim {
5291a39cfb0SJung-uk Kim 
530dcbce41eSJung-uk Kim     /* Allow a null name for fields that span multiple lines (large buffers) */
531dcbce41eSJung-uk Kim 
532dcbce41eSJung-uk Kim     if (!Name)
533dcbce41eSJung-uk Kim     {
534dcbce41eSJung-uk Kim         Name = "";
535dcbce41eSJung-uk Kim     }
536dcbce41eSJung-uk Kim 
537a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
538a88e22b7SJung-uk Kim     {
539a88e22b7SJung-uk Kim         if (ByteLength)
540a88e22b7SJung-uk Kim         {
541dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
542a88e22b7SJung-uk Kim         }
543a88e22b7SJung-uk Kim         else
544a88e22b7SJung-uk Kim         {
545d052a1ccSJung-uk Kim             if (*Name)
546d052a1ccSJung-uk Kim             {
547dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%41s : ", Name);
548a88e22b7SJung-uk Kim             }
549d052a1ccSJung-uk Kim             else
550d052a1ccSJung-uk Kim             {
551d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%41s   ", Name);
552d052a1ccSJung-uk Kim             }
553d052a1ccSJung-uk Kim         }
554a88e22b7SJung-uk Kim     }
555a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
556a88e22b7SJung-uk Kim     {
5571a39cfb0SJung-uk Kim         if (ByteLength)
5581a39cfb0SJung-uk Kim         {
559dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
5601a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name);
5611a39cfb0SJung-uk Kim         }
5621a39cfb0SJung-uk Kim         else
5631a39cfb0SJung-uk Kim         {
564d052a1ccSJung-uk Kim             if (*Name)
565d052a1ccSJung-uk Kim             {
566dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%44s : ", Name);
5671a39cfb0SJung-uk Kim             }
568d052a1ccSJung-uk Kim             else
569d052a1ccSJung-uk Kim             {
570d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%44s   ", Name);
571d052a1ccSJung-uk Kim             }
572d052a1ccSJung-uk Kim         }
5731a39cfb0SJung-uk Kim     }
574a88e22b7SJung-uk Kim }
5751a39cfb0SJung-uk Kim 
5761a39cfb0SJung-uk Kim void
5771a39cfb0SJung-uk Kim AcpiDmLineHeader2 (
5781a39cfb0SJung-uk Kim     UINT32                  Offset,
5791a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5801a39cfb0SJung-uk Kim     char                    *Name,
5811a39cfb0SJung-uk Kim     UINT32                  Value)
5821a39cfb0SJung-uk Kim {
5831a39cfb0SJung-uk Kim 
584a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
585a88e22b7SJung-uk Kim     {
586a88e22b7SJung-uk Kim         if (ByteLength)
587a88e22b7SJung-uk Kim         {
588d052a1ccSJung-uk Kim             AcpiOsPrintf ("[%.4d] %30s %3d : ",
589a88e22b7SJung-uk Kim                 ByteLength, Name, Value);
590a88e22b7SJung-uk Kim         }
591a88e22b7SJung-uk Kim         else
592a88e22b7SJung-uk Kim         {
593a88e22b7SJung-uk Kim             AcpiOsPrintf ("%36s % 3d : ",
594a88e22b7SJung-uk Kim                 Name, Value);
595a88e22b7SJung-uk Kim         }
596a88e22b7SJung-uk Kim     }
597a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
598a88e22b7SJung-uk Kim     {
5991a39cfb0SJung-uk Kim         if (ByteLength)
6001a39cfb0SJung-uk Kim         {
601a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
6021a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name, Value);
6031a39cfb0SJung-uk Kim         }
6041a39cfb0SJung-uk Kim         else
6051a39cfb0SJung-uk Kim         {
606a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
6071a39cfb0SJung-uk Kim                 Offset, Offset, Name, Value);
6081a39cfb0SJung-uk Kim         }
6091a39cfb0SJung-uk Kim     }
610a88e22b7SJung-uk Kim }
6111a39cfb0SJung-uk Kim 
6121a39cfb0SJung-uk Kim 
6131a39cfb0SJung-uk Kim /*******************************************************************************
6141a39cfb0SJung-uk Kim  *
6151a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpTable
6161a39cfb0SJung-uk Kim  *
6171a39cfb0SJung-uk Kim  * PARAMETERS:  TableLength         - Length of the entire ACPI table
6181a39cfb0SJung-uk Kim  *              TableOffset         - Starting offset within the table for this
6191a39cfb0SJung-uk Kim  *                                    sub-descriptor (0 if main table)
6201a39cfb0SJung-uk Kim  *              Table               - The ACPI table
621a9f12690SJung-uk Kim  *              SubtableLength      - Length of this sub-descriptor
6221a39cfb0SJung-uk Kim  *              Info                - Info table for this ACPI table
6231a39cfb0SJung-uk Kim  *
6241a39cfb0SJung-uk Kim  * RETURN:      None
6251a39cfb0SJung-uk Kim  *
6261a39cfb0SJung-uk Kim  * DESCRIPTION: Display ACPI table contents by walking the Info table.
6271a39cfb0SJung-uk Kim  *
628a88e22b7SJung-uk Kim  * Note: This function must remain in sync with DtGetFieldLength.
629a88e22b7SJung-uk Kim  *
6301a39cfb0SJung-uk Kim  ******************************************************************************/
6311a39cfb0SJung-uk Kim 
632a9f12690SJung-uk Kim ACPI_STATUS
6331a39cfb0SJung-uk Kim AcpiDmDumpTable (
6341a39cfb0SJung-uk Kim     UINT32                  TableLength,
6351a39cfb0SJung-uk Kim     UINT32                  TableOffset,
6361a39cfb0SJung-uk Kim     void                    *Table,
6371a39cfb0SJung-uk Kim     UINT32                  SubtableLength,
6381a39cfb0SJung-uk Kim     ACPI_DMTABLE_INFO       *Info)
6391a39cfb0SJung-uk Kim {
6401a39cfb0SJung-uk Kim     UINT8                   *Target;
6411a39cfb0SJung-uk Kim     UINT32                  CurrentOffset;
6421a39cfb0SJung-uk Kim     UINT32                  ByteLength;
6431a39cfb0SJung-uk Kim     UINT8                   Temp8;
6441a39cfb0SJung-uk Kim     UINT16                  Temp16;
6451a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
646d6dd1baeSJung-uk Kim     const char              *Name;
647a9f12690SJung-uk Kim     BOOLEAN                 LastOutputBlankLine = FALSE;
648d6dd1baeSJung-uk Kim     char                    RepairedName[8];
6491a39cfb0SJung-uk Kim 
6501a39cfb0SJung-uk Kim 
6511a39cfb0SJung-uk Kim     if (!Info)
6521a39cfb0SJung-uk Kim     {
6531a39cfb0SJung-uk Kim         AcpiOsPrintf ("Display not implemented\n");
654a9f12690SJung-uk Kim         return (AE_NOT_IMPLEMENTED);
6551a39cfb0SJung-uk Kim     }
6561a39cfb0SJung-uk Kim 
6571a39cfb0SJung-uk Kim     /* Walk entire Info table; Null name terminates */
6581a39cfb0SJung-uk Kim 
6591a39cfb0SJung-uk Kim     for (; Info->Name; Info++)
6601a39cfb0SJung-uk Kim     {
6611a39cfb0SJung-uk Kim         /*
6621a39cfb0SJung-uk Kim          * Target points to the field within the ACPI Table. CurrentOffset is
6631a39cfb0SJung-uk Kim          * the offset of the field from the start of the main table.
6641a39cfb0SJung-uk Kim          */
6651a39cfb0SJung-uk Kim         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
6661a39cfb0SJung-uk Kim         CurrentOffset = TableOffset + Info->Offset;
6671a39cfb0SJung-uk Kim 
6681a39cfb0SJung-uk Kim         /* Check for beyond EOT or beyond subtable end */
6691a39cfb0SJung-uk Kim 
6701a39cfb0SJung-uk Kim         if ((CurrentOffset >= TableLength) ||
6711a39cfb0SJung-uk Kim             (SubtableLength && (Info->Offset >= SubtableLength)))
6721a39cfb0SJung-uk Kim         {
673a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
674a9f12690SJung-uk Kim             return (AE_BAD_DATA);
6751a39cfb0SJung-uk Kim         }
6761a39cfb0SJung-uk Kim 
6771a39cfb0SJung-uk Kim         /* Generate the byte length for this field */
6781a39cfb0SJung-uk Kim 
6791a39cfb0SJung-uk Kim         switch (Info->Opcode)
6801a39cfb0SJung-uk Kim         {
6811a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
6821a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
6831a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
6845a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
685d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
6861a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
6873f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
6881a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
689a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
690a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
691a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
692a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
693a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
694a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
695a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
6961a39cfb0SJung-uk Kim             ByteLength = 1;
6971a39cfb0SJung-uk Kim             break;
6981a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
6991a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
700a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
7011a39cfb0SJung-uk Kim             ByteLength = 2;
7021a39cfb0SJung-uk Kim             break;
7031a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
7041a39cfb0SJung-uk Kim             ByteLength = 3;
7051a39cfb0SJung-uk Kim             break;
7061a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
7071a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
7081a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
709dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
7101a39cfb0SJung-uk Kim             ByteLength = 4;
7111a39cfb0SJung-uk Kim             break;
7123f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
7133f0275a0SJung-uk Kim             ByteLength = 5;
7143f0275a0SJung-uk Kim             break;
7153f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
7161a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
7171a39cfb0SJung-uk Kim             ByteLength = 6;
7181a39cfb0SJung-uk Kim             break;
7191a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
7200b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
7211a39cfb0SJung-uk Kim             ByteLength = 7;
7221a39cfb0SJung-uk Kim             break;
7231a39cfb0SJung-uk Kim         case ACPI_DMT_UINT64:
7241a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
7251a39cfb0SJung-uk Kim             ByteLength = 8;
7261a39cfb0SJung-uk Kim             break;
727d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
728d244b227SJung-uk Kim         case ACPI_DMT_UUID:
729d6dd1baeSJung-uk Kim             ByteLength = 16;
730d6dd1baeSJung-uk Kim             break;
731dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
732dcbce41eSJung-uk Kim             ByteLength = 128;
733dcbce41eSJung-uk Kim             break;
7341a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
7351a39cfb0SJung-uk Kim             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
7361a39cfb0SJung-uk Kim             break;
7371a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
738a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
739a9f12690SJung-uk Kim             {
7401a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
741a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
742a9f12690SJung-uk Kim             }
7431a39cfb0SJung-uk Kim             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
7441a39cfb0SJung-uk Kim             break;
745a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
746a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
747a9f12690SJung-uk Kim             {
748a9f12690SJung-uk Kim                 AcpiOsPrintf ("\n");
749a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
750a9f12690SJung-uk Kim             }
751a9f12690SJung-uk Kim             ByteLength = sizeof (ACPI_HEST_NOTIFY);
752a9f12690SJung-uk Kim             break;
7531a39cfb0SJung-uk Kim         default:
7541a39cfb0SJung-uk Kim             ByteLength = 0;
7551a39cfb0SJung-uk Kim             break;
7561a39cfb0SJung-uk Kim         }
7571a39cfb0SJung-uk Kim 
758a9f12690SJung-uk Kim         if (CurrentOffset + ByteLength > TableLength)
759a9f12690SJung-uk Kim         {
760a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
761a9f12690SJung-uk Kim             return (AE_BAD_DATA);
762a9f12690SJung-uk Kim         }
763a9f12690SJung-uk Kim 
7643f0275a0SJung-uk Kim         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
7653f0275a0SJung-uk Kim         {
7663f0275a0SJung-uk Kim             AcpiOsPrintf ("%s", Info->Name);
7673f0275a0SJung-uk Kim             continue;
7683f0275a0SJung-uk Kim         }
7693f0275a0SJung-uk Kim 
7701a39cfb0SJung-uk Kim         /* Start a new line and decode the opcode */
7711a39cfb0SJung-uk Kim 
7721a39cfb0SJung-uk Kim         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
7731a39cfb0SJung-uk Kim 
7741a39cfb0SJung-uk Kim         switch (Info->Opcode)
7751a39cfb0SJung-uk Kim         {
7761a39cfb0SJung-uk Kim         /* Single-bit Flag fields. Note: Opcode is the bit position */
7771a39cfb0SJung-uk Kim 
7781a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG0:
7791a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG1:
7801a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG2:
7811a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG3:
7821a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG4:
7831a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG5:
7841a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG6:
7851a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG7:
7861a39cfb0SJung-uk Kim 
7871a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
7881a39cfb0SJung-uk Kim             break;
7891a39cfb0SJung-uk Kim 
7901a39cfb0SJung-uk Kim         /* 2-bit Flag fields */
7911a39cfb0SJung-uk Kim 
7921a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS0:
7931a39cfb0SJung-uk Kim 
7941a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
7951a39cfb0SJung-uk Kim             break;
7961a39cfb0SJung-uk Kim 
7973f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS1:
7983f0275a0SJung-uk Kim 
7993f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
8003f0275a0SJung-uk Kim             break;
8013f0275a0SJung-uk Kim 
8021a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS2:
8031a39cfb0SJung-uk Kim 
8041a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
8051a39cfb0SJung-uk Kim             break;
8061a39cfb0SJung-uk Kim 
8073f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS4:
8083f0275a0SJung-uk Kim 
8093f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
8103f0275a0SJung-uk Kim             break;
8113f0275a0SJung-uk Kim 
8123f0275a0SJung-uk Kim         /* Integer Data Types */
8131a39cfb0SJung-uk Kim 
8141a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
8151a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
8161a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
8171a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
8183f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
8193f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
8201a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
8213f0275a0SJung-uk Kim         case ACPI_DMT_UINT64:
8223f0275a0SJung-uk Kim             /*
8233f0275a0SJung-uk Kim              * Dump bytes - high byte first, low byte last.
8243f0275a0SJung-uk Kim              * Note: All ACPI tables are little-endian.
8253f0275a0SJung-uk Kim              */
8263f0275a0SJung-uk Kim             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
827a9f12690SJung-uk Kim             {
8283f0275a0SJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
829a9f12690SJung-uk Kim             }
830a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
8311a39cfb0SJung-uk Kim             break;
8321a39cfb0SJung-uk Kim 
8330b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
834d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
835dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
836d6dd1baeSJung-uk Kim 
8370b94ba42SJung-uk Kim             /*
8380b94ba42SJung-uk Kim              * Buffer: Size depends on the opcode and was set above.
8390b94ba42SJung-uk Kim              * Each hex byte is separated with a space.
840d052a1ccSJung-uk Kim              * Multiple lines are separated by line continuation char.
8410b94ba42SJung-uk Kim              */
842dcbce41eSJung-uk Kim             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
843d6dd1baeSJung-uk Kim             {
844dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
845dcbce41eSJung-uk Kim                 if ((UINT32) (Temp16 + 1) < ByteLength)
846dcbce41eSJung-uk Kim                 {
847dcbce41eSJung-uk Kim                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
848dcbce41eSJung-uk Kim                     {
849d052a1ccSJung-uk Kim                         AcpiOsPrintf (" \\\n"); /* Line continuation */
850dcbce41eSJung-uk Kim                         AcpiDmLineHeader (0, 0, NULL);
851dcbce41eSJung-uk Kim                     }
852dcbce41eSJung-uk Kim                     else
853a88e22b7SJung-uk Kim                     {
8540b94ba42SJung-uk Kim                         AcpiOsPrintf (" ");
855a88e22b7SJung-uk Kim                     }
856d6dd1baeSJung-uk Kim                 }
857dcbce41eSJung-uk Kim             }
858d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\n");
859d6dd1baeSJung-uk Kim             break;
860d6dd1baeSJung-uk Kim 
861d244b227SJung-uk Kim         case ACPI_DMT_UUID:
862d244b227SJung-uk Kim 
863d244b227SJung-uk Kim             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
864d244b227SJung-uk Kim 
865d244b227SJung-uk Kim             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
866d244b227SJung-uk Kim 
867d244b227SJung-uk Kim             AcpiOsPrintf ("%s\n", MsgBuffer);
868d244b227SJung-uk Kim             break;
869d244b227SJung-uk Kim 
8701a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
8711a39cfb0SJung-uk Kim 
872d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
8731a39cfb0SJung-uk Kim             break;
8741a39cfb0SJung-uk Kim 
8751a39cfb0SJung-uk Kim         /* Fixed length ASCII name fields */
8761a39cfb0SJung-uk Kim 
8771a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
8781a39cfb0SJung-uk Kim 
879d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
880d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
8811a39cfb0SJung-uk Kim             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
8821a39cfb0SJung-uk Kim             if (TableData)
8831a39cfb0SJung-uk Kim             {
884d052a1ccSJung-uk Kim                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
8851a39cfb0SJung-uk Kim             }
886d052a1ccSJung-uk Kim             else
887d052a1ccSJung-uk Kim             {
8881a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
889d052a1ccSJung-uk Kim             }
8901a39cfb0SJung-uk Kim             break;
8911a39cfb0SJung-uk Kim 
8921a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
8931a39cfb0SJung-uk Kim 
894d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
895d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
8961a39cfb0SJung-uk Kim             break;
8971a39cfb0SJung-uk Kim 
8981a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
8991a39cfb0SJung-uk Kim 
900d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 6);
901d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
9021a39cfb0SJung-uk Kim             break;
9031a39cfb0SJung-uk Kim 
9041a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
9051a39cfb0SJung-uk Kim 
906d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 8);
907d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
9081a39cfb0SJung-uk Kim             break;
9091a39cfb0SJung-uk Kim 
9101a39cfb0SJung-uk Kim         /* Special Data Types */
9111a39cfb0SJung-uk Kim 
9121a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
9131a39cfb0SJung-uk Kim 
9141a39cfb0SJung-uk Kim             /* Checksum, display and validate */
9151a39cfb0SJung-uk Kim 
9161a39cfb0SJung-uk Kim             AcpiOsPrintf ("%2.2X", *Target);
917a88e22b7SJung-uk Kim             Temp8 = AcpiDmGenerateChecksum (Table,
918a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
919a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
9201a39cfb0SJung-uk Kim             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
9211a39cfb0SJung-uk Kim             {
9221a39cfb0SJung-uk Kim                 AcpiOsPrintf (
9231a39cfb0SJung-uk Kim                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
9241a39cfb0SJung-uk Kim             }
9251a39cfb0SJung-uk Kim             AcpiOsPrintf ("\n");
9261a39cfb0SJung-uk Kim             break;
9271a39cfb0SJung-uk Kim 
9281a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
9291a39cfb0SJung-uk Kim 
9301a39cfb0SJung-uk Kim             /* Address Space ID */
9311a39cfb0SJung-uk Kim 
932d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
9331a39cfb0SJung-uk Kim             break;
9341a39cfb0SJung-uk Kim 
9355a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
9365a77b11bSJung-uk Kim 
9375a77b11bSJung-uk Kim             /* Encoded Access Width */
9385a77b11bSJung-uk Kim 
9395a77b11bSJung-uk Kim             Temp8 = *Target;
9405a77b11bSJung-uk Kim             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
9415a77b11bSJung-uk Kim             {
9425a77b11bSJung-uk Kim                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
9435a77b11bSJung-uk Kim             }
9445a77b11bSJung-uk Kim 
945d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
9465a77b11bSJung-uk Kim             break;
9475a77b11bSJung-uk Kim 
9481a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
9491a39cfb0SJung-uk Kim 
9501a39cfb0SJung-uk Kim             /* Generic Address Structure */
9511a39cfb0SJung-uk Kim 
952d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
953d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
954d6dd1baeSJung-uk Kim                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
955a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
956a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
957a9f12690SJung-uk Kim             break;
958a9f12690SJung-uk Kim 
959a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
960a9f12690SJung-uk Kim 
961a9f12690SJung-uk Kim             /* ASF subtable types */
962a9f12690SJung-uk Kim 
963a9f12690SJung-uk Kim             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
964a9f12690SJung-uk Kim             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
965a9f12690SJung-uk Kim             {
966a9f12690SJung-uk Kim                 Temp16 = ACPI_ASF_TYPE_RESERVED;
967a9f12690SJung-uk Kim             }
968a9f12690SJung-uk Kim 
969d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
9701a39cfb0SJung-uk Kim             break;
9711a39cfb0SJung-uk Kim 
9721a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
9731a39cfb0SJung-uk Kim 
9741a39cfb0SJung-uk Kim             /* DMAR subtable types */
9751a39cfb0SJung-uk Kim 
976a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
9771a39cfb0SJung-uk Kim             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
9781a39cfb0SJung-uk Kim             {
9791a39cfb0SJung-uk Kim                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
9801a39cfb0SJung-uk Kim             }
9811a39cfb0SJung-uk Kim 
982d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
9831a39cfb0SJung-uk Kim             break;
9841a39cfb0SJung-uk Kim 
985a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
986a88e22b7SJung-uk Kim 
987a88e22b7SJung-uk Kim             /* EINJ Action types */
988a88e22b7SJung-uk Kim 
989a88e22b7SJung-uk Kim             Temp8 = *Target;
990a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
991a88e22b7SJung-uk Kim             {
992a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
993a88e22b7SJung-uk Kim             }
994a88e22b7SJung-uk Kim 
995d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
996a88e22b7SJung-uk Kim             break;
997a88e22b7SJung-uk Kim 
998a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
999a88e22b7SJung-uk Kim 
1000a88e22b7SJung-uk Kim             /* EINJ Instruction types */
1001a88e22b7SJung-uk Kim 
1002a88e22b7SJung-uk Kim             Temp8 = *Target;
1003a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1004a88e22b7SJung-uk Kim             {
1005a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1006a88e22b7SJung-uk Kim             }
1007a88e22b7SJung-uk Kim 
1008d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
1009a88e22b7SJung-uk Kim             break;
1010a88e22b7SJung-uk Kim 
1011a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
1012a88e22b7SJung-uk Kim 
1013a88e22b7SJung-uk Kim             /* ERST Action types */
1014a88e22b7SJung-uk Kim 
1015a88e22b7SJung-uk Kim             Temp8 = *Target;
1016a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1017a88e22b7SJung-uk Kim             {
1018a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1019a88e22b7SJung-uk Kim             }
1020a88e22b7SJung-uk Kim 
1021d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1022a88e22b7SJung-uk Kim             break;
1023a88e22b7SJung-uk Kim 
1024a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
1025a88e22b7SJung-uk Kim 
1026a88e22b7SJung-uk Kim             /* ERST Instruction types */
1027a88e22b7SJung-uk Kim 
1028a88e22b7SJung-uk Kim             Temp8 = *Target;
1029a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1030a88e22b7SJung-uk Kim             {
1031a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1032a88e22b7SJung-uk Kim             }
1033a88e22b7SJung-uk Kim 
1034d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1035a88e22b7SJung-uk Kim             break;
1036a88e22b7SJung-uk Kim 
1037a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
1038a9f12690SJung-uk Kim 
1039a9f12690SJung-uk Kim             /* HEST subtable types */
1040a9f12690SJung-uk Kim 
1041a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
1042a9f12690SJung-uk Kim             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1043a9f12690SJung-uk Kim             {
1044a9f12690SJung-uk Kim                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1045a9f12690SJung-uk Kim             }
1046a9f12690SJung-uk Kim 
1047d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1048a9f12690SJung-uk Kim             break;
1049a9f12690SJung-uk Kim 
1050a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
1051a9f12690SJung-uk Kim 
1052d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1053d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1054d6dd1baeSJung-uk Kim                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1055a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
1056a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
1057a9f12690SJung-uk Kim             break;
1058a9f12690SJung-uk Kim 
1059a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
1060a9f12690SJung-uk Kim 
1061a9f12690SJung-uk Kim             /* HEST Notify types */
1062a9f12690SJung-uk Kim 
1063a9f12690SJung-uk Kim             Temp8 = *Target;
1064a9f12690SJung-uk Kim             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1065a9f12690SJung-uk Kim             {
1066a9f12690SJung-uk Kim                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1067a9f12690SJung-uk Kim             }
1068a9f12690SJung-uk Kim 
1069d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1070a9f12690SJung-uk Kim             break;
1071a9f12690SJung-uk Kim 
10721a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
10731a39cfb0SJung-uk Kim 
10741a39cfb0SJung-uk Kim             /* MADT subtable types */
10751a39cfb0SJung-uk Kim 
10761a39cfb0SJung-uk Kim             Temp8 = *Target;
10771a39cfb0SJung-uk Kim             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
10781a39cfb0SJung-uk Kim             {
10791a39cfb0SJung-uk Kim                 Temp8 = ACPI_MADT_TYPE_RESERVED;
10801a39cfb0SJung-uk Kim             }
10811a39cfb0SJung-uk Kim 
1082d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
10831a39cfb0SJung-uk Kim             break;
10841a39cfb0SJung-uk Kim 
10853f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
10863f0275a0SJung-uk Kim 
10873f0275a0SJung-uk Kim             /* PMTT subtable types */
10883f0275a0SJung-uk Kim 
10893f0275a0SJung-uk Kim             Temp8 = *Target;
10903f0275a0SJung-uk Kim             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
10913f0275a0SJung-uk Kim             {
10923f0275a0SJung-uk Kim                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
10933f0275a0SJung-uk Kim             }
10943f0275a0SJung-uk Kim 
10953f0275a0SJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
10963f0275a0SJung-uk Kim             break;
10973f0275a0SJung-uk Kim 
1098dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
1099dcbce41eSJung-uk Kim 
1100dcbce41eSJung-uk Kim             /* SLIC subtable types */
1101dcbce41eSJung-uk Kim 
1102dcbce41eSJung-uk Kim             Temp8 = *Target;
1103dcbce41eSJung-uk Kim             if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1104dcbce41eSJung-uk Kim             {
1105dcbce41eSJung-uk Kim                 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1106dcbce41eSJung-uk Kim             }
1107dcbce41eSJung-uk Kim 
1108d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1109dcbce41eSJung-uk Kim             break;
1110dcbce41eSJung-uk Kim 
11111a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
11121a39cfb0SJung-uk Kim 
11131a39cfb0SJung-uk Kim             /* SRAT subtable types */
11141a39cfb0SJung-uk Kim 
11151a39cfb0SJung-uk Kim             Temp8 = *Target;
11161a39cfb0SJung-uk Kim             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
11171a39cfb0SJung-uk Kim             {
11181a39cfb0SJung-uk Kim                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
11191a39cfb0SJung-uk Kim             }
11201a39cfb0SJung-uk Kim 
1121d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
11221a39cfb0SJung-uk Kim             break;
11231a39cfb0SJung-uk Kim 
1124a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
1125a9f12690SJung-uk Kim 
1126a9f12690SJung-uk Kim             /* FADT Preferred PM Profile names */
1127a9f12690SJung-uk Kim 
1128a9f12690SJung-uk Kim             Temp8 = *Target;
1129a9f12690SJung-uk Kim             if (Temp8 > ACPI_FADT_PM_RESERVED)
1130a9f12690SJung-uk Kim             {
1131a9f12690SJung-uk Kim                 Temp8 = ACPI_FADT_PM_RESERVED;
1132a9f12690SJung-uk Kim             }
1133a9f12690SJung-uk Kim 
1134d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1135a9f12690SJung-uk Kim             break;
1136a9f12690SJung-uk Kim 
1137d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
1138d6dd1baeSJung-uk Kim 
1139d6dd1baeSJung-uk Kim             /* IVRS subtable types */
1140d6dd1baeSJung-uk Kim 
1141d6dd1baeSJung-uk Kim             Temp8 = *Target;
1142d6dd1baeSJung-uk Kim             switch (Temp8)
1143d6dd1baeSJung-uk Kim             {
1144d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_HARDWARE:
1145d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[0];
1146d6dd1baeSJung-uk Kim                 break;
1147d6dd1baeSJung-uk Kim 
1148d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY1:
1149d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY2:
1150d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY3:
1151d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[1];
1152d6dd1baeSJung-uk Kim                 break;
1153d6dd1baeSJung-uk Kim 
1154d6dd1baeSJung-uk Kim             default:
1155d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[2];
1156d6dd1baeSJung-uk Kim                 break;
1157d6dd1baeSJung-uk Kim             }
1158d6dd1baeSJung-uk Kim 
1159d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1160d6dd1baeSJung-uk Kim             break;
1161d6dd1baeSJung-uk Kim 
11621a39cfb0SJung-uk Kim         case ACPI_DMT_EXIT:
1163a9f12690SJung-uk Kim             return (AE_OK);
11641a39cfb0SJung-uk Kim 
11651a39cfb0SJung-uk Kim         default:
11661a39cfb0SJung-uk Kim             ACPI_ERROR ((AE_INFO,
1167ca3cf4faSJung-uk Kim                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1168a9f12690SJung-uk Kim             return (AE_SUPPORT);
11691a39cfb0SJung-uk Kim         }
11701a39cfb0SJung-uk Kim     }
1171a9f12690SJung-uk Kim 
1172a9f12690SJung-uk Kim     if (TableOffset && !SubtableLength)
1173a9f12690SJung-uk Kim     {
1174a9f12690SJung-uk Kim         /* If this table is not the main table, subtable must have valid length */
1175a9f12690SJung-uk Kim 
1176a9f12690SJung-uk Kim         AcpiOsPrintf ("Invalid zero length subtable\n");
1177a9f12690SJung-uk Kim         return (AE_BAD_DATA);
1178a9f12690SJung-uk Kim     }
1179a9f12690SJung-uk Kim 
1180a9f12690SJung-uk Kim     return (AE_OK);
11811a39cfb0SJung-uk Kim }
11821a39cfb0SJung-uk Kim 
11831a39cfb0SJung-uk Kim 
11841a39cfb0SJung-uk Kim /*******************************************************************************
11851a39cfb0SJung-uk Kim  *
11861a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmCheckAscii
11871a39cfb0SJung-uk Kim  *
11881a39cfb0SJung-uk Kim  * PARAMETERS:  Name                - Ascii string
11891a39cfb0SJung-uk Kim  *              Count               - Number of characters to check
11901a39cfb0SJung-uk Kim  *
11911a39cfb0SJung-uk Kim  * RETURN:      None
11921a39cfb0SJung-uk Kim  *
11931a39cfb0SJung-uk Kim  * DESCRIPTION: Ensure that the requested number of characters are printable
11941a39cfb0SJung-uk Kim  *              Ascii characters. Sets non-printable and null chars to <space>.
11951a39cfb0SJung-uk Kim  *
11961a39cfb0SJung-uk Kim  ******************************************************************************/
11971a39cfb0SJung-uk Kim 
11981a39cfb0SJung-uk Kim static void
11991a39cfb0SJung-uk Kim AcpiDmCheckAscii (
12001a39cfb0SJung-uk Kim     UINT8                   *Name,
1201d6dd1baeSJung-uk Kim     char                    *RepairedName,
12021a39cfb0SJung-uk Kim     UINT32                  Count)
12031a39cfb0SJung-uk Kim {
12041a39cfb0SJung-uk Kim     UINT32                  i;
12051a39cfb0SJung-uk Kim 
12061a39cfb0SJung-uk Kim 
12071a39cfb0SJung-uk Kim     for (i = 0; i < Count; i++)
12081a39cfb0SJung-uk Kim     {
1209f556842eSJung-uk Kim         RepairedName[i] = (char) Name[i];
1210d6dd1baeSJung-uk Kim 
1211d6dd1baeSJung-uk Kim         if (!Name[i])
12121a39cfb0SJung-uk Kim         {
1213d6dd1baeSJung-uk Kim             return;
1214d6dd1baeSJung-uk Kim         }
1215d6dd1baeSJung-uk Kim         if (!isprint (Name[i]))
1216d6dd1baeSJung-uk Kim         {
1217d6dd1baeSJung-uk Kim             RepairedName[i] = ' ';
12181a39cfb0SJung-uk Kim         }
12191a39cfb0SJung-uk Kim     }
12201a39cfb0SJung-uk Kim }
1221