Home | History | Annotate | Line # | Download | only in acpiexec
aeexec.c revision 1.1.1.2.2.2
      1  1.1.1.2.2.2  bouyer /******************************************************************************
      2  1.1.1.2.2.2  bouyer  *
      3  1.1.1.2.2.2  bouyer  * Module Name: aeexec - Support routines for AcpiExec utility
      4  1.1.1.2.2.2  bouyer  *
      5  1.1.1.2.2.2  bouyer  *****************************************************************************/
      6  1.1.1.2.2.2  bouyer 
      7  1.1.1.2.2.2  bouyer /*
      8  1.1.1.2.2.2  bouyer  * Copyright (C) 2000 - 2011, Intel Corp.
      9  1.1.1.2.2.2  bouyer  * All rights reserved.
     10  1.1.1.2.2.2  bouyer  *
     11  1.1.1.2.2.2  bouyer  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2.2.2  bouyer  * modification, are permitted provided that the following conditions
     13  1.1.1.2.2.2  bouyer  * are met:
     14  1.1.1.2.2.2  bouyer  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2.2.2  bouyer  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2.2.2  bouyer  *    without modification.
     17  1.1.1.2.2.2  bouyer  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2.2.2  bouyer  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2.2.2  bouyer  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2.2.2  bouyer  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2.2.2  bouyer  *    binary redistribution.
     22  1.1.1.2.2.2  bouyer  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2.2.2  bouyer  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2.2.2  bouyer  *    from this software without specific prior written permission.
     25  1.1.1.2.2.2  bouyer  *
     26  1.1.1.2.2.2  bouyer  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2.2.2  bouyer  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2.2.2  bouyer  * Software Foundation.
     29  1.1.1.2.2.2  bouyer  *
     30  1.1.1.2.2.2  bouyer  * NO WARRANTY
     31  1.1.1.2.2.2  bouyer  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2.2.2  bouyer  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2.2.2  bouyer  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2.2.2  bouyer  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2.2.2  bouyer  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2.2.2  bouyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2.2.2  bouyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2.2.2  bouyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2.2.2  bouyer  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2.2.2  bouyer  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2.2.2  bouyer  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2.2.2  bouyer  */
     43  1.1.1.2.2.2  bouyer 
     44  1.1.1.2.2.2  bouyer #include "aecommon.h"
     45  1.1.1.2.2.2  bouyer 
     46  1.1.1.2.2.2  bouyer #define _COMPONENT          ACPI_TOOLS
     47  1.1.1.2.2.2  bouyer         ACPI_MODULE_NAME    ("aeexec")
     48  1.1.1.2.2.2  bouyer 
     49  1.1.1.2.2.2  bouyer /* Local prototypes */
     50  1.1.1.2.2.2  bouyer 
     51  1.1.1.2.2.2  bouyer static ACPI_STATUS
     52  1.1.1.2.2.2  bouyer AeSetupConfiguration (
     53  1.1.1.2.2.2  bouyer     void                    *RegionAddr);
     54  1.1.1.2.2.2  bouyer 
     55  1.1.1.2.2.2  bouyer static void
     56  1.1.1.2.2.2  bouyer AfInstallGpeBlock (
     57  1.1.1.2.2.2  bouyer     void);
     58  1.1.1.2.2.2  bouyer 
     59  1.1.1.2.2.2  bouyer static void
     60  1.1.1.2.2.2  bouyer AeTestBufferArgument (
     61  1.1.1.2.2.2  bouyer     void);
     62  1.1.1.2.2.2  bouyer 
     63  1.1.1.2.2.2  bouyer static void
     64  1.1.1.2.2.2  bouyer AeTestPackageArgument (
     65  1.1.1.2.2.2  bouyer     void);
     66  1.1.1.2.2.2  bouyer 
     67  1.1.1.2.2.2  bouyer static ACPI_STATUS
     68  1.1.1.2.2.2  bouyer AeGetDevices (
     69  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
     70  1.1.1.2.2.2  bouyer     UINT32                  NestingLevel,
     71  1.1.1.2.2.2  bouyer     void                    *Context,
     72  1.1.1.2.2.2  bouyer     void                    **ReturnValue);
     73  1.1.1.2.2.2  bouyer 
     74  1.1.1.2.2.2  bouyer static ACPI_STATUS
     75  1.1.1.2.2.2  bouyer ExecuteOSI (
     76  1.1.1.2.2.2  bouyer     char                    *OsiString,
     77  1.1.1.2.2.2  bouyer     UINT32                  ExpectedResult);
     78  1.1.1.2.2.2  bouyer 
     79  1.1.1.2.2.2  bouyer static void
     80  1.1.1.2.2.2  bouyer AeHardwareInterfaces (
     81  1.1.1.2.2.2  bouyer     void);
     82  1.1.1.2.2.2  bouyer 
     83  1.1.1.2.2.2  bouyer static void
     84  1.1.1.2.2.2  bouyer AeGenericRegisters (
     85  1.1.1.2.2.2  bouyer     void);
     86  1.1.1.2.2.2  bouyer 
     87  1.1.1.2.2.2  bouyer extern unsigned char Ssdt3Code[];
     88  1.1.1.2.2.2  bouyer 
     89  1.1.1.2.2.2  bouyer 
     90  1.1.1.2.2.2  bouyer /******************************************************************************
     91  1.1.1.2.2.2  bouyer  *
     92  1.1.1.2.2.2  bouyer  * FUNCTION:    AeSetupConfiguration
     93  1.1.1.2.2.2  bouyer  *
     94  1.1.1.2.2.2  bouyer  * PARAMETERS:  RegionAddr          - Address for an ACPI table to be loaded
     95  1.1.1.2.2.2  bouyer  *                                    dynamically. Test purposes only.
     96  1.1.1.2.2.2  bouyer  *
     97  1.1.1.2.2.2  bouyer  * RETURN:      Status
     98  1.1.1.2.2.2  bouyer  *
     99  1.1.1.2.2.2  bouyer  * DESCRIPTION: Call AML _CFG configuration control method
    100  1.1.1.2.2.2  bouyer  *
    101  1.1.1.2.2.2  bouyer  *****************************************************************************/
    102  1.1.1.2.2.2  bouyer 
    103  1.1.1.2.2.2  bouyer static ACPI_STATUS
    104  1.1.1.2.2.2  bouyer AeSetupConfiguration (
    105  1.1.1.2.2.2  bouyer     void                    *RegionAddr)
    106  1.1.1.2.2.2  bouyer {
    107  1.1.1.2.2.2  bouyer     ACPI_OBJECT_LIST        ArgList;
    108  1.1.1.2.2.2  bouyer     ACPI_OBJECT             Arg[3];
    109  1.1.1.2.2.2  bouyer 
    110  1.1.1.2.2.2  bouyer 
    111  1.1.1.2.2.2  bouyer     /*
    112  1.1.1.2.2.2  bouyer      * Invoke _CFG method if present
    113  1.1.1.2.2.2  bouyer      */
    114  1.1.1.2.2.2  bouyer     ArgList.Count = 1;
    115  1.1.1.2.2.2  bouyer     ArgList.Pointer = Arg;
    116  1.1.1.2.2.2  bouyer 
    117  1.1.1.2.2.2  bouyer     Arg[0].Type = ACPI_TYPE_INTEGER;
    118  1.1.1.2.2.2  bouyer     Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
    119  1.1.1.2.2.2  bouyer 
    120  1.1.1.2.2.2  bouyer     (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
    121  1.1.1.2.2.2  bouyer     return (AE_OK);
    122  1.1.1.2.2.2  bouyer }
    123  1.1.1.2.2.2  bouyer 
    124  1.1.1.2.2.2  bouyer 
    125  1.1.1.2.2.2  bouyer /******************************************************************************
    126  1.1.1.2.2.2  bouyer  *
    127  1.1.1.2.2.2  bouyer  * FUNCTION:    AfInstallGpeBlock
    128  1.1.1.2.2.2  bouyer  *
    129  1.1.1.2.2.2  bouyer  * PARAMETERS:  None
    130  1.1.1.2.2.2  bouyer  *
    131  1.1.1.2.2.2  bouyer  * RETURN:      None
    132  1.1.1.2.2.2  bouyer  *
    133  1.1.1.2.2.2  bouyer  * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
    134  1.1.1.2.2.2  bouyer  *              A \GPE2 device.
    135  1.1.1.2.2.2  bouyer  *
    136  1.1.1.2.2.2  bouyer  *****************************************************************************/
    137  1.1.1.2.2.2  bouyer 
    138  1.1.1.2.2.2  bouyer static void
    139  1.1.1.2.2.2  bouyer AfInstallGpeBlock (
    140  1.1.1.2.2.2  bouyer     void)
    141  1.1.1.2.2.2  bouyer {
    142  1.1.1.2.2.2  bouyer     ACPI_STATUS                 Status;
    143  1.1.1.2.2.2  bouyer     ACPI_HANDLE                 Handle;
    144  1.1.1.2.2.2  bouyer     ACPI_HANDLE                 Handle2 = NULL;
    145  1.1.1.2.2.2  bouyer     ACPI_HANDLE                 Handle3 = NULL;
    146  1.1.1.2.2.2  bouyer     ACPI_GENERIC_ADDRESS        BlockAddress;
    147  1.1.1.2.2.2  bouyer     ACPI_HANDLE                 GpeDevice;
    148  1.1.1.2.2.2  bouyer 
    149  1.1.1.2.2.2  bouyer 
    150  1.1.1.2.2.2  bouyer     Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
    151  1.1.1.2.2.2  bouyer     if (ACPI_FAILURE (Status))
    152  1.1.1.2.2.2  bouyer     {
    153  1.1.1.2.2.2  bouyer         return;
    154  1.1.1.2.2.2  bouyer     }
    155  1.1.1.2.2.2  bouyer 
    156  1.1.1.2.2.2  bouyer     ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
    157  1.1.1.2.2.2  bouyer     BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
    158  1.1.1.2.2.2  bouyer     BlockAddress.Address = 0x76540000;
    159  1.1.1.2.2.2  bouyer 
    160  1.1.1.2.2.2  bouyer     Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
    161  1.1.1.2.2.2  bouyer     if (ACPI_SUCCESS (Status))
    162  1.1.1.2.2.2  bouyer     {
    163  1.1.1.2.2.2  bouyer         Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
    164  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiInstallGpeBlock, Status);
    165  1.1.1.2.2.2  bouyer 
    166  1.1.1.2.2.2  bouyer         Status = AcpiInstallGpeHandler (Handle2, 8,
    167  1.1.1.2.2.2  bouyer             ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    168  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    169  1.1.1.2.2.2  bouyer 
    170  1.1.1.2.2.2  bouyer         Status = AcpiEnableGpe (Handle2, 8);
    171  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiEnableGpe, Status);
    172  1.1.1.2.2.2  bouyer 
    173  1.1.1.2.2.2  bouyer         Status = AcpiGetGpeDevice (0x30, &GpeDevice);
    174  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiGetGpeDevice, Status);
    175  1.1.1.2.2.2  bouyer 
    176  1.1.1.2.2.2  bouyer         Status = AcpiGetGpeDevice (0x42, &GpeDevice);
    177  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiGetGpeDevice, Status);
    178  1.1.1.2.2.2  bouyer 
    179  1.1.1.2.2.2  bouyer         Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
    180  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiGetGpeDevice, Status);
    181  1.1.1.2.2.2  bouyer 
    182  1.1.1.2.2.2  bouyer         Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
    183  1.1.1.2.2.2  bouyer         AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
    184  1.1.1.2.2.2  bouyer 
    185  1.1.1.2.2.2  bouyer         Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
    186  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
    187  1.1.1.2.2.2  bouyer     }
    188  1.1.1.2.2.2  bouyer 
    189  1.1.1.2.2.2  bouyer     Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
    190  1.1.1.2.2.2  bouyer     if (ACPI_SUCCESS (Status))
    191  1.1.1.2.2.2  bouyer     {
    192  1.1.1.2.2.2  bouyer         Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
    193  1.1.1.2.2.2  bouyer         AE_CHECK_OK (AcpiInstallGpeBlock, Status);
    194  1.1.1.2.2.2  bouyer     }
    195  1.1.1.2.2.2  bouyer }
    196  1.1.1.2.2.2  bouyer 
    197  1.1.1.2.2.2  bouyer 
    198  1.1.1.2.2.2  bouyer /* Test using a Buffer object as a method argument */
    199  1.1.1.2.2.2  bouyer 
    200  1.1.1.2.2.2  bouyer static void
    201  1.1.1.2.2.2  bouyer AeTestBufferArgument (
    202  1.1.1.2.2.2  bouyer     void)
    203  1.1.1.2.2.2  bouyer {
    204  1.1.1.2.2.2  bouyer     ACPI_OBJECT_LIST        Params;
    205  1.1.1.2.2.2  bouyer     ACPI_OBJECT             BufArg;
    206  1.1.1.2.2.2  bouyer     UINT8                   Buffer[] = {
    207  1.1.1.2.2.2  bouyer         0,0,0,0,
    208  1.1.1.2.2.2  bouyer         4,0,0,0,
    209  1.1.1.2.2.2  bouyer         1,2,3,4};
    210  1.1.1.2.2.2  bouyer 
    211  1.1.1.2.2.2  bouyer 
    212  1.1.1.2.2.2  bouyer     BufArg.Type = ACPI_TYPE_BUFFER;
    213  1.1.1.2.2.2  bouyer     BufArg.Buffer.Length = 12;
    214  1.1.1.2.2.2  bouyer     BufArg.Buffer.Pointer = Buffer;
    215  1.1.1.2.2.2  bouyer 
    216  1.1.1.2.2.2  bouyer     Params.Count = 1;
    217  1.1.1.2.2.2  bouyer     Params.Pointer = &BufArg;
    218  1.1.1.2.2.2  bouyer 
    219  1.1.1.2.2.2  bouyer     (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
    220  1.1.1.2.2.2  bouyer }
    221  1.1.1.2.2.2  bouyer 
    222  1.1.1.2.2.2  bouyer 
    223  1.1.1.2.2.2  bouyer static ACPI_OBJECT                 PkgArg;
    224  1.1.1.2.2.2  bouyer static ACPI_OBJECT                 PkgElements[5];
    225  1.1.1.2.2.2  bouyer static ACPI_OBJECT                 Pkg2Elements[5];
    226  1.1.1.2.2.2  bouyer static ACPI_OBJECT_LIST            Params;
    227  1.1.1.2.2.2  bouyer 
    228  1.1.1.2.2.2  bouyer 
    229  1.1.1.2.2.2  bouyer /*
    230  1.1.1.2.2.2  bouyer  * Test using a Package object as an method argument
    231  1.1.1.2.2.2  bouyer  */
    232  1.1.1.2.2.2  bouyer static void
    233  1.1.1.2.2.2  bouyer AeTestPackageArgument (
    234  1.1.1.2.2.2  bouyer     void)
    235  1.1.1.2.2.2  bouyer {
    236  1.1.1.2.2.2  bouyer 
    237  1.1.1.2.2.2  bouyer     /* Main package */
    238  1.1.1.2.2.2  bouyer 
    239  1.1.1.2.2.2  bouyer     PkgArg.Type = ACPI_TYPE_PACKAGE;
    240  1.1.1.2.2.2  bouyer     PkgArg.Package.Count = 4;
    241  1.1.1.2.2.2  bouyer     PkgArg.Package.Elements = PkgElements;
    242  1.1.1.2.2.2  bouyer 
    243  1.1.1.2.2.2  bouyer     /* Main package elements */
    244  1.1.1.2.2.2  bouyer 
    245  1.1.1.2.2.2  bouyer     PkgElements[0].Type = ACPI_TYPE_INTEGER;
    246  1.1.1.2.2.2  bouyer     PkgElements[0].Integer.Value = 0x22228888;
    247  1.1.1.2.2.2  bouyer 
    248  1.1.1.2.2.2  bouyer     PkgElements[1].Type = ACPI_TYPE_STRING;
    249  1.1.1.2.2.2  bouyer     PkgElements[1].String.Length = sizeof ("Top-level package");
    250  1.1.1.2.2.2  bouyer     PkgElements[1].String.Pointer = "Top-level package";
    251  1.1.1.2.2.2  bouyer 
    252  1.1.1.2.2.2  bouyer     PkgElements[2].Type = ACPI_TYPE_BUFFER;
    253  1.1.1.2.2.2  bouyer     PkgElements[2].Buffer.Length = sizeof ("XXXX");
    254  1.1.1.2.2.2  bouyer     PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX";
    255  1.1.1.2.2.2  bouyer 
    256  1.1.1.2.2.2  bouyer     PkgElements[3].Type = ACPI_TYPE_PACKAGE;
    257  1.1.1.2.2.2  bouyer     PkgElements[3].Package.Count = 2;
    258  1.1.1.2.2.2  bouyer     PkgElements[3].Package.Elements = Pkg2Elements;
    259  1.1.1.2.2.2  bouyer 
    260  1.1.1.2.2.2  bouyer     /* Sub-package elements */
    261  1.1.1.2.2.2  bouyer 
    262  1.1.1.2.2.2  bouyer     Pkg2Elements[0].Type = ACPI_TYPE_INTEGER;
    263  1.1.1.2.2.2  bouyer     Pkg2Elements[0].Integer.Value = 0xAAAABBBB;
    264  1.1.1.2.2.2  bouyer 
    265  1.1.1.2.2.2  bouyer     Pkg2Elements[1].Type = ACPI_TYPE_STRING;
    266  1.1.1.2.2.2  bouyer     Pkg2Elements[1].String.Length = sizeof ("Nested Package");
    267  1.1.1.2.2.2  bouyer     Pkg2Elements[1].String.Pointer = "Nested Package";
    268  1.1.1.2.2.2  bouyer 
    269  1.1.1.2.2.2  bouyer     /* Parameter object */
    270  1.1.1.2.2.2  bouyer 
    271  1.1.1.2.2.2  bouyer     Params.Count = 1;
    272  1.1.1.2.2.2  bouyer     Params.Pointer = &PkgArg;
    273  1.1.1.2.2.2  bouyer 
    274  1.1.1.2.2.2  bouyer     (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
    275  1.1.1.2.2.2  bouyer }
    276  1.1.1.2.2.2  bouyer 
    277  1.1.1.2.2.2  bouyer 
    278  1.1.1.2.2.2  bouyer static ACPI_STATUS
    279  1.1.1.2.2.2  bouyer AeGetDevices (
    280  1.1.1.2.2.2  bouyer     ACPI_HANDLE                     ObjHandle,
    281  1.1.1.2.2.2  bouyer     UINT32                          NestingLevel,
    282  1.1.1.2.2.2  bouyer     void                            *Context,
    283  1.1.1.2.2.2  bouyer     void                            **ReturnValue)
    284  1.1.1.2.2.2  bouyer {
    285  1.1.1.2.2.2  bouyer 
    286  1.1.1.2.2.2  bouyer     return (AE_OK);
    287  1.1.1.2.2.2  bouyer }
    288  1.1.1.2.2.2  bouyer 
    289  1.1.1.2.2.2  bouyer 
    290  1.1.1.2.2.2  bouyer /******************************************************************************
    291  1.1.1.2.2.2  bouyer  *
    292  1.1.1.2.2.2  bouyer  * FUNCTION:    ExecuteOSI
    293  1.1.1.2.2.2  bouyer  *
    294  1.1.1.2.2.2  bouyer  * PARAMETERS:  OsiString           - String passed to _OSI method
    295  1.1.1.2.2.2  bouyer  *              ExpectedResult      - 0 (FALSE) or 0xFFFFFFFF (TRUE)
    296  1.1.1.2.2.2  bouyer  *
    297  1.1.1.2.2.2  bouyer  * RETURN:      Status
    298  1.1.1.2.2.2  bouyer  *
    299  1.1.1.2.2.2  bouyer  * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
    300  1.1.1.2.2.2  bouyer  *
    301  1.1.1.2.2.2  bouyer  *****************************************************************************/
    302  1.1.1.2.2.2  bouyer 
    303  1.1.1.2.2.2  bouyer static ACPI_STATUS
    304  1.1.1.2.2.2  bouyer ExecuteOSI (
    305  1.1.1.2.2.2  bouyer     char                    *OsiString,
    306  1.1.1.2.2.2  bouyer     UINT32                  ExpectedResult)
    307  1.1.1.2.2.2  bouyer {
    308  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    309  1.1.1.2.2.2  bouyer     ACPI_OBJECT_LIST        ArgList;
    310  1.1.1.2.2.2  bouyer     ACPI_OBJECT             Arg[1];
    311  1.1.1.2.2.2  bouyer     ACPI_BUFFER             ReturnValue;
    312  1.1.1.2.2.2  bouyer     ACPI_OBJECT             *Obj;
    313  1.1.1.2.2.2  bouyer 
    314  1.1.1.2.2.2  bouyer 
    315  1.1.1.2.2.2  bouyer     /* Setup input argument */
    316  1.1.1.2.2.2  bouyer 
    317  1.1.1.2.2.2  bouyer     ArgList.Count = 1;
    318  1.1.1.2.2.2  bouyer     ArgList.Pointer = Arg;
    319  1.1.1.2.2.2  bouyer 
    320  1.1.1.2.2.2  bouyer     Arg[0].Type = ACPI_TYPE_STRING;
    321  1.1.1.2.2.2  bouyer     Arg[0].String.Pointer = OsiString;
    322  1.1.1.2.2.2  bouyer     Arg[0].String.Length = strlen (Arg[0].String.Pointer);
    323  1.1.1.2.2.2  bouyer 
    324  1.1.1.2.2.2  bouyer     /* Ask ACPICA to allocate space for the return object */
    325  1.1.1.2.2.2  bouyer 
    326  1.1.1.2.2.2  bouyer     ReturnValue.Length = ACPI_ALLOCATE_BUFFER;
    327  1.1.1.2.2.2  bouyer 
    328  1.1.1.2.2.2  bouyer     Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
    329  1.1.1.2.2.2  bouyer 
    330  1.1.1.2.2.2  bouyer     if (ACPI_FAILURE (Status))
    331  1.1.1.2.2.2  bouyer     {
    332  1.1.1.2.2.2  bouyer         AcpiOsPrintf ("Could not execute _OSI method, %s\n",
    333  1.1.1.2.2.2  bouyer             AcpiFormatException (Status));
    334  1.1.1.2.2.2  bouyer         return (Status);
    335  1.1.1.2.2.2  bouyer     }
    336  1.1.1.2.2.2  bouyer 
    337  1.1.1.2.2.2  bouyer     if (ReturnValue.Length < sizeof (ACPI_OBJECT))
    338  1.1.1.2.2.2  bouyer     {
    339  1.1.1.2.2.2  bouyer         AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
    340  1.1.1.2.2.2  bouyer             ReturnValue.Length);
    341  1.1.1.2.2.2  bouyer         return (AE_ERROR);
    342  1.1.1.2.2.2  bouyer     }
    343  1.1.1.2.2.2  bouyer 
    344  1.1.1.2.2.2  bouyer     Obj = ReturnValue.Pointer;
    345  1.1.1.2.2.2  bouyer     if (Obj->Type != ACPI_TYPE_INTEGER)
    346  1.1.1.2.2.2  bouyer     {
    347  1.1.1.2.2.2  bouyer         AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type);
    348  1.1.1.2.2.2  bouyer         return (AE_ERROR);
    349  1.1.1.2.2.2  bouyer     }
    350  1.1.1.2.2.2  bouyer 
    351  1.1.1.2.2.2  bouyer     if (Obj->Integer.Value != ExpectedResult)
    352  1.1.1.2.2.2  bouyer     {
    353  1.1.1.2.2.2  bouyer         AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n",
    354  1.1.1.2.2.2  bouyer             ExpectedResult, (UINT32) Obj->Integer.Value);
    355  1.1.1.2.2.2  bouyer         return (AE_ERROR);
    356  1.1.1.2.2.2  bouyer     }
    357  1.1.1.2.2.2  bouyer 
    358  1.1.1.2.2.2  bouyer     /* Reset the OSI data */
    359  1.1.1.2.2.2  bouyer 
    360  1.1.1.2.2.2  bouyer     AcpiGbl_OsiData = 0;
    361  1.1.1.2.2.2  bouyer     return (AE_OK);
    362  1.1.1.2.2.2  bouyer }
    363  1.1.1.2.2.2  bouyer 
    364  1.1.1.2.2.2  bouyer 
    365  1.1.1.2.2.2  bouyer /******************************************************************************
    366  1.1.1.2.2.2  bouyer  *
    367  1.1.1.2.2.2  bouyer  * FUNCTION:    AeGenericRegisters
    368  1.1.1.2.2.2  bouyer  *
    369  1.1.1.2.2.2  bouyer  * DESCRIPTION: Call the AcpiRead/Write interfaces.
    370  1.1.1.2.2.2  bouyer  *
    371  1.1.1.2.2.2  bouyer  *****************************************************************************/
    372  1.1.1.2.2.2  bouyer 
    373  1.1.1.2.2.2  bouyer static ACPI_GENERIC_ADDRESS       GenericRegister;
    374  1.1.1.2.2.2  bouyer 
    375  1.1.1.2.2.2  bouyer static void
    376  1.1.1.2.2.2  bouyer AeGenericRegisters (
    377  1.1.1.2.2.2  bouyer     void)
    378  1.1.1.2.2.2  bouyer {
    379  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    380  1.1.1.2.2.2  bouyer     UINT64                  Value;
    381  1.1.1.2.2.2  bouyer 
    382  1.1.1.2.2.2  bouyer 
    383  1.1.1.2.2.2  bouyer     GenericRegister.Address = 0x1234;
    384  1.1.1.2.2.2  bouyer     GenericRegister.BitWidth = 64;
    385  1.1.1.2.2.2  bouyer     GenericRegister.BitOffset = 0;
    386  1.1.1.2.2.2  bouyer     GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
    387  1.1.1.2.2.2  bouyer 
    388  1.1.1.2.2.2  bouyer     Status = AcpiRead (&Value, &GenericRegister);
    389  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiRead, Status);
    390  1.1.1.2.2.2  bouyer 
    391  1.1.1.2.2.2  bouyer     Status = AcpiWrite (Value, &GenericRegister);
    392  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWrite, Status);
    393  1.1.1.2.2.2  bouyer 
    394  1.1.1.2.2.2  bouyer     GenericRegister.Address = 0x12345678;
    395  1.1.1.2.2.2  bouyer     GenericRegister.BitOffset = 0;
    396  1.1.1.2.2.2  bouyer     GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
    397  1.1.1.2.2.2  bouyer 
    398  1.1.1.2.2.2  bouyer     Status = AcpiRead (&Value, &GenericRegister);
    399  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiRead, Status);
    400  1.1.1.2.2.2  bouyer 
    401  1.1.1.2.2.2  bouyer     Status = AcpiWrite (Value, &GenericRegister);
    402  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWrite, Status);
    403  1.1.1.2.2.2  bouyer }
    404  1.1.1.2.2.2  bouyer 
    405  1.1.1.2.2.2  bouyer 
    406  1.1.1.2.2.2  bouyer /******************************************************************************
    407  1.1.1.2.2.2  bouyer  *
    408  1.1.1.2.2.2  bouyer  * FUNCTION:    AeHardwareInterfaces
    409  1.1.1.2.2.2  bouyer  *
    410  1.1.1.2.2.2  bouyer  * DESCRIPTION: Call various hardware support interfaces
    411  1.1.1.2.2.2  bouyer  *
    412  1.1.1.2.2.2  bouyer  *****************************************************************************/
    413  1.1.1.2.2.2  bouyer 
    414  1.1.1.2.2.2  bouyer static void
    415  1.1.1.2.2.2  bouyer AeHardwareInterfaces (
    416  1.1.1.2.2.2  bouyer     void)
    417  1.1.1.2.2.2  bouyer {
    418  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    419  1.1.1.2.2.2  bouyer     UINT32                  Value;
    420  1.1.1.2.2.2  bouyer 
    421  1.1.1.2.2.2  bouyer 
    422  1.1.1.2.2.2  bouyer     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
    423  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWriteBitRegister, Status);
    424  1.1.1.2.2.2  bouyer 
    425  1.1.1.2.2.2  bouyer     Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
    426  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWriteBitRegister, Status);
    427  1.1.1.2.2.2  bouyer 
    428  1.1.1.2.2.2  bouyer     Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
    429  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWriteBitRegister, Status);
    430  1.1.1.2.2.2  bouyer 
    431  1.1.1.2.2.2  bouyer     Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
    432  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiWriteBitRegister, Status);
    433  1.1.1.2.2.2  bouyer 
    434  1.1.1.2.2.2  bouyer 
    435  1.1.1.2.2.2  bouyer     Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
    436  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReadBitRegister, Status);
    437  1.1.1.2.2.2  bouyer 
    438  1.1.1.2.2.2  bouyer     Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
    439  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReadBitRegister, Status);
    440  1.1.1.2.2.2  bouyer 
    441  1.1.1.2.2.2  bouyer     Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
    442  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReadBitRegister, Status);
    443  1.1.1.2.2.2  bouyer 
    444  1.1.1.2.2.2  bouyer     Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
    445  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReadBitRegister, Status);
    446  1.1.1.2.2.2  bouyer }
    447  1.1.1.2.2.2  bouyer 
    448  1.1.1.2.2.2  bouyer 
    449  1.1.1.2.2.2  bouyer /******************************************************************************
    450  1.1.1.2.2.2  bouyer  *
    451  1.1.1.2.2.2  bouyer  * FUNCTION:    AeMiscellaneousTests
    452  1.1.1.2.2.2  bouyer  *
    453  1.1.1.2.2.2  bouyer  * DESCRIPTION: Various ACPICA validation tests.
    454  1.1.1.2.2.2  bouyer  *
    455  1.1.1.2.2.2  bouyer  *****************************************************************************/
    456  1.1.1.2.2.2  bouyer 
    457  1.1.1.2.2.2  bouyer void
    458  1.1.1.2.2.2  bouyer AeMiscellaneousTests (
    459  1.1.1.2.2.2  bouyer     void)
    460  1.1.1.2.2.2  bouyer {
    461  1.1.1.2.2.2  bouyer     ACPI_HANDLE             Handle;
    462  1.1.1.2.2.2  bouyer     ACPI_BUFFER             ReturnBuf;
    463  1.1.1.2.2.2  bouyer     char                    Buffer[32];
    464  1.1.1.2.2.2  bouyer     ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
    465  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    466  1.1.1.2.2.2  bouyer     UINT32                  LockHandle1;
    467  1.1.1.2.2.2  bouyer     UINT32                  LockHandle2;
    468  1.1.1.2.2.2  bouyer     ACPI_STATISTICS         Stats;
    469  1.1.1.2.2.2  bouyer 
    470  1.1.1.2.2.2  bouyer 
    471  1.1.1.2.2.2  bouyer     AeHardwareInterfaces ();
    472  1.1.1.2.2.2  bouyer     AeGenericRegisters ();
    473  1.1.1.2.2.2  bouyer     AeSetupConfiguration (Ssdt3Code);
    474  1.1.1.2.2.2  bouyer 
    475  1.1.1.2.2.2  bouyer     AeTestBufferArgument();
    476  1.1.1.2.2.2  bouyer     AeTestPackageArgument ();
    477  1.1.1.2.2.2  bouyer 
    478  1.1.1.2.2.2  bouyer 
    479  1.1.1.2.2.2  bouyer     Status = AcpiInstallInterface ("");
    480  1.1.1.2.2.2  bouyer     AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
    481  1.1.1.2.2.2  bouyer 
    482  1.1.1.2.2.2  bouyer     Status = AcpiInstallInterface ("TestString");
    483  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallInterface, Status);
    484  1.1.1.2.2.2  bouyer 
    485  1.1.1.2.2.2  bouyer     Status = AcpiInstallInterface ("TestString");
    486  1.1.1.2.2.2  bouyer     AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
    487  1.1.1.2.2.2  bouyer 
    488  1.1.1.2.2.2  bouyer     Status = AcpiRemoveInterface ("Windows 2006");
    489  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiRemoveInterface, Status);
    490  1.1.1.2.2.2  bouyer 
    491  1.1.1.2.2.2  bouyer     Status = AcpiRemoveInterface ("TestString");
    492  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiRemoveInterface, Status);
    493  1.1.1.2.2.2  bouyer 
    494  1.1.1.2.2.2  bouyer     Status = AcpiRemoveInterface ("XXXXXX");
    495  1.1.1.2.2.2  bouyer     AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
    496  1.1.1.2.2.2  bouyer 
    497  1.1.1.2.2.2  bouyer     Status = AcpiInstallInterface ("AnotherTestString");
    498  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallInterface, Status);
    499  1.1.1.2.2.2  bouyer 
    500  1.1.1.2.2.2  bouyer 
    501  1.1.1.2.2.2  bouyer     Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
    502  1.1.1.2.2.2  bouyer     AE_CHECK_OK (ExecuteOSI, Status);
    503  1.1.1.2.2.2  bouyer 
    504  1.1.1.2.2.2  bouyer     Status = ExecuteOSI ("MichiganTerminalSystem", 0);
    505  1.1.1.2.2.2  bouyer     AE_CHECK_OK (ExecuteOSI, Status);
    506  1.1.1.2.2.2  bouyer 
    507  1.1.1.2.2.2  bouyer 
    508  1.1.1.2.2.2  bouyer     ReturnBuf.Length = 32;
    509  1.1.1.2.2.2  bouyer     ReturnBuf.Pointer = Buffer;
    510  1.1.1.2.2.2  bouyer 
    511  1.1.1.2.2.2  bouyer     Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
    512  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiGetName, Status);
    513  1.1.1.2.2.2  bouyer 
    514  1.1.1.2.2.2  bouyer     Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
    515  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableEvent, Status);
    516  1.1.1.2.2.2  bouyer 
    517  1.1.1.2.2.2  bouyer     Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
    518  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
    519  1.1.1.2.2.2  bouyer 
    520  1.1.1.2.2.2  bouyer     /*
    521  1.1.1.2.2.2  bouyer      * GPEs: Handlers, enable/disable, etc.
    522  1.1.1.2.2.2  bouyer      */
    523  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    524  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    525  1.1.1.2.2.2  bouyer 
    526  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 0);
    527  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    528  1.1.1.2.2.2  bouyer 
    529  1.1.1.2.2.2  bouyer     Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
    530  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
    531  1.1.1.2.2.2  bouyer 
    532  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    533  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    534  1.1.1.2.2.2  bouyer 
    535  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 0);
    536  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    537  1.1.1.2.2.2  bouyer 
    538  1.1.1.2.2.2  bouyer     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
    539  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiSetGpe, Status);
    540  1.1.1.2.2.2  bouyer 
    541  1.1.1.2.2.2  bouyer     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
    542  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiSetGpe, Status);
    543  1.1.1.2.2.2  bouyer 
    544  1.1.1.2.2.2  bouyer 
    545  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    546  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    547  1.1.1.2.2.2  bouyer 
    548  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 1);
    549  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    550  1.1.1.2.2.2  bouyer 
    551  1.1.1.2.2.2  bouyer 
    552  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    553  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    554  1.1.1.2.2.2  bouyer 
    555  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 2);
    556  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    557  1.1.1.2.2.2  bouyer 
    558  1.1.1.2.2.2  bouyer 
    559  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    560  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    561  1.1.1.2.2.2  bouyer 
    562  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    563  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    564  1.1.1.2.2.2  bouyer 
    565  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    566  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    567  1.1.1.2.2.2  bouyer 
    568  1.1.1.2.2.2  bouyer     Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
    569  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiGetHandle, Status);
    570  1.1.1.2.2.2  bouyer 
    571  1.1.1.2.2.2  bouyer     Status = AcpiSetupGpeForWake (Handle, NULL, 5);
    572  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiSetupGpeForWake, Status);
    573  1.1.1.2.2.2  bouyer 
    574  1.1.1.2.2.2  bouyer     Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
    575  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiGpeWakeup, Status);
    576  1.1.1.2.2.2  bouyer 
    577  1.1.1.2.2.2  bouyer     Status = AcpiSetupGpeForWake (Handle, NULL, 6);
    578  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiSetupGpeForWake, Status);
    579  1.1.1.2.2.2  bouyer 
    580  1.1.1.2.2.2  bouyer     Status = AcpiSetupGpeForWake (Handle, NULL, 9);
    581  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiSetupGpeForWake, Status);
    582  1.1.1.2.2.2  bouyer 
    583  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    584  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    585  1.1.1.2.2.2  bouyer 
    586  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 0x19);
    587  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    588  1.1.1.2.2.2  bouyer 
    589  1.1.1.2.2.2  bouyer 
    590  1.1.1.2.2.2  bouyer     Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    591  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiInstallGpeHandler, Status);
    592  1.1.1.2.2.2  bouyer 
    593  1.1.1.2.2.2  bouyer     Status = AcpiEnableGpe (NULL, 0x62);
    594  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiEnableGpe, Status);
    595  1.1.1.2.2.2  bouyer 
    596  1.1.1.2.2.2  bouyer     Status = AcpiDisableGpe (NULL, 0x62);
    597  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiDisableGpe, Status);
    598  1.1.1.2.2.2  bouyer 
    599  1.1.1.2.2.2  bouyer     AfInstallGpeBlock ();
    600  1.1.1.2.2.2  bouyer 
    601  1.1.1.2.2.2  bouyer     /* Here is where the GPEs are actually "enabled" */
    602  1.1.1.2.2.2  bouyer 
    603  1.1.1.2.2.2  bouyer     Status = AcpiUpdateAllGpes ();
    604  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiUpdateAllGpes, Status);
    605  1.1.1.2.2.2  bouyer 
    606  1.1.1.2.2.2  bouyer     Status = AcpiGetHandle (NULL, "RSRC", &Handle);
    607  1.1.1.2.2.2  bouyer     if (ACPI_SUCCESS (Status))
    608  1.1.1.2.2.2  bouyer     {
    609  1.1.1.2.2.2  bouyer         ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
    610  1.1.1.2.2.2  bouyer 
    611  1.1.1.2.2.2  bouyer         Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
    612  1.1.1.2.2.2  bouyer         if (ACPI_SUCCESS (Status))
    613  1.1.1.2.2.2  bouyer         {
    614  1.1.1.2.2.2  bouyer             AcpiOsFree (ReturnBuf.Pointer);
    615  1.1.1.2.2.2  bouyer         }
    616  1.1.1.2.2.2  bouyer     }
    617  1.1.1.2.2.2  bouyer 
    618  1.1.1.2.2.2  bouyer     /* Test global lock */
    619  1.1.1.2.2.2  bouyer 
    620  1.1.1.2.2.2  bouyer     Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
    621  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
    622  1.1.1.2.2.2  bouyer 
    623  1.1.1.2.2.2  bouyer     Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
    624  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
    625  1.1.1.2.2.2  bouyer 
    626  1.1.1.2.2.2  bouyer     Status = AcpiReleaseGlobalLock (LockHandle1);
    627  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
    628  1.1.1.2.2.2  bouyer 
    629  1.1.1.2.2.2  bouyer     Status = AcpiReleaseGlobalLock (LockHandle2);
    630  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
    631  1.1.1.2.2.2  bouyer 
    632  1.1.1.2.2.2  bouyer     /* Get Devices */
    633  1.1.1.2.2.2  bouyer 
    634  1.1.1.2.2.2  bouyer     Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
    635  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiGetDevices, Status);
    636  1.1.1.2.2.2  bouyer 
    637  1.1.1.2.2.2  bouyer     Status = AcpiGetStatistics (&Stats);
    638  1.1.1.2.2.2  bouyer     AE_CHECK_OK (AcpiGetStatistics, Status);
    639  1.1.1.2.2.2  bouyer }
    640  1.1.1.2.2.2  bouyer 
    641