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 | |
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')
-rw-r--r-- | drivers/acpi/events/evgpeblk.c | 25 | ||||
-rw-r--r-- | drivers/acpi/events/evmisc.c | 4 | ||||
-rw-r--r-- | drivers/acpi/events/evxfevnt.c | 93 | ||||
-rw-r--r-- | drivers/acpi/hardware/hwgpe.c | 26 | ||||
-rw-r--r-- | drivers/acpi/hardware/hwregs.c | 2 | ||||
-rw-r--r-- | drivers/acpi/system.c | 63 | ||||
-rw-r--r-- | drivers/acpi/utilities/utglobal.c | 6 |
7 files changed, 136 insertions, 83 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 | ||
134 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) | 135 | acpi_status |
136 | acpi_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 | ||
187 | acpi_status | 194 | acpi_status |
188 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 195 | acpi_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)); |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index dbac5b3248a0..d807158c6401 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -588,7 +588,7 @@ void acpi_ev_terminate(void) | |||
588 | 588 | ||
589 | /* Disable all GPEs in all GPE blocks */ | 589 | /* Disable all GPEs in all GPE blocks */ |
590 | 590 | ||
591 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 591 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); |
592 | 592 | ||
593 | /* Remove SCI handler */ | 593 | /* Remove SCI handler */ |
594 | 594 | ||
@@ -606,7 +606,7 @@ void acpi_ev_terminate(void) | |||
606 | 606 | ||
607 | /* Deallocate all handler objects installed within GPE info structs */ | 607 | /* Deallocate all handler objects installed within GPE info structs */ |
608 | 608 | ||
609 | status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers); | 609 | status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL); |
610 | 610 | ||
611 | /* Return to original mode if necessary */ | 611 | /* Return to original mode if necessary */ |
612 | 612 | ||
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 | } | ||
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 0b80db9d9197..5ab7cac6fbb9 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -51,7 +51,8 @@ ACPI_MODULE_NAME("hwgpe") | |||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static acpi_status | 52 | static acpi_status |
53 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 53 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
54 | struct acpi_gpe_block_info *gpe_block); | 54 | struct acpi_gpe_block_info *gpe_block, |
55 | void *context); | ||
55 | 56 | ||
56 | /****************************************************************************** | 57 | /****************************************************************************** |
57 | * | 58 | * |
@@ -260,8 +261,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
260 | ******************************************************************************/ | 261 | ******************************************************************************/ |
261 | 262 | ||
262 | acpi_status | 263 | acpi_status |
263 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 264 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
264 | struct acpi_gpe_block_info * gpe_block) | 265 | struct acpi_gpe_block_info *gpe_block, void *context) |
265 | { | 266 | { |
266 | u32 i; | 267 | u32 i; |
267 | acpi_status status; | 268 | acpi_status status; |
@@ -297,8 +298,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
297 | ******************************************************************************/ | 298 | ******************************************************************************/ |
298 | 299 | ||
299 | acpi_status | 300 | acpi_status |
300 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 301 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
301 | struct acpi_gpe_block_info * gpe_block) | 302 | struct acpi_gpe_block_info *gpe_block, void *context) |
302 | { | 303 | { |
303 | u32 i; | 304 | u32 i; |
304 | acpi_status status; | 305 | acpi_status status; |
@@ -335,8 +336,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
335 | ******************************************************************************/ | 336 | ******************************************************************************/ |
336 | 337 | ||
337 | acpi_status | 338 | acpi_status |
338 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 339 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
339 | struct acpi_gpe_block_info * gpe_block) | 340 | struct acpi_gpe_block_info *gpe_block, void *context) |
340 | { | 341 | { |
341 | u32 i; | 342 | u32 i; |
342 | acpi_status status; | 343 | acpi_status status; |
@@ -382,7 +383,8 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
382 | 383 | ||
383 | static acpi_status | 384 | static acpi_status |
384 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 385 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
385 | struct acpi_gpe_block_info *gpe_block) | 386 | struct acpi_gpe_block_info *gpe_block, |
387 | void *context) | ||
386 | { | 388 | { |
387 | u32 i; | 389 | u32 i; |
388 | acpi_status status; | 390 | acpi_status status; |
@@ -427,8 +429,8 @@ acpi_status acpi_hw_disable_all_gpes(void) | |||
427 | 429 | ||
428 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); | 430 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
429 | 431 | ||
430 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 432 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); |
431 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 433 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); |
432 | return_ACPI_STATUS(status); | 434 | return_ACPI_STATUS(status); |
433 | } | 435 | } |
434 | 436 | ||
@@ -450,7 +452,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) | |||
450 | 452 | ||
451 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); | 453 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
452 | 454 | ||
453 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); | 455 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL); |
454 | return_ACPI_STATUS(status); | 456 | return_ACPI_STATUS(status); |
455 | } | 457 | } |
456 | 458 | ||
@@ -472,6 +474,6 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) | |||
472 | 474 | ||
473 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); | 475 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
474 | 476 | ||
475 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); | 477 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL); |
476 | return_ACPI_STATUS(status); | 478 | return_ACPI_STATUS(status); |
477 | } | 479 | } |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index ddf792adcf96..69dc8b45d76c 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -94,7 +94,7 @@ acpi_status acpi_hw_clear_acpi_status(void) | |||
94 | 94 | ||
95 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ | 95 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ |
96 | 96 | ||
97 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 97 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); |
98 | 98 | ||
99 | unlock_and_exit: | 99 | unlock_and_exit: |
100 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | 100 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 6e4107f82403..391d0358a592 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -192,65 +192,6 @@ static struct attribute_group interrupt_stats_attr_group = { | |||
192 | }; | 192 | }; |
193 | static struct kobj_attribute *counter_attrs; | 193 | static struct kobj_attribute *counter_attrs; |
194 | 194 | ||
195 | static int count_num_gpes(void) | ||
196 | { | ||
197 | int count = 0; | ||
198 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
199 | struct acpi_gpe_block_info *gpe_block; | ||
200 | acpi_cpu_flags flags; | ||
201 | |||
202 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
203 | |||
204 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
205 | while (gpe_xrupt_info) { | ||
206 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
207 | while (gpe_block) { | ||
208 | count += gpe_block->register_count * | ||
209 | ACPI_GPE_REGISTER_WIDTH; | ||
210 | gpe_block = gpe_block->next; | ||
211 | } | ||
212 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
213 | } | ||
214 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
215 | |||
216 | return count; | ||
217 | } | ||
218 | |||
219 | static int get_gpe_device(int index, acpi_handle *handle) | ||
220 | { | ||
221 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
222 | struct acpi_gpe_block_info *gpe_block; | ||
223 | acpi_cpu_flags flags; | ||
224 | struct acpi_namespace_node *node; | ||
225 | |||
226 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
227 | |||
228 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
229 | while (gpe_xrupt_info) { | ||
230 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
231 | node = gpe_block->node; | ||
232 | while (gpe_block) { | ||
233 | index -= gpe_block->register_count * | ||
234 | ACPI_GPE_REGISTER_WIDTH; | ||
235 | if (index < 0) { | ||
236 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
237 | /* return NULL if it's FADT GPE */ | ||
238 | if (node->type != ACPI_TYPE_DEVICE) | ||
239 | *handle = NULL; | ||
240 | else | ||
241 | *handle = node; | ||
242 | return 0; | ||
243 | } | ||
244 | node = gpe_block->node; | ||
245 | gpe_block = gpe_block->next; | ||
246 | } | ||
247 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
248 | } | ||
249 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
250 | |||
251 | return -ENODEV; | ||
252 | } | ||
253 | |||
254 | static void delete_gpe_attr_array(void) | 195 | static void delete_gpe_attr_array(void) |
255 | { | 196 | { |
256 | struct event_counter *tmp = all_counters; | 197 | struct event_counter *tmp = all_counters; |
@@ -309,7 +250,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
309 | goto end; | 250 | goto end; |
310 | 251 | ||
311 | if (index < num_gpes) { | 252 | if (index < num_gpes) { |
312 | result = get_gpe_device(index, handle); | 253 | result = acpi_get_gpe_device(index, handle); |
313 | if (result) { | 254 | if (result) { |
314 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, | 255 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, |
315 | "Invalid GPE 0x%x\n", index)); | 256 | "Invalid GPE 0x%x\n", index)); |
@@ -436,7 +377,7 @@ void acpi_irq_stats_init(void) | |||
436 | if (all_counters) | 377 | if (all_counters) |
437 | return; | 378 | return; |
438 | 379 | ||
439 | num_gpes = count_num_gpes(); | 380 | num_gpes = acpi_current_gpe_count; |
440 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; | 381 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; |
441 | 382 | ||
442 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), | 383 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 211d621f42a9..06112bf976dc 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -46,9 +46,8 @@ | |||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | 48 | ||
49 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | ||
50 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utglobal") | 50 | ACPI_MODULE_NAME("utglobal") |
52 | 51 | ||
53 | /******************************************************************************* | 52 | /******************************************************************************* |
54 | * | 53 | * |
@@ -756,6 +755,7 @@ acpi_status acpi_ut_init_globals(void) | |||
756 | acpi_gbl_gpe_xrupt_list_head = NULL; | 755 | acpi_gbl_gpe_xrupt_list_head = NULL; |
757 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 756 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
758 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 757 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
758 | acpi_current_gpe_count = 0; | ||
759 | 759 | ||
760 | /* Global handlers */ | 760 | /* Global handlers */ |
761 | 761 | ||
@@ -816,5 +816,7 @@ acpi_status acpi_ut_init_globals(void) | |||
816 | return_ACPI_STATUS(AE_OK); | 816 | return_ACPI_STATUS(AE_OK); |
817 | } | 817 | } |
818 | 818 | ||
819 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | ||
819 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 820 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
820 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 821 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
822 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) | ||