1 /******************************************************************************
3 * Module Name: aslrestype2s - Serial Large resource descriptors
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2018, 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 "aslcompiler.h"
153 #include "aslcompiler.y.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);
677 PinList = InterruptList;
679 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
680 ResSourceLength + VendorLength + InterruptLength;
682 /* Allocate the local resource node and initialize */
684 Rnode = RsAllocateResourceNode (DescriptorSize +
685 sizeof (AML_RESOURCE_LARGE_HEADER));
687 Descriptor = Rnode->Buffer;
688 Descriptor->Gpio.ResourceLength = DescriptorSize;
689 Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
690 Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
691 Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
693 /* Build pointers to optional areas */
695 InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
696 PinList = InterruptList;
697 ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
698 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
700 /* Setup offsets within the descriptor */
702 Descriptor->Gpio.PinTableOffset = (UINT16)
703 ACPI_PTR_DIFF (InterruptList, Descriptor);
705 Descriptor->Gpio.ResSourceOffset = (UINT16)
706 ACPI_PTR_DIFF (ResourceSource, Descriptor);
708 /* Process all child initialization nodes */
710 for (i = 0; InitializerOp; i++)
714 case 0: /* Share Type [Flags] (_SHR) */
716 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
717 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
718 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
721 case 1: /* Pin Config [BYTE] (_PPI) */
723 Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
724 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
725 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig));
728 case 2: /* Debounce Timeout [WORD] (_DBT) */
730 Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
731 RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
732 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
735 case 3: /* Drive Strength [WORD] (_DRS) */
737 Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
738 RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
739 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
742 case 4: /* I/O Restriction [Flag] (_IOR) */
744 RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
745 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
746 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
749 case 5: /* ResSource [Optional Field - STRING] */
753 /* Copy string to the descriptor */
755 strcpy (ResourceSource,
756 InitializerOp->Asl.Value.String);
760 case 6: /* Resource Index */
762 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
764 Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
768 case 7: /* Resource Usage (consumer/producer) */
770 RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
773 case 8: /* Resource Tag (Descriptor Name) */
775 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
778 case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
780 * Always set the VendorOffset even if there is no Vendor Data.
781 * This field is required in order to calculate the length
782 * of the ResourceSource at runtime.
784 Descriptor->Gpio.VendorOffset = (UINT16)
785 ACPI_PTR_DIFF (VendorData, Descriptor);
787 if (RsGetVendorData (InitializerOp, VendorData,
788 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
790 Descriptor->Gpio.VendorLength = VendorLength;
796 * PINs come through here, repeatedly. Each PIN must be a WORD.
797 * NOTE: there is no "length" field for this, so from ACPI spec:
798 * The number of pins in the table can be calculated from:
799 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
800 * (implies resource source must immediately follow the pin list.)
803 *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
807 /* Case 10: First interrupt number in list */
811 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
813 /* Must be at least one interrupt */
815 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
816 InitializerOp, NULL);
819 /* Check now for duplicates in list */
821 RsCheckListForDuplicates (InitializerOp);
823 /* Create a named field at the start of the list */
825 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
826 CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
831 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
834 MpSaveGpioInfo (Info->MappingOp, Descriptor,
835 PinCount, PinList, ResourceSource);
840 /*******************************************************************************
842 * FUNCTION: RsDoI2cSerialBusDescriptor
844 * PARAMETERS: Info - Parse Op and resource template offset
846 * RETURN: Completed resource node
848 * DESCRIPTION: Construct a long "I2cSerialBus" descriptor
850 ******************************************************************************/
853 RsDoI2cSerialBusDescriptor (
854 ASL_RESOURCE_INFO *Info)
856 AML_RESOURCE *Descriptor;
857 ACPI_PARSE_OBJECT *InitializerOp;
858 ASL_RESOURCE_NODE *Rnode;
859 char *ResourceSource = NULL;
860 UINT8 *VendorData = NULL;
861 UINT16 ResSourceLength;
863 UINT16 DescriptorSize;
864 UINT32 CurrentByteOffset;
868 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
869 CurrentByteOffset = Info->CurrentByteOffset;
872 * Calculate lengths for fields that have variable length:
873 * 1) Resource Source string
874 * 2) Vendor Data buffer
876 ResSourceLength = RsGetStringDataLength (InitializerOp);
877 VendorLength = RsGetBufferDataLength (InitializerOp);
879 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS) +
880 ResSourceLength + VendorLength;
882 /* Allocate the local resource node and initialize */
884 Rnode = RsAllocateResourceNode (DescriptorSize +
885 sizeof (AML_RESOURCE_LARGE_HEADER));
887 Descriptor = Rnode->Buffer;
888 Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
889 Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
890 Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
891 Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
892 Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
893 Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
895 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
897 Descriptor->I2cSerialBus.RevisionId = 2;
900 /* Build pointers to optional areas */
902 VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
903 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
905 /* Process all child initialization nodes */
907 for (i = 0; InitializerOp; i++)
911 case 0: /* Slave Address [WORD] (_ADR) */
913 Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
914 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
915 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
918 case 1: /* Slave Mode [Flag] (_SLV) */
920 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0);
921 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
922 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0);
925 case 2: /* Connection Speed [DWORD] (_SPE) */
927 Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
928 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
929 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
932 case 3: /* Addressing Mode [Flag] (_MOD) */
934 RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
935 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
936 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
939 case 4: /* ResSource [Optional Field - STRING] */
943 /* Copy string to the descriptor */
945 strcpy (ResourceSource,
946 InitializerOp->Asl.Value.String);
950 case 5: /* Resource Index */
952 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
954 Descriptor->I2cSerialBus.ResSourceIndex =
955 (UINT8) InitializerOp->Asl.Value.Integer;
959 case 6: /* Resource Usage (consumer/producer) */
961 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 1, 1);
964 case 7: /* Resource Tag (Descriptor Name) */
966 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
971 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
972 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
975 RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 2, 0);
976 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
977 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 2);
980 case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
982 RsGetVendorData (InitializerOp, VendorData,
983 CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
986 default: /* Ignore any extra nodes */
991 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
994 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
999 /*******************************************************************************
1001 * FUNCTION: RsDoSpiSerialBusDescriptor
1003 * PARAMETERS: Info - Parse Op and resource template offset
1005 * RETURN: Completed resource node
1007 * DESCRIPTION: Construct a long "SPI Serial Bus" descriptor
1009 ******************************************************************************/
1012 RsDoSpiSerialBusDescriptor (
1013 ASL_RESOURCE_INFO *Info)
1015 AML_RESOURCE *Descriptor;
1016 ACPI_PARSE_OBJECT *InitializerOp;
1017 ASL_RESOURCE_NODE *Rnode;
1018 char *ResourceSource = NULL;
1019 UINT8 *VendorData = NULL;
1020 UINT16 ResSourceLength;
1021 UINT16 VendorLength;
1022 UINT16 DescriptorSize;
1023 UINT32 CurrentByteOffset;
1027 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1028 CurrentByteOffset = Info->CurrentByteOffset;
1031 * Calculate lengths for fields that have variable length:
1032 * 1) Resource Source string
1033 * 2) Vendor Data buffer
1035 ResSourceLength = RsGetStringDataLength (InitializerOp);
1036 VendorLength = RsGetBufferDataLength (InitializerOp);
1038 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) +
1039 ResSourceLength + VendorLength;
1041 /* Allocate the local resource node and initialize */
1043 Rnode = RsAllocateResourceNode (DescriptorSize +
1044 sizeof (AML_RESOURCE_LARGE_HEADER));
1046 Descriptor = Rnode->Buffer;
1047 Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
1048 Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1049 Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
1050 Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
1051 Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
1052 Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
1054 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
1056 Descriptor->I2cSerialBus.RevisionId = 2;
1059 /* Build pointers to optional areas */
1061 VendorData = ACPI_ADD_PTR (UINT8, Descriptor,
1062 sizeof (AML_RESOURCE_SPI_SERIALBUS));
1063 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1065 /* Process all child initialization nodes */
1067 for (i = 0; InitializerOp; i++)
1071 case 0: /* Device Selection [WORD] (_ADR) */
1073 Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
1074 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
1075 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
1078 case 1: /* Device Polarity [Flag] (_DPL) */
1080 RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
1081 RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
1082 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
1085 case 2: /* Wire Mode [Flag] (_MOD) */
1087 RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1088 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
1089 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
1092 case 3: /* Device Bit Length [BYTE] (_LEN) */
1094 Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
1095 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
1096 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));
1099 case 4: /* Slave Mode [Flag] (_SLV) */
1101 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);
1102 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1103 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);
1106 case 5: /* Connection Speed [DWORD] (_SPE) */
1108 Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1109 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1110 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
1113 case 6: /* Clock Polarity [BYTE] (_POL) */
1115 Descriptor->SpiSerialBus.ClockPolarity = (UINT8) InitializerOp->Asl.Value.Integer;
1116 RsCreateByteField (InitializerOp, ACPI_RESTAG_POLARITY,
1117 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPolarity));
1120 case 7: /* Clock Phase [BYTE] (_PHA) */
1122 Descriptor->SpiSerialBus.ClockPhase = (UINT8) InitializerOp->Asl.Value.Integer;
1123 RsCreateByteField (InitializerOp, ACPI_RESTAG_PHASE,
1124 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPhase));
1127 case 8: /* ResSource [Optional Field - STRING] */
1129 if (ResSourceLength)
1131 /* Copy string to the descriptor */
1133 strcpy (ResourceSource,
1134 InitializerOp->Asl.Value.String);
1138 case 9: /* Resource Index */
1140 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1142 Descriptor->SpiSerialBus.ResSourceIndex =
1143 (UINT8) InitializerOp->Asl.Value.Integer;
1147 case 10: /* Resource Usage (consumer/producer) */
1149 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 1, 1);
1152 case 11: /* Resource Tag (Descriptor Name) */
1154 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1159 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1160 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1163 RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 2, 0);
1164 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1165 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 2);
1168 case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1170 RsGetVendorData (InitializerOp, VendorData,
1171 CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS));
1174 default: /* Ignore any extra nodes */
1179 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1182 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1187 /*******************************************************************************
1189 * FUNCTION: RsDoUartSerialBusDescriptor
1191 * PARAMETERS: Info - Parse Op and resource template offset
1193 * RETURN: Completed resource node
1195 * DESCRIPTION: Construct a long "UART Serial Bus" descriptor
1197 ******************************************************************************/
1200 RsDoUartSerialBusDescriptor (
1201 ASL_RESOURCE_INFO *Info)
1203 AML_RESOURCE *Descriptor;
1204 ACPI_PARSE_OBJECT *InitializerOp;
1205 ASL_RESOURCE_NODE *Rnode;
1206 char *ResourceSource = NULL;
1207 UINT8 *VendorData = NULL;
1208 UINT16 ResSourceLength;
1209 UINT16 VendorLength;
1210 UINT16 DescriptorSize;
1211 UINT32 CurrentByteOffset;
1215 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1216 CurrentByteOffset = Info->CurrentByteOffset;
1219 * Calculate lengths for fields that have variable length:
1220 * 1) Resource Source string
1221 * 2) Vendor Data buffer
1223 ResSourceLength = RsGetStringDataLength (InitializerOp);
1224 VendorLength = RsGetBufferDataLength (InitializerOp);
1226 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) +
1227 ResSourceLength + VendorLength;
1229 /* Allocate the local resource node and initialize */
1231 Rnode = RsAllocateResourceNode (DescriptorSize +
1232 sizeof (AML_RESOURCE_LARGE_HEADER));
1234 Descriptor = Rnode->Buffer;
1235 Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
1236 Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1237 Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
1238 Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
1239 Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
1240 Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
1242 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
1244 Descriptor->I2cSerialBus.RevisionId = 2;
1247 /* Build pointers to optional areas */
1249 VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
1250 ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1252 /* Process all child initialization nodes */
1254 for (i = 0; InitializerOp; i++)
1258 case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1260 Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1261 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1262 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
1265 case 1: /* Bits Per Byte [Flags] (_LEN) */
1267 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
1268 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
1269 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
1272 case 2: /* Stop Bits [Flags] (_STB) */
1274 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
1275 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
1276 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
1279 case 3: /* Lines In Use [BYTE] (_LIN) */
1281 Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer;
1282 RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE,
1283 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled));
1286 case 4: /* Endianness [Flag] (_END) */
1288 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
1289 RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
1290 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
1293 case 5: /* Parity [BYTE] (_PAR) */
1295 Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
1296 RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY,
1297 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
1300 case 6: /* Flow Control [Flags] (_FLC) */
1302 RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1303 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
1304 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
1307 case 7: /* Rx Buffer Size [WORD] (_RXL) */
1309 Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1310 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
1311 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
1314 case 8: /* Tx Buffer Size [WORD] (_TXL) */
1316 Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1317 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
1318 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
1321 case 9: /* ResSource [Optional Field - STRING] */
1323 if (ResSourceLength)
1325 /* Copy string to the descriptor */
1327 strcpy (ResourceSource,
1328 InitializerOp->Asl.Value.String);
1332 case 10: /* Resource Index */
1334 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1336 Descriptor->UartSerialBus.ResSourceIndex =
1337 (UINT8) InitializerOp->Asl.Value.Integer;
1341 case 11: /* Resource Usage (consumer/producer) */
1343 RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 1, 1);
1346 * Slave Mode [Flag] (_SLV)
1348 * Note: There is no SlaveMode argument to the UartSerialBus macro, but
1349 * we add this name anyway to allow the flag to be set by ASL in the
1350 * rare case where there is a slave mode associated with the UART.
1352 RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1353 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 0);
1356 case 12: /* Resource Tag (Descriptor Name) */
1358 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1363 * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1364 * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1367 RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 2, 0);
1368 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1369 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 2);
1372 case 14: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1374 RsGetVendorData (InitializerOp, VendorData,
1375 CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));
1378 default: /* Ignore any extra nodes */
1383 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1386 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1391 /*******************************************************************************
1393 * FUNCTION: RsDoPinFunctionDescriptor
1395 * PARAMETERS: Info - Parse Op and resource template offset
1397 * RETURN: Completed resource node
1399 * DESCRIPTION: Construct a long "PinFunction" descriptor
1401 ******************************************************************************/
1404 RsDoPinFunctionDescriptor (
1405 ASL_RESOURCE_INFO *Info)
1407 AML_RESOURCE *Descriptor;
1408 ACPI_PARSE_OBJECT *InitializerOp;
1409 ASL_RESOURCE_NODE *Rnode;
1410 char *ResourceSource = NULL;
1411 UINT8 *VendorData = NULL;
1412 UINT16 *PinList = NULL;
1413 UINT16 ResSourceLength;
1414 UINT16 VendorLength;
1415 UINT16 PinListLength;
1416 UINT16 DescriptorSize;
1417 UINT32 CurrentByteOffset;
1418 UINT32 PinCount = 0;
1421 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1422 CurrentByteOffset = Info->CurrentByteOffset;
1425 * Calculate lengths for fields that have variable length:
1426 * 1) Resource Source string
1427 * 2) Vendor Data buffer
1428 * 3) PIN (interrupt) list
1430 ResSourceLength = RsGetStringDataLength (InitializerOp);
1431 VendorLength = RsGetBufferDataLength (InitializerOp);
1432 PinListLength = RsGetInterruptDataLength (InitializerOp, 8);
1434 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION) +
1435 ResSourceLength + VendorLength + PinListLength;
1437 /* Allocate the local resource node and initialize */
1439 Rnode = RsAllocateResourceNode (DescriptorSize +
1440 sizeof (AML_RESOURCE_LARGE_HEADER));
1442 Descriptor = Rnode->Buffer;
1443 Descriptor->PinFunction.ResourceLength = DescriptorSize;
1444 Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION;
1445 Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION;
1447 /* Build pointers to optional areas */
1449 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_FUNCTION));
1450 ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength);
1451 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
1453 /* Setup offsets within the descriptor */
1455 Descriptor->PinFunction.PinTableOffset = (UINT16)
1456 ACPI_PTR_DIFF (PinList, Descriptor);
1458 Descriptor->PinFunction.ResSourceOffset = (UINT16)
1459 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1461 /* Process all child initialization nodes */
1463 for (i = 0; InitializerOp; i++)
1467 case 0: /* Share Type [Flags] (_SHR) */
1469 RsSetFlagBits16 (&Descriptor->PinFunction.Flags, InitializerOp, 0, 0);
1470 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1471 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.Flags), 0);
1474 case 1: /* Pin Config [BYTE] (_PPI) */
1476 Descriptor->PinFunction.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
1477 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
1478 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.PinConfig));
1481 case 2: /* Function Number [WORD] (_FUN) */
1483 Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
1484 RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
1485 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber));
1488 case 3: /* ResSource [Optional Field - STRING] */
1490 if (ResSourceLength)
1492 /* Copy string to the descriptor */
1494 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
1498 case 4: /* Resource Index */
1500 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1502 Descriptor->PinFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1506 case 5: /* Resource Usage (consumer/producer) */
1508 /* Assumed to be consumer */
1512 case 6: /* Resource Tag (Descriptor Name) */
1514 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1517 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1519 * Always set the VendorOffset even if there is no Vendor Data.
1520 * This field is required in order to calculate the length
1521 * of the ResourceSource at runtime.
1523 Descriptor->PinFunction.VendorOffset = (UINT16)
1524 ACPI_PTR_DIFF (VendorData, Descriptor);
1526 if (RsGetVendorData (InitializerOp, VendorData,
1527 (CurrentByteOffset + Descriptor->PinFunction.VendorOffset)))
1529 Descriptor->PinFunction.VendorLength = VendorLength;
1535 * PINs come through here, repeatedly. Each PIN must be a WORD.
1536 * NOTE: there is no "length" field for this, so from ACPI spec:
1537 * The number of pins in the table can be calculated from:
1538 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1539 * (implies resource source must immediately follow the pin list.)
1542 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1546 /* Case 8: First pin number in list */
1550 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1552 /* Must be at least one interrupt */
1554 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1555 InitializerOp, NULL);
1558 /* Check now for duplicates in list */
1560 RsCheckListForDuplicates (InitializerOp);
1562 /* Create a named field at the start of the list */
1564 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1565 CurrentByteOffset + Descriptor->PinFunction.PinTableOffset);
1570 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1577 /*******************************************************************************
1579 * FUNCTION: RsDoPinConfigDescriptor
1581 * PARAMETERS: Info - Parse Op and resource template offset
1583 * RETURN: Completed resource node
1585 * DESCRIPTION: Construct a long "PinConfig" descriptor
1587 ******************************************************************************/
1590 RsDoPinConfigDescriptor (
1591 ASL_RESOURCE_INFO *Info)
1593 AML_RESOURCE *Descriptor;
1594 ACPI_PARSE_OBJECT *InitializerOp;
1595 ASL_RESOURCE_NODE *Rnode;
1596 char *ResourceSource = NULL;
1597 UINT8 *VendorData = NULL;
1598 UINT16 *PinList = NULL;
1599 UINT16 ResSourceLength;
1600 UINT16 VendorLength;
1601 UINT16 PinListLength;
1602 UINT16 DescriptorSize;
1603 UINT32 CurrentByteOffset;
1604 UINT32 PinCount = 0;
1607 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1608 CurrentByteOffset = Info->CurrentByteOffset;
1611 * Calculate lengths for fields that have variable length:
1612 * 1) Resource Source string
1613 * 2) Vendor Data buffer
1614 * 3) PIN (interrupt) list
1616 ResSourceLength = RsGetStringDataLength (InitializerOp);
1617 VendorLength = RsGetBufferDataLength (InitializerOp);
1618 PinListLength = RsGetInterruptDataLength (InitializerOp, 8);
1620 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG) +
1621 ResSourceLength + VendorLength + PinListLength;
1623 /* Allocate the local resource node and initialize */
1625 Rnode = RsAllocateResourceNode (DescriptorSize +
1626 sizeof (AML_RESOURCE_LARGE_HEADER));
1628 Descriptor = Rnode->Buffer;
1629 Descriptor->PinConfig.ResourceLength = DescriptorSize;
1630 Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG;
1631 Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION;
1633 /* Build pointers to optional areas */
1635 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_CONFIG));
1636 ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength);
1637 VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
1639 /* Setup offsets within the descriptor */
1641 Descriptor->PinConfig.PinTableOffset = (UINT16)
1642 ACPI_PTR_DIFF (PinList, Descriptor);
1644 Descriptor->PinConfig.ResSourceOffset = (UINT16)
1645 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1647 /* Process all child initialization nodes */
1649 for (i = 0; InitializerOp; i++)
1655 case 0: /* Share Type [Flags] (_SHR) */
1657 RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 0, 0);
1658 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1659 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.Flags), 0);
1662 case 1: /* Pin Config Type [BYTE] (_TYP) */
1664 isValid = InitializerOp->Asl.Value.Integer <= 0x0d;
1667 isValid = InitializerOp->Asl.Value.Integer >= 0x80 &&
1668 InitializerOp->Asl.Value.Integer <= 0xff;
1672 AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL);
1675 Descriptor->PinConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer;
1676 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE,
1677 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigType));
1681 case 2: /* Pin Config Value [DWORD] (_VAL) */
1683 Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
1684 RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
1685 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue));
1688 case 3: /* ResSource [Optional Field - STRING] */
1690 if (ResSourceLength)
1692 /* Copy string to the descriptor */
1694 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
1698 case 4: /* Resource Index */
1700 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1702 Descriptor->PinConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1706 case 5: /* Resource Usage (consumer/producer) */
1708 RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 1, 1);
1712 case 6: /* Resource Tag (Descriptor Name) */
1714 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1717 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1719 * Always set the VendorOffset even if there is no Vendor Data.
1720 * This field is required in order to calculate the length
1721 * of the ResourceSource at runtime.
1723 Descriptor->PinConfig.VendorOffset = (UINT16)
1724 ACPI_PTR_DIFF (VendorData, Descriptor);
1726 if (RsGetVendorData (InitializerOp, VendorData,
1727 (CurrentByteOffset + Descriptor->PinConfig.VendorOffset)))
1729 Descriptor->PinConfig.VendorLength = VendorLength;
1735 * PINs come through here, repeatedly. Each PIN must be a WORD.
1736 * NOTE: there is no "length" field for this, so from ACPI spec:
1737 * The number of pins in the table can be calculated from:
1738 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1739 * (implies resource source must immediately follow the pin list.)
1742 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1746 /* Case 8: First pin number in list */
1750 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1752 /* Must be at least one interrupt */
1754 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1755 InitializerOp, NULL);
1758 /* Check now for duplicates in list */
1760 RsCheckListForDuplicates (InitializerOp);
1762 /* Create a named field at the start of the list */
1764 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1765 CurrentByteOffset + Descriptor->PinConfig.PinTableOffset);
1770 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1777 /*******************************************************************************
1779 * FUNCTION: RsDoPinGroupDescriptor
1781 * PARAMETERS: Info - Parse Op and resource template offset
1783 * RETURN: Completed resource node
1785 * DESCRIPTION: Construct a long "PinGroup" descriptor
1787 ******************************************************************************/
1790 RsDoPinGroupDescriptor (
1791 ASL_RESOURCE_INFO *Info)
1793 AML_RESOURCE *Descriptor;
1794 ACPI_PARSE_OBJECT *InitializerOp;
1795 ASL_RESOURCE_NODE *Rnode;
1796 UINT8 *VendorData = NULL;
1797 UINT16 *PinList = NULL;
1800 UINT16 VendorLength;
1801 UINT16 PinListLength;
1802 UINT16 DescriptorSize;
1803 UINT32 CurrentByteOffset;
1804 UINT32 PinCount = 0;
1807 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1808 CurrentByteOffset = Info->CurrentByteOffset;
1811 * Calculate lengths for fields that have variable length:
1813 * 2) Vendor Data buffer
1814 * 3) PIN (interrupt) list
1816 LabelLength = RsGetStringDataLength (InitializerOp);
1817 VendorLength = RsGetBufferDataLength (InitializerOp);
1818 PinListLength = RsGetInterruptDataLength (InitializerOp, 4);
1820 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP) +
1821 LabelLength + VendorLength + PinListLength;
1823 /* Allocate the local resource node and initialize */
1825 Rnode = RsAllocateResourceNode (DescriptorSize +
1826 sizeof (AML_RESOURCE_LARGE_HEADER));
1828 Descriptor = Rnode->Buffer;
1829 Descriptor->PinGroup.ResourceLength = DescriptorSize;
1830 Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP;
1831 Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION;
1833 /* Build pointers to optional areas */
1835 PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP));
1836 Label = ACPI_ADD_PTR (char, PinList, PinListLength);
1837 VendorData = ACPI_ADD_PTR (UINT8, Label, LabelLength);
1839 /* Setup offsets within the descriptor */
1841 Descriptor->PinGroup.PinTableOffset = (UINT16) ACPI_PTR_DIFF (PinList, Descriptor);
1842 Descriptor->PinGroup.LabelOffset = (UINT16) ACPI_PTR_DIFF (Label, Descriptor);
1844 /* Process all child initialization nodes */
1846 for (i = 0; InitializerOp; i++)
1850 case 0: /* Resource Label */
1852 if (LabelLength < 2)
1854 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
1856 strcpy (Label, InitializerOp->Asl.Value.String);
1860 case 1: /* Resource Usage (consumer/producer) */
1862 RsSetFlagBits16 (&Descriptor->PinGroup.Flags, InitializerOp, 0, 0);
1866 case 2: /* Resource Tag (Descriptor Name) */
1868 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1871 case 3: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1873 * Always set the VendorOffset even if there is no Vendor Data.
1874 * This field is required in order to calculate the length
1875 * of the ResourceSource at runtime.
1877 Descriptor->PinGroup.VendorOffset = (UINT16)
1878 ACPI_PTR_DIFF (VendorData, Descriptor);
1880 if (RsGetVendorData (InitializerOp, VendorData,
1881 (CurrentByteOffset + Descriptor->PinGroup.VendorOffset)))
1883 Descriptor->PinGroup.VendorLength = VendorLength;
1889 * PINs come through here, repeatedly. Each PIN must be a WORD.
1890 * NOTE: there is no "length" field for this, so from ACPI spec:
1891 * The number of pins in the table can be calculated from:
1892 * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
1893 * (implies resource source must immediately follow the pin list.)
1896 *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
1900 /* Case 3: First pin number in list */
1904 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1906 /* Must be at least one interrupt */
1908 AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
1909 InitializerOp, NULL);
1912 /* Check now for duplicates in list */
1914 RsCheckListForDuplicates (InitializerOp);
1916 /* Create a named field at the start of the list */
1918 RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1919 CurrentByteOffset + Descriptor->PinGroup.PinTableOffset);
1924 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1931 /*******************************************************************************
1933 * FUNCTION: RsDoPinGroupFunctionDescriptor
1935 * PARAMETERS: Info - Parse Op and resource template offset
1937 * RETURN: Completed resource node
1939 * DESCRIPTION: Construct a long "PinGroupFunction" descriptor
1941 ******************************************************************************/
1944 RsDoPinGroupFunctionDescriptor (
1945 ASL_RESOURCE_INFO *Info)
1947 AML_RESOURCE *Descriptor;
1948 ACPI_PARSE_OBJECT *InitializerOp;
1949 ASL_RESOURCE_NODE *Rnode;
1950 char *ResourceSource = NULL;
1951 char *ResourceSourceLabel = NULL;
1952 UINT8 *VendorData = NULL;
1953 UINT16 ResSourceLength;
1954 UINT16 ResSourceLabelLength;
1955 UINT16 VendorLength;
1956 UINT16 DescriptorSize;
1957 UINT32 CurrentByteOffset;
1960 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1961 CurrentByteOffset = Info->CurrentByteOffset;
1964 * Calculate lengths for fields that have variable length:
1965 * 1) Resource Source string
1966 * 2) Resource Source Label string
1967 * 3) Vendor Data buffer
1969 ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 2);
1970 ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 4);
1971 VendorLength = RsGetBufferDataLength (InitializerOp);
1973 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION) +
1974 ResSourceLength + ResSourceLabelLength + VendorLength;
1976 /* Allocate the local resource node and initialize */
1978 Rnode = RsAllocateResourceNode (DescriptorSize +
1979 sizeof (AML_RESOURCE_LARGE_HEADER));
1981 Descriptor = Rnode->Buffer;
1982 Descriptor->PinGroupFunction.ResourceLength = DescriptorSize;
1983 Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION;
1984 Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION;
1986 /* Build pointers to optional areas */
1988 ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION));
1989 ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength);
1990 VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength);
1992 /* Setup offsets within the descriptor */
1994 Descriptor->PinGroupFunction.ResSourceOffset = (UINT16)
1995 ACPI_PTR_DIFF (ResourceSource, Descriptor);
1996 Descriptor->PinGroupFunction.ResSourceLabelOffset = (UINT16)
1997 ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor);
1999 /* Process all child initialization nodes */
2001 for (i = 0; InitializerOp; i++)
2005 case 0: /* Share Type [Flags] (_SHR) */
2007 RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 0, 0);
2008 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
2009 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.Flags), 0);
2012 case 1: /* Function Number [WORD] */
2014 Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
2015 RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
2016 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber));
2019 case 2: /* ResourceSource [STRING] */
2021 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
2024 case 3: /* Resource Index */
2026 Descriptor->PinGroupFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
2029 case 4: /* ResourceSourceLabel [STRING] */
2031 if (ResSourceLabelLength < 2)
2033 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
2036 strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String);
2039 case 5: /* Resource Usage (consumer/producer) */
2041 RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 1, 1);
2045 case 6: /* Resource Tag (Descriptor Name) */
2047 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
2050 case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
2052 * Always set the VendorOffset even if there is no Vendor Data.
2053 * This field is required in order to calculate the length
2054 * of the ResourceSource at runtime.
2056 Descriptor->PinGroupFunction.VendorOffset = (UINT16)
2057 ACPI_PTR_DIFF (VendorData, Descriptor);
2059 if (RsGetVendorData (InitializerOp, VendorData,
2060 (CurrentByteOffset + Descriptor->PinGroupFunction.VendorOffset)))
2062 Descriptor->PinGroupFunction.VendorLength = VendorLength;
2070 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2077 /*******************************************************************************
2079 * FUNCTION: RsDoPinGroupConfigDescriptor
2081 * PARAMETERS: Info - Parse Op and resource template offset
2083 * RETURN: Completed resource node
2085 * DESCRIPTION: Construct a long "PinGroupConfig" descriptor
2087 ******************************************************************************/
2090 RsDoPinGroupConfigDescriptor (
2091 ASL_RESOURCE_INFO *Info)
2093 AML_RESOURCE *Descriptor;
2094 ACPI_PARSE_OBJECT *InitializerOp;
2095 ASL_RESOURCE_NODE *Rnode;
2096 char *ResourceSource = NULL;
2097 char *ResourceSourceLabel = NULL;
2098 UINT8 *VendorData = NULL;
2099 UINT16 ResSourceLength;
2100 UINT16 ResSourceLabelLength;
2101 UINT16 VendorLength;
2102 UINT16 DescriptorSize;
2103 UINT32 CurrentByteOffset;
2106 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2107 CurrentByteOffset = Info->CurrentByteOffset;
2110 * Calculate lengths for fields that have variable length:
2111 * 1) Resource Source string
2112 * 2) Resource Source Label string
2113 * 3) Vendor Data buffer
2115 ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 3);
2116 ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 5);
2117 VendorLength = RsGetBufferDataLength (InitializerOp);
2119 DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG) +
2120 ResSourceLength + ResSourceLabelLength + VendorLength;
2122 /* Allocate the local resource node and initialize */
2124 Rnode = RsAllocateResourceNode (DescriptorSize +
2125 sizeof (AML_RESOURCE_LARGE_HEADER));
2127 Descriptor = Rnode->Buffer;
2128 Descriptor->PinGroupConfig.ResourceLength = DescriptorSize;
2129 Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG;
2130 Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION;
2132 /* Build pointers to optional areas */
2134 ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_CONFIG));
2135 ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength);
2136 VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength);
2138 /* Setup offsets within the descriptor */
2140 Descriptor->PinGroupConfig.ResSourceOffset = (UINT16)
2141 ACPI_PTR_DIFF (ResourceSource, Descriptor);
2142 Descriptor->PinGroupConfig.ResSourceLabelOffset = (UINT16)
2143 ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor);
2145 /* Process all child initialization nodes */
2147 for (i = 0; InitializerOp; i++)
2153 case 0: /* Share Type [Flags] (_SHR) */
2155 RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 0, 0);
2156 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
2157 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.Flags), 0);
2160 case 1: /* Pin Config Type [BYTE] (_TYP) */
2162 isValid = InitializerOp->Asl.Value.Integer <= 0x0d;
2165 isValid = InitializerOp->Asl.Value.Integer >= 0x80 &&
2166 InitializerOp->Asl.Value.Integer <= 0xff;
2170 AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL);
2173 Descriptor->PinGroupConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer;
2174 RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE,
2175 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigType));
2179 case 2: /* Pin Config Value [DWORD] (_VAL) */
2181 Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
2182 RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
2183 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue));
2186 case 3: /* ResourceSource [STRING] */
2188 /* Copy string to the descriptor */
2190 strcpy (ResourceSource, InitializerOp->Asl.Value.String);
2193 case 4: /* Resource Index */
2195 Descriptor->PinGroupConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
2198 case 5: /* ResourceSourceLabel [STRING] */
2200 if (ResSourceLabelLength < 2)
2202 AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL);
2205 strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String);
2208 case 6: /* Resource Usage (consumer/producer) */
2210 RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 1, 1);
2214 case 7: /* Resource Tag (Descriptor Name) */
2216 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
2219 case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
2221 * Always set the VendorOffset even if there is no Vendor Data.
2222 * This field is required in order to calculate the length
2223 * of the ResourceSource at runtime.
2225 Descriptor->PinGroupConfig.VendorOffset = (UINT16)
2226 ACPI_PTR_DIFF (VendorData, Descriptor);
2228 if (RsGetVendorData (InitializerOp, VendorData,
2229 (CurrentByteOffset + Descriptor->PinGroupConfig.VendorOffset)))
2231 Descriptor->PinGroupConfig.VendorLength = VendorLength;
2239 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);