Sync ACPICA with Intel's version 20150408.
[dragonfly.git] / sys / contrib / dev / acpica / source / common / dmtable.c
1 /******************************************************************************
2  *
3  * Module Name: dmtable - Support for ACPI tables that contain no AML code
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2015, 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 MERCHANTIBILITY 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 #include "dtcompiler.h"
50
51 /* This module used for application-level code only */
52
53 #define _COMPONENT          ACPI_CA_DISASSEMBLER
54         ACPI_MODULE_NAME    ("dmtable")
55
56 /* Local Prototypes */
57
58 static void
59 AcpiDmCheckAscii (
60     UINT8                   *Target,
61     char                    *RepairedName,
62     UINT32                  Count);
63
64
65 /* Common format strings for commented values */
66
67 #define UINT8_FORMAT        "%2.2X [%s]\n"
68 #define UINT16_FORMAT       "%4.4X [%s]\n"
69 #define UINT32_FORMAT       "%8.8X [%s]\n"
70 #define STRING_FORMAT       "[%s]\n"
71
72 /* These tables map a subtable type to a description string */
73
74 static const char           *AcpiDmAsfSubnames[] =
75 {
76     "ASF Information",
77     "ASF Alerts",
78     "ASF Remote Control",
79     "ASF RMCP Boot Options",
80     "ASF Address",
81     "Unknown SubTable Type"         /* Reserved */
82 };
83
84 static const char           *AcpiDmDmarSubnames[] =
85 {
86     "Hardware Unit Definition",
87     "Reserved Memory Region",
88     "Root Port ATS Capability",
89     "Remapping Hardware Static Affinity",
90     "ACPI Namespace Device Declaration",
91     "Unknown SubTable Type"         /* Reserved */
92 };
93
94 static const char           *AcpiDmDmarScope[] =
95 {
96     "Reserved value",
97     "PCI Endpoint Device",
98     "PCI Bridge Device",
99     "IOAPIC Device",
100     "Message-capable HPET Device",
101     "Namespace Device",
102     "Unknown Scope Type"            /* Reserved */
103 };
104
105 static const char           *AcpiDmEinjActions[] =
106 {
107     "Begin Operation",
108     "Get Trigger Table",
109     "Set Error Type",
110     "Get Error Type",
111     "End Operation",
112     "Execute Operation",
113     "Check Busy Status",
114     "Get Command Status",
115     "Set Error Type With Address",
116     "Unknown Action"
117 };
118
119 static const char           *AcpiDmEinjInstructions[] =
120 {
121     "Read Register",
122     "Read Register Value",
123     "Write Register",
124     "Write Register Value",
125     "Noop",
126     "Flush Cacheline",
127     "Unknown Instruction"
128 };
129
130 static const char           *AcpiDmErstActions[] =
131 {
132     "Begin Write Operation",
133     "Begin Read Operation",
134     "Begin Clear Operation",
135     "End Operation",
136     "Set Record Offset",
137     "Execute Operation",
138     "Check Busy Status",
139     "Get Command Status",
140     "Get Record Identifier",
141     "Set Record Identifier",
142     "Get Record Count",
143     "Begin Dummy Write",
144     "Unused/Unknown Action",
145     "Get Error Address Range",
146     "Get Error Address Length",
147     "Get Error Attributes",
148     "Unknown Action"
149 };
150
151 static const char           *AcpiDmErstInstructions[] =
152 {
153     "Read Register",
154     "Read Register Value",
155     "Write Register",
156     "Write Register Value",
157     "Noop",
158     "Load Var1",
159     "Load Var2",
160     "Store Var1",
161     "Add",
162     "Subtract",
163     "Add Value",
164     "Subtract Value",
165     "Stall",
166     "Stall While True",
167     "Skip Next If True",
168     "GoTo",
169     "Set Source Address",
170     "Set Destination Address",
171     "Move Data",
172     "Unknown Instruction"
173 };
174
175 static const char           *AcpiDmGtdtSubnames[] =
176 {
177     "Generic Timer Block",
178     "Generic Watchdog Timer",
179     "Unknown SubTable Type"         /* Reserved */
180 };
181
182 static const char           *AcpiDmHestSubnames[] =
183 {
184     "IA-32 Machine Check Exception",
185     "IA-32 Corrected Machine Check",
186     "IA-32 Non-Maskable Interrupt",
187     "Unknown SubTable Type",        /* 3 - Reserved */
188     "Unknown SubTable Type",        /* 4 - Reserved */
189     "Unknown SubTable Type",        /* 5 - Reserved */
190     "PCI Express Root Port AER",
191     "PCI Express AER (AER Endpoint)",
192     "PCI Express/PCI-X Bridge AER",
193     "Generic Hardware Error Source",
194     "Unknown SubTable Type"         /* Reserved */
195 };
196
197 static const char           *AcpiDmHestNotifySubnames[] =
198 {
199     "Polled",
200     "External Interrupt",
201     "Local Interrupt",
202     "SCI",
203     "NMI",
204     "CMCI",                         /* ACPI 5.0 */
205     "MCE",                          /* ACPI 5.0 */
206     "Unknown Notify Type"           /* Reserved */
207 };
208
209 static const char           *AcpiDmMadtSubnames[] =
210 {
211     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
212     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
213     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
214     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
215     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
216     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
217     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
218     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
219     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
220     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
221     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
222     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
223     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
224     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
225     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
226     "Unknown SubTable Type"             /* Reserved */
227 };
228
229 static const char           *AcpiDmPcctSubnames[] =
230 {
231     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
232     "HW-Reduced Communications Subspace",
233     "Unknown SubTable Type"             /* Reserved */
234 };
235
236 static const char           *AcpiDmPmttSubnames[] =
237 {
238     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
239     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
240     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM  */
241     "Unknown SubTable Type"         /* Reserved */
242 };
243
244 static const char           *AcpiDmSratSubnames[] =
245 {
246     "Processor Local APIC/SAPIC Affinity",
247     "Memory Affinity",
248     "Processor Local x2APIC Affinity",
249     "GICC Affinity",
250     "Unknown SubTable Type"         /* Reserved */
251 };
252
253 static const char           *AcpiDmIvrsSubnames[] =
254 {
255     "Hardware Definition Block",
256     "Memory Definition Block",
257     "Unknown SubTable Type"         /* Reserved */
258 };
259
260 static const char           *AcpiDmLpitSubnames[] =
261 {
262     "Native C-state Idle Structure",
263     "Simple I/O Idle Structure",
264     "Unknown SubTable Type"         /* Reserved */
265 };
266
267 #define ACPI_FADT_PM_RESERVED       9
268
269 static const char           *AcpiDmFadtProfiles[] =
270 {
271     "Unspecified",
272     "Desktop",
273     "Mobile",
274     "Workstation",
275     "Enterprise Server",
276     "SOHO Server",
277     "Appliance PC",
278     "Performance Server",
279     "Tablet",
280     "Unknown Profile Type"
281 };
282
283 #define ACPI_GAS_WIDTH_RESERVED     5
284
285 static const char           *AcpiDmGasAccessWidth[] =
286 {
287     "Undefined/Legacy",
288     "Byte Access:8",
289     "Word Access:16",
290     "DWord Access:32",
291     "QWord Access:64",
292     "Unknown Width Encoding"
293 };
294
295
296 /*******************************************************************************
297  *
298  * ACPI Table Data, indexed by signature.
299  *
300  * Each entry contains: Signature, Table Info, Handler, DtHandler,
301  *  Template, Description
302  *
303  * Simple tables have only a TableInfo structure, complex tables have a
304  * handler. This table must be NULL terminated. RSDP and FACS are
305  * special-cased elsewhere.
306  *
307  ******************************************************************************/
308
309 ACPI_DMTABLE_DATA    AcpiDmTableData[] =
310 {
311     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf,    "Alert Standard Format table"},
312     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert,   "Boot Error Record Table"},
313     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt,   "Boot Graphics Resource Table"},
314     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot,   "Simple Boot Flag Table"},
315     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep,   "Corrected Platform Error Polling table"},
316     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt,   "Core System Resource Table"},
317     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2,   "Debug Port table type 2"},
318     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp,   "Debug Port table"},
319     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar,   "DMA Remapping table"},
320     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt,   "Embedded Controller Boot Resources Table"},
321     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj,   "Error Injection table"},
322     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst,   "Error Record Serialization Table"},
323     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt,   "Fixed ACPI Description Table (FADT)"},
324     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt,   "Firmware Performance Data Table"},
325     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt,   "Generic Timer Description Table"},
326     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest,   "Hardware Error Source Table"},
327     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet,   "High Precision Event Timer table"},
328     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs,   "I/O Virtualization Reporting Structure"},
329     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit,   "Low Power Idle Table"},
330     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt,   "Multiple APIC Description Table (MADT)"},
331     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg,   "Memory Mapped Configuration table"},
332     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi,   "Management Controller Host Interface table"},
333     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst,   "Memory Power State Table"},
334     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct,   "Maximum System Characteristics Table"},
335     {ACPI_SIG_MSDM, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateMsdm,   "Microsoft Data Management table"},
336     {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr,   "MID Timer Table"},
337     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct,   "Platform Communications Channel Table"},
338     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt,   "Platform Memory Topology Table"},
339     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"},
340     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt,   "S3 Performance Table"},
341     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst,   "Smart Battery Specification Table"},
342     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic,   "Software Licensing Description Table"},
343     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit,   "System Locality Information Table"},
344     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr,   "Serial Port Console Redirection table"},
345     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi,   "Server Platform Management Interface table"},
346     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat,   "System Resource Affinity Table"},
347     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},
348     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2,   "Trusted Platform Module hardware interface table"},
349     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
350     {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc,   "Virtual Real-Time Clock Table"},
351     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
352     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
353     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
354     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
355     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
356     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
357 };
358
359
360 /*******************************************************************************
361  *
362  * FUNCTION:    AcpiDmGenerateChecksum
363  *
364  * PARAMETERS:  Table               - Pointer to table to be checksummed
365  *              Length              - Length of the table
366  *              OriginalChecksum    - Value of the checksum field
367  *
368  * RETURN:      8 bit checksum of buffer
369  *
370  * DESCRIPTION: Computes an 8 bit checksum of the table.
371  *
372  ******************************************************************************/
373
374 UINT8
375 AcpiDmGenerateChecksum (
376     void                    *Table,
377     UINT32                  Length,
378     UINT8                   OriginalChecksum)
379 {
380     UINT8                   Checksum;
381
382
383     /* Sum the entire table as-is */
384
385     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
386
387     /* Subtract off the existing checksum value in the table */
388
389     Checksum = (UINT8) (Checksum - OriginalChecksum);
390
391     /* Compute the final checksum */
392
393     Checksum = (UINT8) (0 - Checksum);
394     return (Checksum);
395 }
396
397
398 /*******************************************************************************
399  *
400  * FUNCTION:    AcpiDmGetTableData
401  *
402  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
403  *
404  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
405  *
406  * DESCRIPTION: Find a match in the global table of supported ACPI tables
407  *
408  ******************************************************************************/
409
410 ACPI_DMTABLE_DATA *
411 AcpiDmGetTableData (
412     char                    *Signature)
413 {
414     ACPI_DMTABLE_DATA       *TableData;
415
416
417     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
418     {
419         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
420         {
421             return (TableData);
422         }
423     }
424
425     return (NULL);
426 }
427
428
429 /*******************************************************************************
430  *
431  * FUNCTION:    AcpiDmDumpDataTable
432  *
433  * PARAMETERS:  Table               - An ACPI table
434  *
435  * RETURN:      None.
436  *
437  * DESCRIPTION: Format the contents of an ACPI data table (any table other
438  *              than an SSDT or DSDT that does not contain executable AML code)
439  *
440  ******************************************************************************/
441
442 void
443 AcpiDmDumpDataTable (
444     ACPI_TABLE_HEADER       *Table)
445 {
446     ACPI_STATUS             Status;
447     ACPI_DMTABLE_DATA       *TableData;
448     UINT32                  Length;
449
450
451     /* Ignore tables that contain AML */
452
453     if (AcpiUtIsAmlTable (Table))
454     {
455         if (Gbl_VerboseTemplates)
456         {
457             /* Dump the raw table data */
458
459             Length = Table->Length;
460
461             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
462                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
463             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
464                 Length, DB_BYTE_DISPLAY, 0);
465             AcpiOsPrintf (" */\n");
466         }
467         return;
468     }
469
470     /*
471      * Handle tables that don't use the common ACPI table header structure.
472      * Currently, these are the FACS, RSDP, and S3PT.
473      */
474     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
475     {
476         Length = Table->Length;
477         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
478     }
479     else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
480     {
481         Length = AcpiDmDumpRsdp (Table);
482     }
483     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
484     {
485         Length = AcpiDmDumpS3pt (Table);
486     }
487     else
488     {
489         /*
490          * All other tables must use the common ACPI table header, dump it now
491          */
492         Length = Table->Length;
493         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
494         if (ACPI_FAILURE (Status))
495         {
496             return;
497         }
498         AcpiOsPrintf ("\n");
499
500         /* Match signature and dispatch appropriately */
501
502         TableData = AcpiDmGetTableData (Table->Signature);
503         if (!TableData)
504         {
505             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
506             {
507                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
508                     Table->Signature);
509             }
510             else
511             {
512                 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
513                     Table->Signature);
514
515                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
516                     Table->Signature);
517
518                 if (!AcpiGbl_ForceAmlDisassembly)
519                 {
520                     fprintf (stderr, "decoding ACPI table header only\n");
521                 }
522                 else
523                 {
524                     fprintf (stderr, "assuming table contains valid AML code\n");
525                 }
526             }
527         }
528         else if (TableData->TableHandler)
529         {
530             /* Complex table, has a handler */
531
532             TableData->TableHandler (Table);
533         }
534         else if (TableData->TableInfo)
535         {
536             /* Simple table, just walk the info table */
537
538             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
539         }
540     }
541
542     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
543     {
544         /* Dump the raw table data */
545
546         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
547             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
548         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
549             Length, DB_BYTE_DISPLAY, 0);
550     }
551 }
552
553
554 /*******************************************************************************
555  *
556  * FUNCTION:    AcpiDmLineHeader
557  *
558  * PARAMETERS:  Offset              - Current byte offset, from table start
559  *              ByteLength          - Length of the field in bytes, 0 for flags
560  *              Name                - Name of this field
561  *              Value               - Optional value, displayed on left of ':'
562  *
563  * RETURN:      None
564  *
565  * DESCRIPTION: Utility routines for formatting output lines. Displays the
566  *              current table offset in hex and decimal, the field length,
567  *              and the field name.
568  *
569  ******************************************************************************/
570
571 void
572 AcpiDmLineHeader (
573     UINT32                  Offset,
574     UINT32                  ByteLength,
575     char                    *Name)
576 {
577
578     /* Allow a null name for fields that span multiple lines (large buffers) */
579
580     if (!Name)
581     {
582         Name = "";
583     }
584
585     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
586     {
587         if (ByteLength)
588         {
589             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
590         }
591         else
592         {
593             if (*Name)
594             {
595                 AcpiOsPrintf ("%41s : ", Name);
596             }
597             else
598             {
599                 AcpiOsPrintf ("%41s   ", Name);
600             }
601         }
602     }
603     else /* Normal disassembler or verbose template */
604     {
605         if (ByteLength)
606         {
607             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
608                 Offset, Offset, ByteLength, Name);
609         }
610         else
611         {
612             if (*Name)
613             {
614                 AcpiOsPrintf ("%44s : ", Name);
615             }
616             else
617             {
618                 AcpiOsPrintf ("%44s   ", Name);
619             }
620         }
621     }
622 }
623
624 void
625 AcpiDmLineHeader2 (
626     UINT32                  Offset,
627     UINT32                  ByteLength,
628     char                    *Name,
629     UINT32                  Value)
630 {
631
632     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
633     {
634         if (ByteLength)
635         {
636             AcpiOsPrintf ("[%.4d] %30s %3d : ",
637                 ByteLength, Name, Value);
638         }
639         else
640         {
641             AcpiOsPrintf ("%36s % 3d : ",
642                 Name, Value);
643         }
644     }
645     else /* Normal disassembler or verbose template */
646     {
647         if (ByteLength)
648         {
649             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
650                 Offset, Offset, ByteLength, Name, Value);
651         }
652         else
653         {
654             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
655                 Offset, Offset, Name, Value);
656         }
657     }
658 }
659
660
661 /*******************************************************************************
662  *
663  * FUNCTION:    AcpiDmDumpTable
664  *
665  * PARAMETERS:  TableLength         - Length of the entire ACPI table
666  *              TableOffset         - Starting offset within the table for this
667  *                                    sub-descriptor (0 if main table)
668  *              Table               - The ACPI table
669  *              SubtableLength      - Length of this sub-descriptor
670  *              Info                - Info table for this ACPI table
671  *
672  * RETURN:      None
673  *
674  * DESCRIPTION: Display ACPI table contents by walking the Info table.
675  *
676  * Note: This function must remain in sync with DtGetFieldLength.
677  *
678  ******************************************************************************/
679
680 ACPI_STATUS
681 AcpiDmDumpTable (
682     UINT32                  TableLength,
683     UINT32                  TableOffset,
684     void                    *Table,
685     UINT32                  SubtableLength,
686     ACPI_DMTABLE_INFO       *Info)
687 {
688     UINT8                   *Target;
689     UINT32                  CurrentOffset;
690     UINT32                  ByteLength;
691     UINT8                   Temp8;
692     UINT16                  Temp16;
693     UINT32                  Temp32;
694     UINT64                  Value;
695     ACPI_DMTABLE_DATA       *TableData;
696     const char              *Name;
697     BOOLEAN                 LastOutputBlankLine = FALSE;
698     char                    RepairedName[8];
699
700
701     if (!Info)
702     {
703         AcpiOsPrintf ("Display not implemented\n");
704         return (AE_NOT_IMPLEMENTED);
705     }
706
707     /* Walk entire Info table; Null name terminates */
708
709     for (; Info->Name; Info++)
710     {
711         /*
712          * Target points to the field within the ACPI Table. CurrentOffset is
713          * the offset of the field from the start of the main table.
714          */
715         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
716         CurrentOffset = TableOffset + Info->Offset;
717
718         /* Check for beyond EOT or beyond subtable end */
719
720         if ((CurrentOffset >= TableLength) ||
721             (SubtableLength && (Info->Offset >= SubtableLength)))
722         {
723             AcpiOsPrintf (
724                 "**** ACPI table terminates in the middle of a data structure! (dump table)\n");
725             return (AE_BAD_DATA);
726         }
727
728         /* Generate the byte length for this field */
729
730         switch (Info->Opcode)
731         {
732         case ACPI_DMT_UINT8:
733         case ACPI_DMT_CHKSUM:
734         case ACPI_DMT_SPACEID:
735         case ACPI_DMT_ACCWIDTH:
736         case ACPI_DMT_IVRS:
737         case ACPI_DMT_GTDT:
738         case ACPI_DMT_MADT:
739         case ACPI_DMT_PCCT:
740         case ACPI_DMT_PMTT:
741         case ACPI_DMT_SRAT:
742         case ACPI_DMT_ASF:
743         case ACPI_DMT_HESTNTYP:
744         case ACPI_DMT_FADTPM:
745         case ACPI_DMT_EINJACT:
746         case ACPI_DMT_EINJINST:
747         case ACPI_DMT_ERSTACT:
748         case ACPI_DMT_ERSTINST:
749         case ACPI_DMT_DMAR_SCOPE:
750
751             ByteLength = 1;
752             break;
753
754         case ACPI_DMT_UINT16:
755         case ACPI_DMT_DMAR:
756         case ACPI_DMT_HEST:
757
758             ByteLength = 2;
759             break;
760
761         case ACPI_DMT_UINT24:
762
763             ByteLength = 3;
764             break;
765
766         case ACPI_DMT_UINT32:
767         case ACPI_DMT_NAME4:
768         case ACPI_DMT_SIG:
769         case ACPI_DMT_LPIT:
770
771             ByteLength = 4;
772             break;
773
774         case ACPI_DMT_UINT40:
775
776             ByteLength = 5;
777             break;
778
779         case ACPI_DMT_UINT48:
780         case ACPI_DMT_NAME6:
781
782             ByteLength = 6;
783             break;
784
785         case ACPI_DMT_UINT56:
786         case ACPI_DMT_BUF7:
787
788             ByteLength = 7;
789             break;
790
791         case ACPI_DMT_UINT64:
792         case ACPI_DMT_NAME8:
793
794             ByteLength = 8;
795             break;
796
797         case ACPI_DMT_BUF10:
798
799             ByteLength = 10;
800             break;
801
802         case ACPI_DMT_BUF16:
803         case ACPI_DMT_UUID:
804
805             ByteLength = 16;
806             break;
807
808         case ACPI_DMT_BUF128:
809
810             ByteLength = 128;
811             break;
812
813         case ACPI_DMT_BUFFER:
814         case ACPI_DMT_RAW_BUFFER:
815
816             ByteLength = SubtableLength;
817             break;
818
819         case ACPI_DMT_STRING:
820
821             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
822             break;
823
824         case ACPI_DMT_GAS:
825
826             if (!LastOutputBlankLine)
827             {
828                 AcpiOsPrintf ("\n");
829                 LastOutputBlankLine = TRUE;
830             }
831             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
832             break;
833
834         case ACPI_DMT_HESTNTFY:
835
836             if (!LastOutputBlankLine)
837             {
838                 AcpiOsPrintf ("\n");
839                 LastOutputBlankLine = TRUE;
840             }
841             ByteLength = sizeof (ACPI_HEST_NOTIFY);
842             break;
843
844         default:
845
846             ByteLength = 0;
847             break;
848         }
849
850         if (CurrentOffset + ByteLength > TableLength)
851         {
852             AcpiOsPrintf (
853                 "**** ACPI table terminates in the middle of a data structure!\n");
854             return (AE_BAD_DATA);
855         }
856
857         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
858         {
859             AcpiOsPrintf ("%s", Info->Name);
860             continue;
861         }
862
863         /* Start a new line and decode the opcode */
864
865         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
866
867         switch (Info->Opcode)
868         {
869         /* Single-bit Flag fields. Note: Opcode is the bit position */
870
871         case ACPI_DMT_FLAG0:
872         case ACPI_DMT_FLAG1:
873         case ACPI_DMT_FLAG2:
874         case ACPI_DMT_FLAG3:
875         case ACPI_DMT_FLAG4:
876         case ACPI_DMT_FLAG5:
877         case ACPI_DMT_FLAG6:
878         case ACPI_DMT_FLAG7:
879
880             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
881             break;
882
883         /* 2-bit Flag fields */
884
885         case ACPI_DMT_FLAGS0:
886
887             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
888             break;
889
890         case ACPI_DMT_FLAGS1:
891
892             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
893             break;
894
895         case ACPI_DMT_FLAGS2:
896
897             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
898             break;
899
900         case ACPI_DMT_FLAGS4:
901
902             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
903             break;
904
905         /* Integer Data Types */
906
907         case ACPI_DMT_UINT8:
908         case ACPI_DMT_UINT16:
909         case ACPI_DMT_UINT24:
910         case ACPI_DMT_UINT32:
911         case ACPI_DMT_UINT40:
912         case ACPI_DMT_UINT48:
913         case ACPI_DMT_UINT56:
914         case ACPI_DMT_UINT64:
915             /*
916              * Dump bytes - high byte first, low byte last.
917              * Note: All ACPI tables are little-endian.
918              */
919             Value = 0;
920             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
921             {
922                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
923                 Value |= Target[Temp8 - 1];
924                 Value <<= 8;
925             }
926
927             if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
928             {
929                 AcpiOsPrintf (" [Optional field not present]");
930             }
931
932             AcpiOsPrintf ("\n");
933             break;
934
935         case ACPI_DMT_BUF7:
936         case ACPI_DMT_BUF10:
937         case ACPI_DMT_BUF16:
938         case ACPI_DMT_BUF128:
939             /*
940              * Buffer: Size depends on the opcode and was set above.
941              * Each hex byte is separated with a space.
942              * Multiple lines are separated by line continuation char.
943              */
944             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
945             {
946                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
947                 if ((UINT32) (Temp16 + 1) < ByteLength)
948                 {
949                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
950                     {
951                         AcpiOsPrintf (" \\\n"); /* Line continuation */
952                         AcpiDmLineHeader (0, 0, NULL);
953                     }
954                     else
955                     {
956                         AcpiOsPrintf (" ");
957                     }
958                 }
959             }
960             AcpiOsPrintf ("\n");
961             break;
962
963         case ACPI_DMT_UUID:
964
965             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
966
967             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
968
969             AcpiOsPrintf ("%s\n", MsgBuffer);
970             break;
971
972         case ACPI_DMT_STRING:
973
974             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
975             break;
976
977         /* Fixed length ASCII name fields */
978
979         case ACPI_DMT_SIG:
980
981             AcpiDmCheckAscii (Target, RepairedName, 4);
982             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
983             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
984             if (TableData)
985             {
986                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
987             }
988             else
989             {
990                 AcpiOsPrintf ("\n");
991             }
992             break;
993
994         case ACPI_DMT_NAME4:
995
996             AcpiDmCheckAscii (Target, RepairedName, 4);
997             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
998             break;
999
1000         case ACPI_DMT_NAME6:
1001
1002             AcpiDmCheckAscii (Target, RepairedName, 6);
1003             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1004             break;
1005
1006         case ACPI_DMT_NAME8:
1007
1008             AcpiDmCheckAscii (Target, RepairedName, 8);
1009             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1010             break;
1011
1012         /* Special Data Types */
1013
1014         case ACPI_DMT_CHKSUM:
1015
1016             /* Checksum, display and validate */
1017
1018             AcpiOsPrintf ("%2.2X", *Target);
1019             Temp8 = AcpiDmGenerateChecksum (Table,
1020                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1021                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1022
1023             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1024             {
1025                 AcpiOsPrintf (
1026                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
1027             }
1028             AcpiOsPrintf ("\n");
1029             break;
1030
1031         case ACPI_DMT_SPACEID:
1032
1033             /* Address Space ID */
1034
1035             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1036             break;
1037
1038         case ACPI_DMT_ACCWIDTH:
1039
1040             /* Encoded Access Width */
1041
1042             Temp8 = *Target;
1043             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1044             {
1045                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1046             }
1047
1048             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1049             break;
1050
1051         case ACPI_DMT_GAS:
1052
1053             /* Generic Address Structure */
1054
1055             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1056             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1057                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1058             AcpiOsPrintf ("\n");
1059             LastOutputBlankLine = TRUE;
1060             break;
1061
1062         case ACPI_DMT_ASF:
1063
1064             /* ASF subtable types */
1065
1066             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
1067             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1068             {
1069                 Temp16 = ACPI_ASF_TYPE_RESERVED;
1070             }
1071
1072             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1073             break;
1074
1075         case ACPI_DMT_DMAR:
1076
1077             /* DMAR subtable types */
1078
1079             Temp16 = ACPI_GET16 (Target);
1080             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1081             {
1082                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1083             }
1084
1085             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1086                 AcpiDmDmarSubnames[Temp16]);
1087             break;
1088
1089         case ACPI_DMT_DMAR_SCOPE:
1090
1091             /* DMAR device scope types */
1092
1093             Temp8 = *Target;
1094             if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1095             {
1096                 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1097             }
1098
1099             AcpiOsPrintf (UINT8_FORMAT, *Target,
1100                 AcpiDmDmarScope[Temp8]);
1101             break;
1102
1103         case ACPI_DMT_EINJACT:
1104
1105             /* EINJ Action types */
1106
1107             Temp8 = *Target;
1108             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1109             {
1110                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1111             }
1112
1113             AcpiOsPrintf (UINT8_FORMAT, *Target,
1114                 AcpiDmEinjActions[Temp8]);
1115             break;
1116
1117         case ACPI_DMT_EINJINST:
1118
1119             /* EINJ Instruction types */
1120
1121             Temp8 = *Target;
1122             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1123             {
1124                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1125             }
1126
1127             AcpiOsPrintf (UINT8_FORMAT, *Target,
1128                 AcpiDmEinjInstructions[Temp8]);
1129             break;
1130
1131         case ACPI_DMT_ERSTACT:
1132
1133             /* ERST Action types */
1134
1135             Temp8 = *Target;
1136             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1137             {
1138                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1139             }
1140
1141             AcpiOsPrintf (UINT8_FORMAT, *Target,
1142                 AcpiDmErstActions[Temp8]);
1143             break;
1144
1145         case ACPI_DMT_ERSTINST:
1146
1147             /* ERST Instruction types */
1148
1149             Temp8 = *Target;
1150             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1151             {
1152                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1153             }
1154
1155             AcpiOsPrintf (UINT8_FORMAT, *Target,
1156                 AcpiDmErstInstructions[Temp8]);
1157             break;
1158
1159         case ACPI_DMT_GTDT:
1160
1161             /* GTDT subtable types */
1162
1163             Temp8 = *Target;
1164             if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1165             {
1166                 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1167             }
1168
1169             AcpiOsPrintf (UINT8_FORMAT, *Target,
1170                 AcpiDmGtdtSubnames[Temp8]);
1171             break;
1172
1173         case ACPI_DMT_HEST:
1174
1175             /* HEST subtable types */
1176
1177             Temp16 = ACPI_GET16 (Target);
1178             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1179             {
1180                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1181             }
1182
1183             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1184                 AcpiDmHestSubnames[Temp16]);
1185             break;
1186
1187         case ACPI_DMT_HESTNTFY:
1188
1189             AcpiOsPrintf (STRING_FORMAT,
1190                 "Hardware Error Notification Structure");
1191
1192             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1193                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1194             AcpiOsPrintf ("\n");
1195             LastOutputBlankLine = TRUE;
1196             break;
1197
1198         case ACPI_DMT_HESTNTYP:
1199
1200             /* HEST Notify types */
1201
1202             Temp8 = *Target;
1203             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1204             {
1205                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1206             }
1207
1208             AcpiOsPrintf (UINT8_FORMAT, *Target,
1209                 AcpiDmHestNotifySubnames[Temp8]);
1210             break;
1211
1212         case ACPI_DMT_MADT:
1213
1214             /* MADT subtable types */
1215
1216             Temp8 = *Target;
1217             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1218             {
1219                 Temp8 = ACPI_MADT_TYPE_RESERVED;
1220             }
1221
1222             AcpiOsPrintf (UINT8_FORMAT, *Target,
1223                 AcpiDmMadtSubnames[Temp8]);
1224             break;
1225
1226         case ACPI_DMT_PCCT:
1227
1228             /* PCCT subtable types */
1229
1230             Temp8 = *Target;
1231             if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1232             {
1233                 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1234             }
1235
1236             AcpiOsPrintf (UINT8_FORMAT, *Target,
1237                 AcpiDmPcctSubnames[Temp8]);
1238             break;
1239
1240         case ACPI_DMT_PMTT:
1241
1242             /* PMTT subtable types */
1243
1244             Temp8 = *Target;
1245             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1246             {
1247                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1248             }
1249
1250             AcpiOsPrintf (UINT8_FORMAT, *Target,
1251                 AcpiDmPmttSubnames[Temp8]);
1252             break;
1253
1254         case ACPI_DMT_RAW_BUFFER:
1255             /*
1256              * Currently only used for SLIC table
1257              */
1258             AcpiOsPrintf ("/* Proprietary data structure */ ");
1259
1260             AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER),
1261                 ByteLength, sizeof (ACPI_TABLE_HEADER),
1262                 "Licensing Data", TRUE);
1263             AcpiOsPrintf ("\n");
1264             break;
1265
1266         case ACPI_DMT_SRAT:
1267
1268             /* SRAT subtable types */
1269
1270             Temp8 = *Target;
1271             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1272             {
1273                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1274             }
1275
1276             AcpiOsPrintf (UINT8_FORMAT, *Target,
1277                 AcpiDmSratSubnames[Temp8]);
1278             break;
1279
1280         case ACPI_DMT_FADTPM:
1281
1282             /* FADT Preferred PM Profile names */
1283
1284             Temp8 = *Target;
1285             if (Temp8 > ACPI_FADT_PM_RESERVED)
1286             {
1287                 Temp8 = ACPI_FADT_PM_RESERVED;
1288             }
1289
1290             AcpiOsPrintf (UINT8_FORMAT, *Target,
1291                 AcpiDmFadtProfiles[Temp8]);
1292             break;
1293
1294         case ACPI_DMT_IVRS:
1295
1296             /* IVRS subtable types */
1297
1298             Temp8 = *Target;
1299             switch (Temp8)
1300             {
1301             case ACPI_IVRS_TYPE_HARDWARE:
1302
1303                 Name = AcpiDmIvrsSubnames[0];
1304                 break;
1305
1306             case ACPI_IVRS_TYPE_MEMORY1:
1307             case ACPI_IVRS_TYPE_MEMORY2:
1308             case ACPI_IVRS_TYPE_MEMORY3:
1309
1310                 Name = AcpiDmIvrsSubnames[1];
1311                 break;
1312
1313             default:
1314
1315                 Name = AcpiDmIvrsSubnames[2];
1316                 break;
1317             }
1318
1319             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1320             break;
1321
1322         case ACPI_DMT_LPIT:
1323
1324             /* LPIT subtable types */
1325
1326             Temp32 = ACPI_GET32 (Target);
1327             if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1328             {
1329                 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1330             }
1331
1332             AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1333                 AcpiDmLpitSubnames[Temp32]);
1334             break;
1335
1336         case ACPI_DMT_EXIT:
1337
1338             return (AE_OK);
1339
1340         default:
1341
1342             ACPI_ERROR ((AE_INFO,
1343                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1344             return (AE_SUPPORT);
1345         }
1346     }
1347
1348     if (TableOffset && !SubtableLength)
1349     {
1350         /*
1351          * If this table is not the main table, the subtable must have a
1352          * valid length
1353          */
1354         AcpiOsPrintf ("Invalid zero length subtable\n");
1355         return (AE_BAD_DATA);
1356     }
1357
1358     return (AE_OK);
1359 }
1360
1361
1362 /*******************************************************************************
1363  *
1364  * FUNCTION:    AcpiDmCheckAscii
1365  *
1366  * PARAMETERS:  Name                - Ascii string
1367  *              Count               - Number of characters to check
1368  *
1369  * RETURN:      None
1370  *
1371  * DESCRIPTION: Ensure that the requested number of characters are printable
1372  *              Ascii characters. Sets non-printable and null chars to <space>.
1373  *
1374  ******************************************************************************/
1375
1376 static void
1377 AcpiDmCheckAscii (
1378     UINT8                   *Name,
1379     char                    *RepairedName,
1380     UINT32                  Count)
1381 {
1382     UINT32                  i;
1383
1384
1385     for (i = 0; i < Count; i++)
1386     {
1387         RepairedName[i] = (char) Name[i];
1388
1389         if (!Name[i])
1390         {
1391             return;
1392         }
1393         if (!isprint (Name[i]))
1394         {
1395             RepairedName[i] = ' ';
1396         }
1397     }
1398 }