1 /******************************************************************************
3 * Module Name: aeexec - Support routines for AcpiExec utility
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
46 #define _COMPONENT ACPI_TOOLS
47 ACPI_MODULE_NAME ("aeexec")
49 /* Local prototypes */
52 AeSetupConfiguration (
56 AeTestBufferArgument (
60 AeTestPackageArgument (
65 ACPI_HANDLE ObjHandle,
73 UINT32 ExpectedResult);
80 AeHardwareInterfaces (
91 #if (!ACPI_REDUCED_HARDWARE)
95 #endif /* !ACPI_REDUCED_HARDWARE */
97 extern unsigned char Ssdt2Code[];
98 extern unsigned char Ssdt3Code[];
99 extern unsigned char Ssdt4Code[];
102 /******************************************************************************
104 * FUNCTION: AeSetupConfiguration
106 * PARAMETERS: RegionAddr - Address for an ACPI table to be loaded
107 * dynamically. Test purposes only.
111 * DESCRIPTION: Call AML _CFG configuration control method
113 *****************************************************************************/
116 AeSetupConfiguration (
119 ACPI_OBJECT_LIST ArgList;
124 * Invoke _CFG method if present
127 ArgList.Pointer = Arg;
129 Arg[0].Type = ACPI_TYPE_INTEGER;
130 Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
132 (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
137 #if (!ACPI_REDUCED_HARDWARE)
138 /******************************************************************************
140 * FUNCTION: AfInstallGpeBlock
146 * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
149 *****************************************************************************/
157 ACPI_GENERIC_ADDRESS BlockAddress;
158 ACPI_HANDLE GpeDevice;
159 ACPI_OBJECT_TYPE Type;
162 /* _GPE should always exist */
164 Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
165 ACPI_CHECK_OK (AcpiGetHandle, Status);
166 if (ACPI_FAILURE (Status))
171 memset (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
172 BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
173 BlockAddress.Address = 0x76540000;
175 /* Attempt to install a GPE block on GPE2 (if present) */
177 Status = AcpiGetHandle (NULL, "\\GPE2", &Handle);
178 if (ACPI_SUCCESS (Status))
180 Status = AcpiGetType (Handle, &Type);
181 if (ACPI_FAILURE (Status) ||
182 (Type != ACPI_TYPE_DEVICE))
187 Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 7, 8);
188 ACPI_CHECK_OK (AcpiInstallGpeBlock, Status);
190 Status = AcpiInstallGpeHandler (Handle, 8,
191 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
192 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
194 Status = AcpiEnableGpe (Handle, 8);
195 ACPI_CHECK_OK (AcpiEnableGpe, Status);
197 Status = AcpiGetGpeDevice (0x30, &GpeDevice);
198 ACPI_CHECK_OK (AcpiGetGpeDevice, Status);
200 Status = AcpiGetGpeDevice (0x42, &GpeDevice);
201 ACPI_CHECK_OK (AcpiGetGpeDevice, Status);
203 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
204 ACPI_CHECK_OK (AcpiGetGpeDevice, Status);
206 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
207 ACPI_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
209 Status = AcpiRemoveGpeHandler (Handle, 8, AeGpeHandler);
210 ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
213 /* Attempt to install a GPE block on GPE3 (if present) */
215 Status = AcpiGetHandle (NULL, "\\GPE3", &Handle);
216 if (ACPI_SUCCESS (Status))
218 Status = AcpiGetType (Handle, &Type);
219 if (ACPI_FAILURE (Status) ||
220 (Type != ACPI_TYPE_DEVICE))
225 Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 8, 11);
226 ACPI_CHECK_OK (AcpiInstallGpeBlock, Status);
229 #endif /* !ACPI_REDUCED_HARDWARE */
232 /* Test using a Buffer object as a method argument */
235 AeTestBufferArgument (
238 ACPI_OBJECT_LIST Params;
248 BufArg.Type = ACPI_TYPE_BUFFER;
249 BufArg.Buffer.Length = 12;
250 BufArg.Buffer.Pointer = Buffer;
253 Params.Pointer = &BufArg;
255 (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
259 static ACPI_OBJECT PkgArg;
260 static ACPI_OBJECT PkgElements[5];
261 static ACPI_OBJECT Pkg2Elements[5];
262 static ACPI_OBJECT_LIST Params;
266 * Test using a Package object as an method argument
269 AeTestPackageArgument (
275 PkgArg.Type = ACPI_TYPE_PACKAGE;
276 PkgArg.Package.Count = 4;
277 PkgArg.Package.Elements = PkgElements;
279 /* Main package elements */
281 PkgElements[0].Type = ACPI_TYPE_INTEGER;
282 PkgElements[0].Integer.Value = 0x22228888;
284 PkgElements[1].Type = ACPI_TYPE_STRING;
285 PkgElements[1].String.Length = sizeof ("Top-level package");
286 PkgElements[1].String.Pointer = "Top-level package";
288 PkgElements[2].Type = ACPI_TYPE_BUFFER;
289 PkgElements[2].Buffer.Length = sizeof ("XXXX");
290 PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX";
292 PkgElements[3].Type = ACPI_TYPE_PACKAGE;
293 PkgElements[3].Package.Count = 2;
294 PkgElements[3].Package.Elements = Pkg2Elements;
296 /* Subpackage elements */
298 Pkg2Elements[0].Type = ACPI_TYPE_INTEGER;
299 Pkg2Elements[0].Integer.Value = 0xAAAABBBB;
301 Pkg2Elements[1].Type = ACPI_TYPE_STRING;
302 Pkg2Elements[1].String.Length = sizeof ("Nested Package");
303 Pkg2Elements[1].String.Pointer = "Nested Package";
305 /* Parameter object */
308 Params.Pointer = &PkgArg;
310 (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
316 ACPI_HANDLE ObjHandle,
326 /******************************************************************************
328 * FUNCTION: ExecuteOSI
330 * PARAMETERS: OsiString - String passed to _OSI method
331 * ExpectedResult - 0 (FALSE) or 0xFFFFFFFF (TRUE)
335 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
337 *****************************************************************************/
342 UINT32 ExpectedResult)
345 ACPI_OBJECT_LIST ArgList;
347 ACPI_BUFFER ReturnValue;
351 /* Setup input argument */
354 ArgList.Pointer = Arg;
356 Arg[0].Type = ACPI_TYPE_STRING;
357 Arg[0].String.Pointer = OsiString;
358 Arg[0].String.Length = strlen (Arg[0].String.Pointer);
360 /* Ask ACPICA to allocate space for the return object */
362 ReturnValue.Length = ACPI_ALLOCATE_BUFFER;
364 Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
366 if (ACPI_FAILURE (Status))
369 "Could not execute _OSI method, %s\n",
370 AcpiFormatException (Status));
376 if (ReturnValue.Length < sizeof (ACPI_OBJECT))
379 "Return value from _OSI method too small, %.8X\n",
384 Obj = ReturnValue.Pointer;
385 if (Obj->Type != ACPI_TYPE_INTEGER)
388 "Invalid return type from _OSI method, %.2X\n", Obj->Type);
392 if (Obj->Integer.Value != ExpectedResult)
395 "Invalid return value from _OSI, expected %.8X found %.8X\n",
396 ExpectedResult, (UINT32) Obj->Integer.Value);
402 /* Reset the OSI data */
408 /* Free a buffer created via ACPI_ALLOCATE_BUFFER */
410 AcpiOsFree (ReturnValue.Pointer);
415 /******************************************************************************
417 * FUNCTION: AeGenericRegisters
419 * DESCRIPTION: Call the AcpiRead/Write interfaces.
421 *****************************************************************************/
423 static ACPI_GENERIC_ADDRESS GenericRegister;
433 GenericRegister.Address = 0x1234;
434 GenericRegister.BitWidth = 64;
435 GenericRegister.BitOffset = 0;
436 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
438 Status = AcpiRead (&Value, &GenericRegister);
439 ACPI_CHECK_OK (AcpiRead, Status);
441 Status = AcpiWrite (Value, &GenericRegister);
442 ACPI_CHECK_OK (AcpiWrite, Status);
444 GenericRegister.Address = 0x12345678;
445 GenericRegister.BitOffset = 0;
446 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
448 Status = AcpiRead (&Value, &GenericRegister);
449 ACPI_CHECK_OK (AcpiRead, Status);
451 Status = AcpiWrite (Value, &GenericRegister);
452 ACPI_CHECK_OK (AcpiWrite, Status);
456 /******************************************************************************
458 * FUNCTION: AeMutexInterfaces
460 * DESCRIPTION: Exercise the AML mutex access interfaces
462 *****************************************************************************/
469 ACPI_HANDLE MutexHandle;
472 /* Get a handle to an AML mutex */
474 Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
475 if (Status == AE_NOT_FOUND)
480 ACPI_CHECK_OK (AcpiGetHandle, Status);
481 if (ACPI_FAILURE (Status))
486 /* Acquire the mutex */
488 Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
489 ACPI_CHECK_OK (AcpiAcquireMutex, Status);
490 if (ACPI_FAILURE (Status))
495 /* Release mutex with different parameters */
497 Status = AcpiReleaseMutex (MutexHandle, NULL);
498 ACPI_CHECK_OK (AcpiReleaseMutex, Status);
502 /******************************************************************************
504 * FUNCTION: AeHardwareInterfaces
506 * DESCRIPTION: Call various hardware support interfaces
508 *****************************************************************************/
511 AeHardwareInterfaces (
514 #if (!ACPI_REDUCED_HARDWARE)
520 /* If Hardware Reduced flag is set, we are all done */
522 if (AcpiGbl_ReducedHardware)
527 Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
528 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
530 Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
531 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
533 Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
534 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
536 Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
537 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
540 Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
541 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
543 Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
544 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
546 Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
547 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
549 Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
550 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
552 #endif /* !ACPI_REDUCED_HARDWARE */
556 /******************************************************************************
558 * FUNCTION: AeTestSleepData
560 * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
562 *****************************************************************************/
574 /* Attempt to get sleep data for all known sleep states */
576 for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
578 Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
580 /* All sleep methods are optional */
582 if (Status != AE_NOT_FOUND)
584 ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
590 /******************************************************************************
592 * FUNCTION: AeMiscellaneousTests
594 * DESCRIPTION: Various ACPICA validation tests.
596 *****************************************************************************/
599 AeMiscellaneousTests (
602 ACPI_BUFFER ReturnBuf;
605 ACPI_STATISTICS Stats;
608 #if (!ACPI_REDUCED_HARDWARE)
611 ACPI_VENDOR_UUID Uuid =
612 {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
613 #endif /* !ACPI_REDUCED_HARDWARE */
616 Status = AcpiGetHandle (NULL, "\\", &Handle);
617 ACPI_CHECK_OK (AcpiGetHandle, Status);
619 if (AcpiGbl_DoInterfaceTests)
622 * Tests for AcpiLoadTable and AcpiUnloadParentTable
625 /* Attempt unload of DSDT, should fail */
627 Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
628 ACPI_CHECK_OK (AcpiGetHandle, Status);
630 Status = AcpiUnloadParentTable (Handle);
631 ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
633 /* Load and unload SSDT4 */
635 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
636 ACPI_CHECK_OK (AcpiLoadTable, Status);
638 Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
639 ACPI_CHECK_OK (AcpiGetHandle, Status);
641 Status = AcpiUnloadParentTable (Handle);
642 ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
646 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
647 ACPI_CHECK_OK (AcpiLoadTable, Status);
649 /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
651 Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
652 ACPI_CHECK_OK (AcpiGetHandle, Status);
654 Status = AcpiUnloadParentTable (Handle);
655 ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
657 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
658 ACPI_CHECK_OK (AcpiLoadTable, Status);
660 /* Load OEM9 table (causes table override) */
662 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
663 ACPI_CHECK_OK (AcpiLoadTable, Status);
666 AeHardwareInterfaces ();
667 AeGenericRegisters ();
668 AeSetupConfiguration (Ssdt3Code);
670 AeTestBufferArgument();
671 AeTestPackageArgument ();
672 AeMutexInterfaces ();
675 /* Test _OSI install/remove */
677 Status = AcpiInstallInterface ("");
678 ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
680 Status = AcpiInstallInterface ("TestString");
681 ACPI_CHECK_OK (AcpiInstallInterface, Status);
683 Status = AcpiInstallInterface ("TestString");
684 ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
686 Status = AcpiRemoveInterface ("Windows 2006");
687 ACPI_CHECK_OK (AcpiRemoveInterface, Status);
689 Status = AcpiRemoveInterface ("TestString");
690 ACPI_CHECK_OK (AcpiRemoveInterface, Status);
692 Status = AcpiRemoveInterface ("XXXXXX");
693 ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
695 Status = AcpiInstallInterface ("AnotherTestString");
696 ACPI_CHECK_OK (AcpiInstallInterface, Status);
698 /* Test _OSI execution */
700 Status = ExecuteOSI ("Extended Address Space Descriptor", 0xFFFFFFFF);
701 ACPI_CHECK_OK (ExecuteOSI, Status);
703 Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
704 ACPI_CHECK_OK (ExecuteOSI, Status);
706 Status = ExecuteOSI ("MichiganTerminalSystem", 0);
707 ACPI_CHECK_OK (ExecuteOSI, Status);
710 ReturnBuf.Length = 32;
711 ReturnBuf.Pointer = Buffer;
713 Status = AcpiGetName (ACPI_ROOT_OBJECT,
714 ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
715 ACPI_CHECK_OK (AcpiGetName, Status);
719 Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
720 ACPI_CHECK_OK (AcpiGetDevices, Status);
722 Status = AcpiGetStatistics (&Stats);
723 ACPI_CHECK_OK (AcpiGetStatistics, Status);
726 #if (!ACPI_REDUCED_HARDWARE)
728 Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
729 ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
731 /* If Hardware Reduced flag is set, we are all done */
733 if (AcpiGbl_ReducedHardware)
738 Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
739 ACPI_CHECK_OK (AcpiEnableEvent, Status);
742 * GPEs: Handlers, enable/disable, etc.
744 Status = AcpiInstallGpeHandler (NULL, 0,
745 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
746 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
748 Status = AcpiEnableGpe (NULL, 0);
749 ACPI_CHECK_OK (AcpiEnableGpe, Status);
751 Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
752 ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
754 Status = AcpiInstallGpeHandler (NULL, 0,
755 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
756 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
758 Status = AcpiEnableGpe (NULL, 0);
759 ACPI_CHECK_OK (AcpiEnableGpe, Status);
761 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
762 ACPI_CHECK_OK (AcpiSetGpe, Status);
764 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
765 ACPI_CHECK_OK (AcpiSetGpe, Status);
768 Status = AcpiInstallGpeHandler (NULL, 1,
769 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
770 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
772 Status = AcpiEnableGpe (NULL, 1);
773 ACPI_CHECK_OK (AcpiEnableGpe, Status);
776 Status = AcpiInstallGpeHandler (NULL, 2,
777 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
778 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
780 Status = AcpiEnableGpe (NULL, 2);
781 ACPI_CHECK_OK (AcpiEnableGpe, Status);
784 Status = AcpiInstallGpeHandler (NULL, 3,
785 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
786 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
788 Status = AcpiInstallGpeHandler (NULL, 4,
789 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
790 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
792 Status = AcpiInstallGpeHandler (NULL, 5,
793 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
794 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
796 Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
797 ACPI_CHECK_OK (AcpiGetHandle, Status);
799 Status = AcpiSetupGpeForWake (Handle, NULL, 5);
800 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
802 Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
803 ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
805 Status = AcpiSetupGpeForWake (Handle, NULL, 6);
806 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
808 Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
809 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
811 Status = AcpiSetupGpeForWake (Handle, NULL, 9);
812 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
814 Status = AcpiInstallGpeHandler (NULL, 0x19,
815 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
816 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
818 Status = AcpiEnableGpe (NULL, 0x19);
819 ACPI_CHECK_OK (AcpiEnableGpe, Status);
824 Status = AcpiInstallGpeHandler (NULL, 101,
825 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
826 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
828 Status = AcpiEnableGpe (NULL, 101);
829 ACPI_CHECK_OK (AcpiEnableGpe, Status);
831 Status = AcpiDisableGpe (NULL, 101);
832 ACPI_CHECK_OK (AcpiDisableGpe, Status);
834 AfInstallGpeBlock ();
836 /* Here is where the GPEs are actually "enabled" */
838 Status = AcpiUpdateAllGpes ();
839 ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
841 Status = AcpiGetHandle (NULL, "RSRC", &Handle);
842 if (ACPI_SUCCESS (Status))
844 ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
846 Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
847 if (ACPI_SUCCESS (Status))
849 AcpiOsFree (ReturnBuf.Pointer);
853 /* Test global lock */
855 Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
856 ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
858 Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
859 ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
861 Status = AcpiReleaseGlobalLock (LockHandle1);
862 ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
864 Status = AcpiReleaseGlobalLock (LockHandle2);
865 ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
867 #endif /* !ACPI_REDUCED_HARDWARE */