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