xref: /onnv-gate/usr/src/uts/intel/io/acpica/executer/exsystem.c (revision 7851:e828bbb1689c)
1*7851SDana.Myers@Sun.COM 
2*7851SDana.Myers@Sun.COM /******************************************************************************
3*7851SDana.Myers@Sun.COM  *
4*7851SDana.Myers@Sun.COM  * Module Name: exsystem - Interface to OS services
5*7851SDana.Myers@Sun.COM  *              $Revision: 1.95 $
6*7851SDana.Myers@Sun.COM  *
7*7851SDana.Myers@Sun.COM  *****************************************************************************/
8*7851SDana.Myers@Sun.COM 
9*7851SDana.Myers@Sun.COM /******************************************************************************
10*7851SDana.Myers@Sun.COM  *
11*7851SDana.Myers@Sun.COM  * 1. Copyright Notice
12*7851SDana.Myers@Sun.COM  *
13*7851SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
14*7851SDana.Myers@Sun.COM  * All rights reserved.
15*7851SDana.Myers@Sun.COM  *
16*7851SDana.Myers@Sun.COM  * 2. License
17*7851SDana.Myers@Sun.COM  *
18*7851SDana.Myers@Sun.COM  * 2.1. This is your license from Intel Corp. under its intellectual property
19*7851SDana.Myers@Sun.COM  * rights.  You may have additional license terms from the party that provided
20*7851SDana.Myers@Sun.COM  * you this software, covering your right to use that party's intellectual
21*7851SDana.Myers@Sun.COM  * property rights.
22*7851SDana.Myers@Sun.COM  *
23*7851SDana.Myers@Sun.COM  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24*7851SDana.Myers@Sun.COM  * copy of the source code appearing in this file ("Covered Code") an
25*7851SDana.Myers@Sun.COM  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26*7851SDana.Myers@Sun.COM  * base code distributed originally by Intel ("Original Intel Code") to copy,
27*7851SDana.Myers@Sun.COM  * make derivatives, distribute, use and display any portion of the Covered
28*7851SDana.Myers@Sun.COM  * Code in any form, with the right to sublicense such rights; and
29*7851SDana.Myers@Sun.COM  *
30*7851SDana.Myers@Sun.COM  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31*7851SDana.Myers@Sun.COM  * license (with the right to sublicense), under only those claims of Intel
32*7851SDana.Myers@Sun.COM  * patents that are infringed by the Original Intel Code, to make, use, sell,
33*7851SDana.Myers@Sun.COM  * offer to sell, and import the Covered Code and derivative works thereof
34*7851SDana.Myers@Sun.COM  * solely to the minimum extent necessary to exercise the above copyright
35*7851SDana.Myers@Sun.COM  * license, and in no event shall the patent license extend to any additions
36*7851SDana.Myers@Sun.COM  * to or modifications of the Original Intel Code.  No other license or right
37*7851SDana.Myers@Sun.COM  * is granted directly or by implication, estoppel or otherwise;
38*7851SDana.Myers@Sun.COM  *
39*7851SDana.Myers@Sun.COM  * The above copyright and patent license is granted only if the following
40*7851SDana.Myers@Sun.COM  * conditions are met:
41*7851SDana.Myers@Sun.COM  *
42*7851SDana.Myers@Sun.COM  * 3. Conditions
43*7851SDana.Myers@Sun.COM  *
44*7851SDana.Myers@Sun.COM  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45*7851SDana.Myers@Sun.COM  * Redistribution of source code of any substantial portion of the Covered
46*7851SDana.Myers@Sun.COM  * Code or modification with rights to further distribute source must include
47*7851SDana.Myers@Sun.COM  * the above Copyright Notice, the above License, this list of Conditions,
48*7851SDana.Myers@Sun.COM  * and the following Disclaimer and Export Compliance provision.  In addition,
49*7851SDana.Myers@Sun.COM  * Licensee must cause all Covered Code to which Licensee contributes to
50*7851SDana.Myers@Sun.COM  * contain a file documenting the changes Licensee made to create that Covered
51*7851SDana.Myers@Sun.COM  * Code and the date of any change.  Licensee must include in that file the
52*7851SDana.Myers@Sun.COM  * documentation of any changes made by any predecessor Licensee.  Licensee
53*7851SDana.Myers@Sun.COM  * must include a prominent statement that the modification is derived,
54*7851SDana.Myers@Sun.COM  * directly or indirectly, from Original Intel Code.
55*7851SDana.Myers@Sun.COM  *
56*7851SDana.Myers@Sun.COM  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57*7851SDana.Myers@Sun.COM  * Redistribution of source code of any substantial portion of the Covered
58*7851SDana.Myers@Sun.COM  * Code or modification without rights to further distribute source must
59*7851SDana.Myers@Sun.COM  * include the following Disclaimer and Export Compliance provision in the
60*7851SDana.Myers@Sun.COM  * documentation and/or other materials provided with distribution.  In
61*7851SDana.Myers@Sun.COM  * addition, Licensee may not authorize further sublicense of source of any
62*7851SDana.Myers@Sun.COM  * portion of the Covered Code, and must include terms to the effect that the
63*7851SDana.Myers@Sun.COM  * license from Licensee to its licensee is limited to the intellectual
64*7851SDana.Myers@Sun.COM  * property embodied in the software Licensee provides to its licensee, and
65*7851SDana.Myers@Sun.COM  * not to intellectual property embodied in modifications its licensee may
66*7851SDana.Myers@Sun.COM  * make.
67*7851SDana.Myers@Sun.COM  *
68*7851SDana.Myers@Sun.COM  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69*7851SDana.Myers@Sun.COM  * substantial portion of the Covered Code or modification must reproduce the
70*7851SDana.Myers@Sun.COM  * above Copyright Notice, and the following Disclaimer and Export Compliance
71*7851SDana.Myers@Sun.COM  * provision in the documentation and/or other materials provided with the
72*7851SDana.Myers@Sun.COM  * distribution.
73*7851SDana.Myers@Sun.COM  *
74*7851SDana.Myers@Sun.COM  * 3.4. Intel retains all right, title, and interest in and to the Original
75*7851SDana.Myers@Sun.COM  * Intel Code.
76*7851SDana.Myers@Sun.COM  *
77*7851SDana.Myers@Sun.COM  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78*7851SDana.Myers@Sun.COM  * Intel shall be used in advertising or otherwise to promote the sale, use or
79*7851SDana.Myers@Sun.COM  * other dealings in products derived from or relating to the Covered Code
80*7851SDana.Myers@Sun.COM  * without prior written authorization from Intel.
81*7851SDana.Myers@Sun.COM  *
82*7851SDana.Myers@Sun.COM  * 4. Disclaimer and Export Compliance
83*7851SDana.Myers@Sun.COM  *
84*7851SDana.Myers@Sun.COM  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85*7851SDana.Myers@Sun.COM  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86*7851SDana.Myers@Sun.COM  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87*7851SDana.Myers@Sun.COM  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88*7851SDana.Myers@Sun.COM  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89*7851SDana.Myers@Sun.COM  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90*7851SDana.Myers@Sun.COM  * PARTICULAR PURPOSE.
91*7851SDana.Myers@Sun.COM  *
92*7851SDana.Myers@Sun.COM  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93*7851SDana.Myers@Sun.COM  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94*7851SDana.Myers@Sun.COM  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95*7851SDana.Myers@Sun.COM  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96*7851SDana.Myers@Sun.COM  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97*7851SDana.Myers@Sun.COM  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98*7851SDana.Myers@Sun.COM  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99*7851SDana.Myers@Sun.COM  * LIMITED REMEDY.
100*7851SDana.Myers@Sun.COM  *
101*7851SDana.Myers@Sun.COM  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102*7851SDana.Myers@Sun.COM  * software or system incorporating such software without first obtaining any
103*7851SDana.Myers@Sun.COM  * required license or other approval from the U. S. Department of Commerce or
104*7851SDana.Myers@Sun.COM  * any other agency or department of the United States Government.  In the
105*7851SDana.Myers@Sun.COM  * event Licensee exports any such software from the United States or
106*7851SDana.Myers@Sun.COM  * re-exports any such software from a foreign destination, Licensee shall
107*7851SDana.Myers@Sun.COM  * ensure that the distribution and export/re-export of the software is in
108*7851SDana.Myers@Sun.COM  * compliance with all laws, regulations, orders, or other restrictions of the
109*7851SDana.Myers@Sun.COM  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110*7851SDana.Myers@Sun.COM  * any of its subsidiaries will export/re-export any technical data, process,
111*7851SDana.Myers@Sun.COM  * software, or service, directly or indirectly, to any country for which the
112*7851SDana.Myers@Sun.COM  * United States government or any agency thereof requires an export license,
113*7851SDana.Myers@Sun.COM  * other governmental approval, or letter of assurance, without first obtaining
114*7851SDana.Myers@Sun.COM  * such license, approval or letter.
115*7851SDana.Myers@Sun.COM  *
116*7851SDana.Myers@Sun.COM  *****************************************************************************/
117*7851SDana.Myers@Sun.COM 
118*7851SDana.Myers@Sun.COM #define __EXSYSTEM_C__
119*7851SDana.Myers@Sun.COM 
120*7851SDana.Myers@Sun.COM #include "acpi.h"
121*7851SDana.Myers@Sun.COM #include "acinterp.h"
122*7851SDana.Myers@Sun.COM 
123*7851SDana.Myers@Sun.COM #define _COMPONENT          ACPI_EXECUTER
124*7851SDana.Myers@Sun.COM         ACPI_MODULE_NAME    ("exsystem")
125*7851SDana.Myers@Sun.COM 
126*7851SDana.Myers@Sun.COM 
127*7851SDana.Myers@Sun.COM /*******************************************************************************
128*7851SDana.Myers@Sun.COM  *
129*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemWaitSemaphore
130*7851SDana.Myers@Sun.COM  *
131*7851SDana.Myers@Sun.COM  * PARAMETERS:  Semaphore       - Semaphore to wait on
132*7851SDana.Myers@Sun.COM  *              Timeout         - Max time to wait
133*7851SDana.Myers@Sun.COM  *
134*7851SDana.Myers@Sun.COM  * RETURN:      Status
135*7851SDana.Myers@Sun.COM  *
136*7851SDana.Myers@Sun.COM  * DESCRIPTION: Implements a semaphore wait with a check to see if the
137*7851SDana.Myers@Sun.COM  *              semaphore is available immediately.  If it is not, the
138*7851SDana.Myers@Sun.COM  *              interpreter is released before waiting.
139*7851SDana.Myers@Sun.COM  *
140*7851SDana.Myers@Sun.COM  ******************************************************************************/
141*7851SDana.Myers@Sun.COM 
142*7851SDana.Myers@Sun.COM ACPI_STATUS
143*7851SDana.Myers@Sun.COM AcpiExSystemWaitSemaphore (
144*7851SDana.Myers@Sun.COM     ACPI_SEMAPHORE          Semaphore,
145*7851SDana.Myers@Sun.COM     UINT16                  Timeout)
146*7851SDana.Myers@Sun.COM {
147*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status;
148*7851SDana.Myers@Sun.COM 
149*7851SDana.Myers@Sun.COM 
150*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore);
151*7851SDana.Myers@Sun.COM 
152*7851SDana.Myers@Sun.COM 
153*7851SDana.Myers@Sun.COM     Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT);
154*7851SDana.Myers@Sun.COM     if (ACPI_SUCCESS (Status))
155*7851SDana.Myers@Sun.COM     {
156*7851SDana.Myers@Sun.COM         return_ACPI_STATUS (Status);
157*7851SDana.Myers@Sun.COM     }
158*7851SDana.Myers@Sun.COM 
159*7851SDana.Myers@Sun.COM     if (Status == AE_TIME)
160*7851SDana.Myers@Sun.COM     {
161*7851SDana.Myers@Sun.COM         /* We must wait, so unlock the interpreter */
162*7851SDana.Myers@Sun.COM 
163*7851SDana.Myers@Sun.COM         AcpiExRelinquishInterpreter ();
164*7851SDana.Myers@Sun.COM 
165*7851SDana.Myers@Sun.COM         Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
166*7851SDana.Myers@Sun.COM 
167*7851SDana.Myers@Sun.COM         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
168*7851SDana.Myers@Sun.COM             "*** Thread awake after blocking, %s\n",
169*7851SDana.Myers@Sun.COM             AcpiFormatException (Status)));
170*7851SDana.Myers@Sun.COM 
171*7851SDana.Myers@Sun.COM         /* Reacquire the interpreter */
172*7851SDana.Myers@Sun.COM 
173*7851SDana.Myers@Sun.COM        AcpiExReacquireInterpreter ();
174*7851SDana.Myers@Sun.COM     }
175*7851SDana.Myers@Sun.COM 
176*7851SDana.Myers@Sun.COM     return_ACPI_STATUS (Status);
177*7851SDana.Myers@Sun.COM }
178*7851SDana.Myers@Sun.COM 
179*7851SDana.Myers@Sun.COM 
180*7851SDana.Myers@Sun.COM /*******************************************************************************
181*7851SDana.Myers@Sun.COM  *
182*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemWaitMutex
183*7851SDana.Myers@Sun.COM  *
184*7851SDana.Myers@Sun.COM  * PARAMETERS:  Mutex           - Mutex to wait on
185*7851SDana.Myers@Sun.COM  *              Timeout         - Max time to wait
186*7851SDana.Myers@Sun.COM  *
187*7851SDana.Myers@Sun.COM  * RETURN:      Status
188*7851SDana.Myers@Sun.COM  *
189*7851SDana.Myers@Sun.COM  * DESCRIPTION: Implements a mutex wait with a check to see if the
190*7851SDana.Myers@Sun.COM  *              mutex is available immediately.  If it is not, the
191*7851SDana.Myers@Sun.COM  *              interpreter is released before waiting.
192*7851SDana.Myers@Sun.COM  *
193*7851SDana.Myers@Sun.COM  ******************************************************************************/
194*7851SDana.Myers@Sun.COM 
195*7851SDana.Myers@Sun.COM ACPI_STATUS
196*7851SDana.Myers@Sun.COM AcpiExSystemWaitMutex (
197*7851SDana.Myers@Sun.COM     ACPI_MUTEX              Mutex,
198*7851SDana.Myers@Sun.COM     UINT16                  Timeout)
199*7851SDana.Myers@Sun.COM {
200*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status;
201*7851SDana.Myers@Sun.COM 
202*7851SDana.Myers@Sun.COM 
203*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
204*7851SDana.Myers@Sun.COM 
205*7851SDana.Myers@Sun.COM 
206*7851SDana.Myers@Sun.COM     Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
207*7851SDana.Myers@Sun.COM     if (ACPI_SUCCESS (Status))
208*7851SDana.Myers@Sun.COM     {
209*7851SDana.Myers@Sun.COM         return_ACPI_STATUS (Status);
210*7851SDana.Myers@Sun.COM     }
211*7851SDana.Myers@Sun.COM 
212*7851SDana.Myers@Sun.COM     if (Status == AE_TIME)
213*7851SDana.Myers@Sun.COM     {
214*7851SDana.Myers@Sun.COM         /* We must wait, so unlock the interpreter */
215*7851SDana.Myers@Sun.COM 
216*7851SDana.Myers@Sun.COM         AcpiExRelinquishInterpreter ();
217*7851SDana.Myers@Sun.COM 
218*7851SDana.Myers@Sun.COM         Status = AcpiOsAcquireMutex (Mutex, Timeout);
219*7851SDana.Myers@Sun.COM 
220*7851SDana.Myers@Sun.COM         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
221*7851SDana.Myers@Sun.COM             "*** Thread awake after blocking, %s\n",
222*7851SDana.Myers@Sun.COM             AcpiFormatException (Status)));
223*7851SDana.Myers@Sun.COM 
224*7851SDana.Myers@Sun.COM         /* Reacquire the interpreter */
225*7851SDana.Myers@Sun.COM 
226*7851SDana.Myers@Sun.COM         AcpiExReacquireInterpreter ();
227*7851SDana.Myers@Sun.COM     }
228*7851SDana.Myers@Sun.COM 
229*7851SDana.Myers@Sun.COM     return_ACPI_STATUS (Status);
230*7851SDana.Myers@Sun.COM }
231*7851SDana.Myers@Sun.COM 
232*7851SDana.Myers@Sun.COM 
233*7851SDana.Myers@Sun.COM /*******************************************************************************
234*7851SDana.Myers@Sun.COM  *
235*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemDoStall
236*7851SDana.Myers@Sun.COM  *
237*7851SDana.Myers@Sun.COM  * PARAMETERS:  HowLong         - The amount of time to stall,
238*7851SDana.Myers@Sun.COM  *                                in microseconds
239*7851SDana.Myers@Sun.COM  *
240*7851SDana.Myers@Sun.COM  * RETURN:      Status
241*7851SDana.Myers@Sun.COM  *
242*7851SDana.Myers@Sun.COM  * DESCRIPTION: Suspend running thread for specified amount of time.
243*7851SDana.Myers@Sun.COM  *              Note: ACPI specification requires that Stall() does not
244*7851SDana.Myers@Sun.COM  *              relinquish the processor, and delays longer than 100 usec
245*7851SDana.Myers@Sun.COM  *              should use Sleep() instead.  We allow stalls up to 255 usec
246*7851SDana.Myers@Sun.COM  *              for compatibility with other interpreters and existing BIOSs.
247*7851SDana.Myers@Sun.COM  *
248*7851SDana.Myers@Sun.COM  ******************************************************************************/
249*7851SDana.Myers@Sun.COM 
250*7851SDana.Myers@Sun.COM ACPI_STATUS
251*7851SDana.Myers@Sun.COM AcpiExSystemDoStall (
252*7851SDana.Myers@Sun.COM     UINT32                  HowLong)
253*7851SDana.Myers@Sun.COM {
254*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status = AE_OK;
255*7851SDana.Myers@Sun.COM 
256*7851SDana.Myers@Sun.COM 
257*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_ENTRY ();
258*7851SDana.Myers@Sun.COM 
259*7851SDana.Myers@Sun.COM 
260*7851SDana.Myers@Sun.COM     if (HowLong > 255) /* 255 microseconds */
261*7851SDana.Myers@Sun.COM     {
262*7851SDana.Myers@Sun.COM         /*
263*7851SDana.Myers@Sun.COM          * Longer than 255 usec, this is an error
264*7851SDana.Myers@Sun.COM          *
265*7851SDana.Myers@Sun.COM          * (ACPI specifies 100 usec as max, but this gives some slack in
266*7851SDana.Myers@Sun.COM          * order to support existing BIOSs)
267*7851SDana.Myers@Sun.COM          */
268*7851SDana.Myers@Sun.COM         ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
269*7851SDana.Myers@Sun.COM             HowLong));
270*7851SDana.Myers@Sun.COM         Status = AE_AML_OPERAND_VALUE;
271*7851SDana.Myers@Sun.COM     }
272*7851SDana.Myers@Sun.COM     else
273*7851SDana.Myers@Sun.COM     {
274*7851SDana.Myers@Sun.COM         AcpiOsStall (HowLong);
275*7851SDana.Myers@Sun.COM     }
276*7851SDana.Myers@Sun.COM 
277*7851SDana.Myers@Sun.COM     return (Status);
278*7851SDana.Myers@Sun.COM }
279*7851SDana.Myers@Sun.COM 
280*7851SDana.Myers@Sun.COM 
281*7851SDana.Myers@Sun.COM /*******************************************************************************
282*7851SDana.Myers@Sun.COM  *
283*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemDoSuspend
284*7851SDana.Myers@Sun.COM  *
285*7851SDana.Myers@Sun.COM  * PARAMETERS:  HowLong         - The amount of time to suspend,
286*7851SDana.Myers@Sun.COM  *                                in milliseconds
287*7851SDana.Myers@Sun.COM  *
288*7851SDana.Myers@Sun.COM  * RETURN:      None
289*7851SDana.Myers@Sun.COM  *
290*7851SDana.Myers@Sun.COM  * DESCRIPTION: Suspend running thread for specified amount of time.
291*7851SDana.Myers@Sun.COM  *
292*7851SDana.Myers@Sun.COM  ******************************************************************************/
293*7851SDana.Myers@Sun.COM 
294*7851SDana.Myers@Sun.COM ACPI_STATUS
295*7851SDana.Myers@Sun.COM AcpiExSystemDoSuspend (
296*7851SDana.Myers@Sun.COM     ACPI_INTEGER            HowLong)
297*7851SDana.Myers@Sun.COM {
298*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_ENTRY ();
299*7851SDana.Myers@Sun.COM 
300*7851SDana.Myers@Sun.COM 
301*7851SDana.Myers@Sun.COM     /* Since this thread will sleep, we must release the interpreter */
302*7851SDana.Myers@Sun.COM 
303*7851SDana.Myers@Sun.COM     AcpiExRelinquishInterpreter ();
304*7851SDana.Myers@Sun.COM 
305*7851SDana.Myers@Sun.COM     AcpiOsSleep (HowLong);
306*7851SDana.Myers@Sun.COM 
307*7851SDana.Myers@Sun.COM     /* And now we must get the interpreter again */
308*7851SDana.Myers@Sun.COM 
309*7851SDana.Myers@Sun.COM     AcpiExReacquireInterpreter ();
310*7851SDana.Myers@Sun.COM     return (AE_OK);
311*7851SDana.Myers@Sun.COM }
312*7851SDana.Myers@Sun.COM 
313*7851SDana.Myers@Sun.COM 
314*7851SDana.Myers@Sun.COM /*******************************************************************************
315*7851SDana.Myers@Sun.COM  *
316*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemSignalEvent
317*7851SDana.Myers@Sun.COM  *
318*7851SDana.Myers@Sun.COM  * PARAMETERS:  ObjDesc         - The object descriptor for this op
319*7851SDana.Myers@Sun.COM  *
320*7851SDana.Myers@Sun.COM  * RETURN:      Status
321*7851SDana.Myers@Sun.COM  *
322*7851SDana.Myers@Sun.COM  * DESCRIPTION: Provides an access point to perform synchronization operations
323*7851SDana.Myers@Sun.COM  *              within the AML.
324*7851SDana.Myers@Sun.COM  *
325*7851SDana.Myers@Sun.COM  ******************************************************************************/
326*7851SDana.Myers@Sun.COM 
327*7851SDana.Myers@Sun.COM ACPI_STATUS
328*7851SDana.Myers@Sun.COM AcpiExSystemSignalEvent (
329*7851SDana.Myers@Sun.COM     ACPI_OPERAND_OBJECT     *ObjDesc)
330*7851SDana.Myers@Sun.COM {
331*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status = AE_OK;
332*7851SDana.Myers@Sun.COM 
333*7851SDana.Myers@Sun.COM 
334*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_TRACE (ExSystemSignalEvent);
335*7851SDana.Myers@Sun.COM 
336*7851SDana.Myers@Sun.COM 
337*7851SDana.Myers@Sun.COM     if (ObjDesc)
338*7851SDana.Myers@Sun.COM     {
339*7851SDana.Myers@Sun.COM         Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1);
340*7851SDana.Myers@Sun.COM     }
341*7851SDana.Myers@Sun.COM 
342*7851SDana.Myers@Sun.COM     return_ACPI_STATUS (Status);
343*7851SDana.Myers@Sun.COM }
344*7851SDana.Myers@Sun.COM 
345*7851SDana.Myers@Sun.COM 
346*7851SDana.Myers@Sun.COM /*******************************************************************************
347*7851SDana.Myers@Sun.COM  *
348*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemWaitEvent
349*7851SDana.Myers@Sun.COM  *
350*7851SDana.Myers@Sun.COM  * PARAMETERS:  TimeDesc        - The 'time to delay' object descriptor
351*7851SDana.Myers@Sun.COM  *              ObjDesc         - The object descriptor for this op
352*7851SDana.Myers@Sun.COM  *
353*7851SDana.Myers@Sun.COM  * RETURN:      Status
354*7851SDana.Myers@Sun.COM  *
355*7851SDana.Myers@Sun.COM  * DESCRIPTION: Provides an access point to perform synchronization operations
356*7851SDana.Myers@Sun.COM  *              within the AML.  This operation is a request to wait for an
357*7851SDana.Myers@Sun.COM  *              event.
358*7851SDana.Myers@Sun.COM  *
359*7851SDana.Myers@Sun.COM  ******************************************************************************/
360*7851SDana.Myers@Sun.COM 
361*7851SDana.Myers@Sun.COM ACPI_STATUS
362*7851SDana.Myers@Sun.COM AcpiExSystemWaitEvent (
363*7851SDana.Myers@Sun.COM     ACPI_OPERAND_OBJECT     *TimeDesc,
364*7851SDana.Myers@Sun.COM     ACPI_OPERAND_OBJECT     *ObjDesc)
365*7851SDana.Myers@Sun.COM {
366*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status = AE_OK;
367*7851SDana.Myers@Sun.COM 
368*7851SDana.Myers@Sun.COM 
369*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_TRACE (ExSystemWaitEvent);
370*7851SDana.Myers@Sun.COM 
371*7851SDana.Myers@Sun.COM 
372*7851SDana.Myers@Sun.COM     if (ObjDesc)
373*7851SDana.Myers@Sun.COM     {
374*7851SDana.Myers@Sun.COM         Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore,
375*7851SDana.Myers@Sun.COM                     (UINT16) TimeDesc->Integer.Value);
376*7851SDana.Myers@Sun.COM     }
377*7851SDana.Myers@Sun.COM 
378*7851SDana.Myers@Sun.COM     return_ACPI_STATUS (Status);
379*7851SDana.Myers@Sun.COM }
380*7851SDana.Myers@Sun.COM 
381*7851SDana.Myers@Sun.COM 
382*7851SDana.Myers@Sun.COM /*******************************************************************************
383*7851SDana.Myers@Sun.COM  *
384*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiExSystemResetEvent
385*7851SDana.Myers@Sun.COM  *
386*7851SDana.Myers@Sun.COM  * PARAMETERS:  ObjDesc         - The object descriptor for this op
387*7851SDana.Myers@Sun.COM  *
388*7851SDana.Myers@Sun.COM  * RETURN:      Status
389*7851SDana.Myers@Sun.COM  *
390*7851SDana.Myers@Sun.COM  * DESCRIPTION: Reset an event to a known state.
391*7851SDana.Myers@Sun.COM  *
392*7851SDana.Myers@Sun.COM  ******************************************************************************/
393*7851SDana.Myers@Sun.COM 
394*7851SDana.Myers@Sun.COM ACPI_STATUS
395*7851SDana.Myers@Sun.COM AcpiExSystemResetEvent (
396*7851SDana.Myers@Sun.COM     ACPI_OPERAND_OBJECT     *ObjDesc)
397*7851SDana.Myers@Sun.COM {
398*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status = AE_OK;
399*7851SDana.Myers@Sun.COM     ACPI_SEMAPHORE          TempSemaphore;
400*7851SDana.Myers@Sun.COM 
401*7851SDana.Myers@Sun.COM 
402*7851SDana.Myers@Sun.COM     ACPI_FUNCTION_ENTRY ();
403*7851SDana.Myers@Sun.COM 
404*7851SDana.Myers@Sun.COM 
405*7851SDana.Myers@Sun.COM     /*
406*7851SDana.Myers@Sun.COM      * We are going to simply delete the existing semaphore and
407*7851SDana.Myers@Sun.COM      * create a new one!
408*7851SDana.Myers@Sun.COM      */
409*7851SDana.Myers@Sun.COM     Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
410*7851SDana.Myers@Sun.COM     if (ACPI_SUCCESS (Status))
411*7851SDana.Myers@Sun.COM     {
412*7851SDana.Myers@Sun.COM         (void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore);
413*7851SDana.Myers@Sun.COM         ObjDesc->Event.OsSemaphore = TempSemaphore;
414*7851SDana.Myers@Sun.COM     }
415*7851SDana.Myers@Sun.COM 
416*7851SDana.Myers@Sun.COM     return (Status);
417*7851SDana.Myers@Sun.COM }
418*7851SDana.Myers@Sun.COM 
419