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