Sync ACPICA with Intel's version 20180508 (from previously 20170831).
[dragonfly.git] / sys / contrib / dev / acpica / source / components / disassembler / dmresrcl.c
blob47d3c541a0357bb283caed26f591e288cbb9b2e4
1 /*******************************************************************************
3 * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
5 ******************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12 * All rights reserved.
14 * 2. License
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include "acpi.h"
153 #include "accommon.h"
154 #include "acdisasm.h"
157 #ifdef ACPI_DISASSEMBLER
159 #define _COMPONENT ACPI_CA_DEBUGGER
160 ACPI_MODULE_NAME ("dbresrcl")
163 /* Common names for address and memory descriptors */
165 static const char *AcpiDmAddressNames[] =
167 "Granularity",
168 "Range Minimum",
169 "Range Maximum",
170 "Translation Offset",
171 "Length"
174 static const char *AcpiDmMemoryNames[] =
176 "Range Minimum",
177 "Range Maximum",
178 "Alignment",
179 "Length"
183 /* Local prototypes */
185 static void
186 AcpiDmSpaceFlags (
187 UINT8 Flags);
189 static void
190 AcpiDmIoFlags (
191 UINT8 Flags);
193 static void
194 AcpiDmIoFlags2 (
195 UINT8 SpecificFlags);
197 static void
198 AcpiDmMemoryFlags (
199 UINT8 Flags,
200 UINT8 SpecificFlags);
202 static void
203 AcpiDmMemoryFlags2 (
204 UINT8 SpecificFlags);
206 static void
207 AcpiDmResourceSource (
208 AML_RESOURCE *Resource,
209 ACPI_SIZE MinimumLength,
210 UINT32 Length);
212 static void
213 AcpiDmAddressFields (
214 void *Source,
215 UINT8 Type,
216 UINT32 Level);
218 static void
219 AcpiDmAddressPrefix (
220 UINT8 Type);
222 static void
223 AcpiDmAddressCommon (
224 AML_RESOURCE *Resource,
225 UINT8 Type,
226 UINT32 Level);
228 static void
229 AcpiDmAddressFlags (
230 AML_RESOURCE *Resource);
233 /*******************************************************************************
235 * FUNCTION: AcpiDmMemoryFields
237 * PARAMETERS: Source - Pointer to the contiguous data fields
238 * Type - 16 or 32 (bit)
239 * Level - Current source code indentation level
241 * RETURN: None
243 * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
245 ******************************************************************************/
247 static void
248 AcpiDmMemoryFields (
249 void *Source,
250 UINT8 Type,
251 UINT32 Level)
253 UINT32 i;
256 for (i = 0; i < 4; i++)
258 AcpiDmIndent (Level + 1);
260 switch (Type)
262 case 16:
264 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
265 AcpiDmMemoryNames[i]);
266 break;
268 case 32:
270 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
271 AcpiDmMemoryNames[i]);
272 break;
274 default:
276 return;
282 /*******************************************************************************
284 * FUNCTION: AcpiDmAddressFields
286 * PARAMETERS: Source - Pointer to the contiguous data fields
287 * Type - 16, 32, or 64 (bit)
288 * Level - Current source code indentation level
290 * RETURN: None
292 * DESCRIPTION: Decode fields common to address descriptors
294 ******************************************************************************/
296 static void
297 AcpiDmAddressFields (
298 void *Source,
299 UINT8 Type,
300 UINT32 Level)
302 UINT32 i;
305 AcpiOsPrintf ("\n");
307 for (i = 0; i < 5; i++)
309 AcpiDmIndent (Level + 1);
311 switch (Type)
313 case 16:
315 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
316 AcpiDmAddressNames[i]);
317 break;
319 case 32:
321 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
322 AcpiDmAddressNames[i]);
323 break;
325 case 64:
327 AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
328 AcpiDmAddressNames[i]);
329 break;
331 default:
333 return;
339 /*******************************************************************************
341 * FUNCTION: AcpiDmAddressPrefix
343 * PARAMETERS: Type - Descriptor type
345 * RETURN: None
347 * DESCRIPTION: Emit name prefix representing the address descriptor type
349 ******************************************************************************/
351 static void
352 AcpiDmAddressPrefix (
353 UINT8 Type)
356 switch (Type)
358 case ACPI_RESOURCE_TYPE_ADDRESS16:
360 AcpiOsPrintf ("Word");
361 break;
363 case ACPI_RESOURCE_TYPE_ADDRESS32:
365 AcpiOsPrintf ("DWord");
366 break;
368 case ACPI_RESOURCE_TYPE_ADDRESS64:
370 AcpiOsPrintf ("QWord");
371 break;
373 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
375 AcpiOsPrintf ("Extended");
376 break;
378 default:
380 return;
385 /*******************************************************************************
387 * FUNCTION: AcpiDmAddressCommon
389 * PARAMETERS: Resource - Raw AML descriptor
390 * Type - Descriptor type
391 * Level - Current source code indentation level
393 * RETURN: None
395 * DESCRIPTION: Emit common name and flag fields common to address descriptors
397 ******************************************************************************/
399 static void
400 AcpiDmAddressCommon (
401 AML_RESOURCE *Resource,
402 UINT8 Type,
403 UINT32 Level)
405 UINT8 ResourceType;
406 UINT8 SpecificFlags;
407 UINT8 Flags;
410 ResourceType = Resource->Address.ResourceType;
411 SpecificFlags = Resource->Address.SpecificFlags;
412 Flags = Resource->Address.Flags;
414 AcpiDmIndent (Level);
416 /* Validate ResourceType */
418 if ((ResourceType > 2) && (ResourceType < 0xC0))
420 AcpiOsPrintf (
421 "/**** Invalid Resource Type: 0x%X ****/", ResourceType);
422 return;
425 /* Prefix is either Word, DWord, QWord, or Extended */
427 AcpiDmAddressPrefix (Type);
429 /* Resource Types above 0xC0 are vendor-defined */
431 if (ResourceType > 2)
433 AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
434 AcpiDmSpaceFlags (Flags);
435 AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
436 return;
439 /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
441 AcpiOsPrintf ("%s (",
442 AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
444 /* Decode the general and type-specific flags */
446 if (ResourceType == ACPI_MEMORY_RANGE)
448 AcpiDmMemoryFlags (Flags, SpecificFlags);
450 else /* IO range or BusNumberRange */
452 AcpiDmIoFlags (Flags);
453 if (ResourceType == ACPI_IO_RANGE)
455 AcpiOsPrintf (" %s,",
456 AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
462 /*******************************************************************************
464 * FUNCTION: AcpiDmAddressFlags
466 * PARAMETERS: Resource - Raw AML descriptor
468 * RETURN: None
470 * DESCRIPTION: Emit flags common to address descriptors
472 ******************************************************************************/
474 static void
475 AcpiDmAddressFlags (
476 AML_RESOURCE *Resource)
479 if (Resource->Address.ResourceType == ACPI_IO_RANGE)
481 AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
483 else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
485 AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
490 /*******************************************************************************
492 * FUNCTION: AcpiDmSpaceFlags
494 * PARAMETERS: Flags - Flag byte to be decoded
496 * RETURN: None
498 * DESCRIPTION: Decode the flags specific to Space Address space descriptors
500 ******************************************************************************/
502 static void
503 AcpiDmSpaceFlags (
504 UINT8 Flags)
507 AcpiOsPrintf ("%s, %s, %s, %s,",
508 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
509 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
510 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
511 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
515 /*******************************************************************************
517 * FUNCTION: AcpiDmIoFlags
519 * PARAMETERS: Flags - Flag byte to be decoded
521 * RETURN: None
523 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
525 ******************************************************************************/
527 static void
528 AcpiDmIoFlags (
529 UINT8 Flags)
531 AcpiOsPrintf ("%s, %s, %s, %s,",
532 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
533 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
534 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
535 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
539 /*******************************************************************************
541 * FUNCTION: AcpiDmIoFlags2
543 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
545 * RETURN: None
547 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
549 ******************************************************************************/
551 static void
552 AcpiDmIoFlags2 (
553 UINT8 SpecificFlags)
556 /* _TTP */
558 AcpiOsPrintf (", %s",
559 AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
562 * TRS is only used if TTP is TypeTranslation. However, the disassembler
563 * always emits exactly what is in the AML.
565 AcpiOsPrintf (", %s",
566 AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
570 /*******************************************************************************
572 * FUNCTION: AcpiDmMemoryFlags
574 * PARAMETERS: Flags - Flag byte to be decoded
575 * SpecificFlags - "Specific" flag byte to be decoded
577 * RETURN: None
579 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
581 ******************************************************************************/
583 static void
584 AcpiDmMemoryFlags (
585 UINT8 Flags,
586 UINT8 SpecificFlags)
589 AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
590 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
591 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
592 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
593 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
594 AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
595 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
599 /*******************************************************************************
601 * FUNCTION: AcpiDmMemoryFlags2
603 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
605 * RETURN: None
607 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
609 ******************************************************************************/
611 static void
612 AcpiDmMemoryFlags2 (
613 UINT8 SpecificFlags)
616 AcpiOsPrintf (", %s, %s",
617 AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
618 AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
622 /*******************************************************************************
624 * FUNCTION: AcpiDmResourceSource
626 * PARAMETERS: Resource - Raw AML descriptor
627 * MinimumLength - descriptor length without optional fields
628 * ResourceLength
630 * RETURN: None
632 * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
634 ******************************************************************************/
636 static void
637 AcpiDmResourceSource (
638 AML_RESOURCE *Resource,
639 ACPI_SIZE MinimumTotalLength,
640 UINT32 ResourceLength)
642 UINT8 *AmlResourceSource;
643 UINT32 TotalLength;
646 TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
648 /* Check if the optional ResourceSource fields are present */
650 if (TotalLength <= MinimumTotalLength)
652 /* The two optional fields are not used */
654 AcpiOsPrintf (",, ");
655 return;
658 /* Get a pointer to the ResourceSource */
660 AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
663 * Always emit the ResourceSourceIndex (Byte)
665 * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
666 * Index even if the String does not exist. Although this is in violation
667 * of the ACPI specification, it is very important to emit ASL code that
668 * can be compiled back to the identical AML. There may be fields and/or
669 * indexes into the resource template buffer that are compiled to absolute
670 * offsets, and these will be broken if the AML length is changed.
672 AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
674 /* Make sure that the ResourceSource string exists before dumping it */
676 if (TotalLength > (MinimumTotalLength + 1))
678 AcpiOsPrintf (" ");
679 AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
682 AcpiOsPrintf (", ");
686 /*******************************************************************************
688 * FUNCTION: AcpiDmWordDescriptor
690 * PARAMETERS: Info - Extra resource info
691 * Resource - Pointer to the resource descriptor
692 * Length - Length of the descriptor in bytes
693 * Level - Current source code indentation level
695 * RETURN: None
697 * DESCRIPTION: Decode a Word Address Space descriptor
699 ******************************************************************************/
701 void
702 AcpiDmWordDescriptor (
703 ACPI_OP_WALK_INFO *Info,
704 AML_RESOURCE *Resource,
705 UINT32 Length,
706 UINT32 Level)
709 /* Dump resource name and flags */
711 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
713 /* Dump the 5 contiguous WORD values */
715 AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
717 /* The ResourceSource fields are optional */
719 AcpiDmIndent (Level + 1);
720 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
722 /* Insert a descriptor name */
724 AcpiDmDescriptorName ();
726 /* Type-specific flags */
728 AcpiDmAddressFlags (Resource);
729 AcpiOsPrintf (")\n");
733 /*******************************************************************************
735 * FUNCTION: AcpiDmDwordDescriptor
737 * PARAMETERS: Info - Extra resource info
738 * Resource - Pointer to the resource descriptor
739 * Length - Length of the descriptor in bytes
740 * Level - Current source code indentation level
742 * RETURN: None
744 * DESCRIPTION: Decode a DWord Address Space descriptor
746 ******************************************************************************/
748 void
749 AcpiDmDwordDescriptor (
750 ACPI_OP_WALK_INFO *Info,
751 AML_RESOURCE *Resource,
752 UINT32 Length,
753 UINT32 Level)
756 /* Dump resource name and flags */
758 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
760 /* Dump the 5 contiguous DWORD values */
762 AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
764 /* The ResourceSource fields are optional */
766 AcpiDmIndent (Level + 1);
767 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
769 /* Insert a descriptor name */
771 AcpiDmDescriptorName ();
773 /* Type-specific flags */
775 AcpiDmAddressFlags (Resource);
776 AcpiOsPrintf (")\n");
780 /*******************************************************************************
782 * FUNCTION: AcpiDmQwordDescriptor
784 * PARAMETERS: Info - Extra resource info
785 * Resource - Pointer to the resource descriptor
786 * Length - Length of the descriptor in bytes
787 * Level - Current source code indentation level
789 * RETURN: None
791 * DESCRIPTION: Decode a QWord Address Space descriptor
793 ******************************************************************************/
795 void
796 AcpiDmQwordDescriptor (
797 ACPI_OP_WALK_INFO *Info,
798 AML_RESOURCE *Resource,
799 UINT32 Length,
800 UINT32 Level)
803 /* Dump resource name and flags */
805 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
807 /* Dump the 5 contiguous QWORD values */
809 AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
811 /* The ResourceSource fields are optional */
813 AcpiDmIndent (Level + 1);
814 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
816 /* Insert a descriptor name */
818 AcpiDmDescriptorName ();
820 /* Type-specific flags */
822 AcpiDmAddressFlags (Resource);
823 AcpiOsPrintf (")\n");
827 /*******************************************************************************
829 * FUNCTION: AcpiDmExtendedDescriptor
831 * PARAMETERS: Info - Extra resource info
832 * Resource - Pointer to the resource descriptor
833 * Length - Length of the descriptor in bytes
834 * Level - Current source code indentation level
836 * RETURN: None
838 * DESCRIPTION: Decode a Extended Address Space descriptor
840 ******************************************************************************/
842 void
843 AcpiDmExtendedDescriptor (
844 ACPI_OP_WALK_INFO *Info,
845 AML_RESOURCE *Resource,
846 UINT32 Length,
847 UINT32 Level)
850 /* Dump resource name and flags */
852 AcpiDmAddressCommon (
853 Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
855 /* Dump the 5 contiguous QWORD values */
857 AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
859 /* Extra field for this descriptor only */
861 AcpiDmIndent (Level + 1);
862 AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
863 "Type-Specific Attributes");
865 /* Insert a descriptor name */
867 AcpiDmIndent (Level + 1);
868 AcpiDmDescriptorName ();
870 /* Type-specific flags */
872 AcpiDmAddressFlags (Resource);
873 AcpiOsPrintf (")\n");
877 /*******************************************************************************
879 * FUNCTION: AcpiDmMemory24Descriptor
881 * PARAMETERS: Info - Extra resource info
882 * Resource - Pointer to the resource descriptor
883 * Length - Length of the descriptor in bytes
884 * Level - Current source code indentation level
886 * RETURN: None
888 * DESCRIPTION: Decode a Memory24 descriptor
890 ******************************************************************************/
892 void
893 AcpiDmMemory24Descriptor (
894 ACPI_OP_WALK_INFO *Info,
895 AML_RESOURCE *Resource,
896 UINT32 Length,
897 UINT32 Level)
900 /* Dump name and read/write flag */
902 AcpiDmIndent (Level);
903 AcpiOsPrintf ("Memory24 (%s,\n",
904 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
906 /* Dump the 4 contiguous WORD values */
908 AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
910 /* Insert a descriptor name */
912 AcpiDmIndent (Level + 1);
913 AcpiDmDescriptorName ();
914 AcpiOsPrintf (")\n");
918 /*******************************************************************************
920 * FUNCTION: AcpiDmMemory32Descriptor
922 * PARAMETERS: Info - Extra resource info
923 * Resource - Pointer to the resource descriptor
924 * Length - Length of the descriptor in bytes
925 * Level - Current source code indentation level
927 * RETURN: None
929 * DESCRIPTION: Decode a Memory32 descriptor
931 ******************************************************************************/
933 void
934 AcpiDmMemory32Descriptor (
935 ACPI_OP_WALK_INFO *Info,
936 AML_RESOURCE *Resource,
937 UINT32 Length,
938 UINT32 Level)
941 /* Dump name and read/write flag */
943 AcpiDmIndent (Level);
944 AcpiOsPrintf ("Memory32 (%s,\n",
945 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
947 /* Dump the 4 contiguous DWORD values */
949 AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
951 /* Insert a descriptor name */
953 AcpiDmIndent (Level + 1);
954 AcpiDmDescriptorName ();
955 AcpiOsPrintf (")\n");
959 /*******************************************************************************
961 * FUNCTION: AcpiDmFixedMemory32Descriptor
963 * PARAMETERS: Info - Extra resource info
964 * Resource - Pointer to the resource descriptor
965 * Length - Length of the descriptor in bytes
966 * Level - Current source code indentation level
968 * RETURN: None
970 * DESCRIPTION: Decode a Fixed Memory32 descriptor
972 ******************************************************************************/
974 void
975 AcpiDmFixedMemory32Descriptor (
976 ACPI_OP_WALK_INFO *Info,
977 AML_RESOURCE *Resource,
978 UINT32 Length,
979 UINT32 Level)
982 /* Dump name and read/write flag */
984 AcpiDmIndent (Level);
985 AcpiOsPrintf ("Memory32Fixed (%s,\n",
986 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
988 AcpiDmIndent (Level + 1);
989 AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
990 "Address Base");
992 AcpiDmIndent (Level + 1);
993 AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
994 "Address Length");
996 /* Insert a descriptor name */
998 AcpiDmIndent (Level + 1);
999 AcpiDmDescriptorName ();
1000 AcpiOsPrintf (")\n");
1004 /*******************************************************************************
1006 * FUNCTION: AcpiDmGenericRegisterDescriptor
1008 * PARAMETERS: Info - Extra resource info
1009 * Resource - Pointer to the resource descriptor
1010 * Length - Length of the descriptor in bytes
1011 * Level - Current source code indentation level
1013 * RETURN: None
1015 * DESCRIPTION: Decode a Generic Register descriptor
1017 ******************************************************************************/
1019 void
1020 AcpiDmGenericRegisterDescriptor (
1021 ACPI_OP_WALK_INFO *Info,
1022 AML_RESOURCE *Resource,
1023 UINT32 Length,
1024 UINT32 Level)
1027 AcpiDmIndent (Level);
1028 AcpiOsPrintf ("Register (");
1029 AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
1030 AcpiOsPrintf ("\n");
1032 AcpiDmIndent (Level + 1);
1033 AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
1035 AcpiDmIndent (Level + 1);
1036 AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
1038 AcpiDmIndent (Level + 1);
1039 AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
1041 /* Optional field for ACPI 3.0 */
1043 AcpiDmIndent (Level + 1);
1044 if (Resource->GenericReg.AccessSize)
1046 AcpiOsPrintf ("0x%2.2X, // %s\n",
1047 Resource->GenericReg.AccessSize, "Access Size");
1048 AcpiDmIndent (Level + 1);
1050 else
1052 AcpiOsPrintf (",");
1055 /* DescriptorName was added for ACPI 3.0+ */
1057 AcpiDmDescriptorName ();
1058 AcpiOsPrintf (")\n");
1062 /*******************************************************************************
1064 * FUNCTION: AcpiDmInterruptDescriptor
1066 * PARAMETERS: Info - Extra resource info
1067 * Resource - Pointer to the resource descriptor
1068 * Length - Length of the descriptor in bytes
1069 * Level - Current source code indentation level
1071 * RETURN: None
1073 * DESCRIPTION: Decode a extended Interrupt descriptor
1075 ******************************************************************************/
1077 void
1078 AcpiDmInterruptDescriptor (
1079 ACPI_OP_WALK_INFO *Info,
1080 AML_RESOURCE *Resource,
1081 UINT32 Length,
1082 UINT32 Level)
1084 UINT32 i;
1087 AcpiDmIndent (Level);
1088 AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
1089 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
1090 AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
1091 AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
1092 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
1095 * The ResourceSource fields are optional and appear after the interrupt
1096 * list. Must compute length based on length of the list. First xrupt
1097 * is included in the struct (reason for -1 below)
1099 AcpiDmResourceSource (Resource,
1100 sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1101 ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
1102 Resource->ExtendedIrq.ResourceLength);
1104 /* Insert a descriptor name */
1106 AcpiDmDescriptorName ();
1107 AcpiOsPrintf (")\n");
1109 /* Dump the interrupt list */
1111 AcpiDmIndent (Level);
1112 AcpiOsPrintf ("{\n");
1113 for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1115 AcpiDmIndent (Level + 1);
1116 AcpiOsPrintf ("0x%8.8X,\n",
1117 (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1120 AcpiDmIndent (Level);
1121 AcpiOsPrintf ("}\n");
1125 /*******************************************************************************
1127 * FUNCTION: AcpiDmVendorCommon
1129 * PARAMETERS: Name - Descriptor name suffix
1130 * ByteData - Pointer to the vendor byte data
1131 * Length - Length of the byte data
1132 * Level - Current source code indentation level
1134 * RETURN: None
1136 * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1138 ******************************************************************************/
1140 void
1141 AcpiDmVendorCommon (
1142 const char *Name,
1143 UINT8 *ByteData,
1144 UINT32 Length,
1145 UINT32 Level)
1148 /* Dump macro name */
1150 AcpiDmIndent (Level);
1151 AcpiOsPrintf ("Vendor%s (", Name);
1153 /* Insert a descriptor name */
1155 AcpiDmDescriptorName ();
1156 AcpiOsPrintf (") // Length = 0x%.2X\n", Length);
1158 /* Dump the vendor bytes */
1160 AcpiDmIndent (Level);
1161 AcpiOsPrintf ("{\n");
1163 AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1165 AcpiDmIndent (Level);
1166 AcpiOsPrintf ("}\n");
1170 /*******************************************************************************
1172 * FUNCTION: AcpiDmVendorLargeDescriptor
1174 * PARAMETERS: Info - Extra resource info
1175 * Resource - Pointer to the resource descriptor
1176 * Length - Length of the descriptor in bytes
1177 * Level - Current source code indentation level
1179 * RETURN: None
1181 * DESCRIPTION: Decode a Vendor Large descriptor
1183 ******************************************************************************/
1185 void
1186 AcpiDmVendorLargeDescriptor (
1187 ACPI_OP_WALK_INFO *Info,
1188 AML_RESOURCE *Resource,
1189 UINT32 Length,
1190 UINT32 Level)
1193 AcpiDmVendorCommon ("Long ",
1194 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1195 Length, Level);
1198 #endif