diff options
author | Bob Moore <robert.moore@intel.com> | 2008-12-29 20:45:17 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-12-31 01:10:24 -0500 |
commit | e97d6bf1a01b7403d98aea95731863aab2e84064 (patch) | |
tree | fd6dafb476e312424311425be96e07e5969f060f /drivers/acpi/events/evxfevnt.c | |
parent | c1e3523ccbeca312e11557d2a75f90632a2fb5c7 (diff) |
ACPICA: New: acpi_get_gpe_device interface
This function maps an input GPE index to a GPE block device. Also
Added acpi_current_gpe_count to track the current number of GPEs
that are being managed by the ACPICA core (both FADT-based GPEs
and the GPEs contained in GPE block devices.)
Modify drivers/acpi/system.c to use these 2 new interfaces
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events/evxfevnt.c')
-rw-r--r-- | drivers/acpi/events/evxfevnt.c | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 669b8ca4984b..aa4dec8edfc5 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -49,6 +49,11 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evxfevnt") | 50 | ACPI_MODULE_NAME("evxfevnt") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | acpi_status | ||
54 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
55 | struct acpi_gpe_block_info *gpe_block, void *context); | ||
56 | |||
52 | /******************************************************************************* | 57 | /******************************************************************************* |
53 | * | 58 | * |
54 | * FUNCTION: acpi_enable | 59 | * FUNCTION: acpi_enable |
@@ -60,6 +65,7 @@ ACPI_MODULE_NAME("evxfevnt") | |||
60 | * DESCRIPTION: Transfers the system into ACPI mode. | 65 | * DESCRIPTION: Transfers the system into ACPI mode. |
61 | * | 66 | * |
62 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | |||
63 | acpi_status acpi_enable(void) | 69 | acpi_status acpi_enable(void) |
64 | { | 70 | { |
65 | acpi_status status = AE_OK; | 71 | acpi_status status = AE_OK; |
@@ -717,3 +723,90 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
717 | } | 723 | } |
718 | 724 | ||
719 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) | 725 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) |
726 | |||
727 | /******************************************************************************* | ||
728 | * | ||
729 | * FUNCTION: acpi_get_gpe_device | ||
730 | * | ||
731 | * PARAMETERS: Index - System GPE index (0-current_gpe_count) | ||
732 | * gpe_device - Where the parent GPE Device is returned | ||
733 | * | ||
734 | * RETURN: Status | ||
735 | * | ||
736 | * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL | ||
737 | * gpe device indicates that the gpe number is contained in one of | ||
738 | * the FADT-defined gpe blocks. Otherwise, the GPE block device. | ||
739 | * | ||
740 | ******************************************************************************/ | ||
741 | acpi_status | ||
742 | acpi_get_gpe_device(u32 index, acpi_handle *gpe_device) | ||
743 | { | ||
744 | struct acpi_gpe_device_info info; | ||
745 | acpi_status status; | ||
746 | |||
747 | ACPI_FUNCTION_TRACE(acpi_get_gpe_device); | ||
748 | |||
749 | if (!gpe_device) { | ||
750 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
751 | } | ||
752 | |||
753 | if (index >= acpi_current_gpe_count) { | ||
754 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
755 | } | ||
756 | |||
757 | /* Setup and walk the GPE list */ | ||
758 | |||
759 | info.index = index; | ||
760 | info.status = AE_NOT_EXIST; | ||
761 | info.gpe_device = NULL; | ||
762 | info.next_block_base_index = 0; | ||
763 | |||
764 | status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info); | ||
765 | if (ACPI_FAILURE(status)) { | ||
766 | return_ACPI_STATUS(status); | ||
767 | } | ||
768 | |||
769 | *gpe_device = info.gpe_device; | ||
770 | return_ACPI_STATUS(info.status); | ||
771 | } | ||
772 | |||
773 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_device) | ||
774 | |||
775 | /******************************************************************************* | ||
776 | * | ||
777 | * FUNCTION: acpi_ev_get_gpe_device | ||
778 | * | ||
779 | * PARAMETERS: GPE_WALK_CALLBACK | ||
780 | * | ||
781 | * RETURN: Status | ||
782 | * | ||
783 | * DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE | ||
784 | * block device. NULL if the GPE is one of the FADT-defined GPEs. | ||
785 | * | ||
786 | ******************************************************************************/ | ||
787 | acpi_status | ||
788 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
789 | struct acpi_gpe_block_info *gpe_block, void *context) | ||
790 | { | ||
791 | struct acpi_gpe_device_info *info = context; | ||
792 | |||
793 | /* Increment Index by the number of GPEs in this block */ | ||
794 | |||
795 | info->next_block_base_index += | ||
796 | (gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH); | ||
797 | |||
798 | if (info->index < info->next_block_base_index) { | ||
799 | /* | ||
800 | * The GPE index is within this block, get the node. Leave the node | ||
801 | * NULL for the FADT-defined GPEs | ||
802 | */ | ||
803 | if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) { | ||
804 | info->gpe_device = gpe_block->node; | ||
805 | } | ||
806 | |||
807 | info->status = AE_OK; | ||
808 | return (AE_CTRL_END); | ||
809 | } | ||
810 | |||
811 | return (AE_OK); | ||
812 | } | ||