1 /******************************************************************************
3 * Module Name: aslrestype2s - Serial Large resource descriptors
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2019, 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 *****************************************************************************/
152 #include <contrib/dev/acpica/compiler/aslcompiler.h>
153 #include "aslcompiler.y.h"
154 #include <contrib/dev/acpica/include/amlcode.h>
156 #define _COMPONENT ACPI_COMPILER
157 ACPI_MODULE_NAME ("aslrestype2s")
161 RsGetBufferDataLength (
162 ACPI_PARSE_OBJECT *InitializerOp);
165 RsGetInterruptDataLength (
166 ACPI_PARSE_OBJECT *InitializerOp,
171 ACPI_PARSE_OBJECT *InitializerOp,
173 ACPI_SIZE DescriptorOffset);
176 RsGetStringDataLengthAt (
177 ACPI_PARSE_OBJECT *InitializerOp,
181 * This module contains descriptors for serial buses and GPIO:
196 /*******************************************************************************
198 * FUNCTION: RsGetBufferDataLength
200 * PARAMETERS: InitializerOp - Current parse op, start of the resource
203 * RETURN: Length of the data buffer
205 * DESCRIPTION: Get the length of a RawDataBuffer, used for vendor data.
207 ******************************************************************************/
210 RsGetBufferDataLength (
211 ACPI_PARSE_OBJECT *InitializerOp)
213 UINT16 ExtraDataSize = 0;
214 ACPI_PARSE_OBJECT *DataList;
217 /* Find the byte-initializer list */
219 while (InitializerOp)
221 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DATABUFFER)
223 /* First child is the optional length (ignore it here) */
225 DataList = InitializerOp->Asl.Child;
226 DataList = ASL_GET_PEER_NODE (DataList);
228 /* Count the data items (each one is a byte of data) */
233 DataList = ASL_GET_PEER_NODE (DataList);
236 return (ExtraDataSize);
239 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
242 return (ExtraDataSize);
246 /*******************************************************************************
248 * FUNCTION: RsGetInterruptDataLength
250 * PARAMETERS: InitializerOp - Current parse op, start of the resource
252 * StartIndex - Start index of interrupt/pin list
254 * RETURN: Length of the interrupt data list
256 * DESCRIPTION: Get the length of a list of interrupt DWORDs for the GPIO
259 ******************************************************************************/
262 RsGetInterruptDataLength (
263 ACPI_PARSE_OBJECT *InitializerOp,
266 UINT16 InterruptLength;
270 /* Count the interrupt numbers */
273 for (i = 0; InitializerOp; i++)
275 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
277 /* Interrupt list starts at offset StartIndex (Gpio descriptors) */
281 InterruptLength += 2;
285 return (InterruptLength);
289 /*******************************************************************************
291 * FUNCTION: RsGetVendorData
293 * PARAMETERS: InitializerOp - Current parse op, start of the resource
295 * VendorData - Where the vendor data is returned
296 * DescriptorOffset - Where vendor data begins in descriptor
298 * RETURN: TRUE if valid vendor data was returned, FALSE otherwise.
300 * DESCRIPTION: Extract the vendor data and construct a vendor data buffer.
302 ******************************************************************************/
306 ACPI_PARSE_OBJECT *InitializerOp,
308 ACPI_SIZE DescriptorOffset)
310 ACPI_PARSE_OBJECT *BufferOp;
311 UINT32 SpecifiedLength = ACPI_UINT32_MAX;
312 UINT16 ActualLength = 0;
315 /* Vendor Data field is always optional */
317 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
322 BufferOp = InitializerOp->Asl.Child;
325 AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
329 /* First child is the optional buffer length (WORD) */
331 if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
333 SpecifiedLength = (UINT16) BufferOp->Asl.Value.Integer;
336 /* Insert field tag _VEN */
338 RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
339 (UINT16) DescriptorOffset);
341 /* Walk the list of buffer initializers (each is one byte) */
343 BufferOp = RsCompleteNodeAndGetNext (BufferOp);
344 if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
348 *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
351 BufferOp = RsCompleteNodeAndGetNext (BufferOp);
355 /* Length validation. Buffer cannot be of zero length */
357 if ((SpecifiedLength == 0) ||
358 ((SpecifiedLength == ACPI_UINT32_MAX) && (ActualLength == 0)))
360 AslError (ASL_ERROR, ASL_MSG_BUFFER_LENGTH, InitializerOp, NULL);
364 if (SpecifiedLength != ACPI_UINT32_MAX)
366 /* ActualLength > SpecifiedLength -> error */
368 if (ActualLength > SpecifiedLength)
370 AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, InitializerOp, NULL);
374 /* ActualLength < SpecifiedLength -> remark */
376 else if (ActualLength < SpecifiedLength)
378 AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, InitializerOp, NULL);
387 /*******************************************************************************
389 * FUNCTION: RsGetStringDataLengthAt
391 * PARAMETERS: InitializerOp - Start of a subtree of init nodes
392 * StartIndex - Starting index of the string node
394 * RETURN: Valid string length if a string node is found at given
395 * StartIndex or 0 otherwise.
397 * DESCRIPTION: In a list of peer nodes, find the first one at given index
398 * that contains a string and return length.
400 ******************************************************************************/
403 RsGetStringDataLengthAt (
404 ACPI_PARSE_OBJECT *InitializerOp,
409 for (i = 0; InitializerOp; i++)
411 if (i == StartIndex &&
412 InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
414 return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
417 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
424 /*******************************************************************************
426 * FUNCTION: RsDoGpioIntDescriptor
428 * PARAMETERS: Info - Parse Op and resource template offset
430 * RETURN: Completed resource node
432 * DESCRIPTION: Construct a long "GpioInt" descriptor
434 ******************************************************************************/
437 RsDoGpioIntDescriptor (
438 ASL_RESOURCE_INFO *Info)
440 AML_RESOURCE *Descriptor;
441 ACPI_PARSE_OBJECT *InitializerOp;
442 ASL_RESOURCE_NODE *Rnode;
443 char *ResourceSource = NULL;
444 UINT8 *VendorData = NULL;
445 UINT16 *InterruptList = NULL;
446 UINT16 *PinList = NULL;
447 UINT16 ResSourceLength;
449 UINT16 InterruptLength;
450 UINT16 DescriptorSize;
451 UINT32 CurrentByteOffset;
456 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
457 CurrentByteOffset = Info->CurrentByteOffset;
460 * Calculate lengths for fields that have variable length:
461 * 1) Resource Source string
462 * 2) Vendor Data buffer
463 * 3) PIN (interrupt) list
465 ResSourceLength = RsGetStringDataLength (InitializerOp);
466 VendorLength = RsGetBufferDataLength (InitializerOp);
467 InterruptLength = RsGetInterruptDataLength (InitializerOp, 10);
469 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
470 ResSourceLength + VendorLength + InterruptLength;
472 /* Allocate the local resource node and initialize */
474 Rnode = RsAllocateResourceNode (DescriptorSize +
475 sizeof (AML_RESOURCE_LARGE_HEADER));
477 Descriptor = Rnode->Buffer;
478 Descriptor->Gpio.ResourceLength = DescriptorSize;
479 Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
480 Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
481 Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
483 /* Build pointers to optional areas */
485 InterruptList = ACPI_ADD_PTR (UINT16, Descriptor,
486 sizeof (AML_RESOURCE_GPIO));
487 PinList = InterruptList;
488 ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
489 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
491 /* Setup offsets within the descriptor */
493 Descriptor->Gpio.PinTableOffset = (UINT16)
494 ACPI_PTR_DIFF (InterruptList, Descriptor);
496 Descriptor->Gpio.ResSourceOffset = (UINT16)
497 ACPI_PTR_DIFF (ResourceSource, Descriptor);
499 /* Process all child initialization nodes */
501 for (i = 0; InitializerOp; i++)
505 case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
507 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
508 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
509 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0);
512 case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
514 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0);
515 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY,
516 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2);
519 case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
521 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
522 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
523 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2);
526 case 3: /* Pin Config [BYTE] (_PPI) */
528 Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
529 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
530 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig));
533 case 4: /* Debounce Timeout [WORD] (_DBT) */
535 Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
536 RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
537 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
540 case 5: /* ResSource [Optional Field - STRING] */
544 /* Copy string to the descriptor */
546 strcpy (ResourceSource,
547 InitializerOp->Asl.Value.String);
551 case 6: /* Resource Index */
553 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
555 Descriptor->Gpio.ResSourceIndex =
556 (UINT8) InitializerOp->Asl.Value.Integer;
560 case 7: /* Resource Usage (consumer/producer) */
562 RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
565 case 8: /* Resource Tag (Descriptor Name) */
567 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
570 case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
573 * Always set the VendorOffset even if there is no Vendor Data.
574 * This field is required in order to calculate the length
575 * of the ResourceSource at runtime.
577 Descriptor->Gpio.VendorOffset = (UINT16)
578 ACPI_PTR_DIFF (VendorData, Descriptor);
580 if (RsGetVendorData (InitializerOp, VendorData,
581 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
583 Descriptor->Gpio.VendorLength = VendorLength;
589 * PINs come through here, repeatedly. Each PIN must be a WORD.
590 * NOTE: there is no "length" field for this, so from ACPI spec:
591 * The number of pins in the table can be calculated from:
592 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
593 * (implies resource source must immediately follow the pin list.)
596 *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
600 /* Case 10: First interrupt number in list */
604 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
606 /* Must be at least one interrupt */
608 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
609 InitializerOp, NULL);
612 /* Check now for duplicates in list */
614 RsCheckListForDuplicates (InitializerOp);
616 /* Create a named field at the start of the list */
618 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
619 CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
624 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
627 MpSaveGpioInfo (Info->MappingOp, Descriptor,
628 PinCount, PinList, ResourceSource);
633 /*******************************************************************************
635 * FUNCTION: RsDoGpioIoDescriptor
637 * PARAMETERS: Info - Parse Op and resource template offset
639 * RETURN: Completed resource node
641 * DESCRIPTION: Construct a long "GpioIo" descriptor
643 ******************************************************************************/
646 RsDoGpioIoDescriptor (
647 ASL_RESOURCE_INFO *Info)
649 AML_RESOURCE *Descriptor;
650 ACPI_PARSE_OBJECT *InitializerOp;
651 ASL_RESOURCE_NODE *Rnode;
652 char *ResourceSource = NULL;
653 UINT8 *VendorData = NULL;
654 UINT16 *InterruptList = NULL;
655 UINT16 *PinList = NULL;
656 UINT16 ResSourceLength;
658 UINT16 InterruptLength;
659 UINT16 DescriptorSize;
660 UINT32 CurrentByteOffset;
665 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
666 CurrentByteOffset = Info->CurrentByteOffset;
669 * Calculate lengths for fields that have variable length:
670 * 1) Resource Source string
671 * 2) Vendor Data buffer
672 * 3) PIN (interrupt) list
674 ResSourceLength = RsGetStringDataLength (InitializerOp);
675 VendorLength = RsGetBufferDataLength (InitializerOp);
676 InterruptLength = RsGetInterruptDataLength (InitializerOp, 10);
678 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
679 ResSourceLength + VendorLength + InterruptLength;
681 /* Allocate the local resource node and initialize */
683 Rnode = RsAllocateResourceNode (DescriptorSize +
684 sizeof (AML_RESOURCE_LARGE_HEADER));
686 Descriptor = Rnode->Buffer;
687 Descriptor->Gpio.ResourceLength = DescriptorSize;
688 Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
689 Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
690 Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
692 /* Build pointers to optional areas */
694 InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
695 PinList = InterruptList;
696 ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
697 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
699 /* Setup offsets within the descriptor */
701 Descriptor->Gpio.PinTableOffset = (UINT16)
702 ACPI_PTR_DIFF (InterruptList, Descriptor);
704 Descriptor->Gpio.ResSourceOffset = (UINT16)
705 ACPI_PTR_DIFF (ResourceSource, Descriptor);
707 /* Process all child initialization nodes */
709 for (i = 0; InitializerOp; i++)
713 case 0: /* Share Type [Flags] (_SHR) */
715 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
716 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
717 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
720 case 1: /* Pin Config [BYTE] (_PPI) */
722 Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
723 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
724 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig));
727 case 2: /* Debounce Timeout [WORD] (_DBT) */
729 Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
730 RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
731 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
734 case 3: /* Drive Strength [WORD] (_DRS) */
736 Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
737 RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
738 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
741 case 4: /* I/O Restriction [Flag] (_IOR) */
743 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
744 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
745 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
748 case 5: /* ResSource [Optional Field - STRING] */
752 /* Copy string to the descriptor */
754 strcpy (ResourceSource,
755 InitializerOp->Asl.Value.String);
759 case 6: /* Resource Index */
761 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
763 Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
767 case 7: /* Resource Usage (consumer/producer) */
769 RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
772 case 8: /* Resource Tag (Descriptor Name) */
774 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
777 case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
779 * Always set the VendorOffset even if there is no Vendor Data.
780 * This field is required in order to calculate the length
781 * of the ResourceSource at runtime.
783 Descriptor->Gpio.VendorOffset = (UINT16)
784 ACPI_PTR_DIFF (VendorData, Descriptor);
786 if (RsGetVendorData (InitializerOp, VendorData,
787 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
789 Descriptor->Gpio.VendorLength = VendorLength;
795 * PINs come through here, repeatedly. Each PIN must be a WORD.
796 * NOTE: there is no "length" field for this, so from ACPI spec:
797 * The number of pins in the table can be calculated from:
798 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
799 * (implies resource source must immediately follow the pin list.)
802 *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
806 /* Case 10: First interrupt number in list */
810 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
812 /* Must be at least one interrupt */
814 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
815 InitializerOp, NULL);
818 /* Check now for duplicates in list */
820 RsCheckListForDuplicates (InitializerOp);
822 /* Create a named field at the start of the list */
824 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
825 CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
830 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
833 MpSaveGpioInfo (Info->MappingOp, Descriptor,
834 PinCount, PinList, ResourceSource);
839 /*******************************************************************************
841 * FUNCTION: RsDoI2cSerialBusDescriptor
843 * PARAMETERS: Info - Parse Op and resource template offset
845 * RETURN: Completed resource node
847 * DESCRIPTION: Construct a long "I2cSerialBus" descriptor
849 ******************************************************************************/
852 RsDoI2cSerialBusDescriptor (
853 ASL_RESOURCE_INFO *Info)
855 AML_RESOURCE *Descriptor;
856 ACPI_PARSE_OBJECT *InitializerOp;
857 ASL_RESOURCE_NODE *Rnode;
858 char *ResourceSource = NULL;
859 UINT8 *VendorData = NULL;
860 UINT16 ResSourceLength;
862 UINT16 DescriptorSize;
863 UINT32 CurrentByteOffset;
867 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
868 CurrentByteOffset = Info->CurrentByteOffset;
871 * Calculate lengths for fields that have variable length:
872 * 1) Resource Source string
873 * 2) Vendor Data buffer
875 ResSourceLength = RsGetStringDataLength (InitializerOp);
876 VendorLength = RsGetBufferDataLength (InitializerOp);
878 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS) +
879 ResSourceLength + VendorLength;
881 /* Allocate the local resource node and initialize */
883 Rnode = RsAllocateResourceNode (DescriptorSize +
884 sizeof (AML_RESOURCE_LARGE_HEADER));
886 Descriptor = Rnode->Buffer;
887 Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
888 Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
889 Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
890 Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
891 Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
892 Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
894 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
896 Descriptor->I2cSerialBus.RevisionId = 2;
899 /* Build pointers to optional areas */
901 VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
902 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
904 /* Process all child initialization nodes */
906 for (i = 0; InitializerOp; i++)
910 case 0: /* Slave Address [WORD] (_ADR) */
912 Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
913 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
914 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
917 case 1: /* Slave Mode [Flag] (_SLV) */
919 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0);
920 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
921 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0);
924 case 2: /* Connection Speed [DWORD] (_SPE) */
926 Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
927 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
928 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
931 case 3: /* Addressing Mode [Flag] (_MOD) */
933 RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
934 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
935 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
938 case 4: /* ResSource [Optional Field - STRING] */
942 /* Copy string to the descriptor */
944 strcpy (ResourceSource,
945 InitializerOp->Asl.Value.String);
949 case 5: /* Resource Index */
951 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
953 Descriptor->I2cSerialBus.ResSourceIndex =
954 (UINT8) InitializerOp->Asl.Value.Integer;
958 case 6: /* Resource Usage (consumer/producer) */
960 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 1, 1);
963 case 7: /* Resource Tag (Descriptor Name) */
965 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
970 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
971 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
974 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 2, 0);
975 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
976 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 2);
979 case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
981 RsGetVendorData (InitializerOp, VendorData,
982 CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
985 default: /* Ignore any extra nodes */
990 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
993 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
998 /*******************************************************************************
1000 * FUNCTION: RsDoSpiSerialBusDescriptor
1002 * PARAMETERS: Info - Parse Op and resource template offset
1004 * RETURN: Completed resource node
1006 * DESCRIPTION: Construct a long "SPI Serial Bus" descriptor
1008 ******************************************************************************/
1011 RsDoSpiSerialBusDescriptor (
1012 ASL_RESOURCE_INFO *Info)
1014 AML_RESOURCE *Descriptor;
1015 ACPI_PARSE_OBJECT *InitializerOp;
1016 ASL_RESOURCE_NODE *Rnode;
1017 char *ResourceSource = NULL;
1018 UINT8 *VendorData = NULL;
1019 UINT16 ResSourceLength;
1020 UINT16 VendorLength;
1021 UINT16 DescriptorSize;
1022 UINT32 CurrentByteOffset;
1026 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1027 CurrentByteOffset = Info->CurrentByteOffset;
1030 * Calculate lengths for fields that have variable length:
1031 * 1) Resource Source string
1032 * 2) Vendor Data buffer
1034 ResSourceLength = RsGetStringDataLength (InitializerOp);
1035 VendorLength = RsGetBufferDataLength (InitializerOp);
1037 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) +
1038 ResSourceLength + VendorLength;
1040 /* Allocate the local resource node and initialize */
1042 Rnode = RsAllocateResourceNode (DescriptorSize +
1043 sizeof (AML_RESOURCE_LARGE_HEADER));
1045 Descriptor = Rnode->Buffer;
1046 Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
1047 Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1048 Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
1049 Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
1050 Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
1051 Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
1053 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
1055 Descriptor->I2cSerialBus.RevisionId = 2;
1058 /* Build pointers to optional areas */
1060 VendorData = ACPI_ADD_PTR (UINT8, Descriptor,
1061 sizeof (AML_RESOURCE_SPI_SERIALBUS));
1062 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1064 /* Process all child initialization nodes */
1066 for (i = 0; InitializerOp; i++)
1070 case 0: /* Device Selection [WORD] (_ADR) */
1072 Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
1073 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
1074 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
1077 case 1: /* Device Polarity [Flag] (_DPL) */
1079 RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
1080 RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
1081 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
1084 case 2: /* Wire Mode [Flag] (_MOD) */
1086 RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1087 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
1088 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
1091 case 3: /* Device Bit Length [BYTE] (_LEN) */
1093 Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
1094 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
1095 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));
1098 case 4: /* Slave Mode [Flag] (_SLV) */
1100 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);
1101 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1102 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);
1105 case 5: /* Connection Speed [DWORD] (_SPE) */
1107 Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1108 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1109 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
1112 case 6: /* Clock Polarity [BYTE] (_POL) */
1114 Descriptor->SpiSerialBus.ClockPolarity = (UINT8) InitializerOp->Asl.Value.Integer;
1115 RsCreateByteField (InitializerOp, ACPI_RESTAG_POLARITY,
1116 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPolarity));
1119 case 7: /* Clock Phase [BYTE] (_PHA) */
1121 Descriptor->SpiSerialBus.ClockPhase = (UINT8) InitializerOp->Asl.Value.Integer;
1122 RsCreateByteField (InitializerOp, ACPI_RESTAG_PHASE,
1123 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPhase));
1126 case 8: /* ResSource [Optional Field - STRING] */
1128 if (ResSourceLength)
1130 /* Copy string to the descriptor */
1132 strcpy (ResourceSource,
1133 InitializerOp->Asl.Value.String);
1137 case 9: /* Resource Index */
1139 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1141 Descriptor->SpiSerialBus.ResSourceIndex =
1142 (UINT8) InitializerOp->Asl.Value.Integer;
1146 case 10: /* Resource Usage (consumer/producer) */
1148 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 1, 1);
1151 case 11: /* Resource Tag (Descriptor Name) */
1153 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1158 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1159 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1162 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 2, 0);
1163 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1164 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 2);
1167 case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1169 RsGetVendorData (InitializerOp, VendorData,
1170 CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS));
1173 default: /* Ignore any extra nodes */
1178 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1181 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1186 /*******************************************************************************
1188 * FUNCTION: RsDoUartSerialBusDescriptor
1190 * PARAMETERS: Info - Parse Op and resource template offset
1192 * RETURN: Completed resource node
1194 * DESCRIPTION: Construct a long "UART Serial Bus" descriptor
1196 ******************************************************************************/
1199 RsDoUartSerialBusDescriptor (
1200 ASL_RESOURCE_INFO *Info)
1202 AML_RESOURCE *Descriptor;
1203 ACPI_PARSE_OBJECT *InitializerOp;
1204 ASL_RESOURCE_NODE *Rnode;
1205 char *ResourceSource = NULL;
1206 UINT8 *VendorData = NULL;
1207 UINT16 ResSourceLength;
1208 UINT16 VendorLength;
1209 UINT16 DescriptorSize;
1210 UINT32 CurrentByteOffset;
1214 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1215 CurrentByteOffset = Info->CurrentByteOffset;
1218 * Calculate lengths for fields that have variable length:
1219 * 1) Resource Source string
1220 * 2) Vendor Data buffer
1222 ResSourceLength = RsGetStringDataLength (InitializerOp);
1223 VendorLength = RsGetBufferDataLength (InitializerOp);
1225 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) +
1226 ResSourceLength + VendorLength;
1228 /* Allocate the local resource node and initialize */
1230 Rnode = RsAllocateResourceNode (DescriptorSize +
1231 sizeof (AML_RESOURCE_LARGE_HEADER));
1233 Descriptor = Rnode->Buffer;
1234 Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
1235 Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1236 Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
1237 Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
1238 Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
1239 Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
1241 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
1243 Descriptor->I2cSerialBus.RevisionId = 2;
1246 /* Build pointers to optional areas */
1248 VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
1249 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1251 /* Process all child initialization nodes */
1253 for (i = 0; InitializerOp; i++)
1257 case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1259 Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1260 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1261 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
1264 case 1: /* Bits Per Byte [Flags] (_LEN) */
1266 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
1267 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
1268 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
1271 case 2: /* Stop Bits [Flags] (_STB) */
1273 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
1274 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
1275 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
1278 case 3: /* Lines In Use [BYTE] (_LIN) */
1280 Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer;
1281 RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE,
1282 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled));
1285 case 4: /* Endianness [Flag] (_END) */
1287 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
1288 RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
1289 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
1292 case 5: /* Parity [BYTE] (_PAR) */
1294 Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
1295 RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY,
1296 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
1299 case 6: /* Flow Control [Flags] (_FLC) */
1301 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1302 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
1303 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
1306 case 7: /* Rx Buffer Size [WORD] (_RXL) */
1308 Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1309 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
1310 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
1313 case 8: /* Tx Buffer Size [WORD] (_TXL) */
1315 Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1316 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
1317 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
1320 case 9: /* ResSource [Optional Field - STRING] */
1322 if (ResSourceLength)
1324 /* Copy string to the descriptor */
1326 strcpy (ResourceSource,
1327 InitializerOp->Asl.Value.String);
1331 case 10: /* Resource Index */
1333 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1335 Descriptor->UartSerialBus.ResSourceIndex =
1336 (UINT8) InitializerOp->Asl.Value.Integer;
1340 case 11: /* Resource Usage (consumer/producer) */
1342 RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 1, 1);
1345 * Slave Mode [Flag] (_SLV)
1347 * Note: There is no SlaveMode argument to the UartSerialBus macro, but
1348 * we add this name anyway to allow the flag to be set by ASL in the
1349 * rare case where there is a slave mode associated with the UART.
1351 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1352 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 0);
1355 case 12: /* Resource Tag (Descriptor Name) */
1357 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1362 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1363 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1366 RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 2, 0);
1367 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1368 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 2);
1371 case 14: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1373 RsGetVendorData (InitializerOp, VendorData,
1374 CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));
1377 default: /* Ignore any extra nodes */
1382 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1385 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1390 /*******************************************************************************
1392 * FUNCTION: RsDoPinFunctionDescriptor
1394 * PARAMETERS: Info - Parse Op and resource template offset
1396 * RETURN: Completed resource node
1398 * DESCRIPTION: Construct a long "PinFunction" descriptor
1400 ******************************************************************************/
1403 RsDoPinFunctionDescriptor (
1404 ASL_RESOURCE_INFO *Info)
1406 AML_RESOURCE *Descriptor;
1407 ACPI_PARSE_OBJECT *InitializerOp;
1408 ASL_RESOURCE_NODE *Rnode;
1409 char *ResourceSource = NULL;
1410 UINT8 *VendorData = NULL;
1411 UINT16 *PinList = NULL;
1412 UINT16 ResSourceLength;
1413 UINT16 VendorLength;
1414 UINT16 PinListLength;
1415 UINT16 DescriptorSize;
1416 UINT32 CurrentByteOffset;
1417 UINT32 PinCount = 0;
1420 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1421 CurrentByteOffset = Info->CurrentByteOffset;
1424 * Calculate lengths for fields that have variable length:
1425 * 1) Resource Source string
1426 * 2) Vendor Data buffer
1427 * 3) PIN (interrupt) list
1429 ResSourceLength = RsGetStringDataLength (InitializerOp);
1430 VendorLength = RsGetBufferDataLength (InitializerOp);
1431 PinListLength = RsGetInterruptDataLength (InitializerOp, 8);
1433 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION) +
1434 ResSourceLength + VendorLength + PinListLength;
1436 /* Allocate the local resource node and initialize */
1438 Rnode = RsAllocateResourceNode (DescriptorSize +
1439 sizeof (AML_RESOURCE_LARGE_HEADER));
1441 Descriptor = Rnode->Buffer;
1442 Descriptor->PinFunction.ResourceLength = DescriptorSize;
1443 Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION;
1444 Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION;
1446 /* Build pointers to optional areas */
1448 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_FUNCTION));
1449 ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength);
1450 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
1452 /* Setup offsets within the descriptor */
1454 Descriptor->PinFunction.PinTableOffset = (UINT16)
1455 ACPI_PTR_DIFF (PinList, Descriptor);
1457 Descriptor->PinFunction.ResSourceOffset = (UINT16)
1458 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1460 /* Process all child initialization nodes */
1462 for (i = 0; InitializerOp; i++)
1466 case 0: /* Share Type [Flags] (_SHR) */
1468 RsSetFlagBits16 (&Descriptor->PinFunction.Flags, InitializerOp, 0, 0);
1469 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1470 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.Flags), 0);
1473 case 1: /* Pin Config [BYTE] (_PPI) */
1475 Descriptor->PinFunction.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
1476 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
1477 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.PinConfig));
1480 case 2: /* Function Number [WORD] (_FUN) */
1482 Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
1483 RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
1484 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber));
1487 case 3: /* ResSource [Optional Field - STRING] */
1489 if (ResSourceLength)
1491 /* Copy string to the descriptor */
1493 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
1497 case 4: /* Resource Index */
1499 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1501 Descriptor->PinFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1505 case 5: /* Resource Usage (consumer/producer) */
1507 /* Assumed to be consumer */
1511 case 6: /* Resource Tag (Descriptor Name) */
1513 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1516 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1518 * Always set the VendorOffset even if there is no Vendor Data.
1519 * This field is required in order to calculate the length
1520 * of the ResourceSource at runtime.
1522 Descriptor->PinFunction.VendorOffset = (UINT16)
1523 ACPI_PTR_DIFF (VendorData, Descriptor);
1525 if (RsGetVendorData (InitializerOp, VendorData,
1526 (CurrentByteOffset + Descriptor->PinFunction.VendorOffset)))
1528 Descriptor->PinFunction.VendorLength = VendorLength;
1534 * PINs come through here, repeatedly. Each PIN must be a WORD.
1535 * NOTE: there is no "length" field for this, so from ACPI spec:
1536 * The number of pins in the table can be calculated from:
1537 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1538 * (implies resource source must immediately follow the pin list.)
1541 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1545 /* Case 8: First pin number in list */
1549 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1551 /* Must be at least one interrupt */
1553 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1554 InitializerOp, NULL);
1557 /* Check now for duplicates in list */
1559 RsCheckListForDuplicates (InitializerOp);
1561 /* Create a named field at the start of the list */
1563 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1564 CurrentByteOffset + Descriptor->PinFunction.PinTableOffset);
1569 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1576 /*******************************************************************************
1578 * FUNCTION: RsDoPinConfigDescriptor
1580 * PARAMETERS: Info - Parse Op and resource template offset
1582 * RETURN: Completed resource node
1584 * DESCRIPTION: Construct a long "PinConfig" descriptor
1586 ******************************************************************************/
1589 RsDoPinConfigDescriptor (
1590 ASL_RESOURCE_INFO *Info)
1592 AML_RESOURCE *Descriptor;
1593 ACPI_PARSE_OBJECT *InitializerOp;
1594 ASL_RESOURCE_NODE *Rnode;
1595 char *ResourceSource = NULL;
1596 UINT8 *VendorData = NULL;
1597 UINT16 *PinList = NULL;
1598 UINT16 ResSourceLength;
1599 UINT16 VendorLength;
1600 UINT16 PinListLength;
1601 UINT16 DescriptorSize;
1602 UINT32 CurrentByteOffset;
1603 UINT32 PinCount = 0;
1606 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1607 CurrentByteOffset = Info->CurrentByteOffset;
1610 * Calculate lengths for fields that have variable length:
1611 * 1) Resource Source string
1612 * 2) Vendor Data buffer
1613 * 3) PIN (interrupt) list
1615 ResSourceLength = RsGetStringDataLength (InitializerOp);
1616 VendorLength = RsGetBufferDataLength (InitializerOp);
1617 PinListLength = RsGetInterruptDataLength (InitializerOp, 8);
1619 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG) +
1620 ResSourceLength + VendorLength + PinListLength;
1622 /* Allocate the local resource node and initialize */
1624 Rnode = RsAllocateResourceNode (DescriptorSize +
1625 sizeof (AML_RESOURCE_LARGE_HEADER));
1627 Descriptor = Rnode->Buffer;
1628 Descriptor->PinConfig.ResourceLength = DescriptorSize;
1629 Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG;
1630 Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION;
1632 /* Build pointers to optional areas */
1634 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_CONFIG));
1635 ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength);
1636 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
1638 /* Setup offsets within the descriptor */
1640 Descriptor->PinConfig.PinTableOffset = (UINT16)
1641 ACPI_PTR_DIFF (PinList, Descriptor);
1643 Descriptor->PinConfig.ResSourceOffset = (UINT16)
1644 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1646 /* Process all child initialization nodes */
1648 for (i = 0; InitializerOp; i++)
1654 case 0: /* Share Type [Flags] (_SHR) */
1656 RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 0, 0);
1657 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1658 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.Flags), 0);
1661 case 1: /* Pin Config Type [BYTE] (_TYP) */
1663 isValid = InitializerOp->Asl.Value.Integer <= 0x0d;
1666 isValid = InitializerOp->Asl.Value.Integer >= 0x80 &&
1667 InitializerOp->Asl.Value.Integer <= 0xff;
1671 AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL);
1674 Descriptor->PinConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer;
1675 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE,
1676 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigType));
1680 case 2: /* Pin Config Value [DWORD] (_VAL) */
1682 Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
1683 RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
1684 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue));
1687 case 3: /* ResSource [Optional Field - STRING] */
1689 if (ResSourceLength)
1691 /* Copy string to the descriptor */
1693 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
1697 case 4: /* Resource Index */
1699 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1701 Descriptor->PinConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1705 case 5: /* Resource Usage (consumer/producer) */
1707 RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 1, 1);
1711 case 6: /* Resource Tag (Descriptor Name) */
1713 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1716 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1718 * Always set the VendorOffset even if there is no Vendor Data.
1719 * This field is required in order to calculate the length
1720 * of the ResourceSource at runtime.
1722 Descriptor->PinConfig.VendorOffset = (UINT16)
1723 ACPI_PTR_DIFF (VendorData, Descriptor);
1725 if (RsGetVendorData (InitializerOp, VendorData,
1726 (CurrentByteOffset + Descriptor->PinConfig.VendorOffset)))
1728 Descriptor->PinConfig.VendorLength = VendorLength;
1734 * PINs come through here, repeatedly. Each PIN must be a WORD.
1735 * NOTE: there is no "length" field for this, so from ACPI spec:
1736 * The number of pins in the table can be calculated from:
1737 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1738 * (implies resource source must immediately follow the pin list.)
1741 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1745 /* Case 8: First pin number in list */
1749 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1751 /* Must be at least one interrupt */
1753 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1754 InitializerOp, NULL);
1757 /* Check now for duplicates in list */
1759 RsCheckListForDuplicates (InitializerOp);
1761 /* Create a named field at the start of the list */
1763 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1764 CurrentByteOffset + Descriptor->PinConfig.PinTableOffset);
1769 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1776 /*******************************************************************************
1778 * FUNCTION: RsDoPinGroupDescriptor
1780 * PARAMETERS: Info - Parse Op and resource template offset
1782 * RETURN: Completed resource node
1784 * DESCRIPTION: Construct a long "PinGroup" descriptor
1786 ******************************************************************************/
1789 RsDoPinGroupDescriptor (
1790 ASL_RESOURCE_INFO *Info)
1792 AML_RESOURCE *Descriptor;
1793 ACPI_PARSE_OBJECT *InitializerOp;
1794 ASL_RESOURCE_NODE *Rnode;
1795 UINT8 *VendorData = NULL;
1796 UINT16 *PinList = NULL;
1799 UINT16 VendorLength;
1800 UINT16 PinListLength;
1801 UINT16 DescriptorSize;
1802 UINT32 CurrentByteOffset;
1803 UINT32 PinCount = 0;
1806 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1807 CurrentByteOffset = Info->CurrentByteOffset;
1810 * Calculate lengths for fields that have variable length:
1812 * 2) Vendor Data buffer
1813 * 3) PIN (interrupt) list
1815 LabelLength = RsGetStringDataLength (InitializerOp);
1816 VendorLength = RsGetBufferDataLength (InitializerOp);
1817 PinListLength = RsGetInterruptDataLength (InitializerOp, 4);
1819 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP) +
1820 LabelLength + VendorLength + PinListLength;
1822 /* Allocate the local resource node and initialize */
1824 Rnode = RsAllocateResourceNode (DescriptorSize +
1825 sizeof (AML_RESOURCE_LARGE_HEADER));
1827 Descriptor = Rnode->Buffer;
1828 Descriptor->PinGroup.ResourceLength = DescriptorSize;
1829 Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP;
1830 Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION;
1832 /* Build pointers to optional areas */
1834 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP));
1835 Label = ACPI_ADD_PTR (char, PinList, PinListLength);
1836 VendorData = ACPI_ADD_PTR (UINT8, Label, LabelLength);
1838 /* Setup offsets within the descriptor */
1840 Descriptor->PinGroup.PinTableOffset = (UINT16) ACPI_PTR_DIFF (PinList, Descriptor);
1841 Descriptor->PinGroup.LabelOffset = (UINT16) ACPI_PTR_DIFF (Label, Descriptor);
1843 /* Process all child initialization nodes */
1845 for (i = 0; InitializerOp; i++)
1849 case 0: /* Resource Label */
1851 if (LabelLength < 2)
1853 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
1855 strcpy (Label, InitializerOp->Asl.Value.String);
1859 case 1: /* Resource Usage (consumer/producer) */
1861 RsSetFlagBits16 (&Descriptor->PinGroup.Flags, InitializerOp, 0, 0);
1865 case 2: /* Resource Tag (Descriptor Name) */
1867 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1870 case 3: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1872 * Always set the VendorOffset even if there is no Vendor Data.
1873 * This field is required in order to calculate the length
1874 * of the ResourceSource at runtime.
1876 Descriptor->PinGroup.VendorOffset = (UINT16)
1877 ACPI_PTR_DIFF (VendorData, Descriptor);
1879 if (RsGetVendorData (InitializerOp, VendorData,
1880 (CurrentByteOffset + Descriptor->PinGroup.VendorOffset)))
1882 Descriptor->PinGroup.VendorLength = VendorLength;
1888 * PINs come through here, repeatedly. Each PIN must be a WORD.
1889 * NOTE: there is no "length" field for this, so from ACPI spec:
1890 * The number of pins in the table can be calculated from:
1891 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1892 * (implies resource source must immediately follow the pin list.)
1895 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1899 /* Case 3: First pin number in list */
1903 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1905 /* Must be at least one interrupt */
1907 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1908 InitializerOp, NULL);
1911 /* Check now for duplicates in list */
1913 RsCheckListForDuplicates (InitializerOp);
1915 /* Create a named field at the start of the list */
1917 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1918 CurrentByteOffset + Descriptor->PinGroup.PinTableOffset);
1923 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1930 /*******************************************************************************
1932 * FUNCTION: RsDoPinGroupFunctionDescriptor
1934 * PARAMETERS: Info - Parse Op and resource template offset
1936 * RETURN: Completed resource node
1938 * DESCRIPTION: Construct a long "PinGroupFunction" descriptor
1940 ******************************************************************************/
1943 RsDoPinGroupFunctionDescriptor (
1944 ASL_RESOURCE_INFO *Info)
1946 AML_RESOURCE *Descriptor;
1947 ACPI_PARSE_OBJECT *InitializerOp;
1948 ASL_RESOURCE_NODE *Rnode;
1949 char *ResourceSource = NULL;
1950 char *ResourceSourceLabel = NULL;
1951 UINT8 *VendorData = NULL;
1952 UINT16 ResSourceLength;
1953 UINT16 ResSourceLabelLength;
1954 UINT16 VendorLength;
1955 UINT16 DescriptorSize;
1956 UINT32 CurrentByteOffset;
1959 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1960 CurrentByteOffset = Info->CurrentByteOffset;
1963 * Calculate lengths for fields that have variable length:
1964 * 1) Resource Source string
1965 * 2) Resource Source Label string
1966 * 3) Vendor Data buffer
1968 ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 2);
1969 ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 4);
1970 VendorLength = RsGetBufferDataLength (InitializerOp);
1972 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION) +
1973 ResSourceLength + ResSourceLabelLength + VendorLength;
1975 /* Allocate the local resource node and initialize */
1977 Rnode = RsAllocateResourceNode (DescriptorSize +
1978 sizeof (AML_RESOURCE_LARGE_HEADER));
1980 Descriptor = Rnode->Buffer;
1981 Descriptor->PinGroupFunction.ResourceLength = DescriptorSize;
1982 Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION;
1983 Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION;
1985 /* Build pointers to optional areas */
1987 ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION));
1988 ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength);
1989 VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength);
1991 /* Setup offsets within the descriptor */
1993 Descriptor->PinGroupFunction.ResSourceOffset = (UINT16)
1994 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1995 Descriptor->PinGroupFunction.ResSourceLabelOffset = (UINT16)
1996 ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor);
1998 /* Process all child initialization nodes */
2000 for (i = 0; InitializerOp; i++)
2004 case 0: /* Share Type [Flags] (_SHR) */
2006 RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 0, 0);
2007 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
2008 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.Flags), 0);
2011 case 1: /* Function Number [WORD] */
2013 Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
2014 RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
2015 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber));
2018 case 2: /* ResourceSource [STRING] */
2020 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
2023 case 3: /* Resource Index */
2025 Descriptor->PinGroupFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
2028 case 4: /* ResourceSourceLabel [STRING] */
2030 if (ResSourceLabelLength < 2)
2032 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
2035 strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String);
2038 case 5: /* Resource Usage (consumer/producer) */
2040 RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 1, 1);
2044 case 6: /* Resource Tag (Descriptor Name) */
2046 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
2049 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
2051 * Always set the VendorOffset even if there is no Vendor Data.
2052 * This field is required in order to calculate the length
2053 * of the ResourceSource at runtime.
2055 Descriptor->PinGroupFunction.VendorOffset = (UINT16)
2056 ACPI_PTR_DIFF (VendorData, Descriptor);
2058 if (RsGetVendorData (InitializerOp, VendorData,
2059 (CurrentByteOffset + Descriptor->PinGroupFunction.VendorOffset)))
2061 Descriptor->PinGroupFunction.VendorLength = VendorLength;
2069 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2076 /*******************************************************************************
2078 * FUNCTION: RsDoPinGroupConfigDescriptor
2080 * PARAMETERS: Info - Parse Op and resource template offset
2082 * RETURN: Completed resource node
2084 * DESCRIPTION: Construct a long "PinGroupConfig" descriptor
2086 ******************************************************************************/
2089 RsDoPinGroupConfigDescriptor (
2090 ASL_RESOURCE_INFO *Info)
2092 AML_RESOURCE *Descriptor;
2093 ACPI_PARSE_OBJECT *InitializerOp;
2094 ASL_RESOURCE_NODE *Rnode;
2095 char *ResourceSource = NULL;
2096 char *ResourceSourceLabel = NULL;
2097 UINT8 *VendorData = NULL;
2098 UINT16 ResSourceLength;
2099 UINT16 ResSourceLabelLength;
2100 UINT16 VendorLength;
2101 UINT16 DescriptorSize;
2102 UINT32 CurrentByteOffset;
2105 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2106 CurrentByteOffset = Info->CurrentByteOffset;
2109 * Calculate lengths for fields that have variable length:
2110 * 1) Resource Source string
2111 * 2) Resource Source Label string
2112 * 3) Vendor Data buffer
2114 ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 3);
2115 ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 5);
2116 VendorLength = RsGetBufferDataLength (InitializerOp);
2118 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG) +
2119 ResSourceLength + ResSourceLabelLength + VendorLength;
2121 /* Allocate the local resource node and initialize */
2123 Rnode = RsAllocateResourceNode (DescriptorSize +
2124 sizeof (AML_RESOURCE_LARGE_HEADER));
2126 Descriptor = Rnode->Buffer;
2127 Descriptor->PinGroupConfig.ResourceLength = DescriptorSize;
2128 Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG;
2129 Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION;
2131 /* Build pointers to optional areas */
2133 ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_CONFIG));
2134 ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength);
2135 VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength);
2137 /* Setup offsets within the descriptor */
2139 Descriptor->PinGroupConfig.ResSourceOffset = (UINT16)
2140 ACPI_PTR_DIFF (ResourceSource, Descriptor);
2141 Descriptor->PinGroupConfig.ResSourceLabelOffset = (UINT16)
2142 ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor);
2144 /* Process all child initialization nodes */
2146 for (i = 0; InitializerOp; i++)
2152 case 0: /* Share Type [Flags] (_SHR) */
2154 RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 0, 0);
2155 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
2156 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.Flags), 0);
2159 case 1: /* Pin Config Type [BYTE] (_TYP) */
2161 isValid = InitializerOp->Asl.Value.Integer <= 0x0d;
2164 isValid = InitializerOp->Asl.Value.Integer >= 0x80 &&
2165 InitializerOp->Asl.Value.Integer <= 0xff;
2169 AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL);
2172 Descriptor->PinGroupConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer;
2173 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE,
2174 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigType));
2178 case 2: /* Pin Config Value [DWORD] (_VAL) */
2180 Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
2181 RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
2182 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue));
2185 case 3: /* ResourceSource [STRING] */
2187 /* Copy string to the descriptor */
2189 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
2192 case 4: /* Resource Index */
2194 Descriptor->PinGroupConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
2197 case 5: /* ResourceSourceLabel [STRING] */
2199 if (ResSourceLabelLength < 2)
2201 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
2204 strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String);
2207 case 6: /* Resource Usage (consumer/producer) */
2209 RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 1, 1);
2213 case 7: /* Resource Tag (Descriptor Name) */
2215 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
2218 case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
2220 * Always set the VendorOffset even if there is no Vendor Data.
2221 * This field is required in order to calculate the length
2222 * of the ResourceSource at runtime.
2224 Descriptor->PinGroupConfig.VendorOffset = (UINT16)
2225 ACPI_PTR_DIFF (VendorData, Descriptor);
2227 if (RsGetVendorData (InitializerOp, VendorData,
2228 (CurrentByteOffset + Descriptor->PinGroupConfig.VendorOffset)))
2230 Descriptor->PinGroupConfig.VendorLength = VendorLength;
2238 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);