diff options
-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 | ||||
-rw-r--r-- | include/acpi/acdisasm.h | 4 | ||||
-rw-r--r-- | include/acpi/acglobal.h | 2 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 5 | ||||
-rw-r--r-- | include/acpi/actypes.h | 11 |
7 files changed, 139 insertions, 4 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 | ||
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 75c354f7a024..67d152e7fa44 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -104,12 +104,12 @@ typedef const struct acpi_dmtable_info { | |||
104 | #define ACPI_DMT_SIG 27 | 104 | #define ACPI_DMT_SIG 27 |
105 | 105 | ||
106 | typedef | 106 | typedef |
107 | void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); | 107 | void (*acpi_dmtable_handler) (struct acpi_table_header * table); |
108 | 108 | ||
109 | struct acpi_dmtable_data { | 109 | struct acpi_dmtable_data { |
110 | char *signature; | 110 | char *signature; |
111 | struct acpi_dmtable_info *table_info; | 111 | struct acpi_dmtable_info *table_info; |
112 | ACPI_TABLE_HANDLER table_handler; | 112 | acpi_dmtable_handler table_handler; |
113 | char *name; | 113 | char *name; |
114 | }; | 114 | }; |
115 | 115 | ||
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 44e718ee1579..862468616217 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -217,6 +217,8 @@ ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; | |||
217 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; | 217 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; |
218 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; | 218 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; |
219 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | 219 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; |
220 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; | ||
221 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | ||
220 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | 222 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; |
221 | 223 | ||
222 | /* Owner ID support */ | 224 | /* Owner ID support */ |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index d970f7f99549..c92acda1a77f 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -119,6 +119,11 @@ acpi_status | |||
119 | acpi_get_table_by_index(acpi_native_uint table_index, | 119 | acpi_get_table_by_index(acpi_native_uint table_index, |
120 | struct acpi_table_header **out_table); | 120 | struct acpi_table_header **out_table); |
121 | 121 | ||
122 | acpi_status | ||
123 | acpi_install_table_handler(acpi_tbl_handler handler, void *context); | ||
124 | |||
125 | acpi_status acpi_remove_table_handler(acpi_tbl_handler handler); | ||
126 | |||
122 | /* | 127 | /* |
123 | * Namespace and name interfaces | 128 | * Namespace and name interfaces |
124 | */ | 129 | */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 6182b57590ef..766178c6cc81 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -730,6 +730,12 @@ struct acpi_system_info { | |||
730 | u32 debug_layer; | 730 | u32 debug_layer; |
731 | }; | 731 | }; |
732 | 732 | ||
733 | /* Table Event Types */ | ||
734 | |||
735 | #define ACPI_TABLE_EVENT_LOAD 0x0 | ||
736 | #define ACPI_TABLE_EVENT_UNLOAD 0x1 | ||
737 | #define ACPI_NUM_TABLE_EVENTS 2 | ||
738 | |||
733 | /* | 739 | /* |
734 | * Types specific to the OS service interfaces | 740 | * Types specific to the OS service interfaces |
735 | */ | 741 | */ |
@@ -759,6 +765,11 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status, | |||
759 | u16 opcode, | 765 | u16 opcode, |
760 | u32 aml_offset, void *context); | 766 | u32 aml_offset, void *context); |
761 | 767 | ||
768 | /* Table Event handler (Load, load_table etc) and types */ | ||
769 | |||
770 | typedef | ||
771 | acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); | ||
772 | |||
762 | /* Address Spaces (For Operation Regions) */ | 773 | /* Address Spaces (For Operation Regions) */ |
763 | 774 | ||
764 | typedef | 775 | typedef |