evmisc.c revision 167802
1/****************************************************************************** 2 * 3 * Module Name: evmisc - Miscellaneous event manager support functions 4 * $Revision: 1.103 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117#include <contrib/dev/acpica/acpi.h> 118#include <contrib/dev/acpica/acevents.h> 119#include <contrib/dev/acpica/acnamesp.h> 120#include <contrib/dev/acpica/acinterp.h> 121 122#define _COMPONENT ACPI_EVENTS 123 ACPI_MODULE_NAME ("evmisc") 124 125 126/* Names for Notify() values, used for debug output */ 127 128#ifdef ACPI_DEBUG_OUTPUT 129static const char *AcpiNotifyValueNames[] = 130{ 131 "Bus Check", 132 "Device Check", 133 "Device Wake", 134 "Eject Request", 135 "Device Check Light", 136 "Frequency Mismatch", 137 "Bus Mode Mismatch", 138 "Power Fault" 139}; 140#endif 141 142/* Pointer to FACS needed for the Global Lock */ 143 144static ACPI_TABLE_FACS *Facs = NULL; 145 146/* Local prototypes */ 147 148static void ACPI_SYSTEM_XFACE 149AcpiEvNotifyDispatch ( 150 void *Context); 151 152static UINT32 153AcpiEvGlobalLockHandler ( 154 void *Context); 155 156static ACPI_STATUS 157AcpiEvRemoveGlobalLockHandler ( 158 void); 159 160 161/******************************************************************************* 162 * 163 * FUNCTION: AcpiEvIsNotifyObject 164 * 165 * PARAMETERS: Node - Node to check 166 * 167 * RETURN: TRUE if notifies allowed on this object 168 * 169 * DESCRIPTION: Check type of node for a object that supports notifies. 170 * 171 * TBD: This could be replaced by a flag bit in the node. 172 * 173 ******************************************************************************/ 174 175BOOLEAN 176AcpiEvIsNotifyObject ( 177 ACPI_NAMESPACE_NODE *Node) 178{ 179 switch (Node->Type) 180 { 181 case ACPI_TYPE_DEVICE: 182 case ACPI_TYPE_PROCESSOR: 183 case ACPI_TYPE_POWER: 184 case ACPI_TYPE_THERMAL: 185 /* 186 * These are the ONLY objects that can receive ACPI notifications 187 */ 188 return (TRUE); 189 190 default: 191 return (FALSE); 192 } 193} 194 195 196/******************************************************************************* 197 * 198 * FUNCTION: AcpiEvQueueNotifyRequest 199 * 200 * PARAMETERS: Node - NS node for the notified object 201 * NotifyValue - Value from the Notify() request 202 * 203 * RETURN: Status 204 * 205 * DESCRIPTION: Dispatch a device notification event to a previously 206 * installed handler. 207 * 208 ******************************************************************************/ 209 210ACPI_STATUS 211AcpiEvQueueNotifyRequest ( 212 ACPI_NAMESPACE_NODE *Node, 213 UINT32 NotifyValue) 214{ 215 ACPI_OPERAND_OBJECT *ObjDesc; 216 ACPI_OPERAND_OBJECT *HandlerObj = NULL; 217 ACPI_GENERIC_STATE *NotifyInfo; 218 ACPI_STATUS Status = AE_OK; 219 220 221 ACPI_FUNCTION_NAME (EvQueueNotifyRequest); 222 223 224 /* 225 * For value 3 (Ejection Request), some device method may need to be run. 226 * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need 227 * to be run. 228 * For value 0x80 (Status Change) on the power button or sleep button, 229 * initiate soft-off or sleep operation? 230 */ 231 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 232 "Dispatching Notify(%X) on node %p\n", NotifyValue, Node)); 233 234 if (NotifyValue <= 7) 235 { 236 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", 237 AcpiNotifyValueNames[NotifyValue])); 238 } 239 else 240 { 241 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 242 "Notify value: 0x%2.2X **Device Specific**\n", 243 NotifyValue)); 244 } 245 246 /* Get the notify object attached to the NS Node */ 247 248 ObjDesc = AcpiNsGetAttachedObject (Node); 249 if (ObjDesc) 250 { 251 /* We have the notify object, Get the right handler */ 252 253 switch (Node->Type) 254 { 255 case ACPI_TYPE_DEVICE: 256 case ACPI_TYPE_THERMAL: 257 case ACPI_TYPE_PROCESSOR: 258 case ACPI_TYPE_POWER: 259 260 if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) 261 { 262 HandlerObj = ObjDesc->CommonNotify.SystemNotify; 263 } 264 else 265 { 266 HandlerObj = ObjDesc->CommonNotify.DeviceNotify; 267 } 268 break; 269 270 default: 271 /* All other types are not supported */ 272 return (AE_TYPE); 273 } 274 } 275 276 /* If there is any handler to run, schedule the dispatcher */ 277 278 if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) || 279 (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) || 280 HandlerObj) 281 { 282 NotifyInfo = AcpiUtCreateGenericState (); 283 if (!NotifyInfo) 284 { 285 return (AE_NO_MEMORY); 286 } 287 288 NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; 289 NotifyInfo->Notify.Node = Node; 290 NotifyInfo->Notify.Value = (UINT16) NotifyValue; 291 NotifyInfo->Notify.HandlerObj = HandlerObj; 292 293 Status = AcpiOsExecute ( 294 OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo); 295 if (ACPI_FAILURE (Status)) 296 { 297 AcpiUtDeleteGenericState (NotifyInfo); 298 } 299 } 300 301 if (!HandlerObj) 302 { 303 /* 304 * There is no per-device notify handler for this device. 305 * This may or may not be a problem. 306 */ 307 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 308 "No notify handler for Notify(%4.4s, %X) node %p\n", 309 AcpiUtGetNodeName (Node), NotifyValue, Node)); 310 } 311 312 return (Status); 313} 314 315 316/******************************************************************************* 317 * 318 * FUNCTION: AcpiEvNotifyDispatch 319 * 320 * PARAMETERS: Context - To be passed to the notify handler 321 * 322 * RETURN: None. 323 * 324 * DESCRIPTION: Dispatch a device notification event to a previously 325 * installed handler. 326 * 327 ******************************************************************************/ 328 329static void ACPI_SYSTEM_XFACE 330AcpiEvNotifyDispatch ( 331 void *Context) 332{ 333 ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context; 334 ACPI_NOTIFY_HANDLER GlobalHandler = NULL; 335 void *GlobalContext = NULL; 336 ACPI_OPERAND_OBJECT *HandlerObj; 337 338 339 ACPI_FUNCTION_ENTRY (); 340 341 342 /* 343 * We will invoke a global notify handler if installed. 344 * This is done _before_ we invoke the per-device handler attached 345 * to the device. 346 */ 347 if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY) 348 { 349 /* Global system notification handler */ 350 351 if (AcpiGbl_SystemNotify.Handler) 352 { 353 GlobalHandler = AcpiGbl_SystemNotify.Handler; 354 GlobalContext = AcpiGbl_SystemNotify.Context; 355 } 356 } 357 else 358 { 359 /* Global driver notification handler */ 360 361 if (AcpiGbl_DeviceNotify.Handler) 362 { 363 GlobalHandler = AcpiGbl_DeviceNotify.Handler; 364 GlobalContext = AcpiGbl_DeviceNotify.Context; 365 } 366 } 367 368 /* Invoke the system handler first, if present */ 369 370 if (GlobalHandler) 371 { 372 GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, 373 GlobalContext); 374 } 375 376 /* Now invoke the per-device handler, if present */ 377 378 HandlerObj = NotifyInfo->Notify.HandlerObj; 379 if (HandlerObj) 380 { 381 HandlerObj->Notify.Handler (NotifyInfo->Notify.Node, 382 NotifyInfo->Notify.Value, 383 HandlerObj->Notify.Context); 384 } 385 386 /* All done with the info object */ 387 388 AcpiUtDeleteGenericState (NotifyInfo); 389} 390 391 392/******************************************************************************* 393 * 394 * FUNCTION: AcpiEvGlobalLockHandler 395 * 396 * PARAMETERS: Context - From thread interface, not used 397 * 398 * RETURN: ACPI_INTERRUPT_HANDLED 399 * 400 * DESCRIPTION: Invoked directly from the SCI handler when a global lock 401 * release interrupt occurs. Attempt to acquire the global lock, 402 * if successful, signal the thread waiting for the lock. 403 * 404 * NOTE: Assumes that the semaphore can be signaled from interrupt level. If 405 * this is not possible for some reason, a separate thread will have to be 406 * scheduled to do this. 407 * 408 ******************************************************************************/ 409 410static UINT32 411AcpiEvGlobalLockHandler ( 412 void *Context) 413{ 414 BOOLEAN Acquired = FALSE; 415 ACPI_STATUS Status; 416 417 418 /* 419 * Attempt to get the lock. 420 * 421 * If we don't get it now, it will be marked pending and we will 422 * take another interrupt when it becomes free. 423 */ 424 ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired); 425 if (Acquired) 426 { 427 /* Got the lock, now wake the thread waiting for it */ 428 429 AcpiGbl_GlobalLockAcquired = TRUE; 430 431 /* Send a unit to the semaphore */ 432 433 Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); 434 if (ACPI_FAILURE (Status)) 435 { 436 ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); 437 } 438 } 439 440 return (ACPI_INTERRUPT_HANDLED); 441} 442 443 444/******************************************************************************* 445 * 446 * FUNCTION: AcpiEvInitGlobalLockHandler 447 * 448 * PARAMETERS: None 449 * 450 * RETURN: Status 451 * 452 * DESCRIPTION: Install a handler for the global lock release event 453 * 454 ******************************************************************************/ 455 456ACPI_STATUS 457AcpiEvInitGlobalLockHandler ( 458 void) 459{ 460 ACPI_STATUS Status; 461 462 463 ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); 464 465 466 Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs); 467 if (ACPI_FAILURE (Status)) 468 { 469 return_ACPI_STATUS (Status); 470 } 471 472 AcpiGbl_GlobalLockPresent = TRUE; 473 Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, 474 AcpiEvGlobalLockHandler, NULL); 475 476 /* 477 * If the global lock does not exist on this platform, the attempt 478 * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick) 479 * Map to AE_OK, but mark global lock as not present. 480 * Any attempt to actually use the global lock will be flagged 481 * with an error. 482 */ 483 if (Status == AE_NO_HARDWARE_RESPONSE) 484 { 485 ACPI_ERROR ((AE_INFO, 486 "No response from Global Lock hardware, disabling lock")); 487 488 AcpiGbl_GlobalLockPresent = FALSE; 489 Status = AE_OK; 490 } 491 492 return_ACPI_STATUS (Status); 493} 494 495 496/******************************************************************************* 497 * 498 * FUNCTION: AcpiEvRemoveGlobalLockHandler 499 * 500 * PARAMETERS: None 501 * 502 * RETURN: Status 503 * 504 * DESCRIPTION: Remove the handler for the Global Lock 505 * 506 ******************************************************************************/ 507 508static ACPI_STATUS 509AcpiEvRemoveGlobalLockHandler ( 510 void) 511{ 512 ACPI_STATUS Status; 513 514 515 ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); 516 517 AcpiGbl_GlobalLockPresent = FALSE; 518 Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, 519 AcpiEvGlobalLockHandler); 520 521 return_ACPI_STATUS (Status); 522} 523 524 525/****************************************************************************** 526 * 527 * FUNCTION: AcpiEvAcquireGlobalLock 528 * 529 * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. 530 * 531 * RETURN: Status 532 * 533 * DESCRIPTION: Attempt to gain ownership of the Global Lock. 534 * 535 * MUTEX: Interpreter must be locked 536 * 537 * Note: The original implementation allowed multiple threads to "acquire" the 538 * Global Lock, and the OS would hold the lock until the last thread had 539 * released it. However, this could potentially starve the BIOS out of the 540 * lock, especially in the case where there is a tight handshake between the 541 * Embedded Controller driver and the BIOS. Therefore, this implementation 542 * allows only one thread to acquire the HW Global Lock at a time, and makes 543 * the global lock appear as a standard mutex on the OS side. 544 * 545 *****************************************************************************/ 546 547ACPI_STATUS 548AcpiEvAcquireGlobalLock ( 549 UINT16 Timeout) 550{ 551 ACPI_STATUS Status = AE_OK; 552 BOOLEAN Acquired = FALSE; 553 554 555 ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); 556 557 558 /* 559 * Only one thread can acquire the GL at a time, the GlobalLockMutex 560 * enforces this. This interface releases the interpreter if we must wait. 561 */ 562 Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, 563 Timeout); 564 if (ACPI_FAILURE (Status)) 565 { 566 return_ACPI_STATUS (Status); 567 } 568 569 /* 570 * Make sure that a global lock actually exists. If not, just treat 571 * the lock as a standard mutex. 572 */ 573 if (!AcpiGbl_GlobalLockPresent) 574 { 575 AcpiGbl_GlobalLockAcquired = TRUE; 576 return_ACPI_STATUS (AE_OK); 577 } 578 579 /* Attempt to acquire the actual hardware lock */ 580 581 ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired); 582 if (Acquired) 583 { 584 /* We got the lock */ 585 586 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n")); 587 588 AcpiGbl_GlobalLockAcquired = TRUE; 589 return_ACPI_STATUS (AE_OK); 590 } 591 592 /* 593 * Did not get the lock. The pending bit was set above, and we must now 594 * wait until we get the global lock released interrupt. 595 */ 596 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n")); 597 598 /* 599 * Wait for handshake with the global lock interrupt handler. 600 * This interface releases the interpreter if we must wait. 601 */ 602 Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, 603 ACPI_WAIT_FOREVER); 604 605 return_ACPI_STATUS (Status); 606} 607 608 609/******************************************************************************* 610 * 611 * FUNCTION: AcpiEvReleaseGlobalLock 612 * 613 * PARAMETERS: None 614 * 615 * RETURN: Status 616 * 617 * DESCRIPTION: Releases ownership of the Global Lock. 618 * 619 ******************************************************************************/ 620 621ACPI_STATUS 622AcpiEvReleaseGlobalLock ( 623 void) 624{ 625 BOOLEAN Pending = FALSE; 626 ACPI_STATUS Status = AE_OK; 627 628 629 ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); 630 631 632 /* Lock must be already acquired */ 633 634 if (!AcpiGbl_GlobalLockAcquired) 635 { 636 ACPI_WARNING ((AE_INFO, 637 "Cannot release the ACPI Global Lock, it has not been acquired")); 638 return_ACPI_STATUS (AE_NOT_ACQUIRED); 639 } 640 641 if (AcpiGbl_GlobalLockPresent) 642 { 643 /* Allow any thread to release the lock */ 644 645 ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending); 646 647 /* 648 * If the pending bit was set, we must write GBL_RLS to the control 649 * register 650 */ 651 if (Pending) 652 { 653 Status = AcpiSetRegister ( 654 ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1); 655 } 656 657 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); 658 } 659 660 AcpiGbl_GlobalLockAcquired = FALSE; 661 662 /* Release the local GL mutex */ 663 664 AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); 665 return_ACPI_STATUS (Status); 666} 667 668 669/****************************************************************************** 670 * 671 * FUNCTION: AcpiEvTerminate 672 * 673 * PARAMETERS: none 674 * 675 * RETURN: none 676 * 677 * DESCRIPTION: Disable events and free memory allocated for table storage. 678 * 679 ******************************************************************************/ 680 681void 682AcpiEvTerminate ( 683 void) 684{ 685 ACPI_NATIVE_UINT i; 686 ACPI_STATUS Status; 687 688 689 ACPI_FUNCTION_TRACE (EvTerminate); 690 691 692 if (AcpiGbl_EventsInitialized) 693 { 694 /* 695 * Disable all event-related functionality. 696 * In all cases, on error, print a message but obviously we don't abort. 697 */ 698 699 /* Disable all fixed events */ 700 701 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 702 { 703 Status = AcpiDisableEvent ((UINT32) i, 0); 704 if (ACPI_FAILURE (Status)) 705 { 706 ACPI_ERROR ((AE_INFO, 707 "Could not disable fixed event %d", (UINT32) i)); 708 } 709 } 710 711 /* Disable all GPEs in all GPE blocks */ 712 713 Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock); 714 715 /* Remove SCI handler */ 716 717 Status = AcpiEvRemoveSciHandler (); 718 if (ACPI_FAILURE(Status)) 719 { 720 ACPI_ERROR ((AE_INFO, 721 "Could not remove SCI handler")); 722 } 723 724 Status = AcpiEvRemoveGlobalLockHandler (); 725 if (ACPI_FAILURE(Status)) 726 { 727 ACPI_ERROR ((AE_INFO, 728 "Could not remove Global Lock handler")); 729 } 730 } 731 732 /* Deallocate all handler objects installed within GPE info structs */ 733 734 Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers); 735 736 /* Return to original mode if necessary */ 737 738 if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY) 739 { 740 Status = AcpiDisable (); 741 if (ACPI_FAILURE (Status)) 742 { 743 ACPI_WARNING ((AE_INFO, "AcpiDisable failed")); 744 } 745 } 746 return_VOID; 747} 748 749