xref: /illumos-gate/usr/src/cmd/acpi/common/dmtable.c (revision 35786f68)
1bc36eafdSMike Gerdts /******************************************************************************
2bc36eafdSMike Gerdts  *
3bc36eafdSMike Gerdts  * Module Name: dmtable - Support for ACPI tables that contain no AML code
4bc36eafdSMike Gerdts  *
5bc36eafdSMike Gerdts  *****************************************************************************/
6bc36eafdSMike Gerdts 
7*35786f68SRobert Mustacchi /******************************************************************************
8*35786f68SRobert Mustacchi  *
9*35786f68SRobert Mustacchi  * 1. Copyright Notice
10*35786f68SRobert Mustacchi  *
11*35786f68SRobert Mustacchi  * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12bc36eafdSMike Gerdts  * All rights reserved.
13bc36eafdSMike Gerdts  *
14*35786f68SRobert Mustacchi  * 2. License
15*35786f68SRobert Mustacchi  *
16*35786f68SRobert Mustacchi  * 2.1. This is your license from Intel Corp. under its intellectual property
17*35786f68SRobert Mustacchi  * rights. You may have additional license terms from the party that provided
18*35786f68SRobert Mustacchi  * you this software, covering your right to use that party's intellectual
19*35786f68SRobert Mustacchi  * property rights.
20*35786f68SRobert Mustacchi  *
21*35786f68SRobert Mustacchi  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*35786f68SRobert Mustacchi  * copy of the source code appearing in this file ("Covered Code") an
23*35786f68SRobert Mustacchi  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*35786f68SRobert Mustacchi  * base code distributed originally by Intel ("Original Intel Code") to copy,
25*35786f68SRobert Mustacchi  * make derivatives, distribute, use and display any portion of the Covered
26*35786f68SRobert Mustacchi  * Code in any form, with the right to sublicense such rights; and
27*35786f68SRobert Mustacchi  *
28*35786f68SRobert Mustacchi  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*35786f68SRobert Mustacchi  * license (with the right to sublicense), under only those claims of Intel
30*35786f68SRobert Mustacchi  * patents that are infringed by the Original Intel Code, to make, use, sell,
31*35786f68SRobert Mustacchi  * offer to sell, and import the Covered Code and derivative works thereof
32*35786f68SRobert Mustacchi  * solely to the minimum extent necessary to exercise the above copyright
33*35786f68SRobert Mustacchi  * license, and in no event shall the patent license extend to any additions
34*35786f68SRobert Mustacchi  * to or modifications of the Original Intel Code. No other license or right
35*35786f68SRobert Mustacchi  * is granted directly or by implication, estoppel or otherwise;
36*35786f68SRobert Mustacchi  *
37*35786f68SRobert Mustacchi  * The above copyright and patent license is granted only if the following
38*35786f68SRobert Mustacchi  * conditions are met:
39*35786f68SRobert Mustacchi  *
40*35786f68SRobert Mustacchi  * 3. Conditions
41*35786f68SRobert Mustacchi  *
42*35786f68SRobert Mustacchi  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
44*35786f68SRobert Mustacchi  * Code or modification with rights to further distribute source must include
45*35786f68SRobert Mustacchi  * the above Copyright Notice, the above License, this list of Conditions,
46*35786f68SRobert Mustacchi  * and the following Disclaimer and Export Compliance provision. In addition,
47*35786f68SRobert Mustacchi  * Licensee must cause all Covered Code to which Licensee contributes to
48*35786f68SRobert Mustacchi  * contain a file documenting the changes Licensee made to create that Covered
49*35786f68SRobert Mustacchi  * Code and the date of any change. Licensee must include in that file the
50*35786f68SRobert Mustacchi  * documentation of any changes made by any predecessor Licensee. Licensee
51*35786f68SRobert Mustacchi  * must include a prominent statement that the modification is derived,
52*35786f68SRobert Mustacchi  * directly or indirectly, from Original Intel Code.
53*35786f68SRobert Mustacchi  *
54*35786f68SRobert Mustacchi  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
56*35786f68SRobert Mustacchi  * Code or modification without rights to further distribute source must
57*35786f68SRobert Mustacchi  * include the following Disclaimer and Export Compliance provision in the
58*35786f68SRobert Mustacchi  * documentation and/or other materials provided with distribution. In
59*35786f68SRobert Mustacchi  * addition, Licensee may not authorize further sublicense of source of any
60*35786f68SRobert Mustacchi  * portion of the Covered Code, and must include terms to the effect that the
61*35786f68SRobert Mustacchi  * license from Licensee to its licensee is limited to the intellectual
62*35786f68SRobert Mustacchi  * property embodied in the software Licensee provides to its licensee, and
63*35786f68SRobert Mustacchi  * not to intellectual property embodied in modifications its licensee may
64*35786f68SRobert Mustacchi  * make.
65*35786f68SRobert Mustacchi  *
66*35786f68SRobert Mustacchi  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*35786f68SRobert Mustacchi  * substantial portion of the Covered Code or modification must reproduce the
68*35786f68SRobert Mustacchi  * above Copyright Notice, and the following Disclaimer and Export Compliance
69*35786f68SRobert Mustacchi  * provision in the documentation and/or other materials provided with the
70*35786f68SRobert Mustacchi  * distribution.
71*35786f68SRobert Mustacchi  *
72*35786f68SRobert Mustacchi  * 3.4. Intel retains all right, title, and interest in and to the Original
73*35786f68SRobert Mustacchi  * Intel Code.
74*35786f68SRobert Mustacchi  *
75*35786f68SRobert Mustacchi  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*35786f68SRobert Mustacchi  * Intel shall be used in advertising or otherwise to promote the sale, use or
77*35786f68SRobert Mustacchi  * other dealings in products derived from or relating to the Covered Code
78*35786f68SRobert Mustacchi  * without prior written authorization from Intel.
79*35786f68SRobert Mustacchi  *
80*35786f68SRobert Mustacchi  * 4. Disclaimer and Export Compliance
81*35786f68SRobert Mustacchi  *
82*35786f68SRobert Mustacchi  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*35786f68SRobert Mustacchi  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*35786f68SRobert Mustacchi  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*35786f68SRobert Mustacchi  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*35786f68SRobert Mustacchi  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*35786f68SRobert Mustacchi  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*35786f68SRobert Mustacchi  * PARTICULAR PURPOSE.
89*35786f68SRobert Mustacchi  *
90*35786f68SRobert Mustacchi  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*35786f68SRobert Mustacchi  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*35786f68SRobert Mustacchi  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*35786f68SRobert Mustacchi  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*35786f68SRobert Mustacchi  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*35786f68SRobert Mustacchi  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*35786f68SRobert Mustacchi  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*35786f68SRobert Mustacchi  * LIMITED REMEDY.
98*35786f68SRobert Mustacchi  *
99*35786f68SRobert Mustacchi  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*35786f68SRobert Mustacchi  * software or system incorporating such software without first obtaining any
101*35786f68SRobert Mustacchi  * required license or other approval from the U. S. Department of Commerce or
102*35786f68SRobert Mustacchi  * any other agency or department of the United States Government. In the
103*35786f68SRobert Mustacchi  * event Licensee exports any such software from the United States or
104*35786f68SRobert Mustacchi  * re-exports any such software from a foreign destination, Licensee shall
105*35786f68SRobert Mustacchi  * ensure that the distribution and export/re-export of the software is in
106*35786f68SRobert Mustacchi  * compliance with all laws, regulations, orders, or other restrictions of the
107*35786f68SRobert Mustacchi  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*35786f68SRobert Mustacchi  * any of its subsidiaries will export/re-export any technical data, process,
109*35786f68SRobert Mustacchi  * software, or service, directly or indirectly, to any country for which the
110*35786f68SRobert Mustacchi  * United States government or any agency thereof requires an export license,
111*35786f68SRobert Mustacchi  * other governmental approval, or letter of assurance, without first obtaining
112*35786f68SRobert Mustacchi  * such license, approval or letter.
113*35786f68SRobert Mustacchi  *
114*35786f68SRobert Mustacchi  *****************************************************************************
115*35786f68SRobert Mustacchi  *
116*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
117*35786f68SRobert Mustacchi  * following license:
118*35786f68SRobert Mustacchi  *
119bc36eafdSMike Gerdts  * Redistribution and use in source and binary forms, with or without
120bc36eafdSMike Gerdts  * modification, are permitted provided that the following conditions
121bc36eafdSMike Gerdts  * are met:
122bc36eafdSMike Gerdts  * 1. Redistributions of source code must retain the above copyright
123bc36eafdSMike Gerdts  *    notice, this list of conditions, and the following disclaimer,
124bc36eafdSMike Gerdts  *    without modification.
125bc36eafdSMike Gerdts  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126bc36eafdSMike Gerdts  *    substantially similar to the "NO WARRANTY" disclaimer below
127bc36eafdSMike Gerdts  *    ("Disclaimer") and any redistribution must be conditioned upon
128bc36eafdSMike Gerdts  *    including a substantially similar Disclaimer requirement for further
129bc36eafdSMike Gerdts  *    binary redistribution.
130bc36eafdSMike Gerdts  * 3. Neither the names of the above-listed copyright holders nor the names
131bc36eafdSMike Gerdts  *    of any contributors may be used to endorse or promote products derived
132bc36eafdSMike Gerdts  *    from this software without specific prior written permission.
133bc36eafdSMike Gerdts  *
134bc36eafdSMike Gerdts  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135bc36eafdSMike Gerdts  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*35786f68SRobert Mustacchi  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137bc36eafdSMike Gerdts  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*35786f68SRobert Mustacchi  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*35786f68SRobert Mustacchi  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*35786f68SRobert Mustacchi  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*35786f68SRobert Mustacchi  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*35786f68SRobert Mustacchi  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*35786f68SRobert Mustacchi  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*35786f68SRobert Mustacchi  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*35786f68SRobert Mustacchi  *
146*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
147*35786f68SRobert Mustacchi  * GNU General Public License ("GPL") version 2 as published by the Free
148*35786f68SRobert Mustacchi  * Software Foundation.
149*35786f68SRobert Mustacchi  *
150*35786f68SRobert Mustacchi  *****************************************************************************/
151bc36eafdSMike Gerdts 
152bc36eafdSMike Gerdts #include "acpi.h"
153bc36eafdSMike Gerdts #include "accommon.h"
154bc36eafdSMike Gerdts #include "acdisasm.h"
155bc36eafdSMike Gerdts #include "actables.h"
156bc36eafdSMike Gerdts #include "aslcompiler.h"
157bc36eafdSMike Gerdts 
158bc36eafdSMike Gerdts /* This module used for application-level code only */
159bc36eafdSMike Gerdts 
160bc36eafdSMike Gerdts #define _COMPONENT          ACPI_CA_DISASSEMBLER
161bc36eafdSMike Gerdts         ACPI_MODULE_NAME    ("dmtable")
162bc36eafdSMike Gerdts 
163bc36eafdSMike Gerdts const AH_TABLE *
164bc36eafdSMike Gerdts AcpiAhGetTableInfo (
165bc36eafdSMike Gerdts     char                    *Signature);
166bc36eafdSMike Gerdts 
167bc36eafdSMike Gerdts 
168bc36eafdSMike Gerdts /* Common format strings for commented values */
169bc36eafdSMike Gerdts 
170bc36eafdSMike Gerdts #define UINT8_FORMAT        "%2.2X [%s]\n"
171bc36eafdSMike Gerdts #define UINT16_FORMAT       "%4.4X [%s]\n"
172bc36eafdSMike Gerdts #define UINT32_FORMAT       "%8.8X [%s]\n"
173bc36eafdSMike Gerdts #define STRING_FORMAT       "[%s]\n"
174bc36eafdSMike Gerdts 
175bc36eafdSMike Gerdts /* These tables map a subtable type to a description string */
176bc36eafdSMike Gerdts 
177bc36eafdSMike Gerdts static const char           *AcpiDmAsfSubnames[] =
178bc36eafdSMike Gerdts {
179bc36eafdSMike Gerdts     "ASF Information",
180bc36eafdSMike Gerdts     "ASF Alerts",
181bc36eafdSMike Gerdts     "ASF Remote Control",
182bc36eafdSMike Gerdts     "ASF RMCP Boot Options",
183bc36eafdSMike Gerdts     "ASF Address",
184bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
185bc36eafdSMike Gerdts };
186bc36eafdSMike Gerdts 
187bc36eafdSMike Gerdts static const char           *AcpiDmDmarSubnames[] =
188bc36eafdSMike Gerdts {
189bc36eafdSMike Gerdts     "Hardware Unit Definition",
190bc36eafdSMike Gerdts     "Reserved Memory Region",
191bc36eafdSMike Gerdts     "Root Port ATS Capability",
192bc36eafdSMike Gerdts     "Remapping Hardware Static Affinity",
193bc36eafdSMike Gerdts     "ACPI Namespace Device Declaration",
194bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
195bc36eafdSMike Gerdts };
196bc36eafdSMike Gerdts 
197bc36eafdSMike Gerdts static const char           *AcpiDmDmarScope[] =
198bc36eafdSMike Gerdts {
199bc36eafdSMike Gerdts     "Reserved value",
200bc36eafdSMike Gerdts     "PCI Endpoint Device",
201bc36eafdSMike Gerdts     "PCI Bridge Device",
202bc36eafdSMike Gerdts     "IOAPIC Device",
203bc36eafdSMike Gerdts     "Message-capable HPET Device",
204bc36eafdSMike Gerdts     "Namespace Device",
205bc36eafdSMike Gerdts     "Unknown Scope Type"            /* Reserved */
206bc36eafdSMike Gerdts };
207bc36eafdSMike Gerdts 
208bc36eafdSMike Gerdts static const char           *AcpiDmEinjActions[] =
209bc36eafdSMike Gerdts {
210bc36eafdSMike Gerdts     "Begin Operation",
211bc36eafdSMike Gerdts     "Get Trigger Table",
212bc36eafdSMike Gerdts     "Set Error Type",
213bc36eafdSMike Gerdts     "Get Error Type",
214bc36eafdSMike Gerdts     "End Operation",
215bc36eafdSMike Gerdts     "Execute Operation",
216bc36eafdSMike Gerdts     "Check Busy Status",
217bc36eafdSMike Gerdts     "Get Command Status",
218bc36eafdSMike Gerdts     "Set Error Type With Address",
219bc36eafdSMike Gerdts     "Get Execute Timings",
220bc36eafdSMike Gerdts     "Unknown Action"
221bc36eafdSMike Gerdts };
222bc36eafdSMike Gerdts 
223bc36eafdSMike Gerdts static const char           *AcpiDmEinjInstructions[] =
224bc36eafdSMike Gerdts {
225bc36eafdSMike Gerdts     "Read Register",
226bc36eafdSMike Gerdts     "Read Register Value",
227bc36eafdSMike Gerdts     "Write Register",
228bc36eafdSMike Gerdts     "Write Register Value",
229bc36eafdSMike Gerdts     "Noop",
230bc36eafdSMike Gerdts     "Flush Cacheline",
231bc36eafdSMike Gerdts     "Unknown Instruction"
232bc36eafdSMike Gerdts };
233bc36eafdSMike Gerdts 
234bc36eafdSMike Gerdts static const char           *AcpiDmErstActions[] =
235bc36eafdSMike Gerdts {
236bc36eafdSMike Gerdts     "Begin Write Operation",
237bc36eafdSMike Gerdts     "Begin Read Operation",
238bc36eafdSMike Gerdts     "Begin Clear Operation",
239bc36eafdSMike Gerdts     "End Operation",
240bc36eafdSMike Gerdts     "Set Record Offset",
241bc36eafdSMike Gerdts     "Execute Operation",
242bc36eafdSMike Gerdts     "Check Busy Status",
243bc36eafdSMike Gerdts     "Get Command Status",
244bc36eafdSMike Gerdts     "Get Record Identifier",
245bc36eafdSMike Gerdts     "Set Record Identifier",
246bc36eafdSMike Gerdts     "Get Record Count",
247bc36eafdSMike Gerdts     "Begin Dummy Write",
248bc36eafdSMike Gerdts     "Unused/Unknown Action",
249bc36eafdSMike Gerdts     "Get Error Address Range",
250bc36eafdSMike Gerdts     "Get Error Address Length",
251bc36eafdSMike Gerdts     "Get Error Attributes",
252bc36eafdSMike Gerdts     "Execute Timings",
253bc36eafdSMike Gerdts     "Unknown Action"
254bc36eafdSMike Gerdts };
255bc36eafdSMike Gerdts 
256bc36eafdSMike Gerdts static const char           *AcpiDmErstInstructions[] =
257bc36eafdSMike Gerdts {
258bc36eafdSMike Gerdts     "Read Register",
259bc36eafdSMike Gerdts     "Read Register Value",
260bc36eafdSMike Gerdts     "Write Register",
261bc36eafdSMike Gerdts     "Write Register Value",
262bc36eafdSMike Gerdts     "Noop",
263bc36eafdSMike Gerdts     "Load Var1",
264bc36eafdSMike Gerdts     "Load Var2",
265bc36eafdSMike Gerdts     "Store Var1",
266bc36eafdSMike Gerdts     "Add",
267bc36eafdSMike Gerdts     "Subtract",
268bc36eafdSMike Gerdts     "Add Value",
269bc36eafdSMike Gerdts     "Subtract Value",
270bc36eafdSMike Gerdts     "Stall",
271bc36eafdSMike Gerdts     "Stall While True",
272bc36eafdSMike Gerdts     "Skip Next If True",
273bc36eafdSMike Gerdts     "GoTo",
274bc36eafdSMike Gerdts     "Set Source Address",
275bc36eafdSMike Gerdts     "Set Destination Address",
276bc36eafdSMike Gerdts     "Move Data",
277bc36eafdSMike Gerdts     "Unknown Instruction"
278bc36eafdSMike Gerdts };
279bc36eafdSMike Gerdts 
280bc36eafdSMike Gerdts static const char           *AcpiDmGtdtSubnames[] =
281bc36eafdSMike Gerdts {
282bc36eafdSMike Gerdts     "Generic Timer Block",
283bc36eafdSMike Gerdts     "Generic Watchdog Timer",
284bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
285bc36eafdSMike Gerdts };
286bc36eafdSMike Gerdts 
287bc36eafdSMike Gerdts static const char           *AcpiDmHestSubnames[] =
288bc36eafdSMike Gerdts {
289bc36eafdSMike Gerdts     "IA-32 Machine Check Exception",
290bc36eafdSMike Gerdts     "IA-32 Corrected Machine Check",
291bc36eafdSMike Gerdts     "IA-32 Non-Maskable Interrupt",
292*35786f68SRobert Mustacchi     "Unknown Subtable Type",        /* 3 - Reserved */
293*35786f68SRobert Mustacchi     "Unknown Subtable Type",        /* 4 - Reserved */
294*35786f68SRobert Mustacchi     "Unknown Subtable Type",        /* 5 - Reserved */
295bc36eafdSMike Gerdts     "PCI Express Root Port AER",
296bc36eafdSMike Gerdts     "PCI Express AER (AER Endpoint)",
297bc36eafdSMike Gerdts     "PCI Express/PCI-X Bridge AER",
298bc36eafdSMike Gerdts     "Generic Hardware Error Source",
299bc36eafdSMike Gerdts     "Generic Hardware Error Source V2",
300*35786f68SRobert Mustacchi     "IA-32 Deferred Machine Check",
301bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
302bc36eafdSMike Gerdts };
303bc36eafdSMike Gerdts 
304bc36eafdSMike Gerdts static const char           *AcpiDmHestNotifySubnames[] =
305bc36eafdSMike Gerdts {
306bc36eafdSMike Gerdts     "Polled",
307bc36eafdSMike Gerdts     "External Interrupt",
308bc36eafdSMike Gerdts     "Local Interrupt",
309bc36eafdSMike Gerdts     "SCI",
310bc36eafdSMike Gerdts     "NMI",
311bc36eafdSMike Gerdts     "CMCI",                         /* ACPI 5.0 */
312bc36eafdSMike Gerdts     "MCE",                          /* ACPI 5.0 */
313bc36eafdSMike Gerdts     "GPIO",                         /* ACPI 6.0 */
314bc36eafdSMike Gerdts     "SEA",                          /* ACPI 6.1 */
315bc36eafdSMike Gerdts     "SEI",                          /* ACPI 6.1 */
316bc36eafdSMike Gerdts     "GSIV",                         /* ACPI 6.1 */
317*35786f68SRobert Mustacchi     "Software Delegated Exception", /* ACPI 6.2 */
318bc36eafdSMike Gerdts     "Unknown Notify Type"           /* Reserved */
319bc36eafdSMike Gerdts };
320bc36eafdSMike Gerdts 
321*35786f68SRobert Mustacchi static const char           *AcpiDmHmatSubnames[] =
322*35786f68SRobert Mustacchi {
323*35786f68SRobert Mustacchi     "Memory Subystem Address Range",
324*35786f68SRobert Mustacchi     "System Locality Latency and Bandwidth Information",
325*35786f68SRobert Mustacchi     "Memory Side Cache Information",
326*35786f68SRobert Mustacchi     "Unknown Structure Type"         /* Reserved */
327*35786f68SRobert Mustacchi };
328*35786f68SRobert Mustacchi 
329bc36eafdSMike Gerdts static const char           *AcpiDmMadtSubnames[] =
330bc36eafdSMike Gerdts {
331bc36eafdSMike Gerdts     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
332bc36eafdSMike Gerdts     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
333bc36eafdSMike Gerdts     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
334bc36eafdSMike Gerdts     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
335bc36eafdSMike Gerdts     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
336bc36eafdSMike Gerdts     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
337bc36eafdSMike Gerdts     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
338bc36eafdSMike Gerdts     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
339bc36eafdSMike Gerdts     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
340bc36eafdSMike Gerdts     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
341bc36eafdSMike Gerdts     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
342bc36eafdSMike Gerdts     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
343bc36eafdSMike Gerdts     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
344bc36eafdSMike Gerdts     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
345bc36eafdSMike Gerdts     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
346bc36eafdSMike Gerdts     "Generic Interrupt Translator",     /* ACPI_MADT_GENERIC_TRANSLATOR */
347bc36eafdSMike Gerdts     "Unknown Subtable Type"             /* Reserved */
348bc36eafdSMike Gerdts };
349bc36eafdSMike Gerdts 
350bc36eafdSMike Gerdts static const char           *AcpiDmNfitSubnames[] =
351bc36eafdSMike Gerdts {
352bc36eafdSMike Gerdts     "System Physical Address Range",    /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
353bc36eafdSMike Gerdts     "Memory Range Map",                 /* ACPI_NFIT_TYPE_MEMORY_MAP */
354bc36eafdSMike Gerdts     "Interleave Info",                  /* ACPI_NFIT_TYPE_INTERLEAVE */
355bc36eafdSMike Gerdts     "SMBIOS Information",               /* ACPI_NFIT_TYPE_SMBIOS */
356bc36eafdSMike Gerdts     "NVDIMM Control Region",            /* ACPI_NFIT_TYPE_CONTROL_REGION */
357bc36eafdSMike Gerdts     "NVDIMM Block Data Window Region",  /* ACPI_NFIT_TYPE_DATA_REGION */
358bc36eafdSMike Gerdts     "Flush Hint Address",               /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
359*35786f68SRobert Mustacchi     "Platform Capabilities",            /* ACPI_NFIT_TYPE_CAPABILITIES */
360bc36eafdSMike Gerdts     "Unknown Subtable Type"             /* Reserved */
361bc36eafdSMike Gerdts };
362bc36eafdSMike Gerdts 
363bc36eafdSMike Gerdts static const char           *AcpiDmPcctSubnames[] =
364bc36eafdSMike Gerdts {
365bc36eafdSMike Gerdts     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
366bc36eafdSMike Gerdts     "HW-Reduced Comm Subspace",         /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
367bc36eafdSMike Gerdts     "HW-Reduced Comm Subspace Type2",   /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
368*35786f68SRobert Mustacchi     "Extended PCC Master Subspace",     /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */
369*35786f68SRobert Mustacchi     "Extended PCC Slave Subspace",      /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */
370bc36eafdSMike Gerdts     "Unknown Subtable Type"             /* Reserved */
371bc36eafdSMike Gerdts };
372bc36eafdSMike Gerdts 
373bc36eafdSMike Gerdts static const char           *AcpiDmPmttSubnames[] =
374bc36eafdSMike Gerdts {
375bc36eafdSMike Gerdts     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
376bc36eafdSMike Gerdts     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
377*35786f68SRobert Mustacchi     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM */
378*35786f68SRobert Mustacchi     "Unknown Subtable Type"         /* Reserved */
379*35786f68SRobert Mustacchi };
380*35786f68SRobert Mustacchi 
381*35786f68SRobert Mustacchi static const char           *AcpiDmPpttSubnames[] =
382*35786f68SRobert Mustacchi {
383*35786f68SRobert Mustacchi     "Processor Hierarchy Node",     /* ACPI_PPTT_TYPE_PROCESSOR */
384*35786f68SRobert Mustacchi     "Cache Type",                   /* ACPI_PPTT_TYPE_CACHE */
385*35786f68SRobert Mustacchi     "ID",                           /* ACPI_PPTT_TYPE_ID */
386*35786f68SRobert Mustacchi     "Unknown Subtable Type"         /* Reserved */
387*35786f68SRobert Mustacchi };
388*35786f68SRobert Mustacchi 
389*35786f68SRobert Mustacchi static const char           *AcpiDmSdevSubnames[] =
390*35786f68SRobert Mustacchi {
391*35786f68SRobert Mustacchi     "Namespace Device",             /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
392*35786f68SRobert Mustacchi     "PCIe Endpoint Device",         /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
393bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
394bc36eafdSMike Gerdts };
395bc36eafdSMike Gerdts 
396bc36eafdSMike Gerdts static const char           *AcpiDmSratSubnames[] =
397bc36eafdSMike Gerdts {
398bc36eafdSMike Gerdts     "Processor Local APIC/SAPIC Affinity",
399bc36eafdSMike Gerdts     "Memory Affinity",
400bc36eafdSMike Gerdts     "Processor Local x2APIC Affinity",
401bc36eafdSMike Gerdts     "GICC Affinity",
402*35786f68SRobert Mustacchi     "GIC ITS Affinity",             /* Acpi 6.2 */
403*35786f68SRobert Mustacchi     "Unknown Subtable Type"         /* Reserved */
404*35786f68SRobert Mustacchi };
405*35786f68SRobert Mustacchi 
406*35786f68SRobert Mustacchi static const char           *AcpiDmTpm2Subnames[] =
407*35786f68SRobert Mustacchi {
408*35786f68SRobert Mustacchi     "Illegal Start Method value",
409*35786f68SRobert Mustacchi     "Reserved",
410*35786f68SRobert Mustacchi     "ACPI Start Method",
411*35786f68SRobert Mustacchi     "Reserved",
412*35786f68SRobert Mustacchi     "Reserved",
413*35786f68SRobert Mustacchi     "Reserved",
414*35786f68SRobert Mustacchi     "Memory Mapped I/O",
415*35786f68SRobert Mustacchi     "Command Response Buffer",
416*35786f68SRobert Mustacchi     "Command Response Buffer with ACPI Start Method",
417*35786f68SRobert Mustacchi     "Reserved",
418*35786f68SRobert Mustacchi     "Reserved",
419*35786f68SRobert Mustacchi     "Command Response Buffer with ARM SMC",
420bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
421bc36eafdSMike Gerdts };
422bc36eafdSMike Gerdts 
423bc36eafdSMike Gerdts static const char           *AcpiDmIvrsSubnames[] =
424bc36eafdSMike Gerdts {
425bc36eafdSMike Gerdts     "Hardware Definition Block",
426bc36eafdSMike Gerdts     "Memory Definition Block",
427bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
428bc36eafdSMike Gerdts };
429bc36eafdSMike Gerdts 
430bc36eafdSMike Gerdts static const char           *AcpiDmLpitSubnames[] =
431bc36eafdSMike Gerdts {
432bc36eafdSMike Gerdts     "Native C-state Idle Structure",
433bc36eafdSMike Gerdts     "Unknown Subtable Type"         /* Reserved */
434bc36eafdSMike Gerdts };
435bc36eafdSMike Gerdts 
436bc36eafdSMike Gerdts #define ACPI_FADT_PM_RESERVED       9
437bc36eafdSMike Gerdts 
438bc36eafdSMike Gerdts static const char           *AcpiDmFadtProfiles[] =
439bc36eafdSMike Gerdts {
440bc36eafdSMike Gerdts     "Unspecified",
441bc36eafdSMike Gerdts     "Desktop",
442bc36eafdSMike Gerdts     "Mobile",
443bc36eafdSMike Gerdts     "Workstation",
444bc36eafdSMike Gerdts     "Enterprise Server",
445bc36eafdSMike Gerdts     "SOHO Server",
446bc36eafdSMike Gerdts     "Appliance PC",
447bc36eafdSMike Gerdts     "Performance Server",
448bc36eafdSMike Gerdts     "Tablet",
449bc36eafdSMike Gerdts     "Unknown Profile Type"
450bc36eafdSMike Gerdts };
451bc36eafdSMike Gerdts 
452bc36eafdSMike Gerdts #define ACPI_GAS_WIDTH_RESERVED     5
453bc36eafdSMike Gerdts 
454bc36eafdSMike Gerdts static const char           *AcpiDmGasAccessWidth[] =
455bc36eafdSMike Gerdts {
456bc36eafdSMike Gerdts     "Undefined/Legacy",
457bc36eafdSMike Gerdts     "Byte Access:8",
458bc36eafdSMike Gerdts     "Word Access:16",
459bc36eafdSMike Gerdts     "DWord Access:32",
460bc36eafdSMike Gerdts     "QWord Access:64",
461bc36eafdSMike Gerdts     "Unknown Width Encoding"
462bc36eafdSMike Gerdts };
463bc36eafdSMike Gerdts 
464bc36eafdSMike Gerdts 
465bc36eafdSMike Gerdts /*******************************************************************************
466bc36eafdSMike Gerdts  *
467bc36eafdSMike Gerdts  * ACPI Table Data, indexed by signature.
468bc36eafdSMike Gerdts  *
469bc36eafdSMike Gerdts  * Each entry contains: Signature, Table Info, Handler, DtHandler,
470bc36eafdSMike Gerdts  *  Template, Description
471bc36eafdSMike Gerdts  *
472bc36eafdSMike Gerdts  * Simple tables have only a TableInfo structure, complex tables have a
473bc36eafdSMike Gerdts  * handler. This table must be NULL terminated. RSDP and FACS are
474bc36eafdSMike Gerdts  * special-cased elsewhere.
475bc36eafdSMike Gerdts  *
476bc36eafdSMike Gerdts  * Note: Any tables added here should be duplicated within AcpiSupportedTables
477bc36eafdSMike Gerdts  * in the file common/ahtable.c
478bc36eafdSMike Gerdts  *
479bc36eafdSMike Gerdts  ******************************************************************************/
480bc36eafdSMike Gerdts 
481bc36eafdSMike Gerdts const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
482bc36eafdSMike Gerdts {
483bc36eafdSMike Gerdts     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf},
484bc36eafdSMike Gerdts     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
485bc36eafdSMike Gerdts     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
486bc36eafdSMike Gerdts     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
487bc36eafdSMike Gerdts     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
488bc36eafdSMike Gerdts     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
489bc36eafdSMike Gerdts     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
490bc36eafdSMike Gerdts     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp},
491bc36eafdSMike Gerdts     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar},
492bc36eafdSMike Gerdts     {ACPI_SIG_DRTM, NULL,                   AcpiDmDumpDrtm, DtCompileDrtm,  TemplateDrtm},
493bc36eafdSMike Gerdts     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt},
494bc36eafdSMike Gerdts     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj},
495bc36eafdSMike Gerdts     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst},
496bc36eafdSMike Gerdts     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt},
497bc36eafdSMike Gerdts     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt},
498bc36eafdSMike Gerdts     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt},
499bc36eafdSMike Gerdts     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest},
500*35786f68SRobert Mustacchi     {ACPI_SIG_HMAT, NULL,                   AcpiDmDumpHmat, DtCompileHmat,  TemplateHmat},
501bc36eafdSMike Gerdts     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet},
502bc36eafdSMike Gerdts     {ACPI_SIG_IORT, NULL,                   AcpiDmDumpIort, DtCompileIort,  TemplateIort},
503bc36eafdSMike Gerdts     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs},
504bc36eafdSMike Gerdts     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit},
505bc36eafdSMike Gerdts     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt},
506bc36eafdSMike Gerdts     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg},
507bc36eafdSMike Gerdts     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi},
508bc36eafdSMike Gerdts     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst},
509bc36eafdSMike Gerdts     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct},
510bc36eafdSMike Gerdts     {ACPI_SIG_MSDM, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateMsdm},
511bc36eafdSMike Gerdts     {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr},
512bc36eafdSMike Gerdts     {ACPI_SIG_NFIT, AcpiDmTableInfoNfit,    AcpiDmDumpNfit, DtCompileNfit,  TemplateNfit},
513bc36eafdSMike Gerdts     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct},
514*35786f68SRobert Mustacchi     {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt,    AcpiDmDumpPdtt, DtCompilePdtt,  TemplatePdtt},
515bc36eafdSMike Gerdts     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt},
516*35786f68SRobert Mustacchi     {ACPI_SIG_PPTT, NULL,                   AcpiDmDumpPptt, DtCompilePptt,  TemplatePptt},
517*35786f68SRobert Mustacchi     {ACPI_SIG_RASF, AcpiDmTableInfoRasf,    NULL,           NULL,           TemplateRasf},
518bc36eafdSMike Gerdts     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt},
519bc36eafdSMike Gerdts     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt},
520bc36eafdSMike Gerdts     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst},
521*35786f68SRobert Mustacchi     {ACPI_SIG_SDEI, AcpiDmTableInfoSdei,    NULL,           NULL,           TemplateSdei},
522*35786f68SRobert Mustacchi     {ACPI_SIG_SDEV, AcpiDmTableInfoSdev,    AcpiDmDumpSdev, DtCompileSdev,  TemplateSdev},
523bc36eafdSMike Gerdts     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic},
524bc36eafdSMike Gerdts     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit},
525bc36eafdSMike Gerdts     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr},
526bc36eafdSMike Gerdts     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi},
527bc36eafdSMike Gerdts     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat},
528bc36eafdSMike Gerdts     {ACPI_SIG_STAO, NULL,                   AcpiDmDumpStao, DtCompileStao,  TemplateStao},
529bc36eafdSMike Gerdts     {ACPI_SIG_TCPA, NULL,                   AcpiDmDumpTcpa, DtCompileTcpa,  TemplateTcpa},
530*35786f68SRobert Mustacchi     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    AcpiDmDumpTpm2, DtCompileTpm2,  TemplateTpm2},
531bc36eafdSMike Gerdts     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi},
532bc36eafdSMike Gerdts     {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc},
533bc36eafdSMike Gerdts     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet},
534bc36eafdSMike Gerdts     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat},
535bc36eafdSMike Gerdts     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt},
536bc36eafdSMike Gerdts     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt},
537bc36eafdSMike Gerdts     {ACPI_SIG_WPBT, NULL,                   AcpiDmDumpWpbt, DtCompileWpbt,  TemplateWpbt},
538*35786f68SRobert Mustacchi     {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt,    NULL,           NULL,           TemplateWsmt},
539bc36eafdSMike Gerdts     {ACPI_SIG_XENV, AcpiDmTableInfoXenv,    NULL,           NULL,           TemplateXenv},
540bc36eafdSMike Gerdts     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt},
541bc36eafdSMike Gerdts     {NULL,          NULL,                   NULL,           NULL,           NULL}
542bc36eafdSMike Gerdts };
543bc36eafdSMike Gerdts 
544bc36eafdSMike Gerdts 
545bc36eafdSMike Gerdts /*******************************************************************************
546bc36eafdSMike Gerdts  *
547bc36eafdSMike Gerdts  * FUNCTION:    AcpiDmGenerateChecksum
548bc36eafdSMike Gerdts  *
549bc36eafdSMike Gerdts  * PARAMETERS:  Table               - Pointer to table to be checksummed
550bc36eafdSMike Gerdts  *              Length              - Length of the table
551bc36eafdSMike Gerdts  *              OriginalChecksum    - Value of the checksum field
552bc36eafdSMike Gerdts  *
553bc36eafdSMike Gerdts  * RETURN:      8 bit checksum of buffer
554bc36eafdSMike Gerdts  *
555bc36eafdSMike Gerdts  * DESCRIPTION: Computes an 8 bit checksum of the table.
556bc36eafdSMike Gerdts  *
557bc36eafdSMike Gerdts  ******************************************************************************/
558bc36eafdSMike Gerdts 
559bc36eafdSMike Gerdts UINT8
AcpiDmGenerateChecksum(void * Table,UINT32 Length,UINT8 OriginalChecksum)560bc36eafdSMike Gerdts AcpiDmGenerateChecksum (
561bc36eafdSMike Gerdts     void                    *Table,
562bc36eafdSMike Gerdts     UINT32                  Length,
563bc36eafdSMike Gerdts     UINT8                   OriginalChecksum)
564bc36eafdSMike Gerdts {
565bc36eafdSMike Gerdts     UINT8                   Checksum;
566bc36eafdSMike Gerdts 
567bc36eafdSMike Gerdts 
568bc36eafdSMike Gerdts     /* Sum the entire table as-is */
569bc36eafdSMike Gerdts 
570bc36eafdSMike Gerdts     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
571bc36eafdSMike Gerdts 
572bc36eafdSMike Gerdts     /* Subtract off the existing checksum value in the table */
573bc36eafdSMike Gerdts 
574bc36eafdSMike Gerdts     Checksum = (UINT8) (Checksum - OriginalChecksum);
575bc36eafdSMike Gerdts 
576bc36eafdSMike Gerdts     /* Compute the final checksum */
577bc36eafdSMike Gerdts 
578bc36eafdSMike Gerdts     Checksum = (UINT8) (0 - Checksum);
579bc36eafdSMike Gerdts     return (Checksum);
580bc36eafdSMike Gerdts }
581bc36eafdSMike Gerdts 
582bc36eafdSMike Gerdts 
583bc36eafdSMike Gerdts /*******************************************************************************
584bc36eafdSMike Gerdts  *
585bc36eafdSMike Gerdts  * FUNCTION:    AcpiDmGetTableData
586bc36eafdSMike Gerdts  *
587bc36eafdSMike Gerdts  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
588bc36eafdSMike Gerdts  *
589bc36eafdSMike Gerdts  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
590bc36eafdSMike Gerdts  *
591bc36eafdSMike Gerdts  * DESCRIPTION: Find a match in the global table of supported ACPI tables
592bc36eafdSMike Gerdts  *
593bc36eafdSMike Gerdts  ******************************************************************************/
594bc36eafdSMike Gerdts 
595bc36eafdSMike Gerdts const ACPI_DMTABLE_DATA *
AcpiDmGetTableData(char * Signature)596bc36eafdSMike Gerdts AcpiDmGetTableData (
597bc36eafdSMike Gerdts     char                    *Signature)
598bc36eafdSMike Gerdts {
599bc36eafdSMike Gerdts     const ACPI_DMTABLE_DATA *Info;
600bc36eafdSMike Gerdts 
601bc36eafdSMike Gerdts 
602bc36eafdSMike Gerdts     for (Info = AcpiDmTableData; Info->Signature; Info++)
603bc36eafdSMike Gerdts     {
604bc36eafdSMike Gerdts         if (ACPI_COMPARE_NAME (Signature, Info->Signature))
605bc36eafdSMike Gerdts         {
606bc36eafdSMike Gerdts             return (Info);
607bc36eafdSMike Gerdts         }
608bc36eafdSMike Gerdts     }
609bc36eafdSMike Gerdts 
610bc36eafdSMike Gerdts     return (NULL);
611bc36eafdSMike Gerdts }
612bc36eafdSMike Gerdts 
613bc36eafdSMike Gerdts 
614bc36eafdSMike Gerdts /*******************************************************************************
615bc36eafdSMike Gerdts  *
616bc36eafdSMike Gerdts  * FUNCTION:    AcpiDmDumpDataTable
617bc36eafdSMike Gerdts  *
618bc36eafdSMike Gerdts  * PARAMETERS:  Table               - An ACPI table
619bc36eafdSMike Gerdts  *
620bc36eafdSMike Gerdts  * RETURN:      None.
621bc36eafdSMike Gerdts  *
622bc36eafdSMike Gerdts  * DESCRIPTION: Format the contents of an ACPI data table (any table other
623bc36eafdSMike Gerdts  *              than an SSDT or DSDT that does not contain executable AML code)
624bc36eafdSMike Gerdts  *
625bc36eafdSMike Gerdts  ******************************************************************************/
626bc36eafdSMike Gerdts 
627bc36eafdSMike Gerdts void
AcpiDmDumpDataTable(ACPI_TABLE_HEADER * Table)628bc36eafdSMike Gerdts AcpiDmDumpDataTable (
629bc36eafdSMike Gerdts     ACPI_TABLE_HEADER       *Table)
630bc36eafdSMike Gerdts {
631bc36eafdSMike Gerdts     ACPI_STATUS             Status;
632bc36eafdSMike Gerdts     const ACPI_DMTABLE_DATA *TableData;
633bc36eafdSMike Gerdts     UINT32                  Length;
634bc36eafdSMike Gerdts 
635bc36eafdSMike Gerdts 
636bc36eafdSMike Gerdts     /* Ignore tables that contain AML */
637bc36eafdSMike Gerdts 
638bc36eafdSMike Gerdts     if (AcpiUtIsAmlTable (Table))
639bc36eafdSMike Gerdts     {
640bc36eafdSMike Gerdts         if (Gbl_VerboseTemplates)
641bc36eafdSMike Gerdts         {
642bc36eafdSMike Gerdts             /* Dump the raw table data */
643bc36eafdSMike Gerdts 
644bc36eafdSMike Gerdts             Length = Table->Length;
645bc36eafdSMike Gerdts 
646bc36eafdSMike Gerdts             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
647bc36eafdSMike Gerdts                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
648bc36eafdSMike Gerdts             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
649bc36eafdSMike Gerdts                 Length, DB_BYTE_DISPLAY, 0);
650bc36eafdSMike Gerdts             AcpiOsPrintf (" */\n");
651bc36eafdSMike Gerdts         }
652bc36eafdSMike Gerdts         return;
653bc36eafdSMike Gerdts     }
654bc36eafdSMike Gerdts 
655bc36eafdSMike Gerdts     /*
656bc36eafdSMike Gerdts      * Handle tables that don't use the common ACPI table header structure.
657bc36eafdSMike Gerdts      * Currently, these are the FACS, RSDP, and S3PT.
658bc36eafdSMike Gerdts      */
659bc36eafdSMike Gerdts     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
660bc36eafdSMike Gerdts     {
661bc36eafdSMike Gerdts         Length = Table->Length;
662bc36eafdSMike Gerdts         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
663bc36eafdSMike Gerdts         if (ACPI_FAILURE (Status))
664bc36eafdSMike Gerdts         {
665bc36eafdSMike Gerdts             return;
666bc36eafdSMike Gerdts         }
667bc36eafdSMike Gerdts     }
668bc36eafdSMike Gerdts     else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
669bc36eafdSMike Gerdts     {
670bc36eafdSMike Gerdts         Length = AcpiDmDumpRsdp (Table);
671bc36eafdSMike Gerdts     }
672bc36eafdSMike Gerdts     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
673bc36eafdSMike Gerdts     {
674bc36eafdSMike Gerdts         Length = AcpiDmDumpS3pt (Table);
675bc36eafdSMike Gerdts     }
676bc36eafdSMike Gerdts     else
677bc36eafdSMike Gerdts     {
678bc36eafdSMike Gerdts         /*
679bc36eafdSMike Gerdts          * All other tables must use the common ACPI table header, dump it now
680bc36eafdSMike Gerdts          */
681bc36eafdSMike Gerdts         Length = Table->Length;
682bc36eafdSMike Gerdts         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
683bc36eafdSMike Gerdts         if (ACPI_FAILURE (Status))
684bc36eafdSMike Gerdts         {
685bc36eafdSMike Gerdts             return;
686bc36eafdSMike Gerdts         }
687bc36eafdSMike Gerdts         AcpiOsPrintf ("\n");
688bc36eafdSMike Gerdts 
689bc36eafdSMike Gerdts         /* Match signature and dispatch appropriately */
690bc36eafdSMike Gerdts 
691bc36eafdSMike Gerdts         TableData = AcpiDmGetTableData (Table->Signature);
692bc36eafdSMike Gerdts         if (!TableData)
693bc36eafdSMike Gerdts         {
694bc36eafdSMike Gerdts             if (!strncmp (Table->Signature, "OEM", 3))
695bc36eafdSMike Gerdts             {
696bc36eafdSMike Gerdts                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
697bc36eafdSMike Gerdts                     Table->Signature);
698bc36eafdSMike Gerdts             }
699bc36eafdSMike Gerdts             else
700bc36eafdSMike Gerdts             {
701bc36eafdSMike Gerdts                 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
702bc36eafdSMike Gerdts                     Table->Signature);
703bc36eafdSMike Gerdts 
704bc36eafdSMike Gerdts                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
705bc36eafdSMike Gerdts                     Table->Signature);
706bc36eafdSMike Gerdts 
707bc36eafdSMike Gerdts                 if (!AcpiGbl_ForceAmlDisassembly)
708bc36eafdSMike Gerdts                 {
709bc36eafdSMike Gerdts                     fprintf (stderr, "decoding ACPI table header only\n");
710bc36eafdSMike Gerdts                 }
711bc36eafdSMike Gerdts                 else
712bc36eafdSMike Gerdts                 {
713bc36eafdSMike Gerdts                     fprintf (stderr, "assuming table contains valid AML code\n");
714bc36eafdSMike Gerdts                 }
715bc36eafdSMike Gerdts             }
716bc36eafdSMike Gerdts         }
717bc36eafdSMike Gerdts         else if (TableData->TableHandler)
718bc36eafdSMike Gerdts         {
719bc36eafdSMike Gerdts             /* Complex table, has a handler */
720bc36eafdSMike Gerdts 
721bc36eafdSMike Gerdts             TableData->TableHandler (Table);
722bc36eafdSMike Gerdts         }
723bc36eafdSMike Gerdts         else if (TableData->TableInfo)
724bc36eafdSMike Gerdts         {
725bc36eafdSMike Gerdts             /* Simple table, just walk the info table */
726bc36eafdSMike Gerdts 
727bc36eafdSMike Gerdts             Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
728bc36eafdSMike Gerdts             if (ACPI_FAILURE (Status))
729bc36eafdSMike Gerdts             {
730bc36eafdSMike Gerdts                 return;
731bc36eafdSMike Gerdts             }
732bc36eafdSMike Gerdts         }
733bc36eafdSMike Gerdts     }
734bc36eafdSMike Gerdts 
735bc36eafdSMike Gerdts     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
736bc36eafdSMike Gerdts     {
737bc36eafdSMike Gerdts         /* Dump the raw table data */
738bc36eafdSMike Gerdts 
739bc36eafdSMike Gerdts         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
740bc36eafdSMike Gerdts             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
741bc36eafdSMike Gerdts         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
742bc36eafdSMike Gerdts             Length, DB_BYTE_DISPLAY, 0);
743bc36eafdSMike Gerdts     }
744bc36eafdSMike Gerdts }
745bc36eafdSMike Gerdts 
746bc36eafdSMike Gerdts 
747bc36eafdSMike Gerdts /*******************************************************************************
748bc36eafdSMike Gerdts  *
749bc36eafdSMike Gerdts  * FUNCTION:    AcpiDmLineHeader
750bc36eafdSMike Gerdts  *
751bc36eafdSMike Gerdts  * PARAMETERS:  Offset              - Current byte offset, from table start
752bc36eafdSMike Gerdts  *              ByteLength          - Length of the field in bytes, 0 for flags
753bc36eafdSMike Gerdts  *              Name                - Name of this field
754bc36eafdSMike Gerdts  *
755bc36eafdSMike Gerdts  * RETURN:      None
756bc36eafdSMike Gerdts  *
757bc36eafdSMike Gerdts  * DESCRIPTION: Utility routines for formatting output lines. Displays the
758bc36eafdSMike Gerdts  *              current table offset in hex and decimal, the field length,
759bc36eafdSMike Gerdts  *              and the field name.
760bc36eafdSMike Gerdts  *
761bc36eafdSMike Gerdts  ******************************************************************************/
762bc36eafdSMike Gerdts 
763bc36eafdSMike Gerdts void
AcpiDmLineHeader(UINT32 Offset,UINT32 ByteLength,char * Name)764bc36eafdSMike Gerdts AcpiDmLineHeader (
765bc36eafdSMike Gerdts     UINT32                  Offset,
766bc36eafdSMike Gerdts     UINT32                  ByteLength,
767bc36eafdSMike Gerdts     char                    *Name)
768bc36eafdSMike Gerdts {
769bc36eafdSMike Gerdts 
770bc36eafdSMike Gerdts     /* Allow a null name for fields that span multiple lines (large buffers) */
771bc36eafdSMike Gerdts 
772bc36eafdSMike Gerdts     if (!Name)
773bc36eafdSMike Gerdts     {
774bc36eafdSMike Gerdts         Name = "";
775bc36eafdSMike Gerdts     }
776bc36eafdSMike Gerdts 
777bc36eafdSMike Gerdts     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
778bc36eafdSMike Gerdts     {
779bc36eafdSMike Gerdts         if (ByteLength)
780bc36eafdSMike Gerdts         {
781bc36eafdSMike Gerdts             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
782bc36eafdSMike Gerdts         }
783bc36eafdSMike Gerdts         else
784bc36eafdSMike Gerdts         {
785bc36eafdSMike Gerdts             if (*Name)
786bc36eafdSMike Gerdts             {
787bc36eafdSMike Gerdts                 AcpiOsPrintf ("%41s : ", Name);
788bc36eafdSMike Gerdts             }
789bc36eafdSMike Gerdts             else
790bc36eafdSMike Gerdts             {
791bc36eafdSMike Gerdts                 AcpiOsPrintf ("%41s   ", Name);
792