Home | History | Annotate | Line # | Download | only in resources
rsutils.c revision 1.3.10.1
      1       1.1  jruoho /*******************************************************************************
      2       1.1  jruoho  *
      3       1.1  jruoho  * Module Name: rsutils - Utilities for the resource manager
      4       1.1  jruoho  *
      5       1.1  jruoho  ******************************************************************************/
      6       1.1  jruoho 
      7       1.3  jruoho /*
      8  1.3.10.1    yamt  * Copyright (C) 2000 - 2013, Intel Corp.
      9       1.1  jruoho  * All rights reserved.
     10       1.1  jruoho  *
     11       1.3  jruoho  * Redistribution and use in source and binary forms, with or without
     12       1.3  jruoho  * modification, are permitted provided that the following conditions
     13       1.3  jruoho  * are met:
     14       1.3  jruoho  * 1. Redistributions of source code must retain the above copyright
     15       1.3  jruoho  *    notice, this list of conditions, and the following disclaimer,
     16       1.3  jruoho  *    without modification.
     17       1.3  jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18       1.3  jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19       1.3  jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20       1.3  jruoho  *    including a substantially similar Disclaimer requirement for further
     21       1.3  jruoho  *    binary redistribution.
     22       1.3  jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23       1.3  jruoho  *    of any contributors may be used to endorse or promote products derived
     24       1.3  jruoho  *    from this software without specific prior written permission.
     25       1.3  jruoho  *
     26       1.3  jruoho  * Alternatively, this software may be distributed under the terms of the
     27       1.3  jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28       1.3  jruoho  * Software Foundation.
     29       1.3  jruoho  *
     30       1.3  jruoho  * NO WARRANTY
     31       1.3  jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32       1.3  jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33       1.3  jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34       1.3  jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35       1.3  jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36       1.3  jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37       1.3  jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38       1.3  jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.3  jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40       1.3  jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41       1.3  jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42       1.3  jruoho  */
     43       1.1  jruoho 
     44       1.1  jruoho 
     45       1.1  jruoho #define __RSUTILS_C__
     46       1.1  jruoho 
     47       1.1  jruoho #include "acpi.h"
     48       1.1  jruoho #include "accommon.h"
     49       1.1  jruoho #include "acnamesp.h"
     50       1.1  jruoho #include "acresrc.h"
     51       1.1  jruoho 
     52       1.1  jruoho 
     53       1.1  jruoho #define _COMPONENT          ACPI_RESOURCES
     54       1.1  jruoho         ACPI_MODULE_NAME    ("rsutils")
     55       1.1  jruoho 
     56       1.1  jruoho 
     57       1.1  jruoho /*******************************************************************************
     58       1.1  jruoho  *
     59       1.1  jruoho  * FUNCTION:    AcpiRsDecodeBitmask
     60       1.1  jruoho  *
     61       1.1  jruoho  * PARAMETERS:  Mask            - Bitmask to decode
     62       1.1  jruoho  *              List            - Where the converted list is returned
     63       1.1  jruoho  *
     64       1.1  jruoho  * RETURN:      Count of bits set (length of list)
     65       1.1  jruoho  *
     66       1.1  jruoho  * DESCRIPTION: Convert a bit mask into a list of values
     67       1.1  jruoho  *
     68       1.1  jruoho  ******************************************************************************/
     69       1.1  jruoho 
     70       1.1  jruoho UINT8
     71       1.1  jruoho AcpiRsDecodeBitmask (
     72       1.1  jruoho     UINT16                  Mask,
     73       1.1  jruoho     UINT8                   *List)
     74       1.1  jruoho {
     75       1.1  jruoho     UINT8                   i;
     76       1.1  jruoho     UINT8                   BitCount;
     77       1.1  jruoho 
     78       1.1  jruoho 
     79       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
     80       1.1  jruoho 
     81       1.1  jruoho 
     82       1.1  jruoho     /* Decode the mask bits */
     83       1.1  jruoho 
     84       1.1  jruoho     for (i = 0, BitCount = 0; Mask; i++)
     85       1.1  jruoho     {
     86       1.1  jruoho         if (Mask & 0x0001)
     87       1.1  jruoho         {
     88       1.1  jruoho             List[BitCount] = i;
     89       1.1  jruoho             BitCount++;
     90       1.1  jruoho         }
     91       1.1  jruoho 
     92       1.1  jruoho         Mask >>= 1;
     93       1.1  jruoho     }
     94       1.1  jruoho 
     95       1.1  jruoho     return (BitCount);
     96       1.1  jruoho }
     97       1.1  jruoho 
     98       1.1  jruoho 
     99       1.1  jruoho /*******************************************************************************
    100       1.1  jruoho  *
    101       1.1  jruoho  * FUNCTION:    AcpiRsEncodeBitmask
    102       1.1  jruoho  *
    103       1.1  jruoho  * PARAMETERS:  List            - List of values to encode
    104       1.1  jruoho  *              Count           - Length of list
    105       1.1  jruoho  *
    106       1.1  jruoho  * RETURN:      Encoded bitmask
    107       1.1  jruoho  *
    108       1.1  jruoho  * DESCRIPTION: Convert a list of values to an encoded bitmask
    109       1.1  jruoho  *
    110       1.1  jruoho  ******************************************************************************/
    111       1.1  jruoho 
    112       1.1  jruoho UINT16
    113       1.1  jruoho AcpiRsEncodeBitmask (
    114       1.1  jruoho     UINT8                   *List,
    115       1.1  jruoho     UINT8                   Count)
    116       1.1  jruoho {
    117       1.1  jruoho     UINT32                  i;
    118       1.1  jruoho     UINT16                  Mask;
    119       1.1  jruoho 
    120       1.1  jruoho 
    121       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    122       1.1  jruoho 
    123       1.1  jruoho 
    124       1.1  jruoho     /* Encode the list into a single bitmask */
    125       1.1  jruoho 
    126       1.1  jruoho     for (i = 0, Mask = 0; i < Count; i++)
    127       1.1  jruoho     {
    128       1.1  jruoho         Mask |= (0x1 << List[i]);
    129       1.1  jruoho     }
    130       1.1  jruoho 
    131       1.1  jruoho     return (Mask);
    132       1.1  jruoho }
    133       1.1  jruoho 
    134       1.1  jruoho 
    135       1.1  jruoho /*******************************************************************************
    136       1.1  jruoho  *
    137       1.1  jruoho  * FUNCTION:    AcpiRsMoveData
    138       1.1  jruoho  *
    139       1.1  jruoho  * PARAMETERS:  Destination         - Pointer to the destination descriptor
    140       1.1  jruoho  *              Source              - Pointer to the source descriptor
    141       1.1  jruoho  *              ItemCount           - How many items to move
    142       1.1  jruoho  *              MoveType            - Byte width
    143       1.1  jruoho  *
    144       1.1  jruoho  * RETURN:      None
    145       1.1  jruoho  *
    146       1.1  jruoho  * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
    147       1.1  jruoho  *              alignment issues and endian issues if necessary, as configured
    148       1.1  jruoho  *              via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
    149       1.1  jruoho  *
    150       1.1  jruoho  ******************************************************************************/
    151       1.1  jruoho 
    152       1.1  jruoho void
    153       1.1  jruoho AcpiRsMoveData (
    154       1.1  jruoho     void                    *Destination,
    155       1.1  jruoho     void                    *Source,
    156       1.1  jruoho     UINT16                  ItemCount,
    157       1.1  jruoho     UINT8                   MoveType)
    158       1.1  jruoho {
    159       1.1  jruoho     UINT32                  i;
    160       1.1  jruoho 
    161       1.1  jruoho 
    162       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    163       1.1  jruoho 
    164       1.1  jruoho 
    165       1.1  jruoho     /* One move per item */
    166       1.1  jruoho 
    167       1.1  jruoho     for (i = 0; i < ItemCount; i++)
    168       1.1  jruoho     {
    169       1.1  jruoho         switch (MoveType)
    170       1.1  jruoho         {
    171       1.1  jruoho         /*
    172       1.1  jruoho          * For the 8-bit case, we can perform the move all at once
    173       1.1  jruoho          * since there are no alignment or endian issues
    174       1.1  jruoho          */
    175       1.1  jruoho         case ACPI_RSC_MOVE8:
    176  1.3.10.1    yamt         case ACPI_RSC_MOVE_GPIO_RES:
    177  1.3.10.1    yamt         case ACPI_RSC_MOVE_SERIAL_VEN:
    178  1.3.10.1    yamt         case ACPI_RSC_MOVE_SERIAL_RES:
    179  1.3.10.1    yamt 
    180       1.1  jruoho             ACPI_MEMCPY (Destination, Source, ItemCount);
    181       1.1  jruoho             return;
    182       1.1  jruoho 
    183       1.1  jruoho         /*
    184       1.1  jruoho          * 16-, 32-, and 64-bit cases must use the move macros that perform
    185  1.3.10.1    yamt          * endian conversion and/or accommodate hardware that cannot perform
    186       1.1  jruoho          * misaligned memory transfers
    187       1.1  jruoho          */
    188       1.1  jruoho         case ACPI_RSC_MOVE16:
    189  1.3.10.1    yamt         case ACPI_RSC_MOVE_GPIO_PIN:
    190  1.3.10.1    yamt 
    191       1.1  jruoho             ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
    192       1.1  jruoho                                 &ACPI_CAST_PTR (UINT16, Source)[i]);
    193       1.1  jruoho             break;
    194       1.1  jruoho 
    195       1.1  jruoho         case ACPI_RSC_MOVE32:
    196  1.3.10.1    yamt 
    197       1.1  jruoho             ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
    198       1.1  jruoho                                 &ACPI_CAST_PTR (UINT32, Source)[i]);
    199       1.1  jruoho             break;
    200       1.1  jruoho 
    201       1.1  jruoho         case ACPI_RSC_MOVE64:
    202  1.3.10.1    yamt 
    203       1.1  jruoho             ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
    204       1.1  jruoho                                 &ACPI_CAST_PTR (UINT64, Source)[i]);
    205       1.1  jruoho             break;
    206       1.1  jruoho 
    207       1.1  jruoho         default:
    208  1.3.10.1    yamt 
    209       1.1  jruoho             return;
    210       1.1  jruoho         }
    211       1.1  jruoho     }
    212       1.1  jruoho }
    213       1.1  jruoho 
    214       1.1  jruoho 
    215       1.1  jruoho /*******************************************************************************
    216       1.1  jruoho  *
    217       1.1  jruoho  * FUNCTION:    AcpiRsSetResourceLength
    218       1.1  jruoho  *
    219       1.1  jruoho  * PARAMETERS:  TotalLength         - Length of the AML descriptor, including
    220       1.1  jruoho  *                                    the header and length fields.
    221       1.1  jruoho  *              Aml                 - Pointer to the raw AML descriptor
    222       1.1  jruoho  *
    223       1.1  jruoho  * RETURN:      None
    224       1.1  jruoho  *
    225       1.1  jruoho  * DESCRIPTION: Set the ResourceLength field of an AML
    226       1.1  jruoho  *              resource descriptor, both Large and Small descriptors are
    227       1.1  jruoho  *              supported automatically. Note: Descriptor Type field must
    228       1.1  jruoho  *              be valid.
    229       1.1  jruoho  *
    230       1.1  jruoho  ******************************************************************************/
    231       1.1  jruoho 
    232       1.1  jruoho void
    233       1.1  jruoho AcpiRsSetResourceLength (
    234       1.1  jruoho     ACPI_RSDESC_SIZE        TotalLength,
    235       1.1  jruoho     AML_RESOURCE            *Aml)
    236       1.1  jruoho {
    237       1.1  jruoho     ACPI_RS_LENGTH          ResourceLength;
    238       1.1  jruoho 
    239       1.1  jruoho 
    240       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    241       1.1  jruoho 
    242       1.1  jruoho 
    243       1.1  jruoho     /* Length is the total descriptor length minus the header length */
    244       1.1  jruoho 
    245       1.1  jruoho     ResourceLength = (ACPI_RS_LENGTH)
    246       1.1  jruoho         (TotalLength - AcpiUtGetResourceHeaderLength (Aml));
    247       1.1  jruoho 
    248       1.1  jruoho     /* Length is stored differently for large and small descriptors */
    249       1.1  jruoho 
    250       1.1  jruoho     if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
    251       1.1  jruoho     {
    252       1.1  jruoho         /* Large descriptor -- bytes 1-2 contain the 16-bit length */
    253       1.1  jruoho 
    254       1.1  jruoho         ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength);
    255       1.1  jruoho     }
    256       1.1  jruoho     else
    257       1.1  jruoho     {
    258       1.1  jruoho         /* Small descriptor -- bits 2:0 of byte 0 contain the length */
    259       1.1  jruoho 
    260       1.1  jruoho         Aml->SmallHeader.DescriptorType = (UINT8)
    261       1.1  jruoho 
    262       1.1  jruoho             /* Clear any existing length, preserving descriptor type bits */
    263       1.1  jruoho 
    264       1.1  jruoho             ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
    265       1.1  jruoho 
    266       1.1  jruoho             | ResourceLength);
    267       1.1  jruoho     }
    268       1.1  jruoho }
    269       1.1  jruoho 
    270       1.1  jruoho 
    271       1.1  jruoho /*******************************************************************************
    272       1.1  jruoho  *
    273       1.1  jruoho  * FUNCTION:    AcpiRsSetResourceHeader
    274       1.1  jruoho  *
    275       1.1  jruoho  * PARAMETERS:  DescriptorType      - Byte to be inserted as the type
    276       1.1  jruoho  *              TotalLength         - Length of the AML descriptor, including
    277       1.1  jruoho  *                                    the header and length fields.
    278       1.1  jruoho  *              Aml                 - Pointer to the raw AML descriptor
    279       1.1  jruoho  *
    280       1.1  jruoho  * RETURN:      None
    281       1.1  jruoho  *
    282       1.1  jruoho  * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML
    283       1.1  jruoho  *              resource descriptor, both Large and Small descriptors are
    284       1.1  jruoho  *              supported automatically
    285       1.1  jruoho  *
    286       1.1  jruoho  ******************************************************************************/
    287       1.1  jruoho 
    288       1.1  jruoho void
    289       1.1  jruoho AcpiRsSetResourceHeader (
    290       1.1  jruoho     UINT8                   DescriptorType,
    291       1.1  jruoho     ACPI_RSDESC_SIZE        TotalLength,
    292       1.1  jruoho     AML_RESOURCE            *Aml)
    293       1.1  jruoho {
    294       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    295       1.1  jruoho 
    296       1.1  jruoho 
    297       1.1  jruoho     /* Set the Resource Type */
    298       1.1  jruoho 
    299       1.1  jruoho     Aml->SmallHeader.DescriptorType = DescriptorType;
    300       1.1  jruoho 
    301       1.1  jruoho     /* Set the Resource Length */
    302       1.1  jruoho 
    303       1.1  jruoho     AcpiRsSetResourceLength (TotalLength, Aml);
    304       1.1  jruoho }
    305       1.1  jruoho 
    306       1.1  jruoho 
    307       1.1  jruoho /*******************************************************************************
    308       1.1  jruoho  *
    309       1.1  jruoho  * FUNCTION:    AcpiRsStrcpy
    310       1.1  jruoho  *
    311       1.1  jruoho  * PARAMETERS:  Destination         - Pointer to the destination string
    312       1.1  jruoho  *              Source              - Pointer to the source string
    313       1.1  jruoho  *
    314       1.1  jruoho  * RETURN:      String length, including NULL terminator
    315       1.1  jruoho  *
    316       1.1  jruoho  * DESCRIPTION: Local string copy that returns the string length, saving a
    317       1.1  jruoho  *              strcpy followed by a strlen.
    318       1.1  jruoho  *
    319       1.1  jruoho  ******************************************************************************/
    320       1.1  jruoho 
    321       1.1  jruoho static UINT16
    322       1.1  jruoho AcpiRsStrcpy (
    323       1.1  jruoho     char                    *Destination,
    324       1.1  jruoho     char                    *Source)
    325       1.1  jruoho {
    326       1.1  jruoho     UINT16                  i;
    327       1.1  jruoho 
    328       1.1  jruoho 
    329       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    330       1.1  jruoho 
    331       1.1  jruoho 
    332       1.1  jruoho     for (i = 0; Source[i]; i++)
    333       1.1  jruoho     {
    334       1.1  jruoho         Destination[i] = Source[i];
    335       1.1  jruoho     }
    336       1.1  jruoho 
    337       1.1  jruoho     Destination[i] = 0;
    338       1.1  jruoho 
    339       1.1  jruoho     /* Return string length including the NULL terminator */
    340       1.1  jruoho 
    341       1.1  jruoho     return ((UINT16) (i + 1));
    342       1.1  jruoho }
    343       1.1  jruoho 
    344       1.1  jruoho 
    345       1.1  jruoho /*******************************************************************************
    346       1.1  jruoho  *
    347       1.1  jruoho  * FUNCTION:    AcpiRsGetResourceSource
    348       1.1  jruoho  *
    349       1.1  jruoho  * PARAMETERS:  ResourceLength      - Length field of the descriptor
    350       1.1  jruoho  *              MinimumLength       - Minimum length of the descriptor (minus
    351       1.1  jruoho  *                                    any optional fields)
    352       1.1  jruoho  *              ResourceSource      - Where the ResourceSource is returned
    353       1.1  jruoho  *              Aml                 - Pointer to the raw AML descriptor
    354       1.1  jruoho  *              StringPtr           - (optional) where to store the actual
    355       1.1  jruoho  *                                    ResourceSource string
    356       1.1  jruoho  *
    357       1.1  jruoho  * RETURN:      Length of the string plus NULL terminator, rounded up to native
    358       1.1  jruoho  *              word boundary
    359       1.1  jruoho  *
    360       1.1  jruoho  * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor
    361       1.1  jruoho  *              to an internal resource descriptor
    362       1.1  jruoho  *
    363       1.1  jruoho  ******************************************************************************/
    364       1.1  jruoho 
    365       1.1  jruoho ACPI_RS_LENGTH
    366       1.1  jruoho AcpiRsGetResourceSource (
    367       1.1  jruoho     ACPI_RS_LENGTH          ResourceLength,
    368       1.1  jruoho     ACPI_RS_LENGTH          MinimumLength,
    369       1.1  jruoho     ACPI_RESOURCE_SOURCE    *ResourceSource,
    370       1.1  jruoho     AML_RESOURCE            *Aml,
    371       1.1  jruoho     char                    *StringPtr)
    372       1.1  jruoho {
    373       1.1  jruoho     ACPI_RSDESC_SIZE        TotalLength;
    374       1.1  jruoho     UINT8                   *AmlResourceSource;
    375       1.1  jruoho 
    376       1.1  jruoho 
    377       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    378       1.1  jruoho 
    379       1.1  jruoho 
    380       1.1  jruoho     TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
    381       1.1  jruoho     AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
    382       1.1  jruoho 
    383       1.1  jruoho     /*
    384       1.1  jruoho      * ResourceSource is present if the length of the descriptor is longer than
    385       1.1  jruoho      * the minimum length.
    386       1.1  jruoho      *
    387       1.1  jruoho      * Note: Some resource descriptors will have an additional null, so
    388       1.1  jruoho      * we add 1 to the minimum length.
    389       1.1  jruoho      */
    390       1.1  jruoho     if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
    391       1.1  jruoho     {
    392       1.1  jruoho         /* Get the ResourceSourceIndex */
    393       1.1  jruoho 
    394       1.1  jruoho         ResourceSource->Index = AmlResourceSource[0];
    395       1.1  jruoho 
    396       1.1  jruoho         ResourceSource->StringPtr = StringPtr;
    397       1.1  jruoho         if (!StringPtr)
    398       1.1  jruoho         {
    399       1.1  jruoho             /*
    400       1.1  jruoho              * String destination pointer is not specified; Set the String
    401       1.1  jruoho              * pointer to the end of the current ResourceSource structure.
    402       1.1  jruoho              */
    403       1.1  jruoho             ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
    404       1.1  jruoho                 sizeof (ACPI_RESOURCE_SOURCE));
    405       1.1  jruoho         }
    406       1.1  jruoho 
    407       1.1  jruoho         /*
    408       1.1  jruoho          * In order for the Resource length to be a multiple of the native
    409       1.1  jruoho          * word, calculate the length of the string (+1 for NULL terminator)
    410       1.1  jruoho          * and expand to the next word multiple.
    411       1.1  jruoho          *
    412       1.1  jruoho          * Zero the entire area of the buffer.
    413       1.1  jruoho          */
    414       1.1  jruoho         TotalLength = (UINT32) ACPI_STRLEN (
    415       1.1  jruoho             ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
    416       1.1  jruoho         TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
    417       1.1  jruoho 
    418       1.1  jruoho         ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
    419       1.1  jruoho 
    420       1.1  jruoho         /* Copy the ResourceSource string to the destination */
    421       1.1  jruoho 
    422       1.1  jruoho         ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
    423       1.1  jruoho             ACPI_CAST_PTR (char, &AmlResourceSource[1]));
    424       1.1  jruoho 
    425       1.1  jruoho         return ((ACPI_RS_LENGTH) TotalLength);
    426       1.1  jruoho     }
    427       1.1  jruoho 
    428       1.1  jruoho     /* ResourceSource is not present */
    429       1.1  jruoho 
    430       1.1  jruoho     ResourceSource->Index = 0;
    431       1.1  jruoho     ResourceSource->StringLength = 0;
    432       1.1  jruoho     ResourceSource->StringPtr = NULL;
    433       1.1  jruoho     return (0);
    434       1.1  jruoho }
    435       1.1  jruoho 
    436       1.1  jruoho 
    437       1.1  jruoho /*******************************************************************************
    438       1.1  jruoho  *
    439       1.1  jruoho  * FUNCTION:    AcpiRsSetResourceSource
    440       1.1  jruoho  *
    441       1.1  jruoho  * PARAMETERS:  Aml                 - Pointer to the raw AML descriptor
    442       1.1  jruoho  *              MinimumLength       - Minimum length of the descriptor (minus
    443       1.1  jruoho  *                                    any optional fields)
    444       1.1  jruoho  *              ResourceSource      - Internal ResourceSource
    445       1.1  jruoho 
    446       1.1  jruoho  *
    447       1.1  jruoho  * RETURN:      Total length of the AML descriptor
    448       1.1  jruoho  *
    449       1.1  jruoho  * DESCRIPTION: Convert an optional ResourceSource from internal format to a
    450       1.1  jruoho  *              raw AML resource descriptor
    451       1.1  jruoho  *
    452       1.1  jruoho  ******************************************************************************/
    453       1.1  jruoho 
    454       1.1  jruoho ACPI_RSDESC_SIZE
    455       1.1  jruoho AcpiRsSetResourceSource (
    456       1.1  jruoho     AML_RESOURCE            *Aml,
    457       1.1  jruoho     ACPI_RS_LENGTH          MinimumLength,
    458       1.1  jruoho     ACPI_RESOURCE_SOURCE    *ResourceSource)
    459       1.1  jruoho {
    460       1.1  jruoho     UINT8                   *AmlResourceSource;
    461       1.1  jruoho     ACPI_RSDESC_SIZE        DescriptorLength;
    462       1.1  jruoho 
    463       1.1  jruoho 
    464       1.1  jruoho     ACPI_FUNCTION_ENTRY ();
    465       1.1  jruoho 
    466       1.1  jruoho 
    467       1.1  jruoho     DescriptorLength = MinimumLength;
    468       1.1  jruoho 
    469       1.1  jruoho     /* Non-zero string length indicates presence of a ResourceSource */
    470       1.1  jruoho 
    471       1.1  jruoho     if (ResourceSource->StringLength)
    472       1.1  jruoho     {
    473       1.1  jruoho         /* Point to the end of the AML descriptor */
    474       1.1  jruoho 
    475       1.1  jruoho         AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
    476       1.1  jruoho 
    477       1.1  jruoho         /* Copy the ResourceSourceIndex */
    478       1.1  jruoho 
    479       1.1  jruoho         AmlResourceSource[0] = (UINT8) ResourceSource->Index;
    480       1.1  jruoho 
    481       1.1  jruoho         /* Copy the ResourceSource string */
    482       1.1  jruoho 
    483       1.1  jruoho         ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
    484       1.1  jruoho             ResourceSource->StringPtr);
    485       1.1  jruoho 
    486       1.1  jruoho         /*
    487       1.1  jruoho          * Add the length of the string (+ 1 for null terminator) to the
    488       1.1  jruoho          * final descriptor length
    489       1.1  jruoho          */
    490       1.1  jruoho         DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1);
    491       1.1  jruoho     }
    492       1.1  jruoho 
    493       1.1  jruoho     /* Return the new total length of the AML descriptor */
    494       1.1  jruoho 
    495       1.1  jruoho     return (DescriptorLength);
    496       1.1  jruoho }
    497       1.1  jruoho 
    498       1.1  jruoho 
    499       1.1  jruoho /*******************************************************************************
    500       1.1  jruoho  *
    501       1.1  jruoho  * FUNCTION:    AcpiRsGetPrtMethodData
    502       1.1  jruoho  *
    503       1.1  jruoho  * PARAMETERS:  Node            - Device node
    504       1.1  jruoho  *              RetBuffer       - Pointer to a buffer structure for the
    505       1.1  jruoho  *                                results
    506       1.1  jruoho  *
    507       1.1  jruoho  * RETURN:      Status
    508       1.1  jruoho  *
    509       1.1  jruoho  * DESCRIPTION: This function is called to get the _PRT value of an object
    510       1.1  jruoho  *              contained in an object specified by the handle passed in
    511       1.1  jruoho  *
    512       1.1  jruoho  *              If the function fails an appropriate status will be returned
    513       1.1  jruoho  *              and the contents of the callers buffer is undefined.
    514       1.1  jruoho  *
    515       1.1  jruoho  ******************************************************************************/
    516       1.1  jruoho 
    517       1.1  jruoho ACPI_STATUS
    518       1.1  jruoho AcpiRsGetPrtMethodData (
    519       1.1  jruoho     ACPI_NAMESPACE_NODE     *Node,
    520       1.1  jruoho     ACPI_BUFFER             *RetBuffer)
    521       1.1  jruoho {
    522       1.1  jruoho     ACPI_OPERAND_OBJECT     *ObjDesc;
    523       1.1  jruoho     ACPI_STATUS             Status;
    524       1.1  jruoho 
    525       1.1  jruoho 
    526       1.1  jruoho     ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
    527       1.1  jruoho 
    528       1.1  jruoho 
    529       1.1  jruoho     /* Parameters guaranteed valid by caller */
    530       1.1  jruoho 
    531       1.1  jruoho     /* Execute the method, no parameters */
    532       1.1  jruoho 
    533       1.1  jruoho     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT,
    534       1.1  jruoho                 ACPI_BTYPE_PACKAGE, &ObjDesc);
    535       1.1  jruoho     if (ACPI_FAILURE (Status))
    536       1.1  jruoho     {
    537       1.1  jruoho         return_ACPI_STATUS (Status);
    538       1.1  jruoho     }
    539       1.1  jruoho 
    540       1.1  jruoho     /*
    541       1.1  jruoho      * Create a resource linked list from the byte stream buffer that comes
    542       1.1  jruoho      * back from the _CRS method execution.
    543       1.1  jruoho      */
    544       1.1  jruoho     Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer);
    545       1.1  jruoho 
    546       1.1  jruoho     /* On exit, we must delete the object returned by EvaluateObject */
    547       1.1  jruoho 
    548       1.1  jruoho     AcpiUtRemoveReference (ObjDesc);
    549       1.1  jruoho     return_ACPI_STATUS (Status);
    550       1.1  jruoho }
    551       1.1  jruoho 
    552       1.1  jruoho 
    553       1.1  jruoho /*******************************************************************************
    554       1.1  jruoho  *
    555       1.1  jruoho  * FUNCTION:    AcpiRsGetCrsMethodData
    556       1.1  jruoho  *
    557       1.1  jruoho  * PARAMETERS:  Node            - Device node
    558       1.1  jruoho  *              RetBuffer       - Pointer to a buffer structure for the
    559       1.1  jruoho  *                                results
    560       1.1  jruoho  *
    561       1.1  jruoho  * RETURN:      Status
    562       1.1  jruoho  *
    563       1.1  jruoho  * DESCRIPTION: This function is called to get the _CRS value of an object
    564       1.1  jruoho  *              contained in an object specified by the handle passed in
    565       1.1  jruoho  *
    566       1.1  jruoho  *              If the function fails an appropriate status will be returned
    567       1.1  jruoho  *              and the contents of the callers buffer is undefined.
    568       1.1  jruoho  *
    569       1.1  jruoho  ******************************************************************************/
    570       1.1  jruoho 
    571       1.1  jruoho ACPI_STATUS
    572       1.1  jruoho AcpiRsGetCrsMethodData (
    573       1.1  jruoho     ACPI_NAMESPACE_NODE     *Node,
    574       1.1  jruoho     ACPI_BUFFER             *RetBuffer)
    575       1.1  jruoho {
    576       1.1  jruoho     ACPI_OPERAND_OBJECT     *ObjDesc;
    577       1.1  jruoho     ACPI_STATUS             Status;
    578       1.1  jruoho 
    579       1.1  jruoho 
    580       1.1  jruoho     ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
    581       1.1  jruoho 
    582       1.1  jruoho 
    583       1.1  jruoho     /* Parameters guaranteed valid by caller */
    584       1.1  jruoho 
    585       1.1  jruoho     /* Execute the method, no parameters */
    586       1.1  jruoho 
    587       1.1  jruoho     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS,
    588       1.1  jruoho                 ACPI_BTYPE_BUFFER, &ObjDesc);
    589       1.1  jruoho     if (ACPI_FAILURE (Status))
    590       1.1  jruoho     {
    591       1.1  jruoho         return_ACPI_STATUS (Status);
    592       1.1  jruoho     }
    593       1.1  jruoho 
    594       1.1  jruoho     /*
    595       1.1  jruoho      * Make the call to create a resource linked list from the
    596       1.1  jruoho      * byte stream buffer that comes back from the _CRS method
    597       1.1  jruoho      * execution.
    598       1.1  jruoho      */
    599       1.1  jruoho     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
    600       1.1  jruoho 
    601       1.1  jruoho     /* On exit, we must delete the object returned by evaluateObject */
    602       1.1  jruoho 
    603       1.1  jruoho     AcpiUtRemoveReference (ObjDesc);
    604       1.1  jruoho     return_ACPI_STATUS (Status);
    605       1.1  jruoho }
    606       1.1  jruoho 
    607       1.1  jruoho 
    608       1.1  jruoho /*******************************************************************************
    609       1.1  jruoho  *
    610       1.1  jruoho  * FUNCTION:    AcpiRsGetPrsMethodData
    611       1.1  jruoho  *
    612       1.1  jruoho  * PARAMETERS:  Node            - Device node
    613       1.1  jruoho  *              RetBuffer       - Pointer to a buffer structure for the
    614       1.1  jruoho  *                                results
    615       1.1  jruoho  *
    616       1.1  jruoho  * RETURN:      Status
    617       1.1  jruoho  *
    618       1.1  jruoho  * DESCRIPTION: This function is called to get the _PRS value of an object
    619       1.1  jruoho  *              contained in an object specified by the handle passed in
    620       1.1  jruoho  *
    621       1.1  jruoho  *              If the function fails an appropriate status will be returned
    622       1.1  jruoho  *              and the contents of the callers buffer is undefined.
    623       1.1  jruoho  *
    624       1.1  jruoho  ******************************************************************************/
    625       1.1  jruoho 
    626       1.1  jruoho ACPI_STATUS
    627       1.1  jruoho AcpiRsGetPrsMethodData (
    628       1.1  jruoho     ACPI_NAMESPACE_NODE     *Node,
    629       1.1  jruoho     ACPI_BUFFER             *RetBuffer)
    630       1.1  jruoho {
    631       1.1  jruoho     ACPI_OPERAND_OBJECT     *ObjDesc;
    632       1.1  jruoho     ACPI_STATUS             Status;
    633       1.1  jruoho 
    634       1.1  jruoho 
    635       1.1  jruoho     ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
    636       1.1  jruoho 
    637       1.1  jruoho 
    638       1.1  jruoho     /* Parameters guaranteed valid by caller */
    639       1.1  jruoho 
    640       1.1  jruoho     /* Execute the method, no parameters */
    641       1.1  jruoho 
    642       1.1  jruoho     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS,
    643       1.1  jruoho                 ACPI_BTYPE_BUFFER, &ObjDesc);
    644       1.1  jruoho     if (ACPI_FAILURE (Status))
    645       1.1  jruoho     {
    646       1.1  jruoho         return_ACPI_STATUS (Status);
    647       1.1  jruoho     }
    648       1.1  jruoho 
    649       1.1  jruoho     /*
    650       1.1  jruoho      * Make the call to create a resource linked list from the
    651       1.1  jruoho      * byte stream buffer that comes back from the _CRS method
    652       1.1  jruoho      * execution.
    653       1.1  jruoho      */
    654       1.1  jruoho     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
    655       1.1  jruoho 
    656       1.1  jruoho     /* On exit, we must delete the object returned by evaluateObject */
    657       1.1  jruoho 
    658       1.1  jruoho     AcpiUtRemoveReference (ObjDesc);
    659       1.1  jruoho     return_ACPI_STATUS (Status);
    660       1.1  jruoho }
    661       1.1  jruoho 
    662       1.1  jruoho 
    663       1.1  jruoho /*******************************************************************************
    664       1.1  jruoho  *
    665  1.3.10.1    yamt  * FUNCTION:    AcpiRsGetAeiMethodData
    666  1.3.10.1    yamt  *
    667  1.3.10.1    yamt  * PARAMETERS:  Node            - Device node
    668  1.3.10.1    yamt  *              RetBuffer       - Pointer to a buffer structure for the
    669  1.3.10.1    yamt  *                                results
    670  1.3.10.1    yamt  *
    671  1.3.10.1    yamt  * RETURN:      Status
    672  1.3.10.1    yamt  *
    673  1.3.10.1    yamt  * DESCRIPTION: This function is called to get the _AEI value of an object
    674  1.3.10.1    yamt  *              contained in an object specified by the handle passed in
    675  1.3.10.1    yamt  *
    676  1.3.10.1    yamt  *              If the function fails an appropriate status will be returned
    677  1.3.10.1    yamt  *              and the contents of the callers buffer is undefined.
    678  1.3.10.1    yamt  *
    679  1.3.10.1    yamt  ******************************************************************************/
    680  1.3.10.1    yamt 
    681  1.3.10.1    yamt ACPI_STATUS
    682  1.3.10.1    yamt AcpiRsGetAeiMethodData (
    683  1.3.10.1    yamt     ACPI_NAMESPACE_NODE     *Node,
    684  1.3.10.1    yamt     ACPI_BUFFER             *RetBuffer)
    685  1.3.10.1    yamt {
    686  1.3.10.1    yamt     ACPI_OPERAND_OBJECT     *ObjDesc;
    687  1.3.10.1    yamt     ACPI_STATUS             Status;
    688  1.3.10.1    yamt 
    689  1.3.10.1    yamt 
    690  1.3.10.1    yamt     ACPI_FUNCTION_TRACE (RsGetAeiMethodData);
    691  1.3.10.1    yamt 
    692  1.3.10.1    yamt 
    693  1.3.10.1    yamt     /* Parameters guaranteed valid by caller */
    694  1.3.10.1    yamt 
    695  1.3.10.1    yamt     /* Execute the method, no parameters */
    696  1.3.10.1    yamt 
    697  1.3.10.1    yamt     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI,
    698  1.3.10.1    yamt                 ACPI_BTYPE_BUFFER, &ObjDesc);
    699  1.3.10.1    yamt     if (ACPI_FAILURE (Status))
    700  1.3.10.1    yamt     {
    701  1.3.10.1    yamt         return_ACPI_STATUS (Status);
    702  1.3.10.1    yamt     }
    703  1.3.10.1    yamt 
    704  1.3.10.1    yamt     /*
    705  1.3.10.1    yamt      * Make the call to create a resource linked list from the
    706  1.3.10.1    yamt      * byte stream buffer that comes back from the _CRS method
    707  1.3.10.1    yamt      * execution.
    708  1.3.10.1    yamt      */
    709  1.3.10.1    yamt     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
    710  1.3.10.1    yamt 
    711  1.3.10.1    yamt     /* On exit, we must delete the object returned by evaluateObject */
    712  1.3.10.1    yamt 
    713  1.3.10.1    yamt     AcpiUtRemoveReference (ObjDesc);
    714  1.3.10.1    yamt     return_ACPI_STATUS (Status);
    715  1.3.10.1    yamt }
    716  1.3.10.1    yamt 
    717  1.3.10.1    yamt 
    718  1.3.10.1    yamt /*******************************************************************************
    719  1.3.10.1    yamt  *
    720       1.1  jruoho  * FUNCTION:    AcpiRsGetMethodData
    721       1.1  jruoho  *
    722       1.1  jruoho  * PARAMETERS:  Handle          - Handle to the containing object
    723       1.1  jruoho  *              Path            - Path to method, relative to Handle
    724       1.1  jruoho  *              RetBuffer       - Pointer to a buffer structure for the
    725       1.1  jruoho  *                                results
    726       1.1  jruoho  *
    727       1.1  jruoho  * RETURN:      Status
    728       1.1  jruoho  *
    729       1.1  jruoho  * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
    730       1.1  jruoho  *              object contained in an object specified by the handle passed in
    731       1.1  jruoho  *
    732       1.1  jruoho  *              If the function fails an appropriate status will be returned
    733       1.1  jruoho  *              and the contents of the callers buffer is undefined.
    734       1.1  jruoho  *
    735       1.1  jruoho  ******************************************************************************/
    736       1.1  jruoho 
    737       1.1  jruoho ACPI_STATUS
    738       1.1  jruoho AcpiRsGetMethodData (
    739       1.1  jruoho     ACPI_HANDLE             Handle,
    740       1.1  jruoho     char                    *Path,
    741       1.1  jruoho     ACPI_BUFFER             *RetBuffer)
    742       1.1  jruoho {
    743       1.1  jruoho     ACPI_OPERAND_OBJECT     *ObjDesc;
    744       1.1  jruoho     ACPI_STATUS             Status;
    745       1.1  jruoho 
    746       1.1  jruoho 
    747       1.1  jruoho     ACPI_FUNCTION_TRACE (RsGetMethodData);
    748       1.1  jruoho 
    749       1.1  jruoho 
    750       1.1  jruoho     /* Parameters guaranteed valid by caller */
    751       1.1  jruoho 
    752       1.1  jruoho     /* Execute the method, no parameters */
    753       1.1  jruoho 
    754  1.3.10.1    yamt     Status = AcpiUtEvaluateObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle),
    755  1.3.10.1    yamt         Path, ACPI_BTYPE_BUFFER, &ObjDesc);
    756       1.1  jruoho     if (ACPI_FAILURE (Status))
    757       1.1  jruoho     {
    758       1.1  jruoho         return_ACPI_STATUS (Status);
    759       1.1  jruoho     }
    760       1.1  jruoho 
    761       1.1  jruoho     /*
    762       1.1  jruoho      * Make the call to create a resource linked list from the
    763       1.1  jruoho      * byte stream buffer that comes back from the method
    764       1.1  jruoho      * execution.
    765       1.1  jruoho      */
    766       1.1  jruoho     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
    767       1.1  jruoho 
    768       1.1  jruoho     /* On exit, we must delete the object returned by EvaluateObject */
    769       1.1  jruoho 
    770       1.1  jruoho     AcpiUtRemoveReference (ObjDesc);
    771       1.1  jruoho     return_ACPI_STATUS (Status);
    772       1.1  jruoho }
    773       1.1  jruoho 
    774       1.1  jruoho 
    775       1.1  jruoho /*******************************************************************************
    776       1.1  jruoho  *
    777       1.1  jruoho  * FUNCTION:    AcpiRsSetSrsMethodData
    778       1.1  jruoho  *
    779       1.1  jruoho  * PARAMETERS:  Node            - Device node
    780       1.1  jruoho  *              InBuffer        - Pointer to a buffer structure of the
    781       1.1  jruoho  *                                parameter
    782       1.1  jruoho  *
    783       1.1  jruoho  * RETURN:      Status
    784       1.1  jruoho  *
    785       1.1  jruoho  * DESCRIPTION: This function is called to set the _SRS of an object contained
    786       1.1  jruoho  *              in an object specified by the handle passed in
    787       1.1  jruoho  *
    788       1.1  jruoho  *              If the function fails an appropriate status will be returned
    789       1.1  jruoho  *              and the contents of the callers buffer is undefined.
    790       1.1  jruoho  *
    791       1.1  jruoho  * Note: Parameters guaranteed valid by caller
    792       1.1  jruoho  *
    793       1.1  jruoho  ******************************************************************************/
    794       1.1  jruoho 
    795       1.1  jruoho ACPI_STATUS
    796       1.1  jruoho AcpiRsSetSrsMethodData (
    797       1.1  jruoho     ACPI_NAMESPACE_NODE     *Node,
    798       1.1  jruoho     ACPI_BUFFER             *InBuffer)
    799       1.1  jruoho {
    800       1.1  jruoho     ACPI_EVALUATE_INFO      *Info;
    801       1.1  jruoho     ACPI_OPERAND_OBJECT     *Args[2];
    802       1.1  jruoho     ACPI_STATUS             Status;
    803       1.1  jruoho     ACPI_BUFFER             Buffer;
    804       1.1  jruoho 
    805       1.1  jruoho 
    806       1.1  jruoho     ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
    807       1.1  jruoho 
    808       1.1  jruoho 
    809       1.1  jruoho     /* Allocate and initialize the evaluation information block */
    810       1.1  jruoho 
    811       1.1  jruoho     Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
    812       1.1  jruoho     if (!Info)
    813       1.1  jruoho     {
    814       1.1  jruoho         return_ACPI_STATUS (AE_NO_MEMORY);
    815       1.1  jruoho     }
    816       1.1  jruoho 
    817       1.1  jruoho     Info->PrefixNode = Node;
    818  1.3.10.1    yamt     Info->RelativePathname = __UNCONST(METHOD_NAME__SRS);
    819       1.1  jruoho     Info->Parameters = Args;
    820       1.1  jruoho     Info->Flags = ACPI_IGNORE_RETURN_VALUE;
    821       1.1  jruoho 
    822       1.1  jruoho     /*
    823       1.1  jruoho      * The InBuffer parameter will point to a linked list of
    824       1.1  jruoho      * resource parameters. It needs to be formatted into a
    825       1.1  jruoho      * byte stream to be sent in as an input parameter to _SRS
    826       1.1  jruoho      *
    827       1.1  jruoho      * Convert the linked list into a byte stream
    828       1.1  jruoho      */
    829       1.1  jruoho     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    830  1.3.10.1    yamt     Status = AcpiRsCreateAmlResources (InBuffer, &Buffer);
    831       1.1  jruoho     if (ACPI_FAILURE (Status))
    832       1.1  jruoho     {
    833       1.1  jruoho         goto Cleanup;
    834       1.1  jruoho     }
    835       1.1  jruoho 
    836       1.1  jruoho     /* Create and initialize the method parameter object */
    837       1.1  jruoho 
    838       1.1  jruoho     Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
    839       1.1  jruoho     if (!Args[0])
    840       1.1  jruoho     {
    841       1.1  jruoho         /*
    842       1.1  jruoho          * Must free the buffer allocated above (otherwise it is freed
    843       1.1  jruoho          * later)
    844       1.1  jruoho          */
    845       1.1  jruoho         ACPI_FREE (Buffer.Pointer);
    846       1.1  jruoho         Status = AE_NO_MEMORY;
    847       1.1  jruoho         goto Cleanup;
    848       1.1  jruoho     }
    849       1.1  jruoho 
    850       1.1  jruoho     Args[0]->Buffer.Length  = (UINT32) Buffer.Length;
    851       1.1  jruoho     Args[0]->Buffer.Pointer = Buffer.Pointer;
    852       1.1  jruoho     Args[0]->Common.Flags   = AOPOBJ_DATA_VALID;
    853       1.1  jruoho     Args[1] = NULL;
    854       1.1  jruoho 
    855       1.1  jruoho     /* Execute the method, no return value is expected */
    856       1.1  jruoho 
    857       1.1  jruoho     Status = AcpiNsEvaluate (Info);
    858       1.1  jruoho 
    859       1.1  jruoho     /* Clean up and return the status from AcpiNsEvaluate */
    860       1.1  jruoho 
    861       1.1  jruoho     AcpiUtRemoveReference (Args[0]);
    862       1.1  jruoho 
    863       1.1  jruoho Cleanup:
    864       1.1  jruoho     ACPI_FREE (Info);
    865       1.1  jruoho     return_ACPI_STATUS (Status);
    866       1.1  jruoho }
    867