dmtable.c revision 1.1.1.18 1 /******************************************************************************
2 *
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2021, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acdisasm.h"
47 #include "actables.h"
48 #include "aslcompiler.h"
49
50 /* This module used for application-level code only */
51
52 #define _COMPONENT ACPI_CA_DISASSEMBLER
53 ACPI_MODULE_NAME ("dmtable")
54
55 const AH_TABLE *
56 AcpiAhGetTableInfo (
57 char *Signature);
58
59
60 /* Common format strings for commented values */
61
62 #define UINT8_FORMAT "%2.2X [%s]\n"
63 #define UINT16_FORMAT "%4.4X [%s]\n"
64 #define UINT32_FORMAT "%8.8X [%s]\n"
65 #define STRING_FORMAT "[%s]\n"
66
67 /* These tables map a subtable type to a description string */
68
69 static const char *AcpiDmAsfSubnames[] =
70 {
71 "ASF Information",
72 "ASF Alerts",
73 "ASF Remote Control",
74 "ASF RMCP Boot Options",
75 "ASF Address",
76 "Unknown Subtable Type" /* Reserved */
77 };
78
79 static const char *AcpiDmCedtSubnames[] =
80 {
81 "CXL Host Bridge Structure",
82 "Unknown Subtable Type" /* Reserved */
83 };
84
85 static const char *AcpiDmDmarSubnames[] =
86 {
87 "Hardware Unit Definition",
88 "Reserved Memory Region",
89 "Root Port ATS Capability",
90 "Remapping Hardware Static Affinity",
91 "ACPI Namespace Device Declaration",
92 "Unknown Subtable Type" /* Reserved */
93 };
94
95 static const char *AcpiDmDmarScope[] =
96 {
97 "Reserved value",
98 "PCI Endpoint Device",
99 "PCI Bridge Device",
100 "IOAPIC Device",
101 "Message-capable HPET Device",
102 "Namespace Device",
103 "Unknown Scope Type" /* Reserved */
104 };
105
106 static const char *AcpiDmEinjActions[] =
107 {
108 "Begin Operation",
109 "Get Trigger Table",
110 "Set Error Type",
111 "Get Error Type",
112 "End Operation",
113 "Execute Operation",
114 "Check Busy Status",
115 "Get Command Status",
116 "Set Error Type With Address",
117 "Get Execute Timings",
118 "Unknown Action"
119 };
120
121 static const char *AcpiDmEinjInstructions[] =
122 {
123 "Read Register",
124 "Read Register Value",
125 "Write Register",
126 "Write Register Value",
127 "Noop",
128 "Flush Cacheline",
129 "Unknown Instruction"
130 };
131
132 static const char *AcpiDmErstActions[] =
133 {
134 "Begin Write Operation",
135 "Begin Read Operation",
136 "Begin Clear Operation",
137 "End Operation",
138 "Set Record Offset",
139 "Execute Operation",
140 "Check Busy Status",
141 "Get Command Status",
142 "Get Record Identifier",
143 "Set Record Identifier",
144 "Get Record Count",
145 "Begin Dummy Write",
146 "Unused/Unknown Action",
147 "Get Error Address Range",
148 "Get Error Address Length",
149 "Get Error Attributes",
150 "Execute Timings",
151 "Unknown Action"
152 };
153
154 static const char *AcpiDmErstInstructions[] =
155 {
156 "Read Register",
157 "Read Register Value",
158 "Write Register",
159 "Write Register Value",
160 "Noop",
161 "Load Var1",
162 "Load Var2",
163 "Store Var1",
164 "Add",
165 "Subtract",
166 "Add Value",
167 "Subtract Value",
168 "Stall",
169 "Stall While True",
170 "Skip Next If True",
171 "GoTo",
172 "Set Source Address",
173 "Set Destination Address",
174 "Move Data",
175 "Unknown Instruction"
176 };
177
178 static const char *AcpiDmGtdtSubnames[] =
179 {
180 "Generic Timer Block",
181 "Generic Watchdog Timer",
182 "Unknown Subtable Type" /* Reserved */
183 };
184
185 static const char *AcpiDmHestSubnames[] =
186 {
187 "IA-32 Machine Check Exception",
188 "IA-32 Corrected Machine Check",
189 "IA-32 Non-Maskable Interrupt",
190 "Unknown Subtable Type", /* 3 - Reserved */
191 "Unknown Subtable Type", /* 4 - Reserved */
192 "Unknown Subtable Type", /* 5 - Reserved */
193 "PCI Express Root Port AER",
194 "PCI Express AER (AER Endpoint)",
195 "PCI Express/PCI-X Bridge AER",
196 "Generic Hardware Error Source",
197 "Generic Hardware Error Source V2",
198 "IA-32 Deferred Machine Check",
199 "Unknown Subtable Type" /* Reserved */
200 };
201
202 static const char *AcpiDmHestNotifySubnames[] =
203 {
204 "Polled",
205 "External Interrupt",
206 "Local Interrupt",
207 "SCI",
208 "NMI",
209 "CMCI", /* ACPI 5.0 */
210 "MCE", /* ACPI 5.0 */
211 "GPIO", /* ACPI 6.0 */
212 "SEA", /* ACPI 6.1 */
213 "SEI", /* ACPI 6.1 */
214 "GSIV", /* ACPI 6.1 */
215 "Software Delegated Exception", /* ACPI 6.2 */
216 "Unknown Notify Type" /* Reserved */
217 };
218
219 static const char *AcpiDmHmatSubnames[] =
220 {
221 "Memory Proximity Domain Attributes",
222 "System Locality Latency and Bandwidth Information",
223 "Memory Side Cache Information",
224 "Unknown Structure Type" /* Reserved */
225 };
226
227 static const char *AcpiDmMadtSubnames[] =
228 {
229 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
230 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
231 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
232 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
233 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
234 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
235 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
236 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
237 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
238 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
239 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
240 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
241 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
242 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
243 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
244 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
245 "Unknown Subtable Type" /* Reserved */
246 };
247
248 static const char *AcpiDmNfitSubnames[] =
249 {
250 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
251 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
252 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
253 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
254 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
255 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
256 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
257 "Platform Capabilities", /* ACPI_NFIT_TYPE_CAPABILITIES */
258 "Unknown Subtable Type" /* Reserved */
259 };
260
261 static const char *AcpiDmPcctSubnames[] =
262 {
263 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
264 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
265 "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
266 "Extended PCC Master Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */
267 "Extended PCC Slave Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */
268 "HW Registers based Comm Subspace", /* ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE */
269 "Unknown Subtable Type" /* Reserved */
270 };
271
272 static const char *AcpiDmPhatSubnames[] =
273 {
274 "Firmware Version Data", /* ACPI_PHAT_TYPE_FW_VERSION_DATA */
275 "Firmware Health Data", /* ACPI_PHAT_TYPE_FW_HEALTH_DATA */
276 "Unknown Subtable Type" /* Reserved */
277 };
278
279 static const char *AcpiDmPmttSubnames[] =
280 {
281 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
282 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
283 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
284 "Unknown Subtable Type", /* Reserved */
285 "Vendor Specific" /* ACPI_PMTT_TYPE_VENDOR */
286 };
287
288 static const char *AcpiDmPpttSubnames[] =
289 {
290 "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */
291 "Cache Type", /* ACPI_PPTT_TYPE_CACHE */
292 "ID", /* ACPI_PPTT_TYPE_ID */
293 "Unknown Subtable Type" /* Reserved */
294 };
295
296 static const char *AcpiDmSdevSubnames[] =
297 {
298 "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
299 "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
300 "Unknown Subtable Type" /* Reserved */
301 };
302
303 static const char *AcpiDmSratSubnames[] =
304 {
305 "Processor Local APIC/SAPIC Affinity",
306 "Memory Affinity",
307 "Processor Local x2APIC Affinity",
308 "GICC Affinity",
309 "GIC ITS Affinity", /* Acpi 6.2 */
310 "Generic Initiator Affinity", /* Acpi 6.3 */
311 "Unknown Subtable Type" /* Reserved */
312 };
313
314 static const char *AcpiDmTpm2Subnames[] =
315 {
316 "Illegal Start Method value",
317 "Reserved",
318 "ACPI Start Method",
319 "Reserved",
320 "Reserved",
321 "Reserved",
322 "Memory Mapped I/O",
323 "Command Response Buffer",
324 "Command Response Buffer with ACPI Start Method",
325 "Reserved",
326 "Reserved",
327 "Command Response Buffer with ARM SMC",
328 "Unknown Subtable Type" /* Reserved */
329 };
330
331 static const char *AcpiDmIvrsSubnames[] =
332 {
333 "Hardware Definition Block",
334 "Memory Definition Block",
335 "Unknown Subtable Type" /* Reserved */
336 };
337
338 static const char *AcpiDmLpitSubnames[] =
339 {
340 "Native C-state Idle Structure",
341 "Unknown Subtable Type" /* Reserved */
342 };
343
344 static const char *AcpiDmViotSubnames[] =
345 {
346 "Unknown Subtable Type", /* 0 -Reserved */
347 "PCI Range",
348 "MMIO Endpoint",
349 "VirtIO-PCI IOMMU",
350 "VirtIO-MMIO IOMMU",
351 "Unknown Subtable Type" /* Reserved */
352 };
353
354 #define ACPI_FADT_PM_RESERVED 9
355
356 static const char *AcpiDmFadtProfiles[] =
357 {
358 "Unspecified",
359 "Desktop",
360 "Mobile",
361 "Workstation",
362 "Enterprise Server",
363 "SOHO Server",
364 "Appliance PC",
365 "Performance Server",
366 "Tablet",
367 "Unknown Profile Type"
368 };
369
370 #define ACPI_GAS_WIDTH_RESERVED 5
371
372 static const char *AcpiDmGasAccessWidth[] =
373 {
374 "Undefined/Legacy",
375 "Byte Access:8",
376 "Word Access:16",
377 "DWord Access:32",
378 "QWord Access:64",
379 "Unknown Width Encoding"
380 };
381
382
383 /*******************************************************************************
384 *
385 * ACPI Table Data, indexed by signature.
386 *
387 * Each entry contains: Signature, Table Info, Handler, DtHandler,
388 * Template, Description
389 *
390 * Simple tables have only a TableInfo structure, complex tables have a
391 * handler. This table must be NULL terminated. RSDP and FACS are
392 * special-cased elsewhere.
393 *
394 * Note: Any tables added here should be duplicated within
395 * AcpiGbl_SupportedTables in the file common/ahtable.c
396 *
397 ******************************************************************************/
398
399 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
400 {
401 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
402 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
403 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
404 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
405 {ACPI_SIG_CEDT, NULL, AcpiDmDumpCedt, DtCompileCedt, TemplateCedt},
406 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
407 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
408 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
409 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
410 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
411 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
412 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
413 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
414 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
415 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
416 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
417 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
418 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
419 {ACPI_SIG_HMAT, NULL, AcpiDmDumpHmat, DtCompileHmat, TemplateHmat},
420 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet},
421 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort},
422 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs},
423 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit},
424 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt},
425 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg},
426 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi},
427 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst},
428 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct},
429 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm},
430 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
431 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
432 {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt},
433 {ACPI_SIG_PHAT, NULL, AcpiDmDumpPhat, DtCompilePhat, TemplatePhat},
434 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
435 {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt},
436 {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
437 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
438 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
439 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
440 {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei},
441 {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev},
442 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
443 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
444 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
445 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
446 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
447 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
448 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
449 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2},
450 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
451 {ACPI_SIG_VIOT, AcpiDmTableInfoViot, AcpiDmDumpViot, DtCompileViot, TemplateViot},
452 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
453 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
454 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
455 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
456 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
457 {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt, NULL, NULL, TemplateWsmt},
458 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
459 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
460 {NULL, NULL, NULL, NULL, NULL}
461 };
462
463
464 /*******************************************************************************
465 *
466 * FUNCTION: AcpiDmGenerateChecksum
467 *
468 * PARAMETERS: Table - Pointer to table to be checksummed
469 * Length - Length of the table
470 * OriginalChecksum - Value of the checksum field
471 *
472 * RETURN: 8 bit checksum of buffer
473 *
474 * DESCRIPTION: Computes an 8 bit checksum of the table.
475 *
476 ******************************************************************************/
477
478 UINT8
479 AcpiDmGenerateChecksum (
480 void *Table,
481 UINT32 Length,
482 UINT8 OriginalChecksum)
483 {
484 UINT8 Checksum;
485
486
487 /* Sum the entire table as-is */
488
489 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
490
491 /* Subtract off the existing checksum value in the table */
492
493 Checksum = (UINT8) (Checksum - OriginalChecksum);
494
495 /* Compute the final checksum */
496
497 Checksum = (UINT8) (0 - Checksum);
498 return (Checksum);
499 }
500
501
502 /*******************************************************************************
503 *
504 * FUNCTION: AcpiDmGetTableData
505 *
506 * PARAMETERS: Signature - ACPI signature (4 chars) to match
507 *
508 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
509 *
510 * DESCRIPTION: Find a match in the global table of supported ACPI tables
511 *
512 ******************************************************************************/
513
514 const ACPI_DMTABLE_DATA *
515 AcpiDmGetTableData (
516 char *Signature)
517 {
518 const ACPI_DMTABLE_DATA *Info;
519
520
521 for (Info = AcpiDmTableData; Info->Signature; Info++)
522 {
523 if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature))
524 {
525 return (Info);
526 }
527 }
528
529 return (NULL);
530 }
531
532
533 /*******************************************************************************
534 *
535 * FUNCTION: AcpiDmDumpDataTable
536 *
537 * PARAMETERS: Table - An ACPI table
538 *
539 * RETURN: None.
540 *
541 * DESCRIPTION: Format the contents of an ACPI data table (any table other
542 * than an SSDT or DSDT that does not contain executable AML code)
543 *
544 ******************************************************************************/
545
546 void
547 AcpiDmDumpDataTable (
548 ACPI_TABLE_HEADER *Table)
549 {
550 ACPI_STATUS Status;
551 const ACPI_DMTABLE_DATA *TableData;
552 UINT32 Length;
553
554
555 /* Ignore tables that contain AML */
556
557 if (AcpiUtIsAmlTable (Table))
558 {
559 if (AslGbl_VerboseTemplates)
560 {
561 /* Dump the raw table data */
562
563 Length = Table->Length;
564
565 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
566 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
567 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
568 Length, DB_BYTE_DISPLAY, 0);
569 AcpiOsPrintf (" */\n");
570 }
571 return;
572 }
573
574 /*
575 * Handle tables that don't use the common ACPI table header structure.
576 * Currently, these are the FACS, RSDP, and S3PT.
577 */
578 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
579 {
580 Length = Table->Length;
581 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
582 if (ACPI_FAILURE (Status))
583 {
584 return;
585 }
586 }
587 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
588 {
589 Length = AcpiDmDumpRsdp (Table);
590 }
591 else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
592 {
593 Length = AcpiDmDumpS3pt (Table);
594 }
595 else
596 {
597 /*
598 * All other tables must use the common ACPI table header, dump it now
599 */
600 Length = Table->Length;
601 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
602 if (ACPI_FAILURE (Status))
603 {
604 return;
605 }
606 AcpiOsPrintf ("\n");
607
608 /* Match signature and dispatch appropriately */
609
610 TableData = AcpiDmGetTableData (Table->Signature);
611 if (!TableData)
612 {
613 if (!strncmp (Table->Signature, "OEM", 3))
614 {
615 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
616 Table->Signature);
617 }
618 else
619 {
620 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
621 Table->Signature);
622
623 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
624 Table->Signature);
625
626 if (!AcpiGbl_ForceAmlDisassembly)
627 {
628 fprintf (stderr, "decoding ACPI table header only\n");
629 }
630 else
631 {
632 fprintf (stderr, "assuming table contains valid AML code\n");
633 }
634 }
635 }
636 else if (TableData->TableHandler)
637 {
638 /* Complex table, has a handler */
639
640 TableData->TableHandler (Table);
641 }
642 else if (TableData->TableInfo)
643 {
644 /* Simple table, just walk the info table */
645
646 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
647 if (ACPI_FAILURE (Status))
648 {
649 return;
650 }
651 }
652 }
653
654 if (!AslGbl_DoTemplates || AslGbl_VerboseTemplates)
655 {
656 /* Dump the raw table data */
657
658 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
659 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
660 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
661 Length, DB_BYTE_DISPLAY, 0);
662 }
663 }
664
665
666 /*******************************************************************************
667 *
668 * FUNCTION: AcpiDmLineHeader
669 *
670 * PARAMETERS: Offset - Current byte offset, from table start
671 * ByteLength - Length of the field in bytes, 0 for flags
672 * Name - Name of this field
673 *
674 * RETURN: None
675 *
676 * DESCRIPTION: Utility routines for formatting output lines. Displays the
677 * current table offset in hex and decimal, the field length,
678 * and the field name.
679 *
680 ******************************************************************************/
681
682 void
683 AcpiDmLineHeader (
684 UINT32 Offset,
685 UINT32 ByteLength,
686 char *Name)
687 {
688
689 /* Allow a null name for fields that span multiple lines (large buffers) */
690
691 if (!Name)
692 {
693 Name = "";
694 }
695
696 if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
697 {
698 if (ByteLength)
699 {
700 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
701 }
702 else
703 {
704 if (*Name)
705 {
706 AcpiOsPrintf ("%41s : ", Name);
707 }
708 else
709 {
710 AcpiOsPrintf ("%41s ", Name);
711 }
712 }
713 }
714 else /* Normal disassembler or verbose template */
715 {
716 if (ByteLength)
717 {
718 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
719 Offset, Offset, ByteLength, Name);
720 }
721 else
722 {
723 if (*Name)
724 {
725 AcpiOsPrintf ("%44s : ", Name);
726 }
727 else
728 {
729 AcpiOsPrintf ("%44s ", Name);
730 }
731 }
732 }
733 }
734
735 void
736 AcpiDmLineHeader2 (
737 UINT32 Offset,
738 UINT32 ByteLength,
739 char *Name,
740 UINT32 Value)
741 {
742
743 if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
744 {
745 if (ByteLength)
746 {
747 AcpiOsPrintf ("[%.4d] %30s %3d : ",
748 ByteLength, Name, Value);
749 }
750 else
751 {
752 AcpiOsPrintf ("%36s % 3d : ",
753 Name, Value);
754 }
755 }
756 else /* Normal disassembler or verbose template */
757 {
758 if (ByteLength)
759 {
760 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
761 Offset, Offset, ByteLength, Name, Value);
762 }
763 else
764 {
765 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
766 Offset, Offset, Name, Value);
767 }
768 }
769 }
770
771
772 /*******************************************************************************
773 *
774 * FUNCTION: AcpiDmDumpTable
775 *
776 * PARAMETERS: TableLength - Length of the entire ACPI table
777 * TableOffset - Starting offset within the table for this
778 * sub-descriptor (0 if main table)
779 * Table - The ACPI table
780 * SubtableLength - Length of this sub-descriptor
781 * Info - Info table for this ACPI table
782 *
783 * RETURN: Status
784 *
785 * DESCRIPTION: Display ACPI table contents by walking the Info table.
786 *
787 * Note: This function must remain in sync with DtGetFieldLength.
788 *
789 ******************************************************************************/
790
791 ACPI_STATUS
792 AcpiDmDumpTable (
793 UINT32 TableLength,
794 UINT32 TableOffset,
795 void *Table,
796 UINT32 SubtableLength,
797 ACPI_DMTABLE_INFO *Info)
798 {
799 UINT8 *Target;
800 UINT32 CurrentOffset;
801 UINT32 ByteLength;
802 UINT8 Temp8;
803 UINT16 Temp16;
804 UINT32 Temp32;
805 UINT64 Value;
806 const AH_TABLE *TableData;
807 const char *Name;
808 BOOLEAN LastOutputBlankLine = FALSE;
809 ACPI_STATUS Status;
810 char RepairedName[8];
811
812
813 if (!Info)
814 {
815 AcpiOsPrintf ("Display not implemented\n");
816 return (AE_NOT_IMPLEMENTED);
817 }
818
819 /* Walk entire Info table; Null name terminates */
820
821 for (; Info->Name; Info++)
822 {
823 /*
824 * Target points to the field within the ACPI Table. CurrentOffset is
825 * the offset of the field from the start of the main table.
826 */
827 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
828 CurrentOffset = TableOffset + Info->Offset;
829
830 /* Check for beyond subtable end or (worse) beyond EOT */
831
832 if (SubtableLength && (Info->Offset >= SubtableLength))
833 {
834 AcpiOsPrintf (
835 "/**** ACPI subtable terminates early - "
836 "may be older version (dump table) */\n");
837
838 /* Move on to next subtable */
839
840 return (AE_OK);
841 }
842
843 if (CurrentOffset >= TableLength)
844 {
845 AcpiOsPrintf (
846 "/**** ACPI table terminates "
847 "in the middle of a data structure! (dump table) */\n");
848 return (AE_BAD_DATA);
849 }
850
851 /* Generate the byte length for this field */
852
853 switch (Info->Opcode)
854 {
855 case ACPI_DMT_UINT8:
856 case ACPI_DMT_CHKSUM:
857 case ACPI_DMT_SPACEID:
858 case ACPI_DMT_ACCWIDTH:
859 case ACPI_DMT_CEDT:
860 case ACPI_DMT_IVRS:
861 case ACPI_DMT_GTDT:
862 case ACPI_DMT_MADT:
863 case ACPI_DMT_PCCT:
864 case ACPI_DMT_PMTT:
865 case ACPI_DMT_PPTT:
866 case ACPI_DMT_SDEV:
867 case ACPI_DMT_SRAT:
868 case ACPI_DMT_ASF:
869 case ACPI_DMT_HESTNTYP:
870 case ACPI_DMT_FADTPM:
871 case ACPI_DMT_EINJACT:
872 case ACPI_DMT_EINJINST:
873 case ACPI_DMT_ERSTACT:
874 case ACPI_DMT_ERSTINST:
875 case ACPI_DMT_DMAR_SCOPE:
876 case ACPI_DMT_VIOT:
877
878 ByteLength = 1;
879 break;
880
881 case ACPI_DMT_UINT16:
882 case ACPI_DMT_DMAR:
883 case ACPI_DMT_HEST:
884 case ACPI_DMT_HMAT:
885 case ACPI_DMT_NFIT:
886 case ACPI_DMT_PHAT:
887
888 ByteLength = 2;
889 break;
890
891 case ACPI_DMT_UINT24:
892
893 ByteLength = 3;
894 break;
895
896 case ACPI_DMT_UINT32:
897 case ACPI_DMT_NAME4:
898 case ACPI_DMT_SIG:
899 case ACPI_DMT_LPIT:
900 case ACPI_DMT_TPM2:
901
902 ByteLength = 4;
903 break;
904
905 case ACPI_DMT_UINT40:
906
907 ByteLength = 5;
908 break;
909
910 case ACPI_DMT_UINT48:
911 case ACPI_DMT_NAME6:
912
913 ByteLength = 6;
914 break;
915
916 case ACPI_DMT_UINT56:
917 case ACPI_DMT_BUF7:
918
919 ByteLength = 7;
920 break;
921
922 case ACPI_DMT_UINT64:
923 case ACPI_DMT_NAME8:
924
925 ByteLength = 8;
926 break;
927
928 case ACPI_DMT_BUF10:
929
930 ByteLength = 10;
931 break;
932
933 case ACPI_DMT_BUF12:
934
935 ByteLength = 12;
936 break;
937
938 case ACPI_DMT_BUF16:
939 case ACPI_DMT_UUID:
940
941 ByteLength = 16;
942 break;
943
944 case ACPI_DMT_BUF128:
945
946 ByteLength = 128;
947 break;
948
949 case ACPI_DMT_UNICODE:
950 case ACPI_DMT_BUFFER:
951 case ACPI_DMT_RAW_BUFFER:
952
953 ByteLength = SubtableLength;
954 break;
955
956 case ACPI_DMT_PMTT_VENDOR:
957 /*
958 * Calculate the length of the vendor data for the PMTT table:
959 * Length = (Current Subtable ptr + Subtable length) -
960 * Start of the vendor data (Target)
961 */
962 ByteLength = ((ACPI_CAST_PTR (char, Table) +
963 (ACPI_CAST_PTR (ACPI_PMTT_HEADER, Table)->Length)) -
964 ACPI_CAST_PTR (char, Target));
965 break;
966
967 case ACPI_DMT_STRING:
968
969 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
970 break;
971
972 case ACPI_DMT_GAS:
973
974 if (!LastOutputBlankLine)
975 {
976 AcpiOsPrintf ("\n");
977 LastOutputBlankLine = TRUE;
978 }
979
980 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
981 break;
982
983 case ACPI_DMT_HESTNTFY:
984
985 if (!LastOutputBlankLine)
986 {
987 AcpiOsPrintf ("\n");
988 LastOutputBlankLine = TRUE;
989 }
990
991 ByteLength = sizeof (ACPI_HEST_NOTIFY);
992 break;
993
994 case ACPI_DMT_IORTMEM:
995
996 if (!LastOutputBlankLine)
997 {
998 LastOutputBlankLine = FALSE;
999 }
1000
1001 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
1002 break;
1003
1004 default:
1005
1006 ByteLength = 0;
1007 break;
1008 }
1009
1010 /* Check if we are beyond a subtable, or (worse) beyond EOT */
1011
1012 if (CurrentOffset + ByteLength > TableLength)
1013 {
1014 if (SubtableLength)
1015 {
1016 AcpiOsPrintf (
1017 "/**** ACPI subtable terminates early - "
1018 "may be older version (dump table) */\n");
1019
1020 /* Move on to next subtable */
1021
1022 return (AE_OK);
1023 }
1024
1025 AcpiOsPrintf (
1026 "/**** ACPI table terminates "
1027 "in the middle of a data structure! */\n");
1028 return (AE_BAD_DATA);
1029 }
1030
1031 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
1032 {
1033 AcpiOsPrintf ("%s", Info->Name);
1034 continue;
1035 }
1036
1037 /* Start a new line and decode the opcode */
1038
1039 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
1040
1041 switch (Info->Opcode)
1042 {
1043 /* Single-bit Flag fields. Note: Opcode is the bit position */
1044
1045 case ACPI_DMT_FLAG0:
1046 case ACPI_DMT_FLAG1:
1047 case ACPI_DMT_FLAG2:
1048 case ACPI_DMT_FLAG3:
1049 case ACPI_DMT_FLAG4:
1050 case ACPI_DMT_FLAG5:
1051 case ACPI_DMT_FLAG6:
1052 case ACPI_DMT_FLAG7:
1053
1054 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1055 break;
1056
1057 /* 2-bit Flag fields */
1058
1059 case ACPI_DMT_FLAGS0:
1060
1061 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1062 break;
1063
1064 case ACPI_DMT_FLAGS1:
1065
1066 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1067 break;
1068
1069 case ACPI_DMT_FLAGS2:
1070
1071 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1072 break;
1073
1074 case ACPI_DMT_FLAGS4:
1075
1076 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1077 break;
1078
1079 case ACPI_DMT_FLAGS4_0:
1080
1081 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F);
1082 break;
1083
1084 case ACPI_DMT_FLAGS4_4:
1085
1086 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F);
1087 break;
1088
1089 case ACPI_DMT_FLAGS4_8:
1090
1091 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F);
1092 break;
1093
1094 case ACPI_DMT_FLAGS4_12:
1095
1096 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F);
1097 break;
1098
1099 case ACPI_DMT_FLAGS16_16:
1100
1101 AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF);
1102 break;
1103
1104 /* Integer Data Types */
1105
1106 case ACPI_DMT_UINT8:
1107 case ACPI_DMT_UINT16:
1108 case ACPI_DMT_UINT24:
1109 case ACPI_DMT_UINT32:
1110 case ACPI_DMT_UINT40:
1111 case ACPI_DMT_UINT48:
1112 case ACPI_DMT_UINT56:
1113 case ACPI_DMT_UINT64:
1114 /*
1115 * Dump bytes - high byte first, low byte last.
1116 * Note: All ACPI tables are little-endian.
1117 */
1118 Value = 0;
1119 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1120 {
1121 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1122 Value |= Target[Temp8 - 1];
1123 Value <<= 8;
1124 }
1125
1126 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1127 {
1128 AcpiOsPrintf (" [Optional field not present]");
1129 }
1130
1131 AcpiOsPrintf ("\n");
1132 break;
1133
1134 case ACPI_DMT_BUF7:
1135 case ACPI_DMT_BUF10:
1136 case ACPI_DMT_BUF12:
1137 case ACPI_DMT_BUF16:
1138 case ACPI_DMT_BUF128:
1139 /*
1140 * Buffer: Size depends on the opcode and was set above.
1141 * Each hex byte is separated with a space.
1142 * Multiple lines are separated by line continuation char.
1143 */
1144 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1145 {
1146 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1147 if ((UINT32) (Temp16 + 1) < ByteLength)
1148 {
1149 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1150 {
1151 AcpiOsPrintf (" \\\n"); /* Line continuation */
1152 AcpiDmLineHeader (0, 0, NULL);
1153 }
1154 else
1155 {
1156 AcpiOsPrintf (" ");
1157 }
1158 }
1159 }
1160
1161 AcpiOsPrintf ("\n");
1162 break;
1163
1164 case ACPI_DMT_UUID:
1165
1166 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1167
1168 (void) AuConvertUuidToString ((char *) Target, AslGbl_MsgBuffer);
1169
1170 AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer);
1171 break;
1172
1173 case ACPI_DMT_STRING:
1174
1175 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1176 break;
1177
1178 /* Fixed length ASCII name fields */
1179
1180 case ACPI_DMT_SIG:
1181
1182 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1183 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1184
1185 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1186 if (TableData)
1187 {
1188 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1189 }
1190 else
1191 {
1192 AcpiOsPrintf ("\n");
1193 }
1194 break;
1195
1196 case ACPI_DMT_NAME4:
1197
1198 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1199 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1200 break;
1201
1202 case ACPI_DMT_NAME6:
1203
1204 AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1205 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1206 break;
1207
1208 case ACPI_DMT_NAME8:
1209
1210 AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1211 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1212 break;
1213
1214 /* Special Data Types */
1215
1216 case ACPI_DMT_CHKSUM:
1217
1218 /* Checksum, display and validate */
1219
1220 AcpiOsPrintf ("%2.2X", *Target);
1221 Temp8 = AcpiDmGenerateChecksum (Table,
1222 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1223 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1224
1225 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1226 {
1227 AcpiOsPrintf (
1228 " /* Incorrect checksum, should be %2.2X */", Temp8);
1229 }
1230
1231 AcpiOsPrintf ("\n");
1232 break;
1233
1234 case ACPI_DMT_SPACEID:
1235
1236 /* Address Space ID */
1237
1238 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1239 break;
1240
1241 case ACPI_DMT_ACCWIDTH:
1242
1243 /* Encoded Access Width */
1244
1245 Temp8 = *Target;
1246 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1247 {
1248 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1249 }
1250
1251 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1252 break;
1253
1254 case ACPI_DMT_GAS:
1255
1256 /* Generic Address Structure */
1257
1258 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1259 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1260 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1261 if (ACPI_FAILURE (Status))
1262 {
1263 return (Status);
1264 }
1265
1266 AcpiOsPrintf ("\n");
1267 LastOutputBlankLine = TRUE;
1268 break;
1269
1270 case ACPI_DMT_ASF:
1271
1272 /* ASF subtable types */
1273
1274 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1275 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1276 {
1277 Temp16 = ACPI_ASF_TYPE_RESERVED;
1278 }
1279
1280 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1281 break;
1282
1283 case ACPI_DMT_CEDT:
1284
1285 /* CEDT subtable types */
1286
1287 Temp8 = *Target;
1288 if (Temp8 > ACPI_CEDT_TYPE_RESERVED)
1289 {
1290 Temp8 = ACPI_CEDT_TYPE_RESERVED;
1291 }
1292
1293 AcpiOsPrintf (UINT8_FORMAT, *Target,
1294 AcpiDmCedtSubnames[Temp8]);
1295 break;
1296
1297 case ACPI_DMT_DMAR:
1298
1299 /* DMAR subtable types */
1300
1301 Temp16 = ACPI_GET16 (Target);
1302 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1303 {
1304 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1305 }
1306
1307 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1308 AcpiDmDmarSubnames[Temp16]);
1309 break;
1310
1311 case ACPI_DMT_DMAR_SCOPE:
1312
1313 /* DMAR device scope types */
1314
1315 Temp8 = *Target;
1316 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1317 {
1318 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1319 }
1320
1321 AcpiOsPrintf (UINT8_FORMAT, *Target,
1322 AcpiDmDmarScope[Temp8]);
1323 break;
1324
1325 case ACPI_DMT_EINJACT:
1326
1327 /* EINJ Action types */
1328
1329 Temp8 = *Target;
1330 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1331 {
1332 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1333 }
1334
1335 AcpiOsPrintf (UINT8_FORMAT, *Target,
1336 AcpiDmEinjActions[Temp8]);
1337 break;
1338
1339 case ACPI_DMT_EINJINST:
1340
1341 /* EINJ Instruction types */
1342
1343 Temp8 = *Target;
1344 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1345 {
1346 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1347 }
1348
1349 AcpiOsPrintf (UINT8_FORMAT, *Target,
1350 AcpiDmEinjInstructions[Temp8]);
1351 break;
1352
1353 case ACPI_DMT_ERSTACT:
1354
1355 /* ERST Action types */
1356
1357 Temp8 = *Target;
1358 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1359 {
1360 Temp8 = ACPI_ERST_ACTION_RESERVED;
1361 }
1362
1363 AcpiOsPrintf (UINT8_FORMAT, *Target,
1364 AcpiDmErstActions[Temp8]);
1365 break;
1366
1367 case ACPI_DMT_ERSTINST:
1368
1369 /* ERST Instruction types */
1370
1371 Temp8 = *Target;
1372 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1373 {
1374 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1375 }
1376
1377 AcpiOsPrintf (UINT8_FORMAT, *Target,
1378 AcpiDmErstInstructions[Temp8]);
1379 break;
1380
1381 case ACPI_DMT_GTDT:
1382
1383 /* GTDT subtable types */
1384
1385 Temp8 = *Target;
1386 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1387 {
1388 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1389 }
1390
1391 AcpiOsPrintf (UINT8_FORMAT, *Target,
1392 AcpiDmGtdtSubnames[Temp8]);
1393 break;
1394
1395 case ACPI_DMT_HEST:
1396
1397 /* HEST subtable types */
1398
1399 Temp16 = ACPI_GET16 (Target);
1400 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1401 {
1402 Temp16 = ACPI_HEST_TYPE_RESERVED;
1403 }
1404
1405 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1406 AcpiDmHestSubnames[Temp16]);
1407 break;
1408
1409 case ACPI_DMT_HESTNTFY:
1410
1411 AcpiOsPrintf (STRING_FORMAT,
1412 "Hardware Error Notification Structure");
1413
1414 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1415 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1416 if (ACPI_FAILURE (Status))
1417 {
1418 return (Status);
1419 }
1420
1421 AcpiOsPrintf ("\n");
1422 LastOutputBlankLine = TRUE;
1423 break;
1424
1425 case ACPI_DMT_HESTNTYP:
1426
1427 /* HEST Notify types */
1428
1429 Temp8 = *Target;
1430 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1431 {
1432 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1433 }
1434
1435 AcpiOsPrintf (UINT8_FORMAT, *Target,
1436 AcpiDmHestNotifySubnames[Temp8]);
1437 break;
1438
1439 case ACPI_DMT_HMAT:
1440
1441 /* HMAT subtable types */
1442
1443 Temp16 = *Target;
1444 if (Temp16 > ACPI_HMAT_TYPE_RESERVED)
1445 {
1446 Temp16 = ACPI_HMAT_TYPE_RESERVED;
1447 }
1448
1449 AcpiOsPrintf (UINT16_FORMAT, *Target,
1450 AcpiDmHmatSubnames[Temp16]);
1451 break;
1452
1453 case ACPI_DMT_IORTMEM:
1454
1455 AcpiOsPrintf (STRING_FORMAT,
1456 "IORT Memory Access Properties");
1457
1458 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1459 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1460 if (ACPI_FAILURE (Status))
1461 {
1462 return (Status);
1463 }
1464
1465 LastOutputBlankLine = TRUE;
1466 break;
1467
1468 case ACPI_DMT_MADT:
1469
1470 /* MADT subtable types */
1471
1472 Temp8 = *Target;
1473 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1474 {
1475 Temp8 = ACPI_MADT_TYPE_RESERVED;
1476 }
1477
1478 AcpiOsPrintf (UINT8_FORMAT, *Target,
1479 AcpiDmMadtSubnames[Temp8]);
1480 break;
1481
1482 case ACPI_DMT_NFIT:
1483
1484 /* NFIT subtable types */
1485
1486 Temp16 = ACPI_GET16 (Target);
1487 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1488 {
1489 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1490 }
1491
1492 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1493 AcpiDmNfitSubnames[Temp16]);
1494 break;
1495
1496 case ACPI_DMT_PCCT:
1497
1498 /* PCCT subtable types */
1499
1500 Temp8 = *Target;
1501 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1502 {
1503 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1504 }
1505
1506 AcpiOsPrintf (UINT8_FORMAT, *Target,
1507 AcpiDmPcctSubnames[Temp8]);
1508 break;
1509
1510 case ACPI_DMT_PHAT:
1511
1512 /* PMTT subtable types */
1513
1514 Temp16 = *Target;
1515 if (Temp16 > ACPI_PHAT_TYPE_RESERVED)
1516 {
1517 Temp16 = ACPI_PHAT_TYPE_RESERVED;
1518 }
1519
1520 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16(Target),
1521 AcpiDmPhatSubnames[Temp16]);
1522 break;
1523
1524 case ACPI_DMT_PMTT:
1525
1526 /* PMTT subtable types */
1527
1528 Temp8 = *Target;
1529 if (Temp8 == ACPI_PMTT_TYPE_VENDOR)
1530 {
1531 Temp8 = ACPI_PMTT_TYPE_RESERVED + 1;
1532 }
1533 else if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1534 {
1535 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1536 }
1537 AcpiOsPrintf (UINT8_FORMAT, *Target,
1538 AcpiDmPmttSubnames[Temp8]);
1539 break;
1540
1541 case ACPI_DMT_PPTT:
1542
1543 /* PPTT subtable types */
1544
1545 Temp8 = *Target;
1546 if (Temp8 > ACPI_PPTT_TYPE_RESERVED)
1547 {
1548 Temp8 = ACPI_PPTT_TYPE_RESERVED;
1549 }
1550
1551 AcpiOsPrintf (UINT8_FORMAT, *Target,
1552 AcpiDmPpttSubnames[Temp8]);
1553 break;
1554
1555 case ACPI_DMT_UNICODE:
1556
1557 if (ByteLength == 0)
1558 {
1559 AcpiOsPrintf ("/* Zero-length Data */\n");
1560 break;
1561 }
1562
1563 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1564 break;
1565
1566 case ACPI_DMT_RAW_BUFFER:
1567 case ACPI_DMT_BUFFER:
1568 case ACPI_DMT_PMTT_VENDOR:
1569
1570 if (ByteLength == 0)
1571 {
1572 AcpiOsPrintf ("/* Zero-length Data */\n");
1573 break;
1574 }
1575
1576 AcpiDmDumpBuffer (Target, 0, ByteLength, 0, NULL);
1577 break;
1578
1579 case ACPI_DMT_SDEV:
1580
1581 /* SDEV subtable types */
1582
1583 Temp8 = *Target;
1584 if (Temp8 > ACPI_SDEV_TYPE_RESERVED)
1585 {
1586 Temp8 = ACPI_SDEV_TYPE_RESERVED;
1587 }
1588
1589 AcpiOsPrintf (UINT8_FORMAT, *Target,
1590 AcpiDmSdevSubnames[Temp8]);
1591 break;
1592
1593 case ACPI_DMT_SRAT:
1594
1595 /* SRAT subtable types */
1596
1597 Temp8 = *Target;
1598 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1599 {
1600 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1601 }
1602
1603 AcpiOsPrintf (UINT8_FORMAT, *Target,
1604 AcpiDmSratSubnames[Temp8]);
1605 break;
1606
1607 case ACPI_DMT_TPM2:
1608
1609 /* TPM2 Start Method types */
1610
1611 Temp8 = *Target;
1612 if (Temp8 > ACPI_TPM2_RESERVED)
1613 {
1614 Temp8 = ACPI_TPM2_RESERVED;
1615 }
1616
1617 AcpiOsPrintf (UINT8_FORMAT, *Target,
1618 AcpiDmTpm2Subnames[Temp8]);
1619 break;
1620
1621
1622 case ACPI_DMT_FADTPM:
1623
1624 /* FADT Preferred PM Profile names */
1625
1626 Temp8 = *Target;
1627 if (Temp8 > ACPI_FADT_PM_RESERVED)
1628 {
1629 Temp8 = ACPI_FADT_PM_RESERVED;
1630 }
1631
1632 AcpiOsPrintf (UINT8_FORMAT, *Target,
1633 AcpiDmFadtProfiles[Temp8]);
1634 break;
1635
1636 case ACPI_DMT_IVRS:
1637
1638 /* IVRS subtable types */
1639
1640 Temp8 = *Target;
1641 switch (Temp8)
1642 {
1643 case ACPI_IVRS_TYPE_HARDWARE1:
1644 case ACPI_IVRS_TYPE_HARDWARE2:
1645 case ACPI_IVRS_TYPE_HARDWARE3:
1646
1647 Name = AcpiDmIvrsSubnames[0];
1648 break;
1649
1650 case ACPI_IVRS_TYPE_MEMORY1:
1651 case ACPI_IVRS_TYPE_MEMORY2:
1652 case ACPI_IVRS_TYPE_MEMORY3:
1653
1654 Name = AcpiDmIvrsSubnames[1];
1655 break;
1656
1657 default:
1658
1659 Name = AcpiDmIvrsSubnames[2];
1660 break;
1661 }
1662
1663 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1664 break;
1665
1666 case ACPI_DMT_LPIT:
1667
1668 /* LPIT subtable types */
1669
1670 Temp32 = ACPI_GET32 (Target);
1671 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1672 {
1673 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1674 }
1675
1676 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1677 AcpiDmLpitSubnames[Temp32]);
1678 break;
1679
1680 case ACPI_DMT_VIOT:
1681
1682 /* VIOT subtable types */
1683
1684 Temp8 = *Target;
1685 if (Temp8 > ACPI_VIOT_RESERVED)
1686 {
1687 Temp8 = ACPI_VIOT_RESERVED;
1688 }
1689
1690 AcpiOsPrintf (UINT8_FORMAT, *Target,
1691 AcpiDmViotSubnames[Temp8]);
1692 break;
1693
1694 case ACPI_DMT_EXIT:
1695
1696 return (AE_OK);
1697
1698 default:
1699
1700 ACPI_ERROR ((AE_INFO,
1701 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1702 return (AE_SUPPORT);
1703 }
1704 }
1705
1706 if (TableOffset && !SubtableLength)
1707 {
1708 /*
1709 * If this table is not the main table, the subtable must have a
1710 * valid length
1711 */
1712 AcpiOsPrintf ("Invalid zero length subtable\n");
1713 return (AE_BAD_DATA);
1714 }
1715
1716 return (AE_OK);
1717 }
1718