aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2017-07-10 03:23:56 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-20 10:38:25 -0400
commit19df56bdf0833a8ad9dfe056931696b9e0e30463 (patch)
treef0a50600978fc6eadcee150345a7ebb534b4c644
parentf9d472ee3214cf8fc3e4b418b376869799adaf67 (diff)
ACPICA: Tables: Add deferred table verification support
ACPICA commit 2dd6c151d5d5e76dacba8f7db9e259fc72982d17 ACPICA commit ffddee6638aced83be18b8bc88569586c1a43e03 This patch allows tables not verified in early stage verfied in acpi_reallocate_root_table(). This is useful for OSPMs like linux where tables cannot be verified in early stage due to early ioremp limitations on some architectures. Reported by Hans de Geode, fixed by Lv Zheng. Link: https://github.com/acpica/acpica/commit/2dd6c151 Link: https://github.com/acpica/acpica/commit/ffddee66 Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/tbdata.c34
-rw-r--r--drivers/acpi/acpica/tbxface.c27
-rw-r--r--include/acpi/actbl.h1
3 files changed, 51 insertions, 11 deletions
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index 577361b05ea9..b19a2f0ea331 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -432,6 +432,15 @@ acpi_tb_check_duplication(struct acpi_table_desc *table_desc, u32 *table_index)
432 /* Check if table is already registered */ 432 /* Check if table is already registered */
433 433
434 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { 434 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
435
436 /* Do not compare with unverified tables */
437
438 if (!
439 (acpi_gbl_root_table_list.tables[i].
440 flags & ACPI_TABLE_IS_VERIFIED)) {
441 continue;
442 }
443
435 /* 444 /*
436 * Check for a table match on the entire table length, 445 * Check for a table match on the entire table length,
437 * not just the header. 446 * not just the header.
@@ -483,6 +492,8 @@ acpi_tb_check_duplication(struct acpi_table_desc *table_desc, u32 *table_index)
483 * 492 *
484 * DESCRIPTION: This function is called to validate and verify the table, the 493 * DESCRIPTION: This function is called to validate and verify the table, the
485 * returned table descriptor is in "VALIDATED" state. 494 * returned table descriptor is in "VALIDATED" state.
495 * Note that 'TableIndex' is required to be set to !NULL to
496 * enable duplication check.
486 * 497 *
487 *****************************************************************************/ 498 *****************************************************************************/
488 499
@@ -554,6 +565,8 @@ acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc,
554 goto invalidate_and_exit; 565 goto invalidate_and_exit;
555 } 566 }
556 } 567 }
568
569 table_desc->flags |= ACPI_TABLE_IS_VERIFIED;
557 } 570 }
558 571
559 return_ACPI_STATUS(status); 572 return_ACPI_STATUS(status);
@@ -579,6 +592,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
579{ 592{
580 struct acpi_table_desc *tables; 593 struct acpi_table_desc *tables;
581 u32 table_count; 594 u32 table_count;
595 u32 current_table_count, max_table_count;
596 u32 i;
582 597
583 ACPI_FUNCTION_TRACE(tb_resize_root_table_list); 598 ACPI_FUNCTION_TRACE(tb_resize_root_table_list);
584 599
@@ -598,8 +613,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
598 table_count = acpi_gbl_root_table_list.current_table_count; 613 table_count = acpi_gbl_root_table_list.current_table_count;
599 } 614 }
600 615
601 tables = ACPI_ALLOCATE_ZEROED(((acpi_size)table_count + 616 max_table_count = table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT;
602 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 617 tables = ACPI_ALLOCATE_ZEROED(((acpi_size)max_table_count) *
603 sizeof(struct acpi_table_desc)); 618 sizeof(struct acpi_table_desc));
604 if (!tables) { 619 if (!tables) {
605 ACPI_ERROR((AE_INFO, 620 ACPI_ERROR((AE_INFO,
@@ -609,9 +624,16 @@ acpi_status acpi_tb_resize_root_table_list(void)
609 624
610 /* Copy and free the previous table array */ 625 /* Copy and free the previous table array */
611 626
627 current_table_count = 0;
612 if (acpi_gbl_root_table_list.tables) { 628 if (acpi_gbl_root_table_list.tables) {
613 memcpy(tables, acpi_gbl_root_table_list.tables, 629 for (i = 0; i < table_count; i++) {
614 (acpi_size)table_count * sizeof(struct acpi_table_desc)); 630 if (acpi_gbl_root_table_list.tables[i].address) {
631 memcpy(tables + current_table_count,
632 acpi_gbl_root_table_list.tables + i,
633 sizeof(struct acpi_table_desc));
634 current_table_count++;
635 }
636 }
615 637
616 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 638 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
617 ACPI_FREE(acpi_gbl_root_table_list.tables); 639 ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -619,8 +641,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
619 } 641 }
620 642
621 acpi_gbl_root_table_list.tables = tables; 643 acpi_gbl_root_table_list.tables = tables;
622 acpi_gbl_root_table_list.max_table_count = 644 acpi_gbl_root_table_list.max_table_count = max_table_count;
623 table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT; 645 acpi_gbl_root_table_list.current_table_count = current_table_count;
624 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED; 646 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
625 647
626 return_ACPI_STATUS(AE_OK); 648 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 38c01049afd5..26ad596c973e 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -167,7 +167,8 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_tables)
167acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void) 167acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
168{ 168{
169 acpi_status status; 169 acpi_status status;
170 u32 i; 170 struct acpi_table_desc *table_desc;
171 u32 i, j;
171 172
172 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); 173 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
173 174
@@ -179,6 +180,8 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
179 return_ACPI_STATUS(AE_SUPPORT); 180 return_ACPI_STATUS(AE_SUPPORT);
180 } 181 }
181 182
183 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
184
182 /* 185 /*
183 * Ensure OS early boot logic, which is required by some hosts. If the 186 * Ensure OS early boot logic, which is required by some hosts. If the
184 * table state is reported to be wrong, developers should fix the 187 * table state is reported to be wrong, developers should fix the
@@ -186,11 +189,11 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
186 * early stage. 189 * early stage.
187 */ 190 */
188 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { 191 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
189 if (acpi_gbl_root_table_list.tables[i].pointer) { 192 table_desc = &acpi_gbl_root_table_list.tables[i];
193 if (table_desc->pointer) {
190 ACPI_ERROR((AE_INFO, 194 ACPI_ERROR((AE_INFO,
191 "Table [%4.4s] is not invalidated during early boot stage", 195 "Table [%4.4s] is not invalidated during early boot stage",
192 acpi_gbl_root_table_list.tables[i]. 196 table_desc->signature.ascii));
193 signature.ascii));
194 } 197 }
195 } 198 }
196 199
@@ -200,11 +203,25 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
200 * table initilization here once the flag is set. 203 * table initilization here once the flag is set.
201 */ 204 */
202 acpi_gbl_enable_table_validation = TRUE; 205 acpi_gbl_enable_table_validation = TRUE;
206 for (i = 0; i < acpi_gbl_root_table_list.current_table_count;
207 ++i) {
208 table_desc = &acpi_gbl_root_table_list.tables[i];
209 if (!(table_desc->flags & ACPI_TABLE_IS_VERIFIED)) {
210 status =
211 acpi_tb_verify_temp_table(table_desc, NULL,
212 &j);
213 if (ACPI_FAILURE(status)) {
214 acpi_tb_uninstall_table(table_desc);
215 }
216 }
217 }
203 } 218 }
204 219
205 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE; 220 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE;
206
207 status = acpi_tb_resize_root_table_list(); 221 status = acpi_tb_resize_root_table_list();
222 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
223
224 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
208 return_ACPI_STATUS(status); 225 return_ACPI_STATUS(status);
209} 226}
210 227
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index bdc55c0da19c..89509b86cb54 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -394,6 +394,7 @@ struct acpi_table_desc {
394#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */ 394#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */
395#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */ 395#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */
396#define ACPI_TABLE_ORIGIN_MASK (3) 396#define ACPI_TABLE_ORIGIN_MASK (3)
397#define ACPI_TABLE_IS_VERIFIED (4)
397#define ACPI_TABLE_IS_LOADED (8) 398#define ACPI_TABLE_IS_LOADED (8)
398 399
399/* 400/*