1/******************************************************************************
2 *
3 * Module Name: aslrestype2s - Serial Large resource descriptors
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions, and the following disclaimer,
16 *    without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 *    substantially similar to the "NO WARRANTY" disclaimer below
19 *    ("Disclaimer") and any redistribution must be conditioned upon
20 *    including a substantially similar Disclaimer requirement for further
21 *    binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 *    of any contributors may be used to endorse or promote products derived
24 *    from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <contrib/dev/acpica/compiler/aslcompiler.h>
45#include "aslcompiler.y.h"
46#include <contrib/dev/acpica/include/amlcode.h>
47
48#define _COMPONENT          ACPI_COMPILER
49        ACPI_MODULE_NAME    ("aslrestype2s")
50
51
52static UINT16
53RsGetBufferDataLength (
54    ACPI_PARSE_OBJECT       *InitializerOp);
55
56static UINT16
57RsGetInterruptDataLength (
58    ACPI_PARSE_OBJECT       *InitializerOp);
59
60static BOOLEAN
61RsGetVendorData (
62    ACPI_PARSE_OBJECT       *InitializerOp,
63    UINT8                   *VendorData,
64    ACPI_SIZE               DescriptorOffset);
65
66/*
67 * This module contains descriptors for serial buses and GPIO:
68 *
69 * GpioInt
70 * GpioIo
71 * I2cSerialBus
72 * SpiSerialBus
73 * UartSerialBus
74 */
75
76
77/*******************************************************************************
78 *
79 * FUNCTION:    RsGetBufferDataLength
80 *
81 * PARAMETERS:  InitializerOp       - Current parse op, start of the resource
82 *                                    descriptor
83 *
84 * RETURN:      Length of the data buffer
85 *
86 * DESCRIPTION: Get the length of a RawDataBuffer, used for vendor data.
87 *
88 ******************************************************************************/
89
90static UINT16
91RsGetBufferDataLength (
92    ACPI_PARSE_OBJECT       *InitializerOp)
93{
94    UINT16                  ExtraDataSize = 0;
95    ACPI_PARSE_OBJECT       *DataList;
96
97
98    /* Find the byte-initializer list */
99
100    while (InitializerOp)
101    {
102        if (InitializerOp->Asl.ParseOpcode == PARSEOP_DATABUFFER)
103        {
104            /* First child is the optional length (ignore it here) */
105
106            DataList = InitializerOp->Asl.Child;
107            DataList = ASL_GET_PEER_NODE (DataList);
108
109            /* Count the data items (each one is a byte of data) */
110
111            while (DataList)
112            {
113                ExtraDataSize++;
114                DataList = ASL_GET_PEER_NODE (DataList);
115            }
116
117            return (ExtraDataSize);
118        }
119
120        InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
121    }
122
123    return (ExtraDataSize);
124}
125
126
127/*******************************************************************************
128 *
129 * FUNCTION:    RsGetInterruptDataLength
130 *
131 * PARAMETERS:  InitializerOp       - Current parse op, start of the resource
132 *                                    descriptor
133 *
134 * RETURN:      Length of the interrupt data list
135 *
136 * DESCRIPTION: Get the length of a list of interrupt DWORDs for the GPIO
137 *              descriptors.
138 *
139 ******************************************************************************/
140
141static UINT16
142RsGetInterruptDataLength (
143    ACPI_PARSE_OBJECT       *InitializerOp)
144{
145    UINT16                  InterruptLength;
146    UINT32                  i;
147
148
149    /* Count the interrupt numbers */
150
151    InterruptLength = 0;
152    for (i = 0; InitializerOp; i++)
153    {
154        InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
155
156        /* Interrupt list starts at offset 10 (Gpio descriptors) */
157
158        if (i >= 10)
159        {
160            InterruptLength += 2;
161        }
162    }
163
164    return (InterruptLength);
165}
166
167
168/*******************************************************************************
169 *
170 * FUNCTION:    RsGetVendorData
171 *
172 * PARAMETERS:  InitializerOp       - Current parse op, start of the resource
173 *                                    descriptor.
174 *              VendorData          - Where the vendor data is returned
175 *              DescriptorOffset    - Where vendor data begins in descriptor
176 *
177 * RETURN:      TRUE if valid vendor data was returned, FALSE otherwise.
178 *
179 * DESCRIPTION: Extract the vendor data and construct a vendor data buffer.
180 *
181 ******************************************************************************/
182
183static BOOLEAN
184RsGetVendorData (
185    ACPI_PARSE_OBJECT       *InitializerOp,
186    UINT8                   *VendorData,
187    ACPI_SIZE               DescriptorOffset)
188{
189    ACPI_PARSE_OBJECT       *BufferOp;
190    UINT32                  SpecifiedLength = ACPI_UINT32_MAX;
191    UINT16                  ActualLength = 0;
192
193
194    /* Vendor Data field is always optional */
195
196    if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
197    {
198        return (FALSE);
199    }
200
201    BufferOp = InitializerOp->Asl.Child;
202    if (!BufferOp)
203    {
204        AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
205        return (FALSE);
206    }
207
208    /* First child is the optional buffer length (WORD) */
209
210    if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
211    {
212        SpecifiedLength = (UINT16) BufferOp->Asl.Value.Integer;
213    }
214
215    /* Insert field tag _VEN */
216
217    RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
218        (UINT16) DescriptorOffset);
219
220    /* Walk the list of buffer initializers (each is one byte) */
221
222    BufferOp = RsCompleteNodeAndGetNext (BufferOp);
223    if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
224    {
225        while (BufferOp)
226        {
227            *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
228            VendorData++;
229            ActualLength++;
230            BufferOp = RsCompleteNodeAndGetNext (BufferOp);
231        }
232    }
233
234    /* Length validation. Buffer cannot be of zero length */
235
236    if ((SpecifiedLength == 0) ||
237        ((SpecifiedLength == ACPI_UINT32_MAX) && (ActualLength == 0)))
238    {
239        AslError (ASL_ERROR, ASL_MSG_BUFFER_LENGTH, InitializerOp, NULL);
240        return (FALSE);
241    }
242
243    if (SpecifiedLength != ACPI_UINT32_MAX)
244    {
245        /* ActualLength > SpecifiedLength -> error */
246
247        if (ActualLength > SpecifiedLength)
248        {
249            AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, InitializerOp, NULL);
250            return (FALSE);
251        }
252
253        /* ActualLength < SpecifiedLength -> remark */
254
255        else if (ActualLength < SpecifiedLength)
256        {
257            AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, InitializerOp, NULL);
258            return (FALSE);
259        }
260    }
261
262    return (TRUE);
263}
264
265
266/*******************************************************************************
267 *
268 * FUNCTION:    RsDoGpioIntDescriptor
269 *
270 * PARAMETERS:  Info                - Parse Op and resource template offset
271 *
272 * RETURN:      Completed resource node
273 *
274 * DESCRIPTION: Construct a long "GpioInt" descriptor
275 *
276 ******************************************************************************/
277
278ASL_RESOURCE_NODE *
279RsDoGpioIntDescriptor (
280    ASL_RESOURCE_INFO       *Info)
281{
282    AML_RESOURCE            *Descriptor;
283    ACPI_PARSE_OBJECT       *InitializerOp;
284    ASL_RESOURCE_NODE       *Rnode;
285    char                    *ResourceSource = NULL;
286    UINT8                   *VendorData = NULL;
287    UINT16                  *InterruptList = NULL;
288    UINT16                  *PinList = NULL;
289    UINT16                  ResSourceLength;
290    UINT16                  VendorLength;
291    UINT16                  InterruptLength;
292    UINT16                  DescriptorSize;
293    UINT32                  CurrentByteOffset;
294    UINT32                  PinCount = 0;
295    UINT32                  i;
296
297
298    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
299    CurrentByteOffset = Info->CurrentByteOffset;
300
301    /*
302     * Calculate lengths for fields that have variable length:
303     * 1) Resource Source string
304     * 2) Vendor Data buffer
305     * 3) PIN (interrupt) list
306     */
307    ResSourceLength = RsGetStringDataLength (InitializerOp);
308    VendorLength = RsGetBufferDataLength (InitializerOp);
309    InterruptLength = RsGetInterruptDataLength (InitializerOp);
310
311    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
312        ResSourceLength + VendorLength + InterruptLength;
313
314    /* Allocate the local resource node and initialize */
315
316    Rnode = RsAllocateResourceNode (DescriptorSize +
317        sizeof (AML_RESOURCE_LARGE_HEADER));
318
319    Descriptor = Rnode->Buffer;
320    Descriptor->Gpio.ResourceLength = DescriptorSize;
321    Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
322    Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
323    Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
324
325    /* Build pointers to optional areas */
326
327    InterruptList = ACPI_ADD_PTR (UINT16, Descriptor,
328        sizeof (AML_RESOURCE_GPIO));
329    PinList = InterruptList;
330    ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
331    VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
332
333    /* Setup offsets within the descriptor */
334
335    Descriptor->Gpio.PinTableOffset = (UINT16)
336        ACPI_PTR_DIFF (InterruptList, Descriptor);
337
338    Descriptor->Gpio.ResSourceOffset = (UINT16)
339        ACPI_PTR_DIFF (ResourceSource, Descriptor);
340
341    /* Process all child initialization nodes */
342
343    for (i = 0; InitializerOp; i++)
344    {
345        switch (i)
346        {
347        case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
348
349            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
350            RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
351                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0);
352            break;
353
354        case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
355
356            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0);
357            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY,
358                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2);
359            break;
360
361        case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
362
363            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
364            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
365                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2);
366            break;
367
368        case 3: /* Pin Config [BYTE] (_PPI) */
369
370            Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
371            RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
372                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig));
373            break;
374
375        case 4: /* Debounce Timeout [WORD] (_DBT) */
376
377            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
378            RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
379                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
380            break;
381
382        case 5: /* ResSource [Optional Field - STRING] */
383
384            if (ResSourceLength)
385            {
386                /* Copy string to the descriptor */
387
388                strcpy (ResourceSource,
389                    InitializerOp->Asl.Value.String);
390            }
391            break;
392
393        case 6: /* Resource Index */
394
395            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
396            {
397                Descriptor->Gpio.ResSourceIndex =
398                    (UINT8) InitializerOp->Asl.Value.Integer;
399            }
400            break;
401
402        case 7: /* Resource Usage (consumer/producer) */
403
404            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
405            break;
406
407        case 8: /* Resource Tag (Descriptor Name) */
408
409            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
410            break;
411
412        case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
413
414            /*
415             * Always set the VendorOffset even if there is no Vendor Data.
416             * This field is required in order to calculate the length
417             * of the ResourceSource at runtime.
418             */
419            Descriptor->Gpio.VendorOffset = (UINT16)
420                ACPI_PTR_DIFF (VendorData, Descriptor);
421
422            if (RsGetVendorData (InitializerOp, VendorData,
423                (CurrentByteOffset +  Descriptor->Gpio.VendorOffset)))
424            {
425                Descriptor->Gpio.VendorLength = VendorLength;
426            }
427            break;
428
429        default:
430            /*
431             * PINs come through here, repeatedly. Each PIN must be a WORD.
432             * NOTE: there is no "length" field for this, so from ACPI spec:
433             *  The number of pins in the table can be calculated from:
434             *  PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
435             *  (implies resource source must immediately follow the pin list.)
436             *  Name: _PIN
437             */
438            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
439            InterruptList++;
440            PinCount++;
441
442            /* Case 10: First interrupt number in list */
443
444            if (i == 10)
445            {
446                if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
447                {
448                    /* Must be at least one interrupt */
449
450                    AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
451                        InitializerOp, NULL);
452                }
453
454                /* Check now for duplicates in list */
455
456                RsCheckListForDuplicates (InitializerOp);
457
458                /* Create a named field at the start of the list */
459
460                RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
461                    CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
462            }
463            break;
464        }
465
466        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
467    }
468
469    MpSaveGpioInfo (Info->MappingOp, Descriptor,
470        PinCount, PinList, ResourceSource);
471    return (Rnode);
472}
473
474
475/*******************************************************************************
476 *
477 * FUNCTION:    RsDoGpioIoDescriptor
478 *
479 * PARAMETERS:  Info                - Parse Op and resource template offset
480 *
481 * RETURN:      Completed resource node
482 *
483 * DESCRIPTION: Construct a long "GpioIo" descriptor
484 *
485 ******************************************************************************/
486
487ASL_RESOURCE_NODE *
488RsDoGpioIoDescriptor (
489    ASL_RESOURCE_INFO       *Info)
490{
491    AML_RESOURCE            *Descriptor;
492    ACPI_PARSE_OBJECT       *InitializerOp;
493    ASL_RESOURCE_NODE       *Rnode;
494    char                    *ResourceSource = NULL;
495    UINT8                   *VendorData = NULL;
496    UINT16                  *InterruptList = NULL;
497    UINT16                  *PinList = NULL;
498    UINT16                  ResSourceLength;
499    UINT16                  VendorLength;
500    UINT16                  InterruptLength;
501    UINT16                  DescriptorSize;
502    UINT32                  CurrentByteOffset;
503    UINT32                  PinCount = 0;
504    UINT32                  i;
505
506
507    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
508    CurrentByteOffset = Info->CurrentByteOffset;
509
510    /*
511     * Calculate lengths for fields that have variable length:
512     * 1) Resource Source string
513     * 2) Vendor Data buffer
514     * 3) PIN (interrupt) list
515     */
516    ResSourceLength = RsGetStringDataLength (InitializerOp);
517    VendorLength = RsGetBufferDataLength (InitializerOp);
518    InterruptLength = RsGetInterruptDataLength (InitializerOp);
519    PinList = InterruptList;
520
521    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
522        ResSourceLength + VendorLength + InterruptLength;
523
524    /* Allocate the local resource node and initialize */
525
526    Rnode = RsAllocateResourceNode (DescriptorSize +
527        sizeof (AML_RESOURCE_LARGE_HEADER));
528
529    Descriptor = Rnode->Buffer;
530    Descriptor->Gpio.ResourceLength = DescriptorSize;
531    Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
532    Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
533    Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
534
535    /* Build pointers to optional areas */
536
537    InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
538    PinList = InterruptList;
539    ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
540    VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
541
542    /* Setup offsets within the descriptor */
543
544    Descriptor->Gpio.PinTableOffset = (UINT16)
545        ACPI_PTR_DIFF (InterruptList, Descriptor);
546
547    Descriptor->Gpio.ResSourceOffset = (UINT16)
548        ACPI_PTR_DIFF (ResourceSource, Descriptor);
549
550    /* Process all child initialization nodes */
551
552    for (i = 0; InitializerOp; i++)
553    {
554        switch (i)
555        {
556        case 0: /* Share Type [Flags] (_SHR) */
557
558            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
559            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
560                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
561            break;
562
563        case 1: /* Pin Config [BYTE] (_PPI) */
564
565            Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
566            RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
567                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig));
568            break;
569
570        case 2: /* Debounce Timeout [WORD] (_DBT) */
571
572            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
573            RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
574                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
575            break;
576
577        case 3: /* Drive Strength [WORD] (_DRS) */
578
579            Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
580            RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
581                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
582            break;
583
584        case 4: /* I/O Restriction [Flag] (_IOR) */
585
586            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
587            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
588                CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
589            break;
590
591        case 5: /* ResSource [Optional Field - STRING] */
592
593            if (ResSourceLength)
594            {
595                /* Copy string to the descriptor */
596
597                strcpy (ResourceSource,
598                    InitializerOp->Asl.Value.String);
599            }
600            break;
601
602        case 6: /* Resource Index */
603
604            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
605            {
606                Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
607            }
608            break;
609
610        case 7: /* Resource Usage (consumer/producer) */
611
612            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
613            break;
614
615        case 8: /* Resource Tag (Descriptor Name) */
616
617            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
618            break;
619
620        case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
621            /*
622             * Always set the VendorOffset even if there is no Vendor Data.
623             * This field is required in order to calculate the length
624             * of the ResourceSource at runtime.
625             */
626            Descriptor->Gpio.VendorOffset = (UINT16)
627                ACPI_PTR_DIFF (VendorData, Descriptor);
628
629            if (RsGetVendorData (InitializerOp, VendorData,
630                (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
631            {
632                Descriptor->Gpio.VendorLength = VendorLength;
633            }
634            break;
635
636        default:
637            /*
638             * PINs come through here, repeatedly. Each PIN must be a WORD.
639             * NOTE: there is no "length" field for this, so from ACPI spec:
640             *  The number of pins in the table can be calculated from:
641             *  PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
642             *  (implies resource source must immediately follow the pin list.)
643             *  Name: _PIN
644             */
645            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
646            InterruptList++;
647            PinCount++;
648
649            /* Case 10: First interrupt number in list */
650
651            if (i == 10)
652            {
653                if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
654                {
655                    /* Must be at least one interrupt */
656
657                    AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
658                        InitializerOp, NULL);
659                }
660
661                /* Check now for duplicates in list */
662
663                RsCheckListForDuplicates (InitializerOp);
664
665                /* Create a named field at the start of the list */
666
667                RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
668                    CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
669            }
670            break;
671        }
672
673        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
674    }
675
676    MpSaveGpioInfo (Info->MappingOp, Descriptor,
677        PinCount, PinList, ResourceSource);
678    return (Rnode);
679}
680
681
682/*******************************************************************************
683 *
684 * FUNCTION:    RsDoI2cSerialBusDescriptor
685 *
686 * PARAMETERS:  Info                - Parse Op and resource template offset
687 *
688 * RETURN:      Completed resource node
689 *
690 * DESCRIPTION: Construct a long "I2cSerialBus" descriptor
691 *
692 ******************************************************************************/
693
694ASL_RESOURCE_NODE *
695RsDoI2cSerialBusDescriptor (
696    ASL_RESOURCE_INFO       *Info)
697{
698    AML_RESOURCE            *Descriptor;
699    ACPI_PARSE_OBJECT       *InitializerOp;
700    ASL_RESOURCE_NODE       *Rnode;
701    char                    *ResourceSource = NULL;
702    UINT8                   *VendorData = NULL;
703    UINT16                  ResSourceLength;
704    UINT16                  VendorLength;
705    UINT16                  DescriptorSize;
706    UINT32                  CurrentByteOffset;
707    UINT32                  i;
708
709
710    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
711    CurrentByteOffset = Info->CurrentByteOffset;
712
713    /*
714     * Calculate lengths for fields that have variable length:
715     * 1) Resource Source string
716     * 2) Vendor Data buffer
717     */
718    ResSourceLength = RsGetStringDataLength (InitializerOp);
719    VendorLength = RsGetBufferDataLength (InitializerOp);
720
721    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS) +
722        ResSourceLength + VendorLength;
723
724    /* Allocate the local resource node and initialize */
725
726    Rnode = RsAllocateResourceNode (DescriptorSize +
727        sizeof (AML_RESOURCE_LARGE_HEADER));
728
729    Descriptor = Rnode->Buffer;
730    Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
731    Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
732    Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
733    Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
734    Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
735    Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
736
737    if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
738    {
739        Descriptor->I2cSerialBus.RevisionId = 2;
740    }
741
742    /* Build pointers to optional areas */
743
744    VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
745    ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
746
747    /* Process all child initialization nodes */
748
749    for (i = 0; InitializerOp; i++)
750    {
751        switch (i)
752        {
753        case 0: /* Slave Address [WORD] (_ADR) */
754
755            Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
756            RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
757                CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
758            break;
759
760        case 1: /* Slave Mode [Flag] (_SLV) */
761
762            RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0);
763            RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
764                CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0);
765            break;
766
767        case 2: /* Connection Speed [DWORD] (_SPE) */
768
769            Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
770            RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
771                CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
772            break;
773
774        case 3: /* Addressing Mode [Flag] (_MOD) */
775
776            RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
777            RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
778                CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
779            break;
780
781        case 4: /* ResSource [Optional Field - STRING] */
782
783            if (ResSourceLength)
784            {
785                /* Copy string to the descriptor */
786
787                strcpy (ResourceSource,
788                    InitializerOp->Asl.Value.String);
789            }
790            break;
791
792        case 5: /* Resource Index */
793
794            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
795            {
796                Descriptor->I2cSerialBus.ResSourceIndex =
797                    (UINT8) InitializerOp->Asl.Value.Integer;
798            }
799            break;
800
801        case 6: /* Resource Usage (consumer/producer) */
802
803            RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 1, 1);
804            break;
805
806        case 7: /* Resource Tag (Descriptor Name) */
807
808            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
809            break;
810
811        case 8:
812            /*
813             * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
814             * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
815             * the ASL parser)
816             */
817            RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 2, 0);
818            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
819                CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 2);
820            break;
821
822        case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
823
824            RsGetVendorData (InitializerOp, VendorData,
825                CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
826            break;
827
828        default:    /* Ignore any extra nodes */
829
830            break;
831        }
832
833        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
834    }
835
836    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
837    return (Rnode);
838}
839
840
841/*******************************************************************************
842 *
843 * FUNCTION:    RsDoSpiSerialBusDescriptor
844 *
845 * PARAMETERS:  Info                - Parse Op and resource template offset
846 *
847 * RETURN:      Completed resource node
848 *
849 * DESCRIPTION: Construct a long "SPI Serial Bus" descriptor
850 *
851 ******************************************************************************/
852
853ASL_RESOURCE_NODE *
854RsDoSpiSerialBusDescriptor (
855    ASL_RESOURCE_INFO       *Info)
856{
857    AML_RESOURCE            *Descriptor;
858    ACPI_PARSE_OBJECT       *InitializerOp;
859    ASL_RESOURCE_NODE       *Rnode;
860    char                    *ResourceSource = NULL;
861    UINT8                   *VendorData = NULL;
862    UINT16                  ResSourceLength;
863    UINT16                  VendorLength;
864    UINT16                  DescriptorSize;
865    UINT32                  CurrentByteOffset;
866    UINT32                  i;
867
868
869    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
870    CurrentByteOffset = Info->CurrentByteOffset;
871
872    /*
873     * Calculate lengths for fields that have variable length:
874     * 1) Resource Source string
875     * 2) Vendor Data buffer
876     */
877    ResSourceLength = RsGetStringDataLength (InitializerOp);
878    VendorLength = RsGetBufferDataLength (InitializerOp);
879
880    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) +
881        ResSourceLength + VendorLength;
882
883    /* Allocate the local resource node and initialize */
884
885    Rnode = RsAllocateResourceNode (DescriptorSize +
886        sizeof (AML_RESOURCE_LARGE_HEADER));
887
888    Descriptor = Rnode->Buffer;
889    Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
890    Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
891    Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
892    Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
893    Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
894    Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
895
896    if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
897    {
898        Descriptor->I2cSerialBus.RevisionId = 2;
899    }
900
901    /* Build pointers to optional areas */
902
903    VendorData = ACPI_ADD_PTR (UINT8, Descriptor,
904        sizeof (AML_RESOURCE_SPI_SERIALBUS));
905    ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
906
907    /* Process all child initialization nodes */
908
909    for (i = 0; InitializerOp; i++)
910    {
911        switch (i)
912        {
913        case 0: /* Device Selection [WORD] (_ADR) */
914
915            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
916            RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
917                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
918            break;
919
920        case 1: /* Device Polarity [Flag] (_DPL) */
921
922            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
923            RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
924                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
925            break;
926
927        case 2: /* Wire Mode [Flag] (_MOD) */
928
929            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
930            RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
931                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
932            break;
933
934        case 3: /* Device Bit Length [BYTE] (_LEN) */
935
936            Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
937            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
938                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));
939            break;
940
941        case 4: /* Slave Mode [Flag] (_SLV) */
942
943            RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);
944            RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
945                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);
946            break;
947
948        case 5: /* Connection Speed [DWORD] (_SPE) */
949
950            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
951            RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
952                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
953            break;
954
955        case 6: /* Clock Polarity [BYTE] (_POL) */
956
957            Descriptor->SpiSerialBus.ClockPolarity = (UINT8) InitializerOp->Asl.Value.Integer;
958            RsCreateByteField (InitializerOp, ACPI_RESTAG_POLARITY,
959                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPolarity));
960            break;
961
962        case 7: /* Clock Phase [BYTE] (_PHA) */
963
964            Descriptor->SpiSerialBus.ClockPhase = (UINT8) InitializerOp->Asl.Value.Integer;
965            RsCreateByteField (InitializerOp, ACPI_RESTAG_PHASE,
966                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPhase));
967            break;
968
969        case 8: /* ResSource [Optional Field - STRING] */
970
971            if (ResSourceLength)
972            {
973                /* Copy string to the descriptor */
974
975                strcpy (ResourceSource,
976                    InitializerOp->Asl.Value.String);
977            }
978            break;
979
980        case 9: /* Resource Index */
981
982            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
983            {
984                Descriptor->SpiSerialBus.ResSourceIndex =
985                    (UINT8) InitializerOp->Asl.Value.Integer;
986            }
987            break;
988
989        case 10: /* Resource Usage (consumer/producer) */
990
991            RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 1, 1);
992            break;
993
994        case 11: /* Resource Tag (Descriptor Name) */
995
996            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
997            break;
998
999        case 12:
1000            /*
1001             * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1002             * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1003             * the ASL parser)
1004             */
1005            RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 2, 0);
1006            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1007                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 2);
1008            break;
1009
1010        case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1011
1012            RsGetVendorData (InitializerOp, VendorData,
1013                CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS));
1014            break;
1015
1016        default:    /* Ignore any extra nodes */
1017
1018            break;
1019        }
1020
1021        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1022    }
1023
1024    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1025    return (Rnode);
1026}
1027
1028
1029/*******************************************************************************
1030 *
1031 * FUNCTION:    RsDoUartSerialBusDescriptor
1032 *
1033 * PARAMETERS:  Info                - Parse Op and resource template offset
1034 *
1035 * RETURN:      Completed resource node
1036 *
1037 * DESCRIPTION: Construct a long "UART Serial Bus" descriptor
1038 *
1039 ******************************************************************************/
1040
1041ASL_RESOURCE_NODE *
1042RsDoUartSerialBusDescriptor (
1043    ASL_RESOURCE_INFO       *Info)
1044{
1045    AML_RESOURCE            *Descriptor;
1046    ACPI_PARSE_OBJECT       *InitializerOp;
1047    ASL_RESOURCE_NODE       *Rnode;
1048    char                    *ResourceSource = NULL;
1049    UINT8                   *VendorData = NULL;
1050    UINT16                  ResSourceLength;
1051    UINT16                  VendorLength;
1052    UINT16                  DescriptorSize;
1053    UINT32                  CurrentByteOffset;
1054    UINT32                  i;
1055
1056
1057    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1058    CurrentByteOffset = Info->CurrentByteOffset;
1059
1060    /*
1061     * Calculate lengths for fields that have variable length:
1062     * 1) Resource Source string
1063     * 2) Vendor Data buffer
1064     */
1065    ResSourceLength = RsGetStringDataLength (InitializerOp);
1066    VendorLength = RsGetBufferDataLength (InitializerOp);
1067
1068    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) +
1069        ResSourceLength + VendorLength;
1070
1071    /* Allocate the local resource node and initialize */
1072
1073    Rnode = RsAllocateResourceNode (DescriptorSize +
1074        sizeof (AML_RESOURCE_LARGE_HEADER));
1075
1076    Descriptor = Rnode->Buffer;
1077    Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
1078    Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1079    Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
1080    Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
1081    Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
1082    Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
1083
1084    if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
1085    {
1086        Descriptor->I2cSerialBus.RevisionId = 2;
1087    }
1088
1089    /* Build pointers to optional areas */
1090
1091    VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
1092    ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1093
1094    /* Process all child initialization nodes */
1095
1096    for (i = 0; InitializerOp; i++)
1097    {
1098        switch (i)
1099        {
1100        case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1101
1102            Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1103            RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1104                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
1105            break;
1106
1107        case 1: /* Bits Per Byte [Flags] (_LEN) */
1108
1109            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
1110            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
1111                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
1112            break;
1113
1114        case 2: /* Stop Bits [Flags] (_STB) */
1115
1116            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
1117            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
1118                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
1119            break;
1120
1121        case 3: /* Lines In Use [BYTE] (_LIN) */
1122
1123            Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer;
1124            RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE,
1125                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled));
1126            break;
1127
1128        case 4: /* Endianness [Flag] (_END) */
1129
1130            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
1131            RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
1132                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
1133            break;
1134
1135        case 5: /* Parity [BYTE] (_PAR) */
1136
1137            Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
1138            RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY,
1139                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
1140            break;
1141
1142        case 6: /* Flow Control [Flags] (_FLC) */
1143
1144            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1145            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
1146                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
1147            break;
1148
1149        case 7: /* Rx Buffer Size [WORD] (_RXL) */
1150
1151            Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1152            RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
1153                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
1154            break;
1155
1156        case 8: /* Tx Buffer Size [WORD] (_TXL) */
1157
1158            Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1159            RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
1160                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
1161            break;
1162
1163        case 9: /* ResSource [Optional Field - STRING] */
1164
1165            if (ResSourceLength)
1166            {
1167                /* Copy string to the descriptor */
1168
1169                strcpy (ResourceSource,
1170                    InitializerOp->Asl.Value.String);
1171            }
1172            break;
1173
1174        case 10: /* Resource Index */
1175
1176            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1177            {
1178                Descriptor->UartSerialBus.ResSourceIndex =
1179                    (UINT8) InitializerOp->Asl.Value.Integer;
1180            }
1181            break;
1182
1183        case 11: /* Resource Usage (consumer/producer) */
1184
1185            RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 1, 1);
1186
1187            /*
1188             * Slave Mode [Flag] (_SLV)
1189             *
1190             * Note: There is no SlaveMode argument to the UartSerialBus macro, but
1191             * we add this name anyway to allow the flag to be set by ASL in the
1192             * rare case where there is a slave mode associated with the UART.
1193             */
1194            RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1195                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 0);
1196            break;
1197
1198        case 12: /* Resource Tag (Descriptor Name) */
1199
1200            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
1201            break;
1202
1203        case 13:
1204            /*
1205             * Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
1206             * Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
1207             * the ASL parser)
1208             */
1209            RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 2, 0);
1210            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1211                CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 2);
1212            break;
1213
1214        case 14: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1215
1216            RsGetVendorData (InitializerOp, VendorData,
1217                CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));
1218            break;
1219
1220        default:    /* Ignore any extra nodes */
1221
1222            break;
1223        }
1224
1225        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1226    }
1227
1228    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1229    return (Rnode);
1230}
1231