]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/contrib/dev/acpica/compiler/aslrestype2s.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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              * Always set the VendorOffset even if there is no Vendor Data.
622              * This field is required in order to calculate the length
623              * of the ResourceSource at runtime.
624              */
625             Descriptor->Gpio.VendorOffset = (UINT16)
626                 ACPI_PTR_DIFF (VendorData, Descriptor);
627
628             if (RsGetVendorData (InitializerOp, VendorData,
629                     (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
630             {
631                 Descriptor->Gpio.VendorLength = VendorLength;
632             }
633             break;
634
635         default:
636             /*
637              * PINs come through here, repeatedly. Each PIN must be a DWORD.
638              * NOTE: there is no "length" field for this, so from ACPI spec:
639              *  The number of pins in the table can be calculated from:
640              *  PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
641              *  (implies resource source must immediately follow the pin list.)
642              *  Name: _PIN
643              */
644             *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
645             InterruptList++;
646
647             /* Case 10: First interrupt number in list */
648
649             if (i == 10)
650             {
651                 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
652                 {
653                     /* Must be at least one interrupt */
654
655                     AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
656                         InitializerOp, NULL);
657                 }
658
659                 /* Check now for duplicates in list */
660
661                 RsCheckListForDuplicates (InitializerOp);
662
663                 /* Create a named field at the start of the list */
664
665                 RsCreateDwordField (InitializerOp, ACPI_RESTAG_PIN,
666                     CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
667             }
668             break;
669         }
670
671         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
672     }
673
674     return (Rnode);
675 }
676
677
678 /*******************************************************************************
679  *
680  * FUNCTION:    RsDoI2cSerialBusDescriptor
681  *
682  * PARAMETERS:  Op                  - Parent resource descriptor parse node
683  *              CurrentByteOffset   - Offset into the resource template AML
684  *                                    buffer (to track references to the desc)
685  *
686  * RETURN:      Completed resource node
687  *
688  * DESCRIPTION: Construct a long "I2cSerialBus" descriptor
689  *
690  ******************************************************************************/
691
692 ASL_RESOURCE_NODE *
693 RsDoI2cSerialBusDescriptor (
694     ACPI_PARSE_OBJECT       *Op,
695     UINT32                  CurrentByteOffset)
696 {
697     AML_RESOURCE            *Descriptor;
698     ACPI_PARSE_OBJECT       *InitializerOp;
699     ASL_RESOURCE_NODE       *Rnode;
700     char                    *ResourceSource = NULL;
701     UINT8                   *VendorData = NULL;
702     UINT16                  ResSourceLength;
703     UINT16                  VendorLength;
704     UINT16                  DescriptorSize;
705     UINT32                  i;
706
707
708     InitializerOp = Op->Asl.Child;
709
710     /*
711      * Calculate lengths for fields that have variable length:
712      * 1) Resource Source string
713      * 2) Vendor Data buffer
714      */
715     ResSourceLength = RsGetStringDataLength (InitializerOp);
716     VendorLength = RsGetBufferDataLength (InitializerOp);
717
718     DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS) +
719         ResSourceLength + VendorLength;
720
721     /* Allocate the local resource node and initialize */
722
723     Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
724
725     Descriptor = Rnode->Buffer;
726     Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
727     Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
728     Descriptor->I2cSerialBus.RevisionId     = AML_RESOURCE_I2C_REVISION;
729     Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
730     Descriptor->I2cSerialBus.Type           = AML_RESOURCE_I2C_SERIALBUSTYPE;
731     Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
732
733     /* Build pointers to optional areas */
734
735     VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
736     ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
737
738     DbgPrint (ASL_DEBUG_OUTPUT,
739         "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
740         "I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength,
741         (UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength,
742         VendorLength, Descriptor->I2cSerialBus.TypeDataLength);
743
744     /* Process all child initialization nodes */
745
746     for (i = 0; InitializerOp; i++)
747     {
748         switch (i)
749         {
750         case 0: /* Slave Address [WORD] (_ADR) */
751
752             Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
753             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
754                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
755             break;
756
757         case 1: /* Slave Mode [Flag] (_SLV) */
758
759             RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0);
760             RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
761                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0);
762             break;
763
764         case 2: /* Connection Speed [DWORD] (_SPE) */
765
766             Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
767             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
768                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
769             break;
770
771         case 3: /* Addressing Mode [Flag] (_MOD) */
772
773             RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
774             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
775                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
776             break;
777
778         case 4: /* ResSource [Optional Field - STRING] */
779
780             if (ResSourceLength)
781             {
782                 /* Copy string to the descriptor */
783
784                 strcpy (ResourceSource,
785                     InitializerOp->Asl.Value.String);
786             }
787             break;
788
789         case 5: /* Resource Index */
790
791             if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
792             {
793                 Descriptor->I2cSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
794             }
795             break;
796
797         case 6: /* Resource Usage (consumer/producer) */
798
799             RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 1, 1);
800             break;
801
802         case 7: /* Resource Tag (Descriptor Name) */
803
804             UtAttachNamepathToOwner (Op, InitializerOp);
805             break;
806
807         case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
808
809             RsGetVendorData (InitializerOp, VendorData,
810                 CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
811             break;
812
813         default:    /* Ignore any extra nodes */
814
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
990             break;
991         }
992
993         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
994     }
995
996     return (Rnode);
997 }
998
999
1000 /*******************************************************************************
1001  *
1002  * FUNCTION:    RsDoUartSerialBusDescriptor
1003  *
1004  * PARAMETERS:  Op                  - Parent resource descriptor parse node
1005  *              CurrentByteOffset   - Offset into the resource template AML
1006  *                                    buffer (to track references to the desc)
1007  *
1008  * RETURN:      Completed resource node
1009  *
1010  * DESCRIPTION: Construct a long "UART Serial Bus" descriptor
1011  *
1012  ******************************************************************************/
1013
1014 ASL_RESOURCE_NODE *
1015 RsDoUartSerialBusDescriptor (
1016     ACPI_PARSE_OBJECT       *Op,
1017     UINT32                  CurrentByteOffset)
1018 {
1019     AML_RESOURCE            *Descriptor;
1020     ACPI_PARSE_OBJECT       *InitializerOp;
1021     ASL_RESOURCE_NODE       *Rnode;
1022     char                    *ResourceSource = NULL;
1023     UINT8                   *VendorData = NULL;
1024     UINT16                  ResSourceLength;
1025     UINT16                  VendorLength;
1026     UINT16                  DescriptorSize;
1027     UINT32                  i;
1028
1029
1030     InitializerOp = Op->Asl.Child;
1031
1032     /*
1033      * Calculate lengths for fields that have variable length:
1034      * 1) Resource Source string
1035      * 2) Vendor Data buffer
1036      */
1037     ResSourceLength = RsGetStringDataLength (InitializerOp);
1038     VendorLength = RsGetBufferDataLength (InitializerOp);
1039
1040     DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) +
1041         ResSourceLength + VendorLength;
1042
1043     /* Allocate the local resource node and initialize */
1044
1045     Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
1046
1047     Descriptor = Rnode->Buffer;
1048     Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
1049     Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1050     Descriptor->UartSerialBus.RevisionId     = AML_RESOURCE_UART_REVISION;
1051     Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
1052     Descriptor->UartSerialBus.Type           = AML_RESOURCE_UART_SERIALBUSTYPE;
1053     Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
1054
1055     /* Build pointers to optional areas */
1056
1057     VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
1058     ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
1059
1060     DbgPrint (ASL_DEBUG_OUTPUT,
1061         "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
1062         "UartSerialBus", Descriptor->UartSerialBus.ResourceLength,
1063         (UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength,
1064         VendorLength, Descriptor->UartSerialBus.TypeDataLength);
1065
1066     /* Process all child initialization nodes */
1067
1068     for (i = 0; InitializerOp; i++)
1069     {
1070         switch (i)
1071         {
1072         case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1073
1074             Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1075             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1076                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
1077             break;
1078
1079         case 1: /* Bits Per Byte [Flags] (_LEN) */
1080
1081             RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
1082             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
1083                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
1084             break;
1085
1086         case 2: /* Stop Bits [Flags] (_STB) */
1087
1088             RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
1089             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
1090                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
1091             break;
1092
1093         case 3: /* Lines In Use [BYTE] (_LIN) */
1094
1095             Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer;
1096             RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE,
1097                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled));
1098             break;
1099
1100         case 4: /* Endianness [Flag] (_END) */
1101
1102             RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
1103             RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
1104                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
1105             break;
1106
1107         case 5: /* Parity [BYTE] (_PAR) */
1108
1109             Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
1110             RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY,
1111                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
1112             break;
1113
1114         case 6: /* Flow Control [Flags] (_FLC) */
1115
1116             RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1117             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
1118                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
1119             break;
1120
1121         case 7: /* Rx Buffer Size [WORD] (_RXL) */
1122
1123             Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1124             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
1125                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
1126             break;
1127
1128         case 8: /* Tx Buffer Size [WORD] (_TXL) */
1129
1130             Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
1131             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
1132                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
1133             break;
1134
1135         case 9: /* ResSource [Optional Field - STRING] */
1136
1137             if (ResSourceLength)
1138             {
1139                 /* Copy string to the descriptor */
1140
1141                 strcpy (ResourceSource,
1142                     InitializerOp->Asl.Value.String);
1143             }
1144             break;
1145
1146         case 10: /* Resource Index */
1147
1148             if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1149             {
1150                 Descriptor->UartSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1151             }
1152             break;
1153
1154         case 11: /* Resource Usage (consumer/producer) */
1155
1156             RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 1, 1);
1157
1158             /*
1159              * Slave Mode [Flag] (_SLV)
1160              *
1161              * Note: There is no SlaveMode argument to the UartSerialBus macro, but
1162              * we add this name anyway to allow the flag to be set by ASL in the
1163              * rare case where there is a slave mode associated with the UART.
1164              */
1165             RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
1166                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 0);
1167             break;
1168
1169         case 12: /* Resource Tag (Descriptor Name) */
1170
1171             UtAttachNamepathToOwner (Op, InitializerOp);
1172             break;
1173
1174         case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
1175
1176             RsGetVendorData (InitializerOp, VendorData,
1177                 CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));
1178             break;
1179
1180         default:    /* Ignore any extra nodes */
1181
1182             break;
1183         }
1184
1185         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1186     }
1187
1188     return (Rnode);
1189 }