1 /*******************************************************************************
3 * Module Name: rsmisc - Miscellaneous resource descriptors
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12 * All rights reserved.
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
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
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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
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
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
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
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 *****************************************************************************/
153 #include "accommon.h"
156 #define _COMPONENT ACPI_RESOURCES
157 ACPI_MODULE_NAME ("rsmisc")
160 #define INIT_RESOURCE_TYPE(i) i->ResourceOffset
161 #define INIT_RESOURCE_LENGTH(i) i->AmlOffset
162 #define INIT_TABLE_LENGTH(i) i->Value
164 #define COMPARE_OPCODE(i) i->ResourceOffset
165 #define COMPARE_TARGET(i) i->AmlOffset
166 #define COMPARE_VALUE(i) i->Value
169 /*******************************************************************************
171 * FUNCTION: AcpiRsConvertAmlToResource
173 * PARAMETERS: Resource - Pointer to the resource descriptor
174 * Aml - Where the AML descriptor is returned
175 * Info - Pointer to appropriate conversion table
179 * DESCRIPTION: Convert an external AML resource descriptor to the corresponding
180 * internal resource descriptor
182 ******************************************************************************/
185 AcpiRsConvertAmlToResource (
186 ACPI_RESOURCE *Resource,
188 ACPI_RSCONVERT_INFO *Info)
190 ACPI_RS_LENGTH AmlResourceLength;
195 UINT8 FlagsMode = FALSE;
196 UINT16 ItemCount = 0;
200 ACPI_FUNCTION_TRACE (RsConvertAmlToResource);
205 return_ACPI_STATUS (AE_BAD_PARAMETER);
208 if (((ACPI_SIZE) Resource) & 0x3)
210 /* Each internal resource struct is expected to be 32-bit aligned */
212 ACPI_WARNING ((AE_INFO,
213 "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
214 Resource, Resource->Type, Resource->Length));
217 /* Extract the resource Length field (does not include header length) */
219 AmlResourceLength = AcpiUtGetResourceLength (Aml);
222 * First table entry must be ACPI_RSC_INITxxx and must contain the
223 * table length (# of table entries)
225 Count = INIT_TABLE_LENGTH (Info);
229 * Source is the external AML byte stream buffer,
230 * destination is the internal resource descriptor
232 Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
233 Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
235 switch (Info->Opcode)
237 case ACPI_RSC_INITGET:
239 * Get the resource type and the initial (minimum) length
241 memset (Resource, 0, INIT_RESOURCE_LENGTH (Info));
242 Resource->Type = INIT_RESOURCE_TYPE (Info);
243 Resource->Length = INIT_RESOURCE_LENGTH (Info);
246 case ACPI_RSC_INITSET:
249 case ACPI_RSC_FLAGINIT:
254 case ACPI_RSC_1BITFLAG:
256 * Mask and shift the flag bit
258 ACPI_SET8 (Destination,
259 ((ACPI_GET8 (Source) >> Info->Value) & 0x01));
262 case ACPI_RSC_2BITFLAG:
264 * Mask and shift the flag bits
266 ACPI_SET8 (Destination,
267 ((ACPI_GET8 (Source) >> Info->Value) & 0x03));
270 case ACPI_RSC_3BITFLAG:
272 * Mask and shift the flag bits
274 ACPI_SET8 (Destination,
275 ((ACPI_GET8 (Source) >> Info->Value) & 0x07));
280 ItemCount = ACPI_GET8 (Source);
281 ACPI_SET8 (Destination, ItemCount);
283 Resource->Length = Resource->Length +
284 (Info->Value * (ItemCount - 1));
287 case ACPI_RSC_COUNT16:
289 ItemCount = AmlResourceLength;
290 ACPI_SET16 (Destination, ItemCount);
292 Resource->Length = Resource->Length +
293 (Info->Value * (ItemCount - 1));
296 case ACPI_RSC_COUNT_GPIO_PIN:
298 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
299 ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
301 Resource->Length = Resource->Length + ItemCount;
302 ItemCount = ItemCount / 2;
303 ACPI_SET16 (Destination, ItemCount);
306 case ACPI_RSC_COUNT_GPIO_VEN:
308 ItemCount = ACPI_GET8 (Source);
309 ACPI_SET8 (Destination, ItemCount);
311 Resource->Length = Resource->Length + (Info->Value * ItemCount);
314 case ACPI_RSC_COUNT_GPIO_RES:
316 * Vendor data is optional (length/offset may both be zero)
317 * Examine vendor data length field first
319 Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2));
320 if (ACPI_GET16 (Target))
322 /* Use vendor offset to get resource source length */
324 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
325 ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
329 /* No vendor data to worry about */
331 ItemCount = Aml->LargeHeader.ResourceLength +
332 sizeof (AML_RESOURCE_LARGE_HEADER) -
336 Resource->Length = Resource->Length + ItemCount;
337 ACPI_SET16 (Destination, ItemCount);
340 case ACPI_RSC_COUNT_SERIAL_VEN:
342 ItemCount = ACPI_GET16 (Source) - Info->Value;
344 Resource->Length = Resource->Length + ItemCount;
345 ACPI_SET16 (Destination, ItemCount);
348 case ACPI_RSC_COUNT_SERIAL_RES:
350 ItemCount = (AmlResourceLength +
351 sizeof (AML_RESOURCE_LARGE_HEADER)) -
352 ACPI_GET16 (Source) - Info->Value;
354 Resource->Length = Resource->Length + ItemCount;
355 ACPI_SET16 (Destination, ItemCount);
358 case ACPI_RSC_LENGTH:
360 Resource->Length = Resource->Length + Info->Value;
364 case ACPI_RSC_MOVE16:
365 case ACPI_RSC_MOVE32:
366 case ACPI_RSC_MOVE64:
368 * Raw data move. Use the Info value field unless ItemCount has
369 * been previously initialized via a COUNT opcode
373 ItemCount = Info->Value;
375 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
378 case ACPI_RSC_MOVE_GPIO_PIN:
380 /* Generate and set the PIN data pointer */
382 Target = (char *) ACPI_ADD_PTR (void, Resource,
383 (Resource->Length - ItemCount * 2));
384 *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target);
386 /* Copy the PIN data */
388 Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
389 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
392 case ACPI_RSC_MOVE_GPIO_RES:
394 /* Generate and set the ResourceSource string pointer */
396 Target = (char *) ACPI_ADD_PTR (void, Resource,
397 (Resource->Length - ItemCount));
398 *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
400 /* Copy the ResourceSource string */
402 Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
403 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
406 case ACPI_RSC_MOVE_SERIAL_VEN:
408 /* Generate and set the Vendor Data pointer */
410 Target = (char *) ACPI_ADD_PTR (void, Resource,
411 (Resource->Length - ItemCount));
412 *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
414 /* Copy the Vendor Data */
416 Source = ACPI_ADD_PTR (void, Aml, Info->Value);
417 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
420 case ACPI_RSC_MOVE_SERIAL_RES:
422 /* Generate and set the ResourceSource string pointer */
424 Target = (char *) ACPI_ADD_PTR (void, Resource,
425 (Resource->Length - ItemCount));
426 *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
428 /* Copy the ResourceSource string */
430 Source = ACPI_ADD_PTR (
431 void, Aml, (ACPI_GET16 (Source) + Info->Value));
432 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
437 memset (Destination, Info->AmlOffset, Info->Value);
442 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
443 memcpy (Destination, Source, ACPI_GET16 (Target));
446 case ACPI_RSC_ADDRESS:
448 * Common handler for address descriptor flags
450 if (!AcpiRsGetAddressCommon (Resource, Aml))
452 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
456 case ACPI_RSC_SOURCE:
458 * Optional ResourceSource (Index and String)
461 AcpiRsGetResourceSource (AmlResourceLength, Info->Value,
462 Destination, Aml, NULL);
465 case ACPI_RSC_SOURCEX:
467 * Optional ResourceSource (Index and String). This is the more
468 * complicated case used by the Interrupt() macro
470 Target = ACPI_ADD_PTR (char, Resource,
471 Info->AmlOffset + (ItemCount * 4));
474 AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH)
475 (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
476 Destination, Aml, Target);
479 case ACPI_RSC_BITMASK:
481 * 8-bit encoded bitmask (DMA macro)
483 ItemCount = AcpiRsDecodeBitmask (ACPI_GET8 (Source), Destination);
486 Resource->Length += (ItemCount - 1);
489 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
490 ACPI_SET8 (Target, ItemCount);
493 case ACPI_RSC_BITMASK16:
495 * 16-bit encoded bitmask (IRQ macro)
497 ACPI_MOVE_16_TO_16 (&Temp16, Source);
499 ItemCount = AcpiRsDecodeBitmask (Temp16, Destination);
502 Resource->Length += (ItemCount - 1);
505 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
506 ACPI_SET8 (Target, ItemCount);
509 case ACPI_RSC_EXIT_NE:
511 * Control - Exit conversion if not equal
513 switch (Info->ResourceOffset)
515 case ACPI_RSC_COMPARE_AML_LENGTH:
517 if (AmlResourceLength != Info->Value)
523 case ACPI_RSC_COMPARE_VALUE:
525 if (ACPI_GET8 (Source) != Info->Value)
533 ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
534 return_ACPI_STATUS (AE_BAD_PARAMETER);
540 ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
541 return_ACPI_STATUS (AE_BAD_PARAMETER);
551 /* Round the resource struct length up to the next boundary (32 or 64) */
553 Resource->Length = (UINT32)
554 ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length);
556 return_ACPI_STATUS (AE_OK);
560 /*******************************************************************************
562 * FUNCTION: AcpiRsConvertResourceToAml
564 * PARAMETERS: Resource - Pointer to the resource descriptor
565 * Aml - Where the AML descriptor is returned
566 * Info - Pointer to appropriate conversion table
570 * DESCRIPTION: Convert an internal resource descriptor to the corresponding
571 * external AML resource descriptor.
573 ******************************************************************************/
576 AcpiRsConvertResourceToAml (
577 ACPI_RESOURCE *Resource,
579 ACPI_RSCONVERT_INFO *Info)
584 ACPI_RSDESC_SIZE AmlLength = 0;
587 UINT16 ItemCount = 0;
590 ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
595 return_ACPI_STATUS (AE_BAD_PARAMETER);
599 * First table entry must be ACPI_RSC_INITxxx and must contain the
600 * table length (# of table entries)
602 Count = INIT_TABLE_LENGTH (Info);
607 * Source is the internal resource descriptor,
608 * destination is the external AML byte stream buffer
610 Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
611 Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
613 switch (Info->Opcode)
615 case ACPI_RSC_INITSET:
617 memset (Aml, 0, INIT_RESOURCE_LENGTH (Info));
618 AmlLength = INIT_RESOURCE_LENGTH (Info);
619 AcpiRsSetResourceHeader (
620 INIT_RESOURCE_TYPE (Info), AmlLength, Aml);
623 case ACPI_RSC_INITGET:
626 case ACPI_RSC_FLAGINIT:
628 * Clear the flag byte
630 ACPI_SET8 (Destination, 0);
633 case ACPI_RSC_1BITFLAG:
635 * Mask and shift the flag bit
637 ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
638 ((ACPI_GET8 (Source) & 0x01) << Info->Value));
641 case ACPI_RSC_2BITFLAG:
643 * Mask and shift the flag bits
645 ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
646 ((ACPI_GET8 (Source) & 0x03) << Info->Value));
649 case ACPI_RSC_3BITFLAG:
651 * Mask and shift the flag bits
653 ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
654 ((ACPI_GET8 (Source) & 0x07) << Info->Value));
659 ItemCount = ACPI_GET8 (Source);
660 ACPI_SET8 (Destination, ItemCount);
663 (AmlLength + (Info->Value * (ItemCount - 1)));
666 case ACPI_RSC_COUNT16:
668 ItemCount = ACPI_GET16 (Source);
669 AmlLength = (UINT16) (AmlLength + ItemCount);
670 AcpiRsSetResourceLength (AmlLength, Aml);
673 case ACPI_RSC_COUNT_GPIO_PIN:
675 ItemCount = ACPI_GET16 (Source);
676 ACPI_SET16 (Destination, AmlLength);
678 AmlLength = (UINT16) (AmlLength + ItemCount * 2);
679 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
680 ACPI_SET16 (Target, AmlLength);
681 AcpiRsSetResourceLength (AmlLength, Aml);
684 case ACPI_RSC_COUNT_GPIO_VEN:
686 ItemCount = ACPI_GET16 (Source);
687 ACPI_SET16 (Destination, ItemCount);
689 AmlLength = (UINT16) (
690 AmlLength + (Info->Value * ItemCount));
691 AcpiRsSetResourceLength (AmlLength, Aml);
694 case ACPI_RSC_COUNT_GPIO_RES:
696 /* Set resource source string length */
698 ItemCount = ACPI_GET16 (Source);
699 ACPI_SET16 (Destination, AmlLength);
701 /* Compute offset for the Vendor Data */
703 AmlLength = (UINT16) (AmlLength + ItemCount);
704 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
706 /* Set vendor offset only if there is vendor data */
708 ACPI_SET16 (Target, AmlLength);
710 AcpiRsSetResourceLength (AmlLength, Aml);
713 case ACPI_RSC_COUNT_SERIAL_VEN:
715 ItemCount = ACPI_GET16 (Source);
716 ACPI_SET16 (Destination, ItemCount + Info->Value);
717 AmlLength = (UINT16) (AmlLength + ItemCount);
718 AcpiRsSetResourceLength (AmlLength, Aml);
721 case ACPI_RSC_COUNT_SERIAL_RES:
723 ItemCount = ACPI_GET16 (Source);
724 AmlLength = (UINT16) (AmlLength + ItemCount);
725 AcpiRsSetResourceLength (AmlLength, Aml);
728 case ACPI_RSC_LENGTH:
730 AcpiRsSetResourceLength (Info->Value, Aml);
734 case ACPI_RSC_MOVE16:
735 case ACPI_RSC_MOVE32:
736 case ACPI_RSC_MOVE64:
740 ItemCount = Info->Value;
742 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
745 case ACPI_RSC_MOVE_GPIO_PIN:
747 Destination = (char *) ACPI_ADD_PTR (void, Aml,
748 ACPI_GET16 (Destination));
749 Source = * (UINT16 **) Source;
750 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
753 case ACPI_RSC_MOVE_GPIO_RES:
755 /* Used for both ResourceSource string and VendorData */
757 Destination = (char *) ACPI_ADD_PTR (void, Aml,
758 ACPI_GET16 (Destination));
759 Source = * (UINT8 **) Source;
760 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
763 case ACPI_RSC_MOVE_SERIAL_VEN:
765 Destination = (char *) ACPI_ADD_PTR (void, Aml,
766 (AmlLength - ItemCount));
767 Source = * (UINT8 **) Source;
768 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
771 case ACPI_RSC_MOVE_SERIAL_RES:
773 Destination = (char *) ACPI_ADD_PTR (void, Aml,
774 (AmlLength - ItemCount));
775 Source = * (UINT8 **) Source;
776 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
779 case ACPI_RSC_ADDRESS:
781 /* Set the Resource Type, General Flags, and Type-Specific Flags */
783 AcpiRsSetAddressCommon (Aml, Resource);
786 case ACPI_RSC_SOURCEX:
788 * Optional ResourceSource (Index and String)
790 AmlLength = AcpiRsSetResourceSource (
791 Aml, (ACPI_RS_LENGTH) AmlLength, Source);
792 AcpiRsSetResourceLength (AmlLength, Aml);
795 case ACPI_RSC_SOURCE:
797 * Optional ResourceSource (Index and String). This is the more
798 * complicated case used by the Interrupt() macro
800 AmlLength = AcpiRsSetResourceSource (Aml, Info->Value, Source);
801 AcpiRsSetResourceLength (AmlLength, Aml);
804 case ACPI_RSC_BITMASK:
806 * 8-bit encoded bitmask (DMA macro)
808 ACPI_SET8 (Destination,
809 AcpiRsEncodeBitmask (Source,
810 *ACPI_ADD_PTR (UINT8, Resource, Info->Value)));
813 case ACPI_RSC_BITMASK16:
815 * 16-bit encoded bitmask (IRQ macro)
817 Temp16 = AcpiRsEncodeBitmask (
818 Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
819 ACPI_MOVE_16_TO_16 (Destination, &Temp16);
822 case ACPI_RSC_EXIT_LE:
824 * Control - Exit conversion if less than or equal
826 if (ItemCount <= Info->Value)
832 case ACPI_RSC_EXIT_NE:
834 * Control - Exit conversion if not equal
836 switch (COMPARE_OPCODE (Info))
838 case ACPI_RSC_COMPARE_VALUE:
840 if (*ACPI_ADD_PTR (UINT8, Resource,
841 COMPARE_TARGET (Info)) != COMPARE_VALUE (Info))
849 ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
850 return_ACPI_STATUS (AE_BAD_PARAMETER);
854 case ACPI_RSC_EXIT_EQ:
856 * Control - Exit conversion if equal
858 if (*ACPI_ADD_PTR (UINT8, Resource,
859 COMPARE_TARGET (Info)) == COMPARE_VALUE (Info))
867 ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
868 return_ACPI_STATUS (AE_BAD_PARAMETER);
876 return_ACPI_STATUS (AE_OK);
881 /* Previous resource validations */
883 if (Aml->ExtAddress64.RevisionID !=
884 AML_RESOURCE_EXTENDED_ADDRESS_REVISION)
886 return_ACPI_STATUS (AE_SUPPORT);
889 if (Resource->Data.StartDpf.PerformanceRobustness >= 3)
891 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
894 if (((Aml->Irq.Flags & 0x09) == 0x00) ||
895 ((Aml->Irq.Flags & 0x09) == 0x09))
898 * Only [ActiveHigh, EdgeSensitive] or [ActiveLow, LevelSensitive]
899 * polarity/trigger interrupts are allowed (ACPI spec, section
900 * "IRQ Format"), so 0x00 and 0x09 are illegal.
902 ACPI_ERROR ((AE_INFO,
903 "Invalid interrupt polarity/trigger in resource list, 0x%X",
905 return_ACPI_STATUS (AE_BAD_DATA);
908 Resource->Data.ExtendedIrq.InterruptCount = Temp8;
911 /* Must have at least one IRQ */
913 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
916 if (Resource->Data.Dma.Transfer == 0x03)
918 ACPI_ERROR ((AE_INFO,
919 "Invalid DMA.Transfer preference (3)"));
920 return_ACPI_STATUS (AE_BAD_DATA);