Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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