1 /*******************************************************************************
3 * Module Name: rsmisc - Miscellaneous resource descriptors
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2014, 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 *****************************************************************************/
117 #include "accommon.h"
120 #define _COMPONENT ACPI_RESOURCES
121 ACPI_MODULE_NAME ("rsmisc")
124 #define INIT_RESOURCE_TYPE(i) i->ResourceOffset
125 #define INIT_RESOURCE_LENGTH(i) i->AmlOffset
126 #define INIT_TABLE_LENGTH(i) i->Value
128 #define COMPARE_OPCODE(i) i->ResourceOffset
129 #define COMPARE_TARGET(i) i->AmlOffset
130 #define COMPARE_VALUE(i) i->Value
133 /*******************************************************************************
135 * FUNCTION: AcpiRsConvertAmlToResource
137 * PARAMETERS: Resource - Pointer to the resource descriptor
138 * Aml - Where the AML descriptor is returned
139 * Info - Pointer to appropriate conversion table
143 * DESCRIPTION: Convert an external AML resource descriptor to the corresponding
144 * internal resource descriptor
146 ******************************************************************************/
149 AcpiRsConvertAmlToResource (
150 ACPI_RESOURCE
*Resource
,
152 ACPI_RSCONVERT_INFO
*Info
)
154 ACPI_RS_LENGTH AmlResourceLength
;
159 UINT8 FlagsMode
= FALSE
;
160 UINT16 ItemCount
= 0;
164 ACPI_FUNCTION_TRACE (RsConvertAmlToResource
);
169 return_ACPI_STATUS (AE_BAD_PARAMETER
);
172 if (((ACPI_SIZE
) Resource
) & 0x3)
174 /* Each internal resource struct is expected to be 32-bit aligned */
176 ACPI_WARNING ((AE_INFO
,
177 "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
178 Resource
, Resource
->Type
, Resource
->Length
));
181 /* Extract the resource Length field (does not include header length) */
183 AmlResourceLength
= AcpiUtGetResourceLength (Aml
);
186 * First table entry must be ACPI_RSC_INITxxx and must contain the
187 * table length (# of table entries)
189 Count
= INIT_TABLE_LENGTH (Info
);
193 * Source is the external AML byte stream buffer,
194 * destination is the internal resource descriptor
196 Source
= ACPI_ADD_PTR (void, Aml
, Info
->AmlOffset
);
197 Destination
= ACPI_ADD_PTR (void, Resource
, Info
->ResourceOffset
);
199 switch (Info
->Opcode
)
201 case ACPI_RSC_INITGET
:
203 * Get the resource type and the initial (minimum) length
205 ACPI_MEMSET (Resource
, 0, INIT_RESOURCE_LENGTH (Info
));
206 Resource
->Type
= INIT_RESOURCE_TYPE (Info
);
207 Resource
->Length
= INIT_RESOURCE_LENGTH (Info
);
210 case ACPI_RSC_INITSET
:
213 case ACPI_RSC_FLAGINIT
:
218 case ACPI_RSC_1BITFLAG
:
220 * Mask and shift the flag bit
222 ACPI_SET8 (Destination
,
223 ((ACPI_GET8 (Source
) >> Info
->Value
) & 0x01));
226 case ACPI_RSC_2BITFLAG
:
228 * Mask and shift the flag bits
230 ACPI_SET8 (Destination
,
231 ((ACPI_GET8 (Source
) >> Info
->Value
) & 0x03));
234 case ACPI_RSC_3BITFLAG
:
236 * Mask and shift the flag bits
238 ACPI_SET8 (Destination
,
239 ((ACPI_GET8 (Source
) >> Info
->Value
) & 0x07));
244 ItemCount
= ACPI_GET8 (Source
);
245 ACPI_SET8 (Destination
, ItemCount
);
247 Resource
->Length
= Resource
->Length
+
248 (Info
->Value
* (ItemCount
- 1));
251 case ACPI_RSC_COUNT16
:
253 ItemCount
= AmlResourceLength
;
254 ACPI_SET16 (Destination
, ItemCount
);
256 Resource
->Length
= Resource
->Length
+
257 (Info
->Value
* (ItemCount
- 1));
260 case ACPI_RSC_COUNT_GPIO_PIN
:
262 Target
= ACPI_ADD_PTR (void, Aml
, Info
->Value
);
263 ItemCount
= ACPI_GET16 (Target
) - ACPI_GET16 (Source
);
265 Resource
->Length
= Resource
->Length
+ ItemCount
;
266 ItemCount
= ItemCount
/ 2;
267 ACPI_SET16 (Destination
, ItemCount
);
270 case ACPI_RSC_COUNT_GPIO_VEN
:
272 ItemCount
= ACPI_GET8 (Source
);
273 ACPI_SET8 (Destination
, ItemCount
);
275 Resource
->Length
= Resource
->Length
+
276 (Info
->Value
* ItemCount
);
279 case ACPI_RSC_COUNT_GPIO_RES
:
281 * Vendor data is optional (length/offset may both be zero)
282 * Examine vendor data length field first
284 Target
= ACPI_ADD_PTR (void, Aml
, (Info
->Value
+ 2));
285 if (ACPI_GET16 (Target
))
287 /* Use vendor offset to get resource source length */
289 Target
= ACPI_ADD_PTR (void, Aml
, Info
->Value
);
290 ItemCount
= ACPI_GET16 (Target
) - ACPI_GET16 (Source
);
294 /* No vendor data to worry about */
296 ItemCount
= Aml
->LargeHeader
.ResourceLength
+
297 sizeof (AML_RESOURCE_LARGE_HEADER
) -
301 Resource
->Length
= Resource
->Length
+ ItemCount
;
302 ACPI_SET16 (Destination
, ItemCount
);
305 case ACPI_RSC_COUNT_SERIAL_VEN
:
307 ItemCount
= ACPI_GET16 (Source
) - Info
->Value
;
309 Resource
->Length
= Resource
->Length
+ ItemCount
;
310 ACPI_SET16 (Destination
, ItemCount
);
313 case ACPI_RSC_COUNT_SERIAL_RES
:
315 ItemCount
= (AmlResourceLength
+
316 sizeof (AML_RESOURCE_LARGE_HEADER
)) -
317 ACPI_GET16 (Source
) - Info
->Value
;
319 Resource
->Length
= Resource
->Length
+ ItemCount
;
320 ACPI_SET16 (Destination
, ItemCount
);
323 case ACPI_RSC_LENGTH
:
325 Resource
->Length
= Resource
->Length
+ Info
->Value
;
329 case ACPI_RSC_MOVE16
:
330 case ACPI_RSC_MOVE32
:
331 case ACPI_RSC_MOVE64
:
333 * Raw data move. Use the Info value field unless ItemCount has
334 * been previously initialized via a COUNT opcode
338 ItemCount
= Info
->Value
;
340 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
343 case ACPI_RSC_MOVE_GPIO_PIN
:
345 /* Generate and set the PIN data pointer */
347 Target
= (char *) ACPI_ADD_PTR (void, Resource
,
348 (Resource
->Length
- ItemCount
* 2));
349 *(UINT16
**) Destination
= ACPI_CAST_PTR (UINT16
, Target
);
351 /* Copy the PIN data */
353 Source
= ACPI_ADD_PTR (void, Aml
, ACPI_GET16 (Source
));
354 AcpiRsMoveData (Target
, Source
, ItemCount
, Info
->Opcode
);
357 case ACPI_RSC_MOVE_GPIO_RES
:
359 /* Generate and set the ResourceSource string pointer */
361 Target
= (char *) ACPI_ADD_PTR (void, Resource
,
362 (Resource
->Length
- ItemCount
));
363 *(UINT8
**) Destination
= ACPI_CAST_PTR (UINT8
, Target
);
365 /* Copy the ResourceSource string */
367 Source
= ACPI_ADD_PTR (void, Aml
, ACPI_GET16 (Source
));
368 AcpiRsMoveData (Target
, Source
, ItemCount
, Info
->Opcode
);
371 case ACPI_RSC_MOVE_SERIAL_VEN
:
373 /* Generate and set the Vendor Data pointer */
375 Target
= (char *) ACPI_ADD_PTR (void, Resource
,
376 (Resource
->Length
- ItemCount
));
377 *(UINT8
**) Destination
= ACPI_CAST_PTR (UINT8
, Target
);
379 /* Copy the Vendor Data */
381 Source
= ACPI_ADD_PTR (void, Aml
, Info
->Value
);
382 AcpiRsMoveData (Target
, Source
, ItemCount
, Info
->Opcode
);
385 case ACPI_RSC_MOVE_SERIAL_RES
:
387 /* Generate and set the ResourceSource string pointer */
389 Target
= (char *) ACPI_ADD_PTR (void, Resource
,
390 (Resource
->Length
- ItemCount
));
391 *(UINT8
**) Destination
= ACPI_CAST_PTR (UINT8
, Target
);
393 /* Copy the ResourceSource string */
395 Source
= ACPI_ADD_PTR (void, Aml
, (ACPI_GET16 (Source
) + Info
->Value
));
396 AcpiRsMoveData (Target
, Source
, ItemCount
, Info
->Opcode
);
401 ACPI_MEMSET (Destination
, Info
->AmlOffset
, Info
->Value
);
406 Target
= ACPI_ADD_PTR (char, Resource
, Info
->Value
);
407 ACPI_MEMCPY (Destination
, Source
, ACPI_GET16 (Target
));
410 case ACPI_RSC_ADDRESS
:
412 * Common handler for address descriptor flags
414 if (!AcpiRsGetAddressCommon (Resource
, Aml
))
416 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE
);
420 case ACPI_RSC_SOURCE
:
422 * Optional ResourceSource (Index and String)
425 AcpiRsGetResourceSource (AmlResourceLength
, Info
->Value
,
426 Destination
, Aml
, NULL
);
429 case ACPI_RSC_SOURCEX
:
431 * Optional ResourceSource (Index and String). This is the more
432 * complicated case used by the Interrupt() macro
434 Target
= ACPI_ADD_PTR (char, Resource
,
435 Info
->AmlOffset
+ (ItemCount
* 4));
438 AcpiRsGetResourceSource (AmlResourceLength
, (ACPI_RS_LENGTH
)
439 (((ItemCount
- 1) * sizeof (UINT32
)) + Info
->Value
),
440 Destination
, Aml
, Target
);
443 case ACPI_RSC_BITMASK
:
445 * 8-bit encoded bitmask (DMA macro)
447 ItemCount
= AcpiRsDecodeBitmask (ACPI_GET8 (Source
), Destination
);
450 Resource
->Length
+= (ItemCount
- 1);
453 Target
= ACPI_ADD_PTR (char, Resource
, Info
->Value
);
454 ACPI_SET8 (Target
, ItemCount
);
457 case ACPI_RSC_BITMASK16
:
459 * 16-bit encoded bitmask (IRQ macro)
461 ACPI_MOVE_16_TO_16 (&Temp16
, Source
);
463 ItemCount
= AcpiRsDecodeBitmask (Temp16
, Destination
);
466 Resource
->Length
+= (ItemCount
- 1);
469 Target
= ACPI_ADD_PTR (char, Resource
, Info
->Value
);
470 ACPI_SET8 (Target
, ItemCount
);
473 case ACPI_RSC_EXIT_NE
:
475 * Control - Exit conversion if not equal
477 switch (Info
->ResourceOffset
)
479 case ACPI_RSC_COMPARE_AML_LENGTH
:
481 if (AmlResourceLength
!= Info
->Value
)
487 case ACPI_RSC_COMPARE_VALUE
:
489 if (ACPI_GET8 (Source
) != Info
->Value
)
497 ACPI_ERROR ((AE_INFO
, "Invalid conversion sub-opcode"));
498 return_ACPI_STATUS (AE_BAD_PARAMETER
);
504 ACPI_ERROR ((AE_INFO
, "Invalid conversion opcode"));
505 return_ACPI_STATUS (AE_BAD_PARAMETER
);
515 /* Round the resource struct length up to the next boundary (32 or 64) */
517 Resource
->Length
= (UINT32
) ACPI_ROUND_UP_TO_NATIVE_WORD (Resource
->Length
);
519 return_ACPI_STATUS (AE_OK
);
523 /*******************************************************************************
525 * FUNCTION: AcpiRsConvertResourceToAml
527 * PARAMETERS: Resource - Pointer to the resource descriptor
528 * Aml - Where the AML descriptor is returned
529 * Info - Pointer to appropriate conversion table
533 * DESCRIPTION: Convert an internal resource descriptor to the corresponding
534 * external AML resource descriptor.
536 ******************************************************************************/
539 AcpiRsConvertResourceToAml (
540 ACPI_RESOURCE
*Resource
,
542 ACPI_RSCONVERT_INFO
*Info
)
547 ACPI_RSDESC_SIZE AmlLength
= 0;
550 UINT16 ItemCount
= 0;
553 ACPI_FUNCTION_TRACE (RsConvertResourceToAml
);
558 return_ACPI_STATUS (AE_BAD_PARAMETER
);
562 * First table entry must be ACPI_RSC_INITxxx and must contain the
563 * table length (# of table entries)
565 Count
= INIT_TABLE_LENGTH (Info
);
570 * Source is the internal resource descriptor,
571 * destination is the external AML byte stream buffer
573 Source
= ACPI_ADD_PTR (void, Resource
, Info
->ResourceOffset
);
574 Destination
= ACPI_ADD_PTR (void, Aml
, Info
->AmlOffset
);
576 switch (Info
->Opcode
)
578 case ACPI_RSC_INITSET
:
580 ACPI_MEMSET (Aml
, 0, INIT_RESOURCE_LENGTH (Info
));
581 AmlLength
= INIT_RESOURCE_LENGTH (Info
);
582 AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info
), AmlLength
, Aml
);
585 case ACPI_RSC_INITGET
:
588 case ACPI_RSC_FLAGINIT
:
590 * Clear the flag byte
592 ACPI_SET8 (Destination
, 0);
595 case ACPI_RSC_1BITFLAG
:
597 * Mask and shift the flag bit
599 ACPI_SET_BIT (*ACPI_CAST8 (Destination
), (UINT8
)
600 ((ACPI_GET8 (Source
) & 0x01) << Info
->Value
));
603 case ACPI_RSC_2BITFLAG
:
605 * Mask and shift the flag bits
607 ACPI_SET_BIT (*ACPI_CAST8 (Destination
), (UINT8
)
608 ((ACPI_GET8 (Source
) & 0x03) << Info
->Value
));
611 case ACPI_RSC_3BITFLAG
:
613 * Mask and shift the flag bits
615 ACPI_SET_BIT (*ACPI_CAST8 (Destination
), (UINT8
)
616 ((ACPI_GET8 (Source
) & 0x07) << Info
->Value
));
621 ItemCount
= ACPI_GET8 (Source
);
622 ACPI_SET8 (Destination
, ItemCount
);
624 AmlLength
= (UINT16
) (AmlLength
+ (Info
->Value
* (ItemCount
- 1)));
627 case ACPI_RSC_COUNT16
:
629 ItemCount
= ACPI_GET16 (Source
);
630 AmlLength
= (UINT16
) (AmlLength
+ ItemCount
);
631 AcpiRsSetResourceLength (AmlLength
, Aml
);
634 case ACPI_RSC_COUNT_GPIO_PIN
:
636 ItemCount
= ACPI_GET16 (Source
);
637 ACPI_SET16 (Destination
, AmlLength
);
639 AmlLength
= (UINT16
) (AmlLength
+ ItemCount
* 2);
640 Target
= ACPI_ADD_PTR (void, Aml
, Info
->Value
);
641 ACPI_SET16 (Target
, AmlLength
);
642 AcpiRsSetResourceLength (AmlLength
, Aml
);
645 case ACPI_RSC_COUNT_GPIO_VEN
:
647 ItemCount
= ACPI_GET16 (Source
);
648 ACPI_SET16 (Destination
, ItemCount
);
650 AmlLength
= (UINT16
) (AmlLength
+ (Info
->Value
* ItemCount
));
651 AcpiRsSetResourceLength (AmlLength
, Aml
);
654 case ACPI_RSC_COUNT_GPIO_RES
:
656 /* Set resource source string length */
658 ItemCount
= ACPI_GET16 (Source
);
659 ACPI_SET16 (Destination
, AmlLength
);
661 /* Compute offset for the Vendor Data */
663 AmlLength
= (UINT16
) (AmlLength
+ ItemCount
);
664 Target
= ACPI_ADD_PTR (void, Aml
, Info
->Value
);
666 /* Set vendor offset only if there is vendor data */
668 if (Resource
->Data
.Gpio
.VendorLength
)
670 ACPI_SET16 (Target
, AmlLength
);
673 AcpiRsSetResourceLength (AmlLength
, Aml
);
676 case ACPI_RSC_COUNT_SERIAL_VEN
:
678 ItemCount
= ACPI_GET16 (Source
);
679 ACPI_SET16 (Destination
, ItemCount
+ Info
->Value
);
680 AmlLength
= (UINT16
) (AmlLength
+ ItemCount
);
681 AcpiRsSetResourceLength (AmlLength
, Aml
);
684 case ACPI_RSC_COUNT_SERIAL_RES
:
686 ItemCount
= ACPI_GET16 (Source
);
687 AmlLength
= (UINT16
) (AmlLength
+ ItemCount
);
688 AcpiRsSetResourceLength (AmlLength
, Aml
);
691 case ACPI_RSC_LENGTH
:
693 AcpiRsSetResourceLength (Info
->Value
, Aml
);
697 case ACPI_RSC_MOVE16
:
698 case ACPI_RSC_MOVE32
:
699 case ACPI_RSC_MOVE64
:
703 ItemCount
= Info
->Value
;
705 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
708 case ACPI_RSC_MOVE_GPIO_PIN
:
710 Destination
= (char *) ACPI_ADD_PTR (void, Aml
,
711 ACPI_GET16 (Destination
));
712 Source
= * (UINT16
**) Source
;
713 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
716 case ACPI_RSC_MOVE_GPIO_RES
:
718 /* Used for both ResourceSource string and VendorData */
720 Destination
= (char *) ACPI_ADD_PTR (void, Aml
,
721 ACPI_GET16 (Destination
));
722 Source
= * (UINT8
**) Source
;
723 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
726 case ACPI_RSC_MOVE_SERIAL_VEN
:
728 Destination
= (char *) ACPI_ADD_PTR (void, Aml
,
729 (AmlLength
- ItemCount
));
730 Source
= * (UINT8
**) Source
;
731 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
734 case ACPI_RSC_MOVE_SERIAL_RES
:
736 Destination
= (char *) ACPI_ADD_PTR (void, Aml
,
737 (AmlLength
- ItemCount
));
738 Source
= * (UINT8
**) Source
;
739 AcpiRsMoveData (Destination
, Source
, ItemCount
, Info
->Opcode
);
742 case ACPI_RSC_ADDRESS
:
744 /* Set the Resource Type, General Flags, and Type-Specific Flags */
746 AcpiRsSetAddressCommon (Aml
, Resource
);
749 case ACPI_RSC_SOURCEX
:
751 * Optional ResourceSource (Index and String)
753 AmlLength
= AcpiRsSetResourceSource (
754 Aml
, (ACPI_RS_LENGTH
) AmlLength
, Source
);
755 AcpiRsSetResourceLength (AmlLength
, Aml
);
758 case ACPI_RSC_SOURCE
:
760 * Optional ResourceSource (Index and String). This is the more
761 * complicated case used by the Interrupt() macro
763 AmlLength
= AcpiRsSetResourceSource (Aml
, Info
->Value
, Source
);
764 AcpiRsSetResourceLength (AmlLength
, Aml
);
767 case ACPI_RSC_BITMASK
:
769 * 8-bit encoded bitmask (DMA macro)
771 ACPI_SET8 (Destination
,
772 AcpiRsEncodeBitmask (Source
,
773 *ACPI_ADD_PTR (UINT8
, Resource
, Info
->Value
)));
776 case ACPI_RSC_BITMASK16
:
778 * 16-bit encoded bitmask (IRQ macro)
780 Temp16
= AcpiRsEncodeBitmask (Source
,
781 *ACPI_ADD_PTR (UINT8
, Resource
, Info
->Value
));
782 ACPI_MOVE_16_TO_16 (Destination
, &Temp16
);
785 case ACPI_RSC_EXIT_LE
:
787 * Control - Exit conversion if less than or equal
789 if (ItemCount
<= Info
->Value
)
795 case ACPI_RSC_EXIT_NE
:
797 * Control - Exit conversion if not equal
799 switch (COMPARE_OPCODE (Info
))
801 case ACPI_RSC_COMPARE_VALUE
:
803 if (*ACPI_ADD_PTR (UINT8
, Resource
,
804 COMPARE_TARGET (Info
)) != COMPARE_VALUE (Info
))
812 ACPI_ERROR ((AE_INFO
, "Invalid conversion sub-opcode"));
813 return_ACPI_STATUS (AE_BAD_PARAMETER
);
817 case ACPI_RSC_EXIT_EQ
:
819 * Control - Exit conversion if equal
821 if (*ACPI_ADD_PTR (UINT8
, Resource
,
822 COMPARE_TARGET (Info
)) == COMPARE_VALUE (Info
))
830 ACPI_ERROR ((AE_INFO
, "Invalid conversion opcode"));
831 return_ACPI_STATUS (AE_BAD_PARAMETER
);
839 return_ACPI_STATUS (AE_OK
);
844 /* Previous resource validations */
846 if (Aml
->ExtAddress64
.RevisionID
!= AML_RESOURCE_EXTENDED_ADDRESS_REVISION
)
848 return_ACPI_STATUS (AE_SUPPORT
);
851 if (Resource
->Data
.StartDpf
.PerformanceRobustness
>= 3)
853 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE
);
856 if (((Aml
->Irq
.Flags
& 0x09) == 0x00) ||
857 ((Aml
->Irq
.Flags
& 0x09) == 0x09))
860 * Only [ActiveHigh, EdgeSensitive] or [ActiveLow, LevelSensitive]
861 * polarity/trigger interrupts are allowed (ACPI spec, section
862 * "IRQ Format"), so 0x00 and 0x09 are illegal.
864 ACPI_ERROR ((AE_INFO
,
865 "Invalid interrupt polarity/trigger in resource list, 0x%X",
867 return_ACPI_STATUS (AE_BAD_DATA
);
870 Resource
->Data
.ExtendedIrq
.InterruptCount
= Temp8
;
873 /* Must have at least one IRQ */
875 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH
);
878 if (Resource
->Data
.Dma
.Transfer
== 0x03)
880 ACPI_ERROR ((AE_INFO
,
881 "Invalid DMA.Transfer preference (3)"));
882 return_ACPI_STATUS (AE_BAD_DATA
);