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