Import acpica-unix-20090521
[dragonfly.git] / sys / contrib / dev / acpica-unix / disassembler / dmresrcl.c
blobb1b86db2f3212306a473f7b57ecc90418d4edeb2
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 - 2009, 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 *****************************************************************************/
117 #include "acpi.h"
118 #include "accommon.h"
119 #include "acdisasm.h"
122 #ifdef ACPI_DISASSEMBLER
124 #define _COMPONENT ACPI_CA_DEBUGGER
125 ACPI_MODULE_NAME ("dbresrcl")
128 /* Common names for address and memory descriptors */
130 static char *AcpiDmAddressNames[] =
132 "Granularity",
133 "Range Minimum",
134 "Range Maximum",
135 "Translation Offset",
136 "Length"
139 static char *AcpiDmMemoryNames[] =
141 "Range Minimum",
142 "Range Maximum",
143 "Alignment",
144 "Length"
148 /* Local prototypes */
150 static void
151 AcpiDmSpaceFlags (
152 UINT8 Flags);
154 static void
155 AcpiDmIoFlags (
156 UINT8 Flags);
158 static void
159 AcpiDmIoFlags2 (
160 UINT8 SpecificFlags);
162 static void
163 AcpiDmMemoryFlags (
164 UINT8 Flags,
165 UINT8 SpecificFlags);
167 static void
168 AcpiDmMemoryFlags2 (
169 UINT8 SpecificFlags);
171 static void
172 AcpiDmResourceSource (
173 AML_RESOURCE *Resource,
174 ACPI_SIZE MinimumLength,
175 UINT32 Length);
177 static void
178 AcpiDmAddressFields (
179 void *Source,
180 UINT8 Type,
181 UINT32 Level);
183 static void
184 AcpiDmAddressPrefix (
185 UINT8 Type);
187 static void
188 AcpiDmAddressCommon (
189 AML_RESOURCE *Resource,
190 UINT8 Type,
191 UINT32 Level);
193 static void
194 AcpiDmAddressFlags (
195 AML_RESOURCE *Resource);
198 /*******************************************************************************
200 * FUNCTION: AcpiDmMemoryFields
202 * PARAMETERS: Source - Pointer to the contiguous data fields
203 * Type - 16 or 32 (bit)
204 * Level - Current source code indentation level
206 * RETURN: None
208 * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
210 ******************************************************************************/
212 static void
213 AcpiDmMemoryFields (
214 void *Source,
215 UINT8 Type,
216 UINT32 Level)
218 UINT32 i;
221 for (i = 0; i < 4; i++)
223 AcpiDmIndent (Level + 1);
225 switch (Type)
227 case 16:
228 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
229 AcpiDmMemoryNames[i]);
230 break;
232 case 32:
233 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
234 AcpiDmMemoryNames[i]);
235 break;
237 default:
238 return;
244 /*******************************************************************************
246 * FUNCTION: AcpiDmAddressFields
248 * PARAMETERS: Source - Pointer to the contiguous data fields
249 * Type - 16, 32, or 64 (bit)
250 * Level - Current source code indentation level
252 * RETURN: None
254 * DESCRIPTION: Decode fields common to address descriptors
256 ******************************************************************************/
258 static void
259 AcpiDmAddressFields (
260 void *Source,
261 UINT8 Type,
262 UINT32 Level)
264 UINT32 i;
267 AcpiOsPrintf ("\n");
269 for (i = 0; i < 5; i++)
271 AcpiDmIndent (Level + 1);
273 switch (Type)
275 case 16:
276 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
277 AcpiDmAddressNames[i]);
278 break;
280 case 32:
281 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
282 AcpiDmAddressNames[i]);
283 break;
285 case 64:
286 AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
287 AcpiDmAddressNames[i]);
288 break;
290 default:
291 return;
297 /*******************************************************************************
299 * FUNCTION: AcpiDmAddressPrefix
301 * PARAMETERS: Type - Descriptor type
303 * RETURN: None
305 * DESCRIPTION: Emit name prefix representing the address descriptor type
307 ******************************************************************************/
309 static void
310 AcpiDmAddressPrefix (
311 UINT8 Type)
314 switch (Type)
316 case ACPI_RESOURCE_TYPE_ADDRESS16:
317 AcpiOsPrintf ("Word");
318 break;
320 case ACPI_RESOURCE_TYPE_ADDRESS32:
321 AcpiOsPrintf ("DWord");
322 break;
324 case ACPI_RESOURCE_TYPE_ADDRESS64:
325 AcpiOsPrintf ("QWord");
326 break;
328 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
329 AcpiOsPrintf ("Extended");
330 break;
332 default:
333 return;
338 /*******************************************************************************
340 * FUNCTION: AcpiDmAddressCommon
342 * PARAMETERS: Resource - Raw AML descriptor
343 * Type - Descriptor type
344 * Level - Current source code indentation level
346 * RETURN: None
348 * DESCRIPTION: Emit common name and flag fields common to address descriptors
350 ******************************************************************************/
352 static void
353 AcpiDmAddressCommon (
354 AML_RESOURCE *Resource,
355 UINT8 Type,
356 UINT32 Level)
358 UINT8 ResourceType;
359 UINT8 SpecificFlags;
360 UINT8 Flags;
363 ResourceType = Resource->Address.ResourceType;
364 SpecificFlags = Resource->Address.SpecificFlags;
365 Flags = Resource->Address.Flags;
367 AcpiDmIndent (Level);
369 /* Validate ResourceType */
371 if ((ResourceType > 2) && (ResourceType < 0xC0))
373 AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
374 return;
377 /* Prefix is either Word, DWord, QWord, or Extended */
379 AcpiDmAddressPrefix (Type);
381 /* Resource Types above 0xC0 are vendor-defined */
383 if (ResourceType > 2)
385 AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
386 AcpiDmSpaceFlags (Flags);
387 AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
388 return;
391 /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
393 AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
395 /* Decode the general and type-specific flags */
397 if (ResourceType == ACPI_MEMORY_RANGE)
399 AcpiDmMemoryFlags (Flags, SpecificFlags);
401 else /* IO range or BusNumberRange */
403 AcpiDmIoFlags (Flags);
404 if (ResourceType == ACPI_IO_RANGE)
406 AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
412 /*******************************************************************************
414 * FUNCTION: AcpiDmAddressFlags
416 * PARAMETERS: Resource - Raw AML descriptor
418 * RETURN: None
420 * DESCRIPTION: Emit flags common to address descriptors
422 ******************************************************************************/
424 static void
425 AcpiDmAddressFlags (
426 AML_RESOURCE *Resource)
429 if (Resource->Address.ResourceType == ACPI_IO_RANGE)
431 AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
433 else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
435 AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
440 /*******************************************************************************
442 * FUNCTION: AcpiDmSpaceFlags
444 * PARAMETERS: Flags - Flag byte to be decoded
446 * RETURN: None
448 * DESCRIPTION: Decode the flags specific to Space Address space descriptors
450 ******************************************************************************/
452 static void
453 AcpiDmSpaceFlags (
454 UINT8 Flags)
457 AcpiOsPrintf ("%s, %s, %s, %s,",
458 AcpiGbl_ConsumeDecode [(Flags & 1)],
459 AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
460 AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
461 AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
465 /*******************************************************************************
467 * FUNCTION: AcpiDmIoFlags
469 * PARAMETERS: Flags - Flag byte to be decoded
471 * RETURN: None
473 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
475 ******************************************************************************/
477 static void
478 AcpiDmIoFlags (
479 UINT8 Flags)
481 AcpiOsPrintf ("%s, %s, %s, %s,",
482 AcpiGbl_ConsumeDecode [(Flags & 1)],
483 AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
484 AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
485 AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
489 /*******************************************************************************
491 * FUNCTION: AcpiDmIoFlags2
493 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
495 * RETURN: None
497 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
499 ******************************************************************************/
501 static void
502 AcpiDmIoFlags2 (
503 UINT8 SpecificFlags)
506 AcpiOsPrintf (", %s",
507 AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
509 /* TRS is only used if TTP is TypeTranslation */
511 if (SpecificFlags & 0x10)
513 AcpiOsPrintf (", %s",
514 AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
519 /*******************************************************************************
521 * FUNCTION: AcpiDmMemoryFlags
523 * PARAMETERS: Flags - Flag byte to be decoded
524 * SpecificFlags - "Specific" flag byte to be decoded
526 * RETURN: None
528 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
530 ******************************************************************************/
532 static void
533 AcpiDmMemoryFlags (
534 UINT8 Flags,
535 UINT8 SpecificFlags)
538 AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
539 AcpiGbl_ConsumeDecode [(Flags & 1)],
540 AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
541 AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
542 AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
543 AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
544 AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
548 /*******************************************************************************
550 * FUNCTION: AcpiDmMemoryFlags2
552 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
554 * RETURN: None
556 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
558 ******************************************************************************/
560 static void
561 AcpiDmMemoryFlags2 (
562 UINT8 SpecificFlags)
565 AcpiOsPrintf (", %s, %s",
566 AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
567 AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
571 /*******************************************************************************
573 * FUNCTION: AcpiDmResourceSource
575 * PARAMETERS: Resource - Raw AML descriptor
576 * MinimumLength - descriptor length without optional fields
577 * ResourceLength
579 * RETURN: None
581 * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
583 ******************************************************************************/
585 static void
586 AcpiDmResourceSource (
587 AML_RESOURCE *Resource,
588 ACPI_SIZE MinimumTotalLength,
589 UINT32 ResourceLength)
591 UINT8 *AmlResourceSource;
592 UINT32 TotalLength;
595 TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
597 /* Check if the optional ResourceSource fields are present */
599 if (TotalLength <= MinimumTotalLength)
601 /* The two optional fields are not used */
603 AcpiOsPrintf (",, ");
604 return;
607 /* Get a pointer to the ResourceSource */
609 AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
612 * Always emit the ResourceSourceIndex (Byte)
614 * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
615 * Index even if the String does not exist. Although this is in violation
616 * of the ACPI specification, it is very important to emit ASL code that
617 * can be compiled back to the identical AML. There may be fields and/or
618 * indexes into the resource template buffer that are compiled to absolute
619 * offsets, and these will be broken if the AML length is changed.
621 AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
623 /* Make sure that the ResourceSource string exists before dumping it */
625 if (TotalLength > (MinimumTotalLength + 1))
627 AcpiOsPrintf (" ");
628 AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
631 AcpiOsPrintf (", ");
635 /*******************************************************************************
637 * FUNCTION: AcpiDmWordDescriptor
639 * PARAMETERS: Resource - Pointer to the resource descriptor
640 * Length - Length of the descriptor in bytes
641 * Level - Current source code indentation level
643 * RETURN: None
645 * DESCRIPTION: Decode a Word Address Space descriptor
647 ******************************************************************************/
649 void
650 AcpiDmWordDescriptor (
651 AML_RESOURCE *Resource,
652 UINT32 Length,
653 UINT32 Level)
656 /* Dump resource name and flags */
658 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
660 /* Dump the 5 contiguous WORD values */
662 AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
664 /* The ResourceSource fields are optional */
666 AcpiDmIndent (Level + 1);
667 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
669 /* Insert a descriptor name */
671 AcpiDmDescriptorName ();
673 /* Type-specific flags */
675 AcpiDmAddressFlags (Resource);
676 AcpiOsPrintf (")\n");
680 /*******************************************************************************
682 * FUNCTION: AcpiDmDwordDescriptor
684 * PARAMETERS: Resource - Pointer to the resource descriptor
685 * Length - Length of the descriptor in bytes
686 * Level - Current source code indentation level
688 * RETURN: None
690 * DESCRIPTION: Decode a DWord Address Space descriptor
692 ******************************************************************************/
694 void
695 AcpiDmDwordDescriptor (
696 AML_RESOURCE *Resource,
697 UINT32 Length,
698 UINT32 Level)
701 /* Dump resource name and flags */
703 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
705 /* Dump the 5 contiguous DWORD values */
707 AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
709 /* The ResourceSource fields are optional */
711 AcpiDmIndent (Level + 1);
712 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
714 /* Insert a descriptor name */
716 AcpiDmDescriptorName ();
718 /* Type-specific flags */
720 AcpiDmAddressFlags (Resource);
721 AcpiOsPrintf (")\n");
725 /*******************************************************************************
727 * FUNCTION: AcpiDmQwordDescriptor
729 * PARAMETERS: Resource - Pointer to the resource descriptor
730 * Length - Length of the descriptor in bytes
731 * Level - Current source code indentation level
733 * RETURN: None
735 * DESCRIPTION: Decode a QWord Address Space descriptor
737 ******************************************************************************/
739 void
740 AcpiDmQwordDescriptor (
741 AML_RESOURCE *Resource,
742 UINT32 Length,
743 UINT32 Level)
746 /* Dump resource name and flags */
748 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
750 /* Dump the 5 contiguous QWORD values */
752 AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
754 /* The ResourceSource fields are optional */
756 AcpiDmIndent (Level + 1);
757 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
759 /* Insert a descriptor name */
761 AcpiDmDescriptorName ();
763 /* Type-specific flags */
765 AcpiDmAddressFlags (Resource);
766 AcpiOsPrintf (")\n");
770 /*******************************************************************************
772 * FUNCTION: AcpiDmExtendedDescriptor
774 * PARAMETERS: Resource - Pointer to the resource descriptor
775 * Length - Length of the descriptor in bytes
776 * Level - Current source code indentation level
778 * RETURN: None
780 * DESCRIPTION: Decode a Extended Address Space descriptor
782 ******************************************************************************/
784 void
785 AcpiDmExtendedDescriptor (
786 AML_RESOURCE *Resource,
787 UINT32 Length,
788 UINT32 Level)
791 /* Dump resource name and flags */
793 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
795 /* Dump the 5 contiguous QWORD values */
797 AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
799 /* Extra field for this descriptor only */
801 AcpiDmIndent (Level + 1);
802 AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
803 "Type-Specific Attributes");
805 /* Insert a descriptor name */
807 AcpiDmIndent (Level + 1);
808 AcpiDmDescriptorName ();
810 /* Type-specific flags */
812 AcpiDmAddressFlags (Resource);
813 AcpiOsPrintf (")\n");
817 /*******************************************************************************
819 * FUNCTION: AcpiDmMemory24Descriptor
821 * PARAMETERS: Resource - Pointer to the resource descriptor
822 * Length - Length of the descriptor in bytes
823 * Level - Current source code indentation level
825 * RETURN: None
827 * DESCRIPTION: Decode a Memory24 descriptor
829 ******************************************************************************/
831 void
832 AcpiDmMemory24Descriptor (
833 AML_RESOURCE *Resource,
834 UINT32 Length,
835 UINT32 Level)
838 /* Dump name and read/write flag */
840 AcpiDmIndent (Level);
841 AcpiOsPrintf ("Memory24 (%s,\n",
842 AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
844 /* Dump the 4 contiguous WORD values */
846 AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
848 /* Insert a descriptor name */
850 AcpiDmIndent (Level + 1);
851 AcpiDmDescriptorName ();
852 AcpiOsPrintf (")\n");
856 /*******************************************************************************
858 * FUNCTION: AcpiDmMemory32Descriptor
860 * PARAMETERS: Resource - Pointer to the resource descriptor
861 * Length - Length of the descriptor in bytes
862 * Level - Current source code indentation level
864 * RETURN: None
866 * DESCRIPTION: Decode a Memory32 descriptor
868 ******************************************************************************/
870 void
871 AcpiDmMemory32Descriptor (
872 AML_RESOURCE *Resource,
873 UINT32 Length,
874 UINT32 Level)
877 /* Dump name and read/write flag */
879 AcpiDmIndent (Level);
880 AcpiOsPrintf ("Memory32 (%s,\n",
881 AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
883 /* Dump the 4 contiguous DWORD values */
885 AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
887 /* Insert a descriptor name */
889 AcpiDmIndent (Level + 1);
890 AcpiDmDescriptorName ();
891 AcpiOsPrintf (")\n");
895 /*******************************************************************************
897 * FUNCTION: AcpiDmFixedMemory32Descriptor
899 * PARAMETERS: Resource - Pointer to the resource descriptor
900 * Length - Length of the descriptor in bytes
901 * Level - Current source code indentation level
903 * RETURN: None
905 * DESCRIPTION: Decode a Fixed Memory32 descriptor
907 ******************************************************************************/
909 void
910 AcpiDmFixedMemory32Descriptor (
911 AML_RESOURCE *Resource,
912 UINT32 Length,
913 UINT32 Level)
916 /* Dump name and read/write flag */
918 AcpiDmIndent (Level);
919 AcpiOsPrintf ("Memory32Fixed (%s,\n",
920 AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
922 AcpiDmIndent (Level + 1);
923 AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
925 AcpiDmIndent (Level + 1);
926 AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
928 /* Insert a descriptor name */
930 AcpiDmIndent (Level + 1);
931 AcpiDmDescriptorName ();
932 AcpiOsPrintf (")\n");
936 /*******************************************************************************
938 * FUNCTION: AcpiDmGenericRegisterDescriptor
940 * PARAMETERS: Resource - Pointer to the resource descriptor
941 * Length - Length of the descriptor in bytes
942 * Level - Current source code indentation level
944 * RETURN: None
946 * DESCRIPTION: Decode a Generic Register descriptor
948 ******************************************************************************/
950 void
951 AcpiDmGenericRegisterDescriptor (
952 AML_RESOURCE *Resource,
953 UINT32 Length,
954 UINT32 Level)
957 AcpiDmIndent (Level);
958 AcpiOsPrintf ("Register (");
959 AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
960 AcpiOsPrintf ("\n");
962 AcpiDmIndent (Level + 1);
963 AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
965 AcpiDmIndent (Level + 1);
966 AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
968 AcpiDmIndent (Level + 1);
969 AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
971 /* Optional field for ACPI 3.0 */
973 AcpiDmIndent (Level + 1);
974 if (Resource->GenericReg.AccessSize)
976 AcpiOsPrintf ("0x%2.2X, // %s\n",
977 Resource->GenericReg.AccessSize, "Access Size");
978 AcpiDmIndent (Level + 1);
980 else
982 AcpiOsPrintf (",");
985 /* DescriptorName was added for ACPI 3.0+ */
987 AcpiDmDescriptorName ();
988 AcpiOsPrintf (")\n");
992 /*******************************************************************************
994 * FUNCTION: AcpiDmInterruptDescriptor
996 * PARAMETERS: Resource - Pointer to the resource descriptor
997 * Length - Length of the descriptor in bytes
998 * Level - Current source code indentation level
1000 * RETURN: None
1002 * DESCRIPTION: Decode a extended Interrupt descriptor
1004 ******************************************************************************/
1006 void
1007 AcpiDmInterruptDescriptor (
1008 AML_RESOURCE *Resource,
1009 UINT32 Length,
1010 UINT32 Level)
1012 UINT32 i;
1015 AcpiDmIndent (Level);
1016 AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
1017 AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
1018 AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
1019 AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
1020 AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
1023 * The ResourceSource fields are optional and appear after the interrupt
1024 * list. Must compute length based on length of the list. First xrupt
1025 * is included in the struct (reason for -1 below)
1027 AcpiDmResourceSource (Resource,
1028 sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1029 ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
1030 Resource->ExtendedIrq.ResourceLength);
1032 /* Insert a descriptor name */
1034 AcpiDmDescriptorName ();
1035 AcpiOsPrintf (")\n");
1037 /* Dump the interrupt list */
1039 AcpiDmIndent (Level);
1040 AcpiOsPrintf ("{\n");
1041 for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1043 AcpiDmIndent (Level + 1);
1044 AcpiOsPrintf ("0x%8.8X,\n",
1045 (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1048 AcpiDmIndent (Level);
1049 AcpiOsPrintf ("}\n");
1053 /*******************************************************************************
1055 * FUNCTION: AcpiDmVendorCommon
1057 * PARAMETERS: Name - Descriptor name suffix
1058 * ByteData - Pointer to the vendor byte data
1059 * Length - Length of the byte data
1060 * Level - Current source code indentation level
1062 * RETURN: None
1064 * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1066 ******************************************************************************/
1068 void
1069 AcpiDmVendorCommon (
1070 char *Name,
1071 UINT8 *ByteData,
1072 UINT32 Length,
1073 UINT32 Level)
1076 /* Dump macro name */
1078 AcpiDmIndent (Level);
1079 AcpiOsPrintf ("Vendor%s (", Name);
1081 /* Insert a descriptor name */
1083 AcpiDmDescriptorName ();
1084 AcpiOsPrintf (") // Length = 0x%.2X\n", Length);
1086 /* Dump the vendor bytes */
1088 AcpiDmIndent (Level);
1089 AcpiOsPrintf ("{\n");
1091 AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1093 AcpiDmIndent (Level);
1094 AcpiOsPrintf ("}\n");
1098 /*******************************************************************************
1100 * FUNCTION: AcpiDmVendorLargeDescriptor
1102 * PARAMETERS: Resource - Pointer to the resource descriptor
1103 * Length - Length of the descriptor in bytes
1104 * Level - Current source code indentation level
1106 * RETURN: None
1108 * DESCRIPTION: Decode a Vendor Large descriptor
1110 ******************************************************************************/
1112 void
1113 AcpiDmVendorLargeDescriptor (
1114 AML_RESOURCE *Resource,
1115 UINT32 Length,
1116 UINT32 Level)
1119 AcpiDmVendorCommon ("Long ",
1120 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1121 Length, Level);
1124 #endif