evxface.c revision 69450
1/******************************************************************************
2 *
3 * Module Name: evxface - External interfaces for ACPI events
4 *              $Revision: 96 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
13 * 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 prton 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
118#define __EVXFACE_C__
119
120#include "acpi.h"
121#include "achware.h"
122#include "acnamesp.h"
123#include "acevents.h"
124#include "amlcode.h"
125#include "acinterp.h"
126
127#define _COMPONENT          EVENT_HANDLING
128        MODULE_NAME         ("evxface")
129
130
131/******************************************************************************
132 *
133 * FUNCTION:    AcpiInstallFixedEventHandler
134 *
135 * PARAMETERS:  Event           - Event type to enable.
136 *              Handler         - Pointer to the handler function for the
137 *                                event
138 *              Context         - Value passed to the handler on each GPE
139 *
140 * RETURN:      Status
141 *
142 * DESCRIPTION: Saves the pointer to the handler function and then enables the
143 *              event.
144 *
145 ******************************************************************************/
146
147ACPI_STATUS
148AcpiInstallFixedEventHandler (
149    UINT32                  Event,
150    FIXED_EVENT_HANDLER     Handler,
151    void                    *Context)
152{
153    ACPI_STATUS             Status = AE_OK;
154
155
156    FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
157
158
159    /* Sanity check the parameters. */
160
161    if (Event >= NUM_FIXED_EVENTS)
162    {
163        return_ACPI_STATUS (AE_BAD_PARAMETER);
164    }
165
166    AcpiCmAcquireMutex (ACPI_MTX_EVENTS);
167
168    /* Don't allow two handlers. */
169
170    if (NULL != AcpiGbl_FixedEventHandlers[Event].Handler)
171    {
172        Status = AE_EXIST;
173        goto Cleanup;
174    }
175
176
177    /* Install the handler before enabling the event - just in case... */
178
179    AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
180    AcpiGbl_FixedEventHandlers[Event].Context = Context;
181
182    Status = AcpiEnableEvent(Event, ACPI_EVENT_FIXED);
183
184    if (!ACPI_SUCCESS(Status))
185    {
186        DEBUG_PRINT (ACPI_WARN, ("Could not enable fixed event.\n"));
187
188        /* Remove the handler */
189
190        AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
191        AcpiGbl_FixedEventHandlers[Event].Context = NULL;
192
193        Status = AE_ERROR;
194        goto Cleanup;
195    }
196
197    DEBUG_PRINT (ACPI_INFO,
198        ("Enabled fixed event %d.  Handler: %x\n", Event, Handler));
199
200
201Cleanup:
202    AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
203    return_ACPI_STATUS (Status);
204}
205
206
207/******************************************************************************
208 *
209 * FUNCTION:    AcpiRemoveFixedEventHandler
210 *
211 * PARAMETERS:  Event           - Event type to disable.
212 *              Handler         - Address of the handler
213 *
214 * RETURN:      Status
215 *
216 * DESCRIPTION: Disables the event and unregisters the event handler.
217 *
218 ******************************************************************************/
219
220ACPI_STATUS
221AcpiRemoveFixedEventHandler (
222    UINT32                  Event,
223    FIXED_EVENT_HANDLER     Handler)
224{
225    ACPI_STATUS             Status = AE_OK;
226
227
228    FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
229
230
231    /* Sanity check the parameters. */
232
233    if (Event >= NUM_FIXED_EVENTS)
234    {
235        return_ACPI_STATUS (AE_BAD_PARAMETER);
236    }
237
238    AcpiCmAcquireMutex (ACPI_MTX_EVENTS);
239
240    /* Disable the event before removing the handler - just in case... */
241
242    Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED);
243
244    if (!ACPI_SUCCESS(Status))
245    {
246        DEBUG_PRINT (ACPI_WARN,
247            ("Could not write to fixed event enable register.\n"));
248
249        Status = AE_ERROR;
250        AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
251        return_ACPI_STATUS (Status);
252    }
253
254    /* Remove the handler */
255
256    AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
257    AcpiGbl_FixedEventHandlers[Event].Context = NULL;
258
259    DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %d.\n", Event));
260
261    AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
262    return_ACPI_STATUS (Status);
263}
264
265
266/******************************************************************************
267 *
268 * FUNCTION:    AcpiInstallNotifyHandler
269 *
270 * PARAMETERS:  Device          - The device for which notifies will be handled
271 *              HandlerType     - The type of handler:
272 *                                  ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
273 *                                  ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
274 *              Handler         - Address of the handler
275 *              Context         - Value passed to the handler on each GPE
276 *
277 * RETURN:      Status
278 *
279 * DESCRIPTION: Install a handler for notifies on an ACPI device
280 *
281 ******************************************************************************/
282
283ACPI_STATUS
284AcpiInstallNotifyHandler (
285    ACPI_HANDLE             Device,
286    UINT32                  HandlerType,
287    NOTIFY_HANDLER          Handler,
288    void                    *Context)
289{
290    ACPI_OPERAND_OBJECT     *ObjDesc;
291    ACPI_OPERAND_OBJECT     *NotifyObj;
292    ACPI_NAMESPACE_NODE     *DeviceNode;
293    ACPI_STATUS             Status = AE_OK;
294
295
296    FUNCTION_TRACE ("AcpiInstallNotifyHandler");
297
298
299    /* Parameter validation */
300
301    if ((!Handler) ||
302        (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
303    {
304        return_ACPI_STATUS (AE_BAD_PARAMETER);
305    }
306
307    /* Convert and validate the device handle */
308
309    AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
310
311    DeviceNode = AcpiNsConvertHandleToEntry (Device);
312    if (!DeviceNode)
313    {
314        Status = AE_BAD_PARAMETER;
315        goto UnlockAndExit;
316    }
317
318
319    /*
320     * Support for global notify handlers.  These handlers are invoked for
321     * every notifiy of the type specifiec
322     */
323
324    if (Device == ACPI_ROOT_OBJECT)
325    {
326        /*
327         *  Make sure the handler is not already installed.
328         */
329
330        if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
331              AcpiGbl_SysNotify.Handler) ||
332            ((HandlerType == ACPI_DEVICE_NOTIFY) &&
333              AcpiGbl_DrvNotify.Handler))
334        {
335            Status = AE_EXIST;
336            goto UnlockAndExit;
337        }
338
339        if (HandlerType == ACPI_SYSTEM_NOTIFY)
340        {
341            AcpiGbl_SysNotify.Node = DeviceNode;
342            AcpiGbl_SysNotify.Handler = Handler;
343            AcpiGbl_SysNotify.Context = Context;
344        }
345
346        else
347        {
348            AcpiGbl_DrvNotify.Node = DeviceNode;
349            AcpiGbl_DrvNotify.Handler = Handler;
350            AcpiGbl_DrvNotify.Context = Context;
351        }
352
353
354        /* Global notify handler installed */
355
356        goto UnlockAndExit;
357    }
358
359
360    /*
361     * These are the ONLY objects that can receive ACPI notifications
362     */
363
364    if ((DeviceNode->Type != ACPI_TYPE_DEVICE)     &&
365        (DeviceNode->Type != ACPI_TYPE_PROCESSOR)  &&
366        (DeviceNode->Type != ACPI_TYPE_POWER)      &&
367        (DeviceNode->Type != ACPI_TYPE_THERMAL))
368    {
369        Status = AE_BAD_PARAMETER;
370        goto UnlockAndExit;
371    }
372
373    /* Check for an existing internal object */
374
375    ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
376    if (ObjDesc)
377    {
378        /*
379         *  The object exists.
380         *  Make sure the handler is not already installed.
381         */
382
383        if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
384              ObjDesc->Device.SysHandler) ||
385            ((HandlerType == ACPI_DEVICE_NOTIFY) &&
386              ObjDesc->Device.DrvHandler))
387        {
388            Status = AE_EXIST;
389            goto UnlockAndExit;
390        }
391    }
392
393    else
394    {
395        /* Create a new object */
396
397        ObjDesc = AcpiCmCreateInternalObject (DeviceNode->Type);
398        if (!ObjDesc)
399        {
400            Status = AE_NO_MEMORY;
401            goto UnlockAndExit;
402        }
403
404        /* Attach new object to the Node */
405
406        Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) DeviceNode->Type);
407
408        if (ACPI_FAILURE (Status))
409        {
410            goto UnlockAndExit;
411        }
412    }
413
414
415    /*
416     *  If we get here, we know that there is no handler installed
417     *  so let's party
418     */
419    NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY);
420    if (!NotifyObj)
421    {
422        Status = AE_NO_MEMORY;
423        goto UnlockAndExit;
424    }
425
426    NotifyObj->NotifyHandler.Node = DeviceNode;
427    NotifyObj->NotifyHandler.Handler = Handler;
428    NotifyObj->NotifyHandler.Context = Context;
429
430
431    if (HandlerType == ACPI_SYSTEM_NOTIFY)
432    {
433        ObjDesc->Device.SysHandler = NotifyObj;
434    }
435
436    else
437    {
438        ObjDesc->Device.DrvHandler = NotifyObj;
439    }
440
441
442UnlockAndExit:
443    AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
444    return_ACPI_STATUS (Status);
445}
446
447
448/*****************************************************************************
449 *
450 * FUNCTION:    AcpiRemoveNotifyHandler
451 *
452 * PARAMETERS:  Device          - The device for which notifies will be handled
453 *              HandlerType     - The type of handler:
454 *                                  ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
455 *                                  ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
456 *              Handler         - Address of the handler
457 * RETURN:      Status
458 *
459 * DESCRIPTION: Remove a handler for notifies on an ACPI device
460 *
461 ******************************************************************************/
462
463ACPI_STATUS
464AcpiRemoveNotifyHandler (
465    ACPI_HANDLE             Device,
466    UINT32                  HandlerType,
467    NOTIFY_HANDLER          Handler)
468{
469    ACPI_OPERAND_OBJECT     *NotifyObj;
470    ACPI_OPERAND_OBJECT     *ObjDesc;
471    ACPI_NAMESPACE_NODE     *DeviceNode;
472    ACPI_STATUS             Status = AE_OK;
473
474
475    FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
476
477
478    /* Parameter validation */
479
480    if ((!Handler) ||
481        (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
482    {
483        return_ACPI_STATUS (AE_BAD_PARAMETER);
484    }
485
486    AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
487
488    /* Convert and validate the device handle */
489
490    DeviceNode = AcpiNsConvertHandleToEntry (Device);
491    if (!DeviceNode)
492    {
493        Status = AE_BAD_PARAMETER;
494        goto UnlockAndExit;
495    }
496
497    /*
498     * These are the ONLY objects that can receive ACPI notifications
499     */
500
501    if ((DeviceNode->Type != ACPI_TYPE_DEVICE)     &&
502        (DeviceNode->Type != ACPI_TYPE_PROCESSOR)  &&
503        (DeviceNode->Type != ACPI_TYPE_POWER)      &&
504        (DeviceNode->Type != ACPI_TYPE_THERMAL))
505    {
506        Status = AE_BAD_PARAMETER;
507        goto UnlockAndExit;
508    }
509
510    /* Check for an existing internal object */
511
512    ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
513    if (!ObjDesc)
514    {
515        Status = AE_NOT_EXIST;
516        goto UnlockAndExit;
517    }
518
519    /*
520     *  The object exists.
521     *
522     *  Make sure the handler is installed.
523     */
524
525    if (HandlerType == ACPI_SYSTEM_NOTIFY)
526    {
527        NotifyObj = ObjDesc->Device.SysHandler;
528    }
529    else
530    {
531        NotifyObj = ObjDesc->Device.DrvHandler;
532    }
533
534    if ((!NotifyObj) ||
535        (NotifyObj->NotifyHandler.Handler != Handler))
536    {
537        Status = AE_BAD_PARAMETER;
538        goto UnlockAndExit;
539    }
540
541    /*
542     * Now we can remove the handler
543     */
544    if (HandlerType == ACPI_SYSTEM_NOTIFY)
545    {
546        ObjDesc->Device.SysHandler = NULL;
547    }
548    else
549    {
550        ObjDesc->Device.DrvHandler = NULL;
551    }
552
553    AcpiCmRemoveReference (NotifyObj);
554
555UnlockAndExit:
556    AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
557    return_ACPI_STATUS (Status);
558}
559
560/******************************************************************************
561 *
562 * FUNCTION:    AcpiInstallGpeHandler
563 *
564 * PARAMETERS:  GpeNumber       - The GPE number.  The numbering scheme is
565 *                                bank 0 first, then bank 1.
566 *              Type            - Whether this GPE should be treated as an
567 *                                edge- or level-triggered interrupt.
568 *              Handler         - Address of the handler
569 *              Context         - Value passed to the handler on each GPE
570 *
571 * RETURN:      Status
572 *
573 * DESCRIPTION: Install a handler for a General Purpose Event.
574 *
575 ******************************************************************************/
576
577ACPI_STATUS
578AcpiInstallGpeHandler (
579    UINT32                  GpeNumber,
580    UINT32                  Type,
581    GPE_HANDLER             Handler,
582    void                    *Context)
583{
584    ACPI_STATUS             Status = AE_OK;
585
586    FUNCTION_TRACE ("AcpiInstallGpeHandler");
587
588    /* Parameter validation */
589
590    if (!Handler || (GpeNumber > NUM_GPE))
591    {
592        return_ACPI_STATUS (AE_BAD_PARAMETER);
593    }
594
595    /* Ensure that we have a valid GPE number */
596
597    if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
598    {
599        return_ACPI_STATUS (AE_BAD_PARAMETER);
600    }
601
602    AcpiCmAcquireMutex (ACPI_MTX_EVENTS);
603
604    /* Make sure that there isn't a handler there already */
605
606    if (AcpiGbl_GpeInfo[GpeNumber].Handler)
607    {
608        Status = AE_EXIST;
609        goto Cleanup;
610    }
611
612    /* Install the handler */
613
614    AcpiGbl_GpeInfo[GpeNumber].Handler = Handler;
615    AcpiGbl_GpeInfo[GpeNumber].Context = Context;
616    AcpiGbl_GpeInfo[GpeNumber].Type = (UINT8) Type;
617
618    /* Clear the GPE (of stale events), the enable it */
619
620    AcpiHwClearGpe (GpeNumber);
621    AcpiHwEnableGpe (GpeNumber);
622
623Cleanup:
624    AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
625    return_ACPI_STATUS (Status);
626}
627
628
629/******************************************************************************
630 *
631 * FUNCTION:    AcpiRemoveGpeHandler
632 *
633 * PARAMETERS:  GpeNumber       - The event to remove a handler
634 *              Handler         - Address of the handler
635 *
636 * RETURN:      Status
637 *
638 * DESCRIPTION: Remove a handler for a General Purpose AcpiEvent.
639 *
640 ******************************************************************************/
641
642ACPI_STATUS
643AcpiRemoveGpeHandler (
644    UINT32                  GpeNumber,
645    GPE_HANDLER             Handler)
646{
647    ACPI_STATUS             Status = AE_OK;
648
649
650    FUNCTION_TRACE ("AcpiRemoveGpeHandler");
651
652
653    /* Parameter validation */
654
655    if (!Handler || (GpeNumber > NUM_GPE))
656    {
657        return_ACPI_STATUS (AE_BAD_PARAMETER);
658    }
659
660    /* Ensure that we have a valid GPE number */
661
662    if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
663    {
664        return_ACPI_STATUS (AE_BAD_PARAMETER);
665    }
666
667    /* Disable the GPE before removing the handler */
668
669    AcpiHwDisableGpe (GpeNumber);
670
671    AcpiCmAcquireMutex (ACPI_MTX_EVENTS);
672
673    /* Make sure that the installed handler is the same */
674
675    if (AcpiGbl_GpeInfo[GpeNumber].Handler != Handler)
676    {
677        AcpiHwEnableGpe (GpeNumber);
678        Status = AE_BAD_PARAMETER;
679        goto Cleanup;
680    }
681
682    /* Remove the handler */
683
684    AcpiGbl_GpeInfo[GpeNumber].Handler = NULL;
685    AcpiGbl_GpeInfo[GpeNumber].Context = NULL;
686
687Cleanup:
688    AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
689    return_ACPI_STATUS (Status);
690}
691
692
693/******************************************************************************
694 *
695 * FUNCTION:    AcpiAcquireGlobalLock
696 *
697 * PARAMETERS:  Timeout         - How long the caller is willing to wait
698 *              OutHandle       - A handle to the lock if acquired
699 *
700 * RETURN:      Status
701 *
702 * DESCRIPTION: Acquire the ACPI Global Lock
703 *
704 ******************************************************************************/
705ACPI_STATUS
706AcpiAcquireGlobalLock (
707    void)
708{
709    ACPI_STATUS             Status;
710
711
712    AcpiAmlEnterInterpreter ();
713
714    /*
715     * TBD: [Restructure] add timeout param to internal interface, and
716     * perhaps INTERPRETER_LOCKED
717     */
718
719    Status = AcpiEvAcquireGlobalLock ();
720    AcpiAmlExitInterpreter ();
721
722    return (Status);
723}
724
725
726/******************************************************************************
727 *
728 * FUNCTION:    AcpiReleaseGlobalLock
729 *
730 * PARAMETERS:  Handle      - Returned from AcpiAcquireGlobalLock
731 *
732 * RETURN:      Status
733 *
734 * DESCRIPTION: Release the ACPI Global Lock
735 *
736 ******************************************************************************/
737
738ACPI_STATUS
739AcpiReleaseGlobalLock (
740    void)
741{
742    AcpiEvReleaseGlobalLock ();
743    return (AE_OK);
744}
745
746
747