1 /****************************************************************************** 2 * 3 * Module Name: aeexec - Support routines for AcpiExec utility 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2013, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 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. 25 * 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. 29 * 30 * NO WARRANTY 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. 42 */ 43 44 #include "aecommon.h" 45 46 #define _COMPONENT ACPI_TOOLS 47 ACPI_MODULE_NAME ("aeexec") 48 49 /* Local prototypes */ 50 51 static ACPI_STATUS 52 AeSetupConfiguration ( 53 void *RegionAddr); 54 55 static void 56 AeTestBufferArgument ( 57 void); 58 59 static void 60 AeTestPackageArgument ( 61 void); 62 63 static ACPI_STATUS 64 AeGetDevices ( 65 ACPI_HANDLE ObjHandle, 66 UINT32 NestingLevel, 67 void *Context, 68 void **ReturnValue); 69 70 static ACPI_STATUS 71 ExecuteOSI ( 72 char *OsiString, 73 UINT32 ExpectedResult); 74 75 static void 76 AeMutexInterfaces ( 77 void); 78 79 static void 80 AeHardwareInterfaces ( 81 void); 82 83 static void 84 AeGenericRegisters ( 85 void); 86 87 #if (!ACPI_REDUCED_HARDWARE) 88 static void 89 AfInstallGpeBlock ( 90 void); 91 #endif /* !ACPI_REDUCED_HARDWARE */ 92 93 extern unsigned char Ssdt2Code[]; 94 extern unsigned char Ssdt3Code[]; 95 extern unsigned char Ssdt4Code[]; 96 97 98 /****************************************************************************** 99 * 100 * FUNCTION: AeSetupConfiguration 101 * 102 * PARAMETERS: RegionAddr - Address for an ACPI table to be loaded 103 * dynamically. Test purposes only. 104 * 105 * RETURN: Status 106 * 107 * DESCRIPTION: Call AML _CFG configuration control method 108 * 109 *****************************************************************************/ 110 111 static ACPI_STATUS 112 AeSetupConfiguration ( 113 void *RegionAddr) 114 { 115 ACPI_OBJECT_LIST ArgList; 116 ACPI_OBJECT Arg[3]; 117 118 119 /* 120 * Invoke _CFG method if present 121 */ 122 ArgList.Count = 1; 123 ArgList.Pointer = Arg; 124 125 Arg[0].Type = ACPI_TYPE_INTEGER; 126 Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr); 127 128 (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL); 129 return (AE_OK); 130 } 131 132 133 #if (!ACPI_REDUCED_HARDWARE) 134 /****************************************************************************** 135 * 136 * FUNCTION: AfInstallGpeBlock 137 * 138 * PARAMETERS: None 139 * 140 * RETURN: None 141 * 142 * DESCRIPTION: Test GPE block device initialization. Requires test ASL with 143 * A \GPE2 device. 144 * 145 *****************************************************************************/ 146 147 static void 148 AfInstallGpeBlock ( 149 void) 150 { 151 ACPI_STATUS Status; 152 ACPI_HANDLE Handle; 153 ACPI_HANDLE Handle2 = NULL; 154 ACPI_HANDLE Handle3 = NULL; 155 ACPI_GENERIC_ADDRESS BlockAddress; 156 ACPI_HANDLE GpeDevice; 157 158 159 Status = AcpiGetHandle (NULL, "\\_GPE", &Handle); 160 if (ACPI_FAILURE (Status)) 161 { 162 return; 163 } 164 165 ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS)); 166 BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; 167 BlockAddress.Address = 0x76540000; 168 169 Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2); 170 if (ACPI_SUCCESS (Status)) 171 { 172 Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8); 173 AE_CHECK_OK (AcpiInstallGpeBlock, Status); 174 175 Status = AcpiInstallGpeHandler (Handle2, 8, 176 ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 177 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 178 179 Status = AcpiEnableGpe (Handle2, 8); 180 AE_CHECK_OK (AcpiEnableGpe, Status); 181 182 Status = AcpiGetGpeDevice (0x30, &GpeDevice); 183 AE_CHECK_OK (AcpiGetGpeDevice, Status); 184 185 Status = AcpiGetGpeDevice (0x42, &GpeDevice); 186 AE_CHECK_OK (AcpiGetGpeDevice, Status); 187 188 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice); 189 AE_CHECK_OK (AcpiGetGpeDevice, Status); 190 191 Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice); 192 AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST); 193 194 Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler); 195 AE_CHECK_OK (AcpiRemoveGpeHandler, Status); 196 } 197 198 Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3); 199 if (ACPI_SUCCESS (Status)) 200 { 201 Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11); 202 AE_CHECK_OK (AcpiInstallGpeBlock, Status); 203 } 204 } 205 #endif /* !ACPI_REDUCED_HARDWARE */ 206 207 208 /* Test using a Buffer object as a method argument */ 209 210 static void 211 AeTestBufferArgument ( 212 void) 213 { 214 ACPI_OBJECT_LIST Params; 215 ACPI_OBJECT BufArg; 216 UINT8 Buffer[] = { 217 0,0,0,0, 218 4,0,0,0, 219 1,2,3,4}; 220 221 222 BufArg.Type = ACPI_TYPE_BUFFER; 223 BufArg.Buffer.Length = 12; 224 BufArg.Buffer.Pointer = Buffer; 225 226 Params.Count = 1; 227 Params.Pointer = &BufArg; 228 229 (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL); 230 } 231 232 233 static ACPI_OBJECT PkgArg; 234 static ACPI_OBJECT PkgElements[5]; 235 static ACPI_OBJECT Pkg2Elements[5]; 236 static ACPI_OBJECT_LIST Params; 237 238 239 /* 240 * Test using a Package object as an method argument 241 */ 242 static void 243 AeTestPackageArgument ( 244 void) 245 { 246 247 /* Main package */ 248 249 PkgArg.Type = ACPI_TYPE_PACKAGE; 250 PkgArg.Package.Count = 4; 251 PkgArg.Package.Elements = PkgElements; 252 253 /* Main package elements */ 254 255 PkgElements[0].Type = ACPI_TYPE_INTEGER; 256 PkgElements[0].Integer.Value = 0x22228888; 257 258 PkgElements[1].Type = ACPI_TYPE_STRING; 259 PkgElements[1].String.Length = sizeof ("Top-level package"); 260 PkgElements[1].String.Pointer = "Top-level package"; 261 262 PkgElements[2].Type = ACPI_TYPE_BUFFER; 263 PkgElements[2].Buffer.Length = sizeof ("XXXX"); 264 PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX"; 265 266 PkgElements[3].Type = ACPI_TYPE_PACKAGE; 267 PkgElements[3].Package.Count = 2; 268 PkgElements[3].Package.Elements = Pkg2Elements; 269 270 /* Sub-package elements */ 271 272 Pkg2Elements[0].Type = ACPI_TYPE_INTEGER; 273 Pkg2Elements[0].Integer.Value = 0xAAAABBBB; 274 275 Pkg2Elements[1].Type = ACPI_TYPE_STRING; 276 Pkg2Elements[1].String.Length = sizeof ("Nested Package"); 277 Pkg2Elements[1].String.Pointer = "Nested Package"; 278 279 /* Parameter object */ 280 281 Params.Count = 1; 282 Params.Pointer = &PkgArg; 283 284 (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL); 285 } 286 287 288 static ACPI_STATUS 289 AeGetDevices ( 290 ACPI_HANDLE ObjHandle, 291 UINT32 NestingLevel, 292 void *Context, 293 void **ReturnValue) 294 { 295 296 return (AE_OK); 297 } 298 299 300 /****************************************************************************** 301 * 302 * FUNCTION: ExecuteOSI 303 * 304 * PARAMETERS: OsiString - String passed to _OSI method 305 * ExpectedResult - 0 (FALSE) or 0xFFFFFFFF (TRUE) 306 * 307 * RETURN: Status 308 * 309 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method. 310 * 311 *****************************************************************************/ 312 313 static ACPI_STATUS 314 ExecuteOSI ( 315 char *OsiString, 316 UINT32 ExpectedResult) 317 { 318 ACPI_STATUS Status; 319 ACPI_OBJECT_LIST ArgList; 320 ACPI_OBJECT Arg[1]; 321 ACPI_BUFFER ReturnValue; 322 ACPI_OBJECT *Obj; 323 324 325 /* Setup input argument */ 326 327 ArgList.Count = 1; 328 ArgList.Pointer = Arg; 329 330 Arg[0].Type = ACPI_TYPE_STRING; 331 Arg[0].String.Pointer = OsiString; 332 Arg[0].String.Length = strlen (Arg[0].String.Pointer); 333 334 /* Ask ACPICA to allocate space for the return object */ 335 336 ReturnValue.Length = ACPI_ALLOCATE_BUFFER; 337 338 Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue); 339 340 if (ACPI_FAILURE (Status)) 341 { 342 AcpiOsPrintf ("Could not execute _OSI method, %s\n", 343 AcpiFormatException (Status)); 344 return (Status); 345 } 346 347 Status = AE_ERROR; 348 349 if (ReturnValue.Length < sizeof (ACPI_OBJECT)) 350 { 351 AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n", 352 ReturnValue.Length); 353 goto ErrorExit; 354 } 355 356 Obj = ReturnValue.Pointer; 357 if (Obj->Type != ACPI_TYPE_INTEGER) 358 { 359 AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type); 360 goto ErrorExit; 361 } 362 363 if (Obj->Integer.Value != ExpectedResult) 364 { 365 AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n", 366 ExpectedResult, (UINT32) Obj->Integer.Value); 367 goto ErrorExit; 368 } 369 370 Status = AE_OK; 371 372 /* Reset the OSI data */ 373 374 AcpiGbl_OsiData = 0; 375 376 ErrorExit: 377 378 /* Free a buffer created via ACPI_ALLOCATE_BUFFER */ 379 380 AcpiOsFree (ReturnValue.Pointer); 381 382 return (Status); 383 } 384 385 386 /****************************************************************************** 387 * 388 * FUNCTION: AeGenericRegisters 389 * 390 * DESCRIPTION: Call the AcpiRead/Write interfaces. 391 * 392 *****************************************************************************/ 393 394 static ACPI_GENERIC_ADDRESS GenericRegister; 395 396 static void 397 AeGenericRegisters ( 398 void) 399 { 400 ACPI_STATUS Status; 401 UINT64 Value; 402 403 404 GenericRegister.Address = 0x1234; 405 GenericRegister.BitWidth = 64; 406 GenericRegister.BitOffset = 0; 407 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; 408 409 Status = AcpiRead (&Value, &GenericRegister); 410 AE_CHECK_OK (AcpiRead, Status); 411 412 Status = AcpiWrite (Value, &GenericRegister); 413 AE_CHECK_OK (AcpiWrite, Status); 414 415 GenericRegister.Address = 0x12345678; 416 GenericRegister.BitOffset = 0; 417 GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; 418 419 Status = AcpiRead (&Value, &GenericRegister); 420 AE_CHECK_OK (AcpiRead, Status); 421 422 Status = AcpiWrite (Value, &GenericRegister); 423 AE_CHECK_OK (AcpiWrite, Status); 424 } 425 426 427 /****************************************************************************** 428 * 429 * FUNCTION: AeMutexInterfaces 430 * 431 * DESCRIPTION: Exercise the AML mutex access interfaces 432 * 433 *****************************************************************************/ 434 435 static void 436 AeMutexInterfaces ( 437 void) 438 { 439 ACPI_STATUS Status; 440 ACPI_HANDLE MutexHandle; 441 442 443 /* Get a handle to an AML mutex */ 444 445 Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle); 446 if (Status == AE_NOT_FOUND) 447 { 448 return; 449 } 450 451 AE_CHECK_OK (AcpiGetHandle, Status); 452 if (ACPI_FAILURE (Status)) 453 { 454 return; 455 } 456 457 /* Acquire the mutex */ 458 459 Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF); 460 AE_CHECK_OK (AcpiAcquireMutex, Status); 461 if (ACPI_FAILURE (Status)) 462 { 463 return; 464 } 465 466 /* Release mutex with different parameters */ 467 468 Status = AcpiReleaseMutex (MutexHandle, NULL); 469 AE_CHECK_OK (AcpiReleaseMutex, Status); 470 } 471 472 473 /****************************************************************************** 474 * 475 * FUNCTION: AeHardwareInterfaces 476 * 477 * DESCRIPTION: Call various hardware support interfaces 478 * 479 *****************************************************************************/ 480 481 static void 482 AeHardwareInterfaces ( 483 void) 484 { 485 #if (!ACPI_REDUCED_HARDWARE) 486 487 ACPI_STATUS Status; 488 UINT32 Value; 489 490 491 /* If Hardware Reduced flag is set, we are all done */ 492 493 if (AcpiGbl_ReducedHardware) 494 { 495 return; 496 } 497 498 Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); 499 AE_CHECK_OK (AcpiWriteBitRegister, Status); 500 501 Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1); 502 AE_CHECK_OK (AcpiWriteBitRegister, Status); 503 504 Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1); 505 AE_CHECK_OK (AcpiWriteBitRegister, Status); 506 507 Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); 508 AE_CHECK_OK (AcpiWriteBitRegister, Status); 509 510 511 Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value); 512 AE_CHECK_OK (AcpiReadBitRegister, Status); 513 514 Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value); 515 AE_CHECK_OK (AcpiReadBitRegister, Status); 516 517 Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value); 518 AE_CHECK_OK (AcpiReadBitRegister, Status); 519 520 Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value); 521 AE_CHECK_OK (AcpiReadBitRegister, Status); 522 523 #endif /* !ACPI_REDUCED_HARDWARE */ 524 } 525 526 527 /****************************************************************************** 528 * 529 * FUNCTION: AeMiscellaneousTests 530 * 531 * DESCRIPTION: Various ACPICA validation tests. 532 * 533 *****************************************************************************/ 534 535 void 536 AeMiscellaneousTests ( 537 void) 538 { 539 ACPI_BUFFER ReturnBuf; 540 char Buffer[32]; 541 ACPI_STATUS Status; 542 ACPI_STATISTICS Stats; 543 ACPI_HANDLE Handle; 544 545 #if (!ACPI_REDUCED_HARDWARE) 546 ACPI_VENDOR_UUID Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}}; 547 UINT32 LockHandle1; 548 UINT32 LockHandle2; 549 #endif /* !ACPI_REDUCED_HARDWARE */ 550 551 552 Status = AcpiGetHandle (NULL, "\\", &Handle); 553 AE_CHECK_OK (AcpiGetHandle, Status); 554 555 if (AcpiGbl_DoInterfaceTests) 556 { 557 /* 558 * Tests for AcpiLoadTable and AcpiUnloadParentTable 559 */ 560 561 /* Attempt unload of DSDT, should fail */ 562 563 Status = AcpiGetHandle (NULL, "\\_SB_", &Handle); 564 AE_CHECK_OK (AcpiGetHandle, Status); 565 566 Status = AcpiUnloadParentTable (Handle); 567 AE_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE); 568 569 /* Load and unload SSDT4 */ 570 571 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); 572 AE_CHECK_OK (AcpiLoadTable, Status); 573 574 Status = AcpiGetHandle (NULL, "\\_T96", &Handle); 575 AE_CHECK_OK (AcpiGetHandle, Status); 576 577 Status = AcpiUnloadParentTable (Handle); 578 AE_CHECK_OK (AcpiUnloadParentTable, Status); 579 580 /* Re-load SSDT4 */ 581 582 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); 583 AE_CHECK_OK (AcpiLoadTable, Status); 584 585 /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */ 586 587 Status = AcpiGetHandle (NULL, "\\_T99", &Handle); 588 AE_CHECK_OK (AcpiGetHandle, Status); 589 590 Status = AcpiUnloadParentTable (Handle); 591 AE_CHECK_OK (AcpiUnloadParentTable, Status); 592 593 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code); 594 AE_CHECK_OK (AcpiLoadTable, Status); 595 596 /* Load OEM9 table (causes table override) */ 597 598 Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code); 599 AE_CHECK_OK (AcpiLoadTable, Status); 600 } 601 602 AeHardwareInterfaces (); 603 AeGenericRegisters (); 604 AeSetupConfiguration (Ssdt3Code); 605 606 AeTestBufferArgument(); 607 AeTestPackageArgument (); 608 AeMutexInterfaces (); 609 610 /* Test _OSI install/remove */ 611 612 Status = AcpiInstallInterface (""); 613 AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER); 614 615 Status = AcpiInstallInterface ("TestString"); 616 AE_CHECK_OK (AcpiInstallInterface, Status); 617 618 Status = AcpiInstallInterface ("TestString"); 619 AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS); 620 621 Status = AcpiRemoveInterface ("Windows 2006"); 622 AE_CHECK_OK (AcpiRemoveInterface, Status); 623 624 Status = AcpiRemoveInterface ("TestString"); 625 AE_CHECK_OK (AcpiRemoveInterface, Status); 626 627 Status = AcpiRemoveInterface ("XXXXXX"); 628 AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST); 629 630 Status = AcpiInstallInterface ("AnotherTestString"); 631 AE_CHECK_OK (AcpiInstallInterface, Status); 632 633 /* Test _OSI execution */ 634 635 Status = ExecuteOSI ("Extended Address Space Descriptor", 0xFFFFFFFF); 636 AE_CHECK_OK (ExecuteOSI, Status); 637 638 Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF); 639 AE_CHECK_OK (ExecuteOSI, Status); 640 641 Status = ExecuteOSI ("MichiganTerminalSystem", 0); 642 AE_CHECK_OK (ExecuteOSI, Status); 643 644 645 ReturnBuf.Length = 32; 646 ReturnBuf.Pointer = Buffer; 647 648 Status = AcpiGetName (ACPI_ROOT_OBJECT, ACPI_FULL_PATHNAME, &ReturnBuf); 649 AE_CHECK_OK (AcpiGetName, Status); 650 651 /* Get Devices */ 652 653 Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); 654 AE_CHECK_OK (AcpiGetDevices, Status); 655 656 Status = AcpiGetStatistics (&Stats); 657 AE_CHECK_OK (AcpiGetStatistics, Status); 658 659 660 #if (!ACPI_REDUCED_HARDWARE) 661 662 Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL); 663 AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status); 664 665 /* If Hardware Reduced flag is set, we are all done */ 666 667 if (AcpiGbl_ReducedHardware) 668 { 669 return; 670 } 671 672 Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); 673 AE_CHECK_OK (AcpiEnableEvent, Status); 674 675 /* 676 * GPEs: Handlers, enable/disable, etc. 677 */ 678 Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 679 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 680 681 Status = AcpiEnableGpe (NULL, 0); 682 AE_CHECK_OK (AcpiEnableGpe, Status); 683 684 Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler); 685 AE_CHECK_OK (AcpiRemoveGpeHandler, Status); 686 687 Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 688 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 689 690 Status = AcpiEnableGpe (NULL, 0); 691 AE_CHECK_OK (AcpiEnableGpe, Status); 692 693 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE); 694 AE_CHECK_OK (AcpiSetGpe, Status); 695 696 Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE); 697 AE_CHECK_OK (AcpiSetGpe, Status); 698 699 700 Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); 701 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 702 703 Status = AcpiEnableGpe (NULL, 1); 704 AE_CHECK_OK (AcpiEnableGpe, Status); 705 706 707 Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 708 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 709 710 Status = AcpiEnableGpe (NULL, 2); 711 AE_CHECK_OK (AcpiEnableGpe, Status); 712 713 714 Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); 715 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 716 717 Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 718 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 719 720 Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); 721 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 722 723 Status = AcpiGetHandle (NULL, "\\_SB", &Handle); 724 AE_CHECK_OK (AcpiGetHandle, Status); 725 726 Status = AcpiSetupGpeForWake (Handle, NULL, 5); 727 AE_CHECK_OK (AcpiSetupGpeForWake, Status); 728 729 Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE); 730 AE_CHECK_OK (AcpiSetGpeWakeMask, Status); 731 732 Status = AcpiSetupGpeForWake (Handle, NULL, 6); 733 AE_CHECK_OK (AcpiSetupGpeForWake, Status); 734 735 Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6); 736 AE_CHECK_OK (AcpiSetupGpeForWake, Status); 737 738 Status = AcpiSetupGpeForWake (Handle, NULL, 9); 739 AE_CHECK_OK (AcpiSetupGpeForWake, Status); 740 741 Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 742 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 743 744 Status = AcpiEnableGpe (NULL, 0x19); 745 AE_CHECK_OK (AcpiEnableGpe, Status); 746 747 748 Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); 749 AE_CHECK_OK (AcpiInstallGpeHandler, Status); 750 751 Status = AcpiEnableGpe (NULL, 0x62); 752 AE_CHECK_OK (AcpiEnableGpe, Status); 753 754 Status = AcpiDisableGpe (NULL, 0x62); 755 AE_CHECK_OK (AcpiDisableGpe, Status); 756 757 AfInstallGpeBlock (); 758 759 /* Here is where the GPEs are actually "enabled" */ 760 761 Status = AcpiUpdateAllGpes (); 762 AE_CHECK_OK (AcpiUpdateAllGpes, Status); 763 764 Status = AcpiGetHandle (NULL, "RSRC", &Handle); 765 if (ACPI_SUCCESS (Status)) 766 { 767 ReturnBuf.Length = ACPI_ALLOCATE_BUFFER; 768 769 Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf); 770 if (ACPI_SUCCESS (Status)) 771 { 772 AcpiOsFree (ReturnBuf.Pointer); 773 } 774 } 775 776 /* Test global lock */ 777 778 Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1); 779 AE_CHECK_OK (AcpiAcquireGlobalLock, Status); 780 781 Status = AcpiAcquireGlobalLock (0x5, &LockHandle2); 782 AE_CHECK_OK (AcpiAcquireGlobalLock, Status); 783 784 Status = AcpiReleaseGlobalLock (LockHandle1); 785 AE_CHECK_OK (AcpiReleaseGlobalLock, Status); 786 787 Status = AcpiReleaseGlobalLock (LockHandle2); 788 AE_CHECK_OK (AcpiReleaseGlobalLock, Status); 789 790 #endif /* !ACPI_REDUCED_HARDWARE */ 791 }