unittests: link libcppunit.so to the unittests directory
[haiku.git] / src / add-ons / kernel / bus_managers / acpi / acpica / common / dmtable.c
blobc301da100ae0be05ed0cda23f58c7c3626e59818
1 /******************************************************************************
3 * Module Name: dmtable - Support for ACPI tables that contain no AML code
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
12 * All rights reserved.
14 * 2. License
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
116 #include "acpi.h"
117 #include "accommon.h"
118 #include "acdisasm.h"
119 #include "actables.h"
120 #include "aslcompiler.h"
121 #include "dtcompiler.h"
123 /* This module used for application-level code only */
125 #define _COMPONENT ACPI_CA_DISASSEMBLER
126 ACPI_MODULE_NAME ("dmtable")
128 const AH_TABLE *
129 AcpiAhGetTableInfo (
130 char *Signature);
133 /* Local Prototypes */
135 static void
136 AcpiDmCheckAscii (
137 UINT8 *Target,
138 char *RepairedName,
139 UINT32 Count);
142 /* Common format strings for commented values */
144 #define UINT8_FORMAT "%2.2X [%s]\n"
145 #define UINT16_FORMAT "%4.4X [%s]\n"
146 #define UINT32_FORMAT "%8.8X [%s]\n"
147 #define STRING_FORMAT "[%s]\n"
149 /* These tables map a subtable type to a description string */
151 static const char *AcpiDmAsfSubnames[] =
153 "ASF Information",
154 "ASF Alerts",
155 "ASF Remote Control",
156 "ASF RMCP Boot Options",
157 "ASF Address",
158 "Unknown Subtable Type" /* Reserved */
161 static const char *AcpiDmDmarSubnames[] =
163 "Hardware Unit Definition",
164 "Reserved Memory Region",
165 "Root Port ATS Capability",
166 "Remapping Hardware Static Affinity",
167 "ACPI Namespace Device Declaration",
168 "Unknown Subtable Type" /* Reserved */
171 static const char *AcpiDmDmarScope[] =
173 "Reserved value",
174 "PCI Endpoint Device",
175 "PCI Bridge Device",
176 "IOAPIC Device",
177 "Message-capable HPET Device",
178 "Namespace Device",
179 "Unknown Scope Type" /* Reserved */
182 static const char *AcpiDmEinjActions[] =
184 "Begin Operation",
185 "Get Trigger Table",
186 "Set Error Type",
187 "Get Error Type",
188 "End Operation",
189 "Execute Operation",
190 "Check Busy Status",
191 "Get Command Status",
192 "Set Error Type With Address",
193 "Unknown Action"
196 static const char *AcpiDmEinjInstructions[] =
198 "Read Register",
199 "Read Register Value",
200 "Write Register",
201 "Write Register Value",
202 "Noop",
203 "Flush Cacheline",
204 "Unknown Instruction"
207 static const char *AcpiDmErstActions[] =
209 "Begin Write Operation",
210 "Begin Read Operation",
211 "Begin Clear Operation",
212 "End Operation",
213 "Set Record Offset",
214 "Execute Operation",
215 "Check Busy Status",
216 "Get Command Status",
217 "Get Record Identifier",
218 "Set Record Identifier",
219 "Get Record Count",
220 "Begin Dummy Write",
221 "Unused/Unknown Action",
222 "Get Error Address Range",
223 "Get Error Address Length",
224 "Get Error Attributes",
225 "Unknown Action"
228 static const char *AcpiDmErstInstructions[] =
230 "Read Register",
231 "Read Register Value",
232 "Write Register",
233 "Write Register Value",
234 "Noop",
235 "Load Var1",
236 "Load Var2",
237 "Store Var1",
238 "Add",
239 "Subtract",
240 "Add Value",
241 "Subtract Value",
242 "Stall",
243 "Stall While True",
244 "Skip Next If True",
245 "GoTo",
246 "Set Source Address",
247 "Set Destination Address",
248 "Move Data",
249 "Unknown Instruction"
252 static const char *AcpiDmGtdtSubnames[] =
254 "Generic Timer Block",
255 "Generic Watchdog Timer",
256 "Unknown Subtable Type" /* Reserved */
259 static const char *AcpiDmHestSubnames[] =
261 "IA-32 Machine Check Exception",
262 "IA-32 Corrected Machine Check",
263 "IA-32 Non-Maskable Interrupt",
264 "Unknown SubTable Type", /* 3 - Reserved */
265 "Unknown SubTable Type", /* 4 - Reserved */
266 "Unknown SubTable Type", /* 5 - Reserved */
267 "PCI Express Root Port AER",
268 "PCI Express AER (AER Endpoint)",
269 "PCI Express/PCI-X Bridge AER",
270 "Generic Hardware Error Source",
271 "Unknown Subtable Type" /* Reserved */
274 static const char *AcpiDmHestNotifySubnames[] =
276 "Polled",
277 "External Interrupt",
278 "Local Interrupt",
279 "SCI",
280 "NMI",
281 "CMCI", /* ACPI 5.0 */
282 "MCE", /* ACPI 5.0 */
283 "Unknown Notify Type" /* Reserved */
286 static const char *AcpiDmMadtSubnames[] =
288 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
289 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
290 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
291 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
292 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
293 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
294 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
295 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
296 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
297 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
298 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
299 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
300 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
301 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
302 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
303 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
304 "Unknown Subtable Type" /* Reserved */
307 static const char *AcpiDmNfitSubnames[] =
309 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
310 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */
311 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */
312 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */
313 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
314 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
315 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
316 "Unknown Subtable Type" /* Reserved */
319 static const char *AcpiDmPcctSubnames[] =
321 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
322 "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
323 "Unknown Subtable Type" /* Reserved */
326 static const char *AcpiDmPmttSubnames[] =
328 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
329 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
330 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
331 "Unknown Subtable Type" /* Reserved */
334 static const char *AcpiDmSratSubnames[] =
336 "Processor Local APIC/SAPIC Affinity",
337 "Memory Affinity",
338 "Processor Local x2APIC Affinity",
339 "GICC Affinity",
340 "Unknown Subtable Type" /* Reserved */
343 static const char *AcpiDmIvrsSubnames[] =
345 "Hardware Definition Block",
346 "Memory Definition Block",
347 "Unknown Subtable Type" /* Reserved */
350 static const char *AcpiDmLpitSubnames[] =
352 "Native C-state Idle Structure",
353 "Unknown Subtable Type" /* Reserved */
356 #define ACPI_FADT_PM_RESERVED 9
358 static const char *AcpiDmFadtProfiles[] =
360 "Unspecified",
361 "Desktop",
362 "Mobile",
363 "Workstation",
364 "Enterprise Server",
365 "SOHO Server",
366 "Appliance PC",
367 "Performance Server",
368 "Tablet",
369 "Unknown Profile Type"
372 #define ACPI_GAS_WIDTH_RESERVED 5
374 static const char *AcpiDmGasAccessWidth[] =
376 "Undefined/Legacy",
377 "Byte Access:8",
378 "Word Access:16",
379 "DWord Access:32",
380 "QWord Access:64",
381 "Unknown Width Encoding"
385 /*******************************************************************************
387 * ACPI Table Data, indexed by signature.
389 * Each entry contains: Signature, Table Info, Handler, DtHandler,
390 * Template, Description
392 * Simple tables have only a TableInfo structure, complex tables have a
393 * handler. This table must be NULL terminated. RSDP and FACS are
394 * special-cased elsewhere.
396 * Note: Any tables added here should be duplicated within AcpiSupportedTables
397 * in the file common/ahtable.c
399 ******************************************************************************/
401 const ACPI_DMTABLE_DATA AcpiDmTableData[] =
403 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf},
404 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
405 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
406 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
407 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
408 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
409 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2},
410 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp},
411 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar},
412 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm},
413 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt},
414 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj},
415 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst},
416 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt},
417 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt},
418 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt},
419 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest},
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_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
431 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
432 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
433 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
434 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
435 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
436 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
437 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
438 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
439 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
440 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
441 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
442 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
443 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
444 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
445 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
446 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
447 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
448 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat},
449 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt},
450 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt},
451 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt},
452 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv},
453 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt},
454 {NULL, NULL, NULL, NULL, NULL}
458 /*******************************************************************************
460 * FUNCTION: AcpiDmGenerateChecksum
462 * PARAMETERS: Table - Pointer to table to be checksummed
463 * Length - Length of the table
464 * OriginalChecksum - Value of the checksum field
466 * RETURN: 8 bit checksum of buffer
468 * DESCRIPTION: Computes an 8 bit checksum of the table.
470 ******************************************************************************/
472 UINT8
473 AcpiDmGenerateChecksum (
474 void *Table,
475 UINT32 Length,
476 UINT8 OriginalChecksum)
478 UINT8 Checksum;
481 /* Sum the entire table as-is */
483 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
485 /* Subtract off the existing checksum value in the table */
487 Checksum = (UINT8) (Checksum - OriginalChecksum);
489 /* Compute the final checksum */
491 Checksum = (UINT8) (0 - Checksum);
492 return (Checksum);
496 /*******************************************************************************
498 * FUNCTION: AcpiDmGetTableData
500 * PARAMETERS: Signature - ACPI signature (4 chars) to match
502 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
504 * DESCRIPTION: Find a match in the global table of supported ACPI tables
506 ******************************************************************************/
508 const ACPI_DMTABLE_DATA *
509 AcpiDmGetTableData (
510 char *Signature)
512 const ACPI_DMTABLE_DATA *Info;
515 for (Info = AcpiDmTableData; Info->Signature; Info++)
517 if (ACPI_COMPARE_NAME (Signature, Info->Signature))
519 return (Info);
523 return (NULL);
527 /*******************************************************************************
529 * FUNCTION: AcpiDmDumpDataTable
531 * PARAMETERS: Table - An ACPI table
533 * RETURN: None.
535 * DESCRIPTION: Format the contents of an ACPI data table (any table other
536 * than an SSDT or DSDT that does not contain executable AML code)
538 ******************************************************************************/
540 void
541 AcpiDmDumpDataTable (
542 ACPI_TABLE_HEADER *Table)
544 ACPI_STATUS Status;
545 const ACPI_DMTABLE_DATA *TableData;
546 UINT32 Length;
549 /* Ignore tables that contain AML */
551 if (AcpiUtIsAmlTable (Table))
553 if (Gbl_VerboseTemplates)
555 /* Dump the raw table data */
557 Length = Table->Length;
559 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
560 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
561 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
562 Length, DB_BYTE_DISPLAY, 0);
563 AcpiOsPrintf (" */\n");
565 return;
569 * Handle tables that don't use the common ACPI table header structure.
570 * Currently, these are the FACS, RSDP, and S3PT.
572 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
574 Length = Table->Length;
575 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
576 if (ACPI_FAILURE (Status))
578 return;
581 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
583 Length = AcpiDmDumpRsdp (Table);
585 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
587 Length = AcpiDmDumpS3pt (Table);
589 else
592 * All other tables must use the common ACPI table header, dump it now
594 Length = Table->Length;
595 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
596 if (ACPI_FAILURE (Status))
598 return;
600 AcpiOsPrintf ("\n");
602 /* Match signature and dispatch appropriately */
604 TableData = AcpiDmGetTableData (Table->Signature);
605 if (!TableData)
607 if (!strncmp (Table->Signature, "OEM", 3))
609 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
610 Table->Signature);
612 else
614 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
615 Table->Signature);
617 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
618 Table->Signature);
620 if (!AcpiGbl_ForceAmlDisassembly)
622 fprintf (stderr, "decoding ACPI table header only\n");
624 else
626 fprintf (stderr, "assuming table contains valid AML code\n");
630 else if (TableData->TableHandler)
632 /* Complex table, has a handler */
634 TableData->TableHandler (Table);
636 else if (TableData->TableInfo)
638 /* Simple table, just walk the info table */
640 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
641 if (ACPI_FAILURE (Status))
643 return;
648 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
650 /* Dump the raw table data */
652 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
653 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
654 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
655 Length, DB_BYTE_DISPLAY, 0);
660 /*******************************************************************************
662 * FUNCTION: AcpiDmLineHeader
664 * PARAMETERS: Offset - Current byte offset, from table start
665 * ByteLength - Length of the field in bytes, 0 for flags
666 * Name - Name of this field
668 * RETURN: None
670 * DESCRIPTION: Utility routines for formatting output lines. Displays the
671 * current table offset in hex and decimal, the field length,
672 * and the field name.
674 ******************************************************************************/
676 void
677 AcpiDmLineHeader (
678 UINT32 Offset,
679 UINT32 ByteLength,
680 char *Name)
683 /* Allow a null name for fields that span multiple lines (large buffers) */
685 if (!Name)
687 Name = "";
690 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
692 if (ByteLength)
694 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
696 else
698 if (*Name)
700 AcpiOsPrintf ("%41s : ", Name);
702 else
704 AcpiOsPrintf ("%41s ", Name);
708 else /* Normal disassembler or verbose template */
710 if (ByteLength)
712 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
713 Offset, Offset, ByteLength, Name);
715 else
717 if (*Name)
719 AcpiOsPrintf ("%44s : ", Name);
721 else
723 AcpiOsPrintf ("%44s ", Name);
729 void
730 AcpiDmLineHeader2 (
731 UINT32 Offset,
732 UINT32 ByteLength,
733 char *Name,
734 UINT32 Value)
737 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
739 if (ByteLength)
741 AcpiOsPrintf ("[%.4d] %30s %3d : ",
742 ByteLength, Name, Value);
744 else
746 AcpiOsPrintf ("%36s % 3d : ",
747 Name, Value);
750 else /* Normal disassembler or verbose template */
752 if (ByteLength)
754 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
755 Offset, Offset, ByteLength, Name, Value);
757 else
759 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
760 Offset, Offset, Name, Value);
766 /*******************************************************************************
768 * FUNCTION: AcpiDmDumpTable
770 * PARAMETERS: TableLength - Length of the entire ACPI table
771 * TableOffset - Starting offset within the table for this
772 * sub-descriptor (0 if main table)
773 * Table - The ACPI table
774 * SubtableLength - Length of this sub-descriptor
775 * Info - Info table for this ACPI table
777 * RETURN: Status
779 * DESCRIPTION: Display ACPI table contents by walking the Info table.
781 * Note: This function must remain in sync with DtGetFieldLength.
783 ******************************************************************************/
785 ACPI_STATUS
786 AcpiDmDumpTable (
787 UINT32 TableLength,
788 UINT32 TableOffset,
789 void *Table,
790 UINT32 SubtableLength,
791 ACPI_DMTABLE_INFO *Info)
793 UINT8 *Target;
794 UINT32 CurrentOffset;
795 UINT32 ByteLength;
796 UINT8 Temp8;
797 UINT16 Temp16;
798 UINT32 Temp32;
799 UINT64 Value;
800 const AH_TABLE *TableData;
801 const char *Name;
802 BOOLEAN LastOutputBlankLine = FALSE;
803 ACPI_STATUS Status;
804 char RepairedName[8];
807 if (!Info)
809 AcpiOsPrintf ("Display not implemented\n");
810 return (AE_NOT_IMPLEMENTED);
813 /* Walk entire Info table; Null name terminates */
815 for (; Info->Name; Info++)
818 * Target points to the field within the ACPI Table. CurrentOffset is
819 * the offset of the field from the start of the main table.
821 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
822 CurrentOffset = TableOffset + Info->Offset;
824 /* Check for beyond subtable end or (worse) beyond EOT */
826 if (SubtableLength && (Info->Offset >= SubtableLength))
828 AcpiOsPrintf (
829 "/**** ACPI subtable terminates early - "
830 "may be older version (dump table) */\n");
832 /* Move on to next subtable */
834 return (AE_OK);
837 if (CurrentOffset >= TableLength)
839 AcpiOsPrintf (
840 "/**** ACPI table terminates "
841 "in the middle of a data structure! (dump table) */\n");
842 return (AE_BAD_DATA);
845 /* Generate the byte length for this field */
847 switch (Info->Opcode)
849 case ACPI_DMT_UINT8:
850 case ACPI_DMT_CHKSUM:
851 case ACPI_DMT_SPACEID:
852 case ACPI_DMT_ACCWIDTH:
853 case ACPI_DMT_IVRS:
854 case ACPI_DMT_GTDT:
855 case ACPI_DMT_MADT:
856 case ACPI_DMT_PCCT:
857 case ACPI_DMT_PMTT:
858 case ACPI_DMT_SRAT:
859 case ACPI_DMT_ASF:
860 case ACPI_DMT_HESTNTYP:
861 case ACPI_DMT_FADTPM:
862 case ACPI_DMT_EINJACT:
863 case ACPI_DMT_EINJINST:
864 case ACPI_DMT_ERSTACT:
865 case ACPI_DMT_ERSTINST:
866 case ACPI_DMT_DMAR_SCOPE:
868 ByteLength = 1;
869 break;
871 case ACPI_DMT_UINT16:
872 case ACPI_DMT_DMAR:
873 case ACPI_DMT_HEST:
874 case ACPI_DMT_NFIT:
876 ByteLength = 2;
877 break;
879 case ACPI_DMT_UINT24:
881 ByteLength = 3;
882 break;
884 case ACPI_DMT_UINT32:
885 case ACPI_DMT_NAME4:
886 case ACPI_DMT_SIG:
887 case ACPI_DMT_LPIT:
889 ByteLength = 4;
890 break;
892 case ACPI_DMT_UINT40:
894 ByteLength = 5;
895 break;
897 case ACPI_DMT_UINT48:
898 case ACPI_DMT_NAME6:
900 ByteLength = 6;
901 break;
903 case ACPI_DMT_UINT56:
904 case ACPI_DMT_BUF7:
906 ByteLength = 7;
907 break;
909 case ACPI_DMT_UINT64:
910 case ACPI_DMT_NAME8:
912 ByteLength = 8;
913 break;
915 case ACPI_DMT_BUF10:
917 ByteLength = 10;
918 break;
920 case ACPI_DMT_BUF16:
921 case ACPI_DMT_UUID:
923 ByteLength = 16;
924 break;
926 case ACPI_DMT_BUF128:
928 ByteLength = 128;
929 break;
931 case ACPI_DMT_UNICODE:
932 case ACPI_DMT_BUFFER:
933 case ACPI_DMT_RAW_BUFFER:
935 ByteLength = SubtableLength;
936 break;
938 case ACPI_DMT_STRING:
940 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
941 break;
943 case ACPI_DMT_GAS:
945 if (!LastOutputBlankLine)
947 AcpiOsPrintf ("\n");
948 LastOutputBlankLine = TRUE;
950 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
951 break;
953 case ACPI_DMT_HESTNTFY:
955 if (!LastOutputBlankLine)
957 AcpiOsPrintf ("\n");
958 LastOutputBlankLine = TRUE;
960 ByteLength = sizeof (ACPI_HEST_NOTIFY);
961 break;
963 case ACPI_DMT_IORTMEM:
965 if (!LastOutputBlankLine)
967 LastOutputBlankLine = FALSE;
969 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
970 break;
972 default:
974 ByteLength = 0;
975 break;
978 /* Check if we are beyond a subtable, or (worse) beyond EOT */
980 if (CurrentOffset + ByteLength > TableLength)
982 if (SubtableLength)
984 AcpiOsPrintf (
985 "/**** ACPI subtable terminates early - "
986 "may be older version (dump table) */\n");
988 /* Move on to next subtable */
990 return (AE_OK);
993 AcpiOsPrintf (
994 "/**** ACPI table terminates "
995 "in the middle of a data structure! */\n");
996 return (AE_BAD_DATA);
999 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
1001 AcpiOsPrintf ("%s", Info->Name);
1002 continue;
1005 /* Start a new line and decode the opcode */
1007 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
1009 switch (Info->Opcode)
1011 /* Single-bit Flag fields. Note: Opcode is the bit position */
1013 case ACPI_DMT_FLAG0:
1014 case ACPI_DMT_FLAG1:
1015 case ACPI_DMT_FLAG2:
1016 case ACPI_DMT_FLAG3:
1017 case ACPI_DMT_FLAG4:
1018 case ACPI_DMT_FLAG5:
1019 case ACPI_DMT_FLAG6:
1020 case ACPI_DMT_FLAG7:
1022 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1023 break;
1025 /* 2-bit Flag fields */
1027 case ACPI_DMT_FLAGS0:
1029 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1030 break;
1032 case ACPI_DMT_FLAGS1:
1034 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1035 break;
1037 case ACPI_DMT_FLAGS2:
1039 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1040 break;
1042 case ACPI_DMT_FLAGS4:
1044 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1045 break;
1047 /* Integer Data Types */
1049 case ACPI_DMT_UINT8:
1050 case ACPI_DMT_UINT16:
1051 case ACPI_DMT_UINT24:
1052 case ACPI_DMT_UINT32:
1053 case ACPI_DMT_UINT40:
1054 case ACPI_DMT_UINT48:
1055 case ACPI_DMT_UINT56:
1056 case ACPI_DMT_UINT64:
1058 * Dump bytes - high byte first, low byte last.
1059 * Note: All ACPI tables are little-endian.
1061 Value = 0;
1062 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1064 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1065 Value |= Target[Temp8 - 1];
1066 Value <<= 8;
1069 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1071 AcpiOsPrintf (" [Optional field not present]");
1074 AcpiOsPrintf ("\n");
1075 break;
1077 case ACPI_DMT_BUF7:
1078 case ACPI_DMT_BUF10:
1079 case ACPI_DMT_BUF16:
1080 case ACPI_DMT_BUF128:
1082 * Buffer: Size depends on the opcode and was set above.
1083 * Each hex byte is separated with a space.
1084 * Multiple lines are separated by line continuation char.
1086 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1088 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1089 if ((UINT32) (Temp16 + 1) < ByteLength)
1091 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1093 AcpiOsPrintf (" \\\n"); /* Line continuation */
1094 AcpiDmLineHeader (0, 0, NULL);
1096 else
1098 AcpiOsPrintf (" ");
1102 AcpiOsPrintf ("\n");
1103 break;
1105 case ACPI_DMT_UUID:
1107 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1109 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1111 AcpiOsPrintf ("%s\n", MsgBuffer);
1112 break;
1114 case ACPI_DMT_STRING:
1116 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1117 break;
1119 /* Fixed length ASCII name fields */
1121 case ACPI_DMT_SIG:
1123 AcpiDmCheckAscii (Target, RepairedName, 4);
1124 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1125 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1126 if (TableData)
1128 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1130 else
1132 AcpiOsPrintf ("\n");
1134 break;
1136 case ACPI_DMT_NAME4:
1138 AcpiDmCheckAscii (Target, RepairedName, 4);
1139 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1140 break;
1142 case ACPI_DMT_NAME6:
1144 AcpiDmCheckAscii (Target, RepairedName, 6);
1145 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1146 break;
1148 case ACPI_DMT_NAME8:
1150 AcpiDmCheckAscii (Target, RepairedName, 8);
1151 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1152 break;
1154 /* Special Data Types */
1156 case ACPI_DMT_CHKSUM:
1158 /* Checksum, display and validate */
1160 AcpiOsPrintf ("%2.2X", *Target);
1161 Temp8 = AcpiDmGenerateChecksum (Table,
1162 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1163 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1165 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1167 AcpiOsPrintf (
1168 " /* Incorrect checksum, should be %2.2X */", Temp8);
1170 AcpiOsPrintf ("\n");
1171 break;
1173 case ACPI_DMT_SPACEID:
1175 /* Address Space ID */
1177 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1178 break;
1180 case ACPI_DMT_ACCWIDTH:
1182 /* Encoded Access Width */
1184 Temp8 = *Target;
1185 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1187 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1190 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1191 break;
1193 case ACPI_DMT_GAS:
1195 /* Generic Address Structure */
1197 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1198 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1199 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1200 if (ACPI_FAILURE (Status))
1202 return (Status);
1205 AcpiOsPrintf ("\n");
1206 LastOutputBlankLine = TRUE;
1207 break;
1209 case ACPI_DMT_ASF:
1211 /* ASF subtable types */
1213 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1214 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1216 Temp16 = ACPI_ASF_TYPE_RESERVED;
1219 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1220 break;
1222 case ACPI_DMT_DMAR:
1224 /* DMAR subtable types */
1226 Temp16 = ACPI_GET16 (Target);
1227 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1229 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1232 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1233 AcpiDmDmarSubnames[Temp16]);
1234 break;
1236 case ACPI_DMT_DMAR_SCOPE:
1238 /* DMAR device scope types */
1240 Temp8 = *Target;
1241 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1243 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1246 AcpiOsPrintf (UINT8_FORMAT, *Target,
1247 AcpiDmDmarScope[Temp8]);
1248 break;
1250 case ACPI_DMT_EINJACT:
1252 /* EINJ Action types */
1254 Temp8 = *Target;
1255 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1257 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1260 AcpiOsPrintf (UINT8_FORMAT, *Target,
1261 AcpiDmEinjActions[Temp8]);
1262 break;
1264 case ACPI_DMT_EINJINST:
1266 /* EINJ Instruction types */
1268 Temp8 = *Target;
1269 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1271 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1274 AcpiOsPrintf (UINT8_FORMAT, *Target,
1275 AcpiDmEinjInstructions[Temp8]);
1276 break;
1278 case ACPI_DMT_ERSTACT:
1280 /* ERST Action types */
1282 Temp8 = *Target;
1283 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1285 Temp8 = ACPI_ERST_ACTION_RESERVED;
1288 AcpiOsPrintf (UINT8_FORMAT, *Target,
1289 AcpiDmErstActions[Temp8]);
1290 break;
1292 case ACPI_DMT_ERSTINST:
1294 /* ERST Instruction types */
1296 Temp8 = *Target;
1297 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1299 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1302 AcpiOsPrintf (UINT8_FORMAT, *Target,
1303 AcpiDmErstInstructions[Temp8]);
1304 break;
1306 case ACPI_DMT_GTDT:
1308 /* GTDT subtable types */
1310 Temp8 = *Target;
1311 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1313 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1316 AcpiOsPrintf (UINT8_FORMAT, *Target,
1317 AcpiDmGtdtSubnames[Temp8]);
1318 break;
1320 case ACPI_DMT_HEST:
1322 /* HEST subtable types */
1324 Temp16 = ACPI_GET16 (Target);
1325 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1327 Temp16 = ACPI_HEST_TYPE_RESERVED;
1330 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1331 AcpiDmHestSubnames[Temp16]);
1332 break;
1334 case ACPI_DMT_HESTNTFY:
1336 AcpiOsPrintf (STRING_FORMAT,
1337 "Hardware Error Notification Structure");
1339 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1340 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1341 if (ACPI_FAILURE (Status))
1343 return (Status);
1346 AcpiOsPrintf ("\n");
1347 LastOutputBlankLine = TRUE;
1348 break;
1350 case ACPI_DMT_HESTNTYP:
1352 /* HEST Notify types */
1354 Temp8 = *Target;
1355 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1357 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1360 AcpiOsPrintf (UINT8_FORMAT, *Target,
1361 AcpiDmHestNotifySubnames[Temp8]);
1362 break;
1364 case ACPI_DMT_IORTMEM:
1366 AcpiOsPrintf (STRING_FORMAT,
1367 "IORT Memory Access Properties");
1369 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1370 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1371 if (ACPI_FAILURE (Status))
1373 return (Status);
1376 LastOutputBlankLine = TRUE;
1377 break;
1379 case ACPI_DMT_MADT:
1381 /* MADT subtable types */
1383 Temp8 = *Target;
1384 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1386 Temp8 = ACPI_MADT_TYPE_RESERVED;
1389 AcpiOsPrintf (UINT8_FORMAT, *Target,
1390 AcpiDmMadtSubnames[Temp8]);
1391 break;
1393 case ACPI_DMT_NFIT:
1395 /* NFIT subtable types */
1397 Temp16 = ACPI_GET16 (Target);
1398 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1400 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1403 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1404 AcpiDmNfitSubnames[Temp16]);
1405 break;
1407 case ACPI_DMT_PCCT:
1409 /* PCCT subtable types */
1411 Temp8 = *Target;
1412 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1414 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1417 AcpiOsPrintf (UINT8_FORMAT, *Target,
1418 AcpiDmPcctSubnames[Temp8]);
1419 break;
1421 case ACPI_DMT_PMTT:
1423 /* PMTT subtable types */
1425 Temp8 = *Target;
1426 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1428 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1431 AcpiOsPrintf (UINT8_FORMAT, *Target,
1432 AcpiDmPmttSubnames[Temp8]);
1433 break;
1435 case ACPI_DMT_UNICODE:
1437 if (ByteLength == 0)
1439 AcpiOsPrintf ("/* Zero-length Data */\n");
1440 break;
1443 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1444 break;
1446 case ACPI_DMT_RAW_BUFFER:
1448 if (ByteLength == 0)
1450 AcpiOsPrintf ("/* Zero-length Data */\n");
1451 break;
1454 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1455 CurrentOffset, NULL);
1456 break;
1458 case ACPI_DMT_SRAT:
1460 /* SRAT subtable types */
1462 Temp8 = *Target;
1463 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1465 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1468 AcpiOsPrintf (UINT8_FORMAT, *Target,
1469 AcpiDmSratSubnames[Temp8]);
1470 break;
1472 case ACPI_DMT_FADTPM:
1474 /* FADT Preferred PM Profile names */
1476 Temp8 = *Target;
1477 if (Temp8 > ACPI_FADT_PM_RESERVED)
1479 Temp8 = ACPI_FADT_PM_RESERVED;
1482 AcpiOsPrintf (UINT8_FORMAT, *Target,
1483 AcpiDmFadtProfiles[Temp8]);
1484 break;
1486 case ACPI_DMT_IVRS:
1488 /* IVRS subtable types */
1490 Temp8 = *Target;
1491 switch (Temp8)
1493 case ACPI_IVRS_TYPE_HARDWARE:
1495 Name = AcpiDmIvrsSubnames[0];
1496 break;
1498 case ACPI_IVRS_TYPE_MEMORY1:
1499 case ACPI_IVRS_TYPE_MEMORY2:
1500 case ACPI_IVRS_TYPE_MEMORY3:
1502 Name = AcpiDmIvrsSubnames[1];
1503 break;
1505 default:
1507 Name = AcpiDmIvrsSubnames[2];
1508 break;
1511 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1512 break;
1514 case ACPI_DMT_LPIT:
1516 /* LPIT subtable types */
1518 Temp32 = ACPI_GET32 (Target);
1519 if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1521 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1524 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1525 AcpiDmLpitSubnames[Temp32]);
1526 break;
1528 case ACPI_DMT_EXIT:
1530 return (AE_OK);
1532 default:
1534 ACPI_ERROR ((AE_INFO,
1535 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1536 return (AE_SUPPORT);
1540 if (TableOffset && !SubtableLength)
1543 * If this table is not the main table, the subtable must have a
1544 * valid length
1546 AcpiOsPrintf ("Invalid zero length subtable\n");
1547 return (AE_BAD_DATA);
1550 return (AE_OK);
1554 /*******************************************************************************
1556 * FUNCTION: AcpiDmCheckAscii
1558 * PARAMETERS: Name - Ascii string
1559 * Count - Number of characters to check
1561 * RETURN: None
1563 * DESCRIPTION: Ensure that the requested number of characters are printable
1564 * Ascii characters. Sets non-printable and null chars to <space>.
1566 ******************************************************************************/
1568 static void
1569 AcpiDmCheckAscii (
1570 UINT8 *Name,
1571 char *RepairedName,
1572 UINT32 Count)
1574 UINT32 i;
1577 for (i = 0; i < Count; i++)
1579 RepairedName[i] = (char) Name[i];
1581 if (!Name[i])
1583 return;
1585 if (!isprint (Name[i]))
1587 RepairedName[i] = ' ';