mkfs: move directory entry manipulation
[minix.git] / drivers / acpi / resources / rsdump.c
blob3c1275f52fed5ac400eb6df57bce26cc7c284418
1 /*******************************************************************************
3 * Module Name: rsdump - Functions to display the resource structures.
5 ******************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2010, 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 *****************************************************************************/
117 #define __RSDUMP_C__
119 #include "acpi.h"
120 #include "accommon.h"
121 #include "acresrc.h"
123 #define _COMPONENT ACPI_RESOURCES
124 ACPI_MODULE_NAME ("rsdump")
127 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
129 /* Local prototypes */
131 static void
132 AcpiRsOutString (
133 char *Title,
134 char *Value);
136 static void
137 AcpiRsOutInteger8 (
138 char *Title,
139 UINT8 Value);
141 static void
142 AcpiRsOutInteger16 (
143 char *Title,
144 UINT16 Value);
146 static void
147 AcpiRsOutInteger32 (
148 char *Title,
149 UINT32 Value);
151 static void
152 AcpiRsOutInteger64 (
153 char *Title,
154 UINT64 Value);
156 static void
157 AcpiRsOutTitle (
158 char *Title);
160 static void
161 AcpiRsDumpByteList (
162 UINT16 Length,
163 UINT8 *Data);
165 static void
166 AcpiRsDumpDwordList (
167 UINT8 Length,
168 UINT32 *Data);
170 static void
171 AcpiRsDumpShortByteList (
172 UINT8 Length,
173 UINT8 *Data);
175 static void
176 AcpiRsDumpResourceSource (
177 ACPI_RESOURCE_SOURCE *ResourceSource);
179 static void
180 AcpiRsDumpAddressCommon (
181 ACPI_RESOURCE_DATA *Resource);
183 static void
184 AcpiRsDumpDescriptor (
185 void *Resource,
186 ACPI_RSDUMP_INFO *Table);
189 #define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f)
190 #define ACPI_PRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f)
191 #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_RSDUMP_INFO))
194 /*******************************************************************************
196 * Resource Descriptor info tables
198 * Note: The first table entry must be a Title or Literal and must contain
199 * the table length (number of table entries)
201 ******************************************************************************/
203 ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] =
205 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL},
206 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL},
207 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode},
208 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode},
209 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode},
210 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL},
211 {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL}
214 ACPI_RSDUMP_INFO AcpiRsDumpDma[6] =
216 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL},
217 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode},
218 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode},
219 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode},
220 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL},
221 {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL}
224 ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] =
226 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL},
227 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (StartDpf.DescriptorLength), "Descriptor Length", NULL},
228 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode},
229 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode}
232 ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[1] =
234 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf), "End-Dependent-Functions", NULL}
237 ACPI_RSDUMP_INFO AcpiRsDumpIo[6] =
239 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo), "I/O", NULL},
240 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode), "Address Decoding", AcpiGbl_IoDecode},
241 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Minimum), "Address Minimum", NULL},
242 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Maximum), "Address Maximum", NULL},
243 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.Alignment), "Alignment", NULL},
244 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.AddressLength), "Address Length", NULL}
247 ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[3] =
249 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo), "Fixed I/O", NULL},
250 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedIo.Address), "Address", NULL},
251 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedIo.AddressLength), "Address Length", NULL}
254 ACPI_RSDUMP_INFO AcpiRsDumpVendor[3] =
256 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor), "Vendor Specific", NULL},
257 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Vendor.ByteLength), "Length", NULL},
258 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]), "Vendor Data", NULL}
261 ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] =
263 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag), "EndTag", NULL}
266 ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
268 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL},
269 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
270 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL},
271 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL},
272 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL},
273 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.AddressLength), "Address Length", NULL}
276 ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
278 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL},
279 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
280 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL},
281 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL},
282 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL},
283 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.AddressLength), "Address Length", NULL}
286 ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] =
288 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL},
289 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
290 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL},
291 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL}
294 ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] =
296 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL},
297 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
298 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Granularity), "Granularity", NULL},
299 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Minimum), "Address Minimum", NULL},
300 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Maximum), "Address Maximum", NULL},
301 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.TranslationOffset), "Translation Offset", NULL},
302 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.AddressLength), "Address Length", NULL},
303 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL}
306 ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] =
308 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL},
309 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
310 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Granularity), "Granularity", NULL},
311 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Minimum), "Address Minimum", NULL},
312 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Maximum), "Address Maximum", NULL},
313 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.TranslationOffset), "Translation Offset", NULL},
314 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.AddressLength), "Address Length", NULL},
315 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL}
318 ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] =
320 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL},
321 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
322 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Granularity), "Granularity", NULL},
323 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Minimum), "Address Minimum", NULL},
324 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Maximum), "Address Maximum", NULL},
325 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.TranslationOffset), "Translation Offset", NULL},
326 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.AddressLength), "Address Length", NULL},
327 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL}
330 ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] =
332 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL},
333 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
334 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Granularity), "Granularity", NULL},
335 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Minimum), "Address Minimum", NULL},
336 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Maximum), "Address Maximum", NULL},
337 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset), "Translation Offset", NULL},
338 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.AddressLength), "Address Length", NULL},
339 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL}
342 ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] =
344 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL},
345 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode},
346 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode},
347 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode},
348 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
349 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL},
350 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL},
351 {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL}
354 ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] =
356 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL},
357 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.SpaceId), "Space ID", NULL},
358 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitWidth), "Bit Width", NULL},
359 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitOffset), "Bit Offset", NULL},
360 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.AccessSize), "Access Size", NULL},
361 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL}
366 * Tables used for common address descriptor flag fields
368 static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
370 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL},
371 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode},
372 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode},
373 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode},
374 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode}
377 static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
379 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"},
380 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
381 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode},
382 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode},
383 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode}
386 static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
388 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"},
389 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode},
390 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode},
391 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode}
396 * Table used to dump _PRT contents
398 static ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] =
400 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL},
401 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL},
402 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL},
403 {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL},
404 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL}
408 /*******************************************************************************
410 * FUNCTION: AcpiRsDumpDescriptor
412 * PARAMETERS: Resource
414 * RETURN: None
416 * DESCRIPTION:
418 ******************************************************************************/
420 static void
421 AcpiRsDumpDescriptor (
422 void *Resource,
423 ACPI_RSDUMP_INFO *Table)
425 UINT8 *Target = NULL;
426 UINT8 *PreviousTarget;
427 char *Name;
428 UINT8 Count;
431 /* First table entry must contain the table length (# of table entries) */
433 Count = Table->Offset;
435 while (Count)
437 PreviousTarget = Target;
438 Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
439 Name = Table->Name;
441 switch (Table->Opcode)
443 case ACPI_RSD_TITLE:
445 * Optional resource title
447 if (Table->Name)
449 AcpiOsPrintf ("%s Resource\n", Name);
451 break;
453 /* Strings */
455 case ACPI_RSD_LITERAL:
456 AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
457 break;
459 case ACPI_RSD_STRING:
460 AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
461 break;
463 /* Data items, 8/16/32/64 bit */
465 case ACPI_RSD_UINT8:
466 AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
467 break;
469 case ACPI_RSD_UINT16:
470 AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
471 break;
473 case ACPI_RSD_UINT32:
474 AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
475 break;
477 case ACPI_RSD_UINT64:
478 AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
479 break;
481 /* Flags: 1-bit and 2-bit flags supported */
483 case ACPI_RSD_1BITFLAG:
484 AcpiRsOutString (Name, ACPI_CAST_PTR (char,
485 Table->Pointer [*Target & 0x01]));
486 break;
488 case ACPI_RSD_2BITFLAG:
489 AcpiRsOutString (Name, ACPI_CAST_PTR (char,
490 Table->Pointer [*Target & 0x03]));
491 break;
493 case ACPI_RSD_SHORTLIST:
495 * Short byte list (single line output) for DMA and IRQ resources
496 * Note: The list length is obtained from the previous table entry
498 if (PreviousTarget)
500 AcpiRsOutTitle (Name);
501 AcpiRsDumpShortByteList (*PreviousTarget, Target);
503 break;
505 case ACPI_RSD_LONGLIST:
507 * Long byte list for Vendor resource data
508 * Note: The list length is obtained from the previous table entry
510 if (PreviousTarget)
512 AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
514 break;
516 case ACPI_RSD_DWORDLIST:
518 * Dword list for Extended Interrupt resources
519 * Note: The list length is obtained from the previous table entry
521 if (PreviousTarget)
523 AcpiRsDumpDwordList (*PreviousTarget,
524 ACPI_CAST_PTR (UINT32, Target));
526 break;
528 case ACPI_RSD_ADDRESS:
530 * Common flags for all Address resources
532 AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
533 break;
535 case ACPI_RSD_SOURCE:
537 * Optional ResourceSource for Address resources
539 AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
540 break;
542 default:
543 AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
544 Table->Opcode);
545 return;
548 Table++;
549 Count--;
554 /*******************************************************************************
556 * FUNCTION: AcpiRsDumpResourceSource
558 * PARAMETERS: ResourceSource - Pointer to a Resource Source struct
560 * RETURN: None
562 * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
563 * corresponding ResourceSourceIndex.
565 ******************************************************************************/
567 static void
568 AcpiRsDumpResourceSource (
569 ACPI_RESOURCE_SOURCE *ResourceSource)
571 ACPI_FUNCTION_ENTRY ();
574 if (ResourceSource->Index == 0xFF)
576 return;
579 AcpiRsOutInteger8 ("Resource Source Index",
580 ResourceSource->Index);
582 AcpiRsOutString ("Resource Source",
583 ResourceSource->StringPtr ?
584 ResourceSource->StringPtr : "[Not Specified]");
588 /*******************************************************************************
590 * FUNCTION: AcpiRsDumpAddressCommon
592 * PARAMETERS: Resource - Pointer to an internal resource descriptor
594 * RETURN: None
596 * DESCRIPTION: Dump the fields that are common to all Address resource
597 * descriptors
599 ******************************************************************************/
601 static void
602 AcpiRsDumpAddressCommon (
603 ACPI_RESOURCE_DATA *Resource)
605 ACPI_FUNCTION_ENTRY ();
608 /* Decode the type-specific flags */
610 switch (Resource->Address.ResourceType)
612 case ACPI_MEMORY_RANGE:
614 AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
615 break;
617 case ACPI_IO_RANGE:
619 AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
620 break;
622 case ACPI_BUS_NUMBER_RANGE:
624 AcpiRsOutString ("Resource Type", "Bus Number Range");
625 break;
627 default:
629 AcpiRsOutInteger8 ("Resource Type",
630 (UINT8) Resource->Address.ResourceType);
631 break;
634 /* Decode the general flags */
636 AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
640 /*******************************************************************************
642 * FUNCTION: AcpiRsDumpResourceList
644 * PARAMETERS: ResourceList - Pointer to a resource descriptor list
646 * RETURN: None
648 * DESCRIPTION: Dispatches the structure to the correct dump routine.
650 ******************************************************************************/
652 void
653 AcpiRsDumpResourceList (
654 ACPI_RESOURCE *ResourceList)
656 UINT32 Count = 0;
657 UINT32 Type;
660 ACPI_FUNCTION_ENTRY ();
663 if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
665 return;
668 /* Walk list and dump all resource descriptors (END_TAG terminates) */
672 AcpiOsPrintf ("\n[%02X] ", Count);
673 Count++;
675 /* Validate Type before dispatch */
677 Type = ResourceList->Type;
678 if (Type > ACPI_RESOURCE_TYPE_MAX)
680 AcpiOsPrintf (
681 "Invalid descriptor type (%X) in resource list\n",
682 ResourceList->Type);
683 return;
686 /* Dump the resource descriptor */
688 AcpiRsDumpDescriptor (&ResourceList->Data,
689 AcpiGbl_DumpResourceDispatch[Type]);
691 /* Point to the next resource structure */
693 ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
694 ResourceList->Length);
696 /* Exit when END_TAG descriptor is reached */
698 } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
702 /*******************************************************************************
704 * FUNCTION: AcpiRsDumpIrqList
706 * PARAMETERS: RouteTable - Pointer to the routing table to dump.
708 * RETURN: None
710 * DESCRIPTION: Print IRQ routing table
712 ******************************************************************************/
714 void
715 AcpiRsDumpIrqList (
716 UINT8 *RouteTable)
718 ACPI_PCI_ROUTING_TABLE *PrtElement;
719 UINT8 Count;
722 ACPI_FUNCTION_ENTRY ();
725 if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
727 return;
730 PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
732 /* Dump all table elements, Exit on zero length element */
734 for (Count = 0; PrtElement->Length; Count++)
736 AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
737 AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
739 PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
740 PrtElement, PrtElement->Length);
745 /*******************************************************************************
747 * FUNCTION: AcpiRsOut*
749 * PARAMETERS: Title - Name of the resource field
750 * Value - Value of the resource field
752 * RETURN: None
754 * DESCRIPTION: Miscellaneous helper functions to consistently format the
755 * output of the resource dump routines
757 ******************************************************************************/
759 static void
760 AcpiRsOutString (
761 char *Title,
762 char *Value)
764 AcpiOsPrintf ("%27s : %s", Title, Value);
765 if (!*Value)
767 AcpiOsPrintf ("[NULL NAMESTRING]");
769 AcpiOsPrintf ("\n");
772 static void
773 AcpiRsOutInteger8 (
774 char *Title,
775 UINT8 Value)
777 AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
780 static void
781 AcpiRsOutInteger16 (
782 char *Title,
783 UINT16 Value)
785 AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
788 static void
789 AcpiRsOutInteger32 (
790 char *Title,
791 UINT32 Value)
793 AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
796 static void
797 AcpiRsOutInteger64 (
798 char *Title,
799 UINT64 Value)
801 AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
802 ACPI_FORMAT_UINT64 (Value));
805 static void
806 AcpiRsOutTitle (
807 char *Title)
809 AcpiOsPrintf ("%27s : ", Title);
813 /*******************************************************************************
815 * FUNCTION: AcpiRsDump*List
817 * PARAMETERS: Length - Number of elements in the list
818 * Data - Start of the list
820 * RETURN: None
822 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
824 ******************************************************************************/
826 static void
827 AcpiRsDumpByteList (
828 UINT16 Length,
829 UINT8 *Data)
831 UINT8 i;
834 for (i = 0; i < Length; i++)
836 AcpiOsPrintf ("%25s%2.2X : %2.2X\n",
837 "Byte", i, Data[i]);
841 static void
842 AcpiRsDumpShortByteList (
843 UINT8 Length,
844 UINT8 *Data)
846 UINT8 i;
849 for (i = 0; i < Length; i++)
851 AcpiOsPrintf ("%X ", Data[i]);
853 AcpiOsPrintf ("\n");
856 static void
857 AcpiRsDumpDwordList (
858 UINT8 Length,
859 UINT32 *Data)
861 UINT8 i;
864 for (i = 0; i < Length; i++)
866 AcpiOsPrintf ("%25s%2.2X : %8.8X\n",
867 "Dword", i, Data[i]);
871 #endif