1 /******************************************************************************
2  *
3  * Module Name: aetests - Miscellaneous tests for ACPICA public interfaces
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2019, 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  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
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.
133  *
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.
145  *
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.
149  *
150  *****************************************************************************/
151 
152 #include "aecommon.h"
153 
154 #define _COMPONENT          ACPI_TOOLS
155         ACPI_MODULE_NAME    ("aetests")
156 
157 /* Local prototypes */
158 
159 static void
160 AeMutexInterfaces (
161     void);
162 
163 static void
164 AeHardwareInterfaces (
165     void);
166 
167 static void
168 AeTestSleepData (
169     void);
170 
171 static void
172 AeGlobalAddressRangeCheck(
173     void);
174 
175 
176 /******************************************************************************
177  *
178  * FUNCTION:    AeMiscellaneousTests
179  *
180  * DESCRIPTION: Various ACPICA validation tests.
181  *
182  *****************************************************************************/
183 
184 void
185 AeMiscellaneousTests (
186     void)
187 {
188     ACPI_BUFFER             ReturnBuf;
189     char                    Buffer[32];
190     ACPI_STATUS             Status;
191     ACPI_STATISTICS         Stats;
192     ACPI_HANDLE             Handle;
193 
194 #if (!ACPI_REDUCED_HARDWARE)
195     UINT32                  Temp;
196     UINT32                  LockHandle1;
197     UINT32                  LockHandle2;
198     ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
199 #endif /* !ACPI_REDUCED_HARDWARE */
200 
201 
202     Status = AcpiGetHandle (NULL, "\\", &Handle);
203     ACPI_CHECK_OK (AcpiGetHandle, Status);
204 
205     if (AcpiGbl_DoInterfaceTests)
206     {
207         /*
208          * Tests for AcpiLoadTable and AcpiUnloadParentTable
209          */
210 
211         /* Attempt unload of DSDT, should fail */
212 
213         Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
214         ACPI_CHECK_OK (AcpiGetHandle, Status);
215 
216         Status = AcpiUnloadParentTable (Handle);
217         ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
218 
219         /* Load and unload SSDT4 */
220 
221         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
222         ACPI_CHECK_OK (AcpiLoadTable, Status);
223 
224         Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
225         ACPI_CHECK_OK (AcpiGetHandle, Status);
226 
227         Status = AcpiUnloadParentTable (Handle);
228         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
229 
230         /* Re-load SSDT4 */
231 
232         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
233         ACPI_CHECK_OK (AcpiLoadTable, Status);
234 
235         /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
236 
237         Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
238         ACPI_CHECK_OK (AcpiGetHandle, Status);
239 
240         Status = AcpiUnloadParentTable (Handle);
241         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
242 
243         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
244         ACPI_CHECK_OK (AcpiLoadTable, Status);
245 
246         /* Load OEM9 table (causes table override) */
247 
248         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
249         ACPI_CHECK_OK (AcpiLoadTable, Status);
250     }
251 
252     AeHardwareInterfaces ();
253     AeGenericRegisters ();
254     AeSetupConfiguration (Ssdt3Code);
255 
256     AeTestBufferArgument();
257     AeTestPackageArgument ();
258     AeMutexInterfaces ();
259     AeTestSleepData ();
260 
261     /* Test _OSI install/remove */
262 
263     Status = AcpiInstallInterface ("");
264     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
265 
266     Status = AcpiInstallInterface ("TestString");
267     ACPI_CHECK_OK (AcpiInstallInterface, Status);
268 
269     Status = AcpiInstallInterface ("TestString");
270     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
271 
272     Status = AcpiRemoveInterface ("Windows 2006");
273     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
274 
275     Status = AcpiRemoveInterface ("TestString");
276     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
277 
278     Status = AcpiRemoveInterface ("XXXXXX");
279     ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
280 
281     Status = AcpiInstallInterface ("AnotherTestString");
282     ACPI_CHECK_OK (AcpiInstallInterface, Status);
283 
284     /* Test _OSI execution */
285 
286     Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
287     ACPI_CHECK_OK (ExecuteOSI, Status);
288 
289     Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
290     ACPI_CHECK_OK (ExecuteOSI, Status);
291 
292     Status = ExecuteOSI ("MichiganTerminalSystem", 0);
293     ACPI_CHECK_OK (ExecuteOSI, Status);
294 
295 
296     ReturnBuf.Length = 32;
297     ReturnBuf.Pointer = Buffer;
298 
299     Status = AcpiGetName (ACPI_ROOT_OBJECT,
300         ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
301     ACPI_CHECK_OK (AcpiGetName, Status);
302 
303     /* Get Devices */
304 
305     Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
306     ACPI_CHECK_OK (AcpiGetDevices, Status);
307 
308     Status = AcpiGetStatistics (&Stats);
309     ACPI_CHECK_OK (AcpiGetStatistics, Status);
310 
311 
312 #if (!ACPI_REDUCED_HARDWARE)
313 
314     Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
315     ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
316 
317     /* If Hardware Reduced flag is set, we are all done */
318 
319     if (AcpiGbl_ReducedHardware)
320     {
321         return;
322     }
323 
324     Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
325     ACPI_CHECK_OK (AcpiEnableEvent, Status);
326 
327     /*
328      * GPEs: Handlers, enable/disable, etc.
329      */
330     Status = AcpiInstallGpeHandler (NULL, 0,
331         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
332     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
333 
334     Status = AcpiEnableGpe (NULL, 0);
335     ACPI_CHECK_OK (AcpiEnableGpe, Status);
336 
337     Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
338     ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
339 
340     Status = AcpiInstallGpeHandler (NULL, 0,
341         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
342     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
343 
344     Status = AcpiEnableGpe (NULL, 0);
345     ACPI_CHECK_OK (AcpiEnableGpe, Status);
346 
347     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
348     ACPI_CHECK_OK (AcpiSetGpe, Status);
349 
350     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
351     ACPI_CHECK_OK (AcpiSetGpe, Status);
352 
353 
354     Status = AcpiInstallGpeHandler (NULL, 1,
355         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
356     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
357 
358     Status = AcpiEnableGpe (NULL, 1);
359     ACPI_CHECK_OK (AcpiEnableGpe, Status);
360 
361 
362     Status = AcpiInstallGpeHandler (NULL, 2,
363         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
364     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
365 
366     Status = AcpiEnableGpe (NULL, 2);
367     ACPI_CHECK_OK (AcpiEnableGpe, Status);
368 
369 
370     Status = AcpiInstallGpeHandler (NULL, 3,
371         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
372     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
373 
374     Status = AcpiInstallGpeHandler (NULL, 4,
375         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
376     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
377 
378     Status = AcpiInstallGpeHandler (NULL, 5,
379         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
380     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
381 
382     Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
383     ACPI_CHECK_OK (AcpiGetHandle, Status);
384 
385     Status = AcpiSetupGpeForWake (Handle, NULL, 5);
386     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
387 
388     Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
389     ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
390 
391     Status = AcpiSetupGpeForWake (Handle, NULL, 6);
392     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
393 
394     Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
395     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
396 
397     Status = AcpiSetupGpeForWake (Handle, NULL, 9);
398     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
399 
400     Status = AcpiInstallGpeHandler (NULL, 0x19,
401         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
402     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
403 
404     Status = AcpiEnableGpe (NULL, 0x19);
405     ACPI_CHECK_OK (AcpiEnableGpe, Status);
406 
407 
408     /* GPE block 1 */
409 
410     Status = AcpiInstallGpeHandler (NULL, 101,
411         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
412     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
413 
414     Status = AcpiEnableGpe (NULL, 101);
415     ACPI_CHECK_OK (AcpiEnableGpe, Status);
416 
417     Status = AcpiDisableGpe (NULL, 101);
418     ACPI_CHECK_OK (AcpiDisableGpe, Status);
419 
420     AfInstallGpeBlock ();
421 
422     /* Here is where the GPEs are actually "enabled" */
423 
424     Status = AcpiUpdateAllGpes ();
425     ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
426 
427     Status = AcpiGetHandle (NULL, "RSRC", &Handle);
428     if (ACPI_SUCCESS (Status))
429     {
430         ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
431 
432         Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
433         if (ACPI_SUCCESS (Status))
434         {
435             AcpiOsFree (ReturnBuf.Pointer);
436         }
437     }
438 
439     /* Test global lock */
440 
441     Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
442     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
443 
444     Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
445     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
446 
447     Status = AcpiReleaseGlobalLock (LockHandle1);
448     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
449 
450     Status = AcpiReleaseGlobalLock (LockHandle2);
451     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
452 
453     /* Test timer interfaces */
454 
455     Status = AcpiGetTimerResolution (&Temp);
456     ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
457 
458     Status = AcpiGetTimer (&Temp);
459     ACPI_CHECK_OK (AcpiGetTimer, Status);
460 
461     Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
462     ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
463 
464 
465 #endif /* !ACPI_REDUCED_HARDWARE */
466 }
467 
468 
469 /******************************************************************************
470  *
471  * FUNCTION:    AeMutexInterfaces
472  *
473  * DESCRIPTION: Exercise the AML mutex access interfaces
474  *
475  *****************************************************************************/
476 
477 static void
478 AeMutexInterfaces (
479     void)
480 {
481     ACPI_STATUS             Status;
482     ACPI_HANDLE             MutexHandle;
483 
484 
485     /* Get a handle to an AML mutex */
486 
487     Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
488     if (Status == AE_NOT_FOUND)
489     {
490         return;
491     }
492 
493     ACPI_CHECK_OK (AcpiGetHandle, Status);
494     if (ACPI_FAILURE (Status))
495     {
496         return;
497     }
498 
499     /* Acquire the  mutex */
500 
501     Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
502     ACPI_CHECK_OK (AcpiAcquireMutex, Status);
503     if (ACPI_FAILURE (Status))
504     {
505         return;
506     }
507 
508     /* Release mutex with different parameters */
509 
510     Status = AcpiReleaseMutex (MutexHandle, NULL);
511     ACPI_CHECK_OK (AcpiReleaseMutex, Status);
512 }
513 
514 
515 /******************************************************************************
516  *
517  * FUNCTION:    AeHardwareInterfaces
518  *
519  * DESCRIPTION: Call various hardware support interfaces
520  *
521  *****************************************************************************/
522 
523 static void
524 AeHardwareInterfaces (
525     void)
526 {
527 #if (!ACPI_REDUCED_HARDWARE)
528 
529     ACPI_STATUS             Status;
530     UINT32                  Value;
531 
532 
533     /* If Hardware Reduced flag is set, we are all done */
534 
535     if (AcpiGbl_ReducedHardware)
536     {
537         return;
538     }
539 
540     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
541     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
542 
543     Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
544     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
545 
546     Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
547     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
548 
549     Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
550     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
551 
552 
553     Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
554     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
555 
556     Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
557     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
558 
559     Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
560     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
561 
562     Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
563     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
564 
565 #endif /* !ACPI_REDUCED_HARDWARE */
566 }
567 
568 
569 /******************************************************************************
570  *
571  * FUNCTION:    AeTestSleepData
572  *
573  * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
574  *
575  *****************************************************************************/
576 
577 static void
578 AeTestSleepData (
579     void)
580 {
581     int                     State;
582     UINT8                   TypeA;
583     UINT8                   TypeB;
584     ACPI_STATUS             Status;
585 
586 
587     /* Attempt to get sleep data for all known sleep states */
588 
589     for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
590     {
591         Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
592 
593         /* All sleep methods are optional */
594 
595         if (Status != AE_NOT_FOUND)
596         {
597             ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
598         }
599     }
600 }
601 
602 
603 /******************************************************************************
604  *
605  * FUNCTION:    AeLateTest
606  *
607  * DESCRIPTION: Exercise tests that should be performed before shutdown.
608  *
609  *****************************************************************************/
610 
611 void
612 AeLateTest (
613     void)
614 {
615     AeGlobalAddressRangeCheck();
616 }
617 
618 
619 /******************************************************************************
620  *
621  * FUNCTION:    AeGlobalAddressRangeCheck
622  *
623  * DESCRIPTION: There have been some issues in the past with adding and
624  *              removing items to the global address list from
625  *              OperationRegions declared in control methods. This test loops
626  *              over the list to ensure that dangling pointers do not exist in
627  *              the global address list.
628  *
629  *****************************************************************************/
630 
631 static void
632 AeGlobalAddressRangeCheck (
633     void)
634 {
635     ACPI_STATUS             Status;
636     ACPI_ADDRESS_RANGE      *Current;
637     ACPI_BUFFER             ReturnBuffer;
638     UINT32                  i;
639 
640 
641     for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
642     {
643         Current = AcpiGbl_AddressRangeList[i];
644 
645         while (Current)
646         {
647             ReturnBuffer.Length = ACPI_ALLOCATE_BUFFER;
648 
649             Status = AcpiGetName (Current->RegionNode, ACPI_SINGLE_NAME, &ReturnBuffer);
650             ACPI_CHECK_OK (AcpiGetname, Status);
651 
652             AcpiOsFree (ReturnBuffer.Pointer);
653             Current = Current->Next;
654         }
655     }
656 }
657