Home | History | Annotate | Line # | Download | only in resources
rsxface.c revision 1.1.1.16
      1       1.1    jruoho /*******************************************************************************
      2       1.1    jruoho  *
      3       1.1    jruoho  * Module Name: rsxface - Public interfaces to the resource manager
      4       1.1    jruoho  *
      5       1.1    jruoho  ******************************************************************************/
      6       1.1    jruoho 
      7  1.1.1.16  christos /******************************************************************************
      8  1.1.1.16  christos  *
      9  1.1.1.16  christos  * 1. Copyright Notice
     10  1.1.1.16  christos  *
     11  1.1.1.16  christos  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
     12       1.1    jruoho  * All rights reserved.
     13       1.1    jruoho  *
     14  1.1.1.16  christos  * 2. License
     15  1.1.1.16  christos  *
     16  1.1.1.16  christos  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.1.1.16  christos  * rights. You may have additional license terms from the party that provided
     18  1.1.1.16  christos  * you this software, covering your right to use that party's intellectual
     19  1.1.1.16  christos  * property rights.
     20  1.1.1.16  christos  *
     21  1.1.1.16  christos  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.1.1.16  christos  * copy of the source code appearing in this file ("Covered Code") an
     23  1.1.1.16  christos  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.1.1.16  christos  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.1.1.16  christos  * make derivatives, distribute, use and display any portion of the Covered
     26  1.1.1.16  christos  * Code in any form, with the right to sublicense such rights; and
     27  1.1.1.16  christos  *
     28  1.1.1.16  christos  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.1.1.16  christos  * license (with the right to sublicense), under only those claims of Intel
     30  1.1.1.16  christos  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.1.1.16  christos  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.1.1.16  christos  * solely to the minimum extent necessary to exercise the above copyright
     33  1.1.1.16  christos  * license, and in no event shall the patent license extend to any additions
     34  1.1.1.16  christos  * to or modifications of the Original Intel Code. No other license or right
     35  1.1.1.16  christos  * is granted directly or by implication, estoppel or otherwise;
     36  1.1.1.16  christos  *
     37  1.1.1.16  christos  * The above copyright and patent license is granted only if the following
     38  1.1.1.16  christos  * conditions are met:
     39  1.1.1.16  christos  *
     40  1.1.1.16  christos  * 3. Conditions
     41  1.1.1.16  christos  *
     42  1.1.1.16  christos  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.1.1.16  christos  * Redistribution of source code of any substantial portion of the Covered
     44  1.1.1.16  christos  * Code or modification with rights to further distribute source must include
     45  1.1.1.16  christos  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.1.1.16  christos  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.1.1.16  christos  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.1.1.16  christos  * contain a file documenting the changes Licensee made to create that Covered
     49  1.1.1.16  christos  * Code and the date of any change. Licensee must include in that file the
     50  1.1.1.16  christos  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.1.1.16  christos  * must include a prominent statement that the modification is derived,
     52  1.1.1.16  christos  * directly or indirectly, from Original Intel Code.
     53  1.1.1.16  christos  *
     54  1.1.1.16  christos  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.1.1.16  christos  * Redistribution of source code of any substantial portion of the Covered
     56  1.1.1.16  christos  * Code or modification without rights to further distribute source must
     57  1.1.1.16  christos  * include the following Disclaimer and Export Compliance provision in the
     58  1.1.1.16  christos  * documentation and/or other materials provided with distribution. In
     59  1.1.1.16  christos  * addition, Licensee may not authorize further sublicense of source of any
     60  1.1.1.16  christos  * portion of the Covered Code, and must include terms to the effect that the
     61  1.1.1.16  christos  * license from Licensee to its licensee is limited to the intellectual
     62  1.1.1.16  christos  * property embodied in the software Licensee provides to its licensee, and
     63  1.1.1.16  christos  * not to intellectual property embodied in modifications its licensee may
     64  1.1.1.16  christos  * make.
     65  1.1.1.16  christos  *
     66  1.1.1.16  christos  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.1.1.16  christos  * substantial portion of the Covered Code or modification must reproduce the
     68  1.1.1.16  christos  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.1.1.16  christos  * provision in the documentation and/or other materials provided with the
     70  1.1.1.16  christos  * distribution.
     71  1.1.1.16  christos  *
     72  1.1.1.16  christos  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.1.1.16  christos  * Intel Code.
     74  1.1.1.16  christos  *
     75  1.1.1.16  christos  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.1.1.16  christos  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.1.1.16  christos  * other dealings in products derived from or relating to the Covered Code
     78  1.1.1.16  christos  * without prior written authorization from Intel.
     79  1.1.1.16  christos  *
     80  1.1.1.16  christos  * 4. Disclaimer and Export Compliance
     81  1.1.1.16  christos  *
     82  1.1.1.16  christos  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.1.1.16  christos  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.1.1.16  christos  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  1.1.1.16  christos  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  1.1.1.16  christos  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.1.1.16  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.1.1.16  christos  * PARTICULAR PURPOSE.
     89  1.1.1.16  christos  *
     90  1.1.1.16  christos  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.1.1.16  christos  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.1.1.16  christos  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.1.1.16  christos  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.1.1.16  christos  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.1.1.16  christos  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  1.1.1.16  christos  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.1.1.16  christos  * LIMITED REMEDY.
     98  1.1.1.16  christos  *
     99  1.1.1.16  christos  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.1.1.16  christos  * software or system incorporating such software without first obtaining any
    101  1.1.1.16  christos  * required license or other approval from the U. S. Department of Commerce or
    102  1.1.1.16  christos  * any other agency or department of the United States Government. In the
    103  1.1.1.16  christos  * event Licensee exports any such software from the United States or
    104  1.1.1.16  christos  * re-exports any such software from a foreign destination, Licensee shall
    105  1.1.1.16  christos  * ensure that the distribution and export/re-export of the software is in
    106  1.1.1.16  christos  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.1.1.16  christos  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.1.1.16  christos  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.1.1.16  christos  * software, or service, directly or indirectly, to any country for which the
    110  1.1.1.16  christos  * United States government or any agency thereof requires an export license,
    111  1.1.1.16  christos  * other governmental approval, or letter of assurance, without first obtaining
    112  1.1.1.16  christos  * such license, approval or letter.
    113  1.1.1.16  christos  *
    114  1.1.1.16  christos  *****************************************************************************
    115  1.1.1.16  christos  *
    116  1.1.1.16  christos  * Alternatively, you may choose to be licensed under the terms of the
    117  1.1.1.16  christos  * following license:
    118  1.1.1.16  christos  *
    119   1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
    120   1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
    121   1.1.1.2    jruoho  * are met:
    122   1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
    123   1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
    124   1.1.1.2    jruoho  *    without modification.
    125   1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126   1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    127   1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    128   1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
    129   1.1.1.2    jruoho  *    binary redistribution.
    130   1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    131   1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
    132   1.1.1.2    jruoho  *    from this software without specific prior written permission.
    133   1.1.1.2    jruoho  *
    134   1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135   1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136  1.1.1.13  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137   1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  1.1.1.16  christos  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  1.1.1.16  christos  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  1.1.1.16  christos  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  1.1.1.16  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  1.1.1.16  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  1.1.1.16  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  1.1.1.16  christos  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  1.1.1.16  christos  *
    146  1.1.1.16  christos  * Alternatively, you may choose to be licensed under the terms of the
    147  1.1.1.16  christos  * GNU General Public License ("GPL") version 2 as published by the Free
    148  1.1.1.16  christos  * Software Foundation.
    149  1.1.1.16  christos  *
    150  1.1.1.16  christos  *****************************************************************************/
    151       1.1    jruoho 
    152   1.1.1.3  christos #define EXPORT_ACPI_INTERFACES
    153       1.1    jruoho 
    154       1.1    jruoho #include "acpi.h"
    155       1.1    jruoho #include "accommon.h"
    156       1.1    jruoho #include "acresrc.h"
    157       1.1    jruoho #include "acnamesp.h"
    158       1.1    jruoho 
    159       1.1    jruoho #define _COMPONENT          ACPI_RESOURCES
    160       1.1    jruoho         ACPI_MODULE_NAME    ("rsxface")
    161       1.1    jruoho 
    162       1.1    jruoho /* Local macros for 16,32-bit to 64-bit conversion */
    163       1.1    jruoho 
    164       1.1    jruoho #define ACPI_COPY_FIELD(Out, In, Field)  ((Out)->Field = (In)->Field)
    165   1.1.1.7  christos #define ACPI_COPY_ADDRESS(Out, In)                       \
    166       1.1    jruoho     ACPI_COPY_FIELD(Out, In, ResourceType);              \
    167       1.1    jruoho     ACPI_COPY_FIELD(Out, In, ProducerConsumer);          \
    168       1.1    jruoho     ACPI_COPY_FIELD(Out, In, Decode);                    \
    169       1.1    jruoho     ACPI_COPY_FIELD(Out, In, MinAddressFixed);           \
    170       1.1    jruoho     ACPI_COPY_FIELD(Out, In, MaxAddressFixed);           \
    171       1.1    jruoho     ACPI_COPY_FIELD(Out, In, Info);                      \
    172   1.1.1.5  christos     ACPI_COPY_FIELD(Out, In, Address.Granularity);       \
    173   1.1.1.5  christos     ACPI_COPY_FIELD(Out, In, Address.Minimum);           \
    174   1.1.1.5  christos     ACPI_COPY_FIELD(Out, In, Address.Maximum);           \
    175   1.1.1.5  christos     ACPI_COPY_FIELD(Out, In, Address.TranslationOffset); \
    176   1.1.1.5  christos     ACPI_COPY_FIELD(Out, In, Address.AddressLength);     \
    177       1.1    jruoho     ACPI_COPY_FIELD(Out, In, ResourceSource);
    178       1.1    jruoho 
    179       1.1    jruoho 
    180       1.1    jruoho /* Local prototypes */
    181       1.1    jruoho 
    182       1.1    jruoho static ACPI_STATUS
    183       1.1    jruoho AcpiRsMatchVendorResource (
    184       1.1    jruoho     ACPI_RESOURCE           *Resource,
    185       1.1    jruoho     void                    *Context);
    186       1.1    jruoho 
    187       1.1    jruoho static ACPI_STATUS
    188       1.1    jruoho AcpiRsValidateParameters (
    189       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    190       1.1    jruoho     ACPI_BUFFER             *Buffer,
    191       1.1    jruoho     ACPI_NAMESPACE_NODE     **ReturnNode);
    192       1.1    jruoho 
    193       1.1    jruoho 
    194       1.1    jruoho /*******************************************************************************
    195       1.1    jruoho  *
    196       1.1    jruoho  * FUNCTION:    AcpiRsValidateParameters
    197       1.1    jruoho  *
    198       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle to a device
    199       1.1    jruoho  *              Buffer          - Pointer to a data buffer
    200       1.1    jruoho  *              ReturnNode      - Pointer to where the device node is returned
    201       1.1    jruoho  *
    202       1.1    jruoho  * RETURN:      Status
    203       1.1    jruoho  *
    204       1.1    jruoho  * DESCRIPTION: Common parameter validation for resource interfaces
    205       1.1    jruoho  *
    206       1.1    jruoho  ******************************************************************************/
    207       1.1    jruoho 
    208       1.1    jruoho static ACPI_STATUS
    209       1.1    jruoho AcpiRsValidateParameters (
    210       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    211       1.1    jruoho     ACPI_BUFFER             *Buffer,
    212       1.1    jruoho     ACPI_NAMESPACE_NODE     **ReturnNode)
    213       1.1    jruoho {
    214       1.1    jruoho     ACPI_STATUS             Status;
    215       1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    216       1.1    jruoho 
    217       1.1    jruoho 
    218       1.1    jruoho     ACPI_FUNCTION_TRACE (RsValidateParameters);
    219       1.1    jruoho 
    220       1.1    jruoho 
    221       1.1    jruoho     /*
    222       1.1    jruoho      * Must have a valid handle to an ACPI device
    223       1.1    jruoho      */
    224       1.1    jruoho     if (!DeviceHandle)
    225       1.1    jruoho     {
    226       1.1    jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    227       1.1    jruoho     }
    228       1.1    jruoho 
    229       1.1    jruoho     Node = AcpiNsValidateHandle (DeviceHandle);
    230       1.1    jruoho     if (!Node)
    231       1.1    jruoho     {
    232       1.1    jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    233       1.1    jruoho     }
    234       1.1    jruoho 
    235       1.1    jruoho     if (Node->Type != ACPI_TYPE_DEVICE)
    236       1.1    jruoho     {
    237       1.1    jruoho         return_ACPI_STATUS (AE_TYPE);
    238       1.1    jruoho     }
    239       1.1    jruoho 
    240       1.1    jruoho     /*
    241       1.1    jruoho      * Validate the user buffer object
    242       1.1    jruoho      *
    243       1.1    jruoho      * if there is a non-zero buffer length we also need a valid pointer in
    244       1.1    jruoho      * the buffer. If it's a zero buffer length, we'll be returning the
    245       1.1    jruoho      * needed buffer size (later), so keep going.
    246       1.1    jruoho      */
    247       1.1    jruoho     Status = AcpiUtValidateBuffer (Buffer);
    248       1.1    jruoho     if (ACPI_FAILURE (Status))
    249       1.1    jruoho     {
    250       1.1    jruoho         return_ACPI_STATUS (Status);
    251       1.1    jruoho     }
    252       1.1    jruoho 
    253       1.1    jruoho     *ReturnNode = Node;
    254       1.1    jruoho     return_ACPI_STATUS (AE_OK);
    255       1.1    jruoho }
    256       1.1    jruoho 
    257       1.1    jruoho 
    258       1.1    jruoho /*******************************************************************************
    259       1.1    jruoho  *
    260       1.1    jruoho  * FUNCTION:    AcpiGetIrqRoutingTable
    261       1.1    jruoho  *
    262       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle to the Bus device we are querying
    263       1.1    jruoho  *              RetBuffer       - Pointer to a buffer to receive the
    264       1.1    jruoho  *                                current resources for the device
    265       1.1    jruoho  *
    266       1.1    jruoho  * RETURN:      Status
    267       1.1    jruoho  *
    268       1.1    jruoho  * DESCRIPTION: This function is called to get the IRQ routing table for a
    269       1.1    jruoho  *              specific bus. The caller must first acquire a handle for the
    270       1.1    jruoho  *              desired bus. The routine table is placed in the buffer pointed
    271       1.1    jruoho  *              to by the RetBuffer variable parameter.
    272       1.1    jruoho  *
    273       1.1    jruoho  *              If the function fails an appropriate status will be returned
    274       1.1    jruoho  *              and the value of RetBuffer is undefined.
    275       1.1    jruoho  *
    276       1.1    jruoho  *              This function attempts to execute the _PRT method contained in
    277       1.1    jruoho  *              the object indicated by the passed DeviceHandle.
    278       1.1    jruoho  *
    279       1.1    jruoho  ******************************************************************************/
    280       1.1    jruoho 
    281       1.1    jruoho ACPI_STATUS
    282       1.1    jruoho AcpiGetIrqRoutingTable  (
    283       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    284       1.1    jruoho     ACPI_BUFFER             *RetBuffer)
    285       1.1    jruoho {
    286       1.1    jruoho     ACPI_STATUS             Status;
    287       1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    288       1.1    jruoho 
    289       1.1    jruoho 
    290       1.1    jruoho     ACPI_FUNCTION_TRACE (AcpiGetIrqRoutingTable);
    291       1.1    jruoho 
    292       1.1    jruoho 
    293       1.1    jruoho     /* Validate parameters then dispatch to internal routine */
    294       1.1    jruoho 
    295       1.1    jruoho     Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
    296       1.1    jruoho     if (ACPI_FAILURE (Status))
    297       1.1    jruoho     {
    298       1.1    jruoho         return_ACPI_STATUS (Status);
    299       1.1    jruoho     }
    300       1.1    jruoho 
    301       1.1    jruoho     Status = AcpiRsGetPrtMethodData (Node, RetBuffer);
    302       1.1    jruoho     return_ACPI_STATUS (Status);
    303       1.1    jruoho }
    304       1.1    jruoho 
    305       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiGetIrqRoutingTable)
    306       1.1    jruoho 
    307       1.1    jruoho 
    308       1.1    jruoho /*******************************************************************************
    309       1.1    jruoho  *
    310       1.1    jruoho  * FUNCTION:    AcpiGetCurrentResources
    311       1.1    jruoho  *
    312       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
    313       1.1    jruoho  *                                device we are querying
    314       1.1    jruoho  *              RetBuffer       - Pointer to a buffer to receive the
    315       1.1    jruoho  *                                current resources for the device
    316       1.1    jruoho  *
    317       1.1    jruoho  * RETURN:      Status
    318       1.1    jruoho  *
    319       1.1    jruoho  * DESCRIPTION: This function is called to get the current resources for a
    320       1.1    jruoho  *              specific device. The caller must first acquire a handle for
    321       1.1    jruoho  *              the desired device. The resource data is placed in the buffer
    322       1.1    jruoho  *              pointed to by the RetBuffer variable parameter.
    323       1.1    jruoho  *
    324       1.1    jruoho  *              If the function fails an appropriate status will be returned
    325       1.1    jruoho  *              and the value of RetBuffer is undefined.
    326       1.1    jruoho  *
    327       1.1    jruoho  *              This function attempts to execute the _CRS method contained in
    328       1.1    jruoho  *              the object indicated by the passed DeviceHandle.
    329       1.1    jruoho  *
    330       1.1    jruoho  ******************************************************************************/
    331       1.1    jruoho 
    332       1.1    jruoho ACPI_STATUS
    333       1.1    jruoho AcpiGetCurrentResources (
    334       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    335       1.1    jruoho     ACPI_BUFFER             *RetBuffer)
    336       1.1    jruoho {
    337       1.1    jruoho     ACPI_STATUS             Status;
    338       1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    339       1.1    jruoho 
    340       1.1    jruoho 
    341       1.1    jruoho     ACPI_FUNCTION_TRACE (AcpiGetCurrentResources);
    342       1.1    jruoho 
    343       1.1    jruoho 
    344       1.1    jruoho     /* Validate parameters then dispatch to internal routine */
    345       1.1    jruoho 
    346       1.1    jruoho     Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
    347       1.1    jruoho     if (ACPI_FAILURE (Status))
    348       1.1    jruoho     {
    349       1.1    jruoho         return_ACPI_STATUS (Status);
    350       1.1    jruoho     }
    351       1.1    jruoho 
    352       1.1    jruoho     Status = AcpiRsGetCrsMethodData (Node, RetBuffer);
    353       1.1    jruoho     return_ACPI_STATUS (Status);
    354       1.1    jruoho }
    355       1.1    jruoho 
    356       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiGetCurrentResources)
    357       1.1    jruoho 
    358       1.1    jruoho 
    359       1.1    jruoho /*******************************************************************************
    360       1.1    jruoho  *
    361       1.1    jruoho  * FUNCTION:    AcpiGetPossibleResources
    362       1.1    jruoho  *
    363       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
    364       1.1    jruoho  *                                device we are querying
    365       1.1    jruoho  *              RetBuffer       - Pointer to a buffer to receive the
    366       1.1    jruoho  *                                resources for the device
    367       1.1    jruoho  *
    368       1.1    jruoho  * RETURN:      Status
    369       1.1    jruoho  *
    370       1.1    jruoho  * DESCRIPTION: This function is called to get a list of the possible resources
    371       1.1    jruoho  *              for a specific device. The caller must first acquire a handle
    372       1.1    jruoho  *              for the desired device. The resource data is placed in the
    373       1.1    jruoho  *              buffer pointed to by the RetBuffer variable.
    374       1.1    jruoho  *
    375       1.1    jruoho  *              If the function fails an appropriate status will be returned
    376       1.1    jruoho  *              and the value of RetBuffer is undefined.
    377       1.1    jruoho  *
    378       1.1    jruoho  ******************************************************************************/
    379       1.1    jruoho 
    380       1.1    jruoho ACPI_STATUS
    381       1.1    jruoho AcpiGetPossibleResources (
    382       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    383       1.1    jruoho     ACPI_BUFFER             *RetBuffer)
    384       1.1    jruoho {
    385       1.1    jruoho     ACPI_STATUS             Status;
    386       1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    387       1.1    jruoho 
    388       1.1    jruoho 
    389       1.1    jruoho     ACPI_FUNCTION_TRACE (AcpiGetPossibleResources);
    390       1.1    jruoho 
    391       1.1    jruoho 
    392       1.1    jruoho     /* Validate parameters then dispatch to internal routine */
    393       1.1    jruoho 
    394       1.1    jruoho     Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
    395       1.1    jruoho     if (ACPI_FAILURE (Status))
    396       1.1    jruoho     {
    397       1.1    jruoho         return_ACPI_STATUS (Status);
    398       1.1    jruoho     }
    399       1.1    jruoho 
    400       1.1    jruoho     Status = AcpiRsGetPrsMethodData (Node, RetBuffer);
    401       1.1    jruoho     return_ACPI_STATUS (Status);
    402       1.1    jruoho }
    403       1.1    jruoho 
    404       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiGetPossibleResources)
    405       1.1    jruoho 
    406       1.1    jruoho 
    407       1.1    jruoho /*******************************************************************************
    408       1.1    jruoho  *
    409       1.1    jruoho  * FUNCTION:    AcpiSetCurrentResources
    410       1.1    jruoho  *
    411       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
    412       1.1    jruoho  *                                device we are setting resources
    413       1.1    jruoho  *              InBuffer        - Pointer to a buffer containing the
    414       1.1    jruoho  *                                resources to be set for the device
    415       1.1    jruoho  *
    416       1.1    jruoho  * RETURN:      Status
    417       1.1    jruoho  *
    418       1.1    jruoho  * DESCRIPTION: This function is called to set the current resources for a
    419       1.1    jruoho  *              specific device. The caller must first acquire a handle for
    420       1.1    jruoho  *              the desired device. The resource data is passed to the routine
    421       1.1    jruoho  *              the buffer pointed to by the InBuffer variable.
    422       1.1    jruoho  *
    423       1.1    jruoho  ******************************************************************************/
    424       1.1    jruoho 
    425       1.1    jruoho ACPI_STATUS
    426       1.1    jruoho AcpiSetCurrentResources (
    427       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    428       1.1    jruoho     ACPI_BUFFER             *InBuffer)
    429       1.1    jruoho {
    430       1.1    jruoho     ACPI_STATUS             Status;
    431       1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    432       1.1    jruoho 
    433       1.1    jruoho 
    434       1.1    jruoho     ACPI_FUNCTION_TRACE (AcpiSetCurrentResources);
    435       1.1    jruoho 
    436       1.1    jruoho 
    437       1.1    jruoho     /* Validate the buffer, don't allow zero length */
    438       1.1    jruoho 
    439       1.1    jruoho     if ((!InBuffer) ||
    440       1.1    jruoho         (!InBuffer->Pointer) ||
    441       1.1    jruoho         (!InBuffer->Length))
    442       1.1    jruoho     {
    443       1.1    jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    444       1.1    jruoho     }
    445       1.1    jruoho 
    446       1.1    jruoho     /* Validate parameters then dispatch to internal routine */
    447       1.1    jruoho 
    448       1.1    jruoho     Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node);
    449       1.1    jruoho     if (ACPI_FAILURE (Status))
    450       1.1    jruoho     {
    451       1.1    jruoho         return_ACPI_STATUS (Status);
    452       1.1    jruoho     }
    453       1.1    jruoho 
    454       1.1    jruoho     Status = AcpiRsSetSrsMethodData (Node, InBuffer);
    455       1.1    jruoho     return_ACPI_STATUS (Status);
    456       1.1    jruoho }
    457       1.1    jruoho 
    458       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
    459       1.1    jruoho 
    460       1.1    jruoho 
    461   1.1.1.3  christos /*******************************************************************************
    462   1.1.1.3  christos  *
    463   1.1.1.3  christos  * FUNCTION:    AcpiGetEventResources
    464   1.1.1.3  christos  *
    465   1.1.1.3  christos  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
    466   1.1.1.3  christos  *                                device we are getting resources
    467   1.1.1.3  christos  *              InBuffer        - Pointer to a buffer containing the
    468   1.1.1.3  christos  *                                resources to be set for the device
    469   1.1.1.3  christos  *
    470   1.1.1.3  christos  * RETURN:      Status
    471   1.1.1.3  christos  *
    472   1.1.1.3  christos  * DESCRIPTION: This function is called to get the event resources for a
    473   1.1.1.3  christos  *              specific device. The caller must first acquire a handle for
    474   1.1.1.3  christos  *              the desired device. The resource data is passed to the routine
    475   1.1.1.3  christos  *              the buffer pointed to by the InBuffer variable. Uses the
    476   1.1.1.3  christos  *              _AEI method.
    477   1.1.1.3  christos  *
    478   1.1.1.3  christos  ******************************************************************************/
    479   1.1.1.3  christos 
    480   1.1.1.3  christos ACPI_STATUS
    481   1.1.1.3  christos AcpiGetEventResources (
    482   1.1.1.3  christos     ACPI_HANDLE             DeviceHandle,
    483   1.1.1.3  christos     ACPI_BUFFER             *RetBuffer)
    484   1.1.1.3  christos {
    485   1.1.1.3  christos     ACPI_STATUS             Status;
    486   1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
    487   1.1.1.3  christos 
    488   1.1.1.3  christos 
    489   1.1.1.3  christos     ACPI_FUNCTION_TRACE (AcpiGetEventResources);
    490   1.1.1.3  christos 
    491   1.1.1.3  christos 
    492   1.1.1.3  christos     /* Validate parameters then dispatch to internal routine */
    493   1.1.1.3  christos 
    494   1.1.1.3  christos     Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
    495   1.1.1.3  christos     if (ACPI_FAILURE (Status))
    496   1.1.1.3  christos     {
    497   1.1.1.3  christos         return_ACPI_STATUS (Status);
    498   1.1.1.3  christos     }
    499   1.1.1.3  christos 
    500   1.1.1.3  christos     Status = AcpiRsGetAeiMethodData (Node, RetBuffer);
    501   1.1.1.3  christos     return_ACPI_STATUS (Status);
    502   1.1.1.3  christos }
    503   1.1.1.3  christos 
    504   1.1.1.3  christos ACPI_EXPORT_SYMBOL (AcpiGetEventResources)
    505   1.1.1.3  christos 
    506   1.1.1.3  christos 
    507       1.1    jruoho /******************************************************************************
    508       1.1    jruoho  *
    509       1.1    jruoho  * FUNCTION:    AcpiResourceToAddress64
    510       1.1    jruoho  *
    511       1.1    jruoho  * PARAMETERS:  Resource        - Pointer to a resource
    512       1.1    jruoho  *              Out             - Pointer to the users's return buffer
    513       1.1    jruoho  *                                (a struct acpi_resource_address64)
    514       1.1    jruoho  *
    515       1.1    jruoho  * RETURN:      Status
    516       1.1    jruoho  *
    517       1.1    jruoho  * DESCRIPTION: If the resource is an address16, address32, or address64,
    518       1.1    jruoho  *              copy it to the address64 return buffer. This saves the
    519       1.1    jruoho  *              caller from having to duplicate code for different-sized
    520       1.1    jruoho  *              addresses.
    521       1.1    jruoho  *
    522       1.1    jruoho  ******************************************************************************/
    523       1.1    jruoho 
    524       1.1    jruoho ACPI_STATUS
    525       1.1    jruoho AcpiResourceToAddress64 (
    526       1.1    jruoho     ACPI_RESOURCE               *Resource,
    527       1.1    jruoho     ACPI_RESOURCE_ADDRESS64     *Out)
    528       1.1    jruoho {
    529       1.1    jruoho     ACPI_RESOURCE_ADDRESS16     *Address16;
    530       1.1    jruoho     ACPI_RESOURCE_ADDRESS32     *Address32;
    531       1.1    jruoho 
    532       1.1    jruoho 
    533       1.1    jruoho     if (!Resource || !Out)
    534       1.1    jruoho     {
    535       1.1    jruoho         return (AE_BAD_PARAMETER);
    536       1.1    jruoho     }
    537       1.1    jruoho 
    538       1.1    jruoho     /* Convert 16 or 32 address descriptor to 64 */
    539       1.1    jruoho 
    540       1.1    jruoho     switch (Resource->Type)
    541       1.1    jruoho     {
    542       1.1    jruoho     case ACPI_RESOURCE_TYPE_ADDRESS16:
    543       1.1    jruoho 
    544   1.1.1.7  christos         Address16 = ACPI_CAST_PTR (
    545   1.1.1.7  christos             ACPI_RESOURCE_ADDRESS16, &Resource->Data);
    546       1.1    jruoho         ACPI_COPY_ADDRESS (Out, Address16);
    547       1.1    jruoho         break;
    548       1.1    jruoho 
    549       1.1    jruoho     case ACPI_RESOURCE_TYPE_ADDRESS32:
    550       1.1    jruoho 
    551   1.1.1.7  christos         Address32 = ACPI_CAST_PTR (
    552   1.1.1.7  christos             ACPI_RESOURCE_ADDRESS32, &Resource->Data);
    553       1.1    jruoho         ACPI_COPY_ADDRESS (Out, Address32);
    554       1.1    jruoho         break;
    555       1.1    jruoho 
    556       1.1    jruoho     case ACPI_RESOURCE_TYPE_ADDRESS64:
    557       1.1    jruoho 
    558       1.1    jruoho         /* Simple copy for 64 bit source */
    559       1.1    jruoho 
    560   1.1.1.6  christos         memcpy (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
    561       1.1    jruoho         break;
    562       1.1    jruoho 
    563       1.1    jruoho     default:
    564   1.1.1.3  christos 
    565       1.1    jruoho         return (AE_BAD_PARAMETER);
    566       1.1    jruoho     }
    567       1.1    jruoho 
    568       1.1    jruoho     return (AE_OK);
    569       1.1    jruoho }
    570       1.1    jruoho 
    571       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64)
    572       1.1    jruoho 
    573       1.1    jruoho 
    574       1.1    jruoho /*******************************************************************************
    575       1.1    jruoho  *
    576       1.1    jruoho  * FUNCTION:    AcpiGetVendorResource
    577       1.1    jruoho  *
    578       1.1    jruoho  * PARAMETERS:  DeviceHandle    - Handle for the parent device object
    579       1.1    jruoho  *              Name            - Method name for the parent resource
    580       1.1    jruoho  *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
    581       1.1    jruoho  *              Uuid            - Pointer to the UUID to be matched.
    582       1.1    jruoho  *                                includes both subtype and 16-byte UUID
    583       1.1    jruoho  *              RetBuffer       - Where the vendor resource is returned
    584       1.1    jruoho  *
    585       1.1    jruoho  * RETURN:      Status
    586       1.1    jruoho  *
    587   1.1.1.3  christos  * DESCRIPTION: Walk a resource template for the specified device to find a
    588       1.1    jruoho  *              vendor-defined resource that matches the supplied UUID and
    589       1.1    jruoho  *              UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
    590       1.1    jruoho  *
    591       1.1    jruoho  ******************************************************************************/
    592       1.1    jruoho 
    593       1.1    jruoho ACPI_STATUS
    594       1.1    jruoho AcpiGetVendorResource (
    595       1.1    jruoho     ACPI_HANDLE             DeviceHandle,
    596       1.1    jruoho     char                    *Name,
    597       1.1    jruoho     ACPI_VENDOR_UUID        *Uuid,
    598       1.1    jruoho     ACPI_BUFFER             *RetBuffer)
    599       1.1    jruoho {
    600       1.1    jruoho     ACPI_VENDOR_WALK_INFO   Info;
    601       1.1    jruoho     ACPI_STATUS             Status;
    602       1.1    jruoho 
    603       1.1    jruoho 
    604       1.1    jruoho     /* Other parameters are validated by AcpiWalkResources */
    605       1.1    jruoho 
    606       1.1    jruoho     if (!Uuid || !RetBuffer)
    607       1.1    jruoho     {
    608       1.1    jruoho         return (AE_BAD_PARAMETER);
    609       1.1    jruoho     }
    610       1.1    jruoho 
    611       1.1    jruoho     Info.Uuid = Uuid;
    612       1.1    jruoho     Info.Buffer = RetBuffer;
    613       1.1    jruoho     Info.Status = AE_NOT_EXIST;
    614       1.1    jruoho 
    615       1.1    jruoho     /* Walk the _CRS or _PRS resource list for this device */
    616       1.1    jruoho 
    617   1.1.1.7  christos     Status = AcpiWalkResources (
    618   1.1.1.7  christos         DeviceHandle, Name, AcpiRsMatchVendorResource, &Info);
    619       1.1    jruoho     if (ACPI_FAILURE (Status))
    620       1.1    jruoho     {
    621       1.1    jruoho         return (Status);
    622       1.1    jruoho     }
    623       1.1    jruoho 
    624       1.1    jruoho     return (Info.Status);
    625       1.1    jruoho }
    626       1.1    jruoho 
    627       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiGetVendorResource)
    628       1.1    jruoho 
    629       1.1    jruoho 
    630       1.1    jruoho /*******************************************************************************
    631       1.1    jruoho  *
    632       1.1    jruoho  * FUNCTION:    AcpiRsMatchVendorResource
    633       1.1    jruoho  *
    634       1.1    jruoho  * PARAMETERS:  ACPI_WALK_RESOURCE_CALLBACK
    635       1.1    jruoho  *
    636       1.1    jruoho  * RETURN:      Status
    637       1.1    jruoho  *
    638       1.1    jruoho  * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
    639       1.1    jruoho  *
    640       1.1    jruoho  ******************************************************************************/
    641       1.1    jruoho 
    642       1.1    jruoho static ACPI_STATUS
    643       1.1    jruoho AcpiRsMatchVendorResource (
    644       1.1    jruoho     ACPI_RESOURCE           *Resource,
    645       1.1    jruoho     void                    *Context)
    646       1.1    jruoho {
    647       1.1    jruoho     ACPI_VENDOR_WALK_INFO       *Info = Context;
    648       1.1    jruoho     ACPI_RESOURCE_VENDOR_TYPED  *Vendor;
    649       1.1    jruoho     ACPI_BUFFER                 *Buffer;
    650       1.1    jruoho     ACPI_STATUS                 Status;
    651       1.1    jruoho 
    652       1.1    jruoho 
    653       1.1    jruoho     /* Ignore all descriptors except Vendor */
    654       1.1    jruoho 
    655       1.1    jruoho     if (Resource->Type != ACPI_RESOURCE_TYPE_VENDOR)
    656       1.1    jruoho     {
    657       1.1    jruoho         return (AE_OK);
    658       1.1    jruoho     }
    659       1.1    jruoho 
    660       1.1    jruoho     Vendor = &Resource->Data.VendorTyped;
    661       1.1    jruoho 
    662       1.1    jruoho     /*
    663       1.1    jruoho      * For a valid match, these conditions must hold:
    664       1.1    jruoho      *
    665       1.1    jruoho      * 1) Length of descriptor data must be at least as long as a UUID struct
    666       1.1    jruoho      * 2) The UUID subtypes must match
    667       1.1    jruoho      * 3) The UUID data must match
    668       1.1    jruoho      */
    669       1.1    jruoho     if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) ||
    670       1.1    jruoho         (Vendor->UuidSubtype != Info->Uuid->Subtype)  ||
    671   1.1.1.6  christos         (memcmp (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
    672       1.1    jruoho     {
    673       1.1    jruoho         return (AE_OK);
    674       1.1    jruoho     }
    675       1.1    jruoho 
    676       1.1    jruoho     /* Validate/Allocate/Clear caller buffer */
    677       1.1    jruoho 
    678       1.1    jruoho     Buffer = Info->Buffer;
    679       1.1    jruoho     Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
    680       1.1    jruoho     if (ACPI_FAILURE (Status))
    681       1.1    jruoho     {
    682       1.1    jruoho         return (Status);
    683       1.1    jruoho     }
    684       1.1    jruoho 
    685       1.1    jruoho     /* Found the correct resource, copy and return it */
    686       1.1    jruoho 
    687   1.1.1.6  christos     memcpy (Buffer->Pointer, Resource, Resource->Length);
    688       1.1    jruoho     Buffer->Length = Resource->Length;
    689       1.1    jruoho 
    690       1.1    jruoho     /* Found the desired descriptor, terminate resource walk */
    691       1.1    jruoho 
    692       1.1    jruoho     Info->Status = AE_OK;
    693       1.1    jruoho     return (AE_CTRL_TERMINATE);
    694       1.1    jruoho }
    695       1.1    jruoho 
    696       1.1    jruoho 
    697       1.1    jruoho /*******************************************************************************
    698       1.1    jruoho  *
    699   1.1.1.3  christos  * FUNCTION:    AcpiWalkResourceBuffer
    700       1.1    jruoho  *
    701   1.1.1.3  christos  * PARAMETERS:  Buffer          - Formatted buffer returned by one of the
    702   1.1.1.3  christos  *                                various Get*Resource functions
    703       1.1    jruoho  *              UserFunction    - Called for each resource
    704       1.1    jruoho  *              Context         - Passed to UserFunction
    705       1.1    jruoho  *
    706       1.1    jruoho  * RETURN:      Status
    707       1.1    jruoho  *
    708   1.1.1.3  christos  * DESCRIPTION: Walks the input resource template. The UserFunction is called
    709   1.1.1.3  christos  *              once for each resource in the list.
    710       1.1    jruoho  *
    711       1.1    jruoho  ******************************************************************************/
    712       1.1    jruoho 
    713       1.1    jruoho ACPI_STATUS
    714   1.1.1.3  christos AcpiWalkResourceBuffer (
    715   1.1.1.3  christos     ACPI_BUFFER                 *Buffer,
    716       1.1    jruoho     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
    717       1.1    jruoho     void                        *Context)
    718       1.1    jruoho {
    719   1.1.1.3  christos     ACPI_STATUS                 Status = AE_OK;
    720       1.1    jruoho     ACPI_RESOURCE               *Resource;
    721       1.1    jruoho     ACPI_RESOURCE               *ResourceEnd;
    722       1.1    jruoho 
    723       1.1    jruoho 
    724   1.1.1.3  christos     ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer);
    725       1.1    jruoho 
    726       1.1    jruoho 
    727       1.1    jruoho     /* Parameter validation */
    728       1.1    jruoho 
    729   1.1.1.3  christos     if (!Buffer || !Buffer->Pointer || !UserFunction)
    730       1.1    jruoho     {
    731       1.1    jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    732       1.1    jruoho     }
    733       1.1    jruoho 
    734   1.1.1.3  christos     /* Buffer contains the resource list and length */
    735       1.1    jruoho 
    736   1.1.1.3  christos     Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer);
    737   1.1.1.7  christos     ResourceEnd = ACPI_ADD_PTR (
    738   1.1.1.7  christos         ACPI_RESOURCE, Buffer->Pointer, Buffer->Length);
    739       1.1    jruoho 
    740       1.1    jruoho     /* Walk the resource list until the EndTag is found (or buffer end) */
    741       1.1    jruoho 
    742       1.1    jruoho     while (Resource < ResourceEnd)
    743       1.1    jruoho     {
    744   1.1.1.3  christos         /* Sanity check the resource type */
    745       1.1    jruoho 
    746       1.1    jruoho         if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
    747       1.1    jruoho         {
    748       1.1    jruoho             Status = AE_AML_INVALID_RESOURCE_TYPE;
    749       1.1    jruoho             break;
    750       1.1    jruoho         }
    751       1.1    jruoho 
    752   1.1.1.3  christos         /* Sanity check the length. It must not be zero, or we loop forever */
    753   1.1.1.3  christos 
    754   1.1.1.3  christos         if (!Resource->Length)
    755   1.1.1.3  christos         {
    756   1.1.1.3  christos             return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
    757   1.1.1.3  christos         }
    758   1.1.1.3  christos 
    759       1.1    jruoho         /* Invoke the user function, abort on any error returned */
    760       1.1    jruoho 
    761       1.1    jruoho         Status = UserFunction (Resource, Context);
    762       1.1    jruoho         if (ACPI_FAILURE (Status))
    763       1.1    jruoho         {
    764       1.1    jruoho             if (Status == AE_CTRL_TERMINATE)
    765       1.1    jruoho             {
    766       1.1    jruoho                 /* This is an OK termination by the user function */
    767       1.1    jruoho 
    768       1.1    jruoho                 Status = AE_OK;
    769       1.1    jruoho             }
    770       1.1    jruoho             break;
    771       1.1    jruoho         }
    772       1.1    jruoho 
    773       1.1    jruoho         /* EndTag indicates end-of-list */
    774       1.1    jruoho 
    775       1.1    jruoho         if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
    776       1.1    jruoho         {
    777       1.1    jruoho             break;
    778       1.1    jruoho         }
    779       1.1    jruoho 
    780       1.1    jruoho         /* Get the next resource descriptor */
    781       1.1    jruoho 
    782   1.1.1.3  christos         Resource = ACPI_NEXT_RESOURCE (Resource);
    783       1.1    jruoho     }
    784       1.1    jruoho 
    785   1.1.1.3  christos     return_ACPI_STATUS (Status);
    786   1.1.1.3  christos }
    787   1.1.1.3  christos 
    788   1.1.1.3  christos ACPI_EXPORT_SYMBOL (AcpiWalkResourceBuffer)
    789   1.1.1.3  christos 
    790   1.1.1.3  christos 
    791   1.1.1.3  christos /*******************************************************************************
    792   1.1.1.3  christos  *
    793   1.1.1.3  christos  * FUNCTION:    AcpiWalkResources
    794   1.1.1.3  christos  *
    795   1.1.1.3  christos  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
    796   1.1.1.3  christos  *                                device we are querying
    797   1.1.1.3  christos  *              Name            - Method name of the resources we want.
    798   1.1.1.3  christos  *                                (METHOD_NAME__CRS, METHOD_NAME__PRS, or
    799   1.1.1.9  christos  *                                METHOD_NAME__AEI or METHOD_NAME__DMA)
    800   1.1.1.3  christos  *              UserFunction    - Called for each resource
    801   1.1.1.3  christos  *              Context         - Passed to UserFunction
    802   1.1.1.3  christos  *
    803   1.1.1.3  christos  * RETURN:      Status
    804   1.1.1.3  christos  *
    805   1.1.1.3  christos  * DESCRIPTION: Retrieves the current or possible resource list for the
    806   1.1.1.3  christos  *              specified device. The UserFunction is called once for
    807   1.1.1.3  christos  *              each resource in the list.
    808   1.1.1.3  christos  *
    809   1.1.1.3  christos  ******************************************************************************/
    810   1.1.1.3  christos 
    811   1.1.1.3  christos ACPI_STATUS
    812   1.1.1.3  christos AcpiWalkResources (
    813   1.1.1.3  christos     ACPI_HANDLE                 DeviceHandle,
    814   1.1.1.3  christos     char                        *Name,
    815   1.1.1.3  christos     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
    816   1.1.1.3  christos     void                        *Context)
    817   1.1.1.3  christos {
    818   1.1.1.3  christos     ACPI_STATUS                 Status;
    819   1.1.1.3  christos     ACPI_BUFFER                 Buffer;
    820   1.1.1.3  christos 
    821   1.1.1.3  christos 
    822   1.1.1.3  christos     ACPI_FUNCTION_TRACE (AcpiWalkResources);
    823   1.1.1.3  christos 
    824   1.1.1.3  christos 
    825   1.1.1.3  christos     /* Parameter validation */
    826   1.1.1.3  christos 
    827   1.1.1.3  christos     if (!DeviceHandle || !UserFunction || !Name ||
    828  1.1.1.11  christos         (!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__CRS) &&
    829  1.1.1.11  christos          !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__PRS) &&
    830  1.1.1.11  christos          !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__AEI) &&
    831  1.1.1.11  christos          !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__DMA)))
    832   1.1.1.3  christos     {
    833   1.1.1.3  christos         return_ACPI_STATUS (AE_BAD_PARAMETER);
    834   1.1.1.3  christos     }
    835   1.1.1.3  christos 
    836   1.1.1.9  christos     /* Get the _CRS/_PRS/_AEI/_DMA resource list */
    837   1.1.1.3  christos 
    838   1.1.1.3  christos     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    839   1.1.1.3  christos     Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
    840   1.1.1.3  christos     if (ACPI_FAILURE (Status))
    841   1.1.1.3  christos     {
    842   1.1.1.3  christos         return_ACPI_STATUS (Status);
    843   1.1.1.3  christos     }
    844   1.1.1.3  christos 
    845   1.1.1.3  christos     /* Walk the resource list and cleanup */
    846   1.1.1.3  christos 
    847   1.1.1.3  christos     Status = AcpiWalkResourceBuffer (&Buffer, UserFunction, Context);
    848       1.1    jruoho     ACPI_FREE (Buffer.Pointer);
    849       1.1    jruoho     return_ACPI_STATUS (Status);
    850       1.1    jruoho }
    851       1.1    jruoho 
    852       1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiWalkResources)
    853