aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events/evgpeblk.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-12-29 20:45:17 -0500
committerLen Brown <len.brown@intel.com>2008-12-31 01:10:24 -0500
commite97d6bf1a01b7403d98aea95731863aab2e84064 (patch)
treefd6dafb476e312424311425be96e07e5969f060f /drivers/acpi/events/evgpeblk.c
parentc1e3523ccbeca312e11557d2a75f90632a2fb5c7 (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/evgpeblk.c')
-rw-r--r--drivers/acpi/events/evgpeblk.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 7537cda54050..2872be2b9be5 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -124,6 +124,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
124 * FUNCTION: acpi_ev_walk_gpe_list 124 * FUNCTION: acpi_ev_walk_gpe_list
125 * 125 *
126 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block 126 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block
127 * Context - Value passed to callback
127 * 128 *
128 * RETURN: Status 129 * RETURN: Status
129 * 130 *
@@ -131,7 +132,8 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
131 * 132 *
132 ******************************************************************************/ 133 ******************************************************************************/
133 134
134acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) 135acpi_status
136acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context)
135{ 137{
136 struct acpi_gpe_block_info *gpe_block; 138 struct acpi_gpe_block_info *gpe_block;
137 struct acpi_gpe_xrupt_info *gpe_xrupt_info; 139 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
@@ -154,8 +156,13 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
154 156
155 /* One callback per GPE block */ 157 /* One callback per GPE block */
156 158
157 status = gpe_walk_callback(gpe_xrupt_info, gpe_block); 159 status =
160 gpe_walk_callback(gpe_xrupt_info, gpe_block,
161 context);
158 if (ACPI_FAILURE(status)) { 162 if (ACPI_FAILURE(status)) {
163 if (status == AE_CTRL_END) { /* Callback abort */
164 status = AE_OK;
165 }
159 goto unlock_and_exit; 166 goto unlock_and_exit;
160 } 167 }
161 168
@@ -186,7 +193,8 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
186 193
187acpi_status 194acpi_status
188acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 195acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
189 struct acpi_gpe_block_info *gpe_block) 196 struct acpi_gpe_block_info *gpe_block,
197 void *context)
190{ 198{
191 struct acpi_gpe_event_info *gpe_event_info; 199 struct acpi_gpe_event_info *gpe_event_info;
192 u32 i; 200 u32 i;
@@ -690,7 +698,8 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
690 698
691 /* Disable all GPEs in this block */ 699 /* Disable all GPEs in this block */
692 700
693 status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); 701 status =
702 acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL);
694 703
695 if (!gpe_block->previous && !gpe_block->next) { 704 if (!gpe_block->previous && !gpe_block->next) {
696 705
@@ -717,6 +726,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
717 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 726 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
718 } 727 }
719 728
729 acpi_current_gpe_count -=
730 gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH;
731
720 /* Free the gpe_block */ 732 /* Free the gpe_block */
721 733
722 ACPI_FREE(gpe_block->register_info); 734 ACPI_FREE(gpe_block->register_info);
@@ -958,6 +970,9 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
958 gpe_device->name.ascii, gpe_block->register_count, 970 gpe_device->name.ascii, gpe_block->register_count,
959 interrupt_number)); 971 interrupt_number));
960 972
973 /* Update global count of currently available GPEs */
974
975 acpi_current_gpe_count += register_count * ACPI_GPE_REGISTER_WIDTH;
961 return_ACPI_STATUS(AE_OK); 976 return_ACPI_STATUS(AE_OK);
962} 977}
963 978
@@ -1057,7 +1072,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1057 1072
1058 /* Enable all valid runtime GPEs found above */ 1073 /* Enable all valid runtime GPEs found above */
1059 1074
1060 status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); 1075 status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL);
1061 if (ACPI_FAILURE(status)) { 1076 if (ACPI_FAILURE(status)) {
1062 ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", 1077 ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
1063 gpe_block)); 1078 gpe_block));