xref: /freebsd/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c (revision 5dae51da3da0cc94d17bd67b308fad304ebec7e0)
1 /*******************************************************************************
2  *
3  * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdisasm.h>
47 
48 
49 #define _COMPONENT          ACPI_CA_DEBUGGER
50         ACPI_MODULE_NAME    ("dbresrcl")
51 
52 
53 /* Common names for address and memory descriptors */
54 
55 static const char           *AcpiDmAddressNames[] =
56 {
57     "Granularity",
58     "Range Minimum",
59     "Range Maximum",
60     "Translation Offset",
61     "Length"
62 };
63 
64 static const char           *AcpiDmMemoryNames[] =
65 {
66     "Range Minimum",
67     "Range Maximum",
68     "Alignment",
69     "Length"
70 };
71 
72 
73 /* Local prototypes */
74 
75 static void
76 AcpiDmSpaceFlags (
77         UINT8               Flags);
78 
79 static void
80 AcpiDmIoFlags (
81         UINT8               Flags);
82 
83 static void
84 AcpiDmIoFlags2 (
85         UINT8               SpecificFlags);
86 
87 static void
88 AcpiDmMemoryFlags (
89     UINT8                   Flags,
90     UINT8                   SpecificFlags);
91 
92 static void
93 AcpiDmMemoryFlags2 (
94     UINT8                   SpecificFlags);
95 
96 static void
97 AcpiDmResourceSource (
98     AML_RESOURCE            *Resource,
99     ACPI_SIZE               MinimumLength,
100     UINT32                  Length);
101 
102 static void
103 AcpiDmAddressFields (
104     void                    *Source,
105     UINT8                   Type,
106     UINT32                  Level);
107 
108 static void
109 AcpiDmAddressPrefix (
110     UINT8                   Type);
111 
112 static void
113 AcpiDmAddressCommon (
114     AML_RESOURCE            *Resource,
115     UINT8                   Type,
116     UINT32                  Level);
117 
118 static void
119 AcpiDmAddressFlags (
120     AML_RESOURCE            *Resource);
121 
122 
123 /*******************************************************************************
124  *
125  * FUNCTION:    AcpiDmMemoryFields
126  *
127  * PARAMETERS:  Source              - Pointer to the contiguous data fields
128  *              Type                - 16 or 32 (bit)
129  *              Level               - Current source code indentation level
130  *
131  * RETURN:      None
132  *
133  * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
134  *
135  ******************************************************************************/
136 
137 static void
138 AcpiDmMemoryFields (
139     void                    *Source,
140     UINT8                   Type,
141     UINT32                  Level)
142 {
143     UINT32                  i;
144 
145 
146     for (i = 0; i < 4; i++)
147     {
148         AcpiDmIndent (Level + 1);
149 
150         switch (Type)
151         {
152         case 16:
153 
154             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
155                 AcpiDmMemoryNames[i]);
156             break;
157 
158         case 32:
159 
160             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
161                 AcpiDmMemoryNames[i]);
162             break;
163 
164         default:
165 
166             return;
167         }
168     }
169 }
170 
171 
172 /*******************************************************************************
173  *
174  * FUNCTION:    AcpiDmAddressFields
175  *
176  * PARAMETERS:  Source              - Pointer to the contiguous data fields
177  *              Type                - 16, 32, or 64 (bit)
178  *              Level               - Current source code indentation level
179  *
180  * RETURN:      None
181  *
182  * DESCRIPTION: Decode fields common to address descriptors
183  *
184  ******************************************************************************/
185 
186 static void
187 AcpiDmAddressFields (
188     void                    *Source,
189     UINT8                   Type,
190     UINT32                  Level)
191 {
192     UINT32                  i;
193 
194 
195     AcpiOsPrintf ("\n");
196 
197     for (i = 0; i < 5; i++)
198     {
199         AcpiDmIndent (Level + 1);
200 
201         switch (Type)
202         {
203         case 16:
204 
205             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
206                 AcpiDmAddressNames[i]);
207             break;
208 
209         case 32:
210 
211             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
212                 AcpiDmAddressNames[i]);
213             break;
214 
215         case 64:
216 
217             AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
218                 AcpiDmAddressNames[i]);
219             break;
220 
221         default:
222 
223             return;
224         }
225     }
226 }
227 
228 
229 /*******************************************************************************
230  *
231  * FUNCTION:    AcpiDmAddressPrefix
232  *
233  * PARAMETERS:  Type                - Descriptor type
234  *
235  * RETURN:      None
236  *
237  * DESCRIPTION: Emit name prefix representing the address descriptor type
238  *
239  ******************************************************************************/
240 
241 static void
242 AcpiDmAddressPrefix (
243     UINT8                   Type)
244 {
245 
246     switch (Type)
247     {
248     case ACPI_RESOURCE_TYPE_ADDRESS16:
249 
250         AcpiOsPrintf ("Word");
251         break;
252 
253     case ACPI_RESOURCE_TYPE_ADDRESS32:
254 
255         AcpiOsPrintf ("DWord");
256         break;
257 
258     case ACPI_RESOURCE_TYPE_ADDRESS64:
259 
260         AcpiOsPrintf ("QWord");
261         break;
262 
263     case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
264 
265         AcpiOsPrintf ("Extended");
266         break;
267 
268     default:
269 
270         return;
271     }
272 }
273 
274 
275 /*******************************************************************************
276  *
277  * FUNCTION:    AcpiDmAddressCommon
278  *
279  * PARAMETERS:  Resource            - Raw AML descriptor
280  *              Type                - Descriptor type
281  *              Level               - Current source code indentation level
282  *
283  * RETURN:      None
284  *
285  * DESCRIPTION: Emit common name and flag fields common to address descriptors
286  *
287  ******************************************************************************/
288 
289 static void
290 AcpiDmAddressCommon (
291     AML_RESOURCE            *Resource,
292     UINT8                   Type,
293     UINT32                  Level)
294 {
295     UINT8                   ResourceType;
296     UINT8                   SpecificFlags;
297     UINT8                   Flags;
298 
299 
300     ResourceType = Resource->Address.ResourceType;
301     SpecificFlags = Resource->Address.SpecificFlags;
302     Flags = Resource->Address.Flags;
303 
304     AcpiDmIndent (Level);
305 
306     /* Validate ResourceType */
307 
308     if ((ResourceType > 2) && (ResourceType < 0xC0))
309     {
310         AcpiOsPrintf (
311             "/**** Invalid Resource Type: 0x%X ****/", ResourceType);
312         return;
313     }
314 
315     /* Prefix is either Word, DWord, QWord, or Extended */
316 
317     AcpiDmAddressPrefix (Type);
318 
319     /* Resource Types above 0xC0 are vendor-defined */
320 
321     if (ResourceType > 2)
322     {
323         AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
324         AcpiDmSpaceFlags (Flags);
325         AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
326         return;
327     }
328 
329     /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
330 
331     AcpiOsPrintf ("%s (",
332         AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
333 
334     /* Decode the general and type-specific flags */
335 
336     if (ResourceType == ACPI_MEMORY_RANGE)
337     {
338         AcpiDmMemoryFlags (Flags, SpecificFlags);
339     }
340     else /* IO range or BusNumberRange */
341     {
342         AcpiDmIoFlags (Flags);
343         if (ResourceType == ACPI_IO_RANGE)
344         {
345             AcpiOsPrintf (" %s,",
346                 AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
347         }
348     }
349 }
350 
351 
352 /*******************************************************************************
353  *
354  * FUNCTION:    AcpiDmAddressFlags
355  *
356  * PARAMETERS:  Resource        - Raw AML descriptor
357  *
358  * RETURN:      None
359  *
360  * DESCRIPTION: Emit flags common to address descriptors
361  *
362  ******************************************************************************/
363 
364 static void
365 AcpiDmAddressFlags (
366     AML_RESOURCE            *Resource)
367 {
368 
369     if (Resource->Address.ResourceType == ACPI_IO_RANGE)
370     {
371         AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
372     }
373     else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
374     {
375         AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
376     }
377 }
378 
379 
380 /*******************************************************************************
381  *
382  * FUNCTION:    AcpiDmSpaceFlags
383  *
384  * PARAMETERS:  Flags               - Flag byte to be decoded
385  *
386  * RETURN:      None
387  *
388  * DESCRIPTION: Decode the flags specific to Space Address space descriptors
389  *
390  ******************************************************************************/
391 
392 static void
393 AcpiDmSpaceFlags (
394     UINT8                   Flags)
395 {
396 
397     AcpiOsPrintf ("%s, %s, %s, %s,",
398         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
399         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
400         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
401         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
402 }
403 
404 
405 /*******************************************************************************
406  *
407  * FUNCTION:    AcpiDmIoFlags
408  *
409  * PARAMETERS:  Flags               - Flag byte to be decoded
410  *
411  * RETURN:      None
412  *
413  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
414  *
415  ******************************************************************************/
416 
417 static void
418 AcpiDmIoFlags (
419         UINT8               Flags)
420 {
421     AcpiOsPrintf ("%s, %s, %s, %s,",
422         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
423         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
424         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
425         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
426 }
427 
428 
429 /*******************************************************************************
430  *
431  * FUNCTION:    AcpiDmIoFlags2
432  *
433  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
434  *
435  * RETURN:      None
436  *
437  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
438  *
439  ******************************************************************************/
440 
441 static void
442 AcpiDmIoFlags2 (
443         UINT8               SpecificFlags)
444 {
445 
446     /* _TTP */
447 
448     AcpiOsPrintf (", %s",
449         AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
450 
451     /*
452      * TRS is only used if TTP is TypeTranslation. However, the disassembler
453      * always emits exactly what is in the AML.
454      */
455     AcpiOsPrintf (", %s",
456         AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
457 }
458 
459 
460 /*******************************************************************************
461  *
462  * FUNCTION:    AcpiDmMemoryFlags
463  *
464  * PARAMETERS:  Flags               - Flag byte to be decoded
465  *              SpecificFlags       - "Specific" flag byte to be decoded
466  *
467  * RETURN:      None
468  *
469  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
470  *
471  ******************************************************************************/
472 
473 static void
474 AcpiDmMemoryFlags (
475     UINT8                   Flags,
476     UINT8                   SpecificFlags)
477 {
478 
479     AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
480         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
481         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
482         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
483         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
484         AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
485         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
486 }
487 
488 
489 /*******************************************************************************
490  *
491  * FUNCTION:    AcpiDmMemoryFlags2
492  *
493  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
494  *
495  * RETURN:      None
496  *
497  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
498  *
499  ******************************************************************************/
500 
501 static void
502 AcpiDmMemoryFlags2 (
503     UINT8                   SpecificFlags)
504 {
505 
506     AcpiOsPrintf (", %s, %s",
507         AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
508         AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
509 }
510 
511 
512 /*******************************************************************************
513  *
514  * FUNCTION:    AcpiDmResourceSource
515  *
516  * PARAMETERS:  Resource        - Raw AML descriptor
517  *              MinimumLength   - descriptor length without optional fields
518  *              ResourceLength
519  *
520  * RETURN:      None
521  *
522  * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
523  *
524  ******************************************************************************/
525 
526 static void
527 AcpiDmResourceSource (
528     AML_RESOURCE            *Resource,
529     ACPI_SIZE               MinimumTotalLength,
530     UINT32                  ResourceLength)
531 {
532     UINT8                   *AmlResourceSource;
533     UINT32                  TotalLength;
534 
535 
536     TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
537 
538     /* Check if the optional ResourceSource fields are present */
539 
540     if (TotalLength <= MinimumTotalLength)
541     {
542         /* The two optional fields are not used */
543 
544         AcpiOsPrintf (",, ");
545         return;
546     }
547 
548     /* Get a pointer to the ResourceSource */
549 
550     AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
551 
552     /*
553      * Always emit the ResourceSourceIndex (Byte)
554      *
555      * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
556      * Index even if the String does not exist. Although this is in violation
557      * of the ACPI specification, it is very important to emit ASL code that
558      * can be compiled back to the identical AML. There may be fields and/or
559      * indexes into the resource template buffer that are compiled to absolute
560      * offsets, and these will be broken if the AML length is changed.
561      */
562     AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
563 
564     /* Make sure that the ResourceSource string exists before dumping it */
565 
566     if (TotalLength > (MinimumTotalLength + 1))
567     {
568         AcpiOsPrintf (" ");
569         AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
570     }
571 
572     AcpiOsPrintf (", ");
573 }
574 
575 
576 /*******************************************************************************
577  *
578  * FUNCTION:    AcpiDmWordDescriptor
579  *
580  * PARAMETERS:  Info                - Extra resource info
581  *              Resource            - Pointer to the resource descriptor
582  *              Length              - Length of the descriptor in bytes
583  *              Level               - Current source code indentation level
584  *
585  * RETURN:      None
586  *
587  * DESCRIPTION: Decode a Word Address Space descriptor
588  *
589  ******************************************************************************/
590 
591 void
592 AcpiDmWordDescriptor (
593     ACPI_OP_WALK_INFO       *Info,
594     AML_RESOURCE            *Resource,
595     UINT32                  Length,
596     UINT32                  Level)
597 {
598 
599     /* Dump resource name and flags */
600 
601     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
602 
603     /* Dump the 5 contiguous WORD values */
604 
605     AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
606 
607     /* The ResourceSource fields are optional */
608 
609     AcpiDmIndent (Level + 1);
610     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
611 
612     /* Insert a descriptor name */
613 
614     AcpiDmDescriptorName ();
615 
616     /* Type-specific flags */
617 
618     AcpiDmAddressFlags (Resource);
619     AcpiOsPrintf (")\n");
620 }
621 
622 
623 /*******************************************************************************
624  *
625  * FUNCTION:    AcpiDmDwordDescriptor
626  *
627  * PARAMETERS:  Info                - Extra resource info
628  *              Resource            - Pointer to the resource descriptor
629  *              Length              - Length of the descriptor in bytes
630  *              Level               - Current source code indentation level
631  *
632  * RETURN:      None
633  *
634  * DESCRIPTION: Decode a DWord Address Space descriptor
635  *
636  ******************************************************************************/
637 
638 void
639 AcpiDmDwordDescriptor (
640     ACPI_OP_WALK_INFO       *Info,
641     AML_RESOURCE            *Resource,
642     UINT32                  Length,
643     UINT32                  Level)
644 {
645 
646     /* Dump resource name and flags */
647 
648     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
649 
650     /* Dump the 5 contiguous DWORD values */
651 
652     AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
653 
654     /* The ResourceSource fields are optional */
655 
656     AcpiDmIndent (Level + 1);
657     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
658 
659     /* Insert a descriptor name */
660 
661     AcpiDmDescriptorName ();
662 
663     /* Type-specific flags */
664 
665     AcpiDmAddressFlags (Resource);
666     AcpiOsPrintf (")\n");
667 }
668 
669 
670 /*******************************************************************************
671  *
672  * FUNCTION:    AcpiDmQwordDescriptor
673  *
674  * PARAMETERS:  Info                - Extra resource info
675  *              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 QWord Address Space descriptor
682  *
683  ******************************************************************************/
684 
685 void
686 AcpiDmQwordDescriptor (
687     ACPI_OP_WALK_INFO       *Info,
688     AML_RESOURCE            *Resource,
689     UINT32                  Length,
690     UINT32                  Level)
691 {
692 
693     /* Dump resource name and flags */
694 
695     AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
696 
697     /* Dump the 5 contiguous QWORD values */
698 
699     AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
700 
701     /* The ResourceSource fields are optional */
702 
703     AcpiDmIndent (Level + 1);
704     AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
705 
706     /* Insert a descriptor name */
707 
708     AcpiDmDescriptorName ();
709 
710     /* Type-specific flags */
711 
712     AcpiDmAddressFlags (Resource);
713     AcpiOsPrintf (")\n");
714 }
715 
716 
717 /*******************************************************************************
718  *
719  * FUNCTION:    AcpiDmExtendedDescriptor
720  *
721  * PARAMETERS:  Info                - Extra resource info
722  *              Resource            - Pointer to the resource descriptor
723  *              Length              - Length of the descriptor in bytes
724  *              Level               - Current source code indentation level
725  *
726  * RETURN:      None
727  *
728  * DESCRIPTION: Decode a Extended Address Space descriptor
729  *
730  ******************************************************************************/
731 
732 void
733 AcpiDmExtendedDescriptor (
734     ACPI_OP_WALK_INFO       *Info,
735     AML_RESOURCE            *Resource,
736     UINT32                  Length,
737     UINT32                  Level)
738 {
739 
740     /* Dump resource name and flags */
741 
742     AcpiDmAddressCommon (
743         Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
744 
745     /* Dump the 5 contiguous QWORD values */
746 
747     AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
748 
749     /* Extra field for this descriptor only */
750 
751     AcpiDmIndent (Level + 1);
752     AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
753         "Type-Specific Attributes");
754 
755     /* Insert a descriptor name */
756 
757     AcpiDmIndent (Level + 1);
758     AcpiDmDescriptorName ();
759 
760     /* Type-specific flags */
761 
762     AcpiDmAddressFlags (Resource);
763     AcpiOsPrintf (")\n");
764 }
765 
766 
767 /*******************************************************************************
768  *
769  * FUNCTION:    AcpiDmMemory24Descriptor
770  *
771  * PARAMETERS:  Info                - Extra resource info
772  *              Resource            - Pointer to the resource descriptor
773  *              Length              - Length of the descriptor in bytes
774  *              Level               - Current source code indentation level
775  *
776  * RETURN:      None
777  *
778  * DESCRIPTION: Decode a Memory24 descriptor
779  *
780  ******************************************************************************/
781 
782 void
783 AcpiDmMemory24Descriptor (
784     ACPI_OP_WALK_INFO       *Info,
785     AML_RESOURCE            *Resource,
786     UINT32                  Length,
787     UINT32                  Level)
788 {
789 
790     /* Dump name and read/write flag */
791 
792     AcpiDmIndent (Level);
793     AcpiOsPrintf ("Memory24 (%s,\n",
794         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
795 
796     /* Dump the 4 contiguous WORD values */
797 
798     AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
799 
800     /* Insert a descriptor name */
801 
802     AcpiDmIndent (Level + 1);
803     AcpiDmDescriptorName ();
804     AcpiOsPrintf (")\n");
805 }
806 
807 
808 /*******************************************************************************
809  *
810  * FUNCTION:    AcpiDmMemory32Descriptor
811  *
812  * PARAMETERS:  Info                - Extra resource info
813  *              Resource            - Pointer to the resource descriptor
814  *              Length              - Length of the descriptor in bytes
815  *              Level               - Current source code indentation level
816  *
817  * RETURN:      None
818  *
819  * DESCRIPTION: Decode a Memory32 descriptor
820  *
821  ******************************************************************************/
822 
823 void
824 AcpiDmMemory32Descriptor (
825     ACPI_OP_WALK_INFO       *Info,
826     AML_RESOURCE            *Resource,
827     UINT32                  Length,
828     UINT32                  Level)
829 {
830 
831     /* Dump name and read/write flag */
832 
833     AcpiDmIndent (Level);
834     AcpiOsPrintf ("Memory32 (%s,\n",
835         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
836 
837     /* Dump the 4 contiguous DWORD values */
838 
839     AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
840 
841     /* Insert a descriptor name */
842 
843     AcpiDmIndent (Level + 1);
844     AcpiDmDescriptorName ();
845     AcpiOsPrintf (")\n");
846 }
847 
848 
849 /*******************************************************************************
850  *
851  * FUNCTION:    AcpiDmFixedMemory32Descriptor
852  *
853  * PARAMETERS:  Info                - Extra resource info
854  *              Resource            - Pointer to the resource descriptor
855  *              Length              - Length of the descriptor in bytes
856  *              Level               - Current source code indentation level
857  *
858  * RETURN:      None
859  *
860  * DESCRIPTION: Decode a Fixed Memory32 descriptor
861  *
862  ******************************************************************************/
863 
864 void
865 AcpiDmFixedMemory32Descriptor (
866     ACPI_OP_WALK_INFO       *Info,
867     AML_RESOURCE            *Resource,
868     UINT32                  Length,
869     UINT32                  Level)
870 {
871 
872     /* Dump name and read/write flag */
873 
874     AcpiDmIndent (Level);
875     AcpiOsPrintf ("Memory32Fixed (%s,\n",
876         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
877 
878     AcpiDmIndent (Level + 1);
879     AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
880         "Address Base");
881 
882     AcpiDmIndent (Level + 1);
883     AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
884         "Address Length");
885 
886     /* Insert a descriptor name */
887 
888     AcpiDmIndent (Level + 1);
889     AcpiDmDescriptorName ();
890     AcpiOsPrintf (")\n");
891 }
892 
893 
894 /*******************************************************************************
895  *
896  * FUNCTION:    AcpiDmGenericRegisterDescriptor
897  *
898  * PARAMETERS:  Info                - Extra resource info
899  *              Resource            - Pointer to the resource descriptor
900  *              Length              - Length of the descriptor in bytes
901  *              Level               - Current source code indentation level
902  *
903  * RETURN:      None
904  *
905  * DESCRIPTION: Decode a Generic Register descriptor
906  *
907  ******************************************************************************/
908 
909 void
910 AcpiDmGenericRegisterDescriptor (
911     ACPI_OP_WALK_INFO       *Info,
912     AML_RESOURCE            *Resource,
913     UINT32                  Length,
914     UINT32                  Level)
915 {
916 
917     AcpiDmIndent (Level);
918     AcpiOsPrintf ("Register (");
919     AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
920     AcpiOsPrintf ("\n");
921 
922     AcpiDmIndent (Level + 1);
923     AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
924 
925     AcpiDmIndent (Level + 1);
926     AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
927 
928     AcpiDmIndent (Level + 1);
929     AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
930 
931     /* Optional field for ACPI 3.0 */
932 
933     AcpiDmIndent (Level + 1);
934     if (Resource->GenericReg.AccessSize)
935     {
936         AcpiOsPrintf ("0x%2.2X,               // %s\n",
937             Resource->GenericReg.AccessSize, "Access Size");
938         AcpiDmIndent (Level + 1);
939     }
940     else
941     {
942         AcpiOsPrintf (",");
943     }
944 
945     /* DescriptorName was added for ACPI 3.0+ */
946 
947     AcpiDmDescriptorName ();
948     AcpiOsPrintf (")\n");
949 }
950 
951 
952 /*******************************************************************************
953  *
954  * FUNCTION:    AcpiDmInterruptDescriptor
955  *
956  * PARAMETERS:  Info                - Extra resource info
957  *              Resource            - Pointer to the resource descriptor
958  *              Length              - Length of the descriptor in bytes
959  *              Level               - Current source code indentation level
960  *
961  * RETURN:      None
962  *
963  * DESCRIPTION: Decode a extended Interrupt descriptor
964  *
965  ******************************************************************************/
966 
967 void
968 AcpiDmInterruptDescriptor (
969     ACPI_OP_WALK_INFO       *Info,
970     AML_RESOURCE            *Resource,
971     UINT32                  Length,
972     UINT32                  Level)
973 {
974     UINT32                  i;
975 
976 
977     AcpiDmIndent (Level);
978     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
979         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
980         AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
981         AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
982         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
983 
984     /*
985      * The ResourceSource fields are optional and appear after the interrupt
986      * list. Must compute length based on length of the list. First xrupt
987      * is included in the struct (reason for -1 below)
988      */
989     AcpiDmResourceSource (Resource,
990         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
991             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
992         Resource->ExtendedIrq.ResourceLength);
993 
994     /* Insert a descriptor name */
995 
996     AcpiDmDescriptorName ();
997     AcpiOsPrintf (")\n");
998 
999     /* Dump the interrupt list */
1000 
1001     AcpiDmIndent (Level);
1002     AcpiOsPrintf ("{\n");
1003     for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1004     {
1005         AcpiDmIndent (Level + 1);
1006         AcpiOsPrintf ("0x%8.8X,\n",
1007             (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1008     }
1009 
1010     AcpiDmIndent (Level);
1011     AcpiOsPrintf ("}\n");
1012 }
1013 
1014 
1015 /*******************************************************************************
1016  *
1017  * FUNCTION:    AcpiDmVendorCommon
1018  *
1019  * PARAMETERS:  Name                - Descriptor name suffix
1020  *              ByteData            - Pointer to the vendor byte data
1021  *              Length              - Length of the byte data
1022  *              Level               - Current source code indentation level
1023  *
1024  * RETURN:      None
1025  *
1026  * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1027  *
1028  ******************************************************************************/
1029 
1030 void
1031 AcpiDmVendorCommon (
1032     const char              *Name,
1033     UINT8                   *ByteData,
1034     UINT32                  Length,
1035     UINT32                  Level)
1036 {
1037 
1038     /* Dump macro name */
1039 
1040     AcpiDmIndent (Level);
1041     AcpiOsPrintf ("Vendor%s (", Name);
1042 
1043     /* Insert a descriptor name */
1044 
1045     AcpiDmDescriptorName ();
1046     AcpiOsPrintf (")      // Length = 0x%.2X\n", Length);
1047 
1048     /* Dump the vendor bytes */
1049 
1050     AcpiDmIndent (Level);
1051     AcpiOsPrintf ("{\n");
1052 
1053     AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1054 
1055     AcpiDmIndent (Level);
1056     AcpiOsPrintf ("}\n");
1057 }
1058 
1059 
1060 /*******************************************************************************
1061  *
1062  * FUNCTION:    AcpiDmVendorLargeDescriptor
1063  *
1064  * PARAMETERS:  Info                - Extra resource info
1065  *              Resource            - Pointer to the resource descriptor
1066  *              Length              - Length of the descriptor in bytes
1067  *              Level               - Current source code indentation level
1068  *
1069  * RETURN:      None
1070  *
1071  * DESCRIPTION: Decode a Vendor Large descriptor
1072  *
1073  ******************************************************************************/
1074 
1075 void
1076 AcpiDmVendorLargeDescriptor (
1077     ACPI_OP_WALK_INFO       *Info,
1078     AML_RESOURCE            *Resource,
1079     UINT32                  Length,
1080     UINT32                  Level)
1081 {
1082 
1083     AcpiDmVendorCommon ("Long ",
1084         ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1085         Length, Level);
1086 }
1087