diff options
Diffstat (limited to 'drivers/acpi/events/evrgnini.c')
-rw-r--r-- | drivers/acpi/events/evrgnini.c | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index baed8c1a1b9f..5b3c7a85eb9a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
71 | (union acpi_operand_object *)handle; | 71 | (union acpi_operand_object *)handle; |
72 | struct acpi_mem_space_context *local_region_context; | 72 | struct acpi_mem_space_context *local_region_context; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); | 74 | ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); |
75 | 75 | ||
76 | if (function == ACPI_REGION_DEACTIVATE) { | 76 | if (function == ACPI_REGION_DEACTIVATE) { |
77 | if (*region_context) { | 77 | if (*region_context) { |
78 | ACPI_MEM_FREE(*region_context); | 78 | local_region_context = |
79 | (struct acpi_mem_space_context *)*region_context; | ||
80 | |||
81 | /* Delete a cached mapping if present */ | ||
82 | |||
83 | if (local_region_context->mapped_length) { | ||
84 | acpi_os_unmap_memory(local_region_context-> | ||
85 | mapped_logical_address, | ||
86 | local_region_context-> | ||
87 | mapped_length); | ||
88 | } | ||
89 | ACPI_FREE(local_region_context); | ||
79 | *region_context = NULL; | 90 | *region_context = NULL; |
80 | } | 91 | } |
81 | return_ACPI_STATUS(AE_OK); | 92 | return_ACPI_STATUS(AE_OK); |
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
84 | /* Create a new context */ | 95 | /* Create a new context */ |
85 | 96 | ||
86 | local_region_context = | 97 | local_region_context = |
87 | ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); | 98 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); |
88 | if (!(local_region_context)) { | 99 | if (!(local_region_context)) { |
89 | return_ACPI_STATUS(AE_NO_MEMORY); | 100 | return_ACPI_STATUS(AE_NO_MEMORY); |
90 | } | 101 | } |
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle, | |||
118 | u32 function, | 129 | u32 function, |
119 | void *handler_context, void **region_context) | 130 | void *handler_context, void **region_context) |
120 | { | 131 | { |
121 | ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); | 132 | ACPI_FUNCTION_TRACE(ev_io_space_region_setup); |
122 | 133 | ||
123 | if (function == ACPI_REGION_DEACTIVATE) { | 134 | if (function == ACPI_REGION_DEACTIVATE) { |
124 | *region_context = NULL; | 135 | *region_context = NULL; |
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
161 | (union acpi_operand_object *)handle; | 172 | (union acpi_operand_object *)handle; |
162 | struct acpi_device_id object_hID; | 173 | struct acpi_device_id object_hID; |
163 | 174 | ||
164 | ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); | 175 | ACPI_FUNCTION_TRACE(ev_pci_config_region_setup); |
165 | 176 | ||
166 | handler_obj = region_obj->region.handler; | 177 | handler_obj = region_obj->region.handler; |
167 | if (!handler_obj) { | 178 | if (!handler_obj) { |
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
178 | *region_context = NULL; | 189 | *region_context = NULL; |
179 | if (function == ACPI_REGION_DEACTIVATE) { | 190 | if (function == ACPI_REGION_DEACTIVATE) { |
180 | if (pci_id) { | 191 | if (pci_id) { |
181 | ACPI_MEM_FREE(pci_id); | 192 | ACPI_FREE(pci_id); |
182 | } | 193 | } |
183 | return_ACPI_STATUS(status); | 194 | return_ACPI_STATUS(status); |
184 | } | 195 | } |
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
199 | * handlers with that device. | 210 | * handlers with that device. |
200 | */ | 211 | */ |
201 | if (handler_obj->address_space.node == acpi_gbl_root_node) { | 212 | if (handler_obj->address_space.node == acpi_gbl_root_node) { |
213 | |||
202 | /* Start search from the parent object */ | 214 | /* Start search from the parent object */ |
203 | 215 | ||
204 | pci_root_node = parent_node; | 216 | pci_root_node = parent_node; |
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
220 | PCI_EXPRESS_ROOT_HID_STRING, | 232 | PCI_EXPRESS_ROOT_HID_STRING, |
221 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) | 233 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) |
222 | { | 234 | { |
235 | |||
223 | /* Install a handler for this PCI root bridge */ | 236 | /* Install a handler for this PCI root bridge */ |
224 | 237 | ||
225 | status = | 238 | status = |
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
235 | } else { | 248 | } else { |
236 | ACPI_EXCEPTION((AE_INFO, | 249 | ACPI_EXCEPTION((AE_INFO, |
237 | status, | 250 | status, |
238 | "Could not install pci_config handler for Root Bridge %4.4s", | 251 | "Could not install PciConfig handler for Root Bridge %4.4s", |
239 | acpi_ut_get_node_name | 252 | acpi_ut_get_node_name |
240 | (pci_root_node))); | 253 | (pci_root_node))); |
241 | } | 254 | } |
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
262 | 275 | ||
263 | /* Region is still not initialized. Create a new context */ | 276 | /* Region is still not initialized. Create a new context */ |
264 | 277 | ||
265 | pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); | 278 | pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); |
266 | if (!pci_id) { | 279 | if (!pci_id) { |
267 | return_ACPI_STATUS(AE_NO_MEMORY); | 280 | return_ACPI_STATUS(AE_NO_MEMORY); |
268 | } | 281 | } |
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle, | |||
337 | u32 function, | 350 | u32 function, |
338 | void *handler_context, void **region_context) | 351 | void *handler_context, void **region_context) |
339 | { | 352 | { |
340 | ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); | 353 | ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup); |
341 | 354 | ||
342 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
343 | } | 356 | } |
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle, | |||
364 | u32 function, | 377 | u32 function, |
365 | void *handler_context, void **region_context) | 378 | void *handler_context, void **region_context) |
366 | { | 379 | { |
367 | ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); | 380 | ACPI_FUNCTION_TRACE(ev_cmos_region_setup); |
368 | 381 | ||
369 | return_ACPI_STATUS(AE_OK); | 382 | return_ACPI_STATUS(AE_OK); |
370 | } | 383 | } |
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle, | |||
389 | u32 function, | 402 | u32 function, |
390 | void *handler_context, void **region_context) | 403 | void *handler_context, void **region_context) |
391 | { | 404 | { |
392 | ACPI_FUNCTION_TRACE("ev_default_region_setup"); | 405 | ACPI_FUNCTION_TRACE(ev_default_region_setup); |
393 | 406 | ||
394 | if (function == ACPI_REGION_DEACTIVATE) { | 407 | if (function == ACPI_REGION_DEACTIVATE) { |
395 | *region_context = NULL; | 408 | *region_context = NULL; |
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
435 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | 448 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; |
436 | union acpi_operand_object *region_obj2; | 449 | union acpi_operand_object *region_obj2; |
437 | 450 | ||
438 | ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); | 451 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
439 | 452 | ||
440 | if (!region_obj) { | 453 | if (!region_obj) { |
441 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 454 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
462 | 475 | ||
463 | /* Find any "_REG" method associated with this region definition */ | 476 | /* Find any "_REG" method associated with this region definition */ |
464 | 477 | ||
465 | status = acpi_ns_search_node(*reg_name_ptr, node, | 478 | status = |
466 | ACPI_TYPE_METHOD, &method_node); | 479 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, |
480 | &method_node); | ||
467 | if (ACPI_SUCCESS(status)) { | 481 | if (ACPI_SUCCESS(status)) { |
468 | /* | 482 | /* |
469 | * The _REG method is optional and there can be only one per region | 483 | * The _REG method is optional and there can be only one per region |
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
478 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 492 | * ie: acpi_gbl_root_node->parent_entry being set to NULL |
479 | */ | 493 | */ |
480 | while (node) { | 494 | while (node) { |
495 | |||
481 | /* Check to see if a handler exists */ | 496 | /* Check to see if a handler exists */ |
482 | 497 | ||
483 | handler_obj = NULL; | 498 | handler_obj = NULL; |
484 | obj_desc = acpi_ns_get_attached_object(node); | 499 | obj_desc = acpi_ns_get_attached_object(node); |
485 | if (obj_desc) { | 500 | if (obj_desc) { |
501 | |||
486 | /* Can only be a handler if the object exists */ | 502 | /* Can only be a handler if the object exists */ |
487 | 503 | ||
488 | switch (node->type) { | 504 | switch (node->type) { |
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
507 | } | 523 | } |
508 | 524 | ||
509 | while (handler_obj) { | 525 | while (handler_obj) { |
526 | |||
510 | /* Is this handler of the correct type? */ | 527 | /* Is this handler of the correct type? */ |
511 | 528 | ||
512 | if (handler_obj->address_space.space_id == | 529 | if (handler_obj->address_space.space_id == |
513 | space_id) { | 530 | space_id) { |
531 | |||
514 | /* Found correct handler */ | 532 | /* Found correct handler */ |
515 | 533 | ||
516 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 534 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
571 | /* If we get here, there is no handler for this region */ | 589 | /* If we get here, there is no handler for this region */ |
572 | 590 | ||
573 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
574 | "No handler for region_type %s(%X) (region_obj %p)\n", | 592 | "No handler for RegionType %s(%X) (RegionObj %p)\n", |
575 | acpi_ut_get_region_name(space_id), space_id, | 593 | acpi_ut_get_region_name(space_id), space_id, |
576 | region_obj)); | 594 | region_obj)); |
577 | 595 | ||