diff options
Diffstat (limited to 'drivers/acpi/events/evxfevnt.c')
-rw-r--r-- | drivers/acpi/events/evxfevnt.c | 463 |
1 files changed, 199 insertions, 264 deletions
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index c5f74d7b64d8..887ff9f28a0d 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -48,8 +48,7 @@ | |||
48 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
49 | 49 | ||
50 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
51 | ACPI_MODULE_NAME ("evxfevnt") | 51 | ACPI_MODULE_NAME("evxfevnt") |
52 | |||
53 | 52 | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
@@ -62,44 +61,39 @@ | |||
62 | * DESCRIPTION: Transfers the system into ACPI mode. | 61 | * DESCRIPTION: Transfers the system into ACPI mode. |
63 | * | 62 | * |
64 | ******************************************************************************/ | 63 | ******************************************************************************/ |
65 | 64 | acpi_status acpi_enable(void) | |
66 | acpi_status | ||
67 | acpi_enable ( | ||
68 | void) | ||
69 | { | 65 | { |
70 | acpi_status status = AE_OK; | 66 | acpi_status status = AE_OK; |
71 | |||
72 | 67 | ||
73 | ACPI_FUNCTION_TRACE ("acpi_enable"); | 68 | ACPI_FUNCTION_TRACE("acpi_enable"); |
74 | 69 | ||
75 | 70 | /* Make sure we have the FADT */ | |
76 | /* Make sure we have the FADT*/ | ||
77 | 71 | ||
78 | if (!acpi_gbl_FADT) { | 72 | if (!acpi_gbl_FADT) { |
79 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n")); | 73 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
80 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 74 | "No FADT information present!\n")); |
75 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
81 | } | 76 | } |
82 | 77 | ||
83 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { | 78 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { |
84 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n")); | 79 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
85 | } | 80 | "System is already in ACPI mode\n")); |
86 | else { | 81 | } else { |
87 | /* Transition to ACPI mode */ | 82 | /* Transition to ACPI mode */ |
88 | 83 | ||
89 | status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI); | 84 | status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); |
90 | if (ACPI_FAILURE (status)) { | 85 | if (ACPI_FAILURE(status)) { |
91 | ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n")); | 86 | ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n")); |
92 | return_ACPI_STATUS (status); | 87 | return_ACPI_STATUS(status); |
93 | } | 88 | } |
94 | 89 | ||
95 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, | 90 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
96 | "Transition to ACPI mode successful\n")); | 91 | "Transition to ACPI mode successful\n")); |
97 | } | 92 | } |
98 | 93 | ||
99 | return_ACPI_STATUS (status); | 94 | return_ACPI_STATUS(status); |
100 | } | 95 | } |
101 | 96 | ||
102 | |||
103 | /******************************************************************************* | 97 | /******************************************************************************* |
104 | * | 98 | * |
105 | * FUNCTION: acpi_disable | 99 | * FUNCTION: acpi_disable |
@@ -112,43 +106,38 @@ acpi_enable ( | |||
112 | * | 106 | * |
113 | ******************************************************************************/ | 107 | ******************************************************************************/ |
114 | 108 | ||
115 | acpi_status | 109 | acpi_status acpi_disable(void) |
116 | acpi_disable ( | ||
117 | void) | ||
118 | { | 110 | { |
119 | acpi_status status = AE_OK; | 111 | acpi_status status = AE_OK; |
120 | |||
121 | |||
122 | ACPI_FUNCTION_TRACE ("acpi_disable"); | ||
123 | 112 | ||
113 | ACPI_FUNCTION_TRACE("acpi_disable"); | ||
124 | 114 | ||
125 | if (!acpi_gbl_FADT) { | 115 | if (!acpi_gbl_FADT) { |
126 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n")); | 116 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
127 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 117 | "No FADT information present!\n")); |
118 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
128 | } | 119 | } |
129 | 120 | ||
130 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { | 121 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { |
131 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, | 122 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
132 | "System is already in legacy (non-ACPI) mode\n")); | 123 | "System is already in legacy (non-ACPI) mode\n")); |
133 | } | 124 | } else { |
134 | else { | ||
135 | /* Transition to LEGACY mode */ | 125 | /* Transition to LEGACY mode */ |
136 | 126 | ||
137 | status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); | 127 | status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); |
138 | 128 | ||
139 | if (ACPI_FAILURE (status)) { | 129 | if (ACPI_FAILURE(status)) { |
140 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 130 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
141 | "Could not exit ACPI mode to legacy mode")); | 131 | "Could not exit ACPI mode to legacy mode")); |
142 | return_ACPI_STATUS (status); | 132 | return_ACPI_STATUS(status); |
143 | } | 133 | } |
144 | 134 | ||
145 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n")); | 135 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n")); |
146 | } | 136 | } |
147 | 137 | ||
148 | return_ACPI_STATUS (status); | 138 | return_ACPI_STATUS(status); |
149 | } | 139 | } |
150 | 140 | ||
151 | |||
152 | /******************************************************************************* | 141 | /******************************************************************************* |
153 | * | 142 | * |
154 | * FUNCTION: acpi_enable_event | 143 | * FUNCTION: acpi_enable_event |
@@ -162,52 +151,50 @@ acpi_disable ( | |||
162 | * | 151 | * |
163 | ******************************************************************************/ | 152 | ******************************************************************************/ |
164 | 153 | ||
165 | acpi_status | 154 | acpi_status acpi_enable_event(u32 event, u32 flags) |
166 | acpi_enable_event ( | ||
167 | u32 event, | ||
168 | u32 flags) | ||
169 | { | 155 | { |
170 | acpi_status status = AE_OK; | 156 | acpi_status status = AE_OK; |
171 | u32 value; | 157 | u32 value; |
172 | |||
173 | |||
174 | ACPI_FUNCTION_TRACE ("acpi_enable_event"); | ||
175 | 158 | ||
159 | ACPI_FUNCTION_TRACE("acpi_enable_event"); | ||
176 | 160 | ||
177 | /* Decode the Fixed Event */ | 161 | /* Decode the Fixed Event */ |
178 | 162 | ||
179 | if (event > ACPI_EVENT_MAX) { | 163 | if (event > ACPI_EVENT_MAX) { |
180 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 164 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
181 | } | 165 | } |
182 | 166 | ||
183 | /* | 167 | /* |
184 | * Enable the requested fixed event (by writing a one to the | 168 | * Enable the requested fixed event (by writing a one to the |
185 | * enable register bit) | 169 | * enable register bit) |
186 | */ | 170 | */ |
187 | status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, | 171 | status = |
188 | 1, ACPI_MTX_LOCK); | 172 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
189 | if (ACPI_FAILURE (status)) { | 173 | enable_register_id, 1, ACPI_MTX_LOCK); |
190 | return_ACPI_STATUS (status); | 174 | if (ACPI_FAILURE(status)) { |
175 | return_ACPI_STATUS(status); | ||
191 | } | 176 | } |
192 | 177 | ||
193 | /* Make sure that the hardware responded */ | 178 | /* Make sure that the hardware responded */ |
194 | 179 | ||
195 | status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, | 180 | status = |
196 | &value, ACPI_MTX_LOCK); | 181 | acpi_get_register(acpi_gbl_fixed_event_info[event]. |
197 | if (ACPI_FAILURE (status)) { | 182 | enable_register_id, &value, ACPI_MTX_LOCK); |
198 | return_ACPI_STATUS (status); | 183 | if (ACPI_FAILURE(status)) { |
184 | return_ACPI_STATUS(status); | ||
199 | } | 185 | } |
200 | 186 | ||
201 | if (value != 1) { | 187 | if (value != 1) { |
202 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 188 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
203 | "Could not enable %s event\n", acpi_ut_get_event_name (event))); | 189 | "Could not enable %s event\n", |
204 | return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); | 190 | acpi_ut_get_event_name(event))); |
191 | return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); | ||
205 | } | 192 | } |
206 | 193 | ||
207 | return_ACPI_STATUS (status); | 194 | return_ACPI_STATUS(status); |
208 | } | 195 | } |
209 | EXPORT_SYMBOL(acpi_enable_event); | ||
210 | 196 | ||
197 | EXPORT_SYMBOL(acpi_enable_event); | ||
211 | 198 | ||
212 | /******************************************************************************* | 199 | /******************************************************************************* |
213 | * | 200 | * |
@@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
223 | * | 210 | * |
224 | ******************************************************************************/ | 211 | ******************************************************************************/ |
225 | 212 | ||
226 | acpi_status | 213 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) |
227 | acpi_set_gpe_type ( | ||
228 | acpi_handle gpe_device, | ||
229 | u32 gpe_number, | ||
230 | u8 type) | ||
231 | { | 214 | { |
232 | acpi_status status = AE_OK; | 215 | acpi_status status = AE_OK; |
233 | struct acpi_gpe_event_info *gpe_event_info; | 216 | struct acpi_gpe_event_info *gpe_event_info; |
234 | |||
235 | |||
236 | ACPI_FUNCTION_TRACE ("acpi_set_gpe_type"); | ||
237 | 217 | ||
218 | ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); | ||
238 | 219 | ||
239 | /* Ensure that we have a valid GPE number */ | 220 | /* Ensure that we have a valid GPE number */ |
240 | 221 | ||
241 | gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); | 222 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
242 | if (!gpe_event_info) { | 223 | if (!gpe_event_info) { |
243 | status = AE_BAD_PARAMETER; | 224 | status = AE_BAD_PARAMETER; |
244 | goto unlock_and_exit; | 225 | goto unlock_and_exit; |
245 | } | 226 | } |
246 | 227 | ||
247 | if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) { | 228 | if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) { |
248 | return_ACPI_STATUS (AE_OK); | 229 | return_ACPI_STATUS(AE_OK); |
249 | } | 230 | } |
250 | 231 | ||
251 | /* Set the new type (will disable GPE if currently enabled) */ | 232 | /* Set the new type (will disable GPE if currently enabled) */ |
252 | 233 | ||
253 | status = acpi_ev_set_gpe_type (gpe_event_info, type); | 234 | status = acpi_ev_set_gpe_type(gpe_event_info, type); |
254 | 235 | ||
255 | unlock_and_exit: | 236 | unlock_and_exit: |
256 | return_ACPI_STATUS (status); | 237 | return_ACPI_STATUS(status); |
257 | } | 238 | } |
258 | EXPORT_SYMBOL(acpi_set_gpe_type); | ||
259 | 239 | ||
240 | EXPORT_SYMBOL(acpi_set_gpe_type); | ||
260 | 241 | ||
261 | /******************************************************************************* | 242 | /******************************************************************************* |
262 | * | 243 | * |
@@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type); | |||
273 | * | 254 | * |
274 | ******************************************************************************/ | 255 | ******************************************************************************/ |
275 | 256 | ||
276 | acpi_status | 257 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
277 | acpi_enable_gpe ( | ||
278 | acpi_handle gpe_device, | ||
279 | u32 gpe_number, | ||
280 | u32 flags) | ||
281 | { | 258 | { |
282 | acpi_status status = AE_OK; | 259 | acpi_status status = AE_OK; |
283 | struct acpi_gpe_event_info *gpe_event_info; | 260 | struct acpi_gpe_event_info *gpe_event_info; |
284 | |||
285 | |||
286 | ACPI_FUNCTION_TRACE ("acpi_enable_gpe"); | ||
287 | 261 | ||
262 | ACPI_FUNCTION_TRACE("acpi_enable_gpe"); | ||
288 | 263 | ||
289 | /* Use semaphore lock if not executing at interrupt level */ | 264 | /* Use semaphore lock if not executing at interrupt level */ |
290 | 265 | ||
291 | if (flags & ACPI_NOT_ISR) { | 266 | if (flags & ACPI_NOT_ISR) { |
292 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | 267 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
293 | if (ACPI_FAILURE (status)) { | 268 | if (ACPI_FAILURE(status)) { |
294 | return_ACPI_STATUS (status); | 269 | return_ACPI_STATUS(status); |
295 | } | 270 | } |
296 | } | 271 | } |
297 | 272 | ||
298 | /* Ensure that we have a valid GPE number */ | 273 | /* Ensure that we have a valid GPE number */ |
299 | 274 | ||
300 | gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); | 275 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
301 | if (!gpe_event_info) { | 276 | if (!gpe_event_info) { |
302 | status = AE_BAD_PARAMETER; | 277 | status = AE_BAD_PARAMETER; |
303 | goto unlock_and_exit; | 278 | goto unlock_and_exit; |
@@ -305,16 +280,16 @@ acpi_enable_gpe ( | |||
305 | 280 | ||
306 | /* Perform the enable */ | 281 | /* Perform the enable */ |
307 | 282 | ||
308 | status = acpi_ev_enable_gpe (gpe_event_info, TRUE); | 283 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); |
309 | 284 | ||
310 | unlock_and_exit: | 285 | unlock_and_exit: |
311 | if (flags & ACPI_NOT_ISR) { | 286 | if (flags & ACPI_NOT_ISR) { |
312 | (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 287 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
313 | } | 288 | } |
314 | return_ACPI_STATUS (status); | 289 | return_ACPI_STATUS(status); |
315 | } | 290 | } |
316 | EXPORT_SYMBOL(acpi_enable_gpe); | ||
317 | 291 | ||
292 | EXPORT_SYMBOL(acpi_enable_gpe); | ||
318 | 293 | ||
319 | /******************************************************************************* | 294 | /******************************************************************************* |
320 | * | 295 | * |
@@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe); | |||
331 | * | 306 | * |
332 | ******************************************************************************/ | 307 | ******************************************************************************/ |
333 | 308 | ||
334 | acpi_status | 309 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
335 | acpi_disable_gpe ( | ||
336 | acpi_handle gpe_device, | ||
337 | u32 gpe_number, | ||
338 | u32 flags) | ||
339 | { | 310 | { |
340 | acpi_status status = AE_OK; | 311 | acpi_status status = AE_OK; |
341 | struct acpi_gpe_event_info *gpe_event_info; | 312 | struct acpi_gpe_event_info *gpe_event_info; |
342 | |||
343 | |||
344 | ACPI_FUNCTION_TRACE ("acpi_disable_gpe"); | ||
345 | 313 | ||
314 | ACPI_FUNCTION_TRACE("acpi_disable_gpe"); | ||
346 | 315 | ||
347 | /* Use semaphore lock if not executing at interrupt level */ | 316 | /* Use semaphore lock if not executing at interrupt level */ |
348 | 317 | ||
349 | if (flags & ACPI_NOT_ISR) { | 318 | if (flags & ACPI_NOT_ISR) { |
350 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | 319 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
351 | if (ACPI_FAILURE (status)) { | 320 | if (ACPI_FAILURE(status)) { |
352 | return_ACPI_STATUS (status); | 321 | return_ACPI_STATUS(status); |
353 | } | 322 | } |
354 | } | 323 | } |
355 | 324 | ||
356 | /* Ensure that we have a valid GPE number */ | 325 | /* Ensure that we have a valid GPE number */ |
357 | 326 | ||
358 | gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); | 327 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
359 | if (!gpe_event_info) { | 328 | if (!gpe_event_info) { |
360 | status = AE_BAD_PARAMETER; | 329 | status = AE_BAD_PARAMETER; |
361 | goto unlock_and_exit; | 330 | goto unlock_and_exit; |
362 | } | 331 | } |
363 | 332 | ||
364 | status = acpi_ev_disable_gpe (gpe_event_info); | 333 | status = acpi_ev_disable_gpe(gpe_event_info); |
365 | 334 | ||
366 | unlock_and_exit: | 335 | unlock_and_exit: |
367 | if (flags & ACPI_NOT_ISR) { | 336 | if (flags & ACPI_NOT_ISR) { |
368 | (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 337 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
369 | } | 338 | } |
370 | return_ACPI_STATUS (status); | 339 | return_ACPI_STATUS(status); |
371 | } | 340 | } |
372 | 341 | ||
373 | |||
374 | /******************************************************************************* | 342 | /******************************************************************************* |
375 | * | 343 | * |
376 | * FUNCTION: acpi_disable_event | 344 | * FUNCTION: acpi_disable_event |
@@ -384,50 +352,48 @@ unlock_and_exit: | |||
384 | * | 352 | * |
385 | ******************************************************************************/ | 353 | ******************************************************************************/ |
386 | 354 | ||
387 | acpi_status | 355 | acpi_status acpi_disable_event(u32 event, u32 flags) |
388 | acpi_disable_event ( | ||
389 | u32 event, | ||
390 | u32 flags) | ||
391 | { | 356 | { |
392 | acpi_status status = AE_OK; | 357 | acpi_status status = AE_OK; |
393 | u32 value; | 358 | u32 value; |
394 | |||
395 | |||
396 | ACPI_FUNCTION_TRACE ("acpi_disable_event"); | ||
397 | 359 | ||
360 | ACPI_FUNCTION_TRACE("acpi_disable_event"); | ||
398 | 361 | ||
399 | /* Decode the Fixed Event */ | 362 | /* Decode the Fixed Event */ |
400 | 363 | ||
401 | if (event > ACPI_EVENT_MAX) { | 364 | if (event > ACPI_EVENT_MAX) { |
402 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 365 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
403 | } | 366 | } |
404 | 367 | ||
405 | /* | 368 | /* |
406 | * Disable the requested fixed event (by writing a zero to the | 369 | * Disable the requested fixed event (by writing a zero to the |
407 | * enable register bit) | 370 | * enable register bit) |
408 | */ | 371 | */ |
409 | status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, | 372 | status = |
410 | 0, ACPI_MTX_LOCK); | 373 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
411 | if (ACPI_FAILURE (status)) { | 374 | enable_register_id, 0, ACPI_MTX_LOCK); |
412 | return_ACPI_STATUS (status); | 375 | if (ACPI_FAILURE(status)) { |
376 | return_ACPI_STATUS(status); | ||
413 | } | 377 | } |
414 | 378 | ||
415 | status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, | 379 | status = |
416 | &value, ACPI_MTX_LOCK); | 380 | acpi_get_register(acpi_gbl_fixed_event_info[event]. |
417 | if (ACPI_FAILURE (status)) { | 381 | enable_register_id, &value, ACPI_MTX_LOCK); |
418 | return_ACPI_STATUS (status); | 382 | if (ACPI_FAILURE(status)) { |
383 | return_ACPI_STATUS(status); | ||
419 | } | 384 | } |
420 | 385 | ||
421 | if (value != 0) { | 386 | if (value != 0) { |
422 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 387 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
423 | "Could not disable %s events\n", acpi_ut_get_event_name (event))); | 388 | "Could not disable %s events\n", |
424 | return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); | 389 | acpi_ut_get_event_name(event))); |
390 | return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); | ||
425 | } | 391 | } |
426 | 392 | ||
427 | return_ACPI_STATUS (status); | 393 | return_ACPI_STATUS(status); |
428 | } | 394 | } |
429 | EXPORT_SYMBOL(acpi_disable_event); | ||
430 | 395 | ||
396 | EXPORT_SYMBOL(acpi_disable_event); | ||
431 | 397 | ||
432 | /******************************************************************************* | 398 | /******************************************************************************* |
433 | * | 399 | * |
@@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event); | |||
441 | * | 407 | * |
442 | ******************************************************************************/ | 408 | ******************************************************************************/ |
443 | 409 | ||
444 | acpi_status | 410 | acpi_status acpi_clear_event(u32 event) |
445 | acpi_clear_event ( | ||
446 | u32 event) | ||
447 | { | 411 | { |
448 | acpi_status status = AE_OK; | 412 | acpi_status status = AE_OK; |
449 | |||
450 | |||
451 | ACPI_FUNCTION_TRACE ("acpi_clear_event"); | ||
452 | 413 | ||
414 | ACPI_FUNCTION_TRACE("acpi_clear_event"); | ||
453 | 415 | ||
454 | /* Decode the Fixed Event */ | 416 | /* Decode the Fixed Event */ |
455 | 417 | ||
456 | if (event > ACPI_EVENT_MAX) { | 418 | if (event > ACPI_EVENT_MAX) { |
457 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 419 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
458 | } | 420 | } |
459 | 421 | ||
460 | /* | 422 | /* |
461 | * Clear the requested fixed event (By writing a one to the | 423 | * Clear the requested fixed event (By writing a one to the |
462 | * status register bit) | 424 | * status register bit) |
463 | */ | 425 | */ |
464 | status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, | 426 | status = |
465 | 1, ACPI_MTX_LOCK); | 427 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
428 | status_register_id, 1, ACPI_MTX_LOCK); | ||
466 | 429 | ||
467 | return_ACPI_STATUS (status); | 430 | return_ACPI_STATUS(status); |
468 | } | 431 | } |
469 | EXPORT_SYMBOL(acpi_clear_event); | ||
470 | 432 | ||
433 | EXPORT_SYMBOL(acpi_clear_event); | ||
471 | 434 | ||
472 | /******************************************************************************* | 435 | /******************************************************************************* |
473 | * | 436 | * |
@@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event); | |||
483 | * | 446 | * |
484 | ******************************************************************************/ | 447 | ******************************************************************************/ |
485 | 448 | ||
486 | acpi_status | 449 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
487 | acpi_clear_gpe ( | ||
488 | acpi_handle gpe_device, | ||
489 | u32 gpe_number, | ||
490 | u32 flags) | ||
491 | { | 450 | { |
492 | acpi_status status = AE_OK; | 451 | acpi_status status = AE_OK; |
493 | struct acpi_gpe_event_info *gpe_event_info; | 452 | struct acpi_gpe_event_info *gpe_event_info; |
494 | |||
495 | |||
496 | ACPI_FUNCTION_TRACE ("acpi_clear_gpe"); | ||
497 | 453 | ||
454 | ACPI_FUNCTION_TRACE("acpi_clear_gpe"); | ||
498 | 455 | ||
499 | /* Use semaphore lock if not executing at interrupt level */ | 456 | /* Use semaphore lock if not executing at interrupt level */ |
500 | 457 | ||
501 | if (flags & ACPI_NOT_ISR) { | 458 | if (flags & ACPI_NOT_ISR) { |
502 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | 459 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
503 | if (ACPI_FAILURE (status)) { | 460 | if (ACPI_FAILURE(status)) { |
504 | return_ACPI_STATUS (status); | 461 | return_ACPI_STATUS(status); |
505 | } | 462 | } |
506 | } | 463 | } |
507 | 464 | ||
508 | /* Ensure that we have a valid GPE number */ | 465 | /* Ensure that we have a valid GPE number */ |
509 | 466 | ||
510 | gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); | 467 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
511 | if (!gpe_event_info) { | 468 | if (!gpe_event_info) { |
512 | status = AE_BAD_PARAMETER; | 469 | status = AE_BAD_PARAMETER; |
513 | goto unlock_and_exit; | 470 | goto unlock_and_exit; |
514 | } | 471 | } |
515 | 472 | ||
516 | status = acpi_hw_clear_gpe (gpe_event_info); | 473 | status = acpi_hw_clear_gpe(gpe_event_info); |
517 | 474 | ||
518 | unlock_and_exit: | 475 | unlock_and_exit: |
519 | if (flags & ACPI_NOT_ISR) { | 476 | if (flags & ACPI_NOT_ISR) { |
520 | (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 477 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
521 | } | 478 | } |
522 | return_ACPI_STATUS (status); | 479 | return_ACPI_STATUS(status); |
523 | } | 480 | } |
524 | 481 | ||
525 | |||
526 | #ifdef ACPI_FUTURE_USAGE | 482 | #ifdef ACPI_FUTURE_USAGE |
527 | /******************************************************************************* | 483 | /******************************************************************************* |
528 | * | 484 | * |
@@ -538,36 +494,31 @@ unlock_and_exit: | |||
538 | * | 494 | * |
539 | ******************************************************************************/ | 495 | ******************************************************************************/ |
540 | 496 | ||
541 | acpi_status | 497 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) |
542 | acpi_get_event_status ( | ||
543 | u32 event, | ||
544 | acpi_event_status *event_status) | ||
545 | { | 498 | { |
546 | acpi_status status = AE_OK; | 499 | acpi_status status = AE_OK; |
547 | |||
548 | |||
549 | ACPI_FUNCTION_TRACE ("acpi_get_event_status"); | ||
550 | 500 | ||
501 | ACPI_FUNCTION_TRACE("acpi_get_event_status"); | ||
551 | 502 | ||
552 | if (!event_status) { | 503 | if (!event_status) { |
553 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 504 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
554 | } | 505 | } |
555 | 506 | ||
556 | /* Decode the Fixed Event */ | 507 | /* Decode the Fixed Event */ |
557 | 508 | ||
558 | if (event > ACPI_EVENT_MAX) { | 509 | if (event > ACPI_EVENT_MAX) { |
559 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 510 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
560 | } | 511 | } |
561 | 512 | ||
562 | /* Get the status of the requested fixed event */ | 513 | /* Get the status of the requested fixed event */ |
563 | 514 | ||
564 | status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id, | 515 | status = |
565 | event_status, ACPI_MTX_LOCK); | 516 | acpi_get_register(acpi_gbl_fixed_event_info[event]. |
517 | status_register_id, event_status, ACPI_MTX_LOCK); | ||
566 | 518 | ||
567 | return_ACPI_STATUS (status); | 519 | return_ACPI_STATUS(status); |
568 | } | 520 | } |
569 | 521 | ||
570 | |||
571 | /******************************************************************************* | 522 | /******************************************************************************* |
572 | * | 523 | * |
573 | * FUNCTION: acpi_get_gpe_status | 524 | * FUNCTION: acpi_get_gpe_status |
@@ -585,31 +536,26 @@ acpi_get_event_status ( | |||
585 | ******************************************************************************/ | 536 | ******************************************************************************/ |
586 | 537 | ||
587 | acpi_status | 538 | acpi_status |
588 | acpi_get_gpe_status ( | 539 | acpi_get_gpe_status(acpi_handle gpe_device, |
589 | acpi_handle gpe_device, | 540 | u32 gpe_number, u32 flags, acpi_event_status * event_status) |
590 | u32 gpe_number, | ||
591 | u32 flags, | ||
592 | acpi_event_status *event_status) | ||
593 | { | 541 | { |
594 | acpi_status status = AE_OK; | 542 | acpi_status status = AE_OK; |
595 | struct acpi_gpe_event_info *gpe_event_info; | 543 | struct acpi_gpe_event_info *gpe_event_info; |
596 | |||
597 | |||
598 | ACPI_FUNCTION_TRACE ("acpi_get_gpe_status"); | ||
599 | 544 | ||
545 | ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); | ||
600 | 546 | ||
601 | /* Use semaphore lock if not executing at interrupt level */ | 547 | /* Use semaphore lock if not executing at interrupt level */ |
602 | 548 | ||
603 | if (flags & ACPI_NOT_ISR) { | 549 | if (flags & ACPI_NOT_ISR) { |
604 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | 550 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
605 | if (ACPI_FAILURE (status)) { | 551 | if (ACPI_FAILURE(status)) { |
606 | return_ACPI_STATUS (status); | 552 | return_ACPI_STATUS(status); |
607 | } | 553 | } |
608 | } | 554 | } |
609 | 555 | ||
610 | /* Ensure that we have a valid GPE number */ | 556 | /* Ensure that we have a valid GPE number */ |
611 | 557 | ||
612 | gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); | 558 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
613 | if (!gpe_event_info) { | 559 | if (!gpe_event_info) { |
614 | status = AE_BAD_PARAMETER; | 560 | status = AE_BAD_PARAMETER; |
615 | goto unlock_and_exit; | 561 | goto unlock_and_exit; |
@@ -617,16 +563,15 @@ acpi_get_gpe_status ( | |||
617 | 563 | ||
618 | /* Obtain status on the requested GPE number */ | 564 | /* Obtain status on the requested GPE number */ |
619 | 565 | ||
620 | status = acpi_hw_get_gpe_status (gpe_event_info, event_status); | 566 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); |
621 | 567 | ||
622 | unlock_and_exit: | 568 | unlock_and_exit: |
623 | if (flags & ACPI_NOT_ISR) { | 569 | if (flags & ACPI_NOT_ISR) { |
624 | (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 570 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
625 | } | 571 | } |
626 | return_ACPI_STATUS (status); | 572 | return_ACPI_STATUS(status); |
627 | } | 573 | } |
628 | #endif /* ACPI_FUTURE_USAGE */ | 574 | #endif /* ACPI_FUTURE_USAGE */ |
629 | |||
630 | 575 | ||
631 | /******************************************************************************* | 576 | /******************************************************************************* |
632 | * | 577 | * |
@@ -644,33 +589,27 @@ unlock_and_exit: | |||
644 | ******************************************************************************/ | 589 | ******************************************************************************/ |
645 | 590 | ||
646 | acpi_status | 591 | acpi_status |
647 | acpi_install_gpe_block ( | 592 | acpi_install_gpe_block(acpi_handle gpe_device, |
648 | acpi_handle gpe_device, | 593 | struct acpi_generic_address *gpe_block_address, |
649 | struct acpi_generic_address *gpe_block_address, | 594 | u32 register_count, u32 interrupt_number) |
650 | u32 register_count, | ||
651 | u32 interrupt_number) | ||
652 | { | 595 | { |
653 | acpi_status status; | 596 | acpi_status status; |
654 | union acpi_operand_object *obj_desc; | 597 | union acpi_operand_object *obj_desc; |
655 | struct acpi_namespace_node *node; | 598 | struct acpi_namespace_node *node; |
656 | struct acpi_gpe_block_info *gpe_block; | 599 | struct acpi_gpe_block_info *gpe_block; |
657 | |||
658 | 600 | ||
659 | ACPI_FUNCTION_TRACE ("acpi_install_gpe_block"); | 601 | ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); |
660 | 602 | ||
661 | 603 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { | |
662 | if ((!gpe_device) || | 604 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
663 | (!gpe_block_address) || | ||
664 | (!register_count)) { | ||
665 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
666 | } | 605 | } |
667 | 606 | ||
668 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 607 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
669 | if (ACPI_FAILURE (status)) { | 608 | if (ACPI_FAILURE(status)) { |
670 | return (status); | 609 | return (status); |
671 | } | 610 | } |
672 | 611 | ||
673 | node = acpi_ns_map_handle_to_node (gpe_device); | 612 | node = acpi_ns_map_handle_to_node(gpe_device); |
674 | if (!node) { | 613 | if (!node) { |
675 | status = AE_BAD_PARAMETER; | 614 | status = AE_BAD_PARAMETER; |
676 | goto unlock_and_exit; | 615 | goto unlock_and_exit; |
@@ -680,31 +619,33 @@ acpi_install_gpe_block ( | |||
680 | * For user-installed GPE Block Devices, the gpe_block_base_number | 619 | * For user-installed GPE Block Devices, the gpe_block_base_number |
681 | * is always zero | 620 | * is always zero |
682 | */ | 621 | */ |
683 | status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count, | 622 | status = |
684 | 0, interrupt_number, &gpe_block); | 623 | acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0, |
685 | if (ACPI_FAILURE (status)) { | 624 | interrupt_number, &gpe_block); |
625 | if (ACPI_FAILURE(status)) { | ||
686 | goto unlock_and_exit; | 626 | goto unlock_and_exit; |
687 | } | 627 | } |
688 | 628 | ||
689 | /* Get the device_object attached to the node */ | 629 | /* Get the device_object attached to the node */ |
690 | 630 | ||
691 | obj_desc = acpi_ns_get_attached_object (node); | 631 | obj_desc = acpi_ns_get_attached_object(node); |
692 | if (!obj_desc) { | 632 | if (!obj_desc) { |
693 | /* No object, create a new one */ | 633 | /* No object, create a new one */ |
694 | 634 | ||
695 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE); | 635 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); |
696 | if (!obj_desc) { | 636 | if (!obj_desc) { |
697 | status = AE_NO_MEMORY; | 637 | status = AE_NO_MEMORY; |
698 | goto unlock_and_exit; | 638 | goto unlock_and_exit; |
699 | } | 639 | } |
700 | 640 | ||
701 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE); | 641 | status = |
642 | acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE); | ||
702 | 643 | ||
703 | /* Remove local reference to the object */ | 644 | /* Remove local reference to the object */ |
704 | 645 | ||
705 | acpi_ut_remove_reference (obj_desc); | 646 | acpi_ut_remove_reference(obj_desc); |
706 | 647 | ||
707 | if (ACPI_FAILURE (status)) { | 648 | if (ACPI_FAILURE(status)) { |
708 | goto unlock_and_exit; | 649 | goto unlock_and_exit; |
709 | } | 650 | } |
710 | } | 651 | } |
@@ -713,13 +654,12 @@ acpi_install_gpe_block ( | |||
713 | 654 | ||
714 | obj_desc->device.gpe_block = gpe_block; | 655 | obj_desc->device.gpe_block = gpe_block; |
715 | 656 | ||
716 | 657 | unlock_and_exit: | |
717 | unlock_and_exit: | 658 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
718 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 659 | return_ACPI_STATUS(status); |
719 | return_ACPI_STATUS (status); | ||
720 | } | 660 | } |
721 | EXPORT_SYMBOL(acpi_install_gpe_block); | ||
722 | 661 | ||
662 | EXPORT_SYMBOL(acpi_install_gpe_block); | ||
723 | 663 | ||
724 | /******************************************************************************* | 664 | /******************************************************************************* |
725 | * | 665 | * |
@@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block); | |||
733 | * | 673 | * |
734 | ******************************************************************************/ | 674 | ******************************************************************************/ |
735 | 675 | ||
736 | acpi_status | 676 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) |
737 | acpi_remove_gpe_block ( | ||
738 | acpi_handle gpe_device) | ||
739 | { | 677 | { |
740 | union acpi_operand_object *obj_desc; | 678 | union acpi_operand_object *obj_desc; |
741 | acpi_status status; | 679 | acpi_status status; |
742 | struct acpi_namespace_node *node; | 680 | struct acpi_namespace_node *node; |
743 | |||
744 | |||
745 | ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block"); | ||
746 | 681 | ||
682 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); | ||
747 | 683 | ||
748 | if (!gpe_device) { | 684 | if (!gpe_device) { |
749 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 685 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
750 | } | 686 | } |
751 | 687 | ||
752 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 688 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
753 | if (ACPI_FAILURE (status)) { | 689 | if (ACPI_FAILURE(status)) { |
754 | return (status); | 690 | return (status); |
755 | } | 691 | } |
756 | 692 | ||
757 | node = acpi_ns_map_handle_to_node (gpe_device); | 693 | node = acpi_ns_map_handle_to_node(gpe_device); |
758 | if (!node) { | 694 | if (!node) { |
759 | status = AE_BAD_PARAMETER; | 695 | status = AE_BAD_PARAMETER; |
760 | goto unlock_and_exit; | 696 | goto unlock_and_exit; |
@@ -762,22 +698,21 @@ acpi_remove_gpe_block ( | |||
762 | 698 | ||
763 | /* Get the device_object attached to the node */ | 699 | /* Get the device_object attached to the node */ |
764 | 700 | ||
765 | obj_desc = acpi_ns_get_attached_object (node); | 701 | obj_desc = acpi_ns_get_attached_object(node); |
766 | if (!obj_desc || | 702 | if (!obj_desc || !obj_desc->device.gpe_block) { |
767 | !obj_desc->device.gpe_block) { | 703 | return_ACPI_STATUS(AE_NULL_OBJECT); |
768 | return_ACPI_STATUS (AE_NULL_OBJECT); | ||
769 | } | 704 | } |
770 | 705 | ||
771 | /* Delete the GPE block (but not the device_object) */ | 706 | /* Delete the GPE block (but not the device_object) */ |
772 | 707 | ||
773 | status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block); | 708 | status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block); |
774 | if (ACPI_SUCCESS (status)) { | 709 | if (ACPI_SUCCESS(status)) { |
775 | obj_desc->device.gpe_block = NULL; | 710 | obj_desc->device.gpe_block = NULL; |
776 | } | 711 | } |
777 | 712 | ||
778 | unlock_and_exit: | 713 | unlock_and_exit: |
779 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 714 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
780 | return_ACPI_STATUS (status); | 715 | return_ACPI_STATUS(status); |
781 | } | 716 | } |
782 | 717 | ||
783 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 718 | EXPORT_SYMBOL(acpi_remove_gpe_block); |