1 /******************************************************************************
3 * Module Name: aeexec - Support routines for AcpiExec utility
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2017, 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 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include "aecommon.h"
154 #define _COMPONENT ACPI_TOOLS
155 ACPI_MODULE_NAME ("aeexec")
157 /* Local prototypes */
160 AeSetupConfiguration (
164 AeTestBufferArgument (
168 AeTestPackageArgument (
173 ACPI_HANDLE ObjHandle
,
181 UINT64 ExpectedResult
);
188 AeHardwareInterfaces (
199 #if (!ACPI_REDUCED_HARDWARE)
203 #endif /* !ACPI_REDUCED_HARDWARE */
205 extern unsigned char Ssdt2Code
[];
206 extern unsigned char Ssdt3Code
[];
207 extern unsigned char Ssdt4Code
[];
210 /******************************************************************************
212 * FUNCTION: AeSetupConfiguration
214 * PARAMETERS: RegionAddr - Address for an ACPI table to be loaded
215 * dynamically. Test purposes only.
219 * DESCRIPTION: Call AML _CFG configuration control method
221 *****************************************************************************/
224 AeSetupConfiguration (
227 ACPI_OBJECT_LIST ArgList
;
232 * Invoke _CFG method if present
235 ArgList
.Pointer
= Arg
;
237 Arg
[0].Type
= ACPI_TYPE_INTEGER
;
238 Arg
[0].Integer
.Value
= ACPI_TO_INTEGER (RegionAddr
);
240 (void) AcpiEvaluateObject (NULL
, "\\_CFG", &ArgList
, NULL
);
245 #if (!ACPI_REDUCED_HARDWARE)
246 /******************************************************************************
248 * FUNCTION: AfInstallGpeBlock
254 * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
257 *****************************************************************************/
265 ACPI_GENERIC_ADDRESS BlockAddress
;
266 ACPI_HANDLE GpeDevice
;
267 ACPI_OBJECT_TYPE Type
;
270 /* _GPE should always exist */
272 Status
= AcpiGetHandle (NULL
, "\\_GPE", &Handle
);
273 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
274 if (ACPI_FAILURE (Status
))
279 memset (&BlockAddress
, 0, sizeof (ACPI_GENERIC_ADDRESS
));
280 BlockAddress
.SpaceId
= ACPI_ADR_SPACE_SYSTEM_MEMORY
;
281 BlockAddress
.Address
= 0x76540000;
283 /* Attempt to install a GPE block on GPE2 (if present) */
285 Status
= AcpiGetHandle (NULL
, "\\GPE2", &Handle
);
286 if (ACPI_SUCCESS (Status
))
288 Status
= AcpiGetType (Handle
, &Type
);
289 if (ACPI_FAILURE (Status
) ||
290 (Type
!= ACPI_TYPE_DEVICE
))
295 Status
= AcpiInstallGpeBlock (Handle
, &BlockAddress
, 7, 8);
296 ACPI_CHECK_OK (AcpiInstallGpeBlock
, Status
);
298 Status
= AcpiInstallGpeHandler (Handle
, 8,
299 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
300 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
302 Status
= AcpiEnableGpe (Handle
, 8);
303 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
305 Status
= AcpiGetGpeDevice (0x30, &GpeDevice
);
306 ACPI_CHECK_OK (AcpiGetGpeDevice
, Status
);
308 Status
= AcpiGetGpeDevice (0x42, &GpeDevice
);
309 ACPI_CHECK_OK (AcpiGetGpeDevice
, Status
);
311 Status
= AcpiGetGpeDevice (AcpiCurrentGpeCount
-1, &GpeDevice
);
312 ACPI_CHECK_OK (AcpiGetGpeDevice
, Status
);
314 Status
= AcpiGetGpeDevice (AcpiCurrentGpeCount
, &GpeDevice
);
315 ACPI_CHECK_STATUS (AcpiGetGpeDevice
, Status
, AE_NOT_EXIST
);
317 Status
= AcpiRemoveGpeHandler (Handle
, 8, AeGpeHandler
);
318 ACPI_CHECK_OK (AcpiRemoveGpeHandler
, Status
);
321 /* Attempt to install a GPE block on GPE3 (if present) */
323 Status
= AcpiGetHandle (NULL
, "\\GPE3", &Handle
);
324 if (ACPI_SUCCESS (Status
))
326 Status
= AcpiGetType (Handle
, &Type
);
327 if (ACPI_FAILURE (Status
) ||
328 (Type
!= ACPI_TYPE_DEVICE
))
333 Status
= AcpiInstallGpeBlock (Handle
, &BlockAddress
, 8, 11);
334 ACPI_CHECK_OK (AcpiInstallGpeBlock
, Status
);
337 #endif /* !ACPI_REDUCED_HARDWARE */
340 /* Test using a Buffer object as a method argument */
343 AeTestBufferArgument (
346 ACPI_OBJECT_LIST Params
;
356 BufArg
.Type
= ACPI_TYPE_BUFFER
;
357 BufArg
.Buffer
.Length
= 12;
358 BufArg
.Buffer
.Pointer
= Buffer
;
361 Params
.Pointer
= &BufArg
;
363 (void) AcpiEvaluateObject (NULL
, "\\BUF", &Params
, NULL
);
367 static ACPI_OBJECT PkgArg
;
368 static ACPI_OBJECT PkgElements
[5];
369 static ACPI_OBJECT Pkg2Elements
[5];
370 static ACPI_OBJECT_LIST Params
;
374 * Test using a Package object as an method argument
377 AeTestPackageArgument (
383 PkgArg
.Type
= ACPI_TYPE_PACKAGE
;
384 PkgArg
.Package
.Count
= 4;
385 PkgArg
.Package
.Elements
= PkgElements
;
387 /* Main package elements */
389 PkgElements
[0].Type
= ACPI_TYPE_INTEGER
;
390 PkgElements
[0].Integer
.Value
= 0x22228888;
392 PkgElements
[1].Type
= ACPI_TYPE_STRING
;
393 PkgElements
[1].String
.Length
= sizeof ("Top-level package");
394 PkgElements
[1].String
.Pointer
= "Top-level package";
396 PkgElements
[2].Type
= ACPI_TYPE_BUFFER
;
397 PkgElements
[2].Buffer
.Length
= sizeof ("XXXX");
398 PkgElements
[2].Buffer
.Pointer
= (UINT8
*) "XXXX";
400 PkgElements
[3].Type
= ACPI_TYPE_PACKAGE
;
401 PkgElements
[3].Package
.Count
= 2;
402 PkgElements
[3].Package
.Elements
= Pkg2Elements
;
404 /* Subpackage elements */
406 Pkg2Elements
[0].Type
= ACPI_TYPE_INTEGER
;
407 Pkg2Elements
[0].Integer
.Value
= 0xAAAABBBB;
409 Pkg2Elements
[1].Type
= ACPI_TYPE_STRING
;
410 Pkg2Elements
[1].String
.Length
= sizeof ("Nested Package");
411 Pkg2Elements
[1].String
.Pointer
= "Nested Package";
413 /* Parameter object */
416 Params
.Pointer
= &PkgArg
;
418 (void) AcpiEvaluateObject (NULL
, "\\_PKG", &Params
, NULL
);
424 ACPI_HANDLE ObjHandle
,
434 /******************************************************************************
436 * FUNCTION: ExecuteOSI
438 * PARAMETERS: OsiString - String passed to _OSI method
439 * ExpectedResult - 0 (FALSE) or ACPI_UINT64_MAX (TRUE)
443 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
445 *****************************************************************************/
450 UINT64 ExpectedResult
)
453 ACPI_OBJECT_LIST ArgList
;
455 ACPI_BUFFER ReturnValue
;
459 /* Setup input argument */
462 ArgList
.Pointer
= Arg
;
464 Arg
[0].Type
= ACPI_TYPE_STRING
;
465 Arg
[0].String
.Pointer
= OsiString
;
466 Arg
[0].String
.Length
= strlen (Arg
[0].String
.Pointer
);
468 /* Ask ACPICA to allocate space for the return object */
470 ReturnValue
.Length
= ACPI_ALLOCATE_BUFFER
;
472 Status
= AcpiEvaluateObject (NULL
, "\\_OSI", &ArgList
, &ReturnValue
);
474 if (ACPI_FAILURE (Status
))
477 "Could not execute _OSI method, %s\n",
478 AcpiFormatException (Status
));
484 if (ReturnValue
.Length
< sizeof (ACPI_OBJECT
))
487 "Return value from _OSI method too small, %.8X\n",
492 Obj
= ReturnValue
.Pointer
;
493 if (Obj
->Type
!= ACPI_TYPE_INTEGER
)
496 "Invalid return type from _OSI method, %.2X\n", Obj
->Type
);
500 if (Obj
->Integer
.Value
!= ExpectedResult
)
503 "Invalid return value from _OSI, expected %8.8X%8.8X found %8.8X%8.8X\n",
504 ACPI_FORMAT_UINT64 (ExpectedResult
),
505 ACPI_FORMAT_UINT64 (Obj
->Integer
.Value
));
511 /* Reset the OSI data */
517 /* Free a buffer created via ACPI_ALLOCATE_BUFFER */
519 AcpiOsFree (ReturnValue
.Pointer
);
524 /******************************************************************************
526 * FUNCTION: AeGenericRegisters
528 * DESCRIPTION: Call the AcpiRead/Write interfaces.
530 *****************************************************************************/
532 static ACPI_GENERIC_ADDRESS GenericRegister
;
542 GenericRegister
.Address
= 0x1234;
543 GenericRegister
.BitWidth
= 64;
544 GenericRegister
.BitOffset
= 0;
545 GenericRegister
.SpaceId
= ACPI_ADR_SPACE_SYSTEM_IO
;
547 Status
= AcpiRead (&Value
, &GenericRegister
);
548 ACPI_CHECK_OK (AcpiRead
, Status
);
550 Status
= AcpiWrite (Value
, &GenericRegister
);
551 ACPI_CHECK_OK (AcpiWrite
, Status
);
553 GenericRegister
.Address
= 0x12345678;
554 GenericRegister
.BitOffset
= 0;
555 GenericRegister
.SpaceId
= ACPI_ADR_SPACE_SYSTEM_MEMORY
;
557 Status
= AcpiRead (&Value
, &GenericRegister
);
558 ACPI_CHECK_OK (AcpiRead
, Status
);
560 Status
= AcpiWrite (Value
, &GenericRegister
);
561 ACPI_CHECK_OK (AcpiWrite
, Status
);
565 /******************************************************************************
567 * FUNCTION: AeMutexInterfaces
569 * DESCRIPTION: Exercise the AML mutex access interfaces
571 *****************************************************************************/
578 ACPI_HANDLE MutexHandle
;
581 /* Get a handle to an AML mutex */
583 Status
= AcpiGetHandle (NULL
, "\\MTX1", &MutexHandle
);
584 if (Status
== AE_NOT_FOUND
)
589 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
590 if (ACPI_FAILURE (Status
))
595 /* Acquire the mutex */
597 Status
= AcpiAcquireMutex (NULL
, "\\MTX1", 0xFFFF);
598 ACPI_CHECK_OK (AcpiAcquireMutex
, Status
);
599 if (ACPI_FAILURE (Status
))
604 /* Release mutex with different parameters */
606 Status
= AcpiReleaseMutex (MutexHandle
, NULL
);
607 ACPI_CHECK_OK (AcpiReleaseMutex
, Status
);
611 /******************************************************************************
613 * FUNCTION: AeHardwareInterfaces
615 * DESCRIPTION: Call various hardware support interfaces
617 *****************************************************************************/
620 AeHardwareInterfaces (
623 #if (!ACPI_REDUCED_HARDWARE)
629 /* If Hardware Reduced flag is set, we are all done */
631 if (AcpiGbl_ReducedHardware
)
636 Status
= AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS
, 1);
637 ACPI_CHECK_OK (AcpiWriteBitRegister
, Status
);
639 Status
= AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE
, 1);
640 ACPI_CHECK_OK (AcpiWriteBitRegister
, Status
);
642 Status
= AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE
, 1);
643 ACPI_CHECK_OK (AcpiWriteBitRegister
, Status
);
645 Status
= AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE
, 1);
646 ACPI_CHECK_OK (AcpiWriteBitRegister
, Status
);
649 Status
= AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS
, &Value
);
650 ACPI_CHECK_OK (AcpiReadBitRegister
, Status
);
652 Status
= AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE
, &Value
);
653 ACPI_CHECK_OK (AcpiReadBitRegister
, Status
);
655 Status
= AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE
, &Value
);
656 ACPI_CHECK_OK (AcpiReadBitRegister
, Status
);
658 Status
= AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE
, &Value
);
659 ACPI_CHECK_OK (AcpiReadBitRegister
, Status
);
661 #endif /* !ACPI_REDUCED_HARDWARE */
665 /******************************************************************************
667 * FUNCTION: AeTestSleepData
669 * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
671 *****************************************************************************/
683 /* Attempt to get sleep data for all known sleep states */
685 for (State
= ACPI_STATE_S0
; State
<= ACPI_S_STATES_MAX
; State
++)
687 Status
= AcpiGetSleepTypeData ((UINT8
) State
, &TypeA
, &TypeB
);
689 /* All sleep methods are optional */
691 if (Status
!= AE_NOT_FOUND
)
693 ACPI_CHECK_OK (AcpiGetSleepTypeData
, Status
);
699 /******************************************************************************
701 * FUNCTION: AeMiscellaneousTests
703 * DESCRIPTION: Various ACPICA validation tests.
705 *****************************************************************************/
708 AeMiscellaneousTests (
711 ACPI_BUFFER ReturnBuf
;
714 ACPI_STATISTICS Stats
;
717 #if (!ACPI_REDUCED_HARDWARE)
720 ACPI_VENDOR_UUID Uuid
=
721 {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
722 #endif /* !ACPI_REDUCED_HARDWARE */
725 Status
= AcpiGetHandle (NULL
, "\\", &Handle
);
726 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
728 if (AcpiGbl_DoInterfaceTests
)
731 * Tests for AcpiLoadTable and AcpiUnloadParentTable
734 /* Attempt unload of DSDT, should fail */
736 Status
= AcpiGetHandle (NULL
, "\\_SB_", &Handle
);
737 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
739 Status
= AcpiUnloadParentTable (Handle
);
740 ACPI_CHECK_STATUS (AcpiUnloadParentTable
, Status
, AE_TYPE
);
742 /* Load and unload SSDT4 */
744 Status
= AcpiLoadTable ((ACPI_TABLE_HEADER
*) Ssdt4Code
);
745 ACPI_CHECK_OK (AcpiLoadTable
, Status
);
747 Status
= AcpiGetHandle (NULL
, "\\_T96", &Handle
);
748 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
750 Status
= AcpiUnloadParentTable (Handle
);
751 ACPI_CHECK_OK (AcpiUnloadParentTable
, Status
);
755 Status
= AcpiLoadTable ((ACPI_TABLE_HEADER
*) Ssdt4Code
);
756 ACPI_CHECK_OK (AcpiLoadTable
, Status
);
758 /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
760 Status
= AcpiGetHandle (NULL
, "\\_T99", &Handle
);
761 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
763 Status
= AcpiUnloadParentTable (Handle
);
764 ACPI_CHECK_OK (AcpiUnloadParentTable
, Status
);
766 Status
= AcpiLoadTable ((ACPI_TABLE_HEADER
*) Ssdt2Code
);
767 ACPI_CHECK_OK (AcpiLoadTable
, Status
);
769 /* Load OEM9 table (causes table override) */
771 Status
= AcpiLoadTable ((ACPI_TABLE_HEADER
*) Ssdt3Code
);
772 ACPI_CHECK_OK (AcpiLoadTable
, Status
);
775 AeHardwareInterfaces ();
776 AeGenericRegisters ();
777 AeSetupConfiguration (Ssdt3Code
);
779 AeTestBufferArgument();
780 AeTestPackageArgument ();
781 AeMutexInterfaces ();
784 /* Test _OSI install/remove */
786 Status
= AcpiInstallInterface ("");
787 ACPI_CHECK_STATUS (AcpiInstallInterface
, Status
, AE_BAD_PARAMETER
);
789 Status
= AcpiInstallInterface ("TestString");
790 ACPI_CHECK_OK (AcpiInstallInterface
, Status
);
792 Status
= AcpiInstallInterface ("TestString");
793 ACPI_CHECK_STATUS (AcpiInstallInterface
, Status
, AE_ALREADY_EXISTS
);
795 Status
= AcpiRemoveInterface ("Windows 2006");
796 ACPI_CHECK_OK (AcpiRemoveInterface
, Status
);
798 Status
= AcpiRemoveInterface ("TestString");
799 ACPI_CHECK_OK (AcpiRemoveInterface
, Status
);
801 Status
= AcpiRemoveInterface ("XXXXXX");
802 ACPI_CHECK_STATUS (AcpiRemoveInterface
, Status
, AE_NOT_EXIST
);
804 Status
= AcpiInstallInterface ("AnotherTestString");
805 ACPI_CHECK_OK (AcpiInstallInterface
, Status
);
807 /* Test _OSI execution */
809 Status
= ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX
);
810 ACPI_CHECK_OK (ExecuteOSI
, Status
);
812 Status
= ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX
);
813 ACPI_CHECK_OK (ExecuteOSI
, Status
);
815 Status
= ExecuteOSI ("MichiganTerminalSystem", 0);
816 ACPI_CHECK_OK (ExecuteOSI
, Status
);
819 ReturnBuf
.Length
= 32;
820 ReturnBuf
.Pointer
= Buffer
;
822 Status
= AcpiGetName (ACPI_ROOT_OBJECT
,
823 ACPI_FULL_PATHNAME_NO_TRAILING
, &ReturnBuf
);
824 ACPI_CHECK_OK (AcpiGetName
, Status
);
828 Status
= AcpiGetDevices (NULL
, AeGetDevices
, NULL
, NULL
);
829 ACPI_CHECK_OK (AcpiGetDevices
, Status
);
831 Status
= AcpiGetStatistics (&Stats
);
832 ACPI_CHECK_OK (AcpiGetStatistics
, Status
);
835 #if (!ACPI_REDUCED_HARDWARE)
837 Status
= AcpiInstallGlobalEventHandler (AeGlobalEventHandler
, NULL
);
838 ACPI_CHECK_OK (AcpiInstallGlobalEventHandler
, Status
);
840 /* If Hardware Reduced flag is set, we are all done */
842 if (AcpiGbl_ReducedHardware
)
847 Status
= AcpiEnableEvent (ACPI_EVENT_GLOBAL
, 0);
848 ACPI_CHECK_OK (AcpiEnableEvent
, Status
);
851 * GPEs: Handlers, enable/disable, etc.
853 Status
= AcpiInstallGpeHandler (NULL
, 0,
854 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
855 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
857 Status
= AcpiEnableGpe (NULL
, 0);
858 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
860 Status
= AcpiRemoveGpeHandler (NULL
, 0, AeGpeHandler
);
861 ACPI_CHECK_OK (AcpiRemoveGpeHandler
, Status
);
863 Status
= AcpiInstallGpeHandler (NULL
, 0,
864 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
865 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
867 Status
= AcpiEnableGpe (NULL
, 0);
868 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
870 Status
= AcpiSetGpe (NULL
, 0, ACPI_GPE_DISABLE
);
871 ACPI_CHECK_OK (AcpiSetGpe
, Status
);
873 Status
= AcpiSetGpe (NULL
, 0, ACPI_GPE_ENABLE
);
874 ACPI_CHECK_OK (AcpiSetGpe
, Status
);
877 Status
= AcpiInstallGpeHandler (NULL
, 1,
878 ACPI_GPE_EDGE_TRIGGERED
, AeGpeHandler
, NULL
);
879 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
881 Status
= AcpiEnableGpe (NULL
, 1);
882 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
885 Status
= AcpiInstallGpeHandler (NULL
, 2,
886 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
887 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
889 Status
= AcpiEnableGpe (NULL
, 2);
890 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
893 Status
= AcpiInstallGpeHandler (NULL
, 3,
894 ACPI_GPE_EDGE_TRIGGERED
, AeGpeHandler
, NULL
);
895 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
897 Status
= AcpiInstallGpeHandler (NULL
, 4,
898 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
899 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
901 Status
= AcpiInstallGpeHandler (NULL
, 5,
902 ACPI_GPE_EDGE_TRIGGERED
, AeGpeHandler
, NULL
);
903 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
905 Status
= AcpiGetHandle (NULL
, "\\_SB", &Handle
);
906 ACPI_CHECK_OK (AcpiGetHandle
, Status
);
908 Status
= AcpiSetupGpeForWake (Handle
, NULL
, 5);
909 ACPI_CHECK_OK (AcpiSetupGpeForWake
, Status
);
911 Status
= AcpiSetGpeWakeMask (NULL
, 5, ACPI_GPE_ENABLE
);
912 ACPI_CHECK_OK (AcpiSetGpeWakeMask
, Status
);
914 Status
= AcpiSetupGpeForWake (Handle
, NULL
, 6);
915 ACPI_CHECK_OK (AcpiSetupGpeForWake
, Status
);
917 Status
= AcpiSetupGpeForWake (ACPI_ROOT_OBJECT
, NULL
, 6);
918 ACPI_CHECK_OK (AcpiSetupGpeForWake
, Status
);
920 Status
= AcpiSetupGpeForWake (Handle
, NULL
, 9);
921 ACPI_CHECK_OK (AcpiSetupGpeForWake
, Status
);
923 Status
= AcpiInstallGpeHandler (NULL
, 0x19,
924 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
925 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
927 Status
= AcpiEnableGpe (NULL
, 0x19);
928 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
933 Status
= AcpiInstallGpeHandler (NULL
, 101,
934 ACPI_GPE_LEVEL_TRIGGERED
, AeGpeHandler
, NULL
);
935 ACPI_CHECK_OK (AcpiInstallGpeHandler
, Status
);
937 Status
= AcpiEnableGpe (NULL
, 101);
938 ACPI_CHECK_OK (AcpiEnableGpe
, Status
);
940 Status
= AcpiDisableGpe (NULL
, 101);
941 ACPI_CHECK_OK (AcpiDisableGpe
, Status
);
943 AfInstallGpeBlock ();
945 /* Here is where the GPEs are actually "enabled" */
947 Status
= AcpiUpdateAllGpes ();
948 ACPI_CHECK_OK (AcpiUpdateAllGpes
, Status
);
950 Status
= AcpiGetHandle (NULL
, "RSRC", &Handle
);
951 if (ACPI_SUCCESS (Status
))
953 ReturnBuf
.Length
= ACPI_ALLOCATE_BUFFER
;
955 Status
= AcpiGetVendorResource (Handle
, "_CRS", &Uuid
, &ReturnBuf
);
956 if (ACPI_SUCCESS (Status
))
958 AcpiOsFree (ReturnBuf
.Pointer
);
962 /* Test global lock */
964 Status
= AcpiAcquireGlobalLock (0xFFFF, &LockHandle1
);
965 ACPI_CHECK_OK (AcpiAcquireGlobalLock
, Status
);
967 Status
= AcpiAcquireGlobalLock (0x5, &LockHandle2
);
968 ACPI_CHECK_OK (AcpiAcquireGlobalLock
, Status
);
970 Status
= AcpiReleaseGlobalLock (LockHandle1
);
971 ACPI_CHECK_OK (AcpiReleaseGlobalLock
, Status
);
973 Status
= AcpiReleaseGlobalLock (LockHandle2
);
974 ACPI_CHECK_OK (AcpiReleaseGlobalLock
, Status
);
976 #endif /* !ACPI_REDUCED_HARDWARE */