diff options
Diffstat (limited to 'drivers/acpi/events/evrgnini.c')
-rw-r--r-- | drivers/acpi/events/evrgnini.c | 311 |
1 files changed, 151 insertions, 160 deletions
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index f2d53af97610..a1bd2da27c45 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -41,14 +41,12 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME ("evrgnini") | 49 | ACPI_MODULE_NAME("evrgnini") |
51 | |||
52 | 50 | ||
53 | /******************************************************************************* | 51 | /******************************************************************************* |
54 | * | 52 | * |
@@ -64,34 +62,31 @@ | |||
64 | * DESCRIPTION: Setup a system_memory operation region | 62 | * DESCRIPTION: Setup a system_memory operation region |
65 | * | 63 | * |
66 | ******************************************************************************/ | 64 | ******************************************************************************/ |
67 | |||
68 | acpi_status | 65 | acpi_status |
69 | acpi_ev_system_memory_region_setup ( | 66 | acpi_ev_system_memory_region_setup(acpi_handle handle, |
70 | acpi_handle handle, | 67 | u32 function, |
71 | u32 function, | 68 | void *handler_context, void **region_context) |
72 | void *handler_context, | ||
73 | void **region_context) | ||
74 | { | 69 | { |
75 | union acpi_operand_object *region_desc = (union acpi_operand_object *) handle; | 70 | union acpi_operand_object *region_desc = |
76 | struct acpi_mem_space_context *local_region_context; | 71 | (union acpi_operand_object *)handle; |
77 | 72 | struct acpi_mem_space_context *local_region_context; | |
78 | |||
79 | ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup"); | ||
80 | 73 | ||
74 | ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); | ||
81 | 75 | ||
82 | if (function == ACPI_REGION_DEACTIVATE) { | 76 | if (function == ACPI_REGION_DEACTIVATE) { |
83 | if (*region_context) { | 77 | if (*region_context) { |
84 | ACPI_MEM_FREE (*region_context); | 78 | ACPI_MEM_FREE(*region_context); |
85 | *region_context = NULL; | 79 | *region_context = NULL; |
86 | } | 80 | } |
87 | return_ACPI_STATUS (AE_OK); | 81 | return_ACPI_STATUS(AE_OK); |
88 | } | 82 | } |
89 | 83 | ||
90 | /* Create a new context */ | 84 | /* Create a new context */ |
91 | 85 | ||
92 | local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context)); | 86 | local_region_context = |
87 | ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); | ||
93 | if (!(local_region_context)) { | 88 | if (!(local_region_context)) { |
94 | return_ACPI_STATUS (AE_NO_MEMORY); | 89 | return_ACPI_STATUS(AE_NO_MEMORY); |
95 | } | 90 | } |
96 | 91 | ||
97 | /* Save the region length and address for use in the handler */ | 92 | /* Save the region length and address for use in the handler */ |
@@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup ( | |||
100 | local_region_context->address = region_desc->region.address; | 95 | local_region_context->address = region_desc->region.address; |
101 | 96 | ||
102 | *region_context = local_region_context; | 97 | *region_context = local_region_context; |
103 | return_ACPI_STATUS (AE_OK); | 98 | return_ACPI_STATUS(AE_OK); |
104 | } | 99 | } |
105 | 100 | ||
106 | |||
107 | /******************************************************************************* | 101 | /******************************************************************************* |
108 | * | 102 | * |
109 | * FUNCTION: acpi_ev_io_space_region_setup | 103 | * FUNCTION: acpi_ev_io_space_region_setup |
@@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup ( | |||
120 | ******************************************************************************/ | 114 | ******************************************************************************/ |
121 | 115 | ||
122 | acpi_status | 116 | acpi_status |
123 | acpi_ev_io_space_region_setup ( | 117 | acpi_ev_io_space_region_setup(acpi_handle handle, |
124 | acpi_handle handle, | 118 | u32 function, |
125 | u32 function, | 119 | void *handler_context, void **region_context) |
126 | void *handler_context, | ||
127 | void **region_context) | ||
128 | { | 120 | { |
129 | ACPI_FUNCTION_TRACE ("ev_io_space_region_setup"); | 121 | ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); |
130 | |||
131 | 122 | ||
132 | if (function == ACPI_REGION_DEACTIVATE) { | 123 | if (function == ACPI_REGION_DEACTIVATE) { |
133 | *region_context = NULL; | 124 | *region_context = NULL; |
134 | } | 125 | } else { |
135 | else { | ||
136 | *region_context = handler_context; | 126 | *region_context = handler_context; |
137 | } | 127 | } |
138 | 128 | ||
139 | return_ACPI_STATUS (AE_OK); | 129 | return_ACPI_STATUS(AE_OK); |
140 | } | 130 | } |
141 | 131 | ||
142 | |||
143 | /******************************************************************************* | 132 | /******************************************************************************* |
144 | * | 133 | * |
145 | * FUNCTION: acpi_ev_pci_config_region_setup | 134 | * FUNCTION: acpi_ev_pci_config_region_setup |
@@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup ( | |||
158 | ******************************************************************************/ | 147 | ******************************************************************************/ |
159 | 148 | ||
160 | acpi_status | 149 | acpi_status |
161 | acpi_ev_pci_config_region_setup ( | 150 | acpi_ev_pci_config_region_setup(acpi_handle handle, |
162 | acpi_handle handle, | 151 | u32 function, |
163 | u32 function, | 152 | void *handler_context, void **region_context) |
164 | void *handler_context, | ||
165 | void **region_context) | ||
166 | { | 153 | { |
167 | acpi_status status = AE_OK; | 154 | acpi_status status = AE_OK; |
168 | acpi_integer pci_value; | 155 | acpi_integer pci_value; |
169 | struct acpi_pci_id *pci_id = *region_context; | 156 | struct acpi_pci_id *pci_id = *region_context; |
170 | union acpi_operand_object *handler_obj; | 157 | union acpi_operand_object *handler_obj; |
171 | struct acpi_namespace_node *parent_node; | 158 | struct acpi_namespace_node *parent_node; |
172 | struct acpi_namespace_node *pci_root_node; | 159 | struct acpi_namespace_node *pci_root_node; |
173 | union acpi_operand_object *region_obj = (union acpi_operand_object *) handle; | 160 | union acpi_operand_object *region_obj = |
174 | struct acpi_device_id object_hID; | 161 | (union acpi_operand_object *)handle; |
175 | 162 | struct acpi_device_id object_hID; | |
176 | 163 | ||
177 | ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup"); | 164 | ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); |
178 | |||
179 | 165 | ||
180 | handler_obj = region_obj->region.handler; | 166 | handler_obj = region_obj->region.handler; |
181 | if (!handler_obj) { | 167 | if (!handler_obj) { |
@@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup ( | |||
183 | * No installed handler. This shouldn't happen because the dispatch | 169 | * No installed handler. This shouldn't happen because the dispatch |
184 | * routine checks before we get here, but we check again just in case. | 170 | * routine checks before we get here, but we check again just in case. |
185 | */ | 171 | */ |
186 | ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, | 172 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
187 | "Attempting to init a region %p, with no handler\n", region_obj)); | 173 | "Attempting to init a region %p, with no handler\n", |
188 | return_ACPI_STATUS (AE_NOT_EXIST); | 174 | region_obj)); |
175 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
189 | } | 176 | } |
190 | 177 | ||
191 | *region_context = NULL; | 178 | *region_context = NULL; |
192 | if (function == ACPI_REGION_DEACTIVATE) { | 179 | if (function == ACPI_REGION_DEACTIVATE) { |
193 | if (pci_id) { | 180 | if (pci_id) { |
194 | ACPI_MEM_FREE (pci_id); | 181 | ACPI_MEM_FREE(pci_id); |
195 | } | 182 | } |
196 | return_ACPI_STATUS (status); | 183 | return_ACPI_STATUS(status); |
197 | } | 184 | } |
198 | 185 | ||
199 | parent_node = acpi_ns_get_parent_node (region_obj->region.node); | 186 | parent_node = acpi_ns_get_parent_node(region_obj->region.node); |
200 | 187 | ||
201 | /* | 188 | /* |
202 | * Get the _SEG and _BBN values from the device upon which the handler | 189 | * Get the _SEG and _BBN values from the device upon which the handler |
@@ -216,22 +203,28 @@ acpi_ev_pci_config_region_setup ( | |||
216 | 203 | ||
217 | pci_root_node = parent_node; | 204 | pci_root_node = parent_node; |
218 | while (pci_root_node != acpi_gbl_root_node) { | 205 | while (pci_root_node != acpi_gbl_root_node) { |
219 | status = acpi_ut_execute_HID (pci_root_node, &object_hID); | 206 | status = |
220 | if (ACPI_SUCCESS (status)) { | 207 | acpi_ut_execute_HID(pci_root_node, &object_hID); |
208 | if (ACPI_SUCCESS(status)) { | ||
221 | /* | 209 | /* |
222 | * Got a valid _HID string, check if this is a PCI root. | 210 | * Got a valid _HID string, check if this is a PCI root. |
223 | * New for ACPI 3.0: check for a PCI Express root also. | 211 | * New for ACPI 3.0: check for a PCI Express root also. |
224 | */ | 212 | */ |
225 | if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING, | 213 | if (! |
226 | sizeof (PCI_ROOT_HID_STRING)) || | 214 | (ACPI_STRNCMP |
227 | !(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING, | 215 | (object_hID.value, PCI_ROOT_HID_STRING, |
228 | sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) { | 216 | sizeof(PCI_ROOT_HID_STRING)) |
217 | || | ||
218 | !(ACPI_STRNCMP | ||
219 | (object_hID.value, | ||
220 | PCI_EXPRESS_ROOT_HID_STRING, | ||
221 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) | ||
222 | { | ||
229 | /* Install a handler for this PCI root bridge */ | 223 | /* Install a handler for this PCI root bridge */ |
230 | 224 | ||
231 | status = acpi_install_address_space_handler ((acpi_handle) pci_root_node, | 225 | status = |
232 | ACPI_ADR_SPACE_PCI_CONFIG, | 226 | acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); |
233 | ACPI_DEFAULT_HANDLER, NULL, NULL); | 227 | if (ACPI_FAILURE(status)) { |
234 | if (ACPI_FAILURE (status)) { | ||
235 | if (status == AE_SAME_HANDLER) { | 228 | if (status == AE_SAME_HANDLER) { |
236 | /* | 229 | /* |
237 | * It is OK if the handler is already installed on the root | 230 | * It is OK if the handler is already installed on the root |
@@ -239,23 +232,19 @@ acpi_ev_pci_config_region_setup ( | |||
239 | * new PCI_Config operation region, however. | 232 | * new PCI_Config operation region, however. |
240 | */ | 233 | */ |
241 | status = AE_OK; | 234 | status = AE_OK; |
242 | } | 235 | } else { |
243 | else { | 236 | ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status))); |
244 | ACPI_REPORT_ERROR (( | ||
245 | "Could not install pci_config handler for Root Bridge %4.4s, %s\n", | ||
246 | acpi_ut_get_node_name (pci_root_node), acpi_format_exception (status))); | ||
247 | } | 237 | } |
248 | } | 238 | } |
249 | break; | 239 | break; |
250 | } | 240 | } |
251 | } | 241 | } |
252 | 242 | ||
253 | pci_root_node = acpi_ns_get_parent_node (pci_root_node); | 243 | pci_root_node = acpi_ns_get_parent_node(pci_root_node); |
254 | } | 244 | } |
255 | 245 | ||
256 | /* PCI root bridge not found, use namespace root node */ | 246 | /* PCI root bridge not found, use namespace root node */ |
257 | } | 247 | } else { |
258 | else { | ||
259 | pci_root_node = handler_obj->address_space.node; | 248 | pci_root_node = handler_obj->address_space.node; |
260 | } | 249 | } |
261 | 250 | ||
@@ -264,14 +253,14 @@ acpi_ev_pci_config_region_setup ( | |||
264 | * (install_address_space_handler could have initialized it) | 253 | * (install_address_space_handler could have initialized it) |
265 | */ | 254 | */ |
266 | if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { | 255 | if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { |
267 | return_ACPI_STATUS (AE_OK); | 256 | return_ACPI_STATUS(AE_OK); |
268 | } | 257 | } |
269 | 258 | ||
270 | /* Region is still not initialized. Create a new context */ | 259 | /* Region is still not initialized. Create a new context */ |
271 | 260 | ||
272 | pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id)); | 261 | pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); |
273 | if (!pci_id) { | 262 | if (!pci_id) { |
274 | return_ACPI_STATUS (AE_NO_MEMORY); | 263 | return_ACPI_STATUS(AE_NO_MEMORY); |
275 | } | 264 | } |
276 | 265 | ||
277 | /* | 266 | /* |
@@ -283,40 +272,45 @@ acpi_ev_pci_config_region_setup ( | |||
283 | * Get the PCI device and function numbers from the _ADR object | 272 | * Get the PCI device and function numbers from the _ADR object |
284 | * contained in the parent's scope. | 273 | * contained in the parent's scope. |
285 | */ | 274 | */ |
286 | status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value); | 275 | status = |
276 | acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node, | ||
277 | &pci_value); | ||
287 | 278 | ||
288 | /* | 279 | /* |
289 | * The default is zero, and since the allocation above zeroed | 280 | * The default is zero, and since the allocation above zeroed |
290 | * the data, just do nothing on failure. | 281 | * the data, just do nothing on failure. |
291 | */ | 282 | */ |
292 | if (ACPI_SUCCESS (status)) { | 283 | if (ACPI_SUCCESS(status)) { |
293 | pci_id->device = ACPI_HIWORD (ACPI_LODWORD (pci_value)); | 284 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value)); |
294 | pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value)); | 285 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value)); |
295 | } | 286 | } |
296 | 287 | ||
297 | /* The PCI segment number comes from the _SEG method */ | 288 | /* The PCI segment number comes from the _SEG method */ |
298 | 289 | ||
299 | status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value); | 290 | status = |
300 | if (ACPI_SUCCESS (status)) { | 291 | acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node, |
301 | pci_id->segment = ACPI_LOWORD (pci_value); | 292 | &pci_value); |
293 | if (ACPI_SUCCESS(status)) { | ||
294 | pci_id->segment = ACPI_LOWORD(pci_value); | ||
302 | } | 295 | } |
303 | 296 | ||
304 | /* The PCI bus number comes from the _BBN method */ | 297 | /* The PCI bus number comes from the _BBN method */ |
305 | 298 | ||
306 | status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value); | 299 | status = |
307 | if (ACPI_SUCCESS (status)) { | 300 | acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node, |
308 | pci_id->bus = ACPI_LOWORD (pci_value); | 301 | &pci_value); |
302 | if (ACPI_SUCCESS(status)) { | ||
303 | pci_id->bus = ACPI_LOWORD(pci_value); | ||
309 | } | 304 | } |
310 | 305 | ||
311 | /* Complete this device's pci_id */ | 306 | /* Complete this device's pci_id */ |
312 | 307 | ||
313 | acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id); | 308 | acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id); |
314 | 309 | ||
315 | *region_context = pci_id; | 310 | *region_context = pci_id; |
316 | return_ACPI_STATUS (AE_OK); | 311 | return_ACPI_STATUS(AE_OK); |
317 | } | 312 | } |
318 | 313 | ||
319 | |||
320 | /******************************************************************************* | 314 | /******************************************************************************* |
321 | * | 315 | * |
322 | * FUNCTION: acpi_ev_pci_bar_region_setup | 316 | * FUNCTION: acpi_ev_pci_bar_region_setup |
@@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup ( | |||
335 | ******************************************************************************/ | 329 | ******************************************************************************/ |
336 | 330 | ||
337 | acpi_status | 331 | acpi_status |
338 | acpi_ev_pci_bar_region_setup ( | 332 | acpi_ev_pci_bar_region_setup(acpi_handle handle, |
339 | acpi_handle handle, | 333 | u32 function, |
340 | u32 function, | 334 | void *handler_context, void **region_context) |
341 | void *handler_context, | ||
342 | void **region_context) | ||
343 | { | 335 | { |
344 | ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup"); | 336 | ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); |
345 | |||
346 | 337 | ||
347 | return_ACPI_STATUS (AE_OK); | 338 | return_ACPI_STATUS(AE_OK); |
348 | } | 339 | } |
349 | 340 | ||
350 | |||
351 | /******************************************************************************* | 341 | /******************************************************************************* |
352 | * | 342 | * |
353 | * FUNCTION: acpi_ev_cmos_region_setup | 343 | * FUNCTION: acpi_ev_cmos_region_setup |
@@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup ( | |||
366 | ******************************************************************************/ | 356 | ******************************************************************************/ |
367 | 357 | ||
368 | acpi_status | 358 | acpi_status |
369 | acpi_ev_cmos_region_setup ( | 359 | acpi_ev_cmos_region_setup(acpi_handle handle, |
370 | acpi_handle handle, | 360 | u32 function, |
371 | u32 function, | 361 | void *handler_context, void **region_context) |
372 | void *handler_context, | ||
373 | void **region_context) | ||
374 | { | 362 | { |
375 | ACPI_FUNCTION_TRACE ("ev_cmos_region_setup"); | 363 | ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); |
376 | |||
377 | 364 | ||
378 | return_ACPI_STATUS (AE_OK); | 365 | return_ACPI_STATUS(AE_OK); |
379 | } | 366 | } |
380 | 367 | ||
381 | |||
382 | /******************************************************************************* | 368 | /******************************************************************************* |
383 | * | 369 | * |
384 | * FUNCTION: acpi_ev_default_region_setup | 370 | * FUNCTION: acpi_ev_default_region_setup |
@@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup ( | |||
395 | ******************************************************************************/ | 381 | ******************************************************************************/ |
396 | 382 | ||
397 | acpi_status | 383 | acpi_status |
398 | acpi_ev_default_region_setup ( | 384 | acpi_ev_default_region_setup(acpi_handle handle, |
399 | acpi_handle handle, | 385 | u32 function, |
400 | u32 function, | 386 | void *handler_context, void **region_context) |
401 | void *handler_context, | ||
402 | void **region_context) | ||
403 | { | 387 | { |
404 | ACPI_FUNCTION_TRACE ("ev_default_region_setup"); | 388 | ACPI_FUNCTION_TRACE("ev_default_region_setup"); |
405 | |||
406 | 389 | ||
407 | if (function == ACPI_REGION_DEACTIVATE) { | 390 | if (function == ACPI_REGION_DEACTIVATE) { |
408 | *region_context = NULL; | 391 | *region_context = NULL; |
409 | } | 392 | } else { |
410 | else { | ||
411 | *region_context = handler_context; | 393 | *region_context = handler_context; |
412 | } | 394 | } |
413 | 395 | ||
414 | return_ACPI_STATUS (AE_OK); | 396 | return_ACPI_STATUS(AE_OK); |
415 | } | 397 | } |
416 | 398 | ||
417 | |||
418 | /******************************************************************************* | 399 | /******************************************************************************* |
419 | * | 400 | * |
420 | * FUNCTION: acpi_ev_initialize_region | 401 | * FUNCTION: acpi_ev_initialize_region |
@@ -438,37 +419,34 @@ acpi_ev_default_region_setup ( | |||
438 | ******************************************************************************/ | 419 | ******************************************************************************/ |
439 | 420 | ||
440 | acpi_status | 421 | acpi_status |
441 | acpi_ev_initialize_region ( | 422 | acpi_ev_initialize_region(union acpi_operand_object *region_obj, |
442 | union acpi_operand_object *region_obj, | 423 | u8 acpi_ns_locked) |
443 | u8 acpi_ns_locked) | ||
444 | { | 424 | { |
445 | union acpi_operand_object *handler_obj; | 425 | union acpi_operand_object *handler_obj; |
446 | union acpi_operand_object *obj_desc; | 426 | union acpi_operand_object *obj_desc; |
447 | acpi_adr_space_type space_id; | 427 | acpi_adr_space_type space_id; |
448 | struct acpi_namespace_node *node; | 428 | struct acpi_namespace_node *node; |
449 | acpi_status status; | 429 | acpi_status status; |
450 | struct acpi_namespace_node *method_node; | 430 | struct acpi_namespace_node *method_node; |
451 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | 431 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; |
452 | union acpi_operand_object *region_obj2; | 432 | union acpi_operand_object *region_obj2; |
453 | |||
454 | |||
455 | ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked); | ||
456 | 433 | ||
434 | ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); | ||
457 | 435 | ||
458 | if (!region_obj) { | 436 | if (!region_obj) { |
459 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 437 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
460 | } | 438 | } |
461 | 439 | ||
462 | if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) { | 440 | if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) { |
463 | return_ACPI_STATUS (AE_OK); | 441 | return_ACPI_STATUS(AE_OK); |
464 | } | 442 | } |
465 | 443 | ||
466 | region_obj2 = acpi_ns_get_secondary_object (region_obj); | 444 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
467 | if (!region_obj2) { | 445 | if (!region_obj2) { |
468 | return_ACPI_STATUS (AE_NOT_EXIST); | 446 | return_ACPI_STATUS(AE_NOT_EXIST); |
469 | } | 447 | } |
470 | 448 | ||
471 | node = acpi_ns_get_parent_node (region_obj->region.node); | 449 | node = acpi_ns_get_parent_node(region_obj->region.node); |
472 | space_id = region_obj->region.space_id; | 450 | space_id = region_obj->region.space_id; |
473 | 451 | ||
474 | /* Setup defaults */ | 452 | /* Setup defaults */ |
@@ -480,9 +458,9 @@ acpi_ev_initialize_region ( | |||
480 | 458 | ||
481 | /* Find any "_REG" method associated with this region definition */ | 459 | /* Find any "_REG" method associated with this region definition */ |
482 | 460 | ||
483 | status = acpi_ns_search_node (*reg_name_ptr, node, | 461 | status = acpi_ns_search_node(*reg_name_ptr, node, |
484 | ACPI_TYPE_METHOD, &method_node); | 462 | ACPI_TYPE_METHOD, &method_node); |
485 | if (ACPI_SUCCESS (status)) { | 463 | if (ACPI_SUCCESS(status)) { |
486 | /* | 464 | /* |
487 | * The _REG method is optional and there can be only one per region | 465 | * The _REG method is optional and there can be only one per region |
488 | * definition. This will be executed when the handler is attached | 466 | * definition. This will be executed when the handler is attached |
@@ -499,7 +477,7 @@ acpi_ev_initialize_region ( | |||
499 | /* Check to see if a handler exists */ | 477 | /* Check to see if a handler exists */ |
500 | 478 | ||
501 | handler_obj = NULL; | 479 | handler_obj = NULL; |
502 | obj_desc = acpi_ns_get_attached_object (node); | 480 | obj_desc = acpi_ns_get_attached_object(node); |
503 | if (obj_desc) { | 481 | if (obj_desc) { |
504 | /* Can only be a handler if the object exists */ | 482 | /* Can only be a handler if the object exists */ |
505 | 483 | ||
@@ -527,37 +505,50 @@ acpi_ev_initialize_region ( | |||
527 | while (handler_obj) { | 505 | while (handler_obj) { |
528 | /* Is this handler of the correct type? */ | 506 | /* Is this handler of the correct type? */ |
529 | 507 | ||
530 | if (handler_obj->address_space.space_id == space_id) { | 508 | if (handler_obj->address_space.space_id == |
509 | space_id) { | ||
531 | /* Found correct handler */ | 510 | /* Found correct handler */ |
532 | 511 | ||
533 | ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, | 512 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
534 | "Found handler %p for region %p in obj %p\n", | 513 | "Found handler %p for region %p in obj %p\n", |
535 | handler_obj, region_obj, obj_desc)); | 514 | handler_obj, |
515 | region_obj, | ||
516 | obj_desc)); | ||
536 | 517 | ||
537 | status = acpi_ev_attach_region (handler_obj, region_obj, | 518 | status = |
538 | acpi_ns_locked); | 519 | acpi_ev_attach_region(handler_obj, |
520 | region_obj, | ||
521 | acpi_ns_locked); | ||
539 | 522 | ||
540 | /* | 523 | /* |
541 | * Tell all users that this region is usable by running the _REG | 524 | * Tell all users that this region is usable by running the _REG |
542 | * method | 525 | * method |
543 | */ | 526 | */ |
544 | if (acpi_ns_locked) { | 527 | if (acpi_ns_locked) { |
545 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 528 | status = |
546 | if (ACPI_FAILURE (status)) { | 529 | acpi_ut_release_mutex |
547 | return_ACPI_STATUS (status); | 530 | (ACPI_MTX_NAMESPACE); |
531 | if (ACPI_FAILURE(status)) { | ||
532 | return_ACPI_STATUS | ||
533 | (status); | ||
548 | } | 534 | } |
549 | } | 535 | } |
550 | 536 | ||
551 | status = acpi_ev_execute_reg_method (region_obj, 1); | 537 | status = |
538 | acpi_ev_execute_reg_method | ||
539 | (region_obj, 1); | ||
552 | 540 | ||
553 | if (acpi_ns_locked) { | 541 | if (acpi_ns_locked) { |
554 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 542 | status = |
555 | if (ACPI_FAILURE (status)) { | 543 | acpi_ut_acquire_mutex |
556 | return_ACPI_STATUS (status); | 544 | (ACPI_MTX_NAMESPACE); |
545 | if (ACPI_FAILURE(status)) { | ||
546 | return_ACPI_STATUS | ||
547 | (status); | ||
557 | } | 548 | } |
558 | } | 549 | } |
559 | 550 | ||
560 | return_ACPI_STATUS (AE_OK); | 551 | return_ACPI_STATUS(AE_OK); |
561 | } | 552 | } |
562 | 553 | ||
563 | /* Try next handler in the list */ | 554 | /* Try next handler in the list */ |
@@ -570,15 +561,15 @@ acpi_ev_initialize_region ( | |||
570 | * This node does not have the handler we need; | 561 | * This node does not have the handler we need; |
571 | * Pop up one level | 562 | * Pop up one level |
572 | */ | 563 | */ |
573 | node = acpi_ns_get_parent_node (node); | 564 | node = acpi_ns_get_parent_node(node); |
574 | } | 565 | } |
575 | 566 | ||
576 | /* If we get here, there is no handler for this region */ | 567 | /* If we get here, there is no handler for this region */ |
577 | 568 | ||
578 | ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
579 | "No handler for region_type %s(%X) (region_obj %p)\n", | 570 | "No handler for region_type %s(%X) (region_obj %p)\n", |
580 | acpi_ut_get_region_name (space_id), space_id, region_obj)); | 571 | acpi_ut_get_region_name(space_id), space_id, |
572 | region_obj)); | ||
581 | 573 | ||
582 | return_ACPI_STATUS (AE_NOT_EXIST); | 574 | return_ACPI_STATUS(AE_NOT_EXIST); |
583 | } | 575 | } |
584 | |||