diff options
author | Bob Moore <robert.moore@intel.com> | 2007-02-02 11:48:18 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-02 21:14:21 -0500 |
commit | f3d2e7865c816258c699ff965768e46b50d536d3 (patch) | |
tree | 83d21269e506109275b77d3ed161883bba8a39cf /drivers/acpi/events | |
parent | 2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff) |
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely
redesigned and reimplemented. The new design is much
simpler, and reduces the overall code and data size of
the kernel-resident ACPICA by approximately 5%. Also,
it is now possible to obtain the ACPI tables very early
during kernel initialization, even before dynamic memory
management is initialized.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events')
-rw-r--r-- | drivers/acpi/events/evevent.c | 7 | ||||
-rw-r--r-- | drivers/acpi/events/evgpeblk.c | 49 | ||||
-rw-r--r-- | drivers/acpi/events/evmisc.c | 19 | ||||
-rw-r--r-- | drivers/acpi/events/evsci.c | 12 | ||||
-rw-r--r-- | drivers/acpi/events/evxfevnt.c | 12 |
5 files changed, 48 insertions, 51 deletions
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 919037d6acff..6b4bc99b1c2c 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -70,13 +70,6 @@ acpi_status acpi_ev_initialize_events(void) | |||
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE(ev_initialize_events); | 71 | ACPI_FUNCTION_TRACE(ev_initialize_events); |
72 | 72 | ||
73 | /* Make sure we have ACPI tables */ | ||
74 | |||
75 | if (!acpi_gbl_DSDT) { | ||
76 | ACPI_WARNING((AE_INFO, "No ACPI tables present!")); | ||
77 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
78 | } | ||
79 | |||
80 | /* | 73 | /* |
81 | * Initialize the Fixed and General Purpose Events. This is done prior to | 74 | * Initialize the Fixed and General Purpose Events. This is done prior to |
82 | * enabling SCIs to prevent interrupts from occurring before the handlers are | 75 | * enabling SCIs to prevent interrupts from occurring before the handlers are |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 95ddeb48bc0f..bb0eb50cd28f 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -529,7 +529,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
529 | 529 | ||
530 | /* Install new interrupt handler if not SCI_INT */ | 530 | /* Install new interrupt handler if not SCI_INT */ |
531 | 531 | ||
532 | if (interrupt_number != acpi_gbl_FADT->sci_int) { | 532 | if (interrupt_number != acpi_gbl_FADT.sci_interrupt) { |
533 | status = acpi_os_install_interrupt_handler(interrupt_number, | 533 | status = acpi_os_install_interrupt_handler(interrupt_number, |
534 | acpi_ev_gpe_xrupt_handler, | 534 | acpi_ev_gpe_xrupt_handler, |
535 | gpe_xrupt); | 535 | gpe_xrupt); |
@@ -567,7 +567,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
567 | 567 | ||
568 | /* We never want to remove the SCI interrupt handler */ | 568 | /* We never want to remove the SCI interrupt handler */ |
569 | 569 | ||
570 | if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) { | 570 | if (gpe_xrupt->interrupt_number == acpi_gbl_FADT.sci_interrupt) { |
571 | gpe_xrupt->gpe_block_list_head = NULL; | 571 | gpe_xrupt->gpe_block_list_head = NULL; |
572 | return_ACPI_STATUS(AE_OK); | 572 | return_ACPI_STATUS(AE_OK); |
573 | } | 573 | } |
@@ -803,17 +803,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
803 | (gpe_block->block_address.address | 803 | (gpe_block->block_address.address |
804 | + i + gpe_block->register_count)); | 804 | + i + gpe_block->register_count)); |
805 | 805 | ||
806 | this_register->status_address.address_space_id = | 806 | this_register->status_address.space_id = |
807 | gpe_block->block_address.address_space_id; | 807 | gpe_block->block_address.space_id; |
808 | this_register->enable_address.address_space_id = | 808 | this_register->enable_address.space_id = |
809 | gpe_block->block_address.address_space_id; | 809 | gpe_block->block_address.space_id; |
810 | this_register->status_address.register_bit_width = | 810 | this_register->status_address.bit_width = |
811 | ACPI_GPE_REGISTER_WIDTH; | 811 | ACPI_GPE_REGISTER_WIDTH; |
812 | this_register->enable_address.register_bit_width = | 812 | this_register->enable_address.bit_width = |
813 | ACPI_GPE_REGISTER_WIDTH; | 813 | ACPI_GPE_REGISTER_WIDTH; |
814 | this_register->status_address.register_bit_offset = | 814 | this_register->status_address.bit_offset = |
815 | ACPI_GPE_REGISTER_WIDTH; | 815 | ACPI_GPE_REGISTER_WIDTH; |
816 | this_register->enable_address.register_bit_offset = | 816 | this_register->enable_address.bit_offset = |
817 | ACPI_GPE_REGISTER_WIDTH; | 817 | ACPI_GPE_REGISTER_WIDTH; |
818 | 818 | ||
819 | /* Init the event_info for each GPE within this register */ | 819 | /* Init the event_info for each GPE within this register */ |
@@ -1109,11 +1109,12 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1109 | * If EITHER the register length OR the block address are zero, then that | 1109 | * If EITHER the register length OR the block address are zero, then that |
1110 | * particular block is not supported. | 1110 | * particular block is not supported. |
1111 | */ | 1111 | */ |
1112 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { | 1112 | if (acpi_gbl_FADT.gpe0_block_length && |
1113 | acpi_gbl_FADT.xgpe0_block.address) { | ||
1113 | 1114 | ||
1114 | /* GPE block 0 exists (has both length and address > 0) */ | 1115 | /* GPE block 0 exists (has both length and address > 0) */ |
1115 | 1116 | ||
1116 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); | 1117 | register_count0 = (u16) (acpi_gbl_FADT.gpe0_block_length / 2); |
1117 | 1118 | ||
1118 | gpe_number_max = | 1119 | gpe_number_max = |
1119 | (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; | 1120 | (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; |
@@ -1121,9 +1122,9 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1121 | /* Install GPE Block 0 */ | 1122 | /* Install GPE Block 0 */ |
1122 | 1123 | ||
1123 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, | 1124 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
1124 | &acpi_gbl_FADT->xgpe0_blk, | 1125 | &acpi_gbl_FADT.xgpe0_block, |
1125 | register_count0, 0, | 1126 | register_count0, 0, |
1126 | acpi_gbl_FADT->sci_int, | 1127 | acpi_gbl_FADT.sci_interrupt, |
1127 | &acpi_gbl_gpe_fadt_blocks[0]); | 1128 | &acpi_gbl_gpe_fadt_blocks[0]); |
1128 | 1129 | ||
1129 | if (ACPI_FAILURE(status)) { | 1130 | if (ACPI_FAILURE(status)) { |
@@ -1132,20 +1133,21 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1132 | } | 1133 | } |
1133 | } | 1134 | } |
1134 | 1135 | ||
1135 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { | 1136 | if (acpi_gbl_FADT.gpe1_block_length && |
1137 | acpi_gbl_FADT.xgpe1_block.address) { | ||
1136 | 1138 | ||
1137 | /* GPE block 1 exists (has both length and address > 0) */ | 1139 | /* GPE block 1 exists (has both length and address > 0) */ |
1138 | 1140 | ||
1139 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); | 1141 | register_count1 = (u16) (acpi_gbl_FADT.gpe1_block_length / 2); |
1140 | 1142 | ||
1141 | /* Check for GPE0/GPE1 overlap (if both banks exist) */ | 1143 | /* Check for GPE0/GPE1 overlap (if both banks exist) */ |
1142 | 1144 | ||
1143 | if ((register_count0) && | 1145 | if ((register_count0) && |
1144 | (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { | 1146 | (gpe_number_max >= acpi_gbl_FADT.gpe1_base)) { |
1145 | ACPI_ERROR((AE_INFO, | 1147 | ACPI_ERROR((AE_INFO, |
1146 | "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", | 1148 | "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", |
1147 | gpe_number_max, acpi_gbl_FADT->gpe1_base, | 1149 | gpe_number_max, acpi_gbl_FADT.gpe1_base, |
1148 | acpi_gbl_FADT->gpe1_base + | 1150 | acpi_gbl_FADT.gpe1_base + |
1149 | ((register_count1 * | 1151 | ((register_count1 * |
1150 | ACPI_GPE_REGISTER_WIDTH) - 1))); | 1152 | ACPI_GPE_REGISTER_WIDTH) - 1))); |
1151 | 1153 | ||
@@ -1157,10 +1159,11 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1157 | 1159 | ||
1158 | status = | 1160 | status = |
1159 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, | 1161 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
1160 | &acpi_gbl_FADT->xgpe1_blk, | 1162 | &acpi_gbl_FADT.xgpe1_block, |
1161 | register_count1, | 1163 | register_count1, |
1162 | acpi_gbl_FADT->gpe1_base, | 1164 | acpi_gbl_FADT.gpe1_base, |
1163 | acpi_gbl_FADT->sci_int, | 1165 | acpi_gbl_FADT. |
1166 | sci_interrupt, | ||
1164 | &acpi_gbl_gpe_fadt_blocks | 1167 | &acpi_gbl_gpe_fadt_blocks |
1165 | [1]); | 1168 | [1]); |
1166 | 1169 | ||
@@ -1173,7 +1176,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1173 | * GPE0 and GPE1 do not have to be contiguous in the GPE number | 1176 | * GPE0 and GPE1 do not have to be contiguous in the GPE number |
1174 | * space. However, GPE0 always starts at GPE number zero. | 1177 | * space. However, GPE0 always starts at GPE number zero. |
1175 | */ | 1178 | */ |
1176 | gpe_number_max = acpi_gbl_FADT->gpe1_base + | 1179 | gpe_number_max = acpi_gbl_FADT.gpe1_base + |
1177 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); | 1180 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); |
1178 | } | 1181 | } |
1179 | } | 1182 | } |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 00f33ed4c12e..21449f36b5f8 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -63,6 +63,10 @@ static const char *acpi_notify_value_names[] = { | |||
63 | }; | 63 | }; |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | /* Pointer to FACS needed for the Global Lock */ | ||
67 | |||
68 | static struct acpi_table_facs *facs = NULL; | ||
69 | |||
66 | /* Local prototypes */ | 70 | /* Local prototypes */ |
67 | 71 | ||
68 | static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); | 72 | static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); |
@@ -306,7 +310,7 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
306 | * If we don't get it now, it will be marked pending and we will | 310 | * If we don't get it now, it will be marked pending and we will |
307 | * take another interrupt when it becomes free. | 311 | * take another interrupt when it becomes free. |
308 | */ | 312 | */ |
309 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 313 | ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); |
310 | if (acquired) { | 314 | if (acquired) { |
311 | 315 | ||
312 | /* Got the lock, now wake all threads waiting for it */ | 316 | /* Got the lock, now wake all threads waiting for it */ |
@@ -342,6 +346,13 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
342 | 346 | ||
343 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); | 347 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
344 | 348 | ||
349 | status = | ||
350 | acpi_get_table(ACPI_SIG_FACS, 0, | ||
351 | (struct acpi_table_header **)&facs); | ||
352 | if (ACPI_FAILURE(status)) { | ||
353 | return_ACPI_STATUS(status); | ||
354 | } | ||
355 | |||
345 | acpi_gbl_global_lock_present = TRUE; | 356 | acpi_gbl_global_lock_present = TRUE; |
346 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, | 357 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, |
347 | acpi_ev_global_lock_handler, | 358 | acpi_ev_global_lock_handler, |
@@ -414,7 +425,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
414 | 425 | ||
415 | /* Attempt to acquire the actual hardware lock */ | 426 | /* Attempt to acquire the actual hardware lock */ |
416 | 427 | ||
417 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 428 | ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); |
418 | if (acquired) { | 429 | if (acquired) { |
419 | 430 | ||
420 | /* We got the lock */ | 431 | /* We got the lock */ |
@@ -438,6 +449,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
438 | */ | 449 | */ |
439 | status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, | 450 | status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, |
440 | ACPI_WAIT_FOREVER); | 451 | ACPI_WAIT_FOREVER); |
452 | |||
441 | return_ACPI_STATUS(status); | 453 | return_ACPI_STATUS(status); |
442 | } | 454 | } |
443 | 455 | ||
@@ -472,8 +484,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
472 | 484 | ||
473 | /* Allow any thread to release the lock */ | 485 | /* Allow any thread to release the lock */ |
474 | 486 | ||
475 | ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, | 487 | ACPI_RELEASE_GLOBAL_LOCK(facs, pending); |
476 | pending); | ||
477 | 488 | ||
478 | /* | 489 | /* |
479 | * If the pending bit was set, we must write GBL_RLS to the control | 490 | * If the pending bit was set, we must write GBL_RLS to the control |
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 8106215ad554..d7680ac684a6 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -142,9 +142,10 @@ u32 acpi_ev_install_sci_handler(void) | |||
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE(ev_install_sci_handler); | 143 | ACPI_FUNCTION_TRACE(ev_install_sci_handler); |
144 | 144 | ||
145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, | 145 | status = |
146 | acpi_ev_sci_xrupt_handler, | 146 | acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt, |
147 | acpi_gbl_gpe_xrupt_list_head); | 147 | acpi_ev_sci_xrupt_handler, |
148 | acpi_gbl_gpe_xrupt_list_head); | ||
148 | return_ACPI_STATUS(status); | 149 | return_ACPI_STATUS(status); |
149 | } | 150 | } |
150 | 151 | ||
@@ -175,8 +176,9 @@ acpi_status acpi_ev_remove_sci_handler(void) | |||
175 | 176 | ||
176 | /* Just let the OS remove the handler and disable the level */ | 177 | /* Just let the OS remove the handler and disable the level */ |
177 | 178 | ||
178 | status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int, | 179 | status = |
179 | acpi_ev_sci_xrupt_handler); | 180 | acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt, |
181 | acpi_ev_sci_xrupt_handler); | ||
180 | 182 | ||
181 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
182 | } | 184 | } |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 7ebc2efac936..91e5f5b53a97 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -65,13 +65,6 @@ acpi_status acpi_enable(void) | |||
65 | 65 | ||
66 | ACPI_FUNCTION_TRACE(acpi_enable); | 66 | ACPI_FUNCTION_TRACE(acpi_enable); |
67 | 67 | ||
68 | /* Make sure we have the FADT */ | ||
69 | |||
70 | if (!acpi_gbl_FADT) { | ||
71 | ACPI_WARNING((AE_INFO, "No FADT information present!")); | ||
72 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
73 | } | ||
74 | |||
75 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { | 68 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { |
76 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 69 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
77 | "System is already in ACPI mode\n")); | 70 | "System is already in ACPI mode\n")); |
@@ -111,11 +104,6 @@ acpi_status acpi_disable(void) | |||
111 | 104 | ||
112 | ACPI_FUNCTION_TRACE(acpi_disable); | 105 | ACPI_FUNCTION_TRACE(acpi_disable); |
113 | 106 | ||
114 | if (!acpi_gbl_FADT) { | ||
115 | ACPI_WARNING((AE_INFO, "No FADT information present!")); | ||
116 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
117 | } | ||
118 | |||
119 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { | 107 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { |
120 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 108 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
121 | "System is already in legacy (non-ACPI) mode\n")); | 109 | "System is already in legacy (non-ACPI) mode\n")); |