diff options
author | Bob Moore <robert.moore@intel.com> | 2015-12-29 01:01:53 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-31 21:47:37 -0500 |
commit | 7b73806485ada16059ecc1851793dbe865181c53 (patch) | |
tree | f8f93be685a46b3313671715dbc28c358a33bf13 /drivers/acpi | |
parent | 3c5d3d2543b1c541b601af27998175c3ea8bb617 (diff) |
ACPICA: Cleanup code related to the per-table module level improvement
ACPICA commit 071eff738c59eda1792ac24b3b688b61691d7e7c
This patch collects cleanups from per-table module level improvement. By
splitting this patch from that commit, we can make per-table module level
improvement clearer for the revewers. This is a no-op change.
Link: https://github.com/acpica/acpica/commit/071eff73
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acglobal.h | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/evhandler.c | 113 | ||||
-rw-r--r-- | drivers/acpi/acpica/evregion.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/evrgnini.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exdump.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxfinit.c | 7 |
6 files changed, 91 insertions, 44 deletions
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 3977134f2619..ef0abf4ef9ac 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -145,6 +145,7 @@ ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache); | |||
145 | 145 | ||
146 | ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); | 146 | ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); |
147 | ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); | 147 | ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); |
148 | ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE); | ||
148 | 149 | ||
149 | /* Global handlers */ | 150 | /* Global handlers */ |
150 | 151 | ||
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c index 74e8595f5a2b..5d6a3b590645 100644 --- a/drivers/acpi/acpica/evhandler.c +++ b/drivers/acpi/acpica/evhandler.c | |||
@@ -55,6 +55,10 @@ static acpi_status | |||
55 | acpi_ev_install_handler(acpi_handle obj_handle, | 55 | acpi_ev_install_handler(acpi_handle obj_handle, |
56 | u32 level, void *context, void **return_value); | 56 | u32 level, void *context, void **return_value); |
57 | 57 | ||
58 | static union acpi_operand_object | ||
59 | *acpi_ev_find_region_handler(acpi_adr_space_type space_id, | ||
60 | union acpi_operand_object *handler_obj); | ||
61 | |||
58 | /* These are the address spaces that will get default handlers */ | 62 | /* These are the address spaces that will get default handlers */ |
59 | 63 | ||
60 | u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { | 64 | u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { |
@@ -309,6 +313,43 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
309 | 313 | ||
310 | /******************************************************************************* | 314 | /******************************************************************************* |
311 | * | 315 | * |
316 | * FUNCTION: acpi_ev_find_region_handler | ||
317 | * | ||
318 | * PARAMETERS: space_id - The address space ID | ||
319 | * handler_obj - Head of the handler object list | ||
320 | * | ||
321 | * RETURN: Matching handler object. NULL if space ID not matched | ||
322 | * | ||
323 | * DESCRIPTION: Search a handler object list for a match on the address | ||
324 | * space ID. | ||
325 | * | ||
326 | ******************************************************************************/ | ||
327 | |||
328 | static union acpi_operand_object | ||
329 | *acpi_ev_find_region_handler(acpi_adr_space_type space_id, | ||
330 | union acpi_operand_object *handler_obj) | ||
331 | { | ||
332 | |||
333 | /* Walk the handler list for this device */ | ||
334 | |||
335 | while (handler_obj) { | ||
336 | |||
337 | /* Same space_id indicates a handler is installed */ | ||
338 | |||
339 | if (handler_obj->address_space.space_id == space_id) { | ||
340 | return (handler_obj); | ||
341 | } | ||
342 | |||
343 | /* Next handler object */ | ||
344 | |||
345 | handler_obj = handler_obj->address_space.next; | ||
346 | } | ||
347 | |||
348 | return (NULL); | ||
349 | } | ||
350 | |||
351 | /******************************************************************************* | ||
352 | * | ||
312 | * FUNCTION: acpi_ev_install_space_handler | 353 | * FUNCTION: acpi_ev_install_space_handler |
313 | * | 354 | * |
314 | * PARAMETERS: node - Namespace node for the device | 355 | * PARAMETERS: node - Namespace node for the device |
@@ -332,15 +373,15 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
332 | { | 373 | { |
333 | union acpi_operand_object *obj_desc; | 374 | union acpi_operand_object *obj_desc; |
334 | union acpi_operand_object *handler_obj; | 375 | union acpi_operand_object *handler_obj; |
335 | acpi_status status; | 376 | acpi_status status = AE_OK; |
336 | acpi_object_type type; | 377 | acpi_object_type type; |
337 | u8 flags = 0; | 378 | u8 flags = 0; |
338 | 379 | ||
339 | ACPI_FUNCTION_TRACE(ev_install_space_handler); | 380 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
340 | 381 | ||
341 | /* | 382 | /* |
342 | * This registration is valid for only the types below and the root. This | 383 | * This registration is valid for only the types below and the root. |
343 | * is where the default handlers get placed. | 384 | * The root node is where the default handlers get installed. |
344 | */ | 385 | */ |
345 | if ((node->type != ACPI_TYPE_DEVICE) && | 386 | if ((node->type != ACPI_TYPE_DEVICE) && |
346 | (node->type != ACPI_TYPE_PROCESSOR) && | 387 | (node->type != ACPI_TYPE_PROCESSOR) && |
@@ -407,38 +448,29 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
407 | obj_desc = acpi_ns_get_attached_object(node); | 448 | obj_desc = acpi_ns_get_attached_object(node); |
408 | if (obj_desc) { | 449 | if (obj_desc) { |
409 | /* | 450 | /* |
410 | * The attached device object already exists. Make sure the handler | 451 | * The attached device object already exists. Now make sure |
411 | * is not already installed. | 452 | * the handler is not already installed. |
412 | */ | 453 | */ |
413 | handler_obj = obj_desc->device.handler; | 454 | handler_obj = acpi_ev_find_region_handler(space_id, |
414 | 455 | obj_desc->device. | |
415 | /* Walk the handler list for this device */ | 456 | handler); |
416 | |||
417 | while (handler_obj) { | ||
418 | 457 | ||
419 | /* Same space_id indicates a handler already installed */ | 458 | if (handler_obj) { |
420 | 459 | if (handler_obj->address_space.handler == handler) { | |
421 | if (handler_obj->address_space.space_id == space_id) { | 460 | /* |
422 | if (handler_obj->address_space.handler == | 461 | * It is (relatively) OK to attempt to install the SAME |
423 | handler) { | 462 | * handler twice. This can easily happen with the |
424 | /* | 463 | * PCI_Config space. |
425 | * It is (relatively) OK to attempt to install the SAME | 464 | */ |
426 | * handler twice. This can easily happen with the | 465 | status = AE_SAME_HANDLER; |
427 | * PCI_Config space. | ||
428 | */ | ||
429 | status = AE_SAME_HANDLER; | ||
430 | goto unlock_and_exit; | ||
431 | } else { | ||
432 | /* A handler is already installed */ | ||
433 | |||
434 | status = AE_ALREADY_EXISTS; | ||
435 | } | ||
436 | goto unlock_and_exit; | 466 | goto unlock_and_exit; |
437 | } | 467 | } else { |
468 | /* A handler is already installed */ | ||
438 | 469 | ||
439 | /* Walk the linked list of handlers */ | 470 | status = AE_ALREADY_EXISTS; |
471 | } | ||
440 | 472 | ||
441 | handler_obj = handler_obj->address_space.next; | 473 | goto unlock_and_exit; |
442 | } | 474 | } |
443 | } else { | 475 | } else { |
444 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 476 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -477,7 +509,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
477 | } | 509 | } |
478 | 510 | ||
479 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 511 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
480 | "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", | 512 | "Installing address handler for region %s(%X) " |
513 | "on Device %4.4s %p(%p)\n", | ||
481 | acpi_ut_get_region_name(space_id), space_id, | 514 | acpi_ut_get_region_name(space_id), space_id, |
482 | acpi_ut_get_node_name(node), node, obj_desc)); | 515 | acpi_ut_get_node_name(node), node, obj_desc)); |
483 | 516 | ||
@@ -515,19 +548,17 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
515 | obj_desc->device.handler = handler_obj; | 548 | obj_desc->device.handler = handler_obj; |
516 | 549 | ||
517 | /* | 550 | /* |
518 | * Walk the namespace finding all of the regions this | 551 | * Walk the namespace finding all of the regions this handler will |
519 | * handler will manage. | 552 | * manage. |
520 | * | 553 | * |
521 | * Start at the device and search the branch toward | 554 | * Start at the device and search the branch toward the leaf nodes |
522 | * the leaf nodes until either the leaf is encountered or | 555 | * until either the leaf is encountered or a device is detected that |
523 | * a device is detected that has an address handler of the | 556 | * has an address handler of the same type. |
524 | * same type. | ||
525 | * | 557 | * |
526 | * In either case, back up and search down the remainder | 558 | * In either case, back up and search down the remainder of the branch |
527 | * of the branch | ||
528 | */ | 559 | */ |
529 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | 560 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, |
530 | ACPI_NS_WALK_UNLOCK, | 561 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
531 | acpi_ev_install_handler, NULL, | 562 | acpi_ev_install_handler, NULL, |
532 | handler_obj, NULL); | 563 | handler_obj, NULL); |
533 | 564 | ||
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 5ee79a16fe33..6717e57604d3 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -127,6 +127,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
127 | * DESCRIPTION: Dispatch an address space or operation region access to | 127 | * DESCRIPTION: Dispatch an address space or operation region access to |
128 | * a previously installed handler. | 128 | * a previously installed handler. |
129 | * | 129 | * |
130 | * NOTE: During early initialization, we always install the default region | ||
131 | * handlers for Memory, I/O and PCI_Config. This ensures that these operation | ||
132 | * region address spaces are always available as per the ACPI specification. | ||
133 | * This is especially needed in order to support the execution of | ||
134 | * module-level AML code during loading of the ACPI tables. | ||
135 | * | ||
130 | ******************************************************************************/ | 136 | ******************************************************************************/ |
131 | 137 | ||
132 | acpi_status | 138 | acpi_status |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index da323390bb70..6181f5a2af4f 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -552,7 +552,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
552 | 552 | ||
553 | /* | 553 | /* |
554 | * The following loop depends upon the root Node having no parent | 554 | * The following loop depends upon the root Node having no parent |
555 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 555 | * ie: acpi_gbl_root_node->Parent being set to NULL |
556 | */ | 556 | */ |
557 | while (node) { | 557 | while (node) { |
558 | 558 | ||
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index d836f888bb16..ff976c43b992 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -508,7 +508,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
508 | if (next) { | 508 | if (next) { |
509 | acpi_os_printf("(%s %2.2X)", | 509 | acpi_os_printf("(%s %2.2X)", |
510 | acpi_ut_get_object_type_name | 510 | acpi_ut_get_object_type_name |
511 | (next), next->common.type); | 511 | (next), |
512 | next->address_space.space_id); | ||
512 | 513 | ||
513 | while (next->address_space.next) { | 514 | while (next->address_space.next) { |
514 | if ((next->common.type == | 515 | if ((next->common.type == |
@@ -520,7 +521,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
520 | acpi_os_printf("->%p(%s %2.2X)", next, | 521 | acpi_os_printf("->%p(%s %2.2X)", next, |
521 | acpi_ut_get_object_type_name | 522 | acpi_ut_get_object_type_name |
522 | (next), | 523 | (next), |
523 | next->common.type); | 524 | next->address_space. |
525 | space_id); | ||
524 | 526 | ||
525 | if ((next == start) || (next == data)) { | 527 | if ((next == start) || (next == data)) { |
526 | acpi_os_printf | 528 | acpi_os_printf |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index a7137ec28447..8586260f94cc 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -147,6 +147,13 @@ acpi_status __init acpi_enable_subsystem(u32 flags) | |||
147 | 147 | ||
148 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | 148 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
149 | 149 | ||
150 | /* | ||
151 | * The early initialization phase is complete. The namespace is loaded, | ||
152 | * and we can now support address spaces other than Memory, I/O, and | ||
153 | * PCI_Config. | ||
154 | */ | ||
155 | acpi_gbl_early_initialization = FALSE; | ||
156 | |||
150 | #if (!ACPI_REDUCED_HARDWARE) | 157 | #if (!ACPI_REDUCED_HARDWARE) |
151 | 158 | ||
152 | /* Enable ACPI mode */ | 159 | /* Enable ACPI mode */ |