Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /******************************************************************************
  2.  *
  3.  * Module Name: aeexec - Support routines for AcpiExec utility
  4.  *
  5.  *****************************************************************************/
  6.  
  7. /******************************************************************************
  8.  *
  9.  * 1. Copyright Notice
  10.  *
  11.  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
  12.  * All rights reserved.
  13.  *
  14.  * 2. License
  15.  *
  16.  * 2.1. This is your license from Intel Corp. under its intellectual property
  17.  * rights.  You may have additional license terms from the party that provided
  18.  * you this software, covering your right to use that party's intellectual
  19.  * property rights.
  20.  *
  21.  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  22.  * copy of the source code appearing in this file ("Covered Code") an
  23.  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  24.  * base code distributed originally by Intel ("Original Intel Code") to copy,
  25.  * make derivatives, distribute, use and display any portion of the Covered
  26.  * Code in any form, with the right to sublicense such rights; and
  27.  *
  28.  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  29.  * license (with the right to sublicense), under only those claims of Intel
  30.  * patents that are infringed by the Original Intel Code, to make, use, sell,
  31.  * offer to sell, and import the Covered Code and derivative works thereof
  32.  * solely to the minimum extent necessary to exercise the above copyright
  33.  * license, and in no event shall the patent license extend to any additions
  34.  * to or modifications of the Original Intel Code.  No other license or right
  35.  * is granted directly or by implication, estoppel or otherwise;
  36.  *
  37.  * The above copyright and patent license is granted only if the following
  38.  * conditions are met:
  39.  *
  40.  * 3. Conditions
  41.  *
  42.  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  43.  * Redistribution of source code of any substantial portion of the Covered
  44.  * Code or modification with rights to further distribute source must include
  45.  * the above Copyright Notice, the above License, this list of Conditions,
  46.  * and the following Disclaimer and Export Compliance provision.  In addition,
  47.  * Licensee must cause all Covered Code to which Licensee contributes to
  48.  * contain a file documenting the changes Licensee made to create that Covered
  49.  * Code and the date of any change.  Licensee must include in that file the
  50.  * documentation of any changes made by any predecessor Licensee.  Licensee
  51.  * must include a prominent statement that the modification is derived,
  52.  * directly or indirectly, from Original Intel Code.
  53.  *
  54.  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
  55.  * Redistribution of source code of any substantial portion of the Covered
  56.  * Code or modification without rights to further distribute source must
  57.  * include the following Disclaimer and Export Compliance provision in the
  58.  * documentation and/or other materials provided with distribution.  In
  59.  * addition, Licensee may not authorize further sublicense of source of any
  60.  * portion of the Covered Code, and must include terms to the effect that the
  61.  * license from Licensee to its licensee is limited to the intellectual
  62.  * property embodied in the software Licensee provides to its licensee, and
  63.  * not to intellectual property embodied in modifications its licensee may
  64.  * make.
  65.  *
  66.  * 3.3. Redistribution of Executable. Redistribution in executable form of any
  67.  * substantial portion of the Covered Code or modification must reproduce the
  68.  * above Copyright Notice, and the following Disclaimer and Export Compliance
  69.  * provision in the documentation and/or other materials provided with the
  70.  * distribution.
  71.  *
  72.  * 3.4. Intel retains all right, title, and interest in and to the Original
  73.  * Intel Code.
  74.  *
  75.  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  76.  * Intel shall be used in advertising or otherwise to promote the sale, use or
  77.  * other dealings in products derived from or relating to the Covered Code
  78.  * without prior written authorization from Intel.
  79.  *
  80.  * 4. Disclaimer and Export Compliance
  81.  *
  82.  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  83.  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  84.  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
  85.  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
  86.  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
  87.  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  88.  * PARTICULAR PURPOSE.
  89.  *
  90.  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  91.  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  92.  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  93.  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  94.  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  95.  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
  96.  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  97.  * LIMITED REMEDY.
  98.  *
  99.  * 4.3. Licensee shall not export, either directly or indirectly, any of this
  100.  * software or system incorporating such software without first obtaining any
  101.  * required license or other approval from the U. S. Department of Commerce or
  102.  * any other agency or department of the United States Government.  In the
  103.  * event Licensee exports any such software from the United States or
  104.  * re-exports any such software from a foreign destination, Licensee shall
  105.  * ensure that the distribution and export/re-export of the software is in
  106.  * compliance with all laws, regulations, orders, or other restrictions of the
  107.  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  108.  * any of its subsidiaries will export/re-export any technical data, process,
  109.  * software, or service, directly or indirectly, to any country for which the
  110.  * United States government or any agency thereof requires an export license,
  111.  * other governmental approval, or letter of assurance, without first obtaining
  112.  * such license, approval or letter.
  113.  *
  114.  *****************************************************************************/
  115.  
  116. #include "aecommon.h"
  117.  
  118. #define _COMPONENT          ACPI_TOOLS
  119.         ACPI_MODULE_NAME    ("aeexec")
  120.  
  121. /* Local prototypes */
  122.  
  123. ACPI_STATUS
  124. AeSetupConfiguration (
  125.     void                    *RegionAddr);
  126.  
  127. void
  128. AfInstallGpeBlock (
  129.     void);
  130.  
  131. void
  132. AeTestBufferArgument (
  133.     void);
  134.  
  135. void
  136. AeTestPackageArgument (
  137.     void);
  138.  
  139. ACPI_STATUS
  140. AeGetDevices (
  141.     ACPI_HANDLE             ObjHandle,
  142.     UINT32                  NestingLevel,
  143.     void                    *Context,
  144.     void                    **ReturnValue);
  145.  
  146. ACPI_STATUS
  147. ExecuteOSI (
  148.     char                    *OsiString,
  149.     UINT32                  ExpectedResult);
  150.  
  151. void
  152. AeHardwareInterfaces (
  153.     void);
  154.  
  155. void
  156. AeGenericRegisters (
  157.     void);
  158.  
  159. extern unsigned char Ssdt3Code[];
  160.  
  161.  
  162. /******************************************************************************
  163.  *
  164.  * FUNCTION:    AeSetupConfiguration
  165.  *
  166.  * PARAMETERS:  RegionAddr          - Address for an ACPI table to be loaded
  167.  *                                    dynamically. Test purposes only.
  168.  *
  169.  * RETURN:      Status
  170.  *
  171.  * DESCRIPTION: Call AML _CFG configuration control method
  172.  *
  173.  *****************************************************************************/
  174.  
  175. ACPI_STATUS
  176. AeSetupConfiguration (
  177.     void                    *RegionAddr)
  178. {
  179.     ACPI_STATUS             Status;
  180.     ACPI_OBJECT_LIST        ArgList;
  181.     ACPI_OBJECT             Arg[3];
  182.  
  183.  
  184.     /*
  185.      * Invoke _CFG method if present
  186.      */
  187.     ArgList.Count = 1;
  188.     ArgList.Pointer = Arg;
  189.  
  190.     Arg[0].Type = ACPI_TYPE_INTEGER;
  191.     Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
  192.  
  193.     Status = AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
  194.  
  195.     return (AE_OK);
  196. }
  197.  
  198.  
  199. /******************************************************************************
  200.  *
  201.  * FUNCTION:    AfInstallGpeBlock
  202.  *
  203.  * PARAMETERS:  None
  204.  *
  205.  * RETURN:      None
  206.  *
  207.  * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
  208.  *              A \GPE2 device.
  209.  *
  210.  *****************************************************************************/
  211.  
  212. void
  213. AfInstallGpeBlock (
  214.     void)
  215. {
  216.     ACPI_STATUS                 Status;
  217.     ACPI_HANDLE                 Handle;
  218.     ACPI_HANDLE                 Handle2 = NULL;
  219.     ACPI_HANDLE                 Handle3 = NULL;
  220.     ACPI_GENERIC_ADDRESS        BlockAddress;
  221.     ACPI_HANDLE                 GpeDevice;
  222.  
  223.  
  224.     Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
  225.     if (ACPI_FAILURE (Status))
  226.     {
  227.         return;
  228.     }
  229.  
  230.     ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
  231.     BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
  232.     BlockAddress.Address = 0x76540000;
  233.  
  234.     Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
  235.     if (ACPI_SUCCESS (Status))
  236.     {
  237.         Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
  238.  
  239.         AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  240.         AcpiEnableGpe (Handle2, 8, ACPI_GPE_TYPE_RUNTIME);
  241.  
  242.         Status = AcpiGetGpeDevice (0x30, &GpeDevice);
  243.         Status = AcpiGetGpeDevice (0x42, &GpeDevice);
  244.         Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
  245.         Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
  246.  
  247.         AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
  248.     }
  249.  
  250.     Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
  251.     if (ACPI_SUCCESS (Status))
  252.     {
  253.         Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
  254.     }
  255. }
  256.  
  257.  
  258. /* Test using a Buffer object as a method argument */
  259.  
  260. void
  261. AeTestBufferArgument (
  262.     void)
  263. {
  264.     ACPI_STATUS             Status;
  265.     ACPI_OBJECT_LIST        Params;
  266.     ACPI_OBJECT             BufArg;
  267.     UINT8                   Buffer[] = {
  268.         0,0,0,0,
  269.         4,0,0,0,
  270.         1,2,3,4};
  271.  
  272.  
  273.     BufArg.Type = ACPI_TYPE_BUFFER;
  274.     BufArg.Buffer.Length = 12;
  275.     BufArg.Buffer.Pointer = Buffer;
  276.  
  277.     Params.Count = 1;
  278.     Params.Pointer = &BufArg;
  279.  
  280.  
  281.     Status = AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
  282. }
  283.  
  284.  
  285. ACPI_OBJECT                 PkgArg;
  286. ACPI_OBJECT                 PkgElements[5];
  287. ACPI_OBJECT                 Pkg2Elements[5];
  288. ACPI_OBJECT_LIST            Params;
  289.  
  290.  
  291. /*
  292.  * Test using a Package object as an method argument
  293.  */
  294. void
  295. AeTestPackageArgument (
  296.     void)
  297. {
  298.     ACPI_STATUS             Status;
  299.  
  300.  
  301.     /* Main package */
  302.  
  303.     PkgArg.Type = ACPI_TYPE_PACKAGE;
  304.     PkgArg.Package.Count = 4;
  305.     PkgArg.Package.Elements = PkgElements;
  306.  
  307.     /* Main package elements */
  308.  
  309.     PkgElements[0].Type = ACPI_TYPE_INTEGER;
  310.     PkgElements[0].Integer.Value = 0x22228888;
  311.  
  312.     PkgElements[1].Type = ACPI_TYPE_STRING;
  313.     PkgElements[1].String.Length = sizeof ("Top-level package");
  314.     PkgElements[1].String.Pointer = "Top-level package";
  315.  
  316.     PkgElements[2].Type = ACPI_TYPE_BUFFER;
  317.     PkgElements[2].Buffer.Length = sizeof ("XXXX");
  318.     PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX";
  319.  
  320.     PkgElements[3].Type = ACPI_TYPE_PACKAGE;
  321.     PkgElements[3].Package.Count = 2;
  322.     PkgElements[3].Package.Elements = Pkg2Elements;
  323.  
  324.     /* Sub-package elements */
  325.  
  326.     Pkg2Elements[0].Type = ACPI_TYPE_INTEGER;
  327.     Pkg2Elements[0].Integer.Value = 0xAAAABBBB;
  328.  
  329.     Pkg2Elements[1].Type = ACPI_TYPE_STRING;
  330.     Pkg2Elements[1].String.Length = sizeof ("Nested Package");
  331.     Pkg2Elements[1].String.Pointer = "Nested Package";
  332.  
  333.     /* Parameter object */
  334.  
  335.     Params.Count = 1;
  336.     Params.Pointer = &PkgArg;
  337.  
  338.     Status = AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
  339. }
  340.  
  341.  
  342. ACPI_STATUS
  343. AeGetDevices (
  344.     ACPI_HANDLE                     ObjHandle,
  345.     UINT32                          NestingLevel,
  346.     void                            *Context,
  347.     void                            **ReturnValue)
  348. {
  349.  
  350.     return (AE_OK);
  351. }
  352.  
  353.  
  354. /******************************************************************************
  355.  *
  356.  * FUNCTION:    ExecuteOSI
  357.  *
  358.  * PARAMETERS:  OsiString           - String passed to _OSI method
  359.  *              ExpectedResult      - 0 (FALSE) or 0xFFFFFFFF (TRUE)
  360.  *
  361.  * RETURN:      Status
  362.  *
  363.  * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
  364.  *
  365.  *****************************************************************************/
  366.  
  367. ACPI_STATUS
  368. ExecuteOSI (
  369.     char                    *OsiString,
  370.     UINT32                  ExpectedResult)
  371. {
  372.     ACPI_STATUS             Status;
  373.     ACPI_OBJECT_LIST        ArgList;
  374.     ACPI_OBJECT             Arg[1];
  375.     ACPI_BUFFER             ReturnValue;
  376.     ACPI_OBJECT             *Obj;
  377.  
  378.  
  379.     /* Setup input argument */
  380.  
  381.     ArgList.Count = 1;
  382.     ArgList.Pointer = Arg;
  383.  
  384.     Arg[0].Type = ACPI_TYPE_STRING;
  385.     Arg[0].String.Pointer = OsiString;
  386.     Arg[0].String.Length = strlen (Arg[0].String.Pointer);
  387.  
  388.     /* Ask ACPICA to allocate space for the return object */
  389.  
  390.     ReturnValue.Length = ACPI_ALLOCATE_BUFFER;
  391.  
  392.     Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
  393.  
  394.     if (ACPI_FAILURE (Status))
  395.     {
  396.         AcpiOsPrintf ("Could not execute _OSI method, %s\n",
  397.             AcpiFormatException (Status));
  398.         return (Status);
  399.     }
  400.  
  401.     if (ReturnValue.Length < sizeof (ACPI_OBJECT))
  402.     {
  403.         AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
  404.             ReturnValue.Length);
  405.         return (AE_ERROR);
  406.     }
  407.  
  408.     Obj = ReturnValue.Pointer;
  409.     if (Obj->Type != ACPI_TYPE_INTEGER)
  410.     {
  411.         AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type);
  412.         return (AE_ERROR);
  413.     }
  414.  
  415.     if (Obj->Integer.Value != ExpectedResult)
  416.     {
  417.         AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n",
  418.             ExpectedResult, (UINT32) Obj->Integer.Value);
  419.         return (AE_ERROR);
  420.     }
  421.  
  422.     /* Reset the OSI data */
  423.  
  424.     AcpiGbl_OsiData = 0;
  425.     return (AE_OK);
  426. }
  427.  
  428.  
  429. /******************************************************************************
  430.  *
  431.  * FUNCTION:    AeGenericRegisters
  432.  *
  433.  * DESCRIPTION: Call the AcpiRead/Write interfaces.
  434.  *
  435.  *****************************************************************************/
  436.  
  437. ACPI_GENERIC_ADDRESS       GenericRegister;
  438.  
  439. void
  440. AeGenericRegisters (
  441.     void)
  442. {
  443.     ACPI_STATUS             Status;
  444.     UINT64                  Value;
  445.  
  446.  
  447.     GenericRegister.Address = 0x1234;
  448.     GenericRegister.BitWidth = 64;
  449.     GenericRegister.BitOffset = 0;
  450.     GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
  451.  
  452.     Status = AcpiRead (&Value, &GenericRegister);
  453.     Status = AcpiWrite (Value, &GenericRegister);
  454.  
  455.     GenericRegister.Address = 0x12345678;
  456.     GenericRegister.BitOffset = 0;
  457.     GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
  458.  
  459.     Status = AcpiRead (&Value, &GenericRegister);
  460.     Status = AcpiWrite (Value, &GenericRegister);
  461. }
  462.  
  463.  
  464. /******************************************************************************
  465.  *
  466.  * FUNCTION:    AeHardwareInterfaces
  467.  *
  468.  * DESCRIPTION: Call various hardware support interfaces
  469.  *
  470.  *****************************************************************************/
  471.  
  472. void
  473. AeHardwareInterfaces (
  474.     void)
  475. {
  476.     ACPI_STATUS             Status;
  477.     UINT32                  Value;
  478.  
  479.  
  480.     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
  481.     Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
  482.     Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
  483.     Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
  484.  
  485.     Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
  486.     Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
  487.     Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
  488.     Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
  489. }
  490.  
  491.  
  492. /******************************************************************************
  493.  *
  494.  * FUNCTION:    AeMiscellaneousTests
  495.  *
  496.  * DESCRIPTION: Various ACPICA validation tests.
  497.  *
  498.  *****************************************************************************/
  499.  
  500. void
  501. AeMiscellaneousTests (
  502.     void)
  503. {
  504.     ACPI_HANDLE             Handle;
  505.     ACPI_BUFFER             ReturnBuf;
  506.     char                    Buffer[32];
  507.     ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
  508.     ACPI_STATUS             Status;
  509.     UINT32                  LockHandle1;
  510.     UINT32                  LockHandle2;
  511.     ACPI_STATISTICS         Stats;
  512.  
  513.  
  514.     AeHardwareInterfaces ();
  515.     AeGenericRegisters ();
  516.     AeSetupConfiguration (Ssdt3Code);
  517.  
  518.     AeTestBufferArgument();
  519.     AeTestPackageArgument ();
  520.     ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
  521.     ExecuteOSI ("MichiganTerminalSystem", 0);
  522.  
  523.  
  524.     ReturnBuf.Length = 32;
  525.     ReturnBuf.Pointer = Buffer;
  526.  
  527.     AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
  528.     AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
  529.  
  530.     /*
  531.      * GPEs: Handlers, enable/disable, etc.
  532.      */
  533.     AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  534.     AcpiEnableGpe (NULL, 0, ACPI_GPE_TYPE_RUNTIME);
  535.     AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
  536.  
  537.     AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  538.     AcpiEnableGpe (NULL, 0, ACPI_GPE_TYPE_RUNTIME);
  539.     AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
  540.     AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
  541.  
  542.     AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
  543.     AcpiEnableGpe (NULL, 1, ACPI_GPE_TYPE_RUNTIME);
  544.  
  545.     AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  546.     AcpiEnableGpe (NULL, 2, ACPI_GPE_TYPE_RUNTIME);
  547.  
  548.     AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
  549.     AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  550.     AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
  551.  
  552.     AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  553.     AcpiEnableGpe (NULL, 0x19, ACPI_GPE_TYPE_RUNTIME);
  554.  
  555.     AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
  556.     AcpiEnableGpe (NULL, 0x62, ACPI_GPE_TYPE_RUNTIME);
  557.     AcpiDisableGpe (NULL, 0x62, ACPI_GPE_TYPE_RUNTIME);
  558.  
  559.     AfInstallGpeBlock ();
  560.  
  561.  
  562.     Status = AcpiGetHandle (NULL, "RSRC", &Handle);
  563.     if (ACPI_SUCCESS (Status))
  564.     {
  565.         ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
  566.  
  567.         Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
  568.         if (ACPI_SUCCESS (Status))
  569.         {
  570.             AcpiOsFree (ReturnBuf.Pointer);
  571.         }
  572.     }
  573.  
  574.     /* Test global lock */
  575.  
  576.     Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
  577.     if (ACPI_FAILURE (Status))
  578.     {
  579.         AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
  580.     }
  581.  
  582.     Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
  583.     if (ACPI_FAILURE (Status))
  584.     {
  585.         AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
  586.     }
  587.  
  588.     Status = AcpiReleaseGlobalLock (LockHandle1);
  589.     if (ACPI_FAILURE (Status))
  590.     {
  591.         AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
  592.     }
  593.  
  594.     Status = AcpiReleaseGlobalLock (LockHandle2);
  595.     if (ACPI_FAILURE (Status))
  596.     {
  597.         AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
  598.     }
  599.  
  600.     /* Get Devices */
  601.  
  602.     Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
  603.     if (ACPI_FAILURE (Status))
  604.     {
  605.         AcpiOsPrintf ("Could not AcpiGetDevices, %X\n", Status);
  606.     }
  607.  
  608.     Status = AcpiGetStatistics (&Stats);
  609.     if (ACPI_FAILURE (Status))
  610.     {
  611.         AcpiOsPrintf ("Could not AcpiGetStatistics, %X\n", Status);
  612.     }
  613. }
  614.  
  615.