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