xref: /freebsd/sys/contrib/dev/acpica/common/dmtable.c (revision 1df130f1d47a88a3dd0b18f2ae44677f4b93ba88)
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 /*
8ec3fc72fSJung-uk Kim  * Copyright (C) 2000 - 2012, 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"},
282*1df130f1SJung-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*1df130f1SJung-uk Kim     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, NULL,           NULL,           "Core System Resource Table"},
285*1df130f1SJung-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"},
291*1df130f1SJung-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"},
297*1df130f1SJung-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"},
313d244b227SJung-uk Kim     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
314a88e22b7SJung-uk Kim     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
315a88e22b7SJung-uk Kim     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
316a88e22b7SJung-uk Kim     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
317a88e22b7SJung-uk Kim     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
318a88e22b7SJung-uk Kim     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
319a88e22b7SJung-uk Kim     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
3201a39cfb0SJung-uk Kim };
3211a39cfb0SJung-uk Kim 
3221a39cfb0SJung-uk Kim 
3231a39cfb0SJung-uk Kim /*******************************************************************************
3241a39cfb0SJung-uk Kim  *
325a88e22b7SJung-uk Kim  * FUNCTION:    AcpiDmGenerateChecksum
3261a39cfb0SJung-uk Kim  *
327a88e22b7SJung-uk Kim  * PARAMETERS:  Table               - Pointer to table to be checksummed
328a88e22b7SJung-uk Kim  *              Length              - Length of the table
329a88e22b7SJung-uk Kim  *              OriginalChecksum    - Value of the checksum field
3301a39cfb0SJung-uk Kim  *
3311a39cfb0SJung-uk Kim  * RETURN:      8 bit checksum of buffer
3321a39cfb0SJung-uk Kim  *
3331a39cfb0SJung-uk Kim  * DESCRIPTION: Computes an 8 bit checksum of the table.
3341a39cfb0SJung-uk Kim  *
3351a39cfb0SJung-uk Kim  ******************************************************************************/
3361a39cfb0SJung-uk Kim 
3371a39cfb0SJung-uk Kim UINT8
338a88e22b7SJung-uk Kim AcpiDmGenerateChecksum (
339a88e22b7SJung-uk Kim     void                    *Table,
340a88e22b7SJung-uk Kim     UINT32                  Length,
341a88e22b7SJung-uk Kim     UINT8                   OriginalChecksum)
3421a39cfb0SJung-uk Kim {
3431a39cfb0SJung-uk Kim     UINT8                   Checksum;
3441a39cfb0SJung-uk Kim 
3451a39cfb0SJung-uk Kim 
3461a39cfb0SJung-uk Kim     /* Sum the entire table as-is */
3471a39cfb0SJung-uk Kim 
348a88e22b7SJung-uk Kim     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
3491a39cfb0SJung-uk Kim 
3501a39cfb0SJung-uk Kim     /* Subtract off the existing checksum value in the table */
3511a39cfb0SJung-uk Kim 
352a88e22b7SJung-uk Kim     Checksum = (UINT8) (Checksum - OriginalChecksum);
3531a39cfb0SJung-uk Kim 
3541a39cfb0SJung-uk Kim     /* Compute the final checksum */
3551a39cfb0SJung-uk Kim 
3561a39cfb0SJung-uk Kim     Checksum = (UINT8) (0 - Checksum);
3571a39cfb0SJung-uk Kim     return (Checksum);
3581a39cfb0SJung-uk Kim }
3591a39cfb0SJung-uk Kim 
3601a39cfb0SJung-uk Kim 
3611a39cfb0SJung-uk Kim /*******************************************************************************
3621a39cfb0SJung-uk Kim  *
3631a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmGetTableData
3641a39cfb0SJung-uk Kim  *
3651a39cfb0SJung-uk Kim  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
3661a39cfb0SJung-uk Kim  *
3671a39cfb0SJung-uk Kim  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
3681a39cfb0SJung-uk Kim  *
3691a39cfb0SJung-uk Kim  * DESCRIPTION: Find a match in the global table of supported ACPI tables
3701a39cfb0SJung-uk Kim  *
3711a39cfb0SJung-uk Kim  ******************************************************************************/
3721a39cfb0SJung-uk Kim 
373a88e22b7SJung-uk Kim ACPI_DMTABLE_DATA *
3741a39cfb0SJung-uk Kim AcpiDmGetTableData (
3751a39cfb0SJung-uk Kim     char                    *Signature)
3761a39cfb0SJung-uk Kim {
3771a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
3781a39cfb0SJung-uk Kim 
3791a39cfb0SJung-uk Kim 
3801a39cfb0SJung-uk Kim     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
3811a39cfb0SJung-uk Kim     {
3821a39cfb0SJung-uk Kim         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
3831a39cfb0SJung-uk Kim         {
3841a39cfb0SJung-uk Kim             return (TableData);
3851a39cfb0SJung-uk Kim         }
3861a39cfb0SJung-uk Kim     }
3871a39cfb0SJung-uk Kim 
3881a39cfb0SJung-uk Kim     return (NULL);
3891a39cfb0SJung-uk Kim }
3901a39cfb0SJung-uk Kim 
3911a39cfb0SJung-uk Kim 
3921a39cfb0SJung-uk Kim /*******************************************************************************
3931a39cfb0SJung-uk Kim  *
3941a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpDataTable
3951a39cfb0SJung-uk Kim  *
3961a39cfb0SJung-uk Kim  * PARAMETERS:  Table               - An ACPI table
3971a39cfb0SJung-uk Kim  *
3981a39cfb0SJung-uk Kim  * RETURN:      None.
3991a39cfb0SJung-uk Kim  *
4001a39cfb0SJung-uk Kim  * DESCRIPTION: Format the contents of an ACPI data table (any table other
4011a39cfb0SJung-uk Kim  *              than an SSDT or DSDT that does not contain executable AML code)
4021a39cfb0SJung-uk Kim  *
4031a39cfb0SJung-uk Kim  ******************************************************************************/
4041a39cfb0SJung-uk Kim 
4051a39cfb0SJung-uk Kim void
4061a39cfb0SJung-uk Kim AcpiDmDumpDataTable (
4071a39cfb0SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
4081a39cfb0SJung-uk Kim {
409a9f12690SJung-uk Kim     ACPI_STATUS             Status;
4101a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
4111a39cfb0SJung-uk Kim     UINT32                  Length;
4121a39cfb0SJung-uk Kim 
4131a39cfb0SJung-uk Kim 
4141a39cfb0SJung-uk Kim     /* Ignore tables that contain AML */
4151a39cfb0SJung-uk Kim 
4161a39cfb0SJung-uk Kim     if (AcpiUtIsAmlTable (Table))
4171a39cfb0SJung-uk Kim     {
4181a39cfb0SJung-uk Kim         return;
4191a39cfb0SJung-uk Kim     }
4201a39cfb0SJung-uk Kim 
4211a39cfb0SJung-uk Kim     /*
4221a39cfb0SJung-uk Kim      * Handle tables that don't use the common ACPI table header structure.
4233f0275a0SJung-uk Kim      * Currently, these are the FACS, RSDP, and S3PT.
4241a39cfb0SJung-uk Kim      */
4251a39cfb0SJung-uk Kim     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
4261a39cfb0SJung-uk Kim     {
4271a39cfb0SJung-uk Kim         Length = Table->Length;
4281a39cfb0SJung-uk Kim         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
4291a39cfb0SJung-uk Kim     }
4301a39cfb0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
4311a39cfb0SJung-uk Kim     {
4321a39cfb0SJung-uk Kim         Length = AcpiDmDumpRsdp (Table);
4331a39cfb0SJung-uk Kim     }
4343f0275a0SJung-uk Kim     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
4353f0275a0SJung-uk Kim     {
4363f0275a0SJung-uk Kim         Length = AcpiDmDumpS3pt (Table);
4373f0275a0SJung-uk Kim     }
4381a39cfb0SJung-uk Kim     else
4391a39cfb0SJung-uk Kim     {
4401a39cfb0SJung-uk Kim         /*
4411a39cfb0SJung-uk Kim          * All other tables must use the common ACPI table header, dump it now
4421a39cfb0SJung-uk Kim          */
4431a39cfb0SJung-uk Kim         Length = Table->Length;
444a9f12690SJung-uk Kim         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
445a9f12690SJung-uk Kim         if (ACPI_FAILURE (Status))
446a9f12690SJung-uk Kim         {
447a9f12690SJung-uk Kim             return;
448a9f12690SJung-uk Kim         }
4491a39cfb0SJung-uk Kim         AcpiOsPrintf ("\n");
4501a39cfb0SJung-uk Kim 
4511a39cfb0SJung-uk Kim         /* Match signature and dispatch appropriately */
4521a39cfb0SJung-uk Kim 
4531a39cfb0SJung-uk Kim         TableData = AcpiDmGetTableData (Table->Signature);
4541a39cfb0SJung-uk Kim         if (!TableData)
4551a39cfb0SJung-uk Kim         {
4561a39cfb0SJung-uk Kim             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
4571a39cfb0SJung-uk Kim             {
4581a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
4591a39cfb0SJung-uk Kim                     Table->Signature);
4601a39cfb0SJung-uk Kim             }
4611a39cfb0SJung-uk Kim             else
4621a39cfb0SJung-uk Kim             {
4631a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
4641a39cfb0SJung-uk Kim                     Table->Signature);
4651a39cfb0SJung-uk Kim             }
4661a39cfb0SJung-uk Kim         }
4671a39cfb0SJung-uk Kim         else if (TableData->TableHandler)
4681a39cfb0SJung-uk Kim         {
4691a39cfb0SJung-uk Kim             /* Complex table, has a handler */
4701a39cfb0SJung-uk Kim 
4711a39cfb0SJung-uk Kim             TableData->TableHandler (Table);
4721a39cfb0SJung-uk Kim         }
4731a39cfb0SJung-uk Kim         else if (TableData->TableInfo)
4741a39cfb0SJung-uk Kim         {
4751a39cfb0SJung-uk Kim             /* Simple table, just walk the info table */
4761a39cfb0SJung-uk Kim 
4771a39cfb0SJung-uk Kim             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
4781a39cfb0SJung-uk Kim         }
4791a39cfb0SJung-uk Kim     }
4801a39cfb0SJung-uk Kim 
481a88e22b7SJung-uk Kim     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
482a88e22b7SJung-uk Kim     {
483a88e22b7SJung-uk Kim         /* Dump the raw table data */
4841a39cfb0SJung-uk Kim 
485d244b227SJung-uk Kim         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
486d244b227SJung-uk Kim             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
4871a39cfb0SJung-uk Kim         AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
4881a39cfb0SJung-uk Kim     }
489a88e22b7SJung-uk Kim }
4901a39cfb0SJung-uk Kim 
4911a39cfb0SJung-uk Kim 
4921a39cfb0SJung-uk Kim /*******************************************************************************
4931a39cfb0SJung-uk Kim  *
4941a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmLineHeader
4951a39cfb0SJung-uk Kim  *
4961a39cfb0SJung-uk Kim  * PARAMETERS:  Offset              - Current byte offset, from table start
4971a39cfb0SJung-uk Kim  *              ByteLength          - Length of the field in bytes, 0 for flags
4981a39cfb0SJung-uk Kim  *              Name                - Name of this field
4991a39cfb0SJung-uk Kim  *              Value               - Optional value, displayed on left of ':'
5001a39cfb0SJung-uk Kim  *
5011a39cfb0SJung-uk Kim  * RETURN:      None
5021a39cfb0SJung-uk Kim  *
5031a39cfb0SJung-uk Kim  * DESCRIPTION: Utility routines for formatting output lines. Displays the
5041a39cfb0SJung-uk Kim  *              current table offset in hex and decimal, the field length,
5051a39cfb0SJung-uk Kim  *              and the field name.
5061a39cfb0SJung-uk Kim  *
5071a39cfb0SJung-uk Kim  ******************************************************************************/
5081a39cfb0SJung-uk Kim 
5091a39cfb0SJung-uk Kim void
5101a39cfb0SJung-uk Kim AcpiDmLineHeader (
5111a39cfb0SJung-uk Kim     UINT32                  Offset,
5121a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5131a39cfb0SJung-uk Kim     char                    *Name)
5141a39cfb0SJung-uk Kim {
5151a39cfb0SJung-uk Kim 
516dcbce41eSJung-uk Kim     /* Allow a null name for fields that span multiple lines (large buffers) */
517dcbce41eSJung-uk Kim 
518dcbce41eSJung-uk Kim     if (!Name)
519dcbce41eSJung-uk Kim     {
520dcbce41eSJung-uk Kim         Name = "";
521dcbce41eSJung-uk Kim     }
522dcbce41eSJung-uk Kim 
523a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
524a88e22b7SJung-uk Kim     {
525a88e22b7SJung-uk Kim         if (ByteLength)
526a88e22b7SJung-uk Kim         {
527dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
528a88e22b7SJung-uk Kim         }
529a88e22b7SJung-uk Kim         else
530a88e22b7SJung-uk Kim         {
531d052a1ccSJung-uk Kim             if (*Name)
532d052a1ccSJung-uk Kim             {
533dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%41s : ", Name);
534a88e22b7SJung-uk Kim             }
535d052a1ccSJung-uk Kim             else
536d052a1ccSJung-uk Kim             {
537d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%41s   ", Name);
538d052a1ccSJung-uk Kim             }
539d052a1ccSJung-uk Kim         }
540a88e22b7SJung-uk Kim     }
541a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
542a88e22b7SJung-uk Kim     {
5431a39cfb0SJung-uk Kim         if (ByteLength)
5441a39cfb0SJung-uk Kim         {
545dcbce41eSJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
5461a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name);
5471a39cfb0SJung-uk Kim         }
5481a39cfb0SJung-uk Kim         else
5491a39cfb0SJung-uk Kim         {
550d052a1ccSJung-uk Kim             if (*Name)
551d052a1ccSJung-uk Kim             {
552dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%44s : ", Name);
5531a39cfb0SJung-uk Kim             }
554d052a1ccSJung-uk Kim             else
555d052a1ccSJung-uk Kim             {
556d052a1ccSJung-uk Kim                 AcpiOsPrintf ("%44s   ", Name);
557d052a1ccSJung-uk Kim             }
558d052a1ccSJung-uk Kim         }
5591a39cfb0SJung-uk Kim     }
560a88e22b7SJung-uk Kim }
5611a39cfb0SJung-uk Kim 
5621a39cfb0SJung-uk Kim void
5631a39cfb0SJung-uk Kim AcpiDmLineHeader2 (
5641a39cfb0SJung-uk Kim     UINT32                  Offset,
5651a39cfb0SJung-uk Kim     UINT32                  ByteLength,
5661a39cfb0SJung-uk Kim     char                    *Name,
5671a39cfb0SJung-uk Kim     UINT32                  Value)
5681a39cfb0SJung-uk Kim {
5691a39cfb0SJung-uk Kim 
570a88e22b7SJung-uk Kim     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
571a88e22b7SJung-uk Kim     {
572a88e22b7SJung-uk Kim         if (ByteLength)
573a88e22b7SJung-uk Kim         {
574d052a1ccSJung-uk Kim             AcpiOsPrintf ("[%.4d] %30s %3d : ",
575a88e22b7SJung-uk Kim                 ByteLength, Name, Value);
576a88e22b7SJung-uk Kim         }
577a88e22b7SJung-uk Kim         else
578a88e22b7SJung-uk Kim         {
579a88e22b7SJung-uk Kim             AcpiOsPrintf ("%36s % 3d : ",
580a88e22b7SJung-uk Kim                 Name, Value);
581a88e22b7SJung-uk Kim         }
582a88e22b7SJung-uk Kim     }
583a88e22b7SJung-uk Kim     else /* Normal disassembler or verbose template */
584a88e22b7SJung-uk Kim     {
5851a39cfb0SJung-uk Kim         if (ByteLength)
5861a39cfb0SJung-uk Kim         {
587a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
5881a39cfb0SJung-uk Kim                 Offset, Offset, ByteLength, Name, Value);
5891a39cfb0SJung-uk Kim         }
5901a39cfb0SJung-uk Kim         else
5911a39cfb0SJung-uk Kim         {
592a9f12690SJung-uk Kim             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
5931a39cfb0SJung-uk Kim                 Offset, Offset, Name, Value);
5941a39cfb0SJung-uk Kim         }
5951a39cfb0SJung-uk Kim     }
596a88e22b7SJung-uk Kim }
5971a39cfb0SJung-uk Kim 
5981a39cfb0SJung-uk Kim 
5991a39cfb0SJung-uk Kim /*******************************************************************************
6001a39cfb0SJung-uk Kim  *
6011a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmDumpTable
6021a39cfb0SJung-uk Kim  *
6031a39cfb0SJung-uk Kim  * PARAMETERS:  TableLength         - Length of the entire ACPI table
6041a39cfb0SJung-uk Kim  *              TableOffset         - Starting offset within the table for this
6051a39cfb0SJung-uk Kim  *                                    sub-descriptor (0 if main table)
6061a39cfb0SJung-uk Kim  *              Table               - The ACPI table
607a9f12690SJung-uk Kim  *              SubtableLength      - Length of this sub-descriptor
6081a39cfb0SJung-uk Kim  *              Info                - Info table for this ACPI table
6091a39cfb0SJung-uk Kim  *
6101a39cfb0SJung-uk Kim  * RETURN:      None
6111a39cfb0SJung-uk Kim  *
6121a39cfb0SJung-uk Kim  * DESCRIPTION: Display ACPI table contents by walking the Info table.
6131a39cfb0SJung-uk Kim  *
614a88e22b7SJung-uk Kim  * Note: This function must remain in sync with DtGetFieldLength.
615a88e22b7SJung-uk Kim  *
6161a39cfb0SJung-uk Kim  ******************************************************************************/
6171a39cfb0SJung-uk Kim 
618a9f12690SJung-uk Kim ACPI_STATUS
6191a39cfb0SJung-uk Kim AcpiDmDumpTable (
6201a39cfb0SJung-uk Kim     UINT32                  TableLength,
6211a39cfb0SJung-uk Kim     UINT32                  TableOffset,
6221a39cfb0SJung-uk Kim     void                    *Table,
6231a39cfb0SJung-uk Kim     UINT32                  SubtableLength,
6241a39cfb0SJung-uk Kim     ACPI_DMTABLE_INFO       *Info)
6251a39cfb0SJung-uk Kim {
6261a39cfb0SJung-uk Kim     UINT8                   *Target;
6271a39cfb0SJung-uk Kim     UINT32                  CurrentOffset;
6281a39cfb0SJung-uk Kim     UINT32                  ByteLength;
6291a39cfb0SJung-uk Kim     UINT8                   Temp8;
6301a39cfb0SJung-uk Kim     UINT16                  Temp16;
6311a39cfb0SJung-uk Kim     ACPI_DMTABLE_DATA       *TableData;
632d6dd1baeSJung-uk Kim     const char              *Name;
633a9f12690SJung-uk Kim     BOOLEAN                 LastOutputBlankLine = FALSE;
634d6dd1baeSJung-uk Kim     char                    RepairedName[8];
6351a39cfb0SJung-uk Kim 
6361a39cfb0SJung-uk Kim 
6371a39cfb0SJung-uk Kim     if (!Info)
6381a39cfb0SJung-uk Kim     {
6391a39cfb0SJung-uk Kim         AcpiOsPrintf ("Display not implemented\n");
640a9f12690SJung-uk Kim         return (AE_NOT_IMPLEMENTED);
6411a39cfb0SJung-uk Kim     }
6421a39cfb0SJung-uk Kim 
6431a39cfb0SJung-uk Kim     /* Walk entire Info table; Null name terminates */
6441a39cfb0SJung-uk Kim 
6451a39cfb0SJung-uk Kim     for (; Info->Name; Info++)
6461a39cfb0SJung-uk Kim     {
6471a39cfb0SJung-uk Kim         /*
6481a39cfb0SJung-uk Kim          * Target points to the field within the ACPI Table. CurrentOffset is
6491a39cfb0SJung-uk Kim          * the offset of the field from the start of the main table.
6501a39cfb0SJung-uk Kim          */
6511a39cfb0SJung-uk Kim         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
6521a39cfb0SJung-uk Kim         CurrentOffset = TableOffset + Info->Offset;
6531a39cfb0SJung-uk Kim 
6541a39cfb0SJung-uk Kim         /* Check for beyond EOT or beyond subtable end */
6551a39cfb0SJung-uk Kim 
6561a39cfb0SJung-uk Kim         if ((CurrentOffset >= TableLength) ||
6571a39cfb0SJung-uk Kim             (SubtableLength && (Info->Offset >= SubtableLength)))
6581a39cfb0SJung-uk Kim         {
659a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
660a9f12690SJung-uk Kim             return (AE_BAD_DATA);
6611a39cfb0SJung-uk Kim         }
6621a39cfb0SJung-uk Kim 
6631a39cfb0SJung-uk Kim         /* Generate the byte length for this field */
6641a39cfb0SJung-uk Kim 
6651a39cfb0SJung-uk Kim         switch (Info->Opcode)
6661a39cfb0SJung-uk Kim         {
6671a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
6681a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
6691a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
6705a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
671d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
6721a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
6733f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
6741a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
675a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
676a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
677a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
678a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
679a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
680a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
681a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
6821a39cfb0SJung-uk Kim             ByteLength = 1;
6831a39cfb0SJung-uk Kim             break;
6841a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
6851a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
686a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
6871a39cfb0SJung-uk Kim             ByteLength = 2;
6881a39cfb0SJung-uk Kim             break;
6891a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
6901a39cfb0SJung-uk Kim             ByteLength = 3;
6911a39cfb0SJung-uk Kim             break;
6921a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
6931a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
6941a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
695dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
6961a39cfb0SJung-uk Kim             ByteLength = 4;
6971a39cfb0SJung-uk Kim             break;
6983f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
6993f0275a0SJung-uk Kim             ByteLength = 5;
7003f0275a0SJung-uk Kim             break;
7013f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
7021a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
7031a39cfb0SJung-uk Kim             ByteLength = 6;
7041a39cfb0SJung-uk Kim             break;
7051a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
7060b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
7071a39cfb0SJung-uk Kim             ByteLength = 7;
7081a39cfb0SJung-uk Kim             break;
7091a39cfb0SJung-uk Kim         case ACPI_DMT_UINT64:
7101a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
7111a39cfb0SJung-uk Kim             ByteLength = 8;
7121a39cfb0SJung-uk Kim             break;
713d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
714d244b227SJung-uk Kim         case ACPI_DMT_UUID:
715d6dd1baeSJung-uk Kim             ByteLength = 16;
716d6dd1baeSJung-uk Kim             break;
717dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
718dcbce41eSJung-uk Kim             ByteLength = 128;
719dcbce41eSJung-uk Kim             break;
7201a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
7211a39cfb0SJung-uk Kim             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
7221a39cfb0SJung-uk Kim             break;
7231a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
724a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
725a9f12690SJung-uk Kim             {
7261a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
727a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
728a9f12690SJung-uk Kim             }
7291a39cfb0SJung-uk Kim             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
7301a39cfb0SJung-uk Kim             break;
731a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
732a9f12690SJung-uk Kim             if (!LastOutputBlankLine)
733a9f12690SJung-uk Kim             {
734a9f12690SJung-uk Kim                 AcpiOsPrintf ("\n");
735a9f12690SJung-uk Kim                 LastOutputBlankLine = TRUE;
736a9f12690SJung-uk Kim             }
737a9f12690SJung-uk Kim             ByteLength = sizeof (ACPI_HEST_NOTIFY);
738a9f12690SJung-uk Kim             break;
7391a39cfb0SJung-uk Kim         default:
7401a39cfb0SJung-uk Kim             ByteLength = 0;
7411a39cfb0SJung-uk Kim             break;
7421a39cfb0SJung-uk Kim         }
7431a39cfb0SJung-uk Kim 
744a9f12690SJung-uk Kim         if (CurrentOffset + ByteLength > TableLength)
745a9f12690SJung-uk Kim         {
746a9f12690SJung-uk Kim             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
747a9f12690SJung-uk Kim             return (AE_BAD_DATA);
748a9f12690SJung-uk Kim         }
749a9f12690SJung-uk Kim 
7503f0275a0SJung-uk Kim         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
7513f0275a0SJung-uk Kim         {
7523f0275a0SJung-uk Kim             AcpiOsPrintf ("%s", Info->Name);
7533f0275a0SJung-uk Kim             continue;
7543f0275a0SJung-uk Kim         }
7553f0275a0SJung-uk Kim 
7561a39cfb0SJung-uk Kim         /* Start a new line and decode the opcode */
7571a39cfb0SJung-uk Kim 
7581a39cfb0SJung-uk Kim         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
7591a39cfb0SJung-uk Kim 
7601a39cfb0SJung-uk Kim         switch (Info->Opcode)
7611a39cfb0SJung-uk Kim         {
7621a39cfb0SJung-uk Kim         /* Single-bit Flag fields. Note: Opcode is the bit position */
7631a39cfb0SJung-uk Kim 
7641a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG0:
7651a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG1:
7661a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG2:
7671a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG3:
7681a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG4:
7691a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG5:
7701a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG6:
7711a39cfb0SJung-uk Kim         case ACPI_DMT_FLAG7:
7721a39cfb0SJung-uk Kim 
7731a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
7741a39cfb0SJung-uk Kim             break;
7751a39cfb0SJung-uk Kim 
7761a39cfb0SJung-uk Kim         /* 2-bit Flag fields */
7771a39cfb0SJung-uk Kim 
7781a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS0:
7791a39cfb0SJung-uk Kim 
7801a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
7811a39cfb0SJung-uk Kim             break;
7821a39cfb0SJung-uk Kim 
7833f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS1:
7843f0275a0SJung-uk Kim 
7853f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
7863f0275a0SJung-uk Kim             break;
7873f0275a0SJung-uk Kim 
7881a39cfb0SJung-uk Kim         case ACPI_DMT_FLAGS2:
7891a39cfb0SJung-uk Kim 
7901a39cfb0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
7911a39cfb0SJung-uk Kim             break;
7921a39cfb0SJung-uk Kim 
7933f0275a0SJung-uk Kim         case ACPI_DMT_FLAGS4:
7943f0275a0SJung-uk Kim 
7953f0275a0SJung-uk Kim             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
7963f0275a0SJung-uk Kim             break;
7973f0275a0SJung-uk Kim 
7983f0275a0SJung-uk Kim         /* Integer Data Types */
7991a39cfb0SJung-uk Kim 
8001a39cfb0SJung-uk Kim         case ACPI_DMT_UINT8:
8011a39cfb0SJung-uk Kim         case ACPI_DMT_UINT16:
8021a39cfb0SJung-uk Kim         case ACPI_DMT_UINT24:
8031a39cfb0SJung-uk Kim         case ACPI_DMT_UINT32:
8043f0275a0SJung-uk Kim         case ACPI_DMT_UINT40:
8053f0275a0SJung-uk Kim         case ACPI_DMT_UINT48:
8061a39cfb0SJung-uk Kim         case ACPI_DMT_UINT56:
8073f0275a0SJung-uk Kim         case ACPI_DMT_UINT64:
8083f0275a0SJung-uk Kim             /*
8093f0275a0SJung-uk Kim              * Dump bytes - high byte first, low byte last.
8103f0275a0SJung-uk Kim              * Note: All ACPI tables are little-endian.
8113f0275a0SJung-uk Kim              */
8123f0275a0SJung-uk Kim             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
813a9f12690SJung-uk Kim             {
8143f0275a0SJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
815a9f12690SJung-uk Kim             }
816a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
8171a39cfb0SJung-uk Kim             break;
8181a39cfb0SJung-uk Kim 
8190b94ba42SJung-uk Kim         case ACPI_DMT_BUF7:
820d6dd1baeSJung-uk Kim         case ACPI_DMT_BUF16:
821dcbce41eSJung-uk Kim         case ACPI_DMT_BUF128:
822d6dd1baeSJung-uk Kim 
8230b94ba42SJung-uk Kim             /*
8240b94ba42SJung-uk Kim              * Buffer: Size depends on the opcode and was set above.
8250b94ba42SJung-uk Kim              * Each hex byte is separated with a space.
826d052a1ccSJung-uk Kim              * Multiple lines are separated by line continuation char.
8270b94ba42SJung-uk Kim              */
828dcbce41eSJung-uk Kim             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
829d6dd1baeSJung-uk Kim             {
830dcbce41eSJung-uk Kim                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
831dcbce41eSJung-uk Kim                 if ((UINT32) (Temp16 + 1) < ByteLength)
832dcbce41eSJung-uk Kim                 {
833dcbce41eSJung-uk Kim                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
834dcbce41eSJung-uk Kim                     {
835d052a1ccSJung-uk Kim                         AcpiOsPrintf (" \\\n"); /* Line continuation */
836dcbce41eSJung-uk Kim                         AcpiDmLineHeader (0, 0, NULL);
837dcbce41eSJung-uk Kim                     }
838dcbce41eSJung-uk Kim                     else
839a88e22b7SJung-uk Kim                     {
8400b94ba42SJung-uk Kim                         AcpiOsPrintf (" ");
841a88e22b7SJung-uk Kim                     }
842d6dd1baeSJung-uk Kim                 }
843dcbce41eSJung-uk Kim             }
844d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\n");
845d6dd1baeSJung-uk Kim             break;
846d6dd1baeSJung-uk Kim 
847d244b227SJung-uk Kim         case ACPI_DMT_UUID:
848d244b227SJung-uk Kim 
849d244b227SJung-uk Kim             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
850d244b227SJung-uk Kim 
851d244b227SJung-uk Kim             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
852d244b227SJung-uk Kim 
853d244b227SJung-uk Kim             AcpiOsPrintf ("%s\n", MsgBuffer);
854d244b227SJung-uk Kim             break;
855d244b227SJung-uk Kim 
8561a39cfb0SJung-uk Kim         case ACPI_DMT_STRING:
8571a39cfb0SJung-uk Kim 
858d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
8591a39cfb0SJung-uk Kim             break;
8601a39cfb0SJung-uk Kim 
8611a39cfb0SJung-uk Kim         /* Fixed length ASCII name fields */
8621a39cfb0SJung-uk Kim 
8631a39cfb0SJung-uk Kim         case ACPI_DMT_SIG:
8641a39cfb0SJung-uk Kim 
865d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
866d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
8671a39cfb0SJung-uk Kim             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
8681a39cfb0SJung-uk Kim             if (TableData)
8691a39cfb0SJung-uk Kim             {
870d052a1ccSJung-uk Kim                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
8711a39cfb0SJung-uk Kim             }
872d052a1ccSJung-uk Kim             else
873d052a1ccSJung-uk Kim             {
8741a39cfb0SJung-uk Kim                 AcpiOsPrintf ("\n");
875d052a1ccSJung-uk Kim             }
8761a39cfb0SJung-uk Kim             break;
8771a39cfb0SJung-uk Kim 
8781a39cfb0SJung-uk Kim         case ACPI_DMT_NAME4:
8791a39cfb0SJung-uk Kim 
880d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 4);
881d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
8821a39cfb0SJung-uk Kim             break;
8831a39cfb0SJung-uk Kim 
8841a39cfb0SJung-uk Kim         case ACPI_DMT_NAME6:
8851a39cfb0SJung-uk Kim 
886d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 6);
887d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
8881a39cfb0SJung-uk Kim             break;
8891a39cfb0SJung-uk Kim 
8901a39cfb0SJung-uk Kim         case ACPI_DMT_NAME8:
8911a39cfb0SJung-uk Kim 
892d6dd1baeSJung-uk Kim             AcpiDmCheckAscii (Target, RepairedName, 8);
893d6dd1baeSJung-uk Kim             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
8941a39cfb0SJung-uk Kim             break;
8951a39cfb0SJung-uk Kim 
8961a39cfb0SJung-uk Kim         /* Special Data Types */
8971a39cfb0SJung-uk Kim 
8981a39cfb0SJung-uk Kim         case ACPI_DMT_CHKSUM:
8991a39cfb0SJung-uk Kim 
9001a39cfb0SJung-uk Kim             /* Checksum, display and validate */
9011a39cfb0SJung-uk Kim 
9021a39cfb0SJung-uk Kim             AcpiOsPrintf ("%2.2X", *Target);
903a88e22b7SJung-uk Kim             Temp8 = AcpiDmGenerateChecksum (Table,
904a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
905a88e22b7SJung-uk Kim                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
9061a39cfb0SJung-uk Kim             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
9071a39cfb0SJung-uk Kim             {
9081a39cfb0SJung-uk Kim                 AcpiOsPrintf (
9091a39cfb0SJung-uk Kim                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
9101a39cfb0SJung-uk Kim             }
9111a39cfb0SJung-uk Kim             AcpiOsPrintf ("\n");
9121a39cfb0SJung-uk Kim             break;
9131a39cfb0SJung-uk Kim 
9141a39cfb0SJung-uk Kim         case ACPI_DMT_SPACEID:
9151a39cfb0SJung-uk Kim 
9161a39cfb0SJung-uk Kim             /* Address Space ID */
9171a39cfb0SJung-uk Kim 
918d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
9191a39cfb0SJung-uk Kim             break;
9201a39cfb0SJung-uk Kim 
9215a77b11bSJung-uk Kim         case ACPI_DMT_ACCWIDTH:
9225a77b11bSJung-uk Kim 
9235a77b11bSJung-uk Kim             /* Encoded Access Width */
9245a77b11bSJung-uk Kim 
9255a77b11bSJung-uk Kim             Temp8 = *Target;
9265a77b11bSJung-uk Kim             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
9275a77b11bSJung-uk Kim             {
9285a77b11bSJung-uk Kim                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
9295a77b11bSJung-uk Kim             }
9305a77b11bSJung-uk Kim 
931d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
9325a77b11bSJung-uk Kim             break;
9335a77b11bSJung-uk Kim 
9341a39cfb0SJung-uk Kim         case ACPI_DMT_GAS:
9351a39cfb0SJung-uk Kim 
9361a39cfb0SJung-uk Kim             /* Generic Address Structure */
9371a39cfb0SJung-uk Kim 
938d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
939d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
940d6dd1baeSJung-uk Kim                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
941a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
942a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
943a9f12690SJung-uk Kim             break;
944a9f12690SJung-uk Kim 
945a9f12690SJung-uk Kim         case ACPI_DMT_ASF:
946a9f12690SJung-uk Kim 
947a9f12690SJung-uk Kim             /* ASF subtable types */
948a9f12690SJung-uk Kim 
949a9f12690SJung-uk Kim             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
950a9f12690SJung-uk Kim             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
951a9f12690SJung-uk Kim             {
952a9f12690SJung-uk Kim                 Temp16 = ACPI_ASF_TYPE_RESERVED;
953a9f12690SJung-uk Kim             }
954a9f12690SJung-uk Kim 
955d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
9561a39cfb0SJung-uk Kim             break;
9571a39cfb0SJung-uk Kim 
9581a39cfb0SJung-uk Kim         case ACPI_DMT_DMAR:
9591a39cfb0SJung-uk Kim 
9601a39cfb0SJung-uk Kim             /* DMAR subtable types */
9611a39cfb0SJung-uk Kim 
962a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
9631a39cfb0SJung-uk Kim             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
9641a39cfb0SJung-uk Kim             {
9651a39cfb0SJung-uk Kim                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
9661a39cfb0SJung-uk Kim             }
9671a39cfb0SJung-uk Kim 
968d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
9691a39cfb0SJung-uk Kim             break;
9701a39cfb0SJung-uk Kim 
971a88e22b7SJung-uk Kim         case ACPI_DMT_EINJACT:
972a88e22b7SJung-uk Kim 
973a88e22b7SJung-uk Kim             /* EINJ Action types */
974a88e22b7SJung-uk Kim 
975a88e22b7SJung-uk Kim             Temp8 = *Target;
976a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
977a88e22b7SJung-uk Kim             {
978a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
979a88e22b7SJung-uk Kim             }
980a88e22b7SJung-uk Kim 
981d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
982a88e22b7SJung-uk Kim             break;
983a88e22b7SJung-uk Kim 
984a88e22b7SJung-uk Kim         case ACPI_DMT_EINJINST:
985a88e22b7SJung-uk Kim 
986a88e22b7SJung-uk Kim             /* EINJ Instruction types */
987a88e22b7SJung-uk Kim 
988a88e22b7SJung-uk Kim             Temp8 = *Target;
989a88e22b7SJung-uk Kim             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
990a88e22b7SJung-uk Kim             {
991a88e22b7SJung-uk Kim                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
992a88e22b7SJung-uk Kim             }
993a88e22b7SJung-uk Kim 
994d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
995a88e22b7SJung-uk Kim             break;
996a88e22b7SJung-uk Kim 
997a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTACT:
998a88e22b7SJung-uk Kim 
999a88e22b7SJung-uk Kim             /* ERST Action types */
1000a88e22b7SJung-uk Kim 
1001a88e22b7SJung-uk Kim             Temp8 = *Target;
1002a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1003a88e22b7SJung-uk Kim             {
1004a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1005a88e22b7SJung-uk Kim             }
1006a88e22b7SJung-uk Kim 
1007d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1008a88e22b7SJung-uk Kim             break;
1009a88e22b7SJung-uk Kim 
1010a88e22b7SJung-uk Kim         case ACPI_DMT_ERSTINST:
1011a88e22b7SJung-uk Kim 
1012a88e22b7SJung-uk Kim             /* ERST Instruction types */
1013a88e22b7SJung-uk Kim 
1014a88e22b7SJung-uk Kim             Temp8 = *Target;
1015a88e22b7SJung-uk Kim             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1016a88e22b7SJung-uk Kim             {
1017a88e22b7SJung-uk Kim                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1018a88e22b7SJung-uk Kim             }
1019a88e22b7SJung-uk Kim 
1020d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1021a88e22b7SJung-uk Kim             break;
1022a88e22b7SJung-uk Kim 
1023a9f12690SJung-uk Kim         case ACPI_DMT_HEST:
1024a9f12690SJung-uk Kim 
1025a9f12690SJung-uk Kim             /* HEST subtable types */
1026a9f12690SJung-uk Kim 
1027a9f12690SJung-uk Kim             Temp16 = ACPI_GET16 (Target);
1028a9f12690SJung-uk Kim             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1029a9f12690SJung-uk Kim             {
1030a9f12690SJung-uk Kim                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1031a9f12690SJung-uk Kim             }
1032a9f12690SJung-uk Kim 
1033d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1034a9f12690SJung-uk Kim             break;
1035a9f12690SJung-uk Kim 
1036a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTFY:
1037a9f12690SJung-uk Kim 
1038d052a1ccSJung-uk Kim             AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1039d6dd1baeSJung-uk Kim             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1040d6dd1baeSJung-uk Kim                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1041a9f12690SJung-uk Kim             AcpiOsPrintf ("\n");
1042a9f12690SJung-uk Kim             LastOutputBlankLine = TRUE;
1043a9f12690SJung-uk Kim             break;
1044a9f12690SJung-uk Kim 
1045a9f12690SJung-uk Kim         case ACPI_DMT_HESTNTYP:
1046a9f12690SJung-uk Kim 
1047a9f12690SJung-uk Kim             /* HEST Notify types */
1048a9f12690SJung-uk Kim 
1049a9f12690SJung-uk Kim             Temp8 = *Target;
1050a9f12690SJung-uk Kim             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1051a9f12690SJung-uk Kim             {
1052a9f12690SJung-uk Kim                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1053a9f12690SJung-uk Kim             }
1054a9f12690SJung-uk Kim 
1055d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1056a9f12690SJung-uk Kim             break;
1057a9f12690SJung-uk Kim 
10581a39cfb0SJung-uk Kim         case ACPI_DMT_MADT:
10591a39cfb0SJung-uk Kim 
10601a39cfb0SJung-uk Kim             /* MADT subtable types */
10611a39cfb0SJung-uk Kim 
10621a39cfb0SJung-uk Kim             Temp8 = *Target;
10631a39cfb0SJung-uk Kim             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
10641a39cfb0SJung-uk Kim             {
10651a39cfb0SJung-uk Kim                 Temp8 = ACPI_MADT_TYPE_RESERVED;
10661a39cfb0SJung-uk Kim             }
10671a39cfb0SJung-uk Kim 
1068d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
10691a39cfb0SJung-uk Kim             break;
10701a39cfb0SJung-uk Kim 
10713f0275a0SJung-uk Kim         case ACPI_DMT_PMTT:
10723f0275a0SJung-uk Kim 
10733f0275a0SJung-uk Kim             /* PMTT subtable types */
10743f0275a0SJung-uk Kim 
10753f0275a0SJung-uk Kim             Temp8 = *Target;
10763f0275a0SJung-uk Kim             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
10773f0275a0SJung-uk Kim             {
10783f0275a0SJung-uk Kim                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
10793f0275a0SJung-uk Kim             }
10803f0275a0SJung-uk Kim 
10813f0275a0SJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
10823f0275a0SJung-uk Kim             break;
10833f0275a0SJung-uk Kim 
1084dcbce41eSJung-uk Kim         case ACPI_DMT_SLIC:
1085dcbce41eSJung-uk Kim 
1086dcbce41eSJung-uk Kim             /* SLIC subtable types */
1087dcbce41eSJung-uk Kim 
1088dcbce41eSJung-uk Kim             Temp8 = *Target;
1089dcbce41eSJung-uk Kim             if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1090dcbce41eSJung-uk Kim             {
1091dcbce41eSJung-uk Kim                 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1092dcbce41eSJung-uk Kim             }
1093dcbce41eSJung-uk Kim 
1094d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1095dcbce41eSJung-uk Kim             break;
1096dcbce41eSJung-uk Kim 
10971a39cfb0SJung-uk Kim         case ACPI_DMT_SRAT:
10981a39cfb0SJung-uk Kim 
10991a39cfb0SJung-uk Kim             /* SRAT subtable types */
11001a39cfb0SJung-uk Kim 
11011a39cfb0SJung-uk Kim             Temp8 = *Target;
11021a39cfb0SJung-uk Kim             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
11031a39cfb0SJung-uk Kim             {
11041a39cfb0SJung-uk Kim                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
11051a39cfb0SJung-uk Kim             }
11061a39cfb0SJung-uk Kim 
1107d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
11081a39cfb0SJung-uk Kim             break;
11091a39cfb0SJung-uk Kim 
1110a9f12690SJung-uk Kim         case ACPI_DMT_FADTPM:
1111a9f12690SJung-uk Kim 
1112a9f12690SJung-uk Kim             /* FADT Preferred PM Profile names */
1113a9f12690SJung-uk Kim 
1114a9f12690SJung-uk Kim             Temp8 = *Target;
1115a9f12690SJung-uk Kim             if (Temp8 > ACPI_FADT_PM_RESERVED)
1116a9f12690SJung-uk Kim             {
1117a9f12690SJung-uk Kim                 Temp8 = ACPI_FADT_PM_RESERVED;
1118a9f12690SJung-uk Kim             }
1119a9f12690SJung-uk Kim 
1120d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1121a9f12690SJung-uk Kim             break;
1122a9f12690SJung-uk Kim 
1123d6dd1baeSJung-uk Kim         case ACPI_DMT_IVRS:
1124d6dd1baeSJung-uk Kim 
1125d6dd1baeSJung-uk Kim             /* IVRS subtable types */
1126d6dd1baeSJung-uk Kim 
1127d6dd1baeSJung-uk Kim             Temp8 = *Target;
1128d6dd1baeSJung-uk Kim             switch (Temp8)
1129d6dd1baeSJung-uk Kim             {
1130d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_HARDWARE:
1131d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[0];
1132d6dd1baeSJung-uk Kim                 break;
1133d6dd1baeSJung-uk Kim 
1134d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY1:
1135d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY2:
1136d6dd1baeSJung-uk Kim             case ACPI_IVRS_TYPE_MEMORY3:
1137d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[1];
1138d6dd1baeSJung-uk Kim                 break;
1139d6dd1baeSJung-uk Kim 
1140d6dd1baeSJung-uk Kim             default:
1141d6dd1baeSJung-uk Kim                 Name = AcpiDmIvrsSubnames[2];
1142d6dd1baeSJung-uk Kim                 break;
1143d6dd1baeSJung-uk Kim             }
1144d6dd1baeSJung-uk Kim 
1145d052a1ccSJung-uk Kim             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1146d6dd1baeSJung-uk Kim             break;
1147d6dd1baeSJung-uk Kim 
11481a39cfb0SJung-uk Kim         case ACPI_DMT_EXIT:
1149a9f12690SJung-uk Kim             return (AE_OK);
11501a39cfb0SJung-uk Kim 
11511a39cfb0SJung-uk Kim         default:
11521a39cfb0SJung-uk Kim             ACPI_ERROR ((AE_INFO,
1153ca3cf4faSJung-uk Kim                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1154a9f12690SJung-uk Kim             return (AE_SUPPORT);
11551a39cfb0SJung-uk Kim         }
11561a39cfb0SJung-uk Kim     }
1157a9f12690SJung-uk Kim 
1158a9f12690SJung-uk Kim     if (TableOffset && !SubtableLength)
1159a9f12690SJung-uk Kim     {
1160a9f12690SJung-uk Kim         /* If this table is not the main table, subtable must have valid length */
1161a9f12690SJung-uk Kim 
1162a9f12690SJung-uk Kim         AcpiOsPrintf ("Invalid zero length subtable\n");
1163a9f12690SJung-uk Kim         return (AE_BAD_DATA);
1164a9f12690SJung-uk Kim     }
1165a9f12690SJung-uk Kim 
1166a9f12690SJung-uk Kim     return (AE_OK);
11671a39cfb0SJung-uk Kim }
11681a39cfb0SJung-uk Kim 
11691a39cfb0SJung-uk Kim 
11701a39cfb0SJung-uk Kim /*******************************************************************************
11711a39cfb0SJung-uk Kim  *
11721a39cfb0SJung-uk Kim  * FUNCTION:    AcpiDmCheckAscii
11731a39cfb0SJung-uk Kim  *
11741a39cfb0SJung-uk Kim  * PARAMETERS:  Name                - Ascii string
11751a39cfb0SJung-uk Kim  *              Count               - Number of characters to check
11761a39cfb0SJung-uk Kim  *
11771a39cfb0SJung-uk Kim  * RETURN:      None
11781a39cfb0SJung-uk Kim  *
11791a39cfb0SJung-uk Kim  * DESCRIPTION: Ensure that the requested number of characters are printable
11801a39cfb0SJung-uk Kim  *              Ascii characters. Sets non-printable and null chars to <space>.
11811a39cfb0SJung-uk Kim  *
11821a39cfb0SJung-uk Kim  ******************************************************************************/
11831a39cfb0SJung-uk Kim 
11841a39cfb0SJung-uk Kim static void
11851a39cfb0SJung-uk Kim AcpiDmCheckAscii (
11861a39cfb0SJung-uk Kim     UINT8                   *Name,
1187d6dd1baeSJung-uk Kim     char                    *RepairedName,
11881a39cfb0SJung-uk Kim     UINT32                  Count)
11891a39cfb0SJung-uk Kim {
11901a39cfb0SJung-uk Kim     UINT32                  i;
11911a39cfb0SJung-uk Kim 
11921a39cfb0SJung-uk Kim 
11931a39cfb0SJung-uk Kim     for (i = 0; i < Count; i++)
11941a39cfb0SJung-uk Kim     {
1195f556842eSJung-uk Kim         RepairedName[i] = (char) Name[i];
1196d6dd1baeSJung-uk Kim 
1197d6dd1baeSJung-uk Kim         if (!Name[i])
11981a39cfb0SJung-uk Kim         {
1199d6dd1baeSJung-uk Kim             return;
1200d6dd1baeSJung-uk Kim         }
1201d6dd1baeSJung-uk Kim         if (!isprint (Name[i]))
1202d6dd1baeSJung-uk Kim         {
1203d6dd1baeSJung-uk Kim             RepairedName[i] = ' ';
12041a39cfb0SJung-uk Kim         }
12051a39cfb0SJung-uk Kim     }
12061a39cfb0SJung-uk Kim }
1207