aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hardware/hwgpe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/hardware/hwgpe.c')
-rw-r--r--drivers/acpi/hardware/hwgpe.c197
1 files changed, 82 insertions, 115 deletions
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
index 3536bbb990c3..5c8e5dfd024e 100644
--- a/drivers/acpi/hardware/hwgpe.c
+++ b/drivers/acpi/hardware/hwgpe.c
@@ -46,15 +46,12 @@
46#include <acpi/acevents.h> 46#include <acpi/acevents.h>
47 47
48#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
49 ACPI_MODULE_NAME ("hwgpe") 49ACPI_MODULE_NAME("hwgpe")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52
53static acpi_status 52static acpi_status
54acpi_hw_enable_wakeup_gpe_block ( 53acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
55 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 54 struct acpi_gpe_block_info *gpe_block);
56 struct acpi_gpe_block_info *gpe_block);
57
58 55
59/****************************************************************************** 56/******************************************************************************
60 * 57 *
@@ -71,15 +68,12 @@ acpi_hw_enable_wakeup_gpe_block (
71 ******************************************************************************/ 68 ******************************************************************************/
72 69
73acpi_status 70acpi_status
74acpi_hw_write_gpe_enable_reg ( 71acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
75 struct acpi_gpe_event_info *gpe_event_info)
76{ 72{
77 struct acpi_gpe_register_info *gpe_register_info; 73 struct acpi_gpe_register_info *gpe_register_info;
78 acpi_status status; 74 acpi_status status;
79
80
81 ACPI_FUNCTION_ENTRY ();
82 75
76 ACPI_FUNCTION_ENTRY();
83 77
84 /* Get the info block for the entire GPE register */ 78 /* Get the info block for the entire GPE register */
85 79
@@ -90,13 +84,12 @@ acpi_hw_write_gpe_enable_reg (
90 84
91 /* Write the entire GPE (runtime) enable register */ 85 /* Write the entire GPE (runtime) enable register */
92 86
93 status = acpi_hw_low_level_write (8, gpe_register_info->enable_for_run, 87 status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
94 &gpe_register_info->enable_address); 88 &gpe_register_info->enable_address);
95 89
96 return (status); 90 return (status);
97} 91}
98 92
99
100/****************************************************************************** 93/******************************************************************************
101 * 94 *
102 * FUNCTION: acpi_hw_clear_gpe 95 * FUNCTION: acpi_hw_clear_gpe
@@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg (
109 * 102 *
110 ******************************************************************************/ 103 ******************************************************************************/
111 104
112acpi_status 105acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
113acpi_hw_clear_gpe (
114 struct acpi_gpe_event_info *gpe_event_info)
115{ 106{
116 acpi_status status; 107 acpi_status status;
117
118
119 ACPI_FUNCTION_ENTRY ();
120 108
109 ACPI_FUNCTION_ENTRY();
121 110
122 /* 111 /*
123 * Write a one to the appropriate bit in the status register to 112 * Write a one to the appropriate bit in the status register to
124 * clear this GPE. 113 * clear this GPE.
125 */ 114 */
126 status = acpi_hw_low_level_write (8, gpe_event_info->register_bit, 115 status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
127 &gpe_event_info->register_info->status_address); 116 &gpe_event_info->register_info->
117 status_address);
128 118
129 return (status); 119 return (status);
130} 120}
131 121
132
133/****************************************************************************** 122/******************************************************************************
134 * 123 *
135 * FUNCTION: acpi_hw_get_gpe_status 124 * FUNCTION: acpi_hw_get_gpe_status
@@ -145,19 +134,16 @@ acpi_hw_clear_gpe (
145 134
146#ifdef ACPI_FUTURE_USAGE 135#ifdef ACPI_FUTURE_USAGE
147acpi_status 136acpi_status
148acpi_hw_get_gpe_status ( 137acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
149 struct acpi_gpe_event_info *gpe_event_info, 138 acpi_event_status * event_status)
150 acpi_event_status *event_status)
151{ 139{
152 u32 in_byte; 140 u32 in_byte;
153 u8 register_bit; 141 u8 register_bit;
154 struct acpi_gpe_register_info *gpe_register_info; 142 struct acpi_gpe_register_info *gpe_register_info;
155 acpi_status status; 143 acpi_status status;
156 acpi_event_status local_event_status = 0; 144 acpi_event_status local_event_status = 0;
157
158
159 ACPI_FUNCTION_ENTRY ();
160 145
146 ACPI_FUNCTION_ENTRY();
161 147
162 if (!event_status) { 148 if (!event_status) {
163 return (AE_BAD_PARAMETER); 149 return (AE_BAD_PARAMETER);
@@ -185,8 +171,10 @@ acpi_hw_get_gpe_status (
185 171
186 /* GPE currently active (status bit == 1)? */ 172 /* GPE currently active (status bit == 1)? */
187 173
188 status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address); 174 status =
189 if (ACPI_FAILURE (status)) { 175 acpi_hw_low_level_read(8, &in_byte,
176 &gpe_register_info->status_address);
177 if (ACPI_FAILURE(status)) {
190 goto unlock_and_exit; 178 goto unlock_and_exit;
191 } 179 }
192 180
@@ -198,12 +186,10 @@ acpi_hw_get_gpe_status (
198 186
199 (*event_status) = local_event_status; 187 (*event_status) = local_event_status;
200 188
201 189 unlock_and_exit:
202unlock_and_exit:
203 return (status); 190 return (status);
204} 191}
205#endif /* ACPI_FUTURE_USAGE */ 192#endif /* ACPI_FUTURE_USAGE */
206
207 193
208/****************************************************************************** 194/******************************************************************************
209 * 195 *
@@ -219,22 +205,21 @@ unlock_and_exit:
219 ******************************************************************************/ 205 ******************************************************************************/
220 206
221acpi_status 207acpi_status
222acpi_hw_disable_gpe_block ( 208acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
223 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 209 struct acpi_gpe_block_info * gpe_block)
224 struct acpi_gpe_block_info *gpe_block)
225{ 210{
226 u32 i; 211 u32 i;
227 acpi_status status; 212 acpi_status status;
228
229 213
230 /* Examine each GPE Register within the block */ 214 /* Examine each GPE Register within the block */
231 215
232 for (i = 0; i < gpe_block->register_count; i++) { 216 for (i = 0; i < gpe_block->register_count; i++) {
233 /* Disable all GPEs in this register */ 217 /* Disable all GPEs in this register */
234 218
235 status = acpi_hw_low_level_write (8, 0x00, 219 status = acpi_hw_low_level_write(8, 0x00,
236 &gpe_block->register_info[i].enable_address); 220 &gpe_block->register_info[i].
237 if (ACPI_FAILURE (status)) { 221 enable_address);
222 if (ACPI_FAILURE(status)) {
238 return (status); 223 return (status);
239 } 224 }
240 } 225 }
@@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block (
242 return (AE_OK); 227 return (AE_OK);
243} 228}
244 229
245
246/****************************************************************************** 230/******************************************************************************
247 * 231 *
248 * FUNCTION: acpi_hw_clear_gpe_block 232 * FUNCTION: acpi_hw_clear_gpe_block
@@ -257,22 +241,21 @@ acpi_hw_disable_gpe_block (
257 ******************************************************************************/ 241 ******************************************************************************/
258 242
259acpi_status 243acpi_status
260acpi_hw_clear_gpe_block ( 244acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
261 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 245 struct acpi_gpe_block_info * gpe_block)
262 struct acpi_gpe_block_info *gpe_block)
263{ 246{
264 u32 i; 247 u32 i;
265 acpi_status status; 248 acpi_status status;
266
267 249
268 /* Examine each GPE Register within the block */ 250 /* Examine each GPE Register within the block */
269 251
270 for (i = 0; i < gpe_block->register_count; i++) { 252 for (i = 0; i < gpe_block->register_count; i++) {
271 /* Clear status on all GPEs in this register */ 253 /* Clear status on all GPEs in this register */
272 254
273 status = acpi_hw_low_level_write (8, 0xFF, 255 status = acpi_hw_low_level_write(8, 0xFF,
274 &gpe_block->register_info[i].status_address); 256 &gpe_block->register_info[i].
275 if (ACPI_FAILURE (status)) { 257 status_address);
258 if (ACPI_FAILURE(status)) {
276 return (status); 259 return (status);
277 } 260 }
278 } 261 }
@@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block (
280 return (AE_OK); 263 return (AE_OK);
281} 264}
282 265
283
284/****************************************************************************** 266/******************************************************************************
285 * 267 *
286 * FUNCTION: acpi_hw_enable_runtime_gpe_block 268 * FUNCTION: acpi_hw_enable_runtime_gpe_block
@@ -296,13 +278,11 @@ acpi_hw_clear_gpe_block (
296 ******************************************************************************/ 278 ******************************************************************************/
297 279
298acpi_status 280acpi_status
299acpi_hw_enable_runtime_gpe_block ( 281acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
300 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 282 struct acpi_gpe_block_info * gpe_block)
301 struct acpi_gpe_block_info *gpe_block)
302{ 283{
303 u32 i; 284 u32 i;
304 acpi_status status; 285 acpi_status status;
305
306 286
307 /* NOTE: assumes that all GPEs are currently disabled */ 287 /* NOTE: assumes that all GPEs are currently disabled */
308 288
@@ -315,9 +295,13 @@ acpi_hw_enable_runtime_gpe_block (
315 295
316 /* Enable all "runtime" GPEs in this register */ 296 /* Enable all "runtime" GPEs in this register */
317 297
318 status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run, 298 status =
319 &gpe_block->register_info[i].enable_address); 299 acpi_hw_low_level_write(8,
320 if (ACPI_FAILURE (status)) { 300 gpe_block->register_info[i].
301 enable_for_run,
302 &gpe_block->register_info[i].
303 enable_address);
304 if (ACPI_FAILURE(status)) {
321 return (status); 305 return (status);
322 } 306 }
323 } 307 }
@@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block (
325 return (AE_OK); 309 return (AE_OK);
326} 310}
327 311
328
329/****************************************************************************** 312/******************************************************************************
330 * 313 *
331 * FUNCTION: acpi_hw_enable_wakeup_gpe_block 314 * FUNCTION: acpi_hw_enable_wakeup_gpe_block
@@ -341,13 +324,11 @@ acpi_hw_enable_runtime_gpe_block (
341 ******************************************************************************/ 324 ******************************************************************************/
342 325
343static acpi_status 326static acpi_status
344acpi_hw_enable_wakeup_gpe_block ( 327acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
345 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 328 struct acpi_gpe_block_info *gpe_block)
346 struct acpi_gpe_block_info *gpe_block)
347{ 329{
348 u32 i; 330 u32 i;
349 acpi_status status; 331 acpi_status status;
350
351 332
352 /* Examine each GPE Register within the block */ 333 /* Examine each GPE Register within the block */
353 334
@@ -358,10 +339,12 @@ acpi_hw_enable_wakeup_gpe_block (
358 339
359 /* Enable all "wake" GPEs in this register */ 340 /* Enable all "wake" GPEs in this register */
360 341
361 status = acpi_hw_low_level_write (8, 342 status = acpi_hw_low_level_write(8,
362 gpe_block->register_info[i].enable_for_wake, 343 gpe_block->register_info[i].
363 &gpe_block->register_info[i].enable_address); 344 enable_for_wake,
364 if (ACPI_FAILURE (status)) { 345 &gpe_block->register_info[i].
346 enable_address);
347 if (ACPI_FAILURE(status)) {
365 return (status); 348 return (status);
366 } 349 }
367 } 350 }
@@ -369,7 +352,6 @@ acpi_hw_enable_wakeup_gpe_block (
369 return (AE_OK); 352 return (AE_OK);
370} 353}
371 354
372
373/****************************************************************************** 355/******************************************************************************
374 * 356 *
375 * FUNCTION: acpi_hw_disable_all_gpes 357 * FUNCTION: acpi_hw_disable_all_gpes
@@ -382,22 +364,17 @@ acpi_hw_enable_wakeup_gpe_block (
382 * 364 *
383 ******************************************************************************/ 365 ******************************************************************************/
384 366
385acpi_status 367acpi_status acpi_hw_disable_all_gpes(void)
386acpi_hw_disable_all_gpes (
387 void)
388{ 368{
389 acpi_status status; 369 acpi_status status;
390
391 370
392 ACPI_FUNCTION_TRACE ("hw_disable_all_gpes"); 371 ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
393 372
394 373 status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
395 status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); 374 status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
396 status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); 375 return_ACPI_STATUS(status);
397 return_ACPI_STATUS (status);
398} 376}
399 377
400
401/****************************************************************************** 378/******************************************************************************
402 * 379 *
403 * FUNCTION: acpi_hw_enable_all_runtime_gpes 380 * FUNCTION: acpi_hw_enable_all_runtime_gpes
@@ -410,21 +387,16 @@ acpi_hw_disable_all_gpes (
410 * 387 *
411 ******************************************************************************/ 388 ******************************************************************************/
412 389
413acpi_status 390acpi_status acpi_hw_enable_all_runtime_gpes(void)
414acpi_hw_enable_all_runtime_gpes (
415 void)
416{ 391{
417 acpi_status status; 392 acpi_status status;
418
419 393
420 ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes"); 394 ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
421 395
422 396 status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
423 status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block); 397 return_ACPI_STATUS(status);
424 return_ACPI_STATUS (status);
425} 398}
426 399
427
428/****************************************************************************** 400/******************************************************************************
429 * 401 *
430 * FUNCTION: acpi_hw_enable_all_wakeup_gpes 402 * FUNCTION: acpi_hw_enable_all_wakeup_gpes
@@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes (
437 * 409 *
438 ******************************************************************************/ 410 ******************************************************************************/
439 411
440acpi_status 412acpi_status acpi_hw_enable_all_wakeup_gpes(void)
441acpi_hw_enable_all_wakeup_gpes (
442 void)
443{ 413{
444 acpi_status status; 414 acpi_status status;
445
446 415
447 ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes"); 416 ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
448 417
449 418 status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
450 status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block); 419 return_ACPI_STATUS(status);
451 return_ACPI_STATUS (status);
452} 420}
453