Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / source / components / disassembler / dmresrcl.c
blob0e53672a7308afe3fde27aa6ecc65b3725ce629a
1 /*******************************************************************************
3 * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
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.
45 #include "acpi.h"
46 #include "accommon.h"
47 #include "acdisasm.h"
50 #ifdef ACPI_DISASSEMBLER
52 #define _COMPONENT ACPI_CA_DEBUGGER
53 ACPI_MODULE_NAME ("dbresrcl")
56 /* Common names for address and memory descriptors */
58 static char *AcpiDmAddressNames[] =
60 "Granularity",
61 "Range Minimum",
62 "Range Maximum",
63 "Translation Offset",
64 "Length"
67 static char *AcpiDmMemoryNames[] =
69 "Range Minimum",
70 "Range Maximum",
71 "Alignment",
72 "Length"
76 /* Local prototypes */
78 static void
79 AcpiDmSpaceFlags (
80 UINT8 Flags);
82 static void
83 AcpiDmIoFlags (
84 UINT8 Flags);
86 static void
87 AcpiDmIoFlags2 (
88 UINT8 SpecificFlags);
90 static void
91 AcpiDmMemoryFlags (
92 UINT8 Flags,
93 UINT8 SpecificFlags);
95 static void
96 AcpiDmMemoryFlags2 (
97 UINT8 SpecificFlags);
99 static void
100 AcpiDmResourceSource (
101 AML_RESOURCE *Resource,
102 ACPI_SIZE MinimumLength,
103 UINT32 Length);
105 static void
106 AcpiDmAddressFields (
107 void *Source,
108 UINT8 Type,
109 UINT32 Level);
111 static void
112 AcpiDmAddressPrefix (
113 UINT8 Type);
115 static void
116 AcpiDmAddressCommon (
117 AML_RESOURCE *Resource,
118 UINT8 Type,
119 UINT32 Level);
121 static void
122 AcpiDmAddressFlags (
123 AML_RESOURCE *Resource);
126 /*******************************************************************************
128 * FUNCTION: AcpiDmMemoryFields
130 * PARAMETERS: Source - Pointer to the contiguous data fields
131 * Type - 16 or 32 (bit)
132 * Level - Current source code indentation level
134 * RETURN: None
136 * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
138 ******************************************************************************/
140 static void
141 AcpiDmMemoryFields (
142 void *Source,
143 UINT8 Type,
144 UINT32 Level)
146 UINT32 i;
149 for (i = 0; i < 4; i++)
151 AcpiDmIndent (Level + 1);
153 switch (Type)
155 case 16:
157 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
158 AcpiDmMemoryNames[i]);
159 break;
161 case 32:
163 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
164 AcpiDmMemoryNames[i]);
165 break;
167 default:
169 return;
175 /*******************************************************************************
177 * FUNCTION: AcpiDmAddressFields
179 * PARAMETERS: Source - Pointer to the contiguous data fields
180 * Type - 16, 32, or 64 (bit)
181 * Level - Current source code indentation level
183 * RETURN: None
185 * DESCRIPTION: Decode fields common to address descriptors
187 ******************************************************************************/
189 static void
190 AcpiDmAddressFields (
191 void *Source,
192 UINT8 Type,
193 UINT32 Level)
195 UINT32 i;
198 AcpiOsPrintf ("\n");
200 for (i = 0; i < 5; i++)
202 AcpiDmIndent (Level + 1);
204 switch (Type)
206 case 16:
208 AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
209 AcpiDmAddressNames[i]);
210 break;
212 case 32:
214 AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
215 AcpiDmAddressNames[i]);
216 break;
218 case 64:
220 AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
221 AcpiDmAddressNames[i]);
222 break;
224 default:
226 return;
232 /*******************************************************************************
234 * FUNCTION: AcpiDmAddressPrefix
236 * PARAMETERS: Type - Descriptor type
238 * RETURN: None
240 * DESCRIPTION: Emit name prefix representing the address descriptor type
242 ******************************************************************************/
244 static void
245 AcpiDmAddressPrefix (
246 UINT8 Type)
249 switch (Type)
251 case ACPI_RESOURCE_TYPE_ADDRESS16:
253 AcpiOsPrintf ("Word");
254 break;
256 case ACPI_RESOURCE_TYPE_ADDRESS32:
258 AcpiOsPrintf ("DWord");
259 break;
261 case ACPI_RESOURCE_TYPE_ADDRESS64:
263 AcpiOsPrintf ("QWord");
264 break;
266 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
268 AcpiOsPrintf ("Extended");
269 break;
271 default:
273 return;
278 /*******************************************************************************
280 * FUNCTION: AcpiDmAddressCommon
282 * PARAMETERS: Resource - Raw AML descriptor
283 * Type - Descriptor type
284 * Level - Current source code indentation level
286 * RETURN: None
288 * DESCRIPTION: Emit common name and flag fields common to address descriptors
290 ******************************************************************************/
292 static void
293 AcpiDmAddressCommon (
294 AML_RESOURCE *Resource,
295 UINT8 Type,
296 UINT32 Level)
298 UINT8 ResourceType;
299 UINT8 SpecificFlags;
300 UINT8 Flags;
303 ResourceType = Resource->Address.ResourceType;
304 SpecificFlags = Resource->Address.SpecificFlags;
305 Flags = Resource->Address.Flags;
307 AcpiDmIndent (Level);
309 /* Validate ResourceType */
311 if ((ResourceType > 2) && (ResourceType < 0xC0))
313 AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
314 return;
317 /* Prefix is either Word, DWord, QWord, or Extended */
319 AcpiDmAddressPrefix (Type);
321 /* Resource Types above 0xC0 are vendor-defined */
323 if (ResourceType > 2)
325 AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
326 AcpiDmSpaceFlags (Flags);
327 AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
328 return;
331 /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
333 AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
335 /* Decode the general and type-specific flags */
337 if (ResourceType == ACPI_MEMORY_RANGE)
339 AcpiDmMemoryFlags (Flags, SpecificFlags);
341 else /* IO range or BusNumberRange */
343 AcpiDmIoFlags (Flags);
344 if (ResourceType == ACPI_IO_RANGE)
346 AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
352 /*******************************************************************************
354 * FUNCTION: AcpiDmAddressFlags
356 * PARAMETERS: Resource - Raw AML descriptor
358 * RETURN: None
360 * DESCRIPTION: Emit flags common to address descriptors
362 ******************************************************************************/
364 static void
365 AcpiDmAddressFlags (
366 AML_RESOURCE *Resource)
369 if (Resource->Address.ResourceType == ACPI_IO_RANGE)
371 AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
373 else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
375 AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
380 /*******************************************************************************
382 * FUNCTION: AcpiDmSpaceFlags
384 * PARAMETERS: Flags - Flag byte to be decoded
386 * RETURN: None
388 * DESCRIPTION: Decode the flags specific to Space Address space descriptors
390 ******************************************************************************/
392 static void
393 AcpiDmSpaceFlags (
394 UINT8 Flags)
397 AcpiOsPrintf ("%s, %s, %s, %s,",
398 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
399 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
400 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
401 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
405 /*******************************************************************************
407 * FUNCTION: AcpiDmIoFlags
409 * PARAMETERS: Flags - Flag byte to be decoded
411 * RETURN: None
413 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
415 ******************************************************************************/
417 static void
418 AcpiDmIoFlags (
419 UINT8 Flags)
421 AcpiOsPrintf ("%s, %s, %s, %s,",
422 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
423 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
424 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
425 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
429 /*******************************************************************************
431 * FUNCTION: AcpiDmIoFlags2
433 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
435 * RETURN: None
437 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
439 ******************************************************************************/
441 static void
442 AcpiDmIoFlags2 (
443 UINT8 SpecificFlags)
446 AcpiOsPrintf (", %s",
447 AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
449 /* TRS is only used if TTP is TypeTranslation */
451 if (SpecificFlags & 0x10)
453 AcpiOsPrintf (", %s",
454 AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
459 /*******************************************************************************
461 * FUNCTION: AcpiDmMemoryFlags
463 * PARAMETERS: Flags - Flag byte to be decoded
464 * SpecificFlags - "Specific" flag byte to be decoded
466 * RETURN: None
468 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
470 ******************************************************************************/
472 static void
473 AcpiDmMemoryFlags (
474 UINT8 Flags,
475 UINT8 SpecificFlags)
478 AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
479 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
480 AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
481 AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
482 AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
483 AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
484 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
488 /*******************************************************************************
490 * FUNCTION: AcpiDmMemoryFlags2
492 * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
494 * RETURN: None
496 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
498 ******************************************************************************/
500 static void
501 AcpiDmMemoryFlags2 (
502 UINT8 SpecificFlags)
505 AcpiOsPrintf (", %s, %s",
506 AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
507 AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
511 /*******************************************************************************
513 * FUNCTION: AcpiDmResourceSource
515 * PARAMETERS: Resource - Raw AML descriptor
516 * MinimumLength - descriptor length without optional fields
517 * ResourceLength
519 * RETURN: None
521 * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
523 ******************************************************************************/
525 static void
526 AcpiDmResourceSource (
527 AML_RESOURCE *Resource,
528 ACPI_SIZE MinimumTotalLength,
529 UINT32 ResourceLength)
531 UINT8 *AmlResourceSource;
532 UINT32 TotalLength;
535 TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
537 /* Check if the optional ResourceSource fields are present */
539 if (TotalLength <= MinimumTotalLength)
541 /* The two optional fields are not used */
543 AcpiOsPrintf (",, ");
544 return;
547 /* Get a pointer to the ResourceSource */
549 AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
552 * Always emit the ResourceSourceIndex (Byte)
554 * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
555 * Index even if the String does not exist. Although this is in violation
556 * of the ACPI specification, it is very important to emit ASL code that
557 * can be compiled back to the identical AML. There may be fields and/or
558 * indexes into the resource template buffer that are compiled to absolute
559 * offsets, and these will be broken if the AML length is changed.
561 AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
563 /* Make sure that the ResourceSource string exists before dumping it */
565 if (TotalLength > (MinimumTotalLength + 1))
567 AcpiOsPrintf (" ");
568 AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
571 AcpiOsPrintf (", ");
575 /*******************************************************************************
577 * FUNCTION: AcpiDmWordDescriptor
579 * PARAMETERS: Resource - Pointer to the resource descriptor
580 * Length - Length of the descriptor in bytes
581 * Level - Current source code indentation level
583 * RETURN: None
585 * DESCRIPTION: Decode a Word Address Space descriptor
587 ******************************************************************************/
589 void
590 AcpiDmWordDescriptor (
591 AML_RESOURCE *Resource,
592 UINT32 Length,
593 UINT32 Level)
596 /* Dump resource name and flags */
598 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
600 /* Dump the 5 contiguous WORD values */
602 AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
604 /* The ResourceSource fields are optional */
606 AcpiDmIndent (Level + 1);
607 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
609 /* Insert a descriptor name */
611 AcpiDmDescriptorName ();
613 /* Type-specific flags */
615 AcpiDmAddressFlags (Resource);
616 AcpiOsPrintf (")\n");
620 /*******************************************************************************
622 * FUNCTION: AcpiDmDwordDescriptor
624 * PARAMETERS: Resource - Pointer to the resource descriptor
625 * Length - Length of the descriptor in bytes
626 * Level - Current source code indentation level
628 * RETURN: None
630 * DESCRIPTION: Decode a DWord Address Space descriptor
632 ******************************************************************************/
634 void
635 AcpiDmDwordDescriptor (
636 AML_RESOURCE *Resource,
637 UINT32 Length,
638 UINT32 Level)
641 /* Dump resource name and flags */
643 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
645 /* Dump the 5 contiguous DWORD values */
647 AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
649 /* The ResourceSource fields are optional */
651 AcpiDmIndent (Level + 1);
652 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
654 /* Insert a descriptor name */
656 AcpiDmDescriptorName ();
658 /* Type-specific flags */
660 AcpiDmAddressFlags (Resource);
661 AcpiOsPrintf (")\n");
665 /*******************************************************************************
667 * FUNCTION: AcpiDmQwordDescriptor
669 * PARAMETERS: Resource - Pointer to the resource descriptor
670 * Length - Length of the descriptor in bytes
671 * Level - Current source code indentation level
673 * RETURN: None
675 * DESCRIPTION: Decode a QWord Address Space descriptor
677 ******************************************************************************/
679 void
680 AcpiDmQwordDescriptor (
681 AML_RESOURCE *Resource,
682 UINT32 Length,
683 UINT32 Level)
686 /* Dump resource name and flags */
688 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
690 /* Dump the 5 contiguous QWORD values */
692 AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
694 /* The ResourceSource fields are optional */
696 AcpiDmIndent (Level + 1);
697 AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
699 /* Insert a descriptor name */
701 AcpiDmDescriptorName ();
703 /* Type-specific flags */
705 AcpiDmAddressFlags (Resource);
706 AcpiOsPrintf (")\n");
710 /*******************************************************************************
712 * FUNCTION: AcpiDmExtendedDescriptor
714 * PARAMETERS: Resource - Pointer to the resource descriptor
715 * Length - Length of the descriptor in bytes
716 * Level - Current source code indentation level
718 * RETURN: None
720 * DESCRIPTION: Decode a Extended Address Space descriptor
722 ******************************************************************************/
724 void
725 AcpiDmExtendedDescriptor (
726 AML_RESOURCE *Resource,
727 UINT32 Length,
728 UINT32 Level)
731 /* Dump resource name and flags */
733 AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
735 /* Dump the 5 contiguous QWORD values */
737 AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
739 /* Extra field for this descriptor only */
741 AcpiDmIndent (Level + 1);
742 AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
743 "Type-Specific Attributes");
745 /* Insert a descriptor name */
747 AcpiDmIndent (Level + 1);
748 AcpiDmDescriptorName ();
750 /* Type-specific flags */
752 AcpiDmAddressFlags (Resource);
753 AcpiOsPrintf (")\n");
757 /*******************************************************************************
759 * FUNCTION: AcpiDmMemory24Descriptor
761 * PARAMETERS: Resource - Pointer to the resource descriptor
762 * Length - Length of the descriptor in bytes
763 * Level - Current source code indentation level
765 * RETURN: None
767 * DESCRIPTION: Decode a Memory24 descriptor
769 ******************************************************************************/
771 void
772 AcpiDmMemory24Descriptor (
773 AML_RESOURCE *Resource,
774 UINT32 Length,
775 UINT32 Level)
778 /* Dump name and read/write flag */
780 AcpiDmIndent (Level);
781 AcpiOsPrintf ("Memory24 (%s,\n",
782 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
784 /* Dump the 4 contiguous WORD values */
786 AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
788 /* Insert a descriptor name */
790 AcpiDmIndent (Level + 1);
791 AcpiDmDescriptorName ();
792 AcpiOsPrintf (")\n");
796 /*******************************************************************************
798 * FUNCTION: AcpiDmMemory32Descriptor
800 * PARAMETERS: Resource - Pointer to the resource descriptor
801 * Length - Length of the descriptor in bytes
802 * Level - Current source code indentation level
804 * RETURN: None
806 * DESCRIPTION: Decode a Memory32 descriptor
808 ******************************************************************************/
810 void
811 AcpiDmMemory32Descriptor (
812 AML_RESOURCE *Resource,
813 UINT32 Length,
814 UINT32 Level)
817 /* Dump name and read/write flag */
819 AcpiDmIndent (Level);
820 AcpiOsPrintf ("Memory32 (%s,\n",
821 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
823 /* Dump the 4 contiguous DWORD values */
825 AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
827 /* Insert a descriptor name */
829 AcpiDmIndent (Level + 1);
830 AcpiDmDescriptorName ();
831 AcpiOsPrintf (")\n");
835 /*******************************************************************************
837 * FUNCTION: AcpiDmFixedMemory32Descriptor
839 * PARAMETERS: Resource - Pointer to the resource descriptor
840 * Length - Length of the descriptor in bytes
841 * Level - Current source code indentation level
843 * RETURN: None
845 * DESCRIPTION: Decode a Fixed Memory32 descriptor
847 ******************************************************************************/
849 void
850 AcpiDmFixedMemory32Descriptor (
851 AML_RESOURCE *Resource,
852 UINT32 Length,
853 UINT32 Level)
856 /* Dump name and read/write flag */
858 AcpiDmIndent (Level);
859 AcpiOsPrintf ("Memory32Fixed (%s,\n",
860 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
862 AcpiDmIndent (Level + 1);
863 AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
865 AcpiDmIndent (Level + 1);
866 AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
868 /* Insert a descriptor name */
870 AcpiDmIndent (Level + 1);
871 AcpiDmDescriptorName ();
872 AcpiOsPrintf (")\n");
876 /*******************************************************************************
878 * FUNCTION: AcpiDmGenericRegisterDescriptor
880 * PARAMETERS: Resource - Pointer to the resource descriptor
881 * Length - Length of the descriptor in bytes
882 * Level - Current source code indentation level
884 * RETURN: None
886 * DESCRIPTION: Decode a Generic Register descriptor
888 ******************************************************************************/
890 void
891 AcpiDmGenericRegisterDescriptor (
892 AML_RESOURCE *Resource,
893 UINT32 Length,
894 UINT32 Level)
897 AcpiDmIndent (Level);
898 AcpiOsPrintf ("Register (");
899 AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
900 AcpiOsPrintf ("\n");
902 AcpiDmIndent (Level + 1);
903 AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
905 AcpiDmIndent (Level + 1);
906 AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
908 AcpiDmIndent (Level + 1);
909 AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
911 /* Optional field for ACPI 3.0 */
913 AcpiDmIndent (Level + 1);
914 if (Resource->GenericReg.AccessSize)
916 AcpiOsPrintf ("0x%2.2X, // %s\n",
917 Resource->GenericReg.AccessSize, "Access Size");
918 AcpiDmIndent (Level + 1);
920 else
922 AcpiOsPrintf (",");
925 /* DescriptorName was added for ACPI 3.0+ */
927 AcpiDmDescriptorName ();
928 AcpiOsPrintf (")\n");
932 /*******************************************************************************
934 * FUNCTION: AcpiDmInterruptDescriptor
936 * PARAMETERS: Resource - Pointer to the resource descriptor
937 * Length - Length of the descriptor in bytes
938 * Level - Current source code indentation level
940 * RETURN: None
942 * DESCRIPTION: Decode a extended Interrupt descriptor
944 ******************************************************************************/
946 void
947 AcpiDmInterruptDescriptor (
948 AML_RESOURCE *Resource,
949 UINT32 Length,
950 UINT32 Level)
952 UINT32 i;
955 AcpiDmIndent (Level);
956 AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
957 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
958 AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
959 AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
960 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
963 * The ResourceSource fields are optional and appear after the interrupt
964 * list. Must compute length based on length of the list. First xrupt
965 * is included in the struct (reason for -1 below)
967 AcpiDmResourceSource (Resource,
968 sizeof (AML_RESOURCE_EXTENDED_IRQ) +
969 ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
970 Resource->ExtendedIrq.ResourceLength);
972 /* Insert a descriptor name */
974 AcpiDmDescriptorName ();
975 AcpiOsPrintf (")\n");
977 /* Dump the interrupt list */
979 AcpiDmIndent (Level);
980 AcpiOsPrintf ("{\n");
981 for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
983 AcpiDmIndent (Level + 1);
984 AcpiOsPrintf ("0x%8.8X,\n",
985 (UINT32) Resource->ExtendedIrq.Interrupts[i]);
988 AcpiDmIndent (Level);
989 AcpiOsPrintf ("}\n");
993 /*******************************************************************************
995 * FUNCTION: AcpiDmVendorCommon
997 * PARAMETERS: Name - Descriptor name suffix
998 * ByteData - Pointer to the vendor byte data
999 * Length - Length of the byte data
1000 * Level - Current source code indentation level
1002 * RETURN: None
1004 * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1006 ******************************************************************************/
1008 void
1009 AcpiDmVendorCommon (
1010 char *Name,
1011 UINT8 *ByteData,
1012 UINT32 Length,
1013 UINT32 Level)
1016 /* Dump macro name */
1018 AcpiDmIndent (Level);
1019 AcpiOsPrintf ("Vendor%s (", Name);
1021 /* Insert a descriptor name */
1023 AcpiDmDescriptorName ();
1024 AcpiOsPrintf (") // Length = 0x%.2X\n", Length);
1026 /* Dump the vendor bytes */
1028 AcpiDmIndent (Level);
1029 AcpiOsPrintf ("{\n");
1031 AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1033 AcpiDmIndent (Level);
1034 AcpiOsPrintf ("}\n");
1038 /*******************************************************************************
1040 * FUNCTION: AcpiDmVendorLargeDescriptor
1042 * PARAMETERS: Resource - Pointer to the resource descriptor
1043 * Length - Length of the descriptor in bytes
1044 * Level - Current source code indentation level
1046 * RETURN: None
1048 * DESCRIPTION: Decode a Vendor Large descriptor
1050 ******************************************************************************/
1052 void
1053 AcpiDmVendorLargeDescriptor (
1054 AML_RESOURCE *Resource,
1055 UINT32 Length,
1056 UINT32 Level)
1059 AcpiDmVendorCommon ("Long ",
1060 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1061 Length, Level);
1064 #endif