Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/executer/exsystem.c
+++ new/usr/src/common/acpica/components/executer/exsystem.c
1 -
2 1 /******************************************************************************
3 2 *
4 3 * Module Name: exsystem - Interface to OS services
5 4 *
6 5 *****************************************************************************/
7 6
8 7 /*
9 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
10 9 * All rights reserved.
11 10 *
12 11 * Redistribution and use in source and binary forms, with or without
13 12 * modification, are permitted provided that the following conditions
14 13 * are met:
15 14 * 1. Redistributions of source code must retain the above copyright
16 15 * notice, this list of conditions, and the following disclaimer,
17 16 * without modification.
18 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 18 * substantially similar to the "NO WARRANTY" disclaimer below
20 19 * ("Disclaimer") and any redistribution must be conditioned upon
21 20 * including a substantially similar Disclaimer requirement for further
22 21 * binary redistribution.
23 22 * 3. Neither the names of the above-listed copyright holders nor the names
24 23 * of any contributors may be used to endorse or promote products derived
25 24 * from this software without specific prior written permission.
26 25 *
27 26 * Alternatively, this software may be distributed under the terms of the
28 27 * GNU General Public License ("GPL") version 2 as published by the Free
29 28 * Software Foundation.
30 29 *
31 30 * NO WARRANTY
32 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 41 * POSSIBILITY OF SUCH DAMAGES.
43 42 */
44 43
45 44 #define __EXSYSTEM_C__
46 45
47 46 #include "acpi.h"
48 47 #include "accommon.h"
49 48 #include "acinterp.h"
50 49
51 50 #define _COMPONENT ACPI_EXECUTER
52 51 ACPI_MODULE_NAME ("exsystem")
53 52
54 53
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
55 54 /*******************************************************************************
56 55 *
57 56 * FUNCTION: AcpiExSystemWaitSemaphore
58 57 *
59 58 * PARAMETERS: Semaphore - Semaphore to wait on
60 59 * Timeout - Max time to wait
61 60 *
62 61 * RETURN: Status
63 62 *
64 63 * DESCRIPTION: Implements a semaphore wait with a check to see if the
65 - * semaphore is available immediately. If it is not, the
64 + * semaphore is available immediately. If it is not, the
66 65 * interpreter is released before waiting.
67 66 *
68 67 ******************************************************************************/
69 68
70 69 ACPI_STATUS
71 70 AcpiExSystemWaitSemaphore (
72 71 ACPI_SEMAPHORE Semaphore,
73 72 UINT16 Timeout)
74 73 {
75 74 ACPI_STATUS Status;
76 75
77 76
78 77 ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore);
79 78
80 79
81 80 Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT);
82 81 if (ACPI_SUCCESS (Status))
83 82 {
84 83 return_ACPI_STATUS (Status);
85 84 }
86 85
87 86 if (Status == AE_TIME)
88 87 {
89 88 /* We must wait, so unlock the interpreter */
90 89
91 90 AcpiExRelinquishInterpreter ();
92 91
93 92 Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
94 93
95 94 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
96 95 "*** Thread awake after blocking, %s\n",
97 96 AcpiFormatException (Status)));
98 97
99 98 /* Reacquire the interpreter */
100 99
101 100 AcpiExReacquireInterpreter ();
102 101 }
103 102
104 103 return_ACPI_STATUS (Status);
105 104 }
106 105
107 106
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
108 107 /*******************************************************************************
109 108 *
110 109 * FUNCTION: AcpiExSystemWaitMutex
111 110 *
112 111 * PARAMETERS: Mutex - Mutex to wait on
113 112 * Timeout - Max time to wait
114 113 *
115 114 * RETURN: Status
116 115 *
117 116 * DESCRIPTION: Implements a mutex wait with a check to see if the
118 - * mutex is available immediately. If it is not, the
117 + * mutex is available immediately. If it is not, the
119 118 * interpreter is released before waiting.
120 119 *
121 120 ******************************************************************************/
122 121
123 122 ACPI_STATUS
124 123 AcpiExSystemWaitMutex (
125 124 ACPI_MUTEX Mutex,
126 125 UINT16 Timeout)
127 126 {
128 127 ACPI_STATUS Status;
129 128
130 129
131 130 ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
132 131
133 132
134 133 Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
135 134 if (ACPI_SUCCESS (Status))
136 135 {
137 136 return_ACPI_STATUS (Status);
138 137 }
139 138
140 139 if (Status == AE_TIME)
141 140 {
142 141 /* We must wait, so unlock the interpreter */
143 142
144 143 AcpiExRelinquishInterpreter ();
145 144
146 145 Status = AcpiOsAcquireMutex (Mutex, Timeout);
147 146
148 147 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
149 148 "*** Thread awake after blocking, %s\n",
150 149 AcpiFormatException (Status)));
151 150
152 151 /* Reacquire the interpreter */
153 152
154 153 AcpiExReacquireInterpreter ();
155 154 }
156 155
157 156 return_ACPI_STATUS (Status);
158 157 }
159 158
160 159
161 160 /*******************************************************************************
162 161 *
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
163 162 * FUNCTION: AcpiExSystemDoStall
164 163 *
165 164 * PARAMETERS: HowLong - The amount of time to stall,
166 165 * in microseconds
167 166 *
168 167 * RETURN: Status
169 168 *
170 169 * DESCRIPTION: Suspend running thread for specified amount of time.
171 170 * Note: ACPI specification requires that Stall() does not
172 171 * relinquish the processor, and delays longer than 100 usec
173 - * should use Sleep() instead. We allow stalls up to 255 usec
172 + * should use Sleep() instead. We allow stalls up to 255 usec
174 173 * for compatibility with other interpreters and existing BIOSs.
175 174 *
176 175 ******************************************************************************/
177 176
178 177 ACPI_STATUS
179 178 AcpiExSystemDoStall (
180 179 UINT32 HowLong)
181 180 {
182 181 ACPI_STATUS Status = AE_OK;
183 182
184 183
185 184 ACPI_FUNCTION_ENTRY ();
186 185
187 186
188 187 if (HowLong > 255) /* 255 microseconds */
189 188 {
190 189 /*
191 190 * Longer than 255 usec, this is an error
192 191 *
193 192 * (ACPI specifies 100 usec as max, but this gives some slack in
194 193 * order to support existing BIOSs)
195 194 */
196 195 ACPI_ERROR ((AE_INFO, "Time parameter is too large (%u)",
197 196 HowLong));
198 197 Status = AE_AML_OPERAND_VALUE;
199 198 }
200 199 else
201 200 {
202 201 AcpiOsStall (HowLong);
203 202 }
204 203
205 204 return (Status);
206 205 }
207 206
208 207
209 208 /*******************************************************************************
210 209 *
211 210 * FUNCTION: AcpiExSystemDoSleep
212 211 *
213 212 * PARAMETERS: HowLong - The amount of time to sleep,
214 213 * in milliseconds
215 214 *
216 215 * RETURN: None
217 216 *
218 217 * DESCRIPTION: Sleep the running thread for specified amount of time.
219 218 *
220 219 ******************************************************************************/
221 220
222 221 ACPI_STATUS
223 222 AcpiExSystemDoSleep (
224 223 UINT64 HowLong)
225 224 {
226 225 ACPI_FUNCTION_ENTRY ();
227 226
228 227
229 228 /* Since this thread will sleep, we must release the interpreter */
230 229
231 230 AcpiExRelinquishInterpreter ();
232 231
233 232 /*
234 233 * For compatibility with other ACPI implementations and to prevent
235 234 * accidental deep sleeps, limit the sleep time to something reasonable.
236 235 */
237 236 if (HowLong > ACPI_MAX_SLEEP)
238 237 {
239 238 HowLong = ACPI_MAX_SLEEP;
240 239 }
241 240
242 241 AcpiOsSleep (HowLong);
243 242
244 243 /* And now we must get the interpreter again */
245 244
246 245 AcpiExReacquireInterpreter ();
247 246 return (AE_OK);
248 247 }
249 248
250 249
251 250 /*******************************************************************************
252 251 *
253 252 * FUNCTION: AcpiExSystemSignalEvent
254 253 *
255 254 * PARAMETERS: ObjDesc - The object descriptor for this op
256 255 *
257 256 * RETURN: Status
258 257 *
259 258 * DESCRIPTION: Provides an access point to perform synchronization operations
260 259 * within the AML.
261 260 *
262 261 ******************************************************************************/
263 262
264 263 ACPI_STATUS
265 264 AcpiExSystemSignalEvent (
266 265 ACPI_OPERAND_OBJECT *ObjDesc)
267 266 {
268 267 ACPI_STATUS Status = AE_OK;
269 268
270 269
271 270 ACPI_FUNCTION_TRACE (ExSystemSignalEvent);
272 271
273 272
274 273 if (ObjDesc)
275 274 {
276 275 Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1);
277 276 }
278 277
279 278 return_ACPI_STATUS (Status);
280 279 }
281 280
282 281
↓ open down ↓ |
99 lines elided |
↑ open up ↑ |
283 282 /*******************************************************************************
284 283 *
285 284 * FUNCTION: AcpiExSystemWaitEvent
286 285 *
287 286 * PARAMETERS: TimeDesc - The 'time to delay' object descriptor
288 287 * ObjDesc - The object descriptor for this op
289 288 *
290 289 * RETURN: Status
291 290 *
292 291 * DESCRIPTION: Provides an access point to perform synchronization operations
293 - * within the AML. This operation is a request to wait for an
292 + * within the AML. This operation is a request to wait for an
294 293 * event.
295 294 *
296 295 ******************************************************************************/
297 296
298 297 ACPI_STATUS
299 298 AcpiExSystemWaitEvent (
300 299 ACPI_OPERAND_OBJECT *TimeDesc,
301 300 ACPI_OPERAND_OBJECT *ObjDesc)
302 301 {
303 302 ACPI_STATUS Status = AE_OK;
304 303
305 304
306 305 ACPI_FUNCTION_TRACE (ExSystemWaitEvent);
307 306
308 307
309 308 if (ObjDesc)
310 309 {
311 310 Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore,
312 311 (UINT16) TimeDesc->Integer.Value);
313 312 }
314 313
315 314 return_ACPI_STATUS (Status);
316 315 }
317 316
318 317
319 318 /*******************************************************************************
320 319 *
321 320 * FUNCTION: AcpiExSystemResetEvent
322 321 *
323 322 * PARAMETERS: ObjDesc - The object descriptor for this op
324 323 *
325 324 * RETURN: Status
326 325 *
327 326 * DESCRIPTION: Reset an event to a known state.
328 327 *
329 328 ******************************************************************************/
330 329
331 330 ACPI_STATUS
332 331 AcpiExSystemResetEvent (
333 332 ACPI_OPERAND_OBJECT *ObjDesc)
334 333 {
335 334 ACPI_STATUS Status = AE_OK;
336 335 ACPI_SEMAPHORE TempSemaphore;
337 336
338 337
339 338 ACPI_FUNCTION_ENTRY ();
340 339
341 340
342 341 /*
343 342 * We are going to simply delete the existing semaphore and
344 343 * create a new one!
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
345 344 */
346 345 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
347 346 if (ACPI_SUCCESS (Status))
348 347 {
349 348 (void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore);
350 349 ObjDesc->Event.OsSemaphore = TempSemaphore;
351 350 }
352 351
353 352 return (Status);
354 353 }
355 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX