Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI / tables: Move table override mechanisms to tables.c

This patch moves acpi_os_table_override() and
acpi_os_physical_table_override() to tables.c.

Along with the mechanisms, acpi_initrd_initialize_tables() is also moved to
tables.c to form a static function. The following functions are renamed
according to this change:
1. acpi_initrd_override() -> renamed to early_acpi_table_init(), which
invokes acpi_table_initrd_init()
2. acpi_os_physical_table_override() -> which invokes
acpi_table_initrd_override()
3. acpi_initialize_initrd_tables() -> renamed to acpi_table_initrd_scan()

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Lv Zheng and committed by
Rafael J. Wysocki
5ae74f2c c3b46c73

+294 -285
+1 -1
arch/x86/kernel/setup.c
··· 1139 1139 reserve_initrd(); 1140 1140 1141 1141 #if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD) 1142 - acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start); 1142 + early_acpi_table_init((void *)initrd_start, initrd_end - initrd_start); 1143 1143 #endif 1144 1144 1145 1145 vsmp_init();
-1
drivers/acpi/internal.h
··· 20 20 21 21 #define PREFIX "ACPI: " 22 22 23 - void acpi_initrd_initialize_tables(void); 24 23 acpi_status acpi_os_initialize1(void); 25 24 void init_acpi_device_notify(void); 26 25 int acpi_scan_init(void);
-274
drivers/acpi/osl.c
··· 602 602 return AE_OK; 603 603 } 604 604 605 - static void acpi_table_taint(struct acpi_table_header *table) 606 - { 607 - pr_warn(PREFIX 608 - "Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n", 609 - table->signature, table->oem_table_id); 610 - add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE); 611 - } 612 - 613 - #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE 614 - #include <linux/earlycpio.h> 615 - #include <linux/memblock.h> 616 - 617 - static u64 acpi_tables_addr; 618 - static int all_tables_size; 619 - 620 - /* Copied from acpica/tbutils.c:acpi_tb_checksum() */ 621 - static u8 __init acpi_table_checksum(u8 *buffer, u32 length) 622 - { 623 - u8 sum = 0; 624 - u8 *end = buffer + length; 625 - 626 - while (buffer < end) 627 - sum = (u8) (sum + *(buffer++)); 628 - return sum; 629 - } 630 - 631 - /* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */ 632 - static const char * const table_sigs[] = { 633 - ACPI_SIG_BERT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, ACPI_SIG_EINJ, 634 - ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, ACPI_SIG_MSCT, 635 - ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT, ACPI_SIG_ASF, 636 - ACPI_SIG_BOOT, ACPI_SIG_DBGP, ACPI_SIG_DMAR, ACPI_SIG_HPET, 637 - ACPI_SIG_IBFT, ACPI_SIG_IVRS, ACPI_SIG_MCFG, ACPI_SIG_MCHI, 638 - ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA, 639 - ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT, 640 - ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT, 641 - ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL }; 642 - 643 - #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header) 644 - 645 - #define ACPI_OVERRIDE_TABLES 64 646 - static struct cpio_data __initdata acpi_initrd_files[ACPI_OVERRIDE_TABLES]; 647 - static DECLARE_BITMAP(acpi_initrd_installed, ACPI_OVERRIDE_TABLES); 648 - 649 - #define MAP_CHUNK_SIZE (NR_FIX_BTMAPS << PAGE_SHIFT) 650 - 651 - void __init acpi_initrd_override(void *data, size_t size) 652 - { 653 - int sig, no, table_nr = 0, total_offset = 0; 654 - long offset = 0; 655 - struct acpi_table_header *table; 656 - char cpio_path[32] = "kernel/firmware/acpi/"; 657 - struct cpio_data file; 658 - 659 - if (data == NULL || size == 0) 660 - return; 661 - 662 - for (no = 0; no < ACPI_OVERRIDE_TABLES; no++) { 663 - file = find_cpio_data(cpio_path, data, size, &offset); 664 - if (!file.data) 665 - break; 666 - 667 - data += offset; 668 - size -= offset; 669 - 670 - if (file.size < sizeof(struct acpi_table_header)) { 671 - pr_err("ACPI OVERRIDE: Table smaller than ACPI header [%s%s]\n", 672 - cpio_path, file.name); 673 - continue; 674 - } 675 - 676 - table = file.data; 677 - 678 - for (sig = 0; table_sigs[sig]; sig++) 679 - if (!memcmp(table->signature, table_sigs[sig], 4)) 680 - break; 681 - 682 - if (!table_sigs[sig]) { 683 - pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n", 684 - cpio_path, file.name); 685 - continue; 686 - } 687 - if (file.size != table->length) { 688 - pr_err("ACPI OVERRIDE: File length does not match table length [%s%s]\n", 689 - cpio_path, file.name); 690 - continue; 691 - } 692 - if (acpi_table_checksum(file.data, table->length)) { 693 - pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n", 694 - cpio_path, file.name); 695 - continue; 696 - } 697 - 698 - pr_info("%4.4s ACPI table found in initrd [%s%s][0x%x]\n", 699 - table->signature, cpio_path, file.name, table->length); 700 - 701 - all_tables_size += table->length; 702 - acpi_initrd_files[table_nr].data = file.data; 703 - acpi_initrd_files[table_nr].size = file.size; 704 - table_nr++; 705 - } 706 - if (table_nr == 0) 707 - return; 708 - 709 - acpi_tables_addr = 710 - memblock_find_in_range(0, max_low_pfn_mapped << PAGE_SHIFT, 711 - all_tables_size, PAGE_SIZE); 712 - if (!acpi_tables_addr) { 713 - WARN_ON(1); 714 - return; 715 - } 716 - /* 717 - * Only calling e820_add_reserve does not work and the 718 - * tables are invalid (memory got used) later. 719 - * memblock_reserve works as expected and the tables won't get modified. 720 - * But it's not enough on X86 because ioremap will 721 - * complain later (used by acpi_os_map_memory) that the pages 722 - * that should get mapped are not marked "reserved". 723 - * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area) 724 - * works fine. 725 - */ 726 - memblock_reserve(acpi_tables_addr, all_tables_size); 727 - arch_reserve_mem_area(acpi_tables_addr, all_tables_size); 728 - 729 - /* 730 - * early_ioremap only can remap 256k one time. If we map all 731 - * tables one time, we will hit the limit. Need to map chunks 732 - * one by one during copying the same as that in relocate_initrd(). 733 - */ 734 - for (no = 0; no < table_nr; no++) { 735 - unsigned char *src_p = acpi_initrd_files[no].data; 736 - phys_addr_t size = acpi_initrd_files[no].size; 737 - phys_addr_t dest_addr = acpi_tables_addr + total_offset; 738 - phys_addr_t slop, clen; 739 - char *dest_p; 740 - 741 - total_offset += size; 742 - 743 - while (size) { 744 - slop = dest_addr & ~PAGE_MASK; 745 - clen = size; 746 - if (clen > MAP_CHUNK_SIZE - slop) 747 - clen = MAP_CHUNK_SIZE - slop; 748 - dest_p = early_ioremap(dest_addr & PAGE_MASK, 749 - clen + slop); 750 - memcpy(dest_p + slop, src_p, clen); 751 - early_iounmap(dest_p, clen + slop); 752 - src_p += clen; 753 - dest_addr += clen; 754 - size -= clen; 755 - } 756 - } 757 - } 758 - 759 - acpi_status 760 - acpi_os_physical_table_override(struct acpi_table_header *existing_table, 761 - acpi_physical_address *address, u32 *length) 762 - { 763 - int table_offset = 0; 764 - int table_index = 0; 765 - struct acpi_table_header *table; 766 - u32 table_length; 767 - 768 - *length = 0; 769 - *address = 0; 770 - if (!acpi_tables_addr) 771 - return AE_OK; 772 - 773 - while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) { 774 - table = acpi_os_map_memory(acpi_tables_addr + table_offset, 775 - ACPI_HEADER_SIZE); 776 - if (table_offset + table->length > all_tables_size) { 777 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 778 - WARN_ON(1); 779 - return AE_OK; 780 - } 781 - 782 - table_length = table->length; 783 - 784 - /* Only override tables matched */ 785 - if (test_bit(table_index, acpi_initrd_installed) || 786 - memcmp(existing_table->signature, table->signature, 4) || 787 - memcmp(table->oem_table_id, existing_table->oem_table_id, 788 - ACPI_OEM_TABLE_ID_SIZE)) { 789 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 790 - goto next_table; 791 - } 792 - 793 - *length = table_length; 794 - *address = acpi_tables_addr + table_offset; 795 - acpi_table_taint(existing_table); 796 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 797 - set_bit(table_index, acpi_initrd_installed); 798 - break; 799 - 800 - next_table: 801 - table_offset += table_length; 802 - table_index++; 803 - } 804 - return AE_OK; 805 - } 806 - 807 - void __init acpi_initrd_initialize_tables(void) 808 - { 809 - int table_offset = 0; 810 - int table_index = 0; 811 - u32 table_length; 812 - struct acpi_table_header *table; 813 - 814 - if (!acpi_tables_addr) 815 - return; 816 - 817 - while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) { 818 - table = acpi_os_map_memory(acpi_tables_addr + table_offset, 819 - ACPI_HEADER_SIZE); 820 - if (table_offset + table->length > all_tables_size) { 821 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 822 - WARN_ON(1); 823 - return; 824 - } 825 - 826 - table_length = table->length; 827 - 828 - /* Skip RSDT/XSDT which should only be used for override */ 829 - if (test_bit(table_index, acpi_initrd_installed) || 830 - ACPI_COMPARE_NAME(table->signature, ACPI_SIG_RSDT) || 831 - ACPI_COMPARE_NAME(table->signature, ACPI_SIG_XSDT)) { 832 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 833 - goto next_table; 834 - } 835 - 836 - acpi_table_taint(table); 837 - acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 838 - acpi_install_table(acpi_tables_addr + table_offset, TRUE); 839 - set_bit(table_index, acpi_initrd_installed); 840 - next_table: 841 - table_offset += table_length; 842 - table_index++; 843 - } 844 - } 845 - #else 846 - acpi_status 847 - acpi_os_physical_table_override(struct acpi_table_header *existing_table, 848 - acpi_physical_address *address, 849 - u32 *table_length) 850 - { 851 - *table_length = 0; 852 - *address = 0; 853 - return AE_OK; 854 - } 855 - 856 - void __init acpi_initrd_initialize_tables(void) 857 - { 858 - } 859 - #endif /* CONFIG_ACPI_INITRD_TABLE_OVERRIDE */ 860 - 861 - acpi_status 862 - acpi_os_table_override(struct acpi_table_header *existing_table, 863 - struct acpi_table_header **new_table) 864 - { 865 - if (!existing_table || !new_table) 866 - return AE_BAD_PARAMETER; 867 - 868 - *new_table = NULL; 869 - 870 - #ifdef CONFIG_ACPI_CUSTOM_DSDT 871 - if (strncmp(existing_table->signature, "DSDT", 4) == 0) 872 - *new_table = (struct acpi_table_header *)AmlCode; 873 - #endif 874 - if (*new_table != NULL) 875 - acpi_table_taint(existing_table); 876 - return AE_OK; 877 - } 878 - 879 605 static irqreturn_t acpi_irq(int irq, void *dev_id) 880 606 { 881 607 u32 handled;
+291 -1
drivers/acpi/tables.c
··· 32 32 #include <linux/errno.h> 33 33 #include <linux/acpi.h> 34 34 #include <linux/bootmem.h> 35 + #include <linux/earlycpio.h> 36 + #include <linux/memblock.h> 35 37 #include "internal.h" 36 38 37 39 #define ACPI_MAX_TABLES 128 ··· 435 433 return; 436 434 } 437 435 436 + static void acpi_table_taint(struct acpi_table_header *table) 437 + { 438 + pr_warn("Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n", 439 + table->signature, table->oem_table_id); 440 + add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE); 441 + } 442 + 443 + #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE 444 + static u64 acpi_tables_addr; 445 + static int all_tables_size; 446 + 447 + /* Copied from acpica/tbutils.c:acpi_tb_checksum() */ 448 + static u8 __init acpi_table_checksum(u8 *buffer, u32 length) 449 + { 450 + u8 sum = 0; 451 + u8 *end = buffer + length; 452 + 453 + while (buffer < end) 454 + sum = (u8) (sum + *(buffer++)); 455 + return sum; 456 + } 457 + 458 + /* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */ 459 + static const char * const table_sigs[] = { 460 + ACPI_SIG_BERT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, ACPI_SIG_EINJ, 461 + ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, ACPI_SIG_MSCT, 462 + ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT, ACPI_SIG_ASF, 463 + ACPI_SIG_BOOT, ACPI_SIG_DBGP, ACPI_SIG_DMAR, ACPI_SIG_HPET, 464 + ACPI_SIG_IBFT, ACPI_SIG_IVRS, ACPI_SIG_MCFG, ACPI_SIG_MCHI, 465 + ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA, 466 + ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT, 467 + ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT, 468 + ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL }; 469 + 470 + #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header) 471 + 472 + #define ACPI_OVERRIDE_TABLES 64 473 + static struct cpio_data __initdata acpi_initrd_files[ACPI_OVERRIDE_TABLES]; 474 + static DECLARE_BITMAP(acpi_initrd_installed, ACPI_OVERRIDE_TABLES); 475 + 476 + #define MAP_CHUNK_SIZE (NR_FIX_BTMAPS << PAGE_SHIFT) 477 + 478 + static void __init acpi_table_initrd_init(void *data, size_t size) 479 + { 480 + int sig, no, table_nr = 0, total_offset = 0; 481 + long offset = 0; 482 + struct acpi_table_header *table; 483 + char cpio_path[32] = "kernel/firmware/acpi/"; 484 + struct cpio_data file; 485 + 486 + if (data == NULL || size == 0) 487 + return; 488 + 489 + for (no = 0; no < ACPI_OVERRIDE_TABLES; no++) { 490 + file = find_cpio_data(cpio_path, data, size, &offset); 491 + if (!file.data) 492 + break; 493 + 494 + data += offset; 495 + size -= offset; 496 + 497 + if (file.size < sizeof(struct acpi_table_header)) { 498 + pr_err("ACPI OVERRIDE: Table smaller than ACPI header [%s%s]\n", 499 + cpio_path, file.name); 500 + continue; 501 + } 502 + 503 + table = file.data; 504 + 505 + for (sig = 0; table_sigs[sig]; sig++) 506 + if (!memcmp(table->signature, table_sigs[sig], 4)) 507 + break; 508 + 509 + if (!table_sigs[sig]) { 510 + pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n", 511 + cpio_path, file.name); 512 + continue; 513 + } 514 + if (file.size != table->length) { 515 + pr_err("ACPI OVERRIDE: File length does not match table length [%s%s]\n", 516 + cpio_path, file.name); 517 + continue; 518 + } 519 + if (acpi_table_checksum(file.data, table->length)) { 520 + pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n", 521 + cpio_path, file.name); 522 + continue; 523 + } 524 + 525 + pr_info("%4.4s ACPI table found in initrd [%s%s][0x%x]\n", 526 + table->signature, cpio_path, file.name, table->length); 527 + 528 + all_tables_size += table->length; 529 + acpi_initrd_files[table_nr].data = file.data; 530 + acpi_initrd_files[table_nr].size = file.size; 531 + table_nr++; 532 + } 533 + if (table_nr == 0) 534 + return; 535 + 536 + acpi_tables_addr = 537 + memblock_find_in_range(0, max_low_pfn_mapped << PAGE_SHIFT, 538 + all_tables_size, PAGE_SIZE); 539 + if (!acpi_tables_addr) { 540 + WARN_ON(1); 541 + return; 542 + } 543 + /* 544 + * Only calling e820_add_reserve does not work and the 545 + * tables are invalid (memory got used) later. 546 + * memblock_reserve works as expected and the tables won't get modified. 547 + * But it's not enough on X86 because ioremap will 548 + * complain later (used by acpi_os_map_memory) that the pages 549 + * that should get mapped are not marked "reserved". 550 + * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area) 551 + * works fine. 552 + */ 553 + memblock_reserve(acpi_tables_addr, all_tables_size); 554 + arch_reserve_mem_area(acpi_tables_addr, all_tables_size); 555 + 556 + /* 557 + * early_ioremap only can remap 256k one time. If we map all 558 + * tables one time, we will hit the limit. Need to map chunks 559 + * one by one during copying the same as that in relocate_initrd(). 560 + */ 561 + for (no = 0; no < table_nr; no++) { 562 + unsigned char *src_p = acpi_initrd_files[no].data; 563 + phys_addr_t size = acpi_initrd_files[no].size; 564 + phys_addr_t dest_addr = acpi_tables_addr + total_offset; 565 + phys_addr_t slop, clen; 566 + char *dest_p; 567 + 568 + total_offset += size; 569 + 570 + while (size) { 571 + slop = dest_addr & ~PAGE_MASK; 572 + clen = size; 573 + if (clen > MAP_CHUNK_SIZE - slop) 574 + clen = MAP_CHUNK_SIZE - slop; 575 + dest_p = early_ioremap(dest_addr & PAGE_MASK, 576 + clen + slop); 577 + memcpy(dest_p + slop, src_p, clen); 578 + early_iounmap(dest_p, clen + slop); 579 + src_p += clen; 580 + dest_addr += clen; 581 + size -= clen; 582 + } 583 + } 584 + } 585 + 586 + static acpi_status 587 + acpi_table_initrd_override(struct acpi_table_header *existing_table, 588 + acpi_physical_address *address, u32 *length) 589 + { 590 + int table_offset = 0; 591 + int table_index = 0; 592 + struct acpi_table_header *table; 593 + u32 table_length; 594 + 595 + *length = 0; 596 + *address = 0; 597 + if (!acpi_tables_addr) 598 + return AE_OK; 599 + 600 + while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) { 601 + table = acpi_os_map_memory(acpi_tables_addr + table_offset, 602 + ACPI_HEADER_SIZE); 603 + if (table_offset + table->length > all_tables_size) { 604 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 605 + WARN_ON(1); 606 + return AE_OK; 607 + } 608 + 609 + table_length = table->length; 610 + 611 + /* Only override tables matched */ 612 + if (test_bit(table_index, acpi_initrd_installed) || 613 + memcmp(existing_table->signature, table->signature, 4) || 614 + memcmp(table->oem_table_id, existing_table->oem_table_id, 615 + ACPI_OEM_TABLE_ID_SIZE)) { 616 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 617 + goto next_table; 618 + } 619 + 620 + *length = table_length; 621 + *address = acpi_tables_addr + table_offset; 622 + acpi_table_taint(existing_table); 623 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 624 + set_bit(table_index, acpi_initrd_installed); 625 + break; 626 + 627 + next_table: 628 + table_offset += table_length; 629 + table_index++; 630 + } 631 + return AE_OK; 632 + } 633 + 634 + static void __init acpi_table_initrd_scan(void) 635 + { 636 + int table_offset = 0; 637 + int table_index = 0; 638 + u32 table_length; 639 + struct acpi_table_header *table; 640 + 641 + if (!acpi_tables_addr) 642 + return; 643 + 644 + while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) { 645 + table = acpi_os_map_memory(acpi_tables_addr + table_offset, 646 + ACPI_HEADER_SIZE); 647 + if (table_offset + table->length > all_tables_size) { 648 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 649 + WARN_ON(1); 650 + return; 651 + } 652 + 653 + table_length = table->length; 654 + 655 + /* Skip RSDT/XSDT which should only be used for override */ 656 + if (test_bit(table_index, acpi_initrd_installed) || 657 + ACPI_COMPARE_NAME(table->signature, ACPI_SIG_RSDT) || 658 + ACPI_COMPARE_NAME(table->signature, ACPI_SIG_XSDT)) { 659 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 660 + goto next_table; 661 + } 662 + 663 + acpi_table_taint(table); 664 + acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); 665 + acpi_install_table(acpi_tables_addr + table_offset, TRUE); 666 + set_bit(table_index, acpi_initrd_installed); 667 + next_table: 668 + table_offset += table_length; 669 + table_index++; 670 + } 671 + } 672 + #else 673 + static void __init acpi_table_initrd_init(void *data, size_t size) 674 + { 675 + } 676 + 677 + static acpi_status 678 + acpi_table_initrd_override(struct acpi_table_header *existing_table, 679 + acpi_physical_address *address, 680 + u32 *table_length) 681 + { 682 + *table_length = 0; 683 + *address = 0; 684 + return AE_OK; 685 + } 686 + 687 + static void __init acpi_table_initrd_scan(void) 688 + { 689 + } 690 + #endif /* CONFIG_ACPI_INITRD_TABLE_OVERRIDE */ 691 + 692 + acpi_status 693 + acpi_os_physical_table_override(struct acpi_table_header *existing_table, 694 + acpi_physical_address *address, 695 + u32 *table_length) 696 + { 697 + return acpi_table_initrd_override(existing_table, address, 698 + table_length); 699 + } 700 + 701 + acpi_status 702 + acpi_os_table_override(struct acpi_table_header *existing_table, 703 + struct acpi_table_header **new_table) 704 + { 705 + if (!existing_table || !new_table) 706 + return AE_BAD_PARAMETER; 707 + 708 + *new_table = NULL; 709 + 710 + #ifdef CONFIG_ACPI_CUSTOM_DSDT 711 + if (strncmp(existing_table->signature, "DSDT", 4) == 0) 712 + *new_table = (struct acpi_table_header *)AmlCode; 713 + #endif 714 + if (*new_table != NULL) 715 + acpi_table_taint(existing_table); 716 + return AE_OK; 717 + } 718 + 719 + void __init early_acpi_table_init(void *data, size_t size) 720 + { 721 + acpi_table_initrd_init(data, size); 722 + } 723 + 438 724 /* 439 725 * acpi_table_init() 440 726 * ··· 747 457 status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 748 458 if (ACPI_FAILURE(status)) 749 459 return -EINVAL; 750 - acpi_initrd_initialize_tables(); 460 + acpi_table_initrd_scan(); 751 461 752 462 check_multiple_madt(); 753 463 return 0;
+2 -8
include/linux/acpi.h
··· 190 190 } 191 191 #endif 192 192 193 - #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE 194 - void acpi_initrd_override(void *data, size_t size); 195 - #else 196 - static inline void acpi_initrd_override(void *data, size_t size) 197 - { 198 - } 199 - #endif 200 - 201 193 #define BAD_MADT_ENTRY(entry, end) ( \ 202 194 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 203 195 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) ··· 208 216 int acpi_mps_check (void); 209 217 int acpi_numa_init (void); 210 218 219 + void early_acpi_table_init(void *data, size_t size); 211 220 int acpi_table_init (void); 212 221 int acpi_table_parse(char *id, acpi_tbl_table_handler handler); 213 222 int __init acpi_parse_entries(char *id, unsigned long table_size, ··· 589 596 return NULL; 590 597 } 591 598 599 + static inline void early_acpi_table_init(void *data, size_t size) { } 592 600 static inline void acpi_early_init(void) { } 593 601 static inline void acpi_subsystem_init(void) { } 594 602