BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / bus_managers / acpi / acpica / common / dmtable.c
blobefb50b5603cbaa5365f9e72d232a5f88f5533141
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 - 2014, 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 /* Local Prototypes */
130 static void
131 AcpiDmCheckAscii (
132 UINT8 *Target,
133 char *RepairedName,
134 UINT32 Count);
137 /* Common format strings for commented values */
139 #define UINT8_FORMAT "%2.2X [%s]\n"
140 #define UINT16_FORMAT "%4.4X [%s]\n"
141 #define UINT32_FORMAT "%8.8X [%s]\n"
142 #define STRING_FORMAT "[%s]\n"
144 /* These tables map a subtable type to a description string */
146 static const char *AcpiDmAsfSubnames[] =
148 "ASF Information",
149 "ASF Alerts",
150 "ASF Remote Control",
151 "ASF RMCP Boot Options",
152 "ASF Address",
153 "Unknown SubTable Type" /* Reserved */
156 static const char *AcpiDmDmarSubnames[] =
158 "Hardware Unit Definition",
159 "Reserved Memory Region",
160 "Root Port ATS Capability",
161 "Remapping Hardware Static Affinity",
162 "ACPI Namespace Device Declaration",
163 "Unknown SubTable Type" /* Reserved */
166 static const char *AcpiDmDmarScope[] =
168 "Reserved value",
169 "PCI Endpoint Device",
170 "PCI Bridge Device",
171 "IOAPIC Device",
172 "Message-capable HPET Device",
173 "Namespace Device",
174 "Unknown Scope Type" /* Reserved */
177 static const char *AcpiDmEinjActions[] =
179 "Begin Operation",
180 "Get Trigger Table",
181 "Set Error Type",
182 "Get Error Type",
183 "End Operation",
184 "Execute Operation",
185 "Check Busy Status",
186 "Get Command Status",
187 "Set Error Type With Address",
188 "Unknown Action"
191 static const char *AcpiDmEinjInstructions[] =
193 "Read Register",
194 "Read Register Value",
195 "Write Register",
196 "Write Register Value",
197 "Noop",
198 "Flush Cacheline",
199 "Unknown Instruction"
202 static const char *AcpiDmErstActions[] =
204 "Begin Write Operation",
205 "Begin Read Operation",
206 "Begin Clear Operation",
207 "End Operation",
208 "Set Record Offset",
209 "Execute Operation",
210 "Check Busy Status",
211 "Get Command Status",
212 "Get Record Identifier",
213 "Set Record Identifier",
214 "Get Record Count",
215 "Begin Dummy Write",
216 "Unused/Unknown Action",
217 "Get Error Address Range",
218 "Get Error Address Length",
219 "Get Error Attributes",
220 "Unknown Action"
223 static const char *AcpiDmErstInstructions[] =
225 "Read Register",
226 "Read Register Value",
227 "Write Register",
228 "Write Register Value",
229 "Noop",
230 "Load Var1",
231 "Load Var2",
232 "Store Var1",
233 "Add",
234 "Subtract",
235 "Add Value",
236 "Subtract Value",
237 "Stall",
238 "Stall While True",
239 "Skip Next If True",
240 "GoTo",
241 "Set Source Address",
242 "Set Destination Address",
243 "Move Data",
244 "Unknown Instruction"
247 static const char *AcpiDmGtdtSubnames[] =
249 "Generic Timer Block",
250 "Generic Watchdog Timer",
251 "Unknown SubTable Type" /* Reserved */
254 static const char *AcpiDmHestSubnames[] =
256 "IA-32 Machine Check Exception",
257 "IA-32 Corrected Machine Check",
258 "IA-32 Non-Maskable Interrupt",
259 "Unknown SubTable Type", /* 3 - Reserved */
260 "Unknown SubTable Type", /* 4 - Reserved */
261 "Unknown SubTable Type", /* 5 - Reserved */
262 "PCI Express Root Port AER",
263 "PCI Express AER (AER Endpoint)",
264 "PCI Express/PCI-X Bridge AER",
265 "Generic Hardware Error Source",
266 "Unknown SubTable Type" /* Reserved */
269 static const char *AcpiDmHestNotifySubnames[] =
271 "Polled",
272 "External Interrupt",
273 "Local Interrupt",
274 "SCI",
275 "NMI",
276 "CMCI", /* ACPI 5.0 */
277 "MCE", /* ACPI 5.0 */
278 "Unknown Notify Type" /* Reserved */
281 static const char *AcpiDmMadtSubnames[] =
283 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
284 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
285 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
286 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
287 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
288 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
289 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
290 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
291 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
292 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
293 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
294 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */
295 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */
296 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */
297 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
298 "Unknown SubTable Type" /* Reserved */
301 static const char *AcpiDmPcctSubnames[] =
303 "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
304 "HW-Reduced Communications Subspace",
305 "Unknown SubTable Type" /* Reserved */
308 static const char *AcpiDmPmttSubnames[] =
310 "Socket", /* ACPI_PMTT_TYPE_SOCKET */
311 "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
312 "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
313 "Unknown SubTable Type" /* Reserved */
316 static const char *AcpiDmSlicSubnames[] =
318 "Public Key Structure",
319 "Windows Marker Structure",
320 "Unknown SubTable Type" /* Reserved */
323 static const char *AcpiDmSratSubnames[] =
325 "Processor Local APIC/SAPIC Affinity",
326 "Memory Affinity",
327 "Processor Local x2APIC Affinity",
328 "Unknown SubTable Type" /* Reserved */
331 static const char *AcpiDmIvrsSubnames[] =
333 "Hardware Definition Block",
334 "Memory Definition Block",
335 "Unknown SubTable Type" /* Reserved */
338 static const char *AcpiDmLpitSubnames[] =
340 "Native C-state Idle Structure",
341 "Simple I/O Idle Structure",
342 "Unknown SubTable Type" /* Reserved */
345 #define ACPI_FADT_PM_RESERVED 9
347 static const char *AcpiDmFadtProfiles[] =
349 "Unspecified",
350 "Desktop",
351 "Mobile",
352 "Workstation",
353 "Enterprise Server",
354 "SOHO Server",
355 "Appliance PC",
356 "Performance Server",
357 "Tablet",
358 "Unknown Profile Type"
361 #define ACPI_GAS_WIDTH_RESERVED 5
363 static const char *AcpiDmGasAccessWidth[] =
365 "Undefined/Legacy",
366 "Byte Access:8",
367 "Word Access:16",
368 "DWord Access:32",
369 "QWord Access:64",
370 "Unknown Width Encoding"
374 /*******************************************************************************
376 * ACPI Table Data, indexed by signature.
378 * Each entry contains: Signature, Table Info, Handler, DtHandler,
379 * Template, Description
381 * Simple tables have only a TableInfo structure, complex tables have a
382 * handler. This table must be NULL terminated. RSDP and FACS are
383 * special-cased elsewhere.
385 ******************************************************************************/
387 ACPI_DMTABLE_DATA AcpiDmTableData[] =
389 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
390 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
391 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
392 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
393 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
394 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
395 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"},
396 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
397 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
398 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
399 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
400 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
401 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"},
402 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"},
403 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"},
404 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
405 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
406 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
407 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"},
408 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"},
409 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
410 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
411 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
412 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
413 {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"},
414 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"},
415 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
416 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
417 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"},
418 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"},
419 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"},
420 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"},
421 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"},
422 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
423 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
424 {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
425 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
426 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
427 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"},
428 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
429 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
430 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
431 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"},
432 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"},
433 {NULL, NULL, NULL, NULL, NULL, NULL}
437 /*******************************************************************************
439 * FUNCTION: AcpiDmGenerateChecksum
441 * PARAMETERS: Table - Pointer to table to be checksummed
442 * Length - Length of the table
443 * OriginalChecksum - Value of the checksum field
445 * RETURN: 8 bit checksum of buffer
447 * DESCRIPTION: Computes an 8 bit checksum of the table.
449 ******************************************************************************/
451 UINT8
452 AcpiDmGenerateChecksum (
453 void *Table,
454 UINT32 Length,
455 UINT8 OriginalChecksum)
457 UINT8 Checksum;
460 /* Sum the entire table as-is */
462 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
464 /* Subtract off the existing checksum value in the table */
466 Checksum = (UINT8) (Checksum - OriginalChecksum);
468 /* Compute the final checksum */
470 Checksum = (UINT8) (0 - Checksum);
471 return (Checksum);
475 /*******************************************************************************
477 * FUNCTION: AcpiDmGetTableData
479 * PARAMETERS: Signature - ACPI signature (4 chars) to match
481 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
483 * DESCRIPTION: Find a match in the global table of supported ACPI tables
485 ******************************************************************************/
487 ACPI_DMTABLE_DATA *
488 AcpiDmGetTableData (
489 char *Signature)
491 ACPI_DMTABLE_DATA *TableData;
494 for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
496 if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
498 return (TableData);
502 return (NULL);
506 /*******************************************************************************
508 * FUNCTION: AcpiDmDumpDataTable
510 * PARAMETERS: Table - An ACPI table
512 * RETURN: None.
514 * DESCRIPTION: Format the contents of an ACPI data table (any table other
515 * than an SSDT or DSDT that does not contain executable AML code)
517 ******************************************************************************/
519 void
520 AcpiDmDumpDataTable (
521 ACPI_TABLE_HEADER *Table)
523 ACPI_STATUS Status;
524 ACPI_DMTABLE_DATA *TableData;
525 UINT32 Length;
528 /* Ignore tables that contain AML */
530 if (AcpiUtIsAmlTable (Table))
532 if (Gbl_VerboseTemplates)
534 /* Dump the raw table data */
536 Length = Table->Length;
538 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
539 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
540 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
541 Length, DB_BYTE_DISPLAY, 0);
542 AcpiOsPrintf (" */\n");
544 return;
548 * Handle tables that don't use the common ACPI table header structure.
549 * Currently, these are the FACS, RSDP, and S3PT.
551 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
553 Length = Table->Length;
554 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
556 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
558 Length = AcpiDmDumpRsdp (Table);
560 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
562 Length = AcpiDmDumpS3pt (Table);
564 else
567 * All other tables must use the common ACPI table header, dump it now
569 Length = Table->Length;
570 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
571 if (ACPI_FAILURE (Status))
573 return;
575 AcpiOsPrintf ("\n");
577 /* Match signature and dispatch appropriately */
579 TableData = AcpiDmGetTableData (Table->Signature);
580 if (!TableData)
582 if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
584 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
585 Table->Signature);
587 else
589 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
590 Table->Signature);
591 fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
592 Table->Signature);
595 else if (TableData->TableHandler)
597 /* Complex table, has a handler */
599 TableData->TableHandler (Table);
601 else if (TableData->TableInfo)
603 /* Simple table, just walk the info table */
605 AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
609 if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
611 /* Dump the raw table data */
613 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
614 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
615 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
616 Length, DB_BYTE_DISPLAY, 0);
621 /*******************************************************************************
623 * FUNCTION: AcpiDmLineHeader
625 * PARAMETERS: Offset - Current byte offset, from table start
626 * ByteLength - Length of the field in bytes, 0 for flags
627 * Name - Name of this field
628 * Value - Optional value, displayed on left of ':'
630 * RETURN: None
632 * DESCRIPTION: Utility routines for formatting output lines. Displays the
633 * current table offset in hex and decimal, the field length,
634 * and the field name.
636 ******************************************************************************/
638 void
639 AcpiDmLineHeader (
640 UINT32 Offset,
641 UINT32 ByteLength,
642 char *Name)
645 /* Allow a null name for fields that span multiple lines (large buffers) */
647 if (!Name)
649 Name = "";
652 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
654 if (ByteLength)
656 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
658 else
660 if (*Name)
662 AcpiOsPrintf ("%41s : ", Name);
664 else
666 AcpiOsPrintf ("%41s ", Name);
670 else /* Normal disassembler or verbose template */
672 if (ByteLength)
674 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
675 Offset, Offset, ByteLength, Name);
677 else
679 if (*Name)
681 AcpiOsPrintf ("%44s : ", Name);
683 else
685 AcpiOsPrintf ("%44s ", Name);
691 void
692 AcpiDmLineHeader2 (
693 UINT32 Offset,
694 UINT32 ByteLength,
695 char *Name,
696 UINT32 Value)
699 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
701 if (ByteLength)
703 AcpiOsPrintf ("[%.4d] %30s %3d : ",
704 ByteLength, Name, Value);
706 else
708 AcpiOsPrintf ("%36s % 3d : ",
709 Name, Value);
712 else /* Normal disassembler or verbose template */
714 if (ByteLength)
716 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
717 Offset, Offset, ByteLength, Name, Value);
719 else
721 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
722 Offset, Offset, Name, Value);
728 /*******************************************************************************
730 * FUNCTION: AcpiDmDumpTable
732 * PARAMETERS: TableLength - Length of the entire ACPI table
733 * TableOffset - Starting offset within the table for this
734 * sub-descriptor (0 if main table)
735 * Table - The ACPI table
736 * SubtableLength - Length of this sub-descriptor
737 * Info - Info table for this ACPI table
739 * RETURN: None
741 * DESCRIPTION: Display ACPI table contents by walking the Info table.
743 * Note: This function must remain in sync with DtGetFieldLength.
745 ******************************************************************************/
747 ACPI_STATUS
748 AcpiDmDumpTable (
749 UINT32 TableLength,
750 UINT32 TableOffset,
751 void *Table,
752 UINT32 SubtableLength,
753 ACPI_DMTABLE_INFO *Info)
755 UINT8 *Target;
756 UINT32 CurrentOffset;
757 UINT32 ByteLength;
758 UINT8 Temp8;
759 UINT16 Temp16;
760 UINT64 Value;
761 ACPI_DMTABLE_DATA *TableData;
762 const char *Name;
763 BOOLEAN LastOutputBlankLine = FALSE;
764 char RepairedName[8];
767 if (!Info)
769 AcpiOsPrintf ("Display not implemented\n");
770 return (AE_NOT_IMPLEMENTED);
773 /* Walk entire Info table; Null name terminates */
775 for (; Info->Name; Info++)
778 * Target points to the field within the ACPI Table. CurrentOffset is
779 * the offset of the field from the start of the main table.
781 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
782 CurrentOffset = TableOffset + Info->Offset;
784 /* Check for beyond EOT or beyond subtable end */
786 if ((CurrentOffset >= TableLength) ||
787 (SubtableLength && (Info->Offset >= SubtableLength)))
789 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
790 return (AE_BAD_DATA);
793 /* Generate the byte length for this field */
795 switch (Info->Opcode)
797 case ACPI_DMT_UINT8:
798 case ACPI_DMT_CHKSUM:
799 case ACPI_DMT_SPACEID:
800 case ACPI_DMT_ACCWIDTH:
801 case ACPI_DMT_IVRS:
802 case ACPI_DMT_GTDT:
803 case ACPI_DMT_MADT:
804 case ACPI_DMT_PCCT:
805 case ACPI_DMT_PMTT:
806 case ACPI_DMT_SRAT:
807 case ACPI_DMT_ASF:
808 case ACPI_DMT_HESTNTYP:
809 case ACPI_DMT_FADTPM:
810 case ACPI_DMT_EINJACT:
811 case ACPI_DMT_EINJINST:
812 case ACPI_DMT_ERSTACT:
813 case ACPI_DMT_ERSTINST:
814 case ACPI_DMT_DMAR_SCOPE:
816 ByteLength = 1;
817 break;
819 case ACPI_DMT_UINT16:
820 case ACPI_DMT_DMAR:
821 case ACPI_DMT_HEST:
823 ByteLength = 2;
824 break;
826 case ACPI_DMT_UINT24:
828 ByteLength = 3;
829 break;
831 case ACPI_DMT_UINT32:
832 case ACPI_DMT_NAME4:
833 case ACPI_DMT_SIG:
834 case ACPI_DMT_SLIC:
835 case ACPI_DMT_LPIT:
837 ByteLength = 4;
838 break;
840 case ACPI_DMT_UINT40:
842 ByteLength = 5;
843 break;
845 case ACPI_DMT_UINT48:
846 case ACPI_DMT_NAME6:
848 ByteLength = 6;
849 break;
851 case ACPI_DMT_UINT56:
852 case ACPI_DMT_BUF7:
854 ByteLength = 7;
855 break;
857 case ACPI_DMT_UINT64:
858 case ACPI_DMT_NAME8:
860 ByteLength = 8;
861 break;
863 case ACPI_DMT_BUF10:
865 ByteLength = 10;
866 break;
868 case ACPI_DMT_BUF16:
869 case ACPI_DMT_UUID:
871 ByteLength = 16;
872 break;
874 case ACPI_DMT_BUF128:
876 ByteLength = 128;
877 break;
879 case ACPI_DMT_STRING:
881 ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
882 break;
884 case ACPI_DMT_GAS:
886 if (!LastOutputBlankLine)
888 AcpiOsPrintf ("\n");
889 LastOutputBlankLine = TRUE;
891 ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
892 break;
894 case ACPI_DMT_HESTNTFY:
896 if (!LastOutputBlankLine)
898 AcpiOsPrintf ("\n");
899 LastOutputBlankLine = TRUE;
901 ByteLength = sizeof (ACPI_HEST_NOTIFY);
902 break;
904 default:
906 ByteLength = 0;
907 break;
910 if (CurrentOffset + ByteLength > TableLength)
912 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
913 return (AE_BAD_DATA);
916 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
918 AcpiOsPrintf ("%s", Info->Name);
919 continue;
922 /* Start a new line and decode the opcode */
924 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
926 switch (Info->Opcode)
928 /* Single-bit Flag fields. Note: Opcode is the bit position */
930 case ACPI_DMT_FLAG0:
931 case ACPI_DMT_FLAG1:
932 case ACPI_DMT_FLAG2:
933 case ACPI_DMT_FLAG3:
934 case ACPI_DMT_FLAG4:
935 case ACPI_DMT_FLAG5:
936 case ACPI_DMT_FLAG6:
937 case ACPI_DMT_FLAG7:
939 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
940 break;
942 /* 2-bit Flag fields */
944 case ACPI_DMT_FLAGS0:
946 AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
947 break;
949 case ACPI_DMT_FLAGS1:
951 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
952 break;
954 case ACPI_DMT_FLAGS2:
956 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
957 break;
959 case ACPI_DMT_FLAGS4:
961 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
962 break;
964 /* Integer Data Types */
966 case ACPI_DMT_UINT8:
967 case ACPI_DMT_UINT16:
968 case ACPI_DMT_UINT24:
969 case ACPI_DMT_UINT32:
970 case ACPI_DMT_UINT40:
971 case ACPI_DMT_UINT48:
972 case ACPI_DMT_UINT56:
973 case ACPI_DMT_UINT64:
975 * Dump bytes - high byte first, low byte last.
976 * Note: All ACPI tables are little-endian.
978 Value = 0;
979 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
981 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
982 Value |= Target[Temp8 - 1];
983 Value <<= 8;
986 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
988 AcpiOsPrintf (" [Optional field not present]");
991 AcpiOsPrintf ("\n");
992 break;
994 case ACPI_DMT_BUF7:
995 case ACPI_DMT_BUF10:
996 case ACPI_DMT_BUF16:
997 case ACPI_DMT_BUF128:
999 * Buffer: Size depends on the opcode and was set above.
1000 * Each hex byte is separated with a space.
1001 * Multiple lines are separated by line continuation char.
1003 for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1005 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1006 if ((UINT32) (Temp16 + 1) < ByteLength)
1008 if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1010 AcpiOsPrintf (" \\\n"); /* Line continuation */
1011 AcpiDmLineHeader (0, 0, NULL);
1013 else
1015 AcpiOsPrintf (" ");
1019 AcpiOsPrintf ("\n");
1020 break;
1022 case ACPI_DMT_UUID:
1024 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1026 (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1028 AcpiOsPrintf ("%s\n", MsgBuffer);
1029 break;
1031 case ACPI_DMT_STRING:
1033 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1034 break;
1036 /* Fixed length ASCII name fields */
1038 case ACPI_DMT_SIG:
1040 AcpiDmCheckAscii (Target, RepairedName, 4);
1041 AcpiOsPrintf ("\"%.4s\" ", RepairedName);
1042 TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
1043 if (TableData)
1045 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
1047 else
1049 AcpiOsPrintf ("\n");
1051 break;
1053 case ACPI_DMT_NAME4:
1055 AcpiDmCheckAscii (Target, RepairedName, 4);
1056 AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1057 break;
1059 case ACPI_DMT_NAME6:
1061 AcpiDmCheckAscii (Target, RepairedName, 6);
1062 AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1063 break;
1065 case ACPI_DMT_NAME8:
1067 AcpiDmCheckAscii (Target, RepairedName, 8);
1068 AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1069 break;
1071 /* Special Data Types */
1073 case ACPI_DMT_CHKSUM:
1075 /* Checksum, display and validate */
1077 AcpiOsPrintf ("%2.2X", *Target);
1078 Temp8 = AcpiDmGenerateChecksum (Table,
1079 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1080 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1081 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1083 AcpiOsPrintf (
1084 " /* Incorrect checksum, should be %2.2X */", Temp8);
1086 AcpiOsPrintf ("\n");
1087 break;
1089 case ACPI_DMT_SPACEID:
1091 /* Address Space ID */
1093 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1094 break;
1096 case ACPI_DMT_ACCWIDTH:
1098 /* Encoded Access Width */
1100 Temp8 = *Target;
1101 if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1103 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1106 AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
1107 break;
1109 case ACPI_DMT_GAS:
1111 /* Generic Address Structure */
1113 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1114 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1115 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1116 AcpiOsPrintf ("\n");
1117 LastOutputBlankLine = TRUE;
1118 break;
1120 case ACPI_DMT_ASF:
1122 /* ASF subtable types */
1124 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
1125 if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1127 Temp16 = ACPI_ASF_TYPE_RESERVED;
1130 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1131 break;
1133 case ACPI_DMT_DMAR:
1135 /* DMAR subtable types */
1137 Temp16 = ACPI_GET16 (Target);
1138 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1140 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1143 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
1144 break;
1146 case ACPI_DMT_DMAR_SCOPE:
1148 /* DMAR device scope types */
1150 Temp8 = *Target;
1151 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1153 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1156 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmDmarScope[Temp8]);
1157 break;
1159 case ACPI_DMT_EINJACT:
1161 /* EINJ Action types */
1163 Temp8 = *Target;
1164 if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1166 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1169 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
1170 break;
1172 case ACPI_DMT_EINJINST:
1174 /* EINJ Instruction types */
1176 Temp8 = *Target;
1177 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1179 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1182 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
1183 break;
1185 case ACPI_DMT_ERSTACT:
1187 /* ERST Action types */
1189 Temp8 = *Target;
1190 if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1192 Temp8 = ACPI_ERST_ACTION_RESERVED;
1195 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
1196 break;
1198 case ACPI_DMT_ERSTINST:
1200 /* ERST Instruction types */
1202 Temp8 = *Target;
1203 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1205 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1208 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
1209 break;
1211 case ACPI_DMT_GTDT:
1213 /* GTDT subtable types */
1215 Temp8 = *Target;
1216 if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1218 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1221 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGtdtSubnames[Temp8]);
1222 break;
1224 case ACPI_DMT_HEST:
1226 /* HEST subtable types */
1228 Temp16 = ACPI_GET16 (Target);
1229 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1231 Temp16 = ACPI_HEST_TYPE_RESERVED;
1234 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
1235 break;
1237 case ACPI_DMT_HESTNTFY:
1239 AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
1240 AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1241 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1242 AcpiOsPrintf ("\n");
1243 LastOutputBlankLine = TRUE;
1244 break;
1246 case ACPI_DMT_HESTNTYP:
1248 /* HEST Notify types */
1250 Temp8 = *Target;
1251 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1253 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1256 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
1257 break;
1259 case ACPI_DMT_MADT:
1261 /* MADT subtable types */
1263 Temp8 = *Target;
1264 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1266 Temp8 = ACPI_MADT_TYPE_RESERVED;
1269 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
1270 break;
1272 case ACPI_DMT_PCCT:
1274 /* PCCT subtable types */
1276 Temp8 = *Target;
1277 if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1279 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1282 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPcctSubnames[Temp8]);
1283 break;
1285 case ACPI_DMT_PMTT:
1287 /* PMTT subtable types */
1289 Temp8 = *Target;
1290 if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1292 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1295 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
1296 break;
1298 case ACPI_DMT_SLIC:
1300 /* SLIC subtable types */
1302 Temp8 = *Target;
1303 if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
1305 Temp8 = ACPI_SLIC_TYPE_RESERVED;
1308 AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
1309 break;
1311 case ACPI_DMT_SRAT:
1313 /* SRAT subtable types */
1315 Temp8 = *Target;
1316 if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1318 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1321 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
1322 break;
1324 case ACPI_DMT_FADTPM:
1326 /* FADT Preferred PM Profile names */
1328 Temp8 = *Target;
1329 if (Temp8 > ACPI_FADT_PM_RESERVED)
1331 Temp8 = ACPI_FADT_PM_RESERVED;
1334 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
1335 break;
1337 case ACPI_DMT_IVRS:
1339 /* IVRS subtable types */
1341 Temp8 = *Target;
1342 switch (Temp8)
1344 case ACPI_IVRS_TYPE_HARDWARE:
1346 Name = AcpiDmIvrsSubnames[0];
1347 break;
1349 case ACPI_IVRS_TYPE_MEMORY1:
1350 case ACPI_IVRS_TYPE_MEMORY2:
1351 case ACPI_IVRS_TYPE_MEMORY3:
1353 Name = AcpiDmIvrsSubnames[1];
1354 break;
1356 default:
1358 Name = AcpiDmIvrsSubnames[2];
1359 break;
1362 AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1363 break;
1365 case ACPI_DMT_LPIT:
1367 /* LPIT subtable types */
1369 Temp8 = *Target;
1370 switch (Temp8)
1372 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
1374 Name = AcpiDmLpitSubnames[0];
1375 break;
1377 case ACPI_LPIT_TYPE_SIMPLE_IO:
1379 Name = AcpiDmLpitSubnames[1];
1380 break;
1382 default:
1384 Name = AcpiDmLpitSubnames[2];
1385 break;
1388 AcpiOsPrintf (UINT32_FORMAT, *Target, Name);
1389 break;
1391 case ACPI_DMT_EXIT:
1393 return (AE_OK);
1395 default:
1397 ACPI_ERROR ((AE_INFO,
1398 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1399 return (AE_SUPPORT);
1403 if (TableOffset && !SubtableLength)
1405 /* If this table is not the main table, subtable must have valid length */
1407 AcpiOsPrintf ("Invalid zero length subtable\n");
1408 return (AE_BAD_DATA);
1411 return (AE_OK);
1415 /*******************************************************************************
1417 * FUNCTION: AcpiDmCheckAscii
1419 * PARAMETERS: Name - Ascii string
1420 * Count - Number of characters to check
1422 * RETURN: None
1424 * DESCRIPTION: Ensure that the requested number of characters are printable
1425 * Ascii characters. Sets non-printable and null chars to <space>.
1427 ******************************************************************************/
1429 static void
1430 AcpiDmCheckAscii (
1431 UINT8 *Name,
1432 char *RepairedName,
1433 UINT32 Count)
1435 UINT32 i;
1438 for (i = 0; i < Count; i++)
1440 RepairedName[i] = (char) Name[i];
1442 if (!Name[i])
1444 return;
1446 if (!isprint (Name[i]))
1448 RepairedName[i] = ' ';