diff options
Diffstat (limited to 'drivers/acpi/acpica/evxface.c')
-rw-r--r-- | drivers/acpi/acpica/evxface.c | 132 |
1 files changed, 113 insertions, 19 deletions
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 55a58f3ec8df..81f2d9e87fad 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2014, Intel Corp. | 8 | * Copyright (C) 2000 - 2015, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -51,6 +51,16 @@ | |||
51 | 51 | ||
52 | #define _COMPONENT ACPI_EVENTS | 52 | #define _COMPONENT ACPI_EVENTS |
53 | ACPI_MODULE_NAME("evxface") | 53 | ACPI_MODULE_NAME("evxface") |
54 | #if (!ACPI_REDUCED_HARDWARE) | ||
55 | /* Local prototypes */ | ||
56 | static acpi_status | ||
57 | acpi_ev_install_gpe_handler(acpi_handle gpe_device, | ||
58 | u32 gpe_number, | ||
59 | u32 type, | ||
60 | u8 is_raw_handler, | ||
61 | acpi_gpe_handler address, void *context); | ||
62 | |||
63 | #endif | ||
54 | 64 | ||
55 | 65 | ||
56 | /******************************************************************************* | 66 | /******************************************************************************* |
@@ -76,6 +86,7 @@ ACPI_MODULE_NAME("evxface") | |||
76 | * handlers. | 86 | * handlers. |
77 | * | 87 | * |
78 | ******************************************************************************/ | 88 | ******************************************************************************/ |
89 | |||
79 | acpi_status | 90 | acpi_status |
80 | acpi_install_notify_handler(acpi_handle device, | 91 | acpi_install_notify_handler(acpi_handle device, |
81 | u32 handler_type, | 92 | u32 handler_type, |
@@ -717,32 +728,37 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) | |||
717 | 728 | ||
718 | /******************************************************************************* | 729 | /******************************************************************************* |
719 | * | 730 | * |
720 | * FUNCTION: acpi_install_gpe_handler | 731 | * FUNCTION: acpi_ev_install_gpe_handler |
721 | * | 732 | * |
722 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT | 733 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
723 | * defined GPEs) | 734 | * defined GPEs) |
724 | * gpe_number - The GPE number within the GPE block | 735 | * gpe_number - The GPE number within the GPE block |
725 | * type - Whether this GPE should be treated as an | 736 | * type - Whether this GPE should be treated as an |
726 | * edge- or level-triggered interrupt. | 737 | * edge- or level-triggered interrupt. |
738 | * is_raw_handler - Whether this GPE should be handled using | ||
739 | * the special GPE handler mode. | ||
727 | * address - Address of the handler | 740 | * address - Address of the handler |
728 | * context - Value passed to the handler on each GPE | 741 | * context - Value passed to the handler on each GPE |
729 | * | 742 | * |
730 | * RETURN: Status | 743 | * RETURN: Status |
731 | * | 744 | * |
732 | * DESCRIPTION: Install a handler for a General Purpose Event. | 745 | * DESCRIPTION: Internal function to install a handler for a General Purpose |
746 | * Event. | ||
733 | * | 747 | * |
734 | ******************************************************************************/ | 748 | ******************************************************************************/ |
735 | acpi_status | 749 | static acpi_status |
736 | acpi_install_gpe_handler(acpi_handle gpe_device, | 750 | acpi_ev_install_gpe_handler(acpi_handle gpe_device, |
737 | u32 gpe_number, | 751 | u32 gpe_number, |
738 | u32 type, acpi_gpe_handler address, void *context) | 752 | u32 type, |
753 | u8 is_raw_handler, | ||
754 | acpi_gpe_handler address, void *context) | ||
739 | { | 755 | { |
740 | struct acpi_gpe_event_info *gpe_event_info; | 756 | struct acpi_gpe_event_info *gpe_event_info; |
741 | struct acpi_gpe_handler_info *handler; | 757 | struct acpi_gpe_handler_info *handler; |
742 | acpi_status status; | 758 | acpi_status status; |
743 | acpi_cpu_flags flags; | 759 | acpi_cpu_flags flags; |
744 | 760 | ||
745 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); | 761 | ACPI_FUNCTION_TRACE(ev_install_gpe_handler); |
746 | 762 | ||
747 | /* Parameter validation */ | 763 | /* Parameter validation */ |
748 | 764 | ||
@@ -775,8 +791,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
775 | 791 | ||
776 | /* Make sure that there isn't a handler there already */ | 792 | /* Make sure that there isn't a handler there already */ |
777 | 793 | ||
778 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 794 | if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) == |
779 | ACPI_GPE_DISPATCH_HANDLER) { | 795 | ACPI_GPE_DISPATCH_HANDLER) || |
796 | (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) == | ||
797 | ACPI_GPE_DISPATCH_RAW_HANDLER)) { | ||
780 | status = AE_ALREADY_EXISTS; | 798 | status = AE_ALREADY_EXISTS; |
781 | goto free_and_exit; | 799 | goto free_and_exit; |
782 | } | 800 | } |
@@ -793,9 +811,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
793 | * automatically during initialization, in which case it has to be | 811 | * automatically during initialization, in which case it has to be |
794 | * disabled now to avoid spurious execution of the handler. | 812 | * disabled now to avoid spurious execution of the handler. |
795 | */ | 813 | */ |
796 | if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) || | 814 | if (((ACPI_GPE_DISPATCH_TYPE(handler->original_flags) == |
797 | (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) && | 815 | ACPI_GPE_DISPATCH_METHOD) || |
798 | gpe_event_info->runtime_count) { | 816 | (ACPI_GPE_DISPATCH_TYPE(handler->original_flags) == |
817 | ACPI_GPE_DISPATCH_NOTIFY)) && gpe_event_info->runtime_count) { | ||
799 | handler->originally_enabled = TRUE; | 818 | handler->originally_enabled = TRUE; |
800 | (void)acpi_ev_remove_gpe_reference(gpe_event_info); | 819 | (void)acpi_ev_remove_gpe_reference(gpe_event_info); |
801 | 820 | ||
@@ -816,7 +835,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
816 | 835 | ||
817 | gpe_event_info->flags &= | 836 | gpe_event_info->flags &= |
818 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); | 837 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
819 | gpe_event_info->flags |= (u8)(type | ACPI_GPE_DISPATCH_HANDLER); | 838 | gpe_event_info->flags |= |
839 | (u8)(type | | ||
840 | (is_raw_handler ? ACPI_GPE_DISPATCH_RAW_HANDLER : | ||
841 | ACPI_GPE_DISPATCH_HANDLER)); | ||
820 | 842 | ||
821 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 843 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
822 | 844 | ||
@@ -830,10 +852,78 @@ free_and_exit: | |||
830 | goto unlock_and_exit; | 852 | goto unlock_and_exit; |
831 | } | 853 | } |
832 | 854 | ||
855 | /******************************************************************************* | ||
856 | * | ||
857 | * FUNCTION: acpi_install_gpe_handler | ||
858 | * | ||
859 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT | ||
860 | * defined GPEs) | ||
861 | * gpe_number - The GPE number within the GPE block | ||
862 | * type - Whether this GPE should be treated as an | ||
863 | * edge- or level-triggered interrupt. | ||
864 | * address - Address of the handler | ||
865 | * context - Value passed to the handler on each GPE | ||
866 | * | ||
867 | * RETURN: Status | ||
868 | * | ||
869 | * DESCRIPTION: Install a handler for a General Purpose Event. | ||
870 | * | ||
871 | ******************************************************************************/ | ||
872 | |||
873 | acpi_status | ||
874 | acpi_install_gpe_handler(acpi_handle gpe_device, | ||
875 | u32 gpe_number, | ||
876 | u32 type, acpi_gpe_handler address, void *context) | ||
877 | { | ||
878 | acpi_status status; | ||
879 | |||
880 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); | ||
881 | |||
882 | status = | ||
883 | acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, FALSE, | ||
884 | address, context); | ||
885 | |||
886 | return_ACPI_STATUS(status); | ||
887 | } | ||
888 | |||
833 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) | 889 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
834 | 890 | ||
835 | /******************************************************************************* | 891 | /******************************************************************************* |
836 | * | 892 | * |
893 | * FUNCTION: acpi_install_gpe_raw_handler | ||
894 | * | ||
895 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT | ||
896 | * defined GPEs) | ||
897 | * gpe_number - The GPE number within the GPE block | ||
898 | * type - Whether this GPE should be treated as an | ||
899 | * edge- or level-triggered interrupt. | ||
900 | * address - Address of the handler | ||
901 | * context - Value passed to the handler on each GPE | ||
902 | * | ||
903 | * RETURN: Status | ||
904 | * | ||
905 | * DESCRIPTION: Install a handler for a General Purpose Event. | ||
906 | * | ||
907 | ******************************************************************************/ | ||
908 | acpi_status | ||
909 | acpi_install_gpe_raw_handler(acpi_handle gpe_device, | ||
910 | u32 gpe_number, | ||
911 | u32 type, acpi_gpe_handler address, void *context) | ||
912 | { | ||
913 | acpi_status status; | ||
914 | |||
915 | ACPI_FUNCTION_TRACE(acpi_install_gpe_raw_handler); | ||
916 | |||
917 | status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, TRUE, | ||
918 | address, context); | ||
919 | |||
920 | return_ACPI_STATUS(status); | ||
921 | } | ||
922 | |||
923 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_raw_handler) | ||
924 | |||
925 | /******************************************************************************* | ||
926 | * | ||
837 | * FUNCTION: acpi_remove_gpe_handler | 927 | * FUNCTION: acpi_remove_gpe_handler |
838 | * | 928 | * |
839 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT | 929 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
@@ -880,8 +970,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
880 | 970 | ||
881 | /* Make sure that a handler is indeed installed */ | 971 | /* Make sure that a handler is indeed installed */ |
882 | 972 | ||
883 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != | 973 | if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) != |
884 | ACPI_GPE_DISPATCH_HANDLER) { | 974 | ACPI_GPE_DISPATCH_HANDLER) && |
975 | (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) != | ||
976 | ACPI_GPE_DISPATCH_RAW_HANDLER)) { | ||
885 | status = AE_NOT_EXIST; | 977 | status = AE_NOT_EXIST; |
886 | goto unlock_and_exit; | 978 | goto unlock_and_exit; |
887 | } | 979 | } |
@@ -896,6 +988,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
896 | /* Remove the handler */ | 988 | /* Remove the handler */ |
897 | 989 | ||
898 | handler = gpe_event_info->dispatch.handler; | 990 | handler = gpe_event_info->dispatch.handler; |
991 | gpe_event_info->dispatch.handler = NULL; | ||
899 | 992 | ||
900 | /* Restore Method node (if any), set dispatch flags */ | 993 | /* Restore Method node (if any), set dispatch flags */ |
901 | 994 | ||
@@ -909,9 +1002,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
909 | * enabled, it should be enabled at this point to restore the | 1002 | * enabled, it should be enabled at this point to restore the |
910 | * post-initialization configuration. | 1003 | * post-initialization configuration. |
911 | */ | 1004 | */ |
912 | if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) || | 1005 | if (((ACPI_GPE_DISPATCH_TYPE(handler->original_flags) == |
913 | (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) && | 1006 | ACPI_GPE_DISPATCH_METHOD) || |
914 | handler->originally_enabled) { | 1007 | (ACPI_GPE_DISPATCH_TYPE(handler->original_flags) == |
1008 | ACPI_GPE_DISPATCH_NOTIFY)) && handler->originally_enabled) { | ||
915 | (void)acpi_ev_add_gpe_reference(gpe_event_info); | 1009 | (void)acpi_ev_add_gpe_reference(gpe_event_info); |
916 | } | 1010 | } |
917 | 1011 | ||