diff options
author | Lin Ming <ming.m.lin@intel.com> | 2008-04-10 11:06:38 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 14:29:24 -0400 |
commit | 3e08e2d2d6efb256aa035e300deb059bb333b6db (patch) | |
tree | 33a83f051ad4370f486f4e6d3e19615d5fc11b8b /drivers | |
parent | 698c0a0c299bd9389522e14dae1aff02070bac25 (diff) |
ACPICA: New interfaces for table event handlers
Designed and implemented new external interfaces to install and
remove handlers for ACPI table-related events. Current events that
are defined are LOAD and UNLOAD. These interfaces allow the host to
track ACPI tables as they are dynamically loaded and unloaded. See
AcpiInstallTableHandler and AcpiRemoveTableHandler.
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/executer/exconfig.c | 29 | ||||
-rw-r--r-- | drivers/acpi/tables/tbxface.c | 89 | ||||
-rw-r--r-- | drivers/acpi/utilities/utglobal.c | 3 |
3 files changed, 119 insertions, 2 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 25802f302ffe..009aef5fcbfc 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -234,6 +234,13 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
234 | table->oem_table_id)); | 234 | table->oem_table_id)); |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Invoke table handler if present */ | ||
238 | |||
239 | if (acpi_gbl_table_handler) { | ||
240 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table, | ||
241 | acpi_gbl_table_handler_context); | ||
242 | } | ||
243 | |||
237 | *return_desc = ddb_handle; | 244 | *return_desc = ddb_handle; |
238 | return_ACPI_STATUS(status); | 245 | return_ACPI_STATUS(status); |
239 | } | 246 | } |
@@ -352,6 +359,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
352 | return_ACPI_STATUS(status); | 359 | return_ACPI_STATUS(status); |
353 | } | 360 | } |
354 | 361 | ||
362 | /* Invoke table handler if present */ | ||
363 | |||
364 | if (acpi_gbl_table_handler) { | ||
365 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, | ||
366 | table_desc.pointer, | ||
367 | acpi_gbl_table_handler_context); | ||
368 | } | ||
369 | |||
355 | cleanup: | 370 | cleanup: |
356 | if (ACPI_FAILURE(status)) { | 371 | if (ACPI_FAILURE(status)) { |
357 | acpi_tb_delete_table(&table_desc); | 372 | acpi_tb_delete_table(&table_desc); |
@@ -376,6 +391,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
376 | acpi_status status = AE_OK; | 391 | acpi_status status = AE_OK; |
377 | union acpi_operand_object *table_desc = ddb_handle; | 392 | union acpi_operand_object *table_desc = ddb_handle; |
378 | acpi_native_uint table_index; | 393 | acpi_native_uint table_index; |
394 | struct acpi_table_header *table; | ||
379 | 395 | ||
380 | ACPI_FUNCTION_TRACE(ex_unload_table); | 396 | ACPI_FUNCTION_TRACE(ex_unload_table); |
381 | 397 | ||
@@ -395,6 +411,17 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
395 | 411 | ||
396 | table_index = (acpi_native_uint) table_desc->reference.object; | 412 | table_index = (acpi_native_uint) table_desc->reference.object; |
397 | 413 | ||
414 | /* Invoke table handler if present */ | ||
415 | |||
416 | if (acpi_gbl_table_handler) { | ||
417 | status = acpi_get_table_by_index(table_index, &table); | ||
418 | if (ACPI_SUCCESS(status)) { | ||
419 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, | ||
420 | table, | ||
421 | acpi_gbl_table_handler_context); | ||
422 | } | ||
423 | } | ||
424 | |||
398 | /* | 425 | /* |
399 | * Delete the entire namespace under this table Node | 426 | * Delete the entire namespace under this table Node |
400 | * (Offset contains the table_id) | 427 | * (Offset contains the table_id) |
@@ -407,5 +434,5 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
407 | /* Delete the table descriptor (ddb_handle) */ | 434 | /* Delete the table descriptor (ddb_handle) */ |
408 | 435 | ||
409 | acpi_ut_remove_reference(table_desc); | 436 | acpi_ut_remove_reference(table_desc); |
410 | return_ACPI_STATUS(status); | 437 | return_ACPI_STATUS(AE_OK); |
411 | } | 438 | } |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index a9e3331fee5d..5f2271542a96 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -635,6 +635,95 @@ acpi_status acpi_load_tables(void) | |||
635 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | 635 | ACPI_EXPORT_SYMBOL(acpi_load_tables) |
636 | 636 | ||
637 | 637 | ||
638 | /******************************************************************************* | ||
639 | * | ||
640 | * FUNCTION: acpi_install_table_handler | ||
641 | * | ||
642 | * PARAMETERS: Handler - Table event handler | ||
643 | * Context - Value passed to the handler on each event | ||
644 | * | ||
645 | * RETURN: Status | ||
646 | * | ||
647 | * DESCRIPTION: Install table event handler | ||
648 | * | ||
649 | ******************************************************************************/ | ||
650 | acpi_status | ||
651 | acpi_install_table_handler(acpi_tbl_handler handler, void *context) | ||
652 | { | ||
653 | acpi_status status; | ||
654 | |||
655 | ACPI_FUNCTION_TRACE(acpi_install_table_handler); | ||
656 | |||
657 | if (!handler) { | ||
658 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
659 | } | ||
660 | |||
661 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
662 | if (ACPI_FAILURE(status)) { | ||
663 | return_ACPI_STATUS(status); | ||
664 | } | ||
665 | |||
666 | /* Don't allow more than one handler */ | ||
667 | |||
668 | if (acpi_gbl_table_handler) { | ||
669 | status = AE_ALREADY_EXISTS; | ||
670 | goto cleanup; | ||
671 | } | ||
672 | |||
673 | /* Install the handler */ | ||
674 | |||
675 | acpi_gbl_table_handler = handler; | ||
676 | acpi_gbl_table_handler_context = context; | ||
677 | |||
678 | cleanup: | ||
679 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
680 | return_ACPI_STATUS(status); | ||
681 | } | ||
682 | |||
683 | ACPI_EXPORT_SYMBOL(acpi_install_table_handler) | ||
684 | |||
685 | /******************************************************************************* | ||
686 | * | ||
687 | * FUNCTION: acpi_remove_table_handler | ||
688 | * | ||
689 | * PARAMETERS: Handler - Table event handler that was installed | ||
690 | * previously. | ||
691 | * | ||
692 | * RETURN: Status | ||
693 | * | ||
694 | * DESCRIPTION: Remove table event handler | ||
695 | * | ||
696 | ******************************************************************************/ | ||
697 | acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) | ||
698 | { | ||
699 | acpi_status status; | ||
700 | |||
701 | ACPI_FUNCTION_TRACE(acpi_remove_table_handler); | ||
702 | |||
703 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
704 | if (ACPI_FAILURE(status)) { | ||
705 | return_ACPI_STATUS(status); | ||
706 | } | ||
707 | |||
708 | /* Make sure that the installed handler is the same */ | ||
709 | |||
710 | if (!handler || handler != acpi_gbl_table_handler) { | ||
711 | status = AE_BAD_PARAMETER; | ||
712 | goto cleanup; | ||
713 | } | ||
714 | |||
715 | /* Remove the handler */ | ||
716 | |||
717 | acpi_gbl_table_handler = NULL; | ||
718 | |||
719 | cleanup: | ||
720 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
721 | return_ACPI_STATUS(status); | ||
722 | } | ||
723 | |||
724 | ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) | ||
725 | |||
726 | |||
638 | static int __init acpi_no_auto_ssdt_setup(char *s) { | 727 | static int __init acpi_no_auto_ssdt_setup(char *s) { |
639 | 728 | ||
640 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); | 729 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 630c9a2c5b7b..44425433075a 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -675,12 +675,13 @@ void acpi_ut_init_globals(void) | |||
675 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 675 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
676 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 676 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
677 | 677 | ||
678 | /* Global notify handlers */ | 678 | /* Global handlers */ |
679 | 679 | ||
680 | acpi_gbl_system_notify.handler = NULL; | 680 | acpi_gbl_system_notify.handler = NULL; |
681 | acpi_gbl_device_notify.handler = NULL; | 681 | acpi_gbl_device_notify.handler = NULL; |
682 | acpi_gbl_exception_handler = NULL; | 682 | acpi_gbl_exception_handler = NULL; |
683 | acpi_gbl_init_handler = NULL; | 683 | acpi_gbl_init_handler = NULL; |
684 | acpi_gbl_table_handler = NULL; | ||
684 | 685 | ||
685 | /* Global Lock support */ | 686 | /* Global Lock support */ |
686 | 687 | ||