diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-04-04 00:39:18 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-20 16:59:39 -0400 |
commit | caf4a15c5f930aae41951b4916289e3e59dda8eb (patch) | |
tree | e7906f367abc62597b0075af93306571d362598c | |
parent | a94e88cdd8057fe8ea84bbb6d9a89a823c7bc49b (diff) |
ACPICA: Tables: Add acpi_install_table() API for early table installation.
This patch adds a new API - acpi_install_table(). OSPMs can use this API
to install tables during early boot stage. Lv Zheng.
References: https://lkml.org/lkml/2014/2/28/372
Cc: Thomas Renninger <trenn@suse.de>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
[rjw: Subject]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/actables.h | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/exconfig.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbinstal.c | 16 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbutils.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxfload.c | 42 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 3 |
6 files changed, 60 insertions, 11 deletions
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 32aec48eb2d8..3d20a96f6f09 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
@@ -92,7 +92,8 @@ acpi_tb_release_table(struct acpi_table_header *table, | |||
92 | 92 | ||
93 | acpi_status | 93 | acpi_status |
94 | acpi_tb_install_non_fixed_table(acpi_physical_address address, | 94 | acpi_tb_install_non_fixed_table(acpi_physical_address address, |
95 | u8 flags, u8 reload, u32 *table_index); | 95 | u8 flags, |
96 | u8 reload, u8 override, u32 *table_index); | ||
96 | 97 | ||
97 | acpi_status | 98 | acpi_status |
98 | acpi_tb_store_table(acpi_physical_address address, | 99 | acpi_tb_store_table(acpi_physical_address address, |
@@ -142,7 +143,8 @@ acpi_tb_install_table(struct acpi_table_desc *table_desc, | |||
142 | 143 | ||
143 | void | 144 | void |
144 | acpi_tb_install_and_override_table(u32 table_index, | 145 | acpi_tb_install_and_override_table(u32 table_index, |
145 | struct acpi_table_desc *new_table_desc); | 146 | struct acpi_table_desc *new_table_desc, |
147 | u8 override); | ||
146 | 148 | ||
147 | acpi_status | 149 | acpi_status |
148 | acpi_tb_install_fixed_table(acpi_physical_address address, | 150 | acpi_tb_install_fixed_table(acpi_physical_address address, |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 4dfe6c07b004..815003d81b5c 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -484,7 +484,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
484 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 484 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
485 | status = acpi_tb_install_non_fixed_table(ACPI_PTR_TO_PHYSADDR(table), | 485 | status = acpi_tb_install_non_fixed_table(ACPI_PTR_TO_PHYSADDR(table), |
486 | ACPI_TABLE_ORIGIN_INTERN_VIRTUAL, | 486 | ACPI_TABLE_ORIGIN_INTERN_VIRTUAL, |
487 | TRUE, &table_index); | 487 | TRUE, TRUE, &table_index); |
488 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | 488 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
489 | if (ACPI_FAILURE(status)) { | 489 | if (ACPI_FAILURE(status)) { |
490 | 490 | ||
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index de10d3245d9c..9835213269e6 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -394,6 +394,7 @@ static void acpi_tb_release_temporal_table(struct acpi_table_desc *table_desc) | |||
394 | * | 394 | * |
395 | * PARAMETERS: table_index - Index into root table array | 395 | * PARAMETERS: table_index - Index into root table array |
396 | * new_table_desc - New table descriptor to install | 396 | * new_table_desc - New table descriptor to install |
397 | * override - Whether override should be performed | ||
397 | * | 398 | * |
398 | * RETURN: None | 399 | * RETURN: None |
399 | * | 400 | * |
@@ -406,7 +407,8 @@ static void acpi_tb_release_temporal_table(struct acpi_table_desc *table_desc) | |||
406 | 407 | ||
407 | void | 408 | void |
408 | acpi_tb_install_and_override_table(u32 table_index, | 409 | acpi_tb_install_and_override_table(u32 table_index, |
409 | struct acpi_table_desc *new_table_desc) | 410 | struct acpi_table_desc *new_table_desc, |
411 | u8 override) | ||
410 | { | 412 | { |
411 | if (table_index >= acpi_gbl_root_table_list.current_table_count) { | 413 | if (table_index >= acpi_gbl_root_table_list.current_table_count) { |
412 | return; | 414 | return; |
@@ -419,7 +421,9 @@ acpi_tb_install_and_override_table(u32 table_index, | |||
419 | * one if desired. Any table within the RSDT/XSDT can be replaced, | 421 | * one if desired. Any table within the RSDT/XSDT can be replaced, |
420 | * including the DSDT which is pointed to by the FADT. | 422 | * including the DSDT which is pointed to by the FADT. |
421 | */ | 423 | */ |
422 | acpi_tb_override_table(new_table_desc); | 424 | if (override) { |
425 | acpi_tb_override_table(new_table_desc); | ||
426 | } | ||
423 | 427 | ||
424 | acpi_tb_install_table(&acpi_gbl_root_table_list.tables[table_index], | 428 | acpi_tb_install_table(&acpi_gbl_root_table_list.tables[table_index], |
425 | new_table_desc->address, new_table_desc->flags, | 429 | new_table_desc->address, new_table_desc->flags, |
@@ -484,7 +488,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address, | |||
484 | goto release_and_exit; | 488 | goto release_and_exit; |
485 | } | 489 | } |
486 | 490 | ||
487 | acpi_tb_install_and_override_table(table_index, &new_table_desc); | 491 | acpi_tb_install_and_override_table(table_index, &new_table_desc, TRUE); |
488 | 492 | ||
489 | release_and_exit: | 493 | release_and_exit: |
490 | 494 | ||
@@ -547,6 +551,7 @@ acpi_tb_is_equivalent_table(struct acpi_table_desc *table_desc, u32 table_index) | |||
547 | * address depending on the table_flags) | 551 | * address depending on the table_flags) |
548 | * flags - Flags for the table | 552 | * flags - Flags for the table |
549 | * reload - Whether reload should be performed | 553 | * reload - Whether reload should be performed |
554 | * override - Whether override should be performed | ||
550 | * table_index - Where the table index is returned | 555 | * table_index - Where the table index is returned |
551 | * | 556 | * |
552 | * RETURN: Status | 557 | * RETURN: Status |
@@ -562,7 +567,8 @@ acpi_tb_is_equivalent_table(struct acpi_table_desc *table_desc, u32 table_index) | |||
562 | 567 | ||
563 | acpi_status | 568 | acpi_status |
564 | acpi_tb_install_non_fixed_table(acpi_physical_address address, | 569 | acpi_tb_install_non_fixed_table(acpi_physical_address address, |
565 | u8 flags, u8 reload, u32 *table_index) | 570 | u8 flags, |
571 | u8 reload, u8 override, u32 *table_index) | ||
566 | { | 572 | { |
567 | u32 i; | 573 | u32 i; |
568 | acpi_status status = AE_OK; | 574 | acpi_status status = AE_OK; |
@@ -687,7 +693,7 @@ acpi_tb_install_non_fixed_table(acpi_physical_address address, | |||
687 | goto release_and_exit; | 693 | goto release_and_exit; |
688 | } | 694 | } |
689 | *table_index = i; | 695 | *table_index = i; |
690 | acpi_tb_install_and_override_table(i, &new_table_desc); | 696 | acpi_tb_install_and_override_table(i, &new_table_desc, override); |
691 | 697 | ||
692 | release_and_exit: | 698 | release_and_exit: |
693 | 699 | ||
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 1bf9de7c6636..aa11949815df 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -474,7 +474,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
474 | (table_entry, | 474 | (table_entry, |
475 | table_entry_size), | 475 | table_entry_size), |
476 | ACPI_TABLE_ORIGIN_INTERN_PHYSICAL, | 476 | ACPI_TABLE_ORIGIN_INTERN_PHYSICAL, |
477 | FALSE, &table_index); | 477 | FALSE, TRUE, &table_index); |
478 | 478 | ||
479 | if (ACPI_SUCCESS(status) && | 479 | if (ACPI_SUCCESS(status) && |
480 | ACPI_COMPARE_NAME(&acpi_gbl_root_table_list. | 480 | ACPI_COMPARE_NAME(&acpi_gbl_root_table_list. |
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 3f9eaf5c9fb7..529f633efa55 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c | |||
@@ -195,6 +195,45 @@ unlock_and_exit: | |||
195 | 195 | ||
196 | /******************************************************************************* | 196 | /******************************************************************************* |
197 | * | 197 | * |
198 | * FUNCTION: acpi_install_table | ||
199 | * | ||
200 | * PARAMETERS: address - Address of the ACPI table to be installed. | ||
201 | * physical - Whether the address is a physical table | ||
202 | * address or not | ||
203 | * | ||
204 | * RETURN: Status | ||
205 | * | ||
206 | * DESCRIPTION: Dynamically install an ACPI table. | ||
207 | * Note: This function should only be invoked after | ||
208 | * acpi_initialize_tables() and before acpi_load_tables(). | ||
209 | * | ||
210 | ******************************************************************************/ | ||
211 | |||
212 | acpi_status __init | ||
213 | acpi_install_table(acpi_physical_address address, u8 physical) | ||
214 | { | ||
215 | acpi_status status; | ||
216 | u8 flags; | ||
217 | u32 table_index; | ||
218 | |||
219 | ACPI_FUNCTION_TRACE(acpi_install_table); | ||
220 | |||
221 | if (physical) { | ||
222 | flags = ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL; | ||
223 | } else { | ||
224 | flags = ACPI_TABLE_ORIGIN_INTERN_PHYSICAL; | ||
225 | } | ||
226 | |||
227 | status = acpi_tb_install_non_fixed_table(address, flags, | ||
228 | FALSE, FALSE, &table_index); | ||
229 | |||
230 | return_ACPI_STATUS(status); | ||
231 | } | ||
232 | |||
233 | ACPI_EXPORT_SYMBOL_INIT(acpi_install_table) | ||
234 | |||
235 | /******************************************************************************* | ||
236 | * | ||
198 | * FUNCTION: acpi_load_table | 237 | * FUNCTION: acpi_load_table |
199 | * | 238 | * |
200 | * PARAMETERS: table - Pointer to a buffer containing the ACPI | 239 | * PARAMETERS: table - Pointer to a buffer containing the ACPI |
@@ -209,7 +248,6 @@ unlock_and_exit: | |||
209 | * to ensure that the table is not deleted or unmapped. | 248 | * to ensure that the table is not deleted or unmapped. |
210 | * | 249 | * |
211 | ******************************************************************************/ | 250 | ******************************************************************************/ |
212 | |||
213 | acpi_status acpi_load_table(struct acpi_table_header *table) | 251 | acpi_status acpi_load_table(struct acpi_table_header *table) |
214 | { | 252 | { |
215 | acpi_status status; | 253 | acpi_status status; |
@@ -236,7 +274,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table) | |||
236 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 274 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
237 | status = acpi_tb_install_non_fixed_table(ACPI_PTR_TO_PHYSADDR(table), | 275 | status = acpi_tb_install_non_fixed_table(ACPI_PTR_TO_PHYSADDR(table), |
238 | ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL, | 276 | ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL, |
239 | TRUE, &table_index); | 277 | TRUE, FALSE, &table_index); |
240 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | 278 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
241 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
242 | goto unlock_and_exit; | 280 | goto unlock_and_exit; |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2280c190536d..8dc934073620 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -164,6 +164,9 @@ acpi_decode_pld_buffer(u8 *in_buffer, | |||
164 | /* | 164 | /* |
165 | * ACPI table load/unload interfaces | 165 | * ACPI table load/unload interfaces |
166 | */ | 166 | */ |
167 | acpi_status __init | ||
168 | acpi_install_table(acpi_physical_address address, u8 physical); | ||
169 | |||
167 | acpi_status acpi_load_table(struct acpi_table_header *table); | 170 | acpi_status acpi_load_table(struct acpi_table_header *table); |
168 | 171 | ||
169 | acpi_status acpi_unload_parent_table(acpi_handle object); | 172 | acpi_status acpi_unload_parent_table(acpi_handle object); |