Subversion Repositories Kolibri OS

Rev

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