1 /******************************************************************************
3 * Module Name: aeexec - Support routines for AcpiExec utility
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
12 * All rights reserved.
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
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
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;
37 * The above copyright and patent license is granted only if the following
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.
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
80 * 4. Disclaimer and Export Compliance
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
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
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.
114 *****************************************************************************/
116 #include "aecommon.h"
118 #define _COMPONENT ACPI_TOOLS
119 ACPI_MODULE_NAME ("aeexec")
121 /* Local prototypes */
124 AeSetupConfiguration (
128 AeTestBufferArgument (
132 AeTestPackageArgument (
137 ACPI_HANDLE ObjHandle,
145 UINT32 ExpectedResult);
152 AeHardwareInterfaces (
159 #if (!ACPI_REDUCED_HARDWARE)
163 #endif /* !ACPI_REDUCED_HARDWARE */
165 extern unsigned char Ssdt2Code[];
166 extern unsigned char Ssdt3Code[];
167 extern unsigned char Ssdt4Code[];
170 /******************************************************************************
172 * FUNCTION: AeSetupConfiguration
174 * PARAMETERS: RegionAddr - Address for an ACPI table to be loaded
175 * dynamically. Test purposes only.
179 * DESCRIPTION: Call AML _CFG configuration control method
181 *****************************************************************************/
184 AeSetupConfiguration (
187 ACPI_OBJECT_LIST ArgList;
192 * Invoke _CFG method if present
195 ArgList.Pointer = Arg;
197 Arg[0].Type = ACPI_TYPE_INTEGER;
198 Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
200 (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
205 #if (!ACPI_REDUCED_HARDWARE)
206 /******************************************************************************
208 * FUNCTION: AfInstallGpeBlock
214 * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
217 *****************************************************************************/
225 ACPI_HANDLE Handle2 = NULL;
226 ACPI_HANDLE Handle3 = NULL;
227 ACPI_GENERIC_ADDRESS BlockAddress;
228 ACPI_HANDLE GpeDevice;
231 Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
232 if (ACPI_FAILURE (Status))
237 ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
238 BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
239 BlockAddress.Address = 0x76540000;
241 Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
242 if (ACPI_SUCCESS (Status))
244 Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
245 AE_CHECK_OK (AcpiInstallGpeBlock, Status);
247 Status = AcpiInstallGpeHandler (Handle2, 8,
248 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
249 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
251 Status = AcpiEnableGpe (Handle2, 8);
252 AE_CHECK_OK (AcpiEnableGpe, Status);
254 Status = AcpiGetGpeDevice (0x30, &GpeDevice);
255 AE_CHECK_OK (AcpiGetGpeDevice, Status);
257 Status = AcpiGetGpeDevice (0x42, &GpeDevice);
258 AE_CHECK_OK (AcpiGetGpeDevice, Status);
260 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
261 AE_CHECK_OK (AcpiGetGpeDevice, Status);
263 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
264 AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
266 Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
267 AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
270 Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
271 if (ACPI_SUCCESS (Status))
273 Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
274 AE_CHECK_OK (AcpiInstallGpeBlock, Status);
277 #endif /* !ACPI_REDUCED_HARDWARE */
280 /* Test using a Buffer object as a method argument */
283 AeTestBufferArgument (
286 ACPI_OBJECT_LIST Params;
294 BufArg.Type = ACPI_TYPE_BUFFER;
295 BufArg.Buffer.Length = 12;
296 BufArg.Buffer.Pointer = Buffer;
299 Params.Pointer = &BufArg;
301 (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
305 static ACPI_OBJECT PkgArg;
306 static ACPI_OBJECT PkgElements[5];
307 static ACPI_OBJECT Pkg2Elements[5];
308 static ACPI_OBJECT_LIST Params;
312 * Test using a Package object as an method argument
315 AeTestPackageArgument (
321 PkgArg.Type = ACPI_TYPE_PACKAGE;
322 PkgArg.Package.Count = 4;
323 PkgArg.Package.Elements = PkgElements;
325 /* Main package elements */
327 PkgElements[0].Type = ACPI_TYPE_INTEGER;
328 PkgElements[0].Integer.Value = 0x22228888;
330 PkgElements[1].Type = ACPI_TYPE_STRING;
331 PkgElements[1].String.Length = sizeof ("Top-level package");
332 PkgElements[1].String.Pointer = "Top-level package";
334 PkgElements[2].Type = ACPI_TYPE_BUFFER;
335 PkgElements[2].Buffer.Length = sizeof ("XXXX");
336 PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX";
338 PkgElements[3].Type = ACPI_TYPE_PACKAGE;
339 PkgElements[3].Package.Count = 2;
340 PkgElements[3].Package.Elements = Pkg2Elements;
342 /* Sub-package elements */
344 Pkg2Elements[0].Type = ACPI_TYPE_INTEGER;
345 Pkg2Elements[0].Integer.Value = 0xAAAABBBB;
347 Pkg2Elements[1].Type = ACPI_TYPE_STRING;
348 Pkg2Elements[1].String.Length = sizeof ("Nested Package");
349 Pkg2Elements[1].String.Pointer = "Nested Package";
351 /* Parameter object */
354 Params.Pointer = &PkgArg;
356 (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
362 ACPI_HANDLE ObjHandle,
372 /******************************************************************************
374 * FUNCTION: ExecuteOSI
376 * PARAMETERS: OsiString - String passed to _OSI method
377 * ExpectedResult - 0 (FALSE) or 0xFFFFFFFF (TRUE)
381 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
383 *****************************************************************************/
388 UINT32 ExpectedResult)
391 ACPI_OBJECT_LIST ArgList;
393 ACPI_BUFFER ReturnValue;
397 /* Setup input argument */
400 ArgList.Pointer = Arg;
402 Arg[0].Type = ACPI_TYPE_STRING;
403 Arg[0].String.Pointer = OsiString;
404 Arg[0].String.Length = strlen (Arg[0].String.Pointer);
406 /* Ask ACPICA to allocate space for the return object */
408 ReturnValue.Length = ACPI_ALLOCATE_BUFFER;
410 Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
412 if (ACPI_FAILURE (Status))
414 AcpiOsPrintf ("Could not execute _OSI method, %s\n",
415 AcpiFormatException (Status));
419 if (ReturnValue.Length < sizeof (ACPI_OBJECT))
421 AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
426 Obj = ReturnValue.Pointer;
427 if (Obj->Type != ACPI_TYPE_INTEGER)
429 AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type);
433 if (Obj->Integer.Value != ExpectedResult)
435 AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n",
436 ExpectedResult, (UINT32) Obj->Integer.Value);
440 /* Reset the OSI data */
447 /******************************************************************************
449 * FUNCTION: AeGenericRegisters
451 * DESCRIPTION: Call the AcpiRead/Write interfaces.
453 *****************************************************************************/
455 static ACPI_GENERIC_ADDRESS GenericRegister;
465 GenericRegister.Address = 0x1234;
466 GenericRegister.BitWidth = 64;
467 GenericRegister.BitOffset = 0;
468 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
470 Status = AcpiRead (&Value, &GenericRegister);
471 AE_CHECK_OK (AcpiRead, Status);
473 Status = AcpiWrite (Value, &GenericRegister);
474 AE_CHECK_OK (AcpiWrite, Status);
476 GenericRegister.Address = 0x12345678;
477 GenericRegister.BitOffset = 0;
478 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
480 Status = AcpiRead (&Value, &GenericRegister);
481 AE_CHECK_OK (AcpiRead, Status);
483 Status = AcpiWrite (Value, &GenericRegister);
484 AE_CHECK_OK (AcpiWrite, Status);
488 /******************************************************************************
490 * FUNCTION: AeMutexInterfaces
492 * DESCRIPTION: Exercise the AML mutex access interfaces
494 *****************************************************************************/
501 ACPI_HANDLE MutexHandle;
504 /* Get a handle to an AML mutex */
506 Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
507 if (Status == AE_NOT_FOUND)
512 AE_CHECK_OK (AcpiGetHandle, Status);
513 if (ACPI_FAILURE (Status))
518 /* Acquire the mutex */
520 Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
521 AE_CHECK_OK (AcpiAcquireMutex, Status);
522 if (ACPI_FAILURE (Status))
527 /* Release mutex with different parameters */
529 Status = AcpiReleaseMutex (MutexHandle, NULL);
530 AE_CHECK_OK (AcpiReleaseMutex, Status);
534 /******************************************************************************
536 * FUNCTION: AeHardwareInterfaces
538 * DESCRIPTION: Call various hardware support interfaces
540 *****************************************************************************/
543 AeHardwareInterfaces (
546 #if (!ACPI_REDUCED_HARDWARE)
552 /* If Hardware Reduced flag is set, we are all done */
554 if (AcpiGbl_ReducedHardware)
559 Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
560 AE_CHECK_OK (AcpiWriteBitRegister, Status);
562 Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
563 AE_CHECK_OK (AcpiWriteBitRegister, Status);
565 Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
566 AE_CHECK_OK (AcpiWriteBitRegister, Status);
568 Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
569 AE_CHECK_OK (AcpiWriteBitRegister, Status);
572 Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
573 AE_CHECK_OK (AcpiReadBitRegister, Status);
575 Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
576 AE_CHECK_OK (AcpiReadBitRegister, Status);
578 Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
579 AE_CHECK_OK (AcpiReadBitRegister, Status);
581 Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
582 AE_CHECK_OK (AcpiReadBitRegister, Status);
584 #endif /* !ACPI_REDUCED_HARDWARE */
588 /******************************************************************************
590 * FUNCTION: AeMiscellaneousTests
592 * DESCRIPTION: Various ACPICA validation tests.
594 *****************************************************************************/
597 AeMiscellaneousTests (
600 ACPI_BUFFER ReturnBuf;
603 ACPI_STATISTICS Stats;
606 #if (!ACPI_REDUCED_HARDWARE)
607 ACPI_VENDOR_UUID Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
610 #endif /* !ACPI_REDUCED_HARDWARE */
613 if (AcpiGbl_DoInterfaceTests)
616 * Tests for AcpiLoadTable and AcpiUnloadParentTable
619 /* Attempt unload of DSDT, should fail */
621 Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
622 AE_CHECK_OK (AcpiGetHandle, Status);
624 Status = AcpiUnloadParentTable (Handle);
625 AE_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
627 /* Load and unload SSDT4 */
629 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
630 AE_CHECK_OK (AcpiLoadTable, Status);
632 Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
633 AE_CHECK_OK (AcpiGetHandle, Status);
635 Status = AcpiUnloadParentTable (Handle);
636 AE_CHECK_OK (AcpiUnloadParentTable, Status);
640 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
641 AE_CHECK_OK (AcpiLoadTable, Status);
643 /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
645 Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
646 AE_CHECK_OK (AcpiGetHandle, Status);
648 Status = AcpiUnloadParentTable (Handle);
649 AE_CHECK_OK (AcpiUnloadParentTable, Status);
651 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
652 AE_CHECK_OK (AcpiLoadTable, Status);
654 /* Load OEM9 table (causes table override) */
656 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
657 AE_CHECK_OK (AcpiLoadTable, Status);
661 AeHardwareInterfaces ();
662 AeGenericRegisters ();
663 AeSetupConfiguration (Ssdt3Code);
665 AeTestBufferArgument();
666 AeTestPackageArgument ();
667 AeMutexInterfaces ();
669 Status = AcpiInstallInterface ("");
670 AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
672 Status = AcpiInstallInterface ("TestString");
673 AE_CHECK_OK (AcpiInstallInterface, Status);
675 Status = AcpiInstallInterface ("TestString");
676 AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
678 Status = AcpiRemoveInterface ("Windows 2006");
679 AE_CHECK_OK (AcpiRemoveInterface, Status);
681 Status = AcpiRemoveInterface ("TestString");
682 AE_CHECK_OK (AcpiRemoveInterface, Status);
684 Status = AcpiRemoveInterface ("XXXXXX");
685 AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
687 Status = AcpiInstallInterface ("AnotherTestString");
688 AE_CHECK_OK (AcpiInstallInterface, Status);
691 Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
692 AE_CHECK_OK (ExecuteOSI, Status);
694 Status = ExecuteOSI ("MichiganTerminalSystem", 0);
695 AE_CHECK_OK (ExecuteOSI, Status);
698 ReturnBuf.Length = 32;
699 ReturnBuf.Pointer = Buffer;
701 Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
702 AE_CHECK_OK (AcpiGetName, Status);
706 Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
707 AE_CHECK_OK (AcpiGetDevices, Status);
709 Status = AcpiGetStatistics (&Stats);
710 AE_CHECK_OK (AcpiGetStatistics, Status);
713 #if (!ACPI_REDUCED_HARDWARE)
715 Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
716 AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
718 /* If Hardware Reduced flag is set, we are all done */
720 if (AcpiGbl_ReducedHardware)
725 Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
726 AE_CHECK_OK (AcpiEnableEvent, Status);
729 * GPEs: Handlers, enable/disable, etc.
731 Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
732 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
734 Status = AcpiEnableGpe (NULL, 0);
735 AE_CHECK_OK (AcpiEnableGpe, Status);
737 Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
738 AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
740 Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
741 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
743 Status = AcpiEnableGpe (NULL, 0);
744 AE_CHECK_OK (AcpiEnableGpe, Status);
746 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
747 AE_CHECK_OK (AcpiSetGpe, Status);
749 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
750 AE_CHECK_OK (AcpiSetGpe, Status);
753 Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
754 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
756 Status = AcpiEnableGpe (NULL, 1);
757 AE_CHECK_OK (AcpiEnableGpe, Status);
760 Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
761 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
763 Status = AcpiEnableGpe (NULL, 2);
764 AE_CHECK_OK (AcpiEnableGpe, Status);
767 Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
768 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
770 Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
771 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
773 Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
774 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
776 Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
777 AE_CHECK_OK (AcpiGetHandle, Status);
779 Status = AcpiSetupGpeForWake (Handle, NULL, 5);
780 AE_CHECK_OK (AcpiSetupGpeForWake, Status);
782 Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
783 AE_CHECK_OK (AcpiSetGpeWakeMask, Status);
785 Status = AcpiSetupGpeForWake (Handle, NULL, 6);
786 AE_CHECK_OK (AcpiSetupGpeForWake, Status);
788 Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
789 AE_CHECK_OK (AcpiSetupGpeForWake, Status);
791 Status = AcpiSetupGpeForWake (Handle, NULL, 9);
792 AE_CHECK_OK (AcpiSetupGpeForWake, Status);
794 Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
795 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
797 Status = AcpiEnableGpe (NULL, 0x19);
798 AE_CHECK_OK (AcpiEnableGpe, Status);
801 Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
802 AE_CHECK_OK (AcpiInstallGpeHandler, Status);
804 Status = AcpiEnableGpe (NULL, 0x62);
805 AE_CHECK_OK (AcpiEnableGpe, Status);
807 Status = AcpiDisableGpe (NULL, 0x62);
808 AE_CHECK_OK (AcpiDisableGpe, Status);
810 AfInstallGpeBlock ();
812 /* Here is where the GPEs are actually "enabled" */
814 Status = AcpiUpdateAllGpes ();
815 AE_CHECK_OK (AcpiUpdateAllGpes, Status);
817 Status = AcpiGetHandle (NULL, "RSRC", &Handle);
818 if (ACPI_SUCCESS (Status))
820 ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
822 Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
823 if (ACPI_SUCCESS (Status))
825 AcpiOsFree (ReturnBuf.Pointer);
829 /* Test global lock */
831 Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
832 AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
834 Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
835 AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
837 Status = AcpiReleaseGlobalLock (LockHandle1);
838 AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
840 Status = AcpiReleaseGlobalLock (LockHandle2);
841 AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
843 #endif /* !ACPI_REDUCED_HARDWARE */