diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/events/evgpeblk.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events/evgpeblk.c')
-rw-r--r-- | drivers/acpi/events/evgpeblk.c | 756 |
1 files changed, 357 insertions, 399 deletions
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index dfc54692b127..b312eb33c43e 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -46,41 +46,29 @@ | |||
46 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
47 | 47 | ||
48 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME ("evgpeblk") | 49 | ACPI_MODULE_NAME("evgpeblk") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | |||
53 | static acpi_status | 52 | static acpi_status |
54 | acpi_ev_save_method_info ( | 53 | acpi_ev_save_method_info(acpi_handle obj_handle, |
55 | acpi_handle obj_handle, | 54 | u32 level, void *obj_desc, void **return_value); |
56 | u32 level, | ||
57 | void *obj_desc, | ||
58 | void **return_value); | ||
59 | 55 | ||
60 | static acpi_status | 56 | static acpi_status |
61 | acpi_ev_match_prw_and_gpe ( | 57 | acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, |
62 | acpi_handle obj_handle, | 58 | u32 level, void *info, void **return_value); |
63 | u32 level, | ||
64 | void *info, | ||
65 | void **return_value); | ||
66 | 59 | ||
67 | static struct acpi_gpe_xrupt_info * | 60 | static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 |
68 | acpi_ev_get_gpe_xrupt_block ( | 61 | interrupt_number); |
69 | u32 interrupt_number); | ||
70 | 62 | ||
71 | static acpi_status | 63 | static acpi_status |
72 | acpi_ev_delete_gpe_xrupt ( | 64 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt); |
73 | struct acpi_gpe_xrupt_info *gpe_xrupt); | ||
74 | 65 | ||
75 | static acpi_status | 66 | static acpi_status |
76 | acpi_ev_install_gpe_block ( | 67 | acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, |
77 | struct acpi_gpe_block_info *gpe_block, | 68 | u32 interrupt_number); |
78 | u32 interrupt_number); | ||
79 | 69 | ||
80 | static acpi_status | 70 | static acpi_status |
81 | acpi_ev_create_gpe_info_blocks ( | 71 | acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); |
82 | struct acpi_gpe_block_info *gpe_block); | ||
83 | |||
84 | 72 | ||
85 | /******************************************************************************* | 73 | /******************************************************************************* |
86 | * | 74 | * |
@@ -96,16 +84,12 @@ acpi_ev_create_gpe_info_blocks ( | |||
96 | * | 84 | * |
97 | ******************************************************************************/ | 85 | ******************************************************************************/ |
98 | 86 | ||
99 | u8 | 87 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) |
100 | acpi_ev_valid_gpe_event ( | ||
101 | struct acpi_gpe_event_info *gpe_event_info) | ||
102 | { | 88 | { |
103 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; | 89 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; |
104 | struct acpi_gpe_block_info *gpe_block; | 90 | struct acpi_gpe_block_info *gpe_block; |
105 | |||
106 | |||
107 | ACPI_FUNCTION_ENTRY (); | ||
108 | 91 | ||
92 | ACPI_FUNCTION_ENTRY(); | ||
109 | 93 | ||
110 | /* No need for spin lock since we are not changing any list elements */ | 94 | /* No need for spin lock since we are not changing any list elements */ |
111 | 95 | ||
@@ -119,7 +103,10 @@ acpi_ev_valid_gpe_event ( | |||
119 | 103 | ||
120 | while (gpe_block) { | 104 | while (gpe_block) { |
121 | if ((&gpe_block->event_info[0] <= gpe_event_info) && | 105 | if ((&gpe_block->event_info[0] <= gpe_event_info) && |
122 | (&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) { | 106 | (&gpe_block-> |
107 | event_info[((acpi_size) gpe_block-> | ||
108 | register_count) * 8] > | ||
109 | gpe_event_info)) { | ||
123 | return (TRUE); | 110 | return (TRUE); |
124 | } | 111 | } |
125 | 112 | ||
@@ -132,7 +119,6 @@ acpi_ev_valid_gpe_event ( | |||
132 | return (FALSE); | 119 | return (FALSE); |
133 | } | 120 | } |
134 | 121 | ||
135 | |||
136 | /******************************************************************************* | 122 | /******************************************************************************* |
137 | * | 123 | * |
138 | * FUNCTION: acpi_ev_walk_gpe_list | 124 | * FUNCTION: acpi_ev_walk_gpe_list |
@@ -145,20 +131,16 @@ acpi_ev_valid_gpe_event ( | |||
145 | * | 131 | * |
146 | ******************************************************************************/ | 132 | ******************************************************************************/ |
147 | 133 | ||
148 | acpi_status | 134 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) |
149 | acpi_ev_walk_gpe_list ( | ||
150 | ACPI_GPE_CALLBACK gpe_walk_callback) | ||
151 | { | 135 | { |
152 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
153 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
154 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
155 | u32 flags; | 139 | u32 flags; |
156 | |||
157 | 140 | ||
158 | ACPI_FUNCTION_TRACE ("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); |
159 | 142 | ||
160 | 143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | |
161 | flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); | ||
162 | 144 | ||
163 | /* Walk the interrupt level descriptor list */ | 145 | /* Walk the interrupt level descriptor list */ |
164 | 146 | ||
@@ -170,8 +152,8 @@ acpi_ev_walk_gpe_list ( | |||
170 | while (gpe_block) { | 152 | while (gpe_block) { |
171 | /* One callback per GPE block */ | 153 | /* One callback per GPE block */ |
172 | 154 | ||
173 | status = gpe_walk_callback (gpe_xrupt_info, gpe_block); | 155 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); |
174 | if (ACPI_FAILURE (status)) { | 156 | if (ACPI_FAILURE(status)) { |
175 | goto unlock_and_exit; | 157 | goto unlock_and_exit; |
176 | } | 158 | } |
177 | 159 | ||
@@ -181,12 +163,11 @@ acpi_ev_walk_gpe_list ( | |||
181 | gpe_xrupt_info = gpe_xrupt_info->next; | 163 | gpe_xrupt_info = gpe_xrupt_info->next; |
182 | } | 164 | } |
183 | 165 | ||
184 | unlock_and_exit: | 166 | unlock_and_exit: |
185 | acpi_os_release_lock (acpi_gbl_gpe_lock, flags); | 167 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
186 | return_ACPI_STATUS (status); | 168 | return_ACPI_STATUS(status); |
187 | } | 169 | } |
188 | 170 | ||
189 | |||
190 | /******************************************************************************* | 171 | /******************************************************************************* |
191 | * | 172 | * |
192 | * FUNCTION: acpi_ev_delete_gpe_handlers | 173 | * FUNCTION: acpi_ev_delete_gpe_handlers |
@@ -202,17 +183,14 @@ unlock_and_exit: | |||
202 | ******************************************************************************/ | 183 | ******************************************************************************/ |
203 | 184 | ||
204 | acpi_status | 185 | acpi_status |
205 | acpi_ev_delete_gpe_handlers ( | 186 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
206 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 187 | struct acpi_gpe_block_info *gpe_block) |
207 | struct acpi_gpe_block_info *gpe_block) | ||
208 | { | 188 | { |
209 | struct acpi_gpe_event_info *gpe_event_info; | 189 | struct acpi_gpe_event_info *gpe_event_info; |
210 | acpi_native_uint i; | 190 | acpi_native_uint i; |
211 | acpi_native_uint j; | 191 | acpi_native_uint j; |
212 | |||
213 | |||
214 | ACPI_FUNCTION_TRACE ("ev_delete_gpe_handlers"); | ||
215 | 192 | ||
193 | ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); | ||
216 | 194 | ||
217 | /* Examine each GPE Register within the block */ | 195 | /* Examine each GPE Register within the block */ |
218 | 196 | ||
@@ -220,21 +198,23 @@ acpi_ev_delete_gpe_handlers ( | |||
220 | /* Now look at the individual GPEs in this byte register */ | 198 | /* Now look at the individual GPEs in this byte register */ |
221 | 199 | ||
222 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 200 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
223 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 201 | gpe_event_info = |
202 | &gpe_block-> | ||
203 | event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | ||
224 | 204 | ||
225 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 205 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
226 | ACPI_GPE_DISPATCH_HANDLER) { | 206 | ACPI_GPE_DISPATCH_HANDLER) { |
227 | ACPI_MEM_FREE (gpe_event_info->dispatch.handler); | 207 | ACPI_MEM_FREE(gpe_event_info->dispatch.handler); |
228 | gpe_event_info->dispatch.handler = NULL; | 208 | gpe_event_info->dispatch.handler = NULL; |
229 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; | 209 | gpe_event_info->flags &= |
210 | ~ACPI_GPE_DISPATCH_MASK; | ||
230 | } | 211 | } |
231 | } | 212 | } |
232 | } | 213 | } |
233 | 214 | ||
234 | return_ACPI_STATUS (AE_OK); | 215 | return_ACPI_STATUS(AE_OK); |
235 | } | 216 | } |
236 | 217 | ||
237 | |||
238 | /******************************************************************************* | 218 | /******************************************************************************* |
239 | * | 219 | * |
240 | * FUNCTION: acpi_ev_save_method_info | 220 | * FUNCTION: acpi_ev_save_method_info |
@@ -258,30 +238,26 @@ acpi_ev_delete_gpe_handlers ( | |||
258 | ******************************************************************************/ | 238 | ******************************************************************************/ |
259 | 239 | ||
260 | static acpi_status | 240 | static acpi_status |
261 | acpi_ev_save_method_info ( | 241 | acpi_ev_save_method_info(acpi_handle obj_handle, |
262 | acpi_handle obj_handle, | 242 | u32 level, void *obj_desc, void **return_value) |
263 | u32 level, | ||
264 | void *obj_desc, | ||
265 | void **return_value) | ||
266 | { | 243 | { |
267 | struct acpi_gpe_block_info *gpe_block = (void *) obj_desc; | 244 | struct acpi_gpe_block_info *gpe_block = (void *)obj_desc; |
268 | struct acpi_gpe_event_info *gpe_event_info; | 245 | struct acpi_gpe_event_info *gpe_event_info; |
269 | u32 gpe_number; | 246 | u32 gpe_number; |
270 | char name[ACPI_NAME_SIZE + 1]; | 247 | char name[ACPI_NAME_SIZE + 1]; |
271 | u8 type; | 248 | u8 type; |
272 | acpi_status status; | 249 | acpi_status status; |
273 | |||
274 | |||
275 | ACPI_FUNCTION_TRACE ("ev_save_method_info"); | ||
276 | 250 | ||
251 | ACPI_FUNCTION_TRACE("ev_save_method_info"); | ||
277 | 252 | ||
278 | /* | 253 | /* |
279 | * _Lxx and _Exx GPE method support | 254 | * _Lxx and _Exx GPE method support |
280 | * | 255 | * |
281 | * 1) Extract the name from the object and convert to a string | 256 | * 1) Extract the name from the object and convert to a string |
282 | */ | 257 | */ |
283 | ACPI_MOVE_32_TO_32 (name, | 258 | ACPI_MOVE_32_TO_32(name, |
284 | &((struct acpi_namespace_node *) obj_handle)->name.integer); | 259 | &((struct acpi_namespace_node *)obj_handle)->name. |
260 | integer); | ||
285 | name[ACPI_NAME_SIZE] = 0; | 261 | name[ACPI_NAME_SIZE] = 0; |
286 | 262 | ||
287 | /* | 263 | /* |
@@ -303,34 +279,36 @@ acpi_ev_save_method_info ( | |||
303 | default: | 279 | default: |
304 | /* Unknown method type, just ignore it! */ | 280 | /* Unknown method type, just ignore it! */ |
305 | 281 | ||
306 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 282 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
307 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", | 283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", |
308 | name)); | 284 | name)); |
309 | return_ACPI_STATUS (AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
310 | } | 286 | } |
311 | 287 | ||
312 | /* Convert the last two characters of the name to the GPE Number */ | 288 | /* Convert the last two characters of the name to the GPE Number */ |
313 | 289 | ||
314 | gpe_number = ACPI_STRTOUL (&name[2], NULL, 16); | 290 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); |
315 | if (gpe_number == ACPI_UINT32_MAX) { | 291 | if (gpe_number == ACPI_UINT32_MAX) { |
316 | /* Conversion failed; invalid method, just ignore it */ | 292 | /* Conversion failed; invalid method, just ignore it */ |
317 | 293 | ||
318 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 294 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
319 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", | 295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", |
320 | name)); | 296 | name)); |
321 | return_ACPI_STATUS (AE_OK); | 297 | return_ACPI_STATUS(AE_OK); |
322 | } | 298 | } |
323 | 299 | ||
324 | /* Ensure that we have a valid GPE number for this GPE block */ | 300 | /* Ensure that we have a valid GPE number for this GPE block */ |
325 | 301 | ||
326 | if ((gpe_number < gpe_block->block_base_number) || | 302 | if ((gpe_number < gpe_block->block_base_number) || |
327 | (gpe_number >= (gpe_block->block_base_number + (gpe_block->register_count * 8)))) { | 303 | (gpe_number >= |
304 | (gpe_block->block_base_number + | ||
305 | (gpe_block->register_count * 8)))) { | ||
328 | /* | 306 | /* |
329 | * Not valid for this GPE block, just ignore it | 307 | * Not valid for this GPE block, just ignore it |
330 | * However, it may be valid for a different GPE block, since GPE0 and GPE1 | 308 | * However, it may be valid for a different GPE block, since GPE0 and GPE1 |
331 | * methods both appear under \_GPE. | 309 | * methods both appear under \_GPE. |
332 | */ | 310 | */ |
333 | return_ACPI_STATUS (AE_OK); | 311 | return_ACPI_STATUS(AE_OK); |
334 | } | 312 | } |
335 | 313 | ||
336 | /* | 314 | /* |
@@ -338,24 +316,25 @@ acpi_ev_save_method_info ( | |||
338 | * for use during dispatch of this GPE. Default type is RUNTIME, although | 316 | * for use during dispatch of this GPE. Default type is RUNTIME, although |
339 | * this may change when the _PRW methods are executed later. | 317 | * this may change when the _PRW methods are executed later. |
340 | */ | 318 | */ |
341 | gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 319 | gpe_event_info = |
320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | ||
342 | 321 | ||
343 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | | 322 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | |
344 | ACPI_GPE_TYPE_RUNTIME); | 323 | ACPI_GPE_TYPE_RUNTIME); |
345 | 324 | ||
346 | gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *) obj_handle; | 325 | gpe_event_info->dispatch.method_node = |
326 | (struct acpi_namespace_node *)obj_handle; | ||
347 | 327 | ||
348 | /* Update enable mask, but don't enable the HW GPE as of yet */ | 328 | /* Update enable mask, but don't enable the HW GPE as of yet */ |
349 | 329 | ||
350 | status = acpi_ev_enable_gpe (gpe_event_info, FALSE); | 330 | status = acpi_ev_enable_gpe(gpe_event_info, FALSE); |
351 | 331 | ||
352 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, | 332 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
353 | "Registered GPE method %s as GPE number 0x%.2X\n", | 333 | "Registered GPE method %s as GPE number 0x%.2X\n", |
354 | name, gpe_number)); | 334 | name, gpe_number)); |
355 | return_ACPI_STATUS (status); | 335 | return_ACPI_STATUS(status); |
356 | } | 336 | } |
357 | 337 | ||
358 | |||
359 | /******************************************************************************* | 338 | /******************************************************************************* |
360 | * | 339 | * |
361 | * FUNCTION: acpi_ev_match_prw_and_gpe | 340 | * FUNCTION: acpi_ev_match_prw_and_gpe |
@@ -372,34 +351,29 @@ acpi_ev_save_method_info ( | |||
372 | ******************************************************************************/ | 351 | ******************************************************************************/ |
373 | 352 | ||
374 | static acpi_status | 353 | static acpi_status |
375 | acpi_ev_match_prw_and_gpe ( | 354 | acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, |
376 | acpi_handle obj_handle, | 355 | u32 level, void *info, void **return_value) |
377 | u32 level, | ||
378 | void *info, | ||
379 | void **return_value) | ||
380 | { | 356 | { |
381 | struct acpi_gpe_walk_info *gpe_info = (void *) info; | 357 | struct acpi_gpe_walk_info *gpe_info = (void *)info; |
382 | struct acpi_namespace_node *gpe_device; | 358 | struct acpi_namespace_node *gpe_device; |
383 | struct acpi_gpe_block_info *gpe_block; | 359 | struct acpi_gpe_block_info *gpe_block; |
384 | struct acpi_namespace_node *target_gpe_device; | 360 | struct acpi_namespace_node *target_gpe_device; |
385 | struct acpi_gpe_event_info *gpe_event_info; | 361 | struct acpi_gpe_event_info *gpe_event_info; |
386 | union acpi_operand_object *pkg_desc; | 362 | union acpi_operand_object *pkg_desc; |
387 | union acpi_operand_object *obj_desc; | 363 | union acpi_operand_object *obj_desc; |
388 | u32 gpe_number; | 364 | u32 gpe_number; |
389 | acpi_status status; | 365 | acpi_status status; |
390 | 366 | ||
391 | 367 | ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); | |
392 | ACPI_FUNCTION_TRACE ("ev_match_prw_and_gpe"); | ||
393 | |||
394 | 368 | ||
395 | /* Check for a _PRW method under this device */ | 369 | /* Check for a _PRW method under this device */ |
396 | 370 | ||
397 | status = acpi_ut_evaluate_object (obj_handle, METHOD_NAME__PRW, | 371 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, |
398 | ACPI_BTYPE_PACKAGE, &pkg_desc); | 372 | ACPI_BTYPE_PACKAGE, &pkg_desc); |
399 | if (ACPI_FAILURE (status)) { | 373 | if (ACPI_FAILURE(status)) { |
400 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ | 374 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ |
401 | 375 | ||
402 | return_ACPI_STATUS (AE_OK); | 376 | return_ACPI_STATUS(AE_OK); |
403 | } | 377 | } |
404 | 378 | ||
405 | /* The returned _PRW package must have at least two elements */ | 379 | /* The returned _PRW package must have at least two elements */ |
@@ -419,7 +393,7 @@ acpi_ev_match_prw_and_gpe ( | |||
419 | */ | 393 | */ |
420 | obj_desc = pkg_desc->package.elements[0]; | 394 | obj_desc = pkg_desc->package.elements[0]; |
421 | 395 | ||
422 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 396 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
423 | /* Use FADT-defined GPE device (from definition of _PRW) */ | 397 | /* Use FADT-defined GPE device (from definition of _PRW) */ |
424 | 398 | ||
425 | target_gpe_device = acpi_gbl_fadt_gpe_device; | 399 | target_gpe_device = acpi_gbl_fadt_gpe_device; |
@@ -427,22 +401,23 @@ acpi_ev_match_prw_and_gpe ( | |||
427 | /* Integer is the GPE number in the FADT described GPE blocks */ | 401 | /* Integer is the GPE number in the FADT described GPE blocks */ |
428 | 402 | ||
429 | gpe_number = (u32) obj_desc->integer.value; | 403 | gpe_number = (u32) obj_desc->integer.value; |
430 | } | 404 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
431 | else if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { | ||
432 | /* Package contains a GPE reference and GPE number within a GPE block */ | 405 | /* Package contains a GPE reference and GPE number within a GPE block */ |
433 | 406 | ||
434 | if ((obj_desc->package.count < 2) || | 407 | if ((obj_desc->package.count < 2) || |
435 | (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) || | 408 | (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) != |
436 | (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1]) != ACPI_TYPE_INTEGER)) { | 409 | ACPI_TYPE_LOCAL_REFERENCE) |
410 | || (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) != | ||
411 | ACPI_TYPE_INTEGER)) { | ||
437 | goto cleanup; | 412 | goto cleanup; |
438 | } | 413 | } |
439 | 414 | ||
440 | /* Get GPE block reference and decode */ | 415 | /* Get GPE block reference and decode */ |
441 | 416 | ||
442 | target_gpe_device = obj_desc->package.elements[0]->reference.node; | 417 | target_gpe_device = |
418 | obj_desc->package.elements[0]->reference.node; | ||
443 | gpe_number = (u32) obj_desc->package.elements[1]->integer.value; | 419 | gpe_number = (u32) obj_desc->package.elements[1]->integer.value; |
444 | } | 420 | } else { |
445 | else { | ||
446 | /* Unknown type, just ignore it */ | 421 | /* Unknown type, just ignore it */ |
447 | 422 | ||
448 | goto cleanup; | 423 | goto cleanup; |
@@ -457,26 +432,32 @@ acpi_ev_match_prw_and_gpe ( | |||
457 | * associated with the GPE device. | 432 | * associated with the GPE device. |
458 | */ | 433 | */ |
459 | if ((gpe_device == target_gpe_device) && | 434 | if ((gpe_device == target_gpe_device) && |
460 | (gpe_number >= gpe_block->block_base_number) && | 435 | (gpe_number >= gpe_block->block_base_number) && |
461 | (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { | 436 | (gpe_number < |
462 | gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 437 | gpe_block->block_base_number + (gpe_block->register_count * 8))) { |
438 | gpe_event_info = | ||
439 | &gpe_block->event_info[gpe_number - | ||
440 | gpe_block->block_base_number]; | ||
463 | 441 | ||
464 | /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ | 442 | /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ |
465 | 443 | ||
466 | gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); | 444 | gpe_event_info->flags &= |
467 | status = acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE); | 445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); |
468 | if (ACPI_FAILURE (status)) { | 446 | status = |
447 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | ||
448 | if (ACPI_FAILURE(status)) { | ||
469 | goto cleanup; | 449 | goto cleanup; |
470 | } | 450 | } |
471 | status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE); | 451 | status = |
452 | acpi_ev_update_gpe_enable_masks(gpe_event_info, | ||
453 | ACPI_GPE_DISABLE); | ||
472 | } | 454 | } |
473 | 455 | ||
474 | cleanup: | 456 | cleanup: |
475 | acpi_ut_remove_reference (pkg_desc); | 457 | acpi_ut_remove_reference(pkg_desc); |
476 | return_ACPI_STATUS (AE_OK); | 458 | return_ACPI_STATUS(AE_OK); |
477 | } | 459 | } |
478 | 460 | ||
479 | |||
480 | /******************************************************************************* | 461 | /******************************************************************************* |
481 | * | 462 | * |
482 | * FUNCTION: acpi_ev_get_gpe_xrupt_block | 463 | * FUNCTION: acpi_ev_get_gpe_xrupt_block |
@@ -492,25 +473,22 @@ cleanup: | |||
492 | * | 473 | * |
493 | ******************************************************************************/ | 474 | ******************************************************************************/ |
494 | 475 | ||
495 | static struct acpi_gpe_xrupt_info * | 476 | static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 |
496 | acpi_ev_get_gpe_xrupt_block ( | 477 | interrupt_number) |
497 | u32 interrupt_number) | ||
498 | { | 478 | { |
499 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; | 479 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; |
500 | struct acpi_gpe_xrupt_info *gpe_xrupt; | 480 | struct acpi_gpe_xrupt_info *gpe_xrupt; |
501 | acpi_status status; | 481 | acpi_status status; |
502 | u32 flags; | 482 | u32 flags; |
503 | |||
504 | |||
505 | ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); | ||
506 | 483 | ||
484 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | ||
507 | 485 | ||
508 | /* No need for lock since we are not changing any list elements here */ | 486 | /* No need for lock since we are not changing any list elements here */ |
509 | 487 | ||
510 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; | 488 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; |
511 | while (next_gpe_xrupt) { | 489 | while (next_gpe_xrupt) { |
512 | if (next_gpe_xrupt->interrupt_number == interrupt_number) { | 490 | if (next_gpe_xrupt->interrupt_number == interrupt_number) { |
513 | return_PTR (next_gpe_xrupt); | 491 | return_PTR(next_gpe_xrupt); |
514 | } | 492 | } |
515 | 493 | ||
516 | next_gpe_xrupt = next_gpe_xrupt->next; | 494 | next_gpe_xrupt = next_gpe_xrupt->next; |
@@ -518,16 +496,16 @@ acpi_ev_get_gpe_xrupt_block ( | |||
518 | 496 | ||
519 | /* Not found, must allocate a new xrupt descriptor */ | 497 | /* Not found, must allocate a new xrupt descriptor */ |
520 | 498 | ||
521 | gpe_xrupt = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_xrupt_info)); | 499 | gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); |
522 | if (!gpe_xrupt) { | 500 | if (!gpe_xrupt) { |
523 | return_PTR (NULL); | 501 | return_PTR(NULL); |
524 | } | 502 | } |
525 | 503 | ||
526 | gpe_xrupt->interrupt_number = interrupt_number; | 504 | gpe_xrupt->interrupt_number = interrupt_number; |
527 | 505 | ||
528 | /* Install new interrupt descriptor with spin lock */ | 506 | /* Install new interrupt descriptor with spin lock */ |
529 | 507 | ||
530 | flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); | 508 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
531 | if (acpi_gbl_gpe_xrupt_list_head) { | 509 | if (acpi_gbl_gpe_xrupt_list_head) { |
532 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; | 510 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; |
533 | while (next_gpe_xrupt->next) { | 511 | while (next_gpe_xrupt->next) { |
@@ -536,29 +514,28 @@ acpi_ev_get_gpe_xrupt_block ( | |||
536 | 514 | ||
537 | next_gpe_xrupt->next = gpe_xrupt; | 515 | next_gpe_xrupt->next = gpe_xrupt; |
538 | gpe_xrupt->previous = next_gpe_xrupt; | 516 | gpe_xrupt->previous = next_gpe_xrupt; |
539 | } | 517 | } else { |
540 | else { | ||
541 | acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; | 518 | acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; |
542 | } | 519 | } |
543 | acpi_os_release_lock (acpi_gbl_gpe_lock, flags); | 520 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
544 | 521 | ||
545 | /* Install new interrupt handler if not SCI_INT */ | 522 | /* Install new interrupt handler if not SCI_INT */ |
546 | 523 | ||
547 | if (interrupt_number != acpi_gbl_FADT->sci_int) { | 524 | if (interrupt_number != acpi_gbl_FADT->sci_int) { |
548 | status = acpi_os_install_interrupt_handler (interrupt_number, | 525 | status = acpi_os_install_interrupt_handler(interrupt_number, |
549 | acpi_ev_gpe_xrupt_handler, gpe_xrupt); | 526 | acpi_ev_gpe_xrupt_handler, |
550 | if (ACPI_FAILURE (status)) { | 527 | gpe_xrupt); |
551 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 528 | if (ACPI_FAILURE(status)) { |
552 | "Could not install GPE interrupt handler at level 0x%X\n", | 529 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
553 | interrupt_number)); | 530 | "Could not install GPE interrupt handler at level 0x%X\n", |
554 | return_PTR (NULL); | 531 | interrupt_number)); |
532 | return_PTR(NULL); | ||
555 | } | 533 | } |
556 | } | 534 | } |
557 | 535 | ||
558 | return_PTR (gpe_xrupt); | 536 | return_PTR(gpe_xrupt); |
559 | } | 537 | } |
560 | 538 | ||
561 | |||
562 | /******************************************************************************* | 539 | /******************************************************************************* |
563 | * | 540 | * |
564 | * FUNCTION: acpi_ev_delete_gpe_xrupt | 541 | * FUNCTION: acpi_ev_delete_gpe_xrupt |
@@ -573,34 +550,31 @@ acpi_ev_get_gpe_xrupt_block ( | |||
573 | ******************************************************************************/ | 550 | ******************************************************************************/ |
574 | 551 | ||
575 | static acpi_status | 552 | static acpi_status |
576 | acpi_ev_delete_gpe_xrupt ( | 553 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) |
577 | struct acpi_gpe_xrupt_info *gpe_xrupt) | ||
578 | { | 554 | { |
579 | acpi_status status; | 555 | acpi_status status; |
580 | u32 flags; | 556 | u32 flags; |
581 | |||
582 | |||
583 | ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); | ||
584 | 557 | ||
558 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | ||
585 | 559 | ||
586 | /* We never want to remove the SCI interrupt handler */ | 560 | /* We never want to remove the SCI interrupt handler */ |
587 | 561 | ||
588 | if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) { | 562 | if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) { |
589 | gpe_xrupt->gpe_block_list_head = NULL; | 563 | gpe_xrupt->gpe_block_list_head = NULL; |
590 | return_ACPI_STATUS (AE_OK); | 564 | return_ACPI_STATUS(AE_OK); |
591 | } | 565 | } |
592 | 566 | ||
593 | /* Disable this interrupt */ | 567 | /* Disable this interrupt */ |
594 | 568 | ||
595 | status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number, | 569 | status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, |
596 | acpi_ev_gpe_xrupt_handler); | 570 | acpi_ev_gpe_xrupt_handler); |
597 | if (ACPI_FAILURE (status)) { | 571 | if (ACPI_FAILURE(status)) { |
598 | return_ACPI_STATUS (status); | 572 | return_ACPI_STATUS(status); |
599 | } | 573 | } |
600 | 574 | ||
601 | /* Unlink the interrupt block with lock */ | 575 | /* Unlink the interrupt block with lock */ |
602 | 576 | ||
603 | flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); | 577 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
604 | if (gpe_xrupt->previous) { | 578 | if (gpe_xrupt->previous) { |
605 | gpe_xrupt->previous->next = gpe_xrupt->next; | 579 | gpe_xrupt->previous->next = gpe_xrupt->next; |
606 | } | 580 | } |
@@ -608,15 +582,14 @@ acpi_ev_delete_gpe_xrupt ( | |||
608 | if (gpe_xrupt->next) { | 582 | if (gpe_xrupt->next) { |
609 | gpe_xrupt->next->previous = gpe_xrupt->previous; | 583 | gpe_xrupt->next->previous = gpe_xrupt->previous; |
610 | } | 584 | } |
611 | acpi_os_release_lock (acpi_gbl_gpe_lock, flags); | 585 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
612 | 586 | ||
613 | /* Free the block */ | 587 | /* Free the block */ |
614 | 588 | ||
615 | ACPI_MEM_FREE (gpe_xrupt); | 589 | ACPI_MEM_FREE(gpe_xrupt); |
616 | return_ACPI_STATUS (AE_OK); | 590 | return_ACPI_STATUS(AE_OK); |
617 | } | 591 | } |
618 | 592 | ||
619 | |||
620 | /******************************************************************************* | 593 | /******************************************************************************* |
621 | * | 594 | * |
622 | * FUNCTION: acpi_ev_install_gpe_block | 595 | * FUNCTION: acpi_ev_install_gpe_block |
@@ -631,25 +604,22 @@ acpi_ev_delete_gpe_xrupt ( | |||
631 | ******************************************************************************/ | 604 | ******************************************************************************/ |
632 | 605 | ||
633 | static acpi_status | 606 | static acpi_status |
634 | acpi_ev_install_gpe_block ( | 607 | acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, |
635 | struct acpi_gpe_block_info *gpe_block, | 608 | u32 interrupt_number) |
636 | u32 interrupt_number) | ||
637 | { | 609 | { |
638 | struct acpi_gpe_block_info *next_gpe_block; | 610 | struct acpi_gpe_block_info *next_gpe_block; |
639 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; | 611 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; |
640 | acpi_status status; | 612 | acpi_status status; |
641 | u32 flags; | 613 | u32 flags; |
642 | 614 | ||
615 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | ||
643 | 616 | ||
644 | ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); | 617 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
645 | 618 | if (ACPI_FAILURE(status)) { | |
646 | 619 | return_ACPI_STATUS(status); | |
647 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | ||
648 | if (ACPI_FAILURE (status)) { | ||
649 | return_ACPI_STATUS (status); | ||
650 | } | 620 | } |
651 | 621 | ||
652 | gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number); | 622 | gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block(interrupt_number); |
653 | if (!gpe_xrupt_block) { | 623 | if (!gpe_xrupt_block) { |
654 | status = AE_NO_MEMORY; | 624 | status = AE_NO_MEMORY; |
655 | goto unlock_and_exit; | 625 | goto unlock_and_exit; |
@@ -657,7 +627,7 @@ acpi_ev_install_gpe_block ( | |||
657 | 627 | ||
658 | /* Install the new block at the end of the list with lock */ | 628 | /* Install the new block at the end of the list with lock */ |
659 | 629 | ||
660 | flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); | 630 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
661 | if (gpe_xrupt_block->gpe_block_list_head) { | 631 | if (gpe_xrupt_block->gpe_block_list_head) { |
662 | next_gpe_block = gpe_xrupt_block->gpe_block_list_head; | 632 | next_gpe_block = gpe_xrupt_block->gpe_block_list_head; |
663 | while (next_gpe_block->next) { | 633 | while (next_gpe_block->next) { |
@@ -666,20 +636,18 @@ acpi_ev_install_gpe_block ( | |||
666 | 636 | ||
667 | next_gpe_block->next = gpe_block; | 637 | next_gpe_block->next = gpe_block; |
668 | gpe_block->previous = next_gpe_block; | 638 | gpe_block->previous = next_gpe_block; |
669 | } | 639 | } else { |
670 | else { | ||
671 | gpe_xrupt_block->gpe_block_list_head = gpe_block; | 640 | gpe_xrupt_block->gpe_block_list_head = gpe_block; |
672 | } | 641 | } |
673 | 642 | ||
674 | gpe_block->xrupt_block = gpe_xrupt_block; | 643 | gpe_block->xrupt_block = gpe_xrupt_block; |
675 | acpi_os_release_lock (acpi_gbl_gpe_lock, flags); | 644 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
676 | 645 | ||
677 | unlock_and_exit: | 646 | unlock_and_exit: |
678 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 647 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
679 | return_ACPI_STATUS (status); | 648 | return_ACPI_STATUS(status); |
680 | } | 649 | } |
681 | 650 | ||
682 | |||
683 | /******************************************************************************* | 651 | /******************************************************************************* |
684 | * | 652 | * |
685 | * FUNCTION: acpi_ev_delete_gpe_block | 653 | * FUNCTION: acpi_ev_delete_gpe_block |
@@ -692,63 +660,57 @@ unlock_and_exit: | |||
692 | * | 660 | * |
693 | ******************************************************************************/ | 661 | ******************************************************************************/ |
694 | 662 | ||
695 | acpi_status | 663 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) |
696 | acpi_ev_delete_gpe_block ( | ||
697 | struct acpi_gpe_block_info *gpe_block) | ||
698 | { | 664 | { |
699 | acpi_status status; | 665 | acpi_status status; |
700 | u32 flags; | 666 | u32 flags; |
701 | |||
702 | |||
703 | ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); | ||
704 | 667 | ||
668 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | ||
705 | 669 | ||
706 | status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); | 670 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
707 | if (ACPI_FAILURE (status)) { | 671 | if (ACPI_FAILURE(status)) { |
708 | return_ACPI_STATUS (status); | 672 | return_ACPI_STATUS(status); |
709 | } | 673 | } |
710 | 674 | ||
711 | /* Disable all GPEs in this block */ | 675 | /* Disable all GPEs in this block */ |
712 | 676 | ||
713 | status = acpi_hw_disable_gpe_block (gpe_block->xrupt_block, gpe_block); | 677 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); |
714 | 678 | ||
715 | if (!gpe_block->previous && !gpe_block->next) { | 679 | if (!gpe_block->previous && !gpe_block->next) { |
716 | /* This is the last gpe_block on this interrupt */ | 680 | /* This is the last gpe_block on this interrupt */ |
717 | 681 | ||
718 | status = acpi_ev_delete_gpe_xrupt (gpe_block->xrupt_block); | 682 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); |
719 | if (ACPI_FAILURE (status)) { | 683 | if (ACPI_FAILURE(status)) { |
720 | goto unlock_and_exit; | 684 | goto unlock_and_exit; |
721 | } | 685 | } |
722 | } | 686 | } else { |
723 | else { | ||
724 | /* Remove the block on this interrupt with lock */ | 687 | /* Remove the block on this interrupt with lock */ |
725 | 688 | ||
726 | flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock); | 689 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
727 | if (gpe_block->previous) { | 690 | if (gpe_block->previous) { |
728 | gpe_block->previous->next = gpe_block->next; | 691 | gpe_block->previous->next = gpe_block->next; |
729 | } | 692 | } else { |
730 | else { | 693 | gpe_block->xrupt_block->gpe_block_list_head = |
731 | gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next; | 694 | gpe_block->next; |
732 | } | 695 | } |
733 | 696 | ||
734 | if (gpe_block->next) { | 697 | if (gpe_block->next) { |
735 | gpe_block->next->previous = gpe_block->previous; | 698 | gpe_block->next->previous = gpe_block->previous; |
736 | } | 699 | } |
737 | acpi_os_release_lock (acpi_gbl_gpe_lock, flags); | 700 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
738 | } | 701 | } |
739 | 702 | ||
740 | /* Free the gpe_block */ | 703 | /* Free the gpe_block */ |
741 | 704 | ||
742 | ACPI_MEM_FREE (gpe_block->register_info); | 705 | ACPI_MEM_FREE(gpe_block->register_info); |
743 | ACPI_MEM_FREE (gpe_block->event_info); | 706 | ACPI_MEM_FREE(gpe_block->event_info); |
744 | ACPI_MEM_FREE (gpe_block); | 707 | ACPI_MEM_FREE(gpe_block); |
745 | 708 | ||
746 | unlock_and_exit: | 709 | unlock_and_exit: |
747 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 710 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
748 | return_ACPI_STATUS (status); | 711 | return_ACPI_STATUS(status); |
749 | } | 712 | } |
750 | 713 | ||
751 | |||
752 | /******************************************************************************* | 714 | /******************************************************************************* |
753 | * | 715 | * |
754 | * FUNCTION: acpi_ev_create_gpe_info_blocks | 716 | * FUNCTION: acpi_ev_create_gpe_info_blocks |
@@ -762,43 +724,41 @@ unlock_and_exit: | |||
762 | ******************************************************************************/ | 724 | ******************************************************************************/ |
763 | 725 | ||
764 | static acpi_status | 726 | static acpi_status |
765 | acpi_ev_create_gpe_info_blocks ( | 727 | acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) |
766 | struct acpi_gpe_block_info *gpe_block) | ||
767 | { | 728 | { |
768 | struct acpi_gpe_register_info *gpe_register_info = NULL; | 729 | struct acpi_gpe_register_info *gpe_register_info = NULL; |
769 | struct acpi_gpe_event_info *gpe_event_info = NULL; | 730 | struct acpi_gpe_event_info *gpe_event_info = NULL; |
770 | struct acpi_gpe_event_info *this_event; | 731 | struct acpi_gpe_event_info *this_event; |
771 | struct acpi_gpe_register_info *this_register; | 732 | struct acpi_gpe_register_info *this_register; |
772 | acpi_native_uint i; | 733 | acpi_native_uint i; |
773 | acpi_native_uint j; | 734 | acpi_native_uint j; |
774 | acpi_status status; | 735 | acpi_status status; |
775 | |||
776 | |||
777 | ACPI_FUNCTION_TRACE ("ev_create_gpe_info_blocks"); | ||
778 | 736 | ||
737 | ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); | ||
779 | 738 | ||
780 | /* Allocate the GPE register information block */ | 739 | /* Allocate the GPE register information block */ |
781 | 740 | ||
782 | gpe_register_info = ACPI_MEM_CALLOCATE ( | 741 | gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> |
783 | (acpi_size) gpe_block->register_count * | 742 | register_count * |
784 | sizeof (struct acpi_gpe_register_info)); | 743 | sizeof(struct |
744 | acpi_gpe_register_info)); | ||
785 | if (!gpe_register_info) { | 745 | if (!gpe_register_info) { |
786 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 746 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
787 | "Could not allocate the gpe_register_info table\n")); | 747 | "Could not allocate the gpe_register_info table\n")); |
788 | return_ACPI_STATUS (AE_NO_MEMORY); | 748 | return_ACPI_STATUS(AE_NO_MEMORY); |
789 | } | 749 | } |
790 | 750 | ||
791 | /* | 751 | /* |
792 | * Allocate the GPE event_info block. There are eight distinct GPEs | 752 | * Allocate the GPE event_info block. There are eight distinct GPEs |
793 | * per register. Initialization to zeros is sufficient. | 753 | * per register. Initialization to zeros is sufficient. |
794 | */ | 754 | */ |
795 | gpe_event_info = ACPI_MEM_CALLOCATE ( | 755 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> |
796 | ((acpi_size) gpe_block->register_count * | 756 | register_count * |
797 | ACPI_GPE_REGISTER_WIDTH) * | 757 | ACPI_GPE_REGISTER_WIDTH) * |
798 | sizeof (struct acpi_gpe_event_info)); | 758 | sizeof(struct acpi_gpe_event_info)); |
799 | if (!gpe_event_info) { | 759 | if (!gpe_event_info) { |
800 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 760 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
801 | "Could not allocate the gpe_event_info table\n")); | 761 | "Could not allocate the gpe_event_info table\n")); |
802 | status = AE_NO_MEMORY; | 762 | status = AE_NO_MEMORY; |
803 | goto error_exit; | 763 | goto error_exit; |
804 | } | 764 | } |
@@ -806,7 +766,7 @@ acpi_ev_create_gpe_info_blocks ( | |||
806 | /* Save the new Info arrays in the GPE block */ | 766 | /* Save the new Info arrays in the GPE block */ |
807 | 767 | ||
808 | gpe_block->register_info = gpe_register_info; | 768 | gpe_block->register_info = gpe_register_info; |
809 | gpe_block->event_info = gpe_event_info; | 769 | gpe_block->event_info = gpe_event_info; |
810 | 770 | ||
811 | /* | 771 | /* |
812 | * Initialize the GPE Register and Event structures. A goal of these | 772 | * Initialize the GPE Register and Event structures. A goal of these |
@@ -815,29 +775,34 @@ acpi_ev_create_gpe_info_blocks ( | |||
815 | * and the enable registers occupy the second half. | 775 | * and the enable registers occupy the second half. |
816 | */ | 776 | */ |
817 | this_register = gpe_register_info; | 777 | this_register = gpe_register_info; |
818 | this_event = gpe_event_info; | 778 | this_event = gpe_event_info; |
819 | 779 | ||
820 | for (i = 0; i < gpe_block->register_count; i++) { | 780 | for (i = 0; i < gpe_block->register_count; i++) { |
821 | /* Init the register_info for this GPE register (8 GPEs) */ | 781 | /* Init the register_info for this GPE register (8 GPEs) */ |
822 | 782 | ||
823 | this_register->base_gpe_number = (u8) (gpe_block->block_base_number + | 783 | this_register->base_gpe_number = |
824 | (i * ACPI_GPE_REGISTER_WIDTH)); | 784 | (u8) (gpe_block->block_base_number + |
825 | 785 | (i * ACPI_GPE_REGISTER_WIDTH)); | |
826 | ACPI_STORE_ADDRESS (this_register->status_address.address, | 786 | |
827 | (gpe_block->block_address.address | 787 | ACPI_STORE_ADDRESS(this_register->status_address.address, |
828 | + i)); | 788 | (gpe_block->block_address.address + i)); |
829 | 789 | ||
830 | ACPI_STORE_ADDRESS (this_register->enable_address.address, | 790 | ACPI_STORE_ADDRESS(this_register->enable_address.address, |
831 | (gpe_block->block_address.address | 791 | (gpe_block->block_address.address |
832 | + i | 792 | + i + gpe_block->register_count)); |
833 | + gpe_block->register_count)); | 793 | |
834 | 794 | this_register->status_address.address_space_id = | |
835 | this_register->status_address.address_space_id = gpe_block->block_address.address_space_id; | 795 | gpe_block->block_address.address_space_id; |
836 | this_register->enable_address.address_space_id = gpe_block->block_address.address_space_id; | 796 | this_register->enable_address.address_space_id = |
837 | this_register->status_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH; | 797 | gpe_block->block_address.address_space_id; |
838 | this_register->enable_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH; | 798 | this_register->status_address.register_bit_width = |
839 | this_register->status_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH; | 799 | ACPI_GPE_REGISTER_WIDTH; |
840 | this_register->enable_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH; | 800 | this_register->enable_address.register_bit_width = |
801 | ACPI_GPE_REGISTER_WIDTH; | ||
802 | this_register->status_address.register_bit_offset = | ||
803 | ACPI_GPE_REGISTER_WIDTH; | ||
804 | this_register->enable_address.register_bit_offset = | ||
805 | ACPI_GPE_REGISTER_WIDTH; | ||
841 | 806 | ||
842 | /* Init the event_info for each GPE within this register */ | 807 | /* Init the event_info for each GPE within this register */ |
843 | 808 | ||
@@ -852,36 +817,36 @@ acpi_ev_create_gpe_info_blocks ( | |||
852 | * are cleared by writing a '1', while enable registers are cleared | 817 | * are cleared by writing a '1', while enable registers are cleared |
853 | * by writing a '0'. | 818 | * by writing a '0'. |
854 | */ | 819 | */ |
855 | status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00, | 820 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, |
856 | &this_register->enable_address); | 821 | &this_register-> |
857 | if (ACPI_FAILURE (status)) { | 822 | enable_address); |
823 | if (ACPI_FAILURE(status)) { | ||
858 | goto error_exit; | 824 | goto error_exit; |
859 | } | 825 | } |
860 | 826 | ||
861 | status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF, | 827 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, |
862 | &this_register->status_address); | 828 | &this_register-> |
863 | if (ACPI_FAILURE (status)) { | 829 | status_address); |
830 | if (ACPI_FAILURE(status)) { | ||
864 | goto error_exit; | 831 | goto error_exit; |
865 | } | 832 | } |
866 | 833 | ||
867 | this_register++; | 834 | this_register++; |
868 | } | 835 | } |
869 | 836 | ||
870 | return_ACPI_STATUS (AE_OK); | 837 | return_ACPI_STATUS(AE_OK); |
871 | |||
872 | 838 | ||
873 | error_exit: | 839 | error_exit: |
874 | if (gpe_register_info) { | 840 | if (gpe_register_info) { |
875 | ACPI_MEM_FREE (gpe_register_info); | 841 | ACPI_MEM_FREE(gpe_register_info); |
876 | } | 842 | } |
877 | if (gpe_event_info) { | 843 | if (gpe_event_info) { |
878 | ACPI_MEM_FREE (gpe_event_info); | 844 | ACPI_MEM_FREE(gpe_event_info); |
879 | } | 845 | } |
880 | 846 | ||
881 | return_ACPI_STATUS (status); | 847 | return_ACPI_STATUS(status); |
882 | } | 848 | } |
883 | 849 | ||
884 | |||
885 | /******************************************************************************* | 850 | /******************************************************************************* |
886 | * | 851 | * |
887 | * FUNCTION: acpi_ev_create_gpe_block | 852 | * FUNCTION: acpi_ev_create_gpe_block |
@@ -900,68 +865,66 @@ error_exit: | |||
900 | ******************************************************************************/ | 865 | ******************************************************************************/ |
901 | 866 | ||
902 | acpi_status | 867 | acpi_status |
903 | acpi_ev_create_gpe_block ( | 868 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, |
904 | struct acpi_namespace_node *gpe_device, | 869 | struct acpi_generic_address *gpe_block_address, |
905 | struct acpi_generic_address *gpe_block_address, | 870 | u32 register_count, |
906 | u32 register_count, | 871 | u8 gpe_block_base_number, |
907 | u8 gpe_block_base_number, | 872 | u32 interrupt_number, |
908 | u32 interrupt_number, | 873 | struct acpi_gpe_block_info **return_gpe_block) |
909 | struct acpi_gpe_block_info **return_gpe_block) | ||
910 | { | 874 | { |
911 | struct acpi_gpe_block_info *gpe_block; | 875 | struct acpi_gpe_block_info *gpe_block; |
912 | struct acpi_gpe_event_info *gpe_event_info; | 876 | struct acpi_gpe_event_info *gpe_event_info; |
913 | acpi_native_uint i; | 877 | acpi_native_uint i; |
914 | acpi_native_uint j; | 878 | acpi_native_uint j; |
915 | u32 wake_gpe_count; | 879 | u32 wake_gpe_count; |
916 | u32 gpe_enabled_count; | 880 | u32 gpe_enabled_count; |
917 | acpi_status status; | 881 | acpi_status status; |
918 | struct acpi_gpe_walk_info gpe_info; | 882 | struct acpi_gpe_walk_info gpe_info; |
919 | |||
920 | |||
921 | ACPI_FUNCTION_TRACE ("ev_create_gpe_block"); | ||
922 | 883 | ||
884 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | ||
923 | 885 | ||
924 | if (!register_count) { | 886 | if (!register_count) { |
925 | return_ACPI_STATUS (AE_OK); | 887 | return_ACPI_STATUS(AE_OK); |
926 | } | 888 | } |
927 | 889 | ||
928 | /* Allocate a new GPE block */ | 890 | /* Allocate a new GPE block */ |
929 | 891 | ||
930 | gpe_block = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_block_info)); | 892 | gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); |
931 | if (!gpe_block) { | 893 | if (!gpe_block) { |
932 | return_ACPI_STATUS (AE_NO_MEMORY); | 894 | return_ACPI_STATUS(AE_NO_MEMORY); |
933 | } | 895 | } |
934 | 896 | ||
935 | /* Initialize the new GPE block */ | 897 | /* Initialize the new GPE block */ |
936 | 898 | ||
937 | gpe_block->register_count = register_count; | 899 | gpe_block->register_count = register_count; |
938 | gpe_block->block_base_number = gpe_block_base_number; | 900 | gpe_block->block_base_number = gpe_block_base_number; |
939 | gpe_block->node = gpe_device; | 901 | gpe_block->node = gpe_device; |
940 | 902 | ||
941 | ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, | 903 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, |
942 | sizeof (struct acpi_generic_address)); | 904 | sizeof(struct acpi_generic_address)); |
943 | 905 | ||
944 | /* Create the register_info and event_info sub-structures */ | 906 | /* Create the register_info and event_info sub-structures */ |
945 | 907 | ||
946 | status = acpi_ev_create_gpe_info_blocks (gpe_block); | 908 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
947 | if (ACPI_FAILURE (status)) { | 909 | if (ACPI_FAILURE(status)) { |
948 | ACPI_MEM_FREE (gpe_block); | 910 | ACPI_MEM_FREE(gpe_block); |
949 | return_ACPI_STATUS (status); | 911 | return_ACPI_STATUS(status); |
950 | } | 912 | } |
951 | 913 | ||
952 | /* Install the new block in the global list(s) */ | 914 | /* Install the new block in the global list(s) */ |
953 | 915 | ||
954 | status = acpi_ev_install_gpe_block (gpe_block, interrupt_number); | 916 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
955 | if (ACPI_FAILURE (status)) { | 917 | if (ACPI_FAILURE(status)) { |
956 | ACPI_MEM_FREE (gpe_block); | 918 | ACPI_MEM_FREE(gpe_block); |
957 | return_ACPI_STATUS (status); | 919 | return_ACPI_STATUS(status); |
958 | } | 920 | } |
959 | 921 | ||
960 | /* Find all GPE methods (_Lxx, _Exx) for this block */ | 922 | /* Find all GPE methods (_Lxx, _Exx) for this block */ |
961 | 923 | ||
962 | status = acpi_ns_walk_namespace (ACPI_TYPE_METHOD, gpe_device, | 924 | status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, |
963 | ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_save_method_info, | 925 | ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, |
964 | gpe_block, NULL); | 926 | acpi_ev_save_method_info, gpe_block, |
927 | NULL); | ||
965 | 928 | ||
966 | /* | 929 | /* |
967 | * Runtime option: Should Wake GPEs be enabled at runtime? The default | 930 | * Runtime option: Should Wake GPEs be enabled at runtime? The default |
@@ -977,9 +940,11 @@ acpi_ev_create_gpe_block ( | |||
977 | gpe_info.gpe_block = gpe_block; | 940 | gpe_info.gpe_block = gpe_block; |
978 | gpe_info.gpe_device = gpe_device; | 941 | gpe_info.gpe_device = gpe_device; |
979 | 942 | ||
980 | status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 943 | status = |
981 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_match_prw_and_gpe, | 944 | acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
982 | &gpe_info, NULL); | 945 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
946 | acpi_ev_match_prw_and_gpe, &gpe_info, | ||
947 | NULL); | ||
983 | } | 948 | } |
984 | 949 | ||
985 | /* | 950 | /* |
@@ -994,10 +959,14 @@ acpi_ev_create_gpe_block ( | |||
994 | for (j = 0; j < 8; j++) { | 959 | for (j = 0; j < 8; j++) { |
995 | /* Get the info block for this particular GPE */ | 960 | /* Get the info block for this particular GPE */ |
996 | 961 | ||
997 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 962 | gpe_event_info = |
963 | &gpe_block-> | ||
964 | event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | ||
998 | 965 | ||
999 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) && | 966 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
1000 | (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { | 967 | ACPI_GPE_DISPATCH_METHOD) |
968 | && (gpe_event_info-> | ||
969 | flags & ACPI_GPE_TYPE_RUNTIME)) { | ||
1001 | gpe_enabled_count++; | 970 | gpe_enabled_count++; |
1002 | } | 971 | } |
1003 | 972 | ||
@@ -1009,22 +978,22 @@ acpi_ev_create_gpe_block ( | |||
1009 | 978 | ||
1010 | /* Dump info about this GPE block */ | 979 | /* Dump info about this GPE block */ |
1011 | 980 | ||
1012 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, | 981 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
1013 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | 982 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", |
1014 | (u32) gpe_block->block_base_number, | 983 | (u32) gpe_block->block_base_number, |
1015 | (u32) (gpe_block->block_base_number + | 984 | (u32) (gpe_block->block_base_number + |
1016 | ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), | 985 | ((gpe_block->register_count * |
1017 | gpe_device->name.ascii, | 986 | ACPI_GPE_REGISTER_WIDTH) - 1)), |
1018 | gpe_block->register_count, | 987 | gpe_device->name.ascii, gpe_block->register_count, |
1019 | interrupt_number)); | 988 | interrupt_number)); |
1020 | 989 | ||
1021 | /* Enable all valid GPEs found above */ | 990 | /* Enable all valid GPEs found above */ |
1022 | 991 | ||
1023 | status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block); | 992 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1024 | 993 | ||
1025 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, | 994 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
1026 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", | 995 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", |
1027 | wake_gpe_count, gpe_enabled_count)); | 996 | wake_gpe_count, gpe_enabled_count)); |
1028 | 997 | ||
1029 | /* Return the new block */ | 998 | /* Return the new block */ |
1030 | 999 | ||
@@ -1032,10 +1001,9 @@ acpi_ev_create_gpe_block ( | |||
1032 | (*return_gpe_block) = gpe_block; | 1001 | (*return_gpe_block) = gpe_block; |
1033 | } | 1002 | } |
1034 | 1003 | ||
1035 | return_ACPI_STATUS (AE_OK); | 1004 | return_ACPI_STATUS(AE_OK); |
1036 | } | 1005 | } |
1037 | 1006 | ||
1038 | |||
1039 | /******************************************************************************* | 1007 | /******************************************************************************* |
1040 | * | 1008 | * |
1041 | * FUNCTION: acpi_ev_gpe_initialize | 1009 | * FUNCTION: acpi_ev_gpe_initialize |
@@ -1048,22 +1016,18 @@ acpi_ev_create_gpe_block ( | |||
1048 | * | 1016 | * |
1049 | ******************************************************************************/ | 1017 | ******************************************************************************/ |
1050 | 1018 | ||
1051 | acpi_status | 1019 | acpi_status acpi_ev_gpe_initialize(void) |
1052 | acpi_ev_gpe_initialize ( | ||
1053 | void) | ||
1054 | { | 1020 | { |
1055 | u32 register_count0 = 0; | 1021 | u32 register_count0 = 0; |
1056 | u32 register_count1 = 0; | 1022 | u32 register_count1 = 0; |
1057 | u32 gpe_number_max = 0; | 1023 | u32 gpe_number_max = 0; |
1058 | acpi_status status; | 1024 | acpi_status status; |
1059 | 1025 | ||
1026 | ACPI_FUNCTION_TRACE("ev_gpe_initialize"); | ||
1060 | 1027 | ||
1061 | ACPI_FUNCTION_TRACE ("ev_gpe_initialize"); | 1028 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
1062 | 1029 | if (ACPI_FAILURE(status)) { | |
1063 | 1030 | return_ACPI_STATUS(status); | |
1064 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | ||
1065 | if (ACPI_FAILURE (status)) { | ||
1066 | return_ACPI_STATUS (status); | ||
1067 | } | 1031 | } |
1068 | 1032 | ||
1069 | /* | 1033 | /* |
@@ -1091,29 +1055,29 @@ acpi_ev_gpe_initialize ( | |||
1091 | * If EITHER the register length OR the block address are zero, then that | 1055 | * If EITHER the register length OR the block address are zero, then that |
1092 | * particular block is not supported. | 1056 | * particular block is not supported. |
1093 | */ | 1057 | */ |
1094 | if (acpi_gbl_FADT->gpe0_blk_len && | 1058 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { |
1095 | acpi_gbl_FADT->xgpe0_blk.address) { | ||
1096 | /* GPE block 0 exists (has both length and address > 0) */ | 1059 | /* GPE block 0 exists (has both length and address > 0) */ |
1097 | 1060 | ||
1098 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); | 1061 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); |
1099 | 1062 | ||
1100 | gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; | 1063 | gpe_number_max = |
1064 | (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; | ||
1101 | 1065 | ||
1102 | /* Install GPE Block 0 */ | 1066 | /* Install GPE Block 0 */ |
1103 | 1067 | ||
1104 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, | 1068 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
1105 | &acpi_gbl_FADT->xgpe0_blk, register_count0, 0, | 1069 | &acpi_gbl_FADT->xgpe0_blk, |
1106 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); | 1070 | register_count0, 0, |
1071 | acpi_gbl_FADT->sci_int, | ||
1072 | &acpi_gbl_gpe_fadt_blocks[0]); | ||
1107 | 1073 | ||
1108 | if (ACPI_FAILURE (status)) { | 1074 | if (ACPI_FAILURE(status)) { |
1109 | ACPI_REPORT_ERROR (( | 1075 | ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n", |
1110 | "Could not create GPE Block 0, %s\n", | 1076 | acpi_format_exception(status))); |
1111 | acpi_format_exception (status))); | ||
1112 | } | 1077 | } |
1113 | } | 1078 | } |
1114 | 1079 | ||
1115 | if (acpi_gbl_FADT->gpe1_blk_len && | 1080 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { |
1116 | acpi_gbl_FADT->xgpe1_blk.address) { | ||
1117 | /* GPE block 1 exists (has both length and address > 0) */ | 1081 | /* GPE block 1 exists (has both length and address > 0) */ |
1118 | 1082 | ||
1119 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); | 1083 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); |
@@ -1121,29 +1085,26 @@ acpi_ev_gpe_initialize ( | |||
1121 | /* Check for GPE0/GPE1 overlap (if both banks exist) */ | 1085 | /* Check for GPE0/GPE1 overlap (if both banks exist) */ |
1122 | 1086 | ||
1123 | if ((register_count0) && | 1087 | if ((register_count0) && |
1124 | (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { | 1088 | (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { |
1125 | ACPI_REPORT_ERROR (( | 1089 | ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); |
1126 | "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", | ||
1127 | gpe_number_max, acpi_gbl_FADT->gpe1_base, | ||
1128 | acpi_gbl_FADT->gpe1_base + | ||
1129 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); | ||
1130 | 1090 | ||
1131 | /* Ignore GPE1 block by setting the register count to zero */ | 1091 | /* Ignore GPE1 block by setting the register count to zero */ |
1132 | 1092 | ||
1133 | register_count1 = 0; | 1093 | register_count1 = 0; |
1134 | } | 1094 | } else { |
1135 | else { | ||
1136 | /* Install GPE Block 1 */ | 1095 | /* Install GPE Block 1 */ |
1137 | 1096 | ||
1138 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, | 1097 | status = |
1139 | &acpi_gbl_FADT->xgpe1_blk, register_count1, | 1098 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
1140 | acpi_gbl_FADT->gpe1_base, | 1099 | &acpi_gbl_FADT->xgpe1_blk, |
1141 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); | 1100 | register_count1, |
1142 | 1101 | acpi_gbl_FADT->gpe1_base, | |
1143 | if (ACPI_FAILURE (status)) { | 1102 | acpi_gbl_FADT->sci_int, |
1144 | ACPI_REPORT_ERROR (( | 1103 | &acpi_gbl_gpe_fadt_blocks |
1145 | "Could not create GPE Block 1, %s\n", | 1104 | [1]); |
1146 | acpi_format_exception (status))); | 1105 | |
1106 | if (ACPI_FAILURE(status)) { | ||
1107 | ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status))); | ||
1147 | } | 1108 | } |
1148 | 1109 | ||
1149 | /* | 1110 | /* |
@@ -1151,7 +1112,7 @@ acpi_ev_gpe_initialize ( | |||
1151 | * space. However, GPE0 always starts at GPE number zero. | 1112 | * space. However, GPE0 always starts at GPE number zero. |
1152 | */ | 1113 | */ |
1153 | gpe_number_max = acpi_gbl_FADT->gpe1_base + | 1114 | gpe_number_max = acpi_gbl_FADT->gpe1_base + |
1154 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); | 1115 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); |
1155 | } | 1116 | } |
1156 | } | 1117 | } |
1157 | 1118 | ||
@@ -1160,8 +1121,8 @@ acpi_ev_gpe_initialize ( | |||
1160 | if ((register_count0 + register_count1) == 0) { | 1121 | if ((register_count0 + register_count1) == 0) { |
1161 | /* GPEs are not required by ACPI, this is OK */ | 1122 | /* GPEs are not required by ACPI, this is OK */ |
1162 | 1123 | ||
1163 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, | 1124 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
1164 | "There are no GPE blocks defined in the FADT\n")); | 1125 | "There are no GPE blocks defined in the FADT\n")); |
1165 | status = AE_OK; | 1126 | status = AE_OK; |
1166 | goto cleanup; | 1127 | goto cleanup; |
1167 | } | 1128 | } |
@@ -1169,15 +1130,12 @@ acpi_ev_gpe_initialize ( | |||
1169 | /* Check for Max GPE number out-of-range */ | 1130 | /* Check for Max GPE number out-of-range */ |
1170 | 1131 | ||
1171 | if (gpe_number_max > ACPI_GPE_MAX) { | 1132 | if (gpe_number_max > ACPI_GPE_MAX) { |
1172 | ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", | 1133 | ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max)); |
1173 | gpe_number_max)); | ||
1174 | status = AE_BAD_VALUE; | 1134 | status = AE_BAD_VALUE; |
1175 | goto cleanup; | 1135 | goto cleanup; |
1176 | } | 1136 | } |
1177 | 1137 | ||
1178 | cleanup: | 1138 | cleanup: |
1179 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 1139 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
1180 | return_ACPI_STATUS (AE_OK); | 1140 | return_ACPI_STATUS(AE_OK); |
1181 | } | 1141 | } |
1182 | |||
1183 | |||