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: aslrestype2e - Large Extended address 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    ("aslrestype2e")
  123.  
  124. /*
  125.  * This module contains the Extended (64-bit) address space descriptors:
  126.  *
  127.  * ExtendedIO
  128.  * ExtendedMemory
  129.  * ExtendedSpace
  130.  */
  131.  
  132. /*******************************************************************************
  133.  *
  134.  * FUNCTION:    RsDoExtendedIoDescriptor
  135.  *
  136.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  137.  *              CurrentByteOffset   - Offset into the resource template AML
  138.  *                                    buffer (to track references to the desc)
  139.  *
  140.  * RETURN:      Completed resource node
  141.  *
  142.  * DESCRIPTION: Construct a long "ExtendedIO" descriptor
  143.  *
  144.  ******************************************************************************/
  145.  
  146. ASL_RESOURCE_NODE *
  147. RsDoExtendedIoDescriptor (
  148.     ACPI_PARSE_OBJECT       *Op,
  149.     UINT32                  CurrentByteOffset)
  150. {
  151.     AML_RESOURCE            *Descriptor;
  152.     ACPI_PARSE_OBJECT       *InitializerOp;
  153.     ACPI_PARSE_OBJECT       *MinOp = NULL;
  154.     ACPI_PARSE_OBJECT       *MaxOp = NULL;
  155.     ACPI_PARSE_OBJECT       *LengthOp = NULL;
  156.     ACPI_PARSE_OBJECT       *GranOp = NULL;
  157.     ASL_RESOURCE_NODE       *Rnode;
  158.     UINT16                  StringLength = 0;
  159.     UINT32                  i;
  160.  
  161.  
  162.     InitializerOp = Op->Asl.Child;
  163.     StringLength = RsGetStringDataLength (InitializerOp);
  164.  
  165.     Rnode = RsAllocateResourceNode (
  166.                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
  167.  
  168.     Descriptor = Rnode->Buffer;
  169.     Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
  170.     Descriptor->ExtAddress64.ResourceType    = ACPI_ADDRESS_TYPE_IO_RANGE;
  171.     Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
  172.  
  173.     Descriptor->ExtAddress64.ResourceLength  = (UINT16)
  174.         (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
  175.          sizeof (AML_RESOURCE_LARGE_HEADER));
  176.  
  177.     /* Process all child initialization nodes */
  178.  
  179.     for (i = 0; InitializerOp; i++)
  180.     {
  181.         switch (i)
  182.         {
  183.         case 0: /* Resource Usage */
  184.  
  185.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
  186.             break;
  187.  
  188.         case 1: /* MinType */
  189.  
  190.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
  191.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
  192.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
  193.             break;
  194.  
  195.         case 2: /* MaxType */
  196.  
  197.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
  198.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
  199.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
  200.             break;
  201.  
  202.         case 3: /* DecodeType */
  203.  
  204.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
  205.             RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
  206.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
  207.             break;
  208.  
  209.         case 4: /* Range Type */
  210.  
  211.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3);
  212.             RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
  213.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
  214.             break;
  215.  
  216.         case 5: /* Address Granularity */
  217.  
  218.             Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
  219.             RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
  220.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
  221.             GranOp = InitializerOp;
  222.            break;
  223.  
  224.         case 6: /* Address Min */
  225.  
  226.             Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
  227.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
  228.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
  229.             MinOp = InitializerOp;
  230.             break;
  231.  
  232.         case 7: /* Address Max */
  233.  
  234.             Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
  235.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
  236.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
  237.             MaxOp = InitializerOp;
  238.             break;
  239.  
  240.         case 8: /* Translation Offset */
  241.  
  242.             Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
  243.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
  244.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
  245.             break;
  246.  
  247.         case 9: /* Address Length */
  248.  
  249.             Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
  250.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  251.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
  252.             LengthOp = InitializerOp;
  253.             break;
  254.  
  255.         case 10: /* Type-Specific Attributes */
  256.  
  257.             Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
  258.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
  259.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
  260.             break;
  261.  
  262.         case 11: /* ResourceTag */
  263.  
  264.             UtAttachNamepathToOwner (Op, InitializerOp);
  265.             break;
  266.  
  267.         case 12: /* Type */
  268.  
  269.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0);
  270.             RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
  271.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
  272.             break;
  273.  
  274.         case 13: /* Translation Type */
  275.  
  276.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
  277.             RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
  278.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
  279.             break;
  280.  
  281.         default:
  282.  
  283.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  284.             break;
  285.         }
  286.  
  287.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  288.     }
  289.  
  290.     /* Validate the Min/Max/Len/Gran values */
  291.  
  292.     RsLargeAddressCheck (
  293.         Descriptor->ExtAddress64.Minimum,
  294.         Descriptor->ExtAddress64.Maximum,
  295.         Descriptor->ExtAddress64.AddressLength,
  296.         Descriptor->ExtAddress64.Granularity,
  297.         Descriptor->ExtAddress64.Flags,
  298.         MinOp, MaxOp, LengthOp, GranOp);
  299.  
  300.     Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
  301.     return (Rnode);
  302. }
  303.  
  304.  
  305. /*******************************************************************************
  306.  *
  307.  * FUNCTION:    RsDoExtendedMemoryDescriptor
  308.  *
  309.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  310.  *              CurrentByteOffset   - Offset into the resource template AML
  311.  *                                    buffer (to track references to the desc)
  312.  *
  313.  * RETURN:      Completed resource node
  314.  *
  315.  * DESCRIPTION: Construct a long "ExtendedMemory" descriptor
  316.  *
  317.  ******************************************************************************/
  318.  
  319. ASL_RESOURCE_NODE *
  320. RsDoExtendedMemoryDescriptor (
  321.     ACPI_PARSE_OBJECT       *Op,
  322.     UINT32                  CurrentByteOffset)
  323. {
  324.     AML_RESOURCE            *Descriptor;
  325.     ACPI_PARSE_OBJECT       *InitializerOp;
  326.     ACPI_PARSE_OBJECT       *MinOp = NULL;
  327.     ACPI_PARSE_OBJECT       *MaxOp = NULL;
  328.     ACPI_PARSE_OBJECT       *LengthOp = NULL;
  329.     ACPI_PARSE_OBJECT       *GranOp = NULL;
  330.     ASL_RESOURCE_NODE       *Rnode;
  331.     UINT16                  StringLength = 0;
  332.     UINT32                  i;
  333.  
  334.  
  335.     InitializerOp = Op->Asl.Child;
  336.     StringLength = RsGetStringDataLength (InitializerOp);
  337.  
  338.     Rnode = RsAllocateResourceNode (
  339.                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
  340.  
  341.     Descriptor = Rnode->Buffer;
  342.     Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
  343.     Descriptor->ExtAddress64.ResourceType    = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
  344.     Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
  345.  
  346.     Descriptor->ExtAddress64.ResourceLength  = (UINT16)
  347.         (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
  348.          sizeof (AML_RESOURCE_LARGE_HEADER));
  349.  
  350.     /* Process all child initialization nodes */
  351.  
  352.     for (i = 0; InitializerOp; i++)
  353.     {
  354.         switch (i)
  355.         {
  356.         case 0: /* Resource Usage */
  357.  
  358.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
  359.             break;
  360.  
  361.         case 1: /* DecodeType */
  362.  
  363.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
  364.             RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
  365.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
  366.             break;
  367.  
  368.         case 2: /* MinType */
  369.  
  370.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
  371.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
  372.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
  373.             break;
  374.  
  375.         case 3: /* MaxType */
  376.  
  377.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
  378.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
  379.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
  380.             break;
  381.  
  382.         case 4: /* Memory Type */
  383.  
  384.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0);
  385.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
  386.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
  387.             break;
  388.  
  389.         case 5: /* Read/Write Type */
  390.  
  391.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1);
  392.             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
  393.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
  394.             break;
  395.  
  396.         case 6: /* Address Granularity */
  397.  
  398.             Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
  399.             RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
  400.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
  401.             GranOp = InitializerOp;
  402.             break;
  403.  
  404.         case 7: /* Min Address */
  405.  
  406.             Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
  407.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
  408.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
  409.             MinOp = InitializerOp;
  410.             break;
  411.  
  412.         case 8: /* Max Address */
  413.  
  414.             Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
  415.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
  416.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
  417.             MaxOp = InitializerOp;
  418.             break;
  419.  
  420.         case 9: /* Translation Offset */
  421.  
  422.             Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
  423.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
  424.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
  425.             break;
  426.  
  427.         case 10: /* Address Length */
  428.  
  429.             Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
  430.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  431.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
  432.             LengthOp = InitializerOp;
  433.             break;
  434.  
  435.         case 11: /* Type-Specific Attributes */
  436.  
  437.             Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
  438.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
  439.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
  440.             break;
  441.  
  442.         case 12: /* ResourceTag */
  443.  
  444.             UtAttachNamepathToOwner (Op, InitializerOp);
  445.             break;
  446.  
  447.  
  448.         case 13: /* Address Range */
  449.  
  450.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0);
  451.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
  452.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
  453.             break;
  454.  
  455.         case 14: /* Type */
  456.  
  457.             RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
  458.             RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
  459.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
  460.             break;
  461.  
  462.         default:
  463.  
  464.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  465.             break;
  466.         }
  467.  
  468.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  469.     }
  470.  
  471.     /* Validate the Min/Max/Len/Gran values */
  472.  
  473.     RsLargeAddressCheck (
  474.         Descriptor->ExtAddress64.Minimum,
  475.         Descriptor->ExtAddress64.Maximum,
  476.         Descriptor->ExtAddress64.AddressLength,
  477.         Descriptor->ExtAddress64.Granularity,
  478.         Descriptor->ExtAddress64.Flags,
  479.         MinOp, MaxOp, LengthOp, GranOp);
  480.  
  481.     Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
  482.     return (Rnode);
  483. }
  484.  
  485.  
  486. /*******************************************************************************
  487.  *
  488.  * FUNCTION:    RsDoExtendedSpaceDescriptor
  489.  *
  490.  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  491.  *              CurrentByteOffset   - Offset into the resource template AML
  492.  *                                    buffer (to track references to the desc)
  493.  *
  494.  * RETURN:      Completed resource node
  495.  *
  496.  * DESCRIPTION: Construct a long "ExtendedSpace" descriptor
  497.  *
  498.  ******************************************************************************/
  499.  
  500. ASL_RESOURCE_NODE *
  501. RsDoExtendedSpaceDescriptor (
  502.     ACPI_PARSE_OBJECT       *Op,
  503.     UINT32                  CurrentByteOffset)
  504. {
  505.     AML_RESOURCE            *Descriptor;
  506.     ACPI_PARSE_OBJECT       *InitializerOp;
  507.     ACPI_PARSE_OBJECT       *MinOp = NULL;
  508.     ACPI_PARSE_OBJECT       *MaxOp = NULL;
  509.     ACPI_PARSE_OBJECT       *LengthOp = NULL;
  510.     ACPI_PARSE_OBJECT       *GranOp = NULL;
  511.     ASL_RESOURCE_NODE       *Rnode;
  512.     UINT16                  StringLength = 0;
  513.     UINT32                  i;
  514.  
  515.  
  516.     InitializerOp = Op->Asl.Child;
  517.     StringLength = RsGetStringDataLength (InitializerOp);
  518.  
  519.     Rnode = RsAllocateResourceNode (
  520.                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
  521.  
  522.     Descriptor = Rnode->Buffer;
  523.     Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
  524.     Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
  525.  
  526.     Descriptor->ExtAddress64.ResourceLength  = (UINT16)
  527.         (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
  528.          sizeof (AML_RESOURCE_LARGE_HEADER));
  529.  
  530.     /* Process all child initialization nodes */
  531.  
  532.     for (i = 0; InitializerOp; i++)
  533.     {
  534.         switch (i)
  535.         {
  536.         case 0: /* Resource Type */
  537.  
  538.             Descriptor->ExtAddress64.ResourceType =
  539.                 (UINT8) InitializerOp->Asl.Value.Integer;
  540.             break;
  541.  
  542.         case 1: /* Resource Usage */
  543.  
  544.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
  545.             break;
  546.  
  547.         case 2: /* DecodeType */
  548.  
  549.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
  550.             RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
  551.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
  552.             break;
  553.  
  554.         case 3: /* MinType */
  555.  
  556.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
  557.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
  558.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
  559.             break;
  560.  
  561.         case 4: /* MaxType */
  562.  
  563.             RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
  564.             RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
  565.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
  566.             break;
  567.  
  568.         case 5: /* Type-Specific flags */
  569.  
  570.             Descriptor->ExtAddress64.SpecificFlags =
  571.                 (UINT8) InitializerOp->Asl.Value.Integer;
  572.             break;
  573.  
  574.         case 6: /* Address Granularity */
  575.  
  576.             Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
  577.             RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
  578.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
  579.             GranOp = InitializerOp;
  580.             break;
  581.  
  582.         case 7: /* Min Address */
  583.  
  584.             Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
  585.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
  586.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
  587.             MinOp = InitializerOp;
  588.             break;
  589.  
  590.         case 8: /* Max Address */
  591.  
  592.             Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
  593.             RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
  594.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
  595.             MaxOp = InitializerOp;
  596.             break;
  597.  
  598.         case 9: /* Translation Offset */
  599.  
  600.             Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
  601.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
  602.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
  603.             break;
  604.  
  605.         case 10: /* Address Length */
  606.  
  607.             Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
  608.             RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
  609.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
  610.             LengthOp = InitializerOp;
  611.             break;
  612.  
  613.         case 11: /* Type-Specific Attributes */
  614.  
  615.             Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
  616.             RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
  617.                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
  618.             break;
  619.  
  620.         case 12: /* ResourceTag */
  621.  
  622.             UtAttachNamepathToOwner (Op, InitializerOp);
  623.             break;
  624.  
  625.         default:
  626.  
  627.             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
  628.             break;
  629.         }
  630.  
  631.         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
  632.     }
  633.  
  634.     /* Validate the Min/Max/Len/Gran values */
  635.  
  636.     RsLargeAddressCheck (
  637.         Descriptor->ExtAddress64.Minimum,
  638.         Descriptor->ExtAddress64.Maximum,
  639.         Descriptor->ExtAddress64.AddressLength,
  640.         Descriptor->ExtAddress64.Granularity,
  641.         Descriptor->ExtAddress64.Flags,
  642.         MinOp, MaxOp, LengthOp, GranOp);
  643.  
  644.     Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
  645.     return (Rnode);
  646. }
  647.