1/******************************************************************************
2 *
3 * Module Name: aslrestype1i - Small I/O-related resource descriptors
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************/
115
116#include "aslcompiler.h"
117#include "aslcompiler.y.h"
118
119#define _COMPONENT          ACPI_COMPILER
120        ACPI_MODULE_NAME    ("aslrestype1i")
121
122/*
123 * This module contains the I/O-related small resource descriptors:
124 *
125 * DMA
126 * FixedDMA
127 * FixedIO
128 * IO
129 * IRQ
130 * IRQNoFlags
131 */
132
133/*******************************************************************************
134 *
135 * FUNCTION:    RsDoDmaDescriptor
136 *
137 * PARAMETERS:  Info                - Parse Op and resource template offset
138 *
139 * RETURN:      Completed resource node
140 *
141 * DESCRIPTION: Construct a short "DMA" descriptor
142 *
143 ******************************************************************************/
144
145ASL_RESOURCE_NODE *
146RsDoDmaDescriptor (
147    ASL_RESOURCE_INFO       *Info)
148{
149    AML_RESOURCE            *Descriptor;
150    ACPI_PARSE_OBJECT       *InitializerOp;
151    ASL_RESOURCE_NODE       *Rnode;
152    UINT32                  CurrentByteOffset;
153    UINT32                  i;
154    UINT8                   DmaChannelMask = 0;
155    UINT8                   DmaChannels = 0;
156
157
158    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
159    CurrentByteOffset = Info->CurrentByteOffset;
160    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
161
162    Descriptor = Rnode->Buffer;
163    Descriptor->Dma.DescriptorType =
164        ACPI_RESOURCE_NAME_DMA | ASL_RDESC_DMA_SIZE;
165
166    /* Process all child initialization nodes */
167
168    for (i = 0; InitializerOp; i++)
169    {
170        switch (i)
171        {
172        case 0: /* DMA type */
173
174            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
175            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
176                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5, 2);
177            break;
178
179        case 1: /* Bus Master */
180
181            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
182            RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
183                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
184            break;
185
186        case 2: /* Xfer Type (transfer width) */
187
188            RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
189            RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
190                CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0, 2);
191            break;
192
193        case 3: /* Name */
194
195            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
196            break;
197
198        default:
199
200            /* All DMA channel bytes are handled here, after flags and name */
201
202            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
203            {
204                /* Up to 8 channels can be specified in the list */
205
206                DmaChannels++;
207                if (DmaChannels > 8)
208                {
209                    AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
210                        InitializerOp, NULL);
211                    return (Rnode);
212                }
213
214                /* Only DMA channels 0-7 are allowed (mask is 8 bits) */
215
216                if (InitializerOp->Asl.Value.Integer > 7)
217                {
218                    AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
219                        InitializerOp, NULL);
220                }
221
222                /* Build the mask */
223
224                DmaChannelMask |=
225                    (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
226            }
227
228            if (i == 4) /* case 4: First DMA byte */
229            {
230                /* Check now for duplicates in list */
231
232                RsCheckListForDuplicates (InitializerOp);
233
234                /* Create a named field at the start of the list */
235
236                RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
237                    CurrentByteOffset +
238                    ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
239            }
240            break;
241        }
242
243        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
244    }
245
246    /* Now we can set the channel mask */
247
248    Descriptor->Dma.DmaChannelMask = DmaChannelMask;
249    return (Rnode);
250}
251
252
253/*******************************************************************************
254 *
255 * FUNCTION:    RsDoFixedDmaDescriptor
256 *
257 * PARAMETERS:  Info                - Parse Op and resource template offset
258 *
259 * RETURN:      Completed resource node
260 *
261 * DESCRIPTION: Construct a short "FixedDMA" descriptor
262 *
263 ******************************************************************************/
264
265ASL_RESOURCE_NODE *
266RsDoFixedDmaDescriptor (
267    ASL_RESOURCE_INFO       *Info)
268{
269    AML_RESOURCE            *Descriptor;
270    ACPI_PARSE_OBJECT       *InitializerOp;
271    ASL_RESOURCE_NODE       *Rnode;
272    UINT32                  CurrentByteOffset;
273    UINT32                  i;
274
275
276    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
277    CurrentByteOffset = Info->CurrentByteOffset;
278    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_DMA));
279
280    Descriptor = Rnode->Buffer;
281    Descriptor->FixedDma.DescriptorType =
282        ACPI_RESOURCE_NAME_FIXED_DMA | ASL_RDESC_FIXED_DMA_SIZE;
283
284    /* Process all child initialization nodes */
285
286    for (i = 0; InitializerOp; i++)
287    {
288        switch (i)
289        {
290        case 0: /* DMA Request Lines [WORD] (_DMA) */
291
292            Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
293            RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
294                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
295            break;
296
297        case 1: /* DMA Channel [WORD] (_TYP) */
298
299            Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
300            RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
301                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
302            break;
303
304        case 2: /* Transfer Width [BYTE] (_SIZ) */
305
306            Descriptor->FixedDma.Width = (UINT8) InitializerOp->Asl.Value.Integer;
307            RsCreateByteField (InitializerOp, ACPI_RESTAG_XFERTYPE,
308                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Width));
309            break;
310
311        case 3: /* Descriptor Name (optional) */
312
313            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
314            break;
315
316        default:    /* Ignore any extra nodes */
317
318            break;
319        }
320
321        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
322    }
323
324    return (Rnode);
325}
326
327
328/*******************************************************************************
329 *
330 * FUNCTION:    RsDoFixedIoDescriptor
331 *
332 * PARAMETERS:  Info                - Parse Op and resource template offset
333 *
334 * RETURN:      Completed resource node
335 *
336 * DESCRIPTION: Construct a short "FixedIO" descriptor
337 *
338 ******************************************************************************/
339
340ASL_RESOURCE_NODE *
341RsDoFixedIoDescriptor (
342    ASL_RESOURCE_INFO       *Info)
343{
344    AML_RESOURCE            *Descriptor;
345    ACPI_PARSE_OBJECT       *InitializerOp;
346    ACPI_PARSE_OBJECT       *AddressOp = NULL;
347    ASL_RESOURCE_NODE       *Rnode;
348    UINT32                  CurrentByteOffset;
349    UINT32                  i;
350
351
352    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
353    CurrentByteOffset = Info->CurrentByteOffset;
354    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
355
356    Descriptor = Rnode->Buffer;
357    Descriptor->Io.DescriptorType =
358        ACPI_RESOURCE_NAME_FIXED_IO | ASL_RDESC_FIXED_IO_SIZE;
359
360    /* Process all child initialization nodes */
361
362    for (i = 0; InitializerOp; i++)
363    {
364        switch (i)
365        {
366        case 0: /* Base Address */
367
368            Descriptor->FixedIo.Address =
369                (UINT16) InitializerOp->Asl.Value.Integer;
370            RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
371                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
372            AddressOp = InitializerOp;
373            break;
374
375        case 1: /* Length */
376
377            Descriptor->FixedIo.AddressLength =
378                (UINT8) InitializerOp->Asl.Value.Integer;
379            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
380                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
381            break;
382
383        case 2: /* Name */
384
385            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
386            break;
387
388        default:
389
390            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
391            break;
392        }
393
394        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
395    }
396
397    /* Error checks */
398
399    if (Descriptor->FixedIo.Address > 0x03FF)
400    {
401        AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
402    }
403
404    return (Rnode);
405}
406
407
408/*******************************************************************************
409 *
410 * FUNCTION:    RsDoIoDescriptor
411 *
412 * PARAMETERS:  Info                - Parse Op and resource template offset
413 *
414 * RETURN:      Completed resource node
415 *
416 * DESCRIPTION: Construct a short "IO" descriptor
417 *
418 ******************************************************************************/
419
420ASL_RESOURCE_NODE *
421RsDoIoDescriptor (
422    ASL_RESOURCE_INFO       *Info)
423{
424    AML_RESOURCE            *Descriptor;
425    ACPI_PARSE_OBJECT       *InitializerOp;
426    ACPI_PARSE_OBJECT       *MinOp = NULL;
427    ACPI_PARSE_OBJECT       *MaxOp = NULL;
428    ACPI_PARSE_OBJECT       *LengthOp = NULL;
429    ACPI_PARSE_OBJECT       *AlignOp = NULL;
430    ASL_RESOURCE_NODE       *Rnode;
431    UINT32                  CurrentByteOffset;
432    UINT32                  i;
433
434
435    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
436    CurrentByteOffset = Info->CurrentByteOffset;
437    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
438
439    Descriptor = Rnode->Buffer;
440    Descriptor->Io.DescriptorType =
441        ACPI_RESOURCE_NAME_IO | ASL_RDESC_IO_SIZE;
442
443    /* Process all child initialization nodes */
444
445    for (i = 0; InitializerOp; i++)
446    {
447        switch (i)
448        {
449        case 0: /* Decode size */
450
451            RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
452            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
453                CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
454            break;
455
456        case 1:  /* Min Address */
457
458            Descriptor->Io.Minimum =
459                (UINT16) InitializerOp->Asl.Value.Integer;
460            RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
461                CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
462            MinOp = InitializerOp;
463            break;
464
465        case 2: /* Max Address */
466
467            Descriptor->Io.Maximum =
468                (UINT16) InitializerOp->Asl.Value.Integer;
469            RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
470                CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
471            MaxOp = InitializerOp;
472            break;
473
474        case 3: /* Alignment */
475
476            Descriptor->Io.Alignment =
477                (UINT8) InitializerOp->Asl.Value.Integer;
478            RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
479                CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
480            AlignOp = InitializerOp;
481            break;
482
483        case 4: /* Length */
484
485            Descriptor->Io.AddressLength =
486                (UINT8) InitializerOp->Asl.Value.Integer;
487            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
488                CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
489            LengthOp = InitializerOp;
490            break;
491
492        case 5: /* Name */
493
494            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
495            break;
496
497        default:
498
499            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
500            break;
501        }
502
503        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
504    }
505
506    /* Validate the Min/Max/Len/Align values */
507
508    RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
509        Descriptor->Io.Minimum,
510        Descriptor->Io.Maximum,
511        Descriptor->Io.AddressLength,
512        Descriptor->Io.Alignment,
513        MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
514
515    return (Rnode);
516}
517
518
519/*******************************************************************************
520 *
521 * FUNCTION:    RsDoIrqDescriptor
522 *
523 * PARAMETERS:  Info                - Parse Op and resource template offset
524 *
525 * RETURN:      Completed resource node
526 *
527 * DESCRIPTION: Construct a short "IRQ" descriptor
528 *
529 ******************************************************************************/
530
531ASL_RESOURCE_NODE *
532RsDoIrqDescriptor (
533    ASL_RESOURCE_INFO       *Info)
534{
535    AML_RESOURCE            *Descriptor;
536    ACPI_PARSE_OBJECT       *InitializerOp;
537    ASL_RESOURCE_NODE       *Rnode;
538    UINT32                  Interrupts = 0;
539    UINT16                  IrqMask = 0;
540    UINT32                  CurrentByteOffset;
541    UINT32                  i;
542
543
544    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
545    CurrentByteOffset = Info->CurrentByteOffset;
546    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
547
548    /* Length = 3 (with flag byte) */
549
550    Descriptor = Rnode->Buffer;
551    Descriptor->Irq.DescriptorType =
552        ACPI_RESOURCE_NAME_IRQ | (ASL_RDESC_IRQ_SIZE + 0x01);
553
554    /* Process all child initialization nodes */
555
556    for (i = 0; InitializerOp; i++)
557    {
558        switch (i)
559        {
560        case 0: /* Interrupt Type (or Mode - edge/level) */
561
562            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
563            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
564                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
565            break;
566
567        case 1: /* Interrupt Level (or Polarity - Active high/low) */
568
569            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
570            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
571                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
572            break;
573
574        case 2: /* Share Type - Default: exclusive (0) */
575
576            RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
577            RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
578                CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
579            break;
580
581        case 3: /* Name */
582
583            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
584            break;
585
586        default:
587
588            /* All IRQ bytes are handled here, after the flags and name */
589
590            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
591            {
592                /* Up to 16 interrupts can be specified in the list */
593
594                Interrupts++;
595                if (Interrupts > 16)
596                {
597                    AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
598                        InitializerOp, NULL);
599                    return (Rnode);
600                }
601
602                /* Only interrupts 0-15 are allowed (mask is 16 bits) */
603
604                if (InitializerOp->Asl.Value.Integer > 15)
605                {
606                    AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
607                        InitializerOp, NULL);
608                }
609                else
610                {
611                    IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
612                }
613            }
614
615            /* Case 4: First IRQ value in list */
616
617            if (i == 4)
618            {
619                /* Check now for duplicates in list */
620
621                RsCheckListForDuplicates (InitializerOp);
622
623                /* Create a named field at the start of the list */
624
625                RsCreateWordField (InitializerOp, ACPI_RESTAG_INTERRUPT,
626                    CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
627            }
628            break;
629        }
630
631        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
632    }
633
634    /* Now we can set the channel mask */
635
636    Descriptor->Irq.IrqMask = IrqMask;
637    return (Rnode);
638}
639
640
641/*******************************************************************************
642 *
643 * FUNCTION:    RsDoIrqNoFlagsDescriptor
644 *
645 * PARAMETERS:  Info                - Parse Op and resource template offset
646 *
647 * RETURN:      Completed resource node
648 *
649 * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
650 *
651 ******************************************************************************/
652
653ASL_RESOURCE_NODE *
654RsDoIrqNoFlagsDescriptor (
655    ASL_RESOURCE_INFO       *Info)
656{
657    AML_RESOURCE            *Descriptor;
658    ACPI_PARSE_OBJECT       *InitializerOp;
659    ASL_RESOURCE_NODE       *Rnode;
660    UINT16                  IrqMask = 0;
661    UINT32                  Interrupts = 0;
662    UINT32                  CurrentByteOffset;
663    UINT32                  i;
664
665
666    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
667    CurrentByteOffset = Info->CurrentByteOffset;
668    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
669
670    Descriptor = Rnode->Buffer;
671    Descriptor->Irq.DescriptorType =
672        ACPI_RESOURCE_NAME_IRQ | ASL_RDESC_IRQ_SIZE;
673
674    /* Process all child initialization nodes */
675
676    for (i = 0; InitializerOp; i++)
677    {
678        switch (i)
679        {
680        case 0: /* Name */
681
682            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
683            break;
684
685        default:
686
687            /* IRQ bytes are handled here, after the flags and name */
688
689            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
690            {
691                /* Up to 16 interrupts can be specified in the list */
692
693                Interrupts++;
694                if (Interrupts > 16)
695                {
696                    AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
697                        InitializerOp, NULL);
698                    return (Rnode);
699                }
700
701                /* Only interrupts 0-15 are allowed (mask is 16 bits) */
702
703                if (InitializerOp->Asl.Value.Integer > 15)
704                {
705                    AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
706                        InitializerOp, NULL);
707                }
708                else
709                {
710                    IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
711                }
712            }
713
714            /* Case 1: First IRQ value in list */
715
716            if (i == 1)
717            {
718                /* Check now for duplicates in list */
719
720                RsCheckListForDuplicates (InitializerOp);
721
722                /* Create a named field at the start of the list */
723
724                RsCreateWordField (InitializerOp, ACPI_RESTAG_INTERRUPT,
725                    CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
726            }
727            break;
728        }
729
730        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
731    }
732
733    /* Now we can set the interrupt mask */
734
735    Descriptor->Irq.IrqMask = IrqMask;
736    return (Rnode);
737}
738