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