]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/dev/acpica/dmresrcl.c
This commit was generated by cvs2svn to compensate for changes in r162911,
[FreeBSD/FreeBSD.git] / sys / contrib / dev / acpica / dmresrcl.c
1 /*******************************************************************************
2  *
3  * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
4  *              $Revision: 1.29 $
5  *
6  ******************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116
117
118 #include <contrib/dev/acpica/acpi.h>
119 #include <contrib/dev/acpica/acdisasm.h>
120
121
122 #ifdef ACPI_DISASSEMBLER
123
124 #define _COMPONENT          ACPI_CA_DEBUGGER
125         ACPI_MODULE_NAME    ("dbresrcl")
126
127
128 /* Common names for address and memory descriptors */
129
130 static char                 *AcpiDmAddressNames[] =
131 {
132     "Address Space Granularity",
133     "Address Range Minimum",
134     "Address Range Maximum",
135     "Address Translation Offset",
136     "Address Length"
137 };
138
139 static char                 *AcpiDmMemoryNames[] =
140 {
141     "Address Range Minimum",
142     "Address Range Maximum",
143     "Address Alignment",
144     "Address Length"
145 };
146
147
148 /* Local prototypes */
149
150 static void
151 AcpiDmSpaceFlags (
152         UINT8               Flags);
153
154 static void
155 AcpiDmIoFlags (
156         UINT8               Flags);
157
158 static void
159 AcpiDmIoFlags2 (
160         UINT8               SpecificFlags);
161
162 static void
163 AcpiDmMemoryFlags (
164     UINT8                   Flags,
165     UINT8                   SpecificFlags);
166
167 static void
168 AcpiDmMemoryFlags2 (
169     UINT8                   SpecificFlags);
170
171 static void
172 AcpiDmResourceSource (
173     AML_RESOURCE            *Resource,
174     ACPI_SIZE               MinimumLength,
175     UINT32                  Length);
176
177 static void
178 AcpiDmAddressFields (
179     void                    *Source,
180     UINT8                   Type,
181     UINT32                  Level);
182
183 static void
184 AcpiDmAddressPrefix (
185     UINT8                   Type);
186
187 static void
188 AcpiDmAddressCommon (
189     AML_RESOURCE            *Resource,
190     UINT8                   Type,
191     UINT32                  Level);
192
193 static void
194 AcpiDmAddressFlags (
195     AML_RESOURCE            *Resource);
196
197
198 /*******************************************************************************
199  *
200  * FUNCTION:    AcpiDmMemoryFields
201  *
202  * PARAMETERS:  Source              - Pointer to the contiguous data fields
203  *              Type                - 16 or 32 (bit)
204  *              Level               - Current source code indentation level
205  *
206  * RETURN:      None
207  *
208  * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
209  *
210  ******************************************************************************/
211
212 static void
213 AcpiDmMemoryFields (
214     void                    *Source,
215     UINT8                   Type,
216     UINT32                  Level)
217 {
218     ACPI_NATIVE_UINT        i;
219
220
221     for (i = 0; i < 4; i++)
222     {
223         AcpiDmIndent (Level + 1);
224
225         switch (Type)
226         {
227         case 16:
228             AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmMemoryNames[i]);
229             break;
230
231         case 32:
232             AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmMemoryNames[i]);
233             break;
234
235         default:
236             return;
237         }
238     }
239 }
240
241
242 /*******************************************************************************
243  *
244  * FUNCTION:    AcpiDm
245  *
246  * PARAMETERS:  Source              - Pointer to the contiguous data fields
247  *              Type                - 16, 32, or 64 (bit)
248  *              Level               - Current source code indentation level
249  *
250  * RETURN:      None
251  *
252  * DESCRIPTION: Decode fields common to address descriptors
253  *
254  ******************************************************************************/
255
256 static void
257 AcpiDmAddressFields (
258     void                    *Source,
259     UINT8                   Type,
260     UINT32                  Level)
261 {
262     ACPI_NATIVE_UINT        i;
263
264
265     AcpiOsPrintf ("\n");
266
267     for (i = 0; i < 5; i++)
268     {
269         AcpiDmIndent (Level + 1);
270
271         switch (Type)
272         {
273         case 16:
274             AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmAddressNames[i]);
275             break;
276
277         case 32:
278             AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmAddressNames[i]);
279             break;
280
281         case 64:
282             AcpiDmDumpInteger64 (((UINT64 *) Source)[i], AcpiDmAddressNames[i]);
283             break;
284
285         default:
286             return;
287         }
288     }
289 }
290
291
292 /*******************************************************************************
293  *
294  * FUNCTION:    AcpiDmAddressPrefix
295  *
296  * PARAMETERS:  Type                - Descriptor type
297  *
298  * RETURN:      None
299  *
300  * DESCRIPTION: Emit name prefix representing the address descriptor type
301  *
302  ******************************************************************************/
303
304 static void
305 AcpiDmAddressPrefix (
306     UINT8                   Type)
307 {
308
309     switch (Type)
310     {
311     case ACPI_RESOURCE_TYPE_ADDRESS16:
312         AcpiOsPrintf ("Word");
313         break;
314
315     case ACPI_RESOURCE_TYPE_ADDRESS32:
316         AcpiOsPrintf ("DWord");
317         break;
318
319     case ACPI_RESOURCE_TYPE_ADDRESS64:
320         AcpiOsPrintf ("QWord");
321         break;
322
323     case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
324         AcpiOsPrintf ("Extended");
325         break;
326
327     default:
328         return;
329     }
330 }
331
332
333 /*******************************************************************************
334  *
335  * FUNCTION:    AcpiDmAddressCommon
336  *
337  * PARAMETERS:  Resource            - Raw AML descriptor
338  *              Type                - Descriptor type
339  *              Level               - Current source code indentation level
340  *
341  * RETURN:      None
342  *
343  * DESCRIPTION: Emit common name and flag fields common to address descriptors
344  *
345  ******************************************************************************/
346
347 static void
348 AcpiDmAddressCommon (
349     AML_RESOURCE            *Resource,
350     UINT8                   Type,
351     UINT32                  Level)
352 {
353     UINT8                   ResourceType;
354     UINT8                   SpecificFlags;
355     UINT8                   Flags;
356
357
358     ResourceType = Resource->Address.ResourceType;
359     SpecificFlags = Resource->Address.SpecificFlags;
360     Flags = Resource->Address.Flags;
361
362     AcpiDmIndent (Level);
363
364     /* Validate ResourceType */
365
366     if ((ResourceType > 2) && (ResourceType < 0xC0))
367     {
368         AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
369         return;
370     }
371
372     /* Prefix is either Word, DWord, QWord, or Extended */
373
374     AcpiDmAddressPrefix (Type);
375
376     /* Resource Types above 0xC0 are vendor-defined */
377
378     if (ResourceType > 2)
379     {
380         AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
381         AcpiDmSpaceFlags (Flags);
382         AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
383         return;
384     }
385
386     /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
387
388     AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType]);
389
390     /* Decode the general and type-specific flags */
391
392     if (ResourceType == ACPI_MEMORY_RANGE)
393     {
394         AcpiDmMemoryFlags (Flags, SpecificFlags);
395     }
396     else /* IO range or BusNumberRange */
397     {
398         AcpiDmIoFlags (Flags);
399         if (ResourceType == ACPI_IO_RANGE)
400         {
401             AcpiOsPrintf (" %s,", AcpiGbl_RNGDecode [SpecificFlags & 0x3]);
402         }
403     }
404 }
405
406
407 /*******************************************************************************
408  *
409  * FUNCTION:    AcpiDmAddressFlags
410  *
411  * PARAMETERS:  Resource        - Raw AML descriptor
412  *
413  * RETURN:      None
414  *
415  * DESCRIPTION: Emit flags common to address descriptors
416  *
417  ******************************************************************************/
418
419 static void
420 AcpiDmAddressFlags (
421     AML_RESOURCE            *Resource)
422 {
423
424     if (Resource->Address.ResourceType == ACPI_IO_RANGE)
425     {
426         AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
427     }
428     else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
429     {
430         AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
431     }
432 }
433
434
435 /*******************************************************************************
436  *
437  * FUNCTION:    AcpiDmSpaceFlags
438  *
439  * PARAMETERS:  Flags               - Flag byte to be decoded
440  *
441  * RETURN:      None
442  *
443  * DESCRIPTION: Decode the flags specific to Space Address space descriptors
444  *
445  ******************************************************************************/
446
447 static void
448 AcpiDmSpaceFlags (
449     UINT8                   Flags)
450 {
451
452     AcpiOsPrintf ("%s, %s, %s, %s,",
453         AcpiGbl_ConsumeDecode [(Flags & 1)],
454         AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
455         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
456         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
457 }
458
459
460 /*******************************************************************************
461  *
462  * FUNCTION:    AcpiDmIoFlags
463  *
464  * PARAMETERS:  Flags               - Flag byte to be decoded
465  *
466  * RETURN:      None
467  *
468  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
469  *
470  ******************************************************************************/
471
472 static void
473 AcpiDmIoFlags (
474         UINT8               Flags)
475 {
476     AcpiOsPrintf ("%s, %s, %s, %s,",
477         AcpiGbl_ConsumeDecode [(Flags & 1)],
478         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
479         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
480         AcpiGbl_DECDecode [(Flags & 0x2) >> 1]);
481 }
482
483
484 /*******************************************************************************
485  *
486  * FUNCTION:    AcpiDmIoFlags2
487  *
488  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
489  *
490  * RETURN:      None
491  *
492  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
493  *
494  ******************************************************************************/
495
496 static void
497 AcpiDmIoFlags2 (
498         UINT8               SpecificFlags)
499 {
500
501     AcpiOsPrintf (", %s",
502         AcpiGbl_TTPDecode [(SpecificFlags & 0x10) >> 4]);
503
504     /* TRS is only used if TTP is TypeTranslation */
505
506     if (SpecificFlags & 0x10)
507     {
508         AcpiOsPrintf (", %s",
509             AcpiGbl_TRSDecode [(SpecificFlags & 0x20) >> 5]);
510     }
511 }
512
513
514 /*******************************************************************************
515  *
516  * FUNCTION:    AcpiDmMemoryFlags
517  *
518  * PARAMETERS:  Flags               - Flag byte to be decoded
519  *              SpecificFlags       - "Specific" flag byte to be decoded
520  *
521  * RETURN:      None
522  *
523  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
524  *
525  ******************************************************************************/
526
527 static void
528 AcpiDmMemoryFlags (
529     UINT8                   Flags,
530     UINT8                   SpecificFlags)
531 {
532
533     AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
534         AcpiGbl_ConsumeDecode [(Flags & 1)],
535         AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
536         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
537         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
538         AcpiGbl_MEMDecode [(SpecificFlags & 0x6) >> 1],
539         AcpiGbl_RWDecode [(SpecificFlags & 0x1)]);
540 }
541
542
543 /*******************************************************************************
544  *
545  * FUNCTION:    AcpiDmMemoryFlags2
546  *
547  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
548  *
549  * RETURN:      None
550  *
551  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
552  *
553  ******************************************************************************/
554
555 static void
556 AcpiDmMemoryFlags2 (
557     UINT8                   SpecificFlags)
558 {
559
560     AcpiOsPrintf (", %s, %s",
561         AcpiGbl_MTPDecode [(SpecificFlags & 0x18) >> 3],
562         AcpiGbl_TTPDecode [(SpecificFlags & 0x20) >> 5]);
563 }
564
565
566 /*******************************************************************************
567  *
568  * FUNCTION:    AcpiDmResourceSource
569  *
570  * PARAMETERS:  Resource        - Raw AML descriptor
571  *              MinimumLength   - descriptor length without optional fields
572  *              ResourceLength
573  *
574  * RETURN:      None
575  *
576  * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
577  *
578  ******************************************************************************/
579
580 static void
581 AcpiDmResourceSource (
582     AML_RESOURCE            *Resource,
583     ACPI_SIZE               MinimumTotalLength,
584     UINT32                  ResourceLength)
585 {
586     UINT8                   *AmlResourceSource;
587     UINT32                  TotalLength;
588
589
590     TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
591
592     /* Check if the optional ResourceSource fields are present */
593
594     if (TotalLength <= MinimumTotalLength)
595     {
596         /* The two optional fields are not used */
597
598         AcpiOsPrintf (",,");
599         return;
600     }
601
602     /* Get a pointer to the ResourceSource */
603
604     AmlResourceSource = ((UINT8 *) Resource) + MinimumTotalLength;
605
606     /*
607      * Always emit the ResourceSourceIndex (Byte)
608      *
609      * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
610      * Index even if the String does not exist. Although this is in violation
611      * of the ACPI specification, it is very important to emit ASL code that
612      * can be compiled back to the identical AML. There may be fields and/or
613      * indexes into the resource template buffer that are compiled to absolute
614      * offsets, and these will be broken if the AML length is changed.
615      */
616     AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
617
618     /* Make sure that the ResourceSource string exists before dumping it */
619
620     if (TotalLength > (MinimumTotalLength + 1))
621     {
622         AcpiOsPrintf (" ");
623         AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
624     }
625
626     AcpiOsPrintf (",");
627 }
628
629
630 /*******************************************************************************
631  *
632  * FUNCTION:    AcpiDmWordDescriptor
633  *
634  * PARAMETERS:  Resource            - Pointer to the resource descriptor
635  *              Length              - Length of the descriptor in bytes
636  *              Level               - Current source code indentation level
637  *
638  * RETURN:      None
639  *
640  * DESCRIPTION: Decode a Word Address Space descriptor
641  *
642  ******************************************************************************/
643
644 void
645 AcpiDmWordDescriptor (
646     AML_RESOURCE            *Resource,
647     UINT32                  Length,
648     UINT32                  Level)
649 {
650
651     /* Dump resource name and flags */
652
653     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
654
655     /* Dump the 5 contiguous WORD values */
656
657     AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
658
659     /* The ResourceSource fields are optional */
660
661     AcpiDmIndent (Level + 1);
662     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
663
664     /* Type-specific flags */
665
666     AcpiDmAddressFlags (Resource);
667     AcpiOsPrintf (")\n");
668 }
669
670
671 /*******************************************************************************
672  *
673  * FUNCTION:    AcpiDmDwordDescriptor
674  *
675  * PARAMETERS:  Resource            - Pointer to the resource descriptor
676  *              Length              - Length of the descriptor in bytes
677  *              Level               - Current source code indentation level
678  *
679  * RETURN:      None
680  *
681  * DESCRIPTION: Decode a DWord Address Space descriptor
682  *
683  ******************************************************************************/
684
685 void
686 AcpiDmDwordDescriptor (
687     AML_RESOURCE            *Resource,
688     UINT32                  Length,
689     UINT32                  Level)
690 {
691
692     /* Dump resource name and flags */
693
694     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
695
696     /* Dump the 5 contiguous DWORD values */
697
698     AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
699
700     /* The ResourceSource fields are optional */
701
702     AcpiDmIndent (Level + 1);
703     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
704
705     /* Type-specific flags */
706
707     AcpiDmAddressFlags (Resource);
708     AcpiOsPrintf (")\n");
709 }
710
711
712 /*******************************************************************************
713  *
714  * FUNCTION:    AcpiDmQwordDescriptor
715  *
716  * PARAMETERS:  Resource            - Pointer to the resource descriptor
717  *              Length              - Length of the descriptor in bytes
718  *              Level               - Current source code indentation level
719  *
720  * RETURN:      None
721  *
722  * DESCRIPTION: Decode a QWord Address Space descriptor
723  *
724  ******************************************************************************/
725
726 void
727 AcpiDmQwordDescriptor (
728     AML_RESOURCE            *Resource,
729     UINT32                  Length,
730     UINT32                  Level)
731 {
732
733     /* Dump resource name and flags */
734
735     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
736
737     /* Dump the 5 contiguous QWORD values */
738
739     AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
740
741     /* The ResourceSource fields are optional */
742
743     AcpiDmIndent (Level + 1);
744     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
745
746     /* Type-specific flags */
747
748     AcpiDmAddressFlags (Resource);
749     AcpiOsPrintf (")\n");
750 }
751
752
753 /*******************************************************************************
754  *
755  * FUNCTION:    AcpiDmExtendedDescriptor
756  *
757  * PARAMETERS:  Resource            - Pointer to the resource descriptor
758  *              Length              - Length of the descriptor in bytes
759  *              Level               - Current source code indentation level
760  *
761  * RETURN:      None
762  *
763  * DESCRIPTION: Decode a Extended Address Space descriptor
764  *
765  ******************************************************************************/
766
767 void
768 AcpiDmExtendedDescriptor (
769     AML_RESOURCE            *Resource,
770     UINT32                  Length,
771     UINT32                  Level)
772 {
773
774     /* Dump resource name and flags */
775
776     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
777
778     /* Dump the 5 contiguous QWORD values */
779
780     AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
781
782     /* Extra field for this descriptor only */
783
784     AcpiDmIndent (Level + 1);
785     AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
786         "Type-Specific Attributes");
787
788     /* Type-specific flags */
789
790     AcpiDmIndent (Level + 1);
791     AcpiDmAddressFlags (Resource);
792     AcpiOsPrintf (")\n");
793 }
794
795
796 /*******************************************************************************
797  *
798  * FUNCTION:    AcpiDmMemory24Descriptor
799  *
800  * PARAMETERS:  Resource            - Pointer to the resource descriptor
801  *              Length              - Length of the descriptor in bytes
802  *              Level               - Current source code indentation level
803  *
804  * RETURN:      None
805  *
806  * DESCRIPTION: Decode a Memory24 descriptor
807  *
808  ******************************************************************************/
809
810 void
811 AcpiDmMemory24Descriptor (
812     AML_RESOURCE            *Resource,
813     UINT32                  Length,
814     UINT32                  Level)
815 {
816
817     /* Dump name and read/write flag */
818
819     AcpiDmIndent (Level);
820     AcpiOsPrintf ("Memory24 (%s,\n",
821         AcpiGbl_RWDecode [Resource->Memory24.Flags & 1]);
822
823     /* Dump the 4 contiguous WORD values */
824
825     AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
826
827     AcpiDmIndent (Level + 1);
828     AcpiOsPrintf (")\n");
829 }
830
831
832 /*******************************************************************************
833  *
834  * FUNCTION:    AcpiDmMemory32Descriptor
835  *
836  * PARAMETERS:  Resource            - Pointer to the resource descriptor
837  *              Length              - Length of the descriptor in bytes
838  *              Level               - Current source code indentation level
839  *
840  * RETURN:      None
841  *
842  * DESCRIPTION: Decode a Memory32 descriptor
843  *
844  ******************************************************************************/
845
846 void
847 AcpiDmMemory32Descriptor (
848     AML_RESOURCE            *Resource,
849     UINT32                  Length,
850     UINT32                  Level)
851 {
852
853     /* Dump name and read/write flag */
854
855     AcpiDmIndent (Level);
856     AcpiOsPrintf ("Memory32 (%s,\n",
857         AcpiGbl_RWDecode [Resource->Memory32.Flags & 1]);
858
859     /* Dump the 4 contiguous DWORD values */
860
861     AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
862
863     AcpiDmIndent (Level + 1);
864     AcpiOsPrintf (")\n");
865 }
866
867
868 /*******************************************************************************
869  *
870  * FUNCTION:    AcpiDmFixedMemory32Descriptor
871  *
872  * PARAMETERS:  Resource            - Pointer to the resource descriptor
873  *              Length              - Length of the descriptor in bytes
874  *              Level               - Current source code indentation level
875  *
876  * RETURN:      None
877  *
878  * DESCRIPTION: Decode a Fixed Memory32 descriptor
879  *
880  ******************************************************************************/
881
882 void
883 AcpiDmFixedMemory32Descriptor (
884     AML_RESOURCE            *Resource,
885     UINT32                  Length,
886     UINT32                  Level)
887 {
888
889     /* Dump name and read/write flag */
890
891     AcpiDmIndent (Level);
892     AcpiOsPrintf ("Memory32Fixed (%s,\n",
893         AcpiGbl_RWDecode [Resource->FixedMemory32.Flags & 1]);
894
895     AcpiDmIndent (Level + 1);
896     AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
897
898     AcpiDmIndent (Level + 1);
899     AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
900
901     AcpiDmIndent (Level + 1);
902     AcpiOsPrintf (")\n");
903 }
904
905
906 /*******************************************************************************
907  *
908  * FUNCTION:    AcpiDmGenericRegisterDescriptor
909  *
910  * PARAMETERS:  Resource            - Pointer to the resource descriptor
911  *              Length              - Length of the descriptor in bytes
912  *              Level               - Current source code indentation level
913  *
914  * RETURN:      None
915  *
916  * DESCRIPTION: Decode a Generic Register descriptor
917  *
918  ******************************************************************************/
919
920 void
921 AcpiDmGenericRegisterDescriptor (
922     AML_RESOURCE            *Resource,
923     UINT32                  Length,
924     UINT32                  Level)
925 {
926
927     AcpiDmIndent (Level);
928     AcpiOsPrintf ("Register (");
929     AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
930     AcpiOsPrintf ("\n");
931
932     AcpiDmIndent (Level + 1);
933     AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Register Bit Width");
934
935     AcpiDmIndent (Level + 1);
936     AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Register Bit Offset");
937
938     AcpiDmIndent (Level + 1);
939     AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Register Address");
940
941     /* Optional field for ACPI 3.0 */
942
943     if (Resource->GenericReg.AccessSize)
944     {
945         AcpiDmIndent (Level + 1);
946         AcpiOsPrintf ("0x%2.2X                // %s\n",
947             Resource->GenericReg.AccessSize, "Access Size");
948     }
949
950     AcpiDmIndent (Level + 1);
951     AcpiOsPrintf (")\n");
952 }
953
954
955 /*******************************************************************************
956  *
957  * FUNCTION:    AcpiDmInterruptDescriptor
958  *
959  * PARAMETERS:  Resource            - Pointer to the resource descriptor
960  *              Length              - Length of the descriptor in bytes
961  *              Level               - Current source code indentation level
962  *
963  * RETURN:      None
964  *
965  * DESCRIPTION: Decode a extended Interrupt descriptor
966  *
967  ******************************************************************************/
968
969 void
970 AcpiDmInterruptDescriptor (
971     AML_RESOURCE            *Resource,
972     UINT32                  Length,
973     UINT32                  Level)
974 {
975     UINT32                  i;
976
977
978     AcpiDmIndent (Level);
979     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
980         AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
981         AcpiGbl_HEDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
982         AcpiGbl_LLDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
983         AcpiGbl_SHRDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
984
985     /*
986      * The ResourceSource fields are optional and appear after the interrupt
987      * list. Must compute length based on length of the list. First xrupt
988      * is included in the struct (reason for -1 below)
989      */
990     AcpiDmResourceSource (Resource,
991         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
992             (Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
993         Resource->ExtendedIrq.ResourceLength);
994
995     /* Dump the interrupt list */
996
997     AcpiOsPrintf (")\n");
998     AcpiDmIndent (Level);
999     AcpiOsPrintf ("{\n");
1000     for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1001     {
1002         AcpiDmIndent (Level + 1);
1003         AcpiOsPrintf ("0x%8.8X,\n",
1004             (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1005     }
1006
1007     AcpiDmIndent (Level);
1008     AcpiOsPrintf ("}\n");
1009 }
1010
1011
1012 /*******************************************************************************
1013  *
1014  * FUNCTION:    AcpiDmVendorCommon
1015  *
1016  * PARAMETERS:  Name                - Descriptor name suffix
1017  *              ByteData            - Pointer to the vendor byte data
1018  *              Length              - Length of the byte data
1019  *              Level               - Current source code indentation level
1020  *
1021  * RETURN:      None
1022  *
1023  * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1024  *
1025  ******************************************************************************/
1026
1027 void
1028 AcpiDmVendorCommon (
1029     char                    *Name,
1030     UINT8                   *ByteData,
1031     UINT32                  Length,
1032     UINT32                  Level)
1033 {
1034
1035     /* Dump descriptor name */
1036
1037     AcpiDmIndent (Level);
1038     AcpiOsPrintf ("Vendor%s          // Length = 0x%.2X\n", Name, Length);
1039
1040     /* Dump the vendor bytes */
1041
1042     AcpiDmIndent (Level);
1043     AcpiOsPrintf ("{\n");
1044
1045     AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1046
1047     AcpiDmIndent (Level);
1048     AcpiOsPrintf ("}\n");
1049 }
1050
1051
1052 /*******************************************************************************
1053  *
1054  * FUNCTION:    AcpiDmVendorLargeDescriptor
1055  *
1056  * PARAMETERS:  Resource            - Pointer to the resource descriptor
1057  *              Length              - Length of the descriptor in bytes
1058  *              Level               - Current source code indentation level
1059  *
1060  * RETURN:      None
1061  *
1062  * DESCRIPTION: Decode a Vendor Large descriptor
1063  *
1064  ******************************************************************************/
1065
1066 void
1067 AcpiDmVendorLargeDescriptor (
1068     AML_RESOURCE            *Resource,
1069     UINT32                  Length,
1070     UINT32                  Level)
1071 {
1072
1073     AcpiDmVendorCommon ("Long () ",
1074         ((UINT8 *) Resource) + sizeof (AML_RESOURCE_LARGE_HEADER),
1075         Length, Level);
1076 }
1077
1078 #endif
1079