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