aslrestype1.c revision 118611
1118611Snjl
2118611Snjl/******************************************************************************
3118611Snjl *
4118611Snjl * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
5118611Snjl *              $Revision: 25 $
6118611Snjl *
7118611Snjl *****************************************************************************/
8118611Snjl
9118611Snjl/******************************************************************************
10118611Snjl *
11118611Snjl * 1. Copyright Notice
12118611Snjl *
13118611Snjl * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
14118611Snjl * All rights reserved.
15118611Snjl *
16118611Snjl * 2. License
17118611Snjl *
18118611Snjl * 2.1. This is your license from Intel Corp. under its intellectual property
19118611Snjl * rights.  You may have additional license terms from the party that provided
20118611Snjl * you this software, covering your right to use that party's intellectual
21118611Snjl * property rights.
22118611Snjl *
23118611Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24118611Snjl * copy of the source code appearing in this file ("Covered Code") an
25118611Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26118611Snjl * base code distributed originally by Intel ("Original Intel Code") to copy,
27118611Snjl * make derivatives, distribute, use and display any portion of the Covered
28118611Snjl * Code in any form, with the right to sublicense such rights; and
29118611Snjl *
30118611Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31118611Snjl * license (with the right to sublicense), under only those claims of Intel
32118611Snjl * patents that are infringed by the Original Intel Code, to make, use, sell,
33118611Snjl * offer to sell, and import the Covered Code and derivative works thereof
34118611Snjl * solely to the minimum extent necessary to exercise the above copyright
35118611Snjl * license, and in no event shall the patent license extend to any additions
36118611Snjl * to or modifications of the Original Intel Code.  No other license or right
37118611Snjl * is granted directly or by implication, estoppel or otherwise;
38118611Snjl *
39118611Snjl * The above copyright and patent license is granted only if the following
40118611Snjl * conditions are met:
41118611Snjl *
42118611Snjl * 3. Conditions
43118611Snjl *
44118611Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45118611Snjl * Redistribution of source code of any substantial portion of the Covered
46118611Snjl * Code or modification with rights to further distribute source must include
47118611Snjl * the above Copyright Notice, the above License, this list of Conditions,
48118611Snjl * and the following Disclaimer and Export Compliance provision.  In addition,
49118611Snjl * Licensee must cause all Covered Code to which Licensee contributes to
50118611Snjl * contain a file documenting the changes Licensee made to create that Covered
51118611Snjl * Code and the date of any change.  Licensee must include in that file the
52118611Snjl * documentation of any changes made by any predecessor Licensee.  Licensee
53118611Snjl * must include a prominent statement that the modification is derived,
54118611Snjl * directly or indirectly, from Original Intel Code.
55118611Snjl *
56118611Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57118611Snjl * Redistribution of source code of any substantial portion of the Covered
58118611Snjl * Code or modification without rights to further distribute source must
59118611Snjl * include the following Disclaimer and Export Compliance provision in the
60118611Snjl * documentation and/or other materials provided with distribution.  In
61118611Snjl * addition, Licensee may not authorize further sublicense of source of any
62118611Snjl * portion of the Covered Code, and must include terms to the effect that the
63118611Snjl * license from Licensee to its licensee is limited to the intellectual
64118611Snjl * property embodied in the software Licensee provides to its licensee, and
65118611Snjl * not to intellectual property embodied in modifications its licensee may
66118611Snjl * make.
67118611Snjl *
68118611Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any
69118611Snjl * substantial portion of the Covered Code or modification must reproduce the
70118611Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance
71118611Snjl * provision in the documentation and/or other materials provided with the
72118611Snjl * distribution.
73118611Snjl *
74118611Snjl * 3.4. Intel retains all right, title, and interest in and to the Original
75118611Snjl * Intel Code.
76118611Snjl *
77118611Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78118611Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or
79118611Snjl * other dealings in products derived from or relating to the Covered Code
80118611Snjl * without prior written authorization from Intel.
81118611Snjl *
82118611Snjl * 4. Disclaimer and Export Compliance
83118611Snjl *
84118611Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85118611Snjl * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86118611Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87118611Snjl * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88118611Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89118611Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90118611Snjl * PARTICULAR PURPOSE.
91118611Snjl *
92118611Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93118611Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94118611Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95118611Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96118611Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97118611Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98118611Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99118611Snjl * LIMITED REMEDY.
100118611Snjl *
101118611Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this
102118611Snjl * software or system incorporating such software without first obtaining any
103118611Snjl * required license or other approval from the U. S. Department of Commerce or
104118611Snjl * any other agency or department of the United States Government.  In the
105118611Snjl * event Licensee exports any such software from the United States or
106118611Snjl * re-exports any such software from a foreign destination, Licensee shall
107118611Snjl * ensure that the distribution and export/re-export of the software is in
108118611Snjl * compliance with all laws, regulations, orders, or other restrictions of the
109118611Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110118611Snjl * any of its subsidiaries will export/re-export any technical data, process,
111118611Snjl * software, or service, directly or indirectly, to any country for which the
112118611Snjl * United States government or any agency thereof requires an export license,
113118611Snjl * other governmental approval, or letter of assurance, without first obtaining
114118611Snjl * such license, approval or letter.
115118611Snjl *
116118611Snjl *****************************************************************************/
117118611Snjl
118118611Snjl
119118611Snjl#include "aslcompiler.h"
120118611Snjl#include "aslcompiler.y.h"
121118611Snjl
122118611Snjl#define _COMPONENT          ACPI_COMPILER
123118611Snjl        ACPI_MODULE_NAME    ("aslrestype1")
124118611Snjl
125118611Snjl
126118611Snjl/*******************************************************************************
127118611Snjl *
128118611Snjl * FUNCTION:    RsDoDmaDescriptor
129118611Snjl *
130118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
131118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
132118611Snjl *                                    buffer (to track references to the desc)
133118611Snjl *
134118611Snjl * RETURN:      Completed resource node
135118611Snjl *
136118611Snjl * DESCRIPTION: Construct a short "DMA" descriptor
137118611Snjl *
138118611Snjl ******************************************************************************/
139118611Snjl
140118611SnjlASL_RESOURCE_NODE *
141118611SnjlRsDoDmaDescriptor (
142118611Snjl    ACPI_PARSE_OBJECT       *Op,
143118611Snjl    UINT32                  CurrentByteOffset)
144118611Snjl{
145118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
146118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
147118611Snjl    ASL_RESOURCE_NODE       *Rnode;
148118611Snjl    UINT32                  i;
149118611Snjl    UINT8                   DmaChannelMask = 0;
150118611Snjl
151118611Snjl
152118611Snjl    InitializerOp = Op->Asl.Child;
153118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_DMA_FORMAT_DESC));
154118611Snjl
155118611Snjl    Descriptor = Rnode->Buffer;
156118611Snjl    Descriptor->Dma.DescriptorType  = ACPI_RDESC_TYPE_DMA_FORMAT |
157118611Snjl                                        ASL_RDESC_DMA_SIZE;
158118611Snjl
159118611Snjl    /*
160118611Snjl     * Process all child initialization nodes
161118611Snjl     */
162118611Snjl    for (i = 0; InitializerOp; i++)
163118611Snjl    {
164118611Snjl        switch (i)
165118611Snjl        {
166118611Snjl        case 0: /* DMA type */
167118611Snjl
168118611Snjl            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
169118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE,
170118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
171118611Snjl            break;
172118611Snjl
173118611Snjl        case 1: /* Bus Master */
174118611Snjl
175118611Snjl            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
176118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER,
177118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
178118611Snjl            break;
179118611Snjl
180118611Snjl        case 2: /* Xfer Type (transfer width) */
181118611Snjl
182118611Snjl            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
183118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE,
184118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
185118611Snjl            break;
186118611Snjl
187118611Snjl        case 3: /* Name */
188118611Snjl
189118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
190118611Snjl            break;
191118611Snjl
192118611Snjl        default:
193118611Snjl
194118611Snjl            /* All DMA channel bytes are handled here, after the flags and name */
195118611Snjl
196118611Snjl            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
197118611Snjl            {
198118611Snjl                DmaChannelMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
199118611Snjl            }
200118611Snjl
201118611Snjl            if (i == 4) /* case 4: First DMA byte */
202118611Snjl            {
203118611Snjl                RsCreateByteField (InitializerOp, ASL_RESNAME_DMA,
204118611Snjl                                    CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
205118611Snjl            }
206118611Snjl            break;
207118611Snjl        }
208118611Snjl
209118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
210118611Snjl    }
211118611Snjl
212118611Snjl    /* Now we can set the channel mask */
213118611Snjl
214118611Snjl    Descriptor->Dma.DmaChannelMask = DmaChannelMask;
215118611Snjl    return (Rnode);
216118611Snjl}
217118611Snjl
218118611Snjl
219118611Snjl/*******************************************************************************
220118611Snjl *
221118611Snjl * FUNCTION:    RsDoEndDependentDescriptor
222118611Snjl *
223118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
224118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
225118611Snjl *                                    buffer (to track references to the desc)
226118611Snjl *
227118611Snjl * RETURN:      Completed resource node
228118611Snjl *
229118611Snjl * DESCRIPTION: Construct a short "EndDependentFn" descriptor
230118611Snjl *
231118611Snjl ******************************************************************************/
232118611Snjl
233118611SnjlASL_RESOURCE_NODE *
234118611SnjlRsDoEndDependentDescriptor (
235118611Snjl    ACPI_PARSE_OBJECT       *Op,
236118611Snjl    UINT32                  CurrentByteOffset)
237118611Snjl{
238118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
239118611Snjl    ASL_RESOURCE_NODE       *Rnode;
240118611Snjl
241118611Snjl
242118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_END_DEPENDENT_DESC));
243118611Snjl
244118611Snjl    Descriptor = Rnode->Buffer;
245118611Snjl    Descriptor->End.DescriptorType  = ACPI_RDESC_TYPE_END_DEPENDENT |
246118611Snjl                                        ASL_RDESC_END_DEPEND_SIZE;
247118611Snjl    return (Rnode);
248118611Snjl}
249118611Snjl
250118611Snjl
251118611Snjl/*******************************************************************************
252118611Snjl *
253118611Snjl * FUNCTION:    RsDoFixedIoDescriptor
254118611Snjl *
255118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
256118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
257118611Snjl *                                    buffer (to track references to the desc)
258118611Snjl *
259118611Snjl * RETURN:      Completed resource node
260118611Snjl *
261118611Snjl * DESCRIPTION: Construct a short "FixedIO" descriptor
262118611Snjl *
263118611Snjl ******************************************************************************/
264118611Snjl
265118611SnjlASL_RESOURCE_NODE *
266118611SnjlRsDoFixedIoDescriptor (
267118611Snjl    ACPI_PARSE_OBJECT       *Op,
268118611Snjl    UINT32                  CurrentByteOffset)
269118611Snjl{
270118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
271118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
272118611Snjl    ASL_RESOURCE_NODE       *Rnode;
273118611Snjl    UINT32                  i;
274118611Snjl
275118611Snjl
276118611Snjl    InitializerOp = Op->Asl.Child;
277118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_IO_PORT_DESC));
278118611Snjl
279118611Snjl    Descriptor = Rnode->Buffer;
280118611Snjl    Descriptor->Iop.DescriptorType  = ACPI_RDESC_TYPE_FIXED_IO_PORT |
281118611Snjl                                        ASL_RDESC_FIXED_IO_SIZE;
282118611Snjl
283118611Snjl    /*
284118611Snjl     * Process all child initialization nodes
285118611Snjl     */
286118611Snjl    for (i = 0; InitializerOp; i++)
287118611Snjl    {
288118611Snjl        switch (i)
289118611Snjl        {
290118611Snjl        case 0: /* Base Address */
291118611Snjl
292118611Snjl            Descriptor->Fio.BaseAddress = (UINT16) InitializerOp->Asl.Value.Integer;
293118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
294118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.BaseAddress));
295118611Snjl            break;
296118611Snjl
297118611Snjl        case 1: /* Length */
298118611Snjl
299118611Snjl            Descriptor->Fio.Length = (UINT8) InitializerOp->Asl.Value.Integer;
300118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
301118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.Length));
302118611Snjl            break;
303118611Snjl
304118611Snjl        case 2: /* Name */
305118611Snjl
306118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
307118611Snjl            break;
308118611Snjl
309118611Snjl        default:
310118611Snjl
311118611Snjl            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
312118611Snjl            break;
313118611Snjl        }
314118611Snjl
315118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
316118611Snjl    }
317118611Snjl
318118611Snjl    return (Rnode);
319118611Snjl}
320118611Snjl
321118611Snjl
322118611Snjl/*******************************************************************************
323118611Snjl *
324118611Snjl * FUNCTION:    RsDoIoDescriptor
325118611Snjl *
326118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
327118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
328118611Snjl *                                    buffer (to track references to the desc)
329118611Snjl *
330118611Snjl * RETURN:      Completed resource node
331118611Snjl *
332118611Snjl * DESCRIPTION: Construct a short "IO" descriptor
333118611Snjl *
334118611Snjl ******************************************************************************/
335118611Snjl
336118611SnjlASL_RESOURCE_NODE *
337118611SnjlRsDoIoDescriptor (
338118611Snjl    ACPI_PARSE_OBJECT       *Op,
339118611Snjl    UINT32                  CurrentByteOffset)
340118611Snjl{
341118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
342118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
343118611Snjl    ASL_RESOURCE_NODE       *Rnode;
344118611Snjl    UINT32                  i;
345118611Snjl
346118611Snjl
347118611Snjl    InitializerOp = Op->Asl.Child;
348118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_IO_PORT_DESC));
349118611Snjl
350118611Snjl    Descriptor = Rnode->Buffer;
351118611Snjl    Descriptor->Iop.DescriptorType  = ACPI_RDESC_TYPE_IO_PORT |
352118611Snjl                                        ASL_RDESC_IO_SIZE;
353118611Snjl
354118611Snjl    /*
355118611Snjl     * Process all child initialization nodes
356118611Snjl     */
357118611Snjl    for (i = 0; InitializerOp; i++)
358118611Snjl    {
359118611Snjl        switch (i)
360118611Snjl        {
361118611Snjl        case 0: /* Decode size */
362118611Snjl
363118611Snjl            RsSetFlagBits (&Descriptor->Iop.Information, InitializerOp, 0, 1);
364118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
365118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Information), 0);
366118611Snjl            break;
367118611Snjl
368118611Snjl        case 1:  /* Min Address */
369118611Snjl
370118611Snjl            Descriptor->Iop.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
371118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
372118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMin));
373118611Snjl            break;
374118611Snjl
375118611Snjl        case 2: /* Max Address */
376118611Snjl
377118611Snjl            Descriptor->Iop.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
378118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
379118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMax));
380118611Snjl            break;
381118611Snjl
382118611Snjl        case 3: /* Alignment */
383118611Snjl
384118611Snjl            Descriptor->Iop.Alignment = (UINT8) InitializerOp->Asl.Value.Integer;
385118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
386118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Alignment));
387118611Snjl            break;
388118611Snjl
389118611Snjl        case 4: /* Length */
390118611Snjl
391118611Snjl            Descriptor->Iop.Length = (UINT8) InitializerOp->Asl.Value.Integer;
392118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
393118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Length));
394118611Snjl            break;
395118611Snjl
396118611Snjl        case 5: /* Name */
397118611Snjl
398118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
399118611Snjl            break;
400118611Snjl
401118611Snjl        default:
402118611Snjl
403118611Snjl            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
404118611Snjl            break;
405118611Snjl        }
406118611Snjl
407118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
408118611Snjl    }
409118611Snjl
410118611Snjl    return (Rnode);
411118611Snjl}
412118611Snjl
413118611Snjl
414118611Snjl/*******************************************************************************
415118611Snjl *
416118611Snjl * FUNCTION:    RsDoIrqDescriptor
417118611Snjl *
418118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
419118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
420118611Snjl *                                    buffer (to track references to the desc)
421118611Snjl *
422118611Snjl * RETURN:      Completed resource node
423118611Snjl *
424118611Snjl * DESCRIPTION: Construct a short "IRQ" descriptor
425118611Snjl *
426118611Snjl ******************************************************************************/
427118611Snjl
428118611SnjlASL_RESOURCE_NODE *
429118611SnjlRsDoIrqDescriptor (
430118611Snjl    ACPI_PARSE_OBJECT       *Op,
431118611Snjl    UINT32                  CurrentByteOffset)
432118611Snjl{
433118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
434118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
435118611Snjl    ASL_RESOURCE_NODE       *Rnode;
436118611Snjl    UINT32                  i;
437118611Snjl    UINT16                  IrqMask = 0;
438118611Snjl
439118611Snjl
440118611Snjl    InitializerOp = Op->Asl.Child;
441118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_FORMAT_DESC));
442118611Snjl
443118611Snjl    /* Length = 3 (with flag byte) */
444118611Snjl
445118611Snjl    Descriptor = Rnode->Buffer;
446118611Snjl    Descriptor->Irq.DescriptorType  = ACPI_RDESC_TYPE_IRQ_FORMAT |
447118611Snjl                                        (ASL_RDESC_IRQ_SIZE + 0x01);
448118611Snjl
449118611Snjl    /*
450118611Snjl     * Process all child initialization nodes
451118611Snjl     */
452118611Snjl    for (i = 0; InitializerOp; i++)
453118611Snjl    {
454118611Snjl        switch (i)
455118611Snjl        {
456118611Snjl        case 0: /* Interrupt Type (or Mode - edge/level) */
457118611Snjl
458118611Snjl            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
459118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
460118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
461118611Snjl            break;
462118611Snjl
463118611Snjl        case 1: /* Interrupt Level (or Polarity - Active high/low) */
464118611Snjl
465118611Snjl            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
466118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
467118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
468118611Snjl            break;
469118611Snjl
470118611Snjl        case 2: /* Share Type - Default: exclusive (0) */
471118611Snjl
472118611Snjl            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
473118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
474118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
475118611Snjl            break;
476118611Snjl
477118611Snjl        case 3: /* Name */
478118611Snjl
479118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
480118611Snjl            break;
481118611Snjl
482118611Snjl        default:
483118611Snjl
484118611Snjl            /* All IRQ bytes are handled here, after the flags and name */
485118611Snjl
486118611Snjl            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
487118611Snjl            {
488118611Snjl                IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
489118611Snjl            }
490118611Snjl
491118611Snjl            if (i == 4) /* case 4: First IRQ byte */
492118611Snjl            {
493118611Snjl                RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
494118611Snjl                                    CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
495118611Snjl            }
496118611Snjl            break;
497118611Snjl        }
498118611Snjl
499118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
500118611Snjl    }
501118611Snjl
502118611Snjl    /* Now we can set the channel mask */
503118611Snjl
504118611Snjl    Descriptor->Irq.IrqMask = IrqMask;
505118611Snjl    return (Rnode);
506118611Snjl}
507118611Snjl
508118611Snjl
509118611Snjl/*******************************************************************************
510118611Snjl *
511118611Snjl * FUNCTION:    RsDoIrqNoFlagsDescriptor
512118611Snjl *
513118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
514118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
515118611Snjl *                                    buffer (to track references to the desc)
516118611Snjl *
517118611Snjl * RETURN:      Completed resource node
518118611Snjl *
519118611Snjl * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
520118611Snjl *
521118611Snjl ******************************************************************************/
522118611Snjl
523118611SnjlASL_RESOURCE_NODE *
524118611SnjlRsDoIrqNoFlagsDescriptor (
525118611Snjl    ACPI_PARSE_OBJECT       *Op,
526118611Snjl    UINT32                  CurrentByteOffset)
527118611Snjl{
528118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
529118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
530118611Snjl    ASL_RESOURCE_NODE       *Rnode;
531118611Snjl    UINT32                  i;
532118611Snjl    UINT16                  IrqMask = 0;
533118611Snjl
534118611Snjl
535118611Snjl    InitializerOp = Op->Asl.Child;
536118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_NOFLAGS_DESC));
537118611Snjl
538118611Snjl    Descriptor = Rnode->Buffer;
539118611Snjl    Descriptor->Irq.DescriptorType  = ACPI_RDESC_TYPE_IRQ_FORMAT |
540118611Snjl                                        ASL_RDESC_IRQ_SIZE;
541118611Snjl
542118611Snjl    /*
543118611Snjl     * Process all child initialization nodes
544118611Snjl     */
545118611Snjl    for (i = 0; InitializerOp; i++)
546118611Snjl    {
547118611Snjl        switch (i)
548118611Snjl        {
549118611Snjl        case 0: /* Name */
550118611Snjl
551118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
552118611Snjl            break;
553118611Snjl
554118611Snjl        default:
555118611Snjl
556118611Snjl            /* IRQ bytes are handled here, after the flags and name */
557118611Snjl
558118611Snjl            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
559118611Snjl            {
560118611Snjl                IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
561118611Snjl            }
562118611Snjl
563118611Snjl            if (i == 1) /* case 1: First IRQ byte */
564118611Snjl            {
565118611Snjl                RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
566118611Snjl                                    CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
567118611Snjl            }
568118611Snjl            break;
569118611Snjl        }
570118611Snjl
571118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
572118611Snjl    }
573118611Snjl
574118611Snjl    /* Now we can set the interrupt mask */
575118611Snjl
576118611Snjl    Descriptor->Irq.IrqMask = IrqMask;
577118611Snjl    return (Rnode);
578118611Snjl}
579118611Snjl
580118611Snjl
581118611Snjl/*******************************************************************************
582118611Snjl *
583118611Snjl * FUNCTION:    RsDoMemory24Descriptor
584118611Snjl *
585118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
586118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
587118611Snjl *                                    buffer (to track references to the desc)
588118611Snjl *
589118611Snjl * RETURN:      Completed resource node
590118611Snjl *
591118611Snjl * DESCRIPTION: Construct a short "Memory24" descriptor
592118611Snjl *
593118611Snjl ******************************************************************************/
594118611Snjl
595118611SnjlASL_RESOURCE_NODE *
596118611SnjlRsDoMemory24Descriptor (
597118611Snjl    ACPI_PARSE_OBJECT       *Op,
598118611Snjl    UINT32                  CurrentByteOffset)
599118611Snjl{
600118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
601118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
602118611Snjl    ASL_RESOURCE_NODE       *Rnode;
603118611Snjl    UINT32                  i;
604118611Snjl
605118611Snjl
606118611Snjl    InitializerOp = Op->Asl.Child;
607118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_24_DESC));
608118611Snjl
609118611Snjl    Descriptor = Rnode->Buffer;
610118611Snjl    Descriptor->M24.DescriptorType  = ACPI_RDESC_TYPE_MEMORY_24;
611118611Snjl    Descriptor->M24.Length = 9;
612118611Snjl
613118611Snjl    /*
614118611Snjl     * Process all child initialization nodes
615118611Snjl     */
616118611Snjl    for (i = 0; InitializerOp; i++)
617118611Snjl    {
618118611Snjl        switch (i)
619118611Snjl        {
620118611Snjl        case 0: /* Read/Write type */
621118611Snjl
622118611Snjl            RsSetFlagBits (&Descriptor->M24.Information, InitializerOp, 0, 1);
623118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
624118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Information), 0);
625118611Snjl            break;
626118611Snjl
627118611Snjl        case 1: /* Min Address */
628118611Snjl
629118611Snjl            Descriptor->M24.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
630118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
631118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMin));
632118611Snjl            break;
633118611Snjl
634118611Snjl        case 2: /* Max Address */
635118611Snjl
636118611Snjl            Descriptor->M24.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
637118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
638118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMax));
639118611Snjl            break;
640118611Snjl
641118611Snjl        case 3: /* Alignment */
642118611Snjl
643118611Snjl            Descriptor->M24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
644118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
645118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Alignment));
646118611Snjl            break;
647118611Snjl
648118611Snjl        case 4: /* Length */
649118611Snjl
650118611Snjl            Descriptor->M24.RangeLength = (UINT16) InitializerOp->Asl.Value.Integer;
651118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
652118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M24.RangeLength));
653118611Snjl            break;
654118611Snjl
655118611Snjl        case 5: /* Name */
656118611Snjl
657118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
658118611Snjl            break;
659118611Snjl
660118611Snjl        default:
661118611Snjl
662118611Snjl            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
663118611Snjl            break;
664118611Snjl        }
665118611Snjl
666118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
667118611Snjl    }
668118611Snjl
669118611Snjl    return (Rnode);
670118611Snjl}
671118611Snjl
672118611Snjl
673118611Snjl/*******************************************************************************
674118611Snjl *
675118611Snjl * FUNCTION:    RsDoMemory32Descriptor
676118611Snjl *
677118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
678118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
679118611Snjl *                                    buffer (to track references to the desc)
680118611Snjl *
681118611Snjl * RETURN:      Completed resource node
682118611Snjl *
683118611Snjl * DESCRIPTION: Construct a short "Memory32" descriptor
684118611Snjl *
685118611Snjl ******************************************************************************/
686118611Snjl
687118611SnjlASL_RESOURCE_NODE *
688118611SnjlRsDoMemory32Descriptor (
689118611Snjl    ACPI_PARSE_OBJECT       *Op,
690118611Snjl    UINT32                  CurrentByteOffset)
691118611Snjl{
692118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
693118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
694118611Snjl    ASL_RESOURCE_NODE       *Rnode;
695118611Snjl    UINT32                  i;
696118611Snjl
697118611Snjl
698118611Snjl    InitializerOp = Op->Asl.Child;
699118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_32_DESC));
700118611Snjl
701118611Snjl    Descriptor = Rnode->Buffer;
702118611Snjl    Descriptor->M32.DescriptorType  = ACPI_RDESC_TYPE_MEMORY_32;
703118611Snjl    Descriptor->M32.Length = 17;
704118611Snjl
705118611Snjl    /*
706118611Snjl     * Process all child initialization nodes
707118611Snjl     */
708118611Snjl    for (i = 0; InitializerOp; i++)
709118611Snjl    {
710118611Snjl        switch (i)
711118611Snjl        {
712118611Snjl        case 0: /* Read/Write type */
713118611Snjl
714118611Snjl            RsSetFlagBits (&Descriptor->M32.Information, InitializerOp, 0, 1);
715118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
716118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Information), 0);
717118611Snjl            break;
718118611Snjl
719118611Snjl        case 1:  /* Min Address */
720118611Snjl
721118611Snjl            Descriptor->M32.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
722118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
723118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMin));
724118611Snjl            break;
725118611Snjl
726118611Snjl        case 2: /* Max Address */
727118611Snjl
728118611Snjl            Descriptor->M32.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
729118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
730118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMax));
731118611Snjl            break;
732118611Snjl
733118611Snjl        case 3: /* Alignment */
734118611Snjl
735118611Snjl            Descriptor->M32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
736118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
737118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Alignment));
738118611Snjl            break;
739118611Snjl
740118611Snjl        case 4: /* Length */
741118611Snjl
742118611Snjl            Descriptor->M32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
743118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
744118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (M32.RangeLength));
745118611Snjl            break;
746118611Snjl
747118611Snjl        case 5: /* Name */
748118611Snjl
749118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
750118611Snjl            break;
751118611Snjl
752118611Snjl        default:
753118611Snjl
754118611Snjl            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
755118611Snjl            break;
756118611Snjl        }
757118611Snjl
758118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
759118611Snjl    }
760118611Snjl
761118611Snjl    return (Rnode);
762118611Snjl}
763118611Snjl
764118611Snjl
765118611Snjl/*******************************************************************************
766118611Snjl *
767118611Snjl * FUNCTION:    RsDoMemory32FixedDescriptor
768118611Snjl *
769118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
770118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
771118611Snjl *                                    buffer (to track references to the desc)
772118611Snjl *
773118611Snjl * RETURN:      Completed resource node
774118611Snjl *
775118611Snjl * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
776118611Snjl *
777118611Snjl ******************************************************************************/
778118611Snjl
779118611SnjlASL_RESOURCE_NODE *
780118611SnjlRsDoMemory32FixedDescriptor (
781118611Snjl    ACPI_PARSE_OBJECT       *Op,
782118611Snjl    UINT32                  CurrentByteOffset)
783118611Snjl{
784118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
785118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
786118611Snjl    ASL_RESOURCE_NODE       *Rnode;
787118611Snjl    UINT32                  i;
788118611Snjl
789118611Snjl
790118611Snjl    InitializerOp = Op->Asl.Child;
791118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_MEMORY_32_DESC));
792118611Snjl
793118611Snjl    Descriptor = Rnode->Buffer;
794118611Snjl    Descriptor->F32.DescriptorType  = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
795118611Snjl    Descriptor->F32.Length = 9;
796118611Snjl
797118611Snjl    /*
798118611Snjl     * Process all child initialization nodes
799118611Snjl     */
800118611Snjl    for (i = 0; InitializerOp; i++)
801118611Snjl    {
802118611Snjl        switch (i)
803118611Snjl        {
804118611Snjl        case 0: /* Read/Write type */
805118611Snjl
806118611Snjl            RsSetFlagBits (&Descriptor->F32.Information, InitializerOp, 0, 1);
807118611Snjl            RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
808118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (F32.Information), 0);
809118611Snjl            break;
810118611Snjl
811118611Snjl        case 1: /* Address */
812118611Snjl
813118611Snjl            Descriptor->F32.BaseAddress = (UINT32) InitializerOp->Asl.Value.Integer;
814118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
815118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (F32.BaseAddress));
816118611Snjl            break;
817118611Snjl
818118611Snjl        case 2: /* Length */
819118611Snjl
820118611Snjl            Descriptor->F32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
821118611Snjl            RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
822118611Snjl                                CurrentByteOffset + ASL_RESDESC_OFFSET (F32.RangeLength));
823118611Snjl            break;
824118611Snjl
825118611Snjl        case 3: /* Name */
826118611Snjl
827118611Snjl            UtAttachNamepathToOwner (Op, InitializerOp);
828118611Snjl            break;
829118611Snjl
830118611Snjl        default:
831118611Snjl
832118611Snjl            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
833118611Snjl            break;
834118611Snjl        }
835118611Snjl
836118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
837118611Snjl    }
838118611Snjl
839118611Snjl    return (Rnode);
840118611Snjl}
841118611Snjl
842118611Snjl
843118611Snjl/*******************************************************************************
844118611Snjl *
845118611Snjl * FUNCTION:    RsDoStartDependentDescriptor
846118611Snjl *
847118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
848118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
849118611Snjl *                                    buffer (to track references to the desc)
850118611Snjl *
851118611Snjl * RETURN:      Completed resource node
852118611Snjl *
853118611Snjl * DESCRIPTION: Construct a short "StartDependentFn" descriptor
854118611Snjl *
855118611Snjl ******************************************************************************/
856118611Snjl
857118611SnjlASL_RESOURCE_NODE *
858118611SnjlRsDoStartDependentDescriptor (
859118611Snjl    ACPI_PARSE_OBJECT       *Op,
860118611Snjl    UINT32                  CurrentByteOffset)
861118611Snjl{
862118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
863118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
864118611Snjl    ASL_RESOURCE_NODE       *Rnode;
865118611Snjl    ASL_RESOURCE_NODE       *PreviousRnode;
866118611Snjl    ASL_RESOURCE_NODE       *NextRnode;
867118611Snjl    UINT32                  i;
868118611Snjl    UINT8                   State;
869118611Snjl
870118611Snjl
871118611Snjl    InitializerOp = Op->Asl.Child;
872118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_DESC));
873118611Snjl
874118611Snjl    PreviousRnode = Rnode;
875118611Snjl    Descriptor = Rnode->Buffer;
876118611Snjl
877118611Snjl    /* Descriptor has priority byte */
878118611Snjl
879118611Snjl    Descriptor->Std.DescriptorType  = ACPI_RDESC_TYPE_START_DEPENDENT |
880118611Snjl                                        (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
881118611Snjl
882118611Snjl    /*
883118611Snjl     * Process all child initialization nodes
884118611Snjl     */
885118611Snjl    State = ACPI_RSTATE_START_DEPENDENT;
886118611Snjl    for (i = 0; InitializerOp; i++)
887118611Snjl    {
888118611Snjl        switch (i)
889118611Snjl        {
890118611Snjl        case 0: /* Compatibility Priority */
891118611Snjl
892118611Snjl            if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
893118611Snjl            {
894118611Snjl                AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerOp, NULL);
895118611Snjl            }
896118611Snjl
897118611Snjl            RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 0, 0);
898118611Snjl            break;
899118611Snjl
900118611Snjl        case 1: /* Performance/Robustness Priority */
901118611Snjl
902118611Snjl            if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
903118611Snjl            {
904118611Snjl                AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerOp, NULL);
905118611Snjl            }
906118611Snjl
907118611Snjl            RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 2, 0);
908118611Snjl            break;
909118611Snjl
910118611Snjl        default:
911118611Snjl            NextRnode = RsDoOneResourceDescriptor  (InitializerOp, CurrentByteOffset, &State);
912118611Snjl
913118611Snjl            /*
914118611Snjl             * Update current byte offset to indicate the number of bytes from the
915118611Snjl             * start of the buffer.  Buffer can include multiple descriptors, we
916118611Snjl             * must keep track of the offset of not only each descriptor, but each
917118611Snjl             * element (field) within each descriptor as well.
918118611Snjl             */
919118611Snjl
920118611Snjl            CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
921118611Snjl            break;
922118611Snjl        }
923118611Snjl
924118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
925118611Snjl    }
926118611Snjl
927118611Snjl    return (Rnode);
928118611Snjl}
929118611Snjl
930118611Snjl
931118611Snjl/*******************************************************************************
932118611Snjl *
933118611Snjl * FUNCTION:    RsDoStartDependentNoPriDescriptor
934118611Snjl *
935118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
936118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
937118611Snjl *                                    buffer (to track references to the desc)
938118611Snjl *
939118611Snjl * RETURN:      Completed resource node
940118611Snjl *
941118611Snjl * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
942118611Snjl *
943118611Snjl ******************************************************************************/
944118611Snjl
945118611SnjlASL_RESOURCE_NODE *
946118611SnjlRsDoStartDependentNoPriDescriptor (
947118611Snjl    ACPI_PARSE_OBJECT       *Op,
948118611Snjl    UINT32                  CurrentByteOffset)
949118611Snjl{
950118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
951118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
952118611Snjl    ASL_RESOURCE_NODE       *Rnode;
953118611Snjl    ASL_RESOURCE_NODE       *PreviousRnode;
954118611Snjl    ASL_RESOURCE_NODE       *NextRnode;
955118611Snjl    UINT8                   State;
956118611Snjl
957118611Snjl
958118611Snjl    InitializerOp = Op->Asl.Child;
959118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_NOPRIO_DESC));
960118611Snjl
961118611Snjl    Descriptor = Rnode->Buffer;
962118611Snjl    Descriptor->Std.DescriptorType  = ACPI_RDESC_TYPE_START_DEPENDENT |
963118611Snjl                                        ASL_RDESC_ST_DEPEND_SIZE;
964118611Snjl    PreviousRnode = Rnode;
965118611Snjl
966118611Snjl    /*
967118611Snjl     * Process all child initialization nodes
968118611Snjl     */
969118611Snjl    State = ACPI_RSTATE_START_DEPENDENT;
970118611Snjl    while (InitializerOp)
971118611Snjl    {
972118611Snjl        NextRnode = RsDoOneResourceDescriptor  (InitializerOp, CurrentByteOffset, &State);
973118611Snjl
974118611Snjl        /*
975118611Snjl         * Update current byte offset to indicate the number of bytes from the
976118611Snjl         * start of the buffer.  Buffer can include multiple descriptors, we
977118611Snjl         * must keep track of the offset of not only each descriptor, but each
978118611Snjl         * element (field) within each descriptor as well.
979118611Snjl         */
980118611Snjl
981118611Snjl        CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
982118611Snjl
983118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
984118611Snjl    }
985118611Snjl
986118611Snjl    return (Rnode);
987118611Snjl}
988118611Snjl
989118611Snjl
990118611Snjl/*******************************************************************************
991118611Snjl *
992118611Snjl * FUNCTION:    RsDoVendorSmallDescriptor
993118611Snjl *
994118611Snjl * PARAMETERS:  Op                  - Parent resource descriptor parse node
995118611Snjl *              CurrentByteOffset   - Offset into the resource template AML
996118611Snjl *                                    buffer (to track references to the desc)
997118611Snjl *
998118611Snjl * RETURN:      Completed resource node
999118611Snjl *
1000118611Snjl * DESCRIPTION: Construct a short "VendorShort" descriptor
1001118611Snjl *
1002118611Snjl ******************************************************************************/
1003118611Snjl
1004118611SnjlASL_RESOURCE_NODE *
1005118611SnjlRsDoVendorSmallDescriptor (
1006118611Snjl    ACPI_PARSE_OBJECT       *Op,
1007118611Snjl    UINT32                  CurrentByteOffset)
1008118611Snjl{
1009118611Snjl    ASL_RESOURCE_DESC       *Descriptor;
1010118611Snjl    ACPI_PARSE_OBJECT       *InitializerOp;
1011118611Snjl    ASL_RESOURCE_NODE       *Rnode;
1012118611Snjl    UINT32                  i;
1013118611Snjl
1014118611Snjl
1015118611Snjl    InitializerOp = Op->Asl.Child;
1016118611Snjl    Rnode = RsAllocateResourceNode (sizeof (ASL_SMALL_VENDOR_DESC));
1017118611Snjl
1018118611Snjl    Descriptor = Rnode->Buffer;
1019118611Snjl    Descriptor->Smv.DescriptorType  = ACPI_RDESC_TYPE_SMALL_VENDOR;
1020118611Snjl
1021118611Snjl    /*
1022118611Snjl     * Process all child initialization nodes
1023118611Snjl     */
1024118611Snjl    InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1025118611Snjl    for (i = 0; (InitializerOp && (i < 7)); i++)
1026118611Snjl    {
1027118611Snjl        Descriptor->Smv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1028118611Snjl        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1029118611Snjl    }
1030118611Snjl
1031118611Snjl    /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
1032118611Snjl
1033118611Snjl    Rnode->BufferLength -= (7 - i);
1034118611Snjl
1035118611Snjl    /* Set the length in the Type Tag */
1036118611Snjl
1037118611Snjl    Descriptor->Smv.DescriptorType |= (UINT8) i;
1038118611Snjl    return (Rnode);
1039118611Snjl}
1040118611Snjl
1041118611Snjl
1042