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 UINT64 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 ACPI_UINT64_MAX (TRUE)
335 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
337 *****************************************************************************/
342 UINT64 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 %8.8X%8.8X found %8.8X%8.8X\n",
396 ACPI_FORMAT_UINT64 (ExpectedResult),
397 ACPI_FORMAT_UINT64 (Obj->Integer.Value));
403 /* Reset the OSI data */
409 /* Free a buffer created via ACPI_ALLOCATE_BUFFER */
411 AcpiOsFree (ReturnValue.Pointer);
416 /******************************************************************************
418 * FUNCTION: AeGenericRegisters
420 * DESCRIPTION: Call the AcpiRead/Write interfaces.
422 *****************************************************************************/
424 static ACPI_GENERIC_ADDRESS GenericRegister;
434 GenericRegister.Address = 0x1234;
435 GenericRegister.BitWidth = 64;
436 GenericRegister.BitOffset = 0;
437 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
439 Status = AcpiRead (&Value, &GenericRegister);
440 ACPI_CHECK_OK (AcpiRead, Status);
442 Status = AcpiWrite (Value, &GenericRegister);
443 ACPI_CHECK_OK (AcpiWrite, Status);
445 GenericRegister.Address = 0x12345678;
446 GenericRegister.BitOffset = 0;
447 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
449 Status = AcpiRead (&Value, &GenericRegister);
450 ACPI_CHECK_OK (AcpiRead, Status);
452 Status = AcpiWrite (Value, &GenericRegister);
453 ACPI_CHECK_OK (AcpiWrite, Status);
457 /******************************************************************************
459 * FUNCTION: AeMutexInterfaces
461 * DESCRIPTION: Exercise the AML mutex access interfaces
463 *****************************************************************************/
470 ACPI_HANDLE MutexHandle;
473 /* Get a handle to an AML mutex */
475 Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
476 if (Status == AE_NOT_FOUND)
481 ACPI_CHECK_OK (AcpiGetHandle, Status);
482 if (ACPI_FAILURE (Status))
487 /* Acquire the mutex */
489 Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
490 ACPI_CHECK_OK (AcpiAcquireMutex, Status);
491 if (ACPI_FAILURE (Status))
496 /* Release mutex with different parameters */
498 Status = AcpiReleaseMutex (MutexHandle, NULL);
499 ACPI_CHECK_OK (AcpiReleaseMutex, Status);
503 /******************************************************************************
505 * FUNCTION: AeHardwareInterfaces
507 * DESCRIPTION: Call various hardware support interfaces
509 *****************************************************************************/
512 AeHardwareInterfaces (
515 #if (!ACPI_REDUCED_HARDWARE)
521 /* If Hardware Reduced flag is set, we are all done */
523 if (AcpiGbl_ReducedHardware)
528 Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
529 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
531 Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
532 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
534 Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
535 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
537 Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
538 ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
541 Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
542 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
544 Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
545 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
547 Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
548 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
550 Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
551 ACPI_CHECK_OK (AcpiReadBitRegister, Status);
553 #endif /* !ACPI_REDUCED_HARDWARE */
557 /******************************************************************************
559 * FUNCTION: AeTestSleepData
561 * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
563 *****************************************************************************/
575 /* Attempt to get sleep data for all known sleep states */
577 for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
579 Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
581 /* All sleep methods are optional */
583 if (Status != AE_NOT_FOUND)
585 ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
591 /******************************************************************************
593 * FUNCTION: AeMiscellaneousTests
595 * DESCRIPTION: Various ACPICA validation tests.
597 *****************************************************************************/
600 AeMiscellaneousTests (
603 ACPI_BUFFER ReturnBuf;
606 ACPI_STATISTICS Stats;
609 #if (!ACPI_REDUCED_HARDWARE)
612 ACPI_VENDOR_UUID Uuid =
613 {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
614 #endif /* !ACPI_REDUCED_HARDWARE */
617 Status = AcpiGetHandle (NULL, "\\", &Handle);
618 ACPI_CHECK_OK (AcpiGetHandle, Status);
620 if (AcpiGbl_DoInterfaceTests)
623 * Tests for AcpiLoadTable and AcpiUnloadParentTable
626 /* Attempt unload of DSDT, should fail */
628 Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
629 ACPI_CHECK_OK (AcpiGetHandle, Status);
631 Status = AcpiUnloadParentTable (Handle);
632 ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
634 /* Load and unload SSDT4 */
636 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
637 ACPI_CHECK_OK (AcpiLoadTable, Status);
639 Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
640 ACPI_CHECK_OK (AcpiGetHandle, Status);
642 Status = AcpiUnloadParentTable (Handle);
643 ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
647 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
648 ACPI_CHECK_OK (AcpiLoadTable, Status);
650 /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
652 Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
653 ACPI_CHECK_OK (AcpiGetHandle, Status);
655 Status = AcpiUnloadParentTable (Handle);
656 ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
658 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
659 ACPI_CHECK_OK (AcpiLoadTable, Status);
661 /* Load OEM9 table (causes table override) */
663 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
664 ACPI_CHECK_OK (AcpiLoadTable, Status);
667 AeHardwareInterfaces ();
668 AeGenericRegisters ();
669 AeSetupConfiguration (Ssdt3Code);
671 AeTestBufferArgument();
672 AeTestPackageArgument ();
673 AeMutexInterfaces ();
676 /* Test _OSI install/remove */
678 Status = AcpiInstallInterface ("");
679 ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
681 Status = AcpiInstallInterface ("TestString");
682 ACPI_CHECK_OK (AcpiInstallInterface, Status);
684 Status = AcpiInstallInterface ("TestString");
685 ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
687 Status = AcpiRemoveInterface ("Windows 2006");
688 ACPI_CHECK_OK (AcpiRemoveInterface, Status);
690 Status = AcpiRemoveInterface ("TestString");
691 ACPI_CHECK_OK (AcpiRemoveInterface, Status);
693 Status = AcpiRemoveInterface ("XXXXXX");
694 ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
696 Status = AcpiInstallInterface ("AnotherTestString");
697 ACPI_CHECK_OK (AcpiInstallInterface, Status);
699 /* Test _OSI execution */
701 Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
702 ACPI_CHECK_OK (ExecuteOSI, Status);
704 Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
705 ACPI_CHECK_OK (ExecuteOSI, Status);
707 Status = ExecuteOSI ("MichiganTerminalSystem", 0);
708 ACPI_CHECK_OK (ExecuteOSI, Status);
711 ReturnBuf.Length = 32;
712 ReturnBuf.Pointer = Buffer;
714 Status = AcpiGetName (ACPI_ROOT_OBJECT,
715 ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
716 ACPI_CHECK_OK (AcpiGetName, Status);
720 Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
721 ACPI_CHECK_OK (AcpiGetDevices, Status);
723 Status = AcpiGetStatistics (&Stats);
724 ACPI_CHECK_OK (AcpiGetStatistics, Status);
727 #if (!ACPI_REDUCED_HARDWARE)
729 Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
730 ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
732 /* If Hardware Reduced flag is set, we are all done */
734 if (AcpiGbl_ReducedHardware)
739 Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
740 ACPI_CHECK_OK (AcpiEnableEvent, Status);
743 * GPEs: Handlers, enable/disable, etc.
745 Status = AcpiInstallGpeHandler (NULL, 0,
746 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
747 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
749 Status = AcpiEnableGpe (NULL, 0);
750 ACPI_CHECK_OK (AcpiEnableGpe, Status);
752 Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
753 ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
755 Status = AcpiInstallGpeHandler (NULL, 0,
756 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
757 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
759 Status = AcpiEnableGpe (NULL, 0);
760 ACPI_CHECK_OK (AcpiEnableGpe, Status);
762 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
763 ACPI_CHECK_OK (AcpiSetGpe, Status);
765 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
766 ACPI_CHECK_OK (AcpiSetGpe, Status);
769 Status = AcpiInstallGpeHandler (NULL, 1,
770 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
771 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
773 Status = AcpiEnableGpe (NULL, 1);
774 ACPI_CHECK_OK (AcpiEnableGpe, Status);
777 Status = AcpiInstallGpeHandler (NULL, 2,
778 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
779 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
781 Status = AcpiEnableGpe (NULL, 2);
782 ACPI_CHECK_OK (AcpiEnableGpe, Status);
785 Status = AcpiInstallGpeHandler (NULL, 3,
786 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
787 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
789 Status = AcpiInstallGpeHandler (NULL, 4,
790 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
791 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
793 Status = AcpiInstallGpeHandler (NULL, 5,
794 ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
795 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
797 Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
798 ACPI_CHECK_OK (AcpiGetHandle, Status);
800 Status = AcpiSetupGpeForWake (Handle, NULL, 5);
801 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
803 Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
804 ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
806 Status = AcpiSetupGpeForWake (Handle, NULL, 6);
807 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
809 Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
810 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
812 Status = AcpiSetupGpeForWake (Handle, NULL, 9);
813 ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
815 Status = AcpiInstallGpeHandler (NULL, 0x19,
816 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
817 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
819 Status = AcpiEnableGpe (NULL, 0x19);
820 ACPI_CHECK_OK (AcpiEnableGpe, Status);
825 Status = AcpiInstallGpeHandler (NULL, 101,
826 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
827 ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
829 Status = AcpiEnableGpe (NULL, 101);
830 ACPI_CHECK_OK (AcpiEnableGpe, Status);
832 Status = AcpiDisableGpe (NULL, 101);
833 ACPI_CHECK_OK (AcpiDisableGpe, Status);
835 AfInstallGpeBlock ();
837 /* Here is where the GPEs are actually "enabled" */
839 Status = AcpiUpdateAllGpes ();
840 ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
842 Status = AcpiGetHandle (NULL, "RSRC", &Handle);
843 if (ACPI_SUCCESS (Status))
845 ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
847 Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
848 if (ACPI_SUCCESS (Status))
850 AcpiOsFree (ReturnBuf.Pointer);
854 /* Test global lock */
856 Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
857 ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
859 Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
860 ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
862 Status = AcpiReleaseGlobalLock (LockHandle1);
863 ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
865 Status = AcpiReleaseGlobalLock (LockHandle2);
866 ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
868 #endif /* !ACPI_REDUCED_HARDWARE */