Deleted Added
sdiff udiff text old ( 102550 ) new ( 104470 )
full compact
1/******************************************************************************
2 *
3 * Module Name: evmisc - Miscellaneous event manager support functions
4 * $Revision: 56 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, 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/*******************************************************************************
127 *
128 * FUNCTION: AcpiEvIsNotifyObject
129 *
130 * PARAMETERS: Node - Node to check
131 *
132 * RETURN: TRUE if notifies allowed on this object
133 *
134 * DESCRIPTION: Check type of node for a object that supports notifies.
135 *
136 * TBD: This could be replaced by a flag bit in the node.
137 *
138 ******************************************************************************/
139
140BOOLEAN
141AcpiEvIsNotifyObject (
142 ACPI_NAMESPACE_NODE *Node)
143{
144 switch (Node->Type)
145 {
146 case ACPI_TYPE_DEVICE:
147 case ACPI_TYPE_PROCESSOR:
148 case ACPI_TYPE_POWER:
149 case ACPI_TYPE_THERMAL:
150 /*
151 * These are the ONLY objects that can receive ACPI notifications
152 */
153 return (TRUE);
154
155 default:
156 return (FALSE);
157 }
158}
159
160
161/*******************************************************************************
162 *
163 * FUNCTION: AcpiEvGetGpeRegisterIndex
164 *
165 * PARAMETERS: GpeNumber - Raw GPE number
166 *
167 * RETURN: None.
168 *
169 * DESCRIPTION: Returns the register index (index into the GPE register info
170 * table) associated with this GPE.
171 *
172 ******************************************************************************/
173
174UINT32
175AcpiEvGetGpeRegisterIndex (
176 UINT32 GpeNumber)
177{
178
179 if (GpeNumber > AcpiGbl_GpeNumberMax)
180 {
181 return (ACPI_GPE_INVALID);
182 }
183
184 return (ACPI_DIV_8 (AcpiGbl_GpeNumberToIndex[GpeNumber].NumberIndex));
185}
186
187
188/*******************************************************************************
189 *
190 * FUNCTION: AcpiEvGetGpeNumberIndex
191 *
192 * PARAMETERS: GpeNumber - Raw GPE number
193 *
194 * RETURN: None.
195 *
196 * DESCRIPTION: Returns the number index (index into the GPE number info table)
197 * associated with this GPE.
198 *
199 ******************************************************************************/
200
201UINT32
202AcpiEvGetGpeNumberIndex (
203 UINT32 GpeNumber)
204{
205
206 if (GpeNumber > AcpiGbl_GpeNumberMax)
207 {
208 return (ACPI_GPE_INVALID);
209 }
210
211 return (AcpiGbl_GpeNumberToIndex[GpeNumber].NumberIndex);
212}
213
214
215/*******************************************************************************
216 *
217 * FUNCTION: AcpiEvQueueNotifyRequest
218 *
219 * PARAMETERS:
220 *
221 * RETURN: None.
222 *
223 * DESCRIPTION: Dispatch a device notification event to a previously
224 * installed handler.
225 *
226 ******************************************************************************/
227
228ACPI_STATUS
229AcpiEvQueueNotifyRequest (
230 ACPI_NAMESPACE_NODE *Node,
231 UINT32 NotifyValue)
232{
233 ACPI_OPERAND_OBJECT *ObjDesc;
234 ACPI_OPERAND_OBJECT *HandlerObj = NULL;
235 ACPI_GENERIC_STATE *NotifyInfo;
236 ACPI_STATUS Status = AE_OK;
237
238
239 ACPI_FUNCTION_NAME ("EvQueueNotifyRequest");
240
241
242 /*
243 * For value 1 (Ejection Request), some device method may need to be run.
244 * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run.
245 * For value 0x80 (Status Change) on the power button or sleep button,
246 * initiate soft-off or sleep operation?
247 */
248 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
249 "Dispatching Notify(%X) on node %p\n", NotifyValue, Node));
250
251 switch (NotifyValue)
252 {
253 case 0:
254 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Re-enumerate Devices\n"));
255 break;
256
257 case 1:
258 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Ejection Request\n"));
259 break;
260
261 case 2:
262 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Device Wake\n"));
263 break;
264
265 case 0x80:
266 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Status Change\n"));
267 break;
268
269 default:
270 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %X \n", NotifyValue));
271 break;
272 }
273
274 /*
275 * Get the notify object attached to the NS Node
276 */
277 ObjDesc = AcpiNsGetAttachedObject (Node);
278 if (ObjDesc)
279 {
280 /* We have the notify object, Get the right handler */
281
282 switch (Node->Type)
283 {
284 case ACPI_TYPE_DEVICE:
285 case ACPI_TYPE_THERMAL:
286 case ACPI_TYPE_PROCESSOR:
287 case ACPI_TYPE_POWER:
288
289 if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
290 {
291 HandlerObj = ObjDesc->CommonNotify.SysHandler;
292 }
293 else
294 {
295 HandlerObj = ObjDesc->CommonNotify.DrvHandler;
296 }
297 break;
298
299 default:
300 /* All other types are not supported */
301 return (AE_TYPE);
302 }
303 }
304
305 /* If there is any handler to run, schedule the dispatcher */
306
307 if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
308 (AcpiGbl_DrvNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
309 HandlerObj)
310 {
311 NotifyInfo = AcpiUtCreateGenericState ();
312 if (!NotifyInfo)
313 {
314 return (AE_NO_MEMORY);
315 }
316
317 NotifyInfo->Common.DataType = ACPI_DESC_TYPE_STATE_NOTIFY;
318 NotifyInfo->Notify.Node = Node;
319 NotifyInfo->Notify.Value = (UINT16) NotifyValue;
320 NotifyInfo->Notify.HandlerObj = HandlerObj;
321
322 Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
323 AcpiEvNotifyDispatch, NotifyInfo);
324 if (ACPI_FAILURE (Status))
325 {
326 AcpiUtDeleteGenericState (NotifyInfo);
327 }
328 }
329
330 if (!HandlerObj)
331 {
332 /* There is no per-device notify handler for this device */
333
334 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No notify handler for node %p \n", Node));
335 }
336
337 return (Status);
338}
339
340
341/*******************************************************************************
342 *
343 * FUNCTION: AcpiEvNotifyDispatch
344 *
345 * PARAMETERS:
346 *
347 * RETURN: None.
348 *
349 * DESCRIPTION: Dispatch a device notification event to a previously
350 * installed handler.
351 *
352 ******************************************************************************/
353
354void ACPI_SYSTEM_XFACE
355AcpiEvNotifyDispatch (
356 void *Context)
357{
358 ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context;
359 ACPI_NOTIFY_HANDLER GlobalHandler = NULL;
360 void *GlobalContext = NULL;
361 ACPI_OPERAND_OBJECT *HandlerObj;
362
363
364 ACPI_FUNCTION_ENTRY ();
365
366
367 /*
368 * We will invoke a global notify handler if installed.
369 * This is done _before_ we invoke the per-device handler attached to the device.
370 */
371 if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
372 {
373 /* Global system notification handler */
374
375 if (AcpiGbl_SysNotify.Handler)
376 {
377 GlobalHandler = AcpiGbl_SysNotify.Handler;
378 GlobalContext = AcpiGbl_SysNotify.Context;
379 }
380 }
381 else
382 {
383 /* Global driver notification handler */
384
385 if (AcpiGbl_DrvNotify.Handler)
386 {
387 GlobalHandler = AcpiGbl_DrvNotify.Handler;
388 GlobalContext = AcpiGbl_DrvNotify.Context;
389 }
390 }
391
392 /* Invoke the system handler first, if present */
393
394 if (GlobalHandler)
395 {
396 GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, GlobalContext);
397 }
398
399 /* Now invoke the per-device handler, if present */
400
401 HandlerObj = NotifyInfo->Notify.HandlerObj;
402 if (HandlerObj)
403 {
404 HandlerObj->NotifyHandler.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
405 HandlerObj->NotifyHandler.Context);
406 }
407
408 /* All done with the info object */
409
410 AcpiUtDeleteGenericState (NotifyInfo);
411}
412
413
414/*******************************************************************************
415 *
416 * FUNCTION: AcpiEvGlobalLockThread
417 *
418 * RETURN: None
419 *
420 * DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the
421 * Global Lock. Simply signal all threads that are waiting
422 * for the lock.
423 *
424 ******************************************************************************/
425
426static void ACPI_SYSTEM_XFACE
427AcpiEvGlobalLockThread (
428 void *Context)
429{
430 ACPI_STATUS Status;
431
432
433 /* Signal threads that are waiting for the lock */
434
435 if (AcpiGbl_GlobalLockThreadCount)
436 {
437 /* Send sufficient units to the semaphore */
438
439 Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore,
440 AcpiGbl_GlobalLockThreadCount);
441 if (ACPI_FAILURE (Status))
442 {
443 ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
444 }
445 }
446}
447
448
449/*******************************************************************************
450 *
451 * FUNCTION: AcpiEvGlobalLockHandler
452 *
453 * RETURN: Status
454 *
455 * DESCRIPTION: Invoked directly from the SCI handler when a global lock
456 * release interrupt occurs. Grab the global lock and queue
457 * the global lock thread for execution
458 *
459 ******************************************************************************/
460
461static UINT32
462AcpiEvGlobalLockHandler (
463 void *Context)
464{
465 BOOLEAN Acquired = FALSE;
466 ACPI_STATUS Status;
467
468
469 /*
470 * Attempt to get the lock
471 * If we don't get it now, it will be marked pending and we will
472 * take another interrupt when it becomes free.
473 */
474 ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
475 if (Acquired)
476 {
477 /* Got the lock, now wake all threads waiting for it */
478
479 AcpiGbl_GlobalLockAcquired = TRUE;
480
481 /* Run the Global Lock thread which will signal all waiting threads */
482
483 Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
484 AcpiEvGlobalLockThread, Context);
485 if (ACPI_FAILURE (Status))
486 {
487 ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
488 AcpiFormatException (Status)));
489
490 return (ACPI_INTERRUPT_NOT_HANDLED);
491 }
492 }
493
494 return (ACPI_INTERRUPT_HANDLED);
495}
496
497
498/*******************************************************************************
499 *
500 * FUNCTION: AcpiEvInitGlobalLockHandler
501 *
502 * RETURN: Status
503 *
504 * DESCRIPTION: Install a handler for the global lock release event
505 *
506 ******************************************************************************/
507
508ACPI_STATUS
509AcpiEvInitGlobalLockHandler (void)
510{
511 ACPI_STATUS Status;
512
513
514 ACPI_FUNCTION_TRACE ("EvInitGlobalLockHandler");
515
516
517 AcpiGbl_GlobalLockPresent = TRUE;
518 Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
519 AcpiEvGlobalLockHandler, NULL);
520
521 /*
522 * If the global lock does not exist on this platform, the attempt
523 * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
524 * Map to AE_OK, but mark global lock as not present.
525 * Any attempt to actually use the global lock will be flagged
526 * with an error.
527 */
528 if (Status == AE_NO_HARDWARE_RESPONSE)
529 {
530 AcpiGbl_GlobalLockPresent = FALSE;
531 Status = AE_OK;
532 }
533
534 return_ACPI_STATUS (Status);
535}
536
537
538/******************************************************************************
539 *
540 * FUNCTION: AcpiEvAcquireGlobalLock
541 *
542 * RETURN: Status
543 *
544 * DESCRIPTION: Attempt to gain ownership of the Global Lock.
545 *
546 *****************************************************************************/
547
548ACPI_STATUS
549AcpiEvAcquireGlobalLock (
550 UINT32 Timeout)
551{
552 ACPI_STATUS Status = AE_OK;
553 BOOLEAN Acquired = FALSE;
554
555
556 ACPI_FUNCTION_TRACE ("EvAcquireGlobalLock");
557
558
559#ifndef ACPI_APPLICATION
560 /* Make sure that we actually have a global lock */
561
562 if (!AcpiGbl_GlobalLockPresent)
563 {
564 return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
565 }
566#endif
567
568 /* One more thread wants the global lock */
569
570 AcpiGbl_GlobalLockThreadCount++;
571
572 /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
573
574 if (AcpiGbl_GlobalLockAcquired)
575 {
576 return_ACPI_STATUS (AE_OK);
577 }
578
579 /* We must acquire the actual hardware lock */
580
581 ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
582 if (Acquired)
583 {
584 /* We got the lock */
585
586 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the HW 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_INFO, "Waiting for the HW Global Lock\n"));
597
598 /*
599 * Acquire the global lock semaphore first.
600 * Since this wait will block, we must release the interpreter
601 */
602 Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
603 Timeout);
604 return_ACPI_STATUS (Status);
605}
606
607
608/*******************************************************************************
609 *
610 * FUNCTION: AcpiEvReleaseGlobalLock
611 *
612 * DESCRIPTION: Releases ownership of the Global Lock.
613 *
614 ******************************************************************************/
615
616ACPI_STATUS
617AcpiEvReleaseGlobalLock (void)
618{
619 BOOLEAN Pending = FALSE;
620 ACPI_STATUS Status = AE_OK;
621
622
623 ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock");
624
625
626 if (!AcpiGbl_GlobalLockThreadCount)
627 {
628 ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
629 return_ACPI_STATUS (AE_NOT_ACQUIRED);
630 }
631
632 /* One fewer thread has the global lock */
633
634 AcpiGbl_GlobalLockThreadCount--;
635 if (AcpiGbl_GlobalLockThreadCount)
636 {
637 /* There are still some threads holding the lock, cannot release */
638
639 return_ACPI_STATUS (AE_OK);
640 }
641
642 /*
643 * No more threads holding lock, we can do the actual hardware
644 * release
645 */
646 ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
647 AcpiGbl_GlobalLockAcquired = FALSE;
648
649 /*
650 * If the pending bit was set, we must write GBL_RLS to the control
651 * register
652 */
653 if (Pending)
654 {
655 Status = AcpiSetRegister (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
656 }
657
658 return_ACPI_STATUS (Status);
659}
660
661
662/******************************************************************************
663 *
664 * FUNCTION: AcpiEvTerminate
665 *
666 * PARAMETERS: none
667 *
668 * RETURN: none
669 *
670 * DESCRIPTION: free memory allocated for table storage.
671 *
672 ******************************************************************************/
673
674void
675AcpiEvTerminate (void)
676{
677 NATIVE_UINT_MAX32 i;
678 ACPI_STATUS Status;
679
680
681 ACPI_FUNCTION_TRACE ("EvTerminate");
682
683 /*
684 * Disable all event-related functionality.
685 * In all cases, on error, print a message but obviously we don't abort.
686 */
687
688 /*
689 * Disable all fixed events
690 */
691 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
692 {
693 Status = AcpiDisableEvent(i, ACPI_EVENT_FIXED, 0);
694 if (ACPI_FAILURE (Status))
695 {
696 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to disable fixed event %d.\n", i));
697 }
698 }
699
700 /*
701 * Disable all GPEs
702 */
703 for (i = 0; i < AcpiGbl_GpeNumberMax; i++)
704 {
705 if (AcpiEvGetGpeNumberIndex(i) != ACPI_GPE_INVALID)
706 {
707 Status = AcpiHwDisableGpe(i);
708 if (ACPI_FAILURE (Status))
709 {
710 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to disable GPE %d.\n", i));
711 }
712 }
713 }
714
715 /*
716 * Remove SCI handler
717 */
718 Status = AcpiEvRemoveSciHandler();
719 if (ACPI_FAILURE(Status))
720 {
721 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to remove SCI handler.\n"));
722 }
723
724 /*
725 * Return to original mode if necessary
726 */
727 if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)
728 {
729 Status = AcpiDisable ();
730 if (ACPI_FAILURE (Status))
731 {
732 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiDisable failed.\n"));
733 }
734 }
735
736 /*
737 * Free global tables, etc.
738 */
739 if (AcpiGbl_GpeRegisterInfo)
740 {
741 ACPI_MEM_FREE (AcpiGbl_GpeRegisterInfo);
742 AcpiGbl_GpeRegisterInfo = NULL;
743 }
744
745 if (AcpiGbl_GpeNumberInfo)
746 {
747 ACPI_MEM_FREE (AcpiGbl_GpeNumberInfo);
748 AcpiGbl_GpeNumberInfo = NULL;
749 }
750
751 if (AcpiGbl_GpeNumberToIndex)
752 {
753 ACPI_MEM_FREE (AcpiGbl_GpeNumberToIndex);
754 AcpiGbl_GpeNumberToIndex = NULL;
755 }
756
757 return_VOID;
758}
759