This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ex_system_wait_mutex
- acpi_ex_system_do_stall
- acpi_ex_system_do_sleep
- acpi_ex_system_signal_event
- acpi_ex_system_wait_event
- acpi_ex_system_reset_event
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acinterp.h"
13
14 #define _COMPONENT ACPI_EXECUTER
15 ACPI_MODULE_NAME("exsystem")
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
32 {
33 acpi_status status;
34
35 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
36
37 status = acpi_os_wait_semaphore(semaphore, 1, ACPI_DO_NOT_WAIT);
38 if (ACPI_SUCCESS(status)) {
39 return_ACPI_STATUS(status);
40 }
41
42 if (status == AE_TIME) {
43
44
45
46 acpi_ex_exit_interpreter();
47 status = acpi_os_wait_semaphore(semaphore, 1, timeout);
48
49 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
50 "*** Thread awake after blocking, %s\n",
51 acpi_format_exception(status)));
52
53
54
55 acpi_ex_enter_interpreter();
56 }
57
58 return_ACPI_STATUS(status);
59 }
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
77 {
78 acpi_status status;
79
80 ACPI_FUNCTION_TRACE(ex_system_wait_mutex);
81
82 status = acpi_os_acquire_mutex(mutex, ACPI_DO_NOT_WAIT);
83 if (ACPI_SUCCESS(status)) {
84 return_ACPI_STATUS(status);
85 }
86
87 if (status == AE_TIME) {
88
89
90
91 acpi_ex_exit_interpreter();
92 status = acpi_os_acquire_mutex(mutex, timeout);
93
94 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
95 "*** Thread awake after blocking, %s\n",
96 acpi_format_exception(status)));
97
98
99
100 acpi_ex_enter_interpreter();
101 }
102
103 return_ACPI_STATUS(status);
104 }
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 acpi_status acpi_ex_system_do_stall(u32 how_long)
124 {
125 acpi_status status = AE_OK;
126
127 ACPI_FUNCTION_ENTRY();
128
129 if (how_long > 255) {
130
131
132
133
134
135
136 ACPI_ERROR((AE_INFO,
137 "Time parameter is too large (%u)", how_long));
138 status = AE_AML_OPERAND_VALUE;
139 } else {
140 acpi_os_stall(how_long);
141 }
142
143 return (status);
144 }
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159 acpi_status acpi_ex_system_do_sleep(u64 how_long)
160 {
161 ACPI_FUNCTION_ENTRY();
162
163
164
165 acpi_ex_exit_interpreter();
166
167
168
169
170
171 if (how_long > ACPI_MAX_SLEEP) {
172 how_long = ACPI_MAX_SLEEP;
173 }
174
175 acpi_os_sleep(how_long);
176
177
178
179 acpi_ex_enter_interpreter();
180 return (AE_OK);
181 }
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 acpi_status acpi_ex_system_signal_event(union acpi_operand_object * obj_desc)
197 {
198 acpi_status status = AE_OK;
199
200 ACPI_FUNCTION_TRACE(ex_system_signal_event);
201
202 if (obj_desc) {
203 status =
204 acpi_os_signal_semaphore(obj_desc->event.os_semaphore, 1);
205 }
206
207 return_ACPI_STATUS(status);
208 }
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225 acpi_status
226 acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
227 union acpi_operand_object *obj_desc)
228 {
229 acpi_status status = AE_OK;
230
231 ACPI_FUNCTION_TRACE(ex_system_wait_event);
232
233 if (obj_desc) {
234 status =
235 acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore,
236 (u16) time_desc->integer.
237 value);
238 }
239
240 return_ACPI_STATUS(status);
241 }
242
243
244
245
246
247
248
249
250
251
252
253
254
255 acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
256 {
257 acpi_status status = AE_OK;
258 acpi_semaphore temp_semaphore;
259
260 ACPI_FUNCTION_ENTRY();
261
262
263
264
265
266 status =
267 acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
268 if (ACPI_SUCCESS(status)) {
269 (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore);
270 obj_desc->event.os_semaphore = temp_semaphore;
271 }
272
273 return (status);
274 }