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