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: aslrestype1 - Miscellaneous small 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    ("aslrestype1")
  123.  
  124. /*
  125.  * This module contains miscellaneous small resource descriptors:
  126.  *
  127.  * EndTag
  128.  * EndDependentFn
  129.  * Memory24
  130.  * Memory32
  131.  * Memory32Fixed
  132.  * StartDependentFn
  133.  * StartDependentFnNoPri
  134.  * VendorShort
  135.  */
  136.  
  137. /*******************************************************************************
  138.  *
  139.  * FUNCTION:    RsDoEndTagDescriptor
  140.  *
  141.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  142.  *              CurrentByteOffset   - Offset into the resource template AML
  143.  *                                    buffer (to track references to the desc)
  144.  *
  145.  * RETURN:      Completed resource node
  146.  *
  147.  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
  148.  *
  149.  ******************************************************************************/
  150.  
  151. ASL_RESOURCE_NODE *
  152. RsDoEndTagDescriptor (
  153.     ACPI_PARSE_OBJECT       *Op,
  154.     UINT32                  CurrentByteOffset)
  155. {
  156.     AML_RESOURCE            *Descriptor;
  157.     ASL_RESOURCE_NODE       *Rnode;
  158.  
  159.  
  160.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
  161.  
  162.     Descriptor = Rnode->Buffer;
  163.     Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
  164.                                         ASL_RDESC_END_TAG_SIZE;
  165.     Descriptor->EndTag.Checksum = 0;
  166.  
  167.     return (Rnode);
  168. }
  169.  
  170.  
  171. /*******************************************************************************
  172.  *
  173.  * FUNCTION:    RsDoEndDependentDescriptor
  174.  *
  175.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  176.  *              CurrentByteOffset   - Offset into the resource template AML
  177.  *                                    buffer (to track references to the desc)
  178.  *
  179.  * RETURN:      Completed resource node
  180.  *
  181.  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
  182.  *
  183.  ******************************************************************************/
  184.  
  185. ASL_RESOURCE_NODE *
  186. RsDoEndDependentDescriptor (
  187.     ACPI_PARSE_OBJECT       *Op,
  188.     UINT32                  CurrentByteOffset)
  189. {
  190.     AML_RESOURCE            *Descriptor;
  191.     ASL_RESOURCE_NODE       *Rnode;
  192.  
  193.  
  194.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
  195.  
  196.     Descriptor = Rnode->Buffer;
  197.     Descriptor->EndDpf.DescriptorType  = ACPI_RESOURCE_NAME_END_DEPENDENT |
  198.                                       ASL_RDESC_END_DEPEND_SIZE;
  199.     return (Rnode);
  200. }
  201.  
  202.  
  203. /*******************************************************************************
  204.  *
  205.  * FUNCTION:    RsDoMemory24Descriptor
  206.  *
  207.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  208.  *              CurrentByteOffset   - Offset into the resource template AML
  209.  *                                    buffer (to track references to the desc)
  210.  *
  211.  * RETURN:      Completed resource node
  212.  *
  213.  * DESCRIPTION: Construct a short "Memory24" descriptor
  214.  *
  215.  ******************************************************************************/
  216.  
  217. ASL_RESOURCE_NODE *
  218. RsDoMemory24Descriptor (
  219.     ACPI_PARSE_OBJECT       *Op,
  220.     UINT32                  CurrentByteOffset)
  221. {
  222.     AML_RESOURCE            *Descriptor;
  223.     ACPI_PARSE_OBJECT       *InitializerOp;
  224.     ACPI_PARSE_OBJECT       *MinOp = NULL;
  225.     ACPI_PARSE_OBJECT       *MaxOp = NULL;
  226.     ACPI_PARSE_OBJECT       *LengthOp = NULL;
  227.     ACPI_PARSE_OBJECT       *AlignOp = NULL;
  228.     ASL_RESOURCE_NODE       *Rnode;
  229.     UINT32                  i;
  230.  
  231.  
  232.     InitializerOp = Op->Asl.Child;
  233.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
  234.  
  235.     Descriptor = Rnode->Buffer;
  236.     Descriptor->Memory24.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY24;
  237.     Descriptor->Memory24.ResourceLength = 9;
  238.  
  239.     /* Process all child initialization nodes */
  240.  
  241.     for (i = 0; InitializerOp; i++)
  242.     {
  243.         switch (i)
  244.         {
  245.         case 0: /* Read/Write type */
  246.  
  247.             RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
  248.             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
  249.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
  250.             break;
  251.  
  252.         case 1: /* Min Address */
  253.  
  254.             Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
  255.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
  256.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
  257.             MinOp = InitializerOp;
  258.             break;
  259.  
  260.         case 2: /* Max Address */
  261.  
  262.             Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
  263.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
  264.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
  265.             MaxOp = InitializerOp;
  266.             break;
  267.  
  268.         case 3: /* Alignment */
  269.  
  270.             Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
  271.             RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
  272.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
  273.             AlignOp = InitializerOp;
  274.             break;
  275.  
  276.         case 4: /* Length */
  277.  
  278.             Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
  279.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  280.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
  281.             LengthOp = InitializerOp;
  282.             break;
  283.  
  284.         case 5: /* Name */
  285.  
  286.             UtAttachNamepathToOwner (Op, InitializerOp);
  287.             break;
  288.  
  289.         default:
  290.  
  291.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  292.             break;
  293.         }
  294.  
  295.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  296.     }
  297.  
  298.     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
  299.  
  300.     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
  301.         Descriptor->Memory24.Minimum,
  302.         Descriptor->Memory24.Maximum,
  303.         Descriptor->Memory24.AddressLength,
  304.         Descriptor->Memory24.Alignment,
  305.         MinOp, MaxOp, LengthOp, NULL);
  306.  
  307.     return (Rnode);
  308. }
  309.  
  310.  
  311. /*******************************************************************************
  312.  *
  313.  * FUNCTION:    RsDoMemory32Descriptor
  314.  *
  315.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  316.  *              CurrentByteOffset   - Offset into the resource template AML
  317.  *                                    buffer (to track references to the desc)
  318.  *
  319.  * RETURN:      Completed resource node
  320.  *
  321.  * DESCRIPTION: Construct a short "Memory32" descriptor
  322.  *
  323.  ******************************************************************************/
  324.  
  325. ASL_RESOURCE_NODE *
  326. RsDoMemory32Descriptor (
  327.     ACPI_PARSE_OBJECT       *Op,
  328.     UINT32                  CurrentByteOffset)
  329. {
  330.     AML_RESOURCE            *Descriptor;
  331.     ACPI_PARSE_OBJECT       *InitializerOp;
  332.     ACPI_PARSE_OBJECT       *MinOp = NULL;
  333.     ACPI_PARSE_OBJECT       *MaxOp = NULL;
  334.     ACPI_PARSE_OBJECT       *LengthOp = NULL;
  335.     ACPI_PARSE_OBJECT       *AlignOp = NULL;
  336.     ASL_RESOURCE_NODE       *Rnode;
  337.     UINT32                  i;
  338.  
  339.  
  340.     InitializerOp = Op->Asl.Child;
  341.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
  342.  
  343.     Descriptor = Rnode->Buffer;
  344.     Descriptor->Memory32.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY32;
  345.     Descriptor->Memory32.ResourceLength = 17;
  346.  
  347.     /* Process all child initialization nodes */
  348.  
  349.     for (i = 0; InitializerOp; i++)
  350.     {
  351.         switch (i)
  352.         {
  353.         case 0: /* Read/Write type */
  354.  
  355.             RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
  356.             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
  357.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
  358.             break;
  359.  
  360.         case 1:  /* Min Address */
  361.  
  362.             Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
  363.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
  364.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
  365.             MinOp = InitializerOp;
  366.             break;
  367.  
  368.         case 2: /* Max Address */
  369.  
  370.             Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
  371.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
  372.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
  373.             MaxOp = InitializerOp;
  374.             break;
  375.  
  376.         case 3: /* Alignment */
  377.  
  378.             Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
  379.             RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
  380.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
  381.             AlignOp = InitializerOp;
  382.             break;
  383.  
  384.         case 4: /* Length */
  385.  
  386.             Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
  387.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  388.                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
  389.             LengthOp = InitializerOp;
  390.             break;
  391.  
  392.         case 5: /* Name */
  393.  
  394.             UtAttachNamepathToOwner (Op, InitializerOp);
  395.             break;
  396.  
  397.         default:
  398.  
  399.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  400.             break;
  401.         }
  402.  
  403.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  404.     }
  405.  
  406.     /* Validate the Min/Max/Len/Align values */
  407.  
  408.     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
  409.         Descriptor->Memory32.Minimum,
  410.         Descriptor->Memory32.Maximum,
  411.         Descriptor->Memory32.AddressLength,
  412.         Descriptor->Memory32.Alignment,
  413.         MinOp, MaxOp, LengthOp, AlignOp);
  414.  
  415.     return (Rnode);
  416. }
  417.  
  418.  
  419. /*******************************************************************************
  420.  *
  421.  * FUNCTION:    RsDoMemory32FixedDescriptor
  422.  *
  423.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  424.  *              CurrentByteOffset   - Offset into the resource template AML
  425.  *                                    buffer (to track references to the desc)
  426.  *
  427.  * RETURN:      Completed resource node
  428.  *
  429.  * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
  430.  *
  431.  ******************************************************************************/
  432.  
  433. ASL_RESOURCE_NODE *
  434. RsDoMemory32FixedDescriptor (
  435.     ACPI_PARSE_OBJECT       *Op,
  436.     UINT32                  CurrentByteOffset)
  437. {
  438.     AML_RESOURCE            *Descriptor;
  439.     ACPI_PARSE_OBJECT       *InitializerOp;
  440.     ASL_RESOURCE_NODE       *Rnode;
  441.     UINT32                  i;
  442.  
  443.  
  444.     InitializerOp = Op->Asl.Child;
  445.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
  446.  
  447.     Descriptor = Rnode->Buffer;
  448.     Descriptor->FixedMemory32.DescriptorType  = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
  449.     Descriptor->FixedMemory32.ResourceLength = 9;
  450.  
  451.     /* Process all child initialization nodes */
  452.  
  453.     for (i = 0; InitializerOp; i++)
  454.     {
  455.         switch (i)
  456.         {
  457.         case 0: /* Read/Write type */
  458.  
  459.             RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
  460.             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
  461.                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
  462.             break;
  463.  
  464.         case 1: /* Address */
  465.  
  466.             Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
  467.             RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
  468.                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
  469.             break;
  470.  
  471.         case 2: /* Length */
  472.  
  473.             Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
  474.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  475.                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
  476.             break;
  477.  
  478.         case 3: /* Name */
  479.  
  480.             UtAttachNamepathToOwner (Op, InitializerOp);
  481.             break;
  482.  
  483.         default:
  484.  
  485.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  486.             break;
  487.         }
  488.  
  489.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  490.     }
  491.  
  492.     return (Rnode);
  493. }
  494.  
  495.  
  496. /*******************************************************************************
  497.  *
  498.  * FUNCTION:    RsDoStartDependentDescriptor
  499.  *
  500.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  501.  *              CurrentByteOffset   - Offset into the resource template AML
  502.  *                                    buffer (to track references to the desc)
  503.  *
  504.  * RETURN:      Completed resource node
  505.  *
  506.  * DESCRIPTION: Construct a short "StartDependentFn" descriptor
  507.  *
  508.  ******************************************************************************/
  509.  
  510. ASL_RESOURCE_NODE *
  511. RsDoStartDependentDescriptor (
  512.     ACPI_PARSE_OBJECT       *Op,
  513.     UINT32                  CurrentByteOffset)
  514. {
  515.     AML_RESOURCE            *Descriptor;
  516.     ACPI_PARSE_OBJECT       *InitializerOp;
  517.     ASL_RESOURCE_NODE       *Rnode;
  518.     ASL_RESOURCE_NODE       *PreviousRnode;
  519.     ASL_RESOURCE_NODE       *NextRnode;
  520.     UINT32                  i;
  521.     UINT8                   State;
  522.  
  523.  
  524.     InitializerOp = Op->Asl.Child;
  525.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
  526.  
  527.     PreviousRnode = Rnode;
  528.     Descriptor = Rnode->Buffer;
  529.  
  530.     /* Descriptor has priority byte */
  531.  
  532.     Descriptor->StartDpf.DescriptorType  = ACPI_RESOURCE_NAME_START_DEPENDENT |
  533.                                       (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
  534.  
  535.     /* Process all child initialization nodes */
  536.  
  537.     State = ACPI_RSTATE_START_DEPENDENT;
  538.     for (i = 0; InitializerOp; i++)
  539.     {
  540.         switch (i)
  541.         {
  542.         case 0: /* Compatibility Priority */
  543.  
  544.             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
  545.             {
  546.                 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
  547.                     InitializerOp, NULL);
  548.             }
  549.  
  550.             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
  551.             break;
  552.  
  553.         case 1: /* Performance/Robustness Priority */
  554.  
  555.             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
  556.             {
  557.                 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
  558.                     InitializerOp, NULL);
  559.             }
  560.  
  561.             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
  562.             break;
  563.  
  564.         default:
  565.  
  566.             NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
  567.                         CurrentByteOffset, &State);
  568.  
  569.             /*
  570.              * Update current byte offset to indicate the number of bytes from the
  571.              * start of the buffer.  Buffer can include multiple descriptors, we
  572.              * must keep track of the offset of not only each descriptor, but each
  573.              * element (field) within each descriptor as well.
  574.              */
  575.             CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
  576.                                     NextRnode);
  577.             break;
  578.         }
  579.  
  580.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  581.     }
  582.  
  583.     return (Rnode);
  584. }
  585.  
  586.  
  587. /*******************************************************************************
  588.  *
  589.  * FUNCTION:    RsDoStartDependentNoPriDescriptor
  590.  *
  591.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  592.  *              CurrentByteOffset   - Offset into the resource template AML
  593.  *                                    buffer (to track references to the desc)
  594.  *
  595.  * RETURN:      Completed resource node
  596.  *
  597.  * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
  598.  *
  599.  ******************************************************************************/
  600.  
  601. ASL_RESOURCE_NODE *
  602. RsDoStartDependentNoPriDescriptor (
  603.     ACPI_PARSE_OBJECT       *Op,
  604.     UINT32                  CurrentByteOffset)
  605. {
  606.     AML_RESOURCE            *Descriptor;
  607.     ACPI_PARSE_OBJECT       *InitializerOp;
  608.     ASL_RESOURCE_NODE       *Rnode;
  609.     ASL_RESOURCE_NODE       *PreviousRnode;
  610.     ASL_RESOURCE_NODE       *NextRnode;
  611.     UINT8                   State;
  612.  
  613.  
  614.     InitializerOp = Op->Asl.Child;
  615.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
  616.  
  617.     Descriptor = Rnode->Buffer;
  618.     Descriptor->StartDpf.DescriptorType  = ACPI_RESOURCE_NAME_START_DEPENDENT |
  619.                                       ASL_RDESC_ST_DEPEND_SIZE;
  620.     PreviousRnode = Rnode;
  621.  
  622.     /* Process all child initialization nodes */
  623.  
  624.     State = ACPI_RSTATE_START_DEPENDENT;
  625.     while (InitializerOp)
  626.     {
  627.         NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
  628.                         CurrentByteOffset, &State);
  629.  
  630.         /*
  631.          * Update current byte offset to indicate the number of bytes from the
  632.          * start of the buffer.  Buffer can include multiple descriptors, we
  633.          * must keep track of the offset of not only each descriptor, but each
  634.          * element (field) within each descriptor as well.
  635.          */
  636.         CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
  637.  
  638.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  639.     }
  640.  
  641.     return (Rnode);
  642. }
  643.  
  644.  
  645. /*******************************************************************************
  646.  *
  647.  * FUNCTION:    RsDoVendorSmallDescriptor
  648.  *
  649.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  650.  *              CurrentByteOffset   - Offset into the resource template AML
  651.  *                                    buffer (to track references to the desc)
  652.  *
  653.  * RETURN:      Completed resource node
  654.  *
  655.  * DESCRIPTION: Construct a short "VendorShort" descriptor
  656.  *
  657.  ******************************************************************************/
  658.  
  659. ASL_RESOURCE_NODE *
  660. RsDoVendorSmallDescriptor (
  661.     ACPI_PARSE_OBJECT       *Op,
  662.     UINT32                  CurrentByteOffset)
  663. {
  664.     AML_RESOURCE            *Descriptor;
  665.     ACPI_PARSE_OBJECT       *InitializerOp;
  666.     ASL_RESOURCE_NODE       *Rnode;
  667.     UINT8                   *VendorData;
  668.     UINT32                  i;
  669.  
  670.  
  671.     InitializerOp = Op->Asl.Child;
  672.  
  673.     /* Allocate worst case - 7 vendor bytes */
  674.  
  675.     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
  676.  
  677.     Descriptor = Rnode->Buffer;
  678.     Descriptor->VendorSmall.DescriptorType  = ACPI_RESOURCE_NAME_VENDOR_SMALL;
  679.     VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
  680.  
  681.     /* Process all child initialization nodes */
  682.  
  683.     InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  684.     for (i = 0; InitializerOp; i++)
  685.     {
  686.         if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
  687.         {
  688.             break;
  689.         }
  690.  
  691.         /* Maximum 7 vendor data bytes allowed (0-6) */
  692.  
  693.         if (i >= 7)
  694.         {
  695.             AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
  696.  
  697.             /* Eat the excess initializers */
  698.  
  699.             while (InitializerOp)
  700.             {
  701.                 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  702.             }
  703.             break;
  704.         }
  705.  
  706.         VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
  707.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  708.     }
  709.  
  710.     /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
  711.  
  712.     Rnode->BufferLength -= (7 - i);
  713.  
  714.     /* Set the length in the Type Tag */
  715.  
  716.     Descriptor->VendorSmall.DescriptorType |= (UINT8) i;
  717.     return (Rnode);
  718. }
  719.  
  720.