xref: /titanic_52/usr/src/uts/intel/io/acpica/events/evmisc.c (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1 /******************************************************************************
2  *
3  * Module Name: evmisc - Miscellaneous event manager support functions
4  *              $Revision: 1.96 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, 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 "acpi.h"
118 #include "acevents.h"
119 #include "acnamesp.h"
120 #include "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
129 static 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 /* Local prototypes */
143 
144 static void ACPI_SYSTEM_XFACE
145 AcpiEvNotifyDispatch (
146     void                    *Context);
147 
148 static UINT32
149 AcpiEvGlobalLockHandler (
150     void                    *Context);
151 
152 
153 /*******************************************************************************
154  *
155  * FUNCTION:    AcpiEvIsNotifyObject
156  *
157  * PARAMETERS:  Node            - Node to check
158  *
159  * RETURN:      TRUE if notifies allowed on this object
160  *
161  * DESCRIPTION: Check type of node for a object that supports notifies.
162  *
163  *              TBD: This could be replaced by a flag bit in the node.
164  *
165  ******************************************************************************/
166 
167 BOOLEAN
168 AcpiEvIsNotifyObject (
169     ACPI_NAMESPACE_NODE     *Node)
170 {
171     switch (Node->Type)
172     {
173     case ACPI_TYPE_DEVICE:
174     case ACPI_TYPE_PROCESSOR:
175     case ACPI_TYPE_POWER:
176     case ACPI_TYPE_THERMAL:
177         /*
178          * These are the ONLY objects that can receive ACPI notifications
179          */
180         return (TRUE);
181 
182     default:
183         return (FALSE);
184     }
185 }
186 
187 
188 /*******************************************************************************
189  *
190  * FUNCTION:    AcpiEvQueueNotifyRequest
191  *
192  * PARAMETERS:  Node            - NS node for the notified object
193  *              NotifyValue     - Value from the Notify() request
194  *
195  * RETURN:      Status
196  *
197  * DESCRIPTION: Dispatch a device notification event to a previously
198  *              installed handler.
199  *
200  ******************************************************************************/
201 
202 ACPI_STATUS
203 AcpiEvQueueNotifyRequest (
204     ACPI_NAMESPACE_NODE     *Node,
205     UINT32                  NotifyValue)
206 {
207     ACPI_OPERAND_OBJECT     *ObjDesc;
208     ACPI_OPERAND_OBJECT     *HandlerObj = NULL;
209     ACPI_GENERIC_STATE      *NotifyInfo;
210     ACPI_STATUS             Status = AE_OK;
211 
212 
213     ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
214 
215 
216     /*
217      * For value 3 (Ejection Request), some device method may need to be run.
218      * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
219      *   to be run.
220      * For value 0x80 (Status Change) on the power button or sleep button,
221      *   initiate soft-off or sleep operation?
222      */
223     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
224         "Dispatching Notify(%X) on node %p\n", NotifyValue, Node));
225 
226     if (NotifyValue <= 7)
227     {
228         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
229             AcpiNotifyValueNames[NotifyValue]));
230     }
231     else
232     {
233         ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
234             "Notify value: 0x%2.2X **Device Specific**\n",
235             NotifyValue));
236     }
237 
238     /* Get the notify object attached to the NS Node */
239 
240     ObjDesc = AcpiNsGetAttachedObject (Node);
241     if (ObjDesc)
242     {
243         /* We have the notify object, Get the right handler */
244 
245         switch (Node->Type)
246         {
247         case ACPI_TYPE_DEVICE:
248         case ACPI_TYPE_THERMAL:
249         case ACPI_TYPE_PROCESSOR:
250         case ACPI_TYPE_POWER:
251 
252             if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
253             {
254                 HandlerObj = ObjDesc->CommonNotify.SystemNotify;
255             }
256             else
257             {
258                 HandlerObj = ObjDesc->CommonNotify.DeviceNotify;
259             }
260             break;
261 
262         default:
263             /* All other types are not supported */
264             return (AE_TYPE);
265         }
266     }
267 
268     /* If there is any handler to run, schedule the dispatcher */
269 
270     if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
271         (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY))  ||
272         HandlerObj)
273     {
274         NotifyInfo = AcpiUtCreateGenericState ();
275         if (!NotifyInfo)
276         {
277             return (AE_NO_MEMORY);
278         }
279 
280         NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
281         NotifyInfo->Notify.Node = Node;
282         NotifyInfo->Notify.Value = (UINT16) NotifyValue;
283         NotifyInfo->Notify.HandlerObj = HandlerObj;
284 
285         Status = AcpiOsExecute (
286                     OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo);
287         if (ACPI_FAILURE (Status))
288         {
289             AcpiUtDeleteGenericState (NotifyInfo);
290         }
291     }
292 
293     if (!HandlerObj)
294     {
295         /*
296          * There is no per-device notify handler for this device.
297          * This may or may not be a problem.
298          */
299         ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
300             "No notify handler for Notify(%4.4s, %X) node %p\n",
301             AcpiUtGetNodeName (Node), NotifyValue, Node));
302     }
303 
304     return (Status);
305 }
306 
307 
308 /*******************************************************************************
309  *
310  * FUNCTION:    AcpiEvNotifyDispatch
311  *
312  * PARAMETERS:  Context         - To be passed to the notify handler
313  *
314  * RETURN:      None.
315  *
316  * DESCRIPTION: Dispatch a device notification event to a previously
317  *              installed handler.
318  *
319  ******************************************************************************/
320 
321 static void ACPI_SYSTEM_XFACE
322 AcpiEvNotifyDispatch (
323     void                    *Context)
324 {
325     ACPI_GENERIC_STATE      *NotifyInfo = (ACPI_GENERIC_STATE *) Context;
326     ACPI_NOTIFY_HANDLER     GlobalHandler = NULL;
327     void                    *GlobalContext = NULL;
328     ACPI_OPERAND_OBJECT     *HandlerObj;
329 
330 
331     ACPI_FUNCTION_ENTRY ();
332 
333 
334     /*
335      * We will invoke a global notify handler if installed.
336      * This is done _before_ we invoke the per-device handler attached
337      * to the device.
338      */
339     if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
340     {
341         /* Global system notification handler */
342 
343         if (AcpiGbl_SystemNotify.Handler)
344         {
345             GlobalHandler = AcpiGbl_SystemNotify.Handler;
346             GlobalContext = AcpiGbl_SystemNotify.Context;
347         }
348     }
349     else
350     {
351         /* Global driver notification handler */
352 
353         if (AcpiGbl_DeviceNotify.Handler)
354         {
355             GlobalHandler = AcpiGbl_DeviceNotify.Handler;
356             GlobalContext = AcpiGbl_DeviceNotify.Context;
357         }
358     }
359 
360     /* Invoke the system handler first, if present */
361 
362     if (GlobalHandler)
363     {
364         GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
365             GlobalContext);
366     }
367 
368     /* Now invoke the per-device handler, if present */
369 
370     HandlerObj = NotifyInfo->Notify.HandlerObj;
371     if (HandlerObj)
372     {
373         HandlerObj->Notify.Handler (NotifyInfo->Notify.Node,
374             NotifyInfo->Notify.Value,
375             HandlerObj->Notify.Context);
376     }
377 
378     /* All done with the info object */
379 
380     AcpiUtDeleteGenericState (NotifyInfo);
381 }
382 
383 
384 /*******************************************************************************
385  *
386  * FUNCTION:    AcpiEvGlobalLockHandler
387  *
388  * PARAMETERS:  Context         - From thread interface, not used
389  *
390  * RETURN:      ACPI_INTERRUPT_HANDLED
391  *
392  * DESCRIPTION: Invoked directly from the SCI handler when a global lock
393  *              release interrupt occurs. Attempt to acquire the global lock,
394  *              if successful, signal the thread waiting for the lock.
395  *
396  * NOTE: Assumes that the semaphore can be signaled from interrupt level. If
397  * this is not possible for some reason, a separate thread will have to be
398  * scheduled to do this.
399  *
400  ******************************************************************************/
401 
402 static UINT32
403 AcpiEvGlobalLockHandler (
404     void                    *Context)
405 {
406     BOOLEAN                 Acquired = FALSE;
407     ACPI_STATUS             Status;
408 
409 
410     /*
411      * Attempt to get the lock.
412      *
413      * If we don't get it now, it will be marked pending and we will
414      * take another interrupt when it becomes free.
415      */
416     ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
417     if (Acquired)
418     {
419         /* Got the lock, now wake the thread waiting for it */
420 
421         AcpiGbl_GlobalLockAcquired = TRUE;
422 
423         /* Send a unit to the semaphore */
424 
425         Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
426         if (ACPI_FAILURE (Status))
427         {
428             ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
429         }
430     }
431 
432     return (ACPI_INTERRUPT_HANDLED);
433 }
434 
435 
436 /*******************************************************************************
437  *
438  * FUNCTION:    AcpiEvInitGlobalLockHandler
439  *
440  * PARAMETERS:  None
441  *
442  * RETURN:      Status
443  *
444  * DESCRIPTION: Install a handler for the global lock release event
445  *
446  ******************************************************************************/
447 
448 ACPI_STATUS
449 AcpiEvInitGlobalLockHandler (
450     void)
451 {
452     ACPI_STATUS             Status;
453 
454 
455     ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
456 
457 
458     AcpiGbl_GlobalLockPresent = TRUE;
459     Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
460                 AcpiEvGlobalLockHandler, NULL);
461 
462     /*
463      * If the global lock does not exist on this platform, the attempt
464      * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
465      * Map to AE_OK, but mark global lock as not present.
466      * Any attempt to actually use the global lock will be flagged
467      * with an error.
468      */
469     if (Status == AE_NO_HARDWARE_RESPONSE)
470     {
471         ACPI_ERROR ((AE_INFO,
472             "No response from Global Lock hardware, disabling lock"));
473 
474         AcpiGbl_GlobalLockPresent = FALSE;
475         Status = AE_OK;
476     }
477 
478     return_ACPI_STATUS (Status);
479 }
480 
481 
482 /******************************************************************************
483  *
484  * FUNCTION:    AcpiEvAcquireGlobalLock
485  *
486  * PARAMETERS:  Timeout         - Max time to wait for the lock, in millisec.
487  *
488  * RETURN:      Status
489  *
490  * DESCRIPTION: Attempt to gain ownership of the Global Lock.
491  *
492  * MUTEX:       Interpreter must be locked
493  *
494  * Note: The original implementation allowed multiple threads to "acquire" the
495  * Global Lock, and the OS would hold the lock until the last thread had
496  * released it. However, this could potentially starve the BIOS out of the
497  * lock, especially in the case where there is a tight handshake between the
498  * Embedded Controller driver and the BIOS. Therefore, this implementation
499  * allows only one thread to acquire the HW Global Lock at a time, and makes
500  * the global lock appear as a standard mutex on the OS side.
501  *
502  *****************************************************************************/
503 
504 ACPI_STATUS
505 AcpiEvAcquireGlobalLock (
506     UINT16                  Timeout)
507 {
508     ACPI_STATUS             Status = AE_OK;
509     BOOLEAN                 Acquired = FALSE;
510 
511 
512     ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
513 
514 
515     /*
516      * Only one thread can acquire the GL at a time, the GlobalLockMutex
517      * enforces this. This interface releases the interpreter if we must wait.
518      */
519     Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex, Timeout);
520     if (ACPI_FAILURE (Status))
521     {
522         return_ACPI_STATUS (Status);
523     }
524 
525     /*
526      * Make sure that a global lock actually exists. If not, just treat
527      * the lock as a standard mutex.
528      */
529     if (!AcpiGbl_GlobalLockPresent)
530     {
531         AcpiGbl_GlobalLockAcquired = TRUE;
532         return_ACPI_STATUS (AE_OK);
533     }
534 
535     /* Attempt to acquire the actual hardware lock */
536 
537     ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
538     if (Acquired)
539     {
540        /* We got the lock */
541 
542         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n"));
543 
544         AcpiGbl_GlobalLockAcquired = TRUE;
545         return_ACPI_STATUS (AE_OK);
546     }
547 
548     /*
549      * Did not get the lock. The pending bit was set above, and we must now
550      * wait until we get the global lock released interrupt.
551      */
552     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n"));
553 
554     /*
555      * Wait for handshake with the global lock interrupt handler.
556      * This interface releases the interpreter if we must wait.
557      */
558     Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
559                 ACPI_WAIT_FOREVER);
560     return_ACPI_STATUS (Status);
561 }
562 
563 
564 /*******************************************************************************
565  *
566  * FUNCTION:    AcpiEvReleaseGlobalLock
567  *
568  * PARAMETERS:  None
569  *
570  * RETURN:      Status
571  *
572  * DESCRIPTION: Releases ownership of the Global Lock.
573  *
574  ******************************************************************************/
575 
576 ACPI_STATUS
577 AcpiEvReleaseGlobalLock (
578     void)
579 {
580     BOOLEAN                 Pending = FALSE;
581     ACPI_STATUS             Status = AE_OK;
582 
583 
584     ACPI_FUNCTION_TRACE (EvReleaseGlobalLock);
585 
586 
587     /* Lock must be already acquired */
588 
589     if (!AcpiGbl_GlobalLockAcquired)
590     {
591         ACPI_WARNING ((AE_INFO,
592             "Cannot release the ACPI Global Lock, it has not been acquired"));
593         return_ACPI_STATUS (AE_NOT_ACQUIRED);
594     }
595 
596     if (AcpiGbl_GlobalLockPresent)
597     {
598         /* Allow any thread to release the lock */
599 
600         ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
601 
602         /*
603          * If the pending bit was set, we must write GBL_RLS to the control
604          * register
605          */
606         if (Pending)
607         {
608             Status = AcpiSetRegister (
609                         ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
610         }
611 
612         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
613     }
614 
615     AcpiGbl_GlobalLockAcquired = FALSE;
616 
617     /* Release the local GL mutex */
618 
619     AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex);
620     return_ACPI_STATUS (Status);
621 }
622 
623 
624 /******************************************************************************
625  *
626  * FUNCTION:    AcpiEvTerminate
627  *
628  * PARAMETERS:  none
629  *
630  * RETURN:      none
631  *
632  * DESCRIPTION: Disable events and free memory allocated for table storage.
633  *
634  ******************************************************************************/
635 
636 void
637 AcpiEvTerminate (
638     void)
639 {
640     ACPI_NATIVE_UINT        i;
641     ACPI_STATUS             Status;
642 
643 
644     ACPI_FUNCTION_TRACE (EvTerminate);
645 
646 
647     if (AcpiGbl_EventsInitialized)
648     {
649         /*
650          * Disable all event-related functionality.
651          * In all cases, on error, print a message but obviously we don't abort.
652          */
653 
654         /* Disable all fixed events */
655 
656         for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
657         {
658             Status = AcpiDisableEvent ((UINT32) i, 0);
659             if (ACPI_FAILURE (Status))
660             {
661                 ACPI_ERROR ((AE_INFO,
662                     "Could not disable fixed event %d", (UINT32) i));
663             }
664         }
665 
666         /* Disable all GPEs in all GPE blocks */
667 
668         Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
669 
670         /* Remove SCI handler */
671 
672         Status = AcpiEvRemoveSciHandler ();
673         if (ACPI_FAILURE(Status))
674         {
675             ACPI_ERROR ((AE_INFO,
676                 "Could not remove SCI handler"));
677         }
678     }
679 
680     /* Deallocate all handler objects installed within GPE info structs */
681 
682     Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
683 
684     /* Return to original mode if necessary */
685 
686     if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)
687     {
688         Status = AcpiDisable ();
689         if (ACPI_FAILURE (Status))
690         {
691             ACPI_WARNING ((AE_INFO, "AcpiDisable failed"));
692         }
693     }
694     return_VOID;
695 }
696 
697