diff options
| -rw-r--r-- | Documentation/acpi/initrd_table_override.txt | 4 | ||||
| -rw-r--r-- | drivers/acpi/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/acpi/tables.c | 12 | ||||
| -rw-r--r-- | include/linux/initrd.h | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/acpi/initrd_table_override.txt b/Documentation/acpi/initrd_table_override.txt index eb651a6aa285..30437a6db373 100644 --- a/Documentation/acpi/initrd_table_override.txt +++ b/Documentation/acpi/initrd_table_override.txt | |||
| @@ -14,6 +14,10 @@ upgrade the ACPI execution environment that is defined by the ACPI tables | |||
| 14 | via upgrading the ACPI tables provided by the BIOS with an instrumented, | 14 | via upgrading the ACPI tables provided by the BIOS with an instrumented, |
| 15 | modified, more recent version one, or installing brand new ACPI tables. | 15 | modified, more recent version one, or installing brand new ACPI tables. |
| 16 | 16 | ||
| 17 | When building initrd with kernel in a single image, option | ||
| 18 | ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this | ||
| 19 | feature to work. | ||
| 20 | |||
| 17 | For a full list of ACPI tables that can be upgraded/installed, take a look | 21 | For a full list of ACPI tables that can be upgraded/installed, take a look |
| 18 | at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in | 22 | at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in |
| 19 | drivers/acpi/tables.c. | 23 | drivers/acpi/tables.c. |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 90ff0a47c12e..4e015c77e48e 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -357,6 +357,16 @@ config ACPI_TABLE_UPGRADE | |||
| 357 | initrd, therefore it's safe to say Y. | 357 | initrd, therefore it's safe to say Y. |
| 358 | See Documentation/acpi/initrd_table_override.txt for details | 358 | See Documentation/acpi/initrd_table_override.txt for details |
| 359 | 359 | ||
| 360 | config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD | ||
| 361 | bool "Override ACPI tables from built-in initrd" | ||
| 362 | depends on ACPI_TABLE_UPGRADE | ||
| 363 | depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION="" | ||
| 364 | help | ||
| 365 | This option provides functionality to override arbitrary ACPI tables | ||
| 366 | from built-in uncompressed initrd. | ||
| 367 | |||
| 368 | See Documentation/acpi/initrd_table_override.txt for details | ||
| 369 | |||
| 360 | config ACPI_DEBUG | 370 | config ACPI_DEBUG |
| 361 | bool "Debug Statements" | 371 | bool "Debug Statements" |
| 362 | help | 372 | help |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 48eabb6c2d4f..8fccbe49612a 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -473,14 +473,22 @@ static DECLARE_BITMAP(acpi_initrd_installed, NR_ACPI_INITRD_TABLES); | |||
| 473 | 473 | ||
| 474 | void __init acpi_table_upgrade(void) | 474 | void __init acpi_table_upgrade(void) |
| 475 | { | 475 | { |
| 476 | void *data = (void *)initrd_start; | 476 | void *data; |
| 477 | size_t size = initrd_end - initrd_start; | 477 | size_t size; |
| 478 | int sig, no, table_nr = 0, total_offset = 0; | 478 | int sig, no, table_nr = 0, total_offset = 0; |
| 479 | long offset = 0; | 479 | long offset = 0; |
| 480 | struct acpi_table_header *table; | 480 | struct acpi_table_header *table; |
| 481 | char cpio_path[32] = "kernel/firmware/acpi/"; | 481 | char cpio_path[32] = "kernel/firmware/acpi/"; |
| 482 | struct cpio_data file; | 482 | struct cpio_data file; |
| 483 | 483 | ||
| 484 | if (IS_ENABLED(CONFIG_ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD)) { | ||
| 485 | data = __initramfs_start; | ||
| 486 | size = __initramfs_size; | ||
| 487 | } else { | ||
| 488 | data = (void *)initrd_start; | ||
| 489 | size = initrd_end - initrd_start; | ||
| 490 | } | ||
| 491 | |||
| 484 | if (data == NULL || size == 0) | 492 | if (data == NULL || size == 0) |
| 485 | return; | 493 | return; |
| 486 | 494 | ||
diff --git a/include/linux/initrd.h b/include/linux/initrd.h index 14beaff9b445..d77fe34fb00a 100644 --- a/include/linux/initrd.h +++ b/include/linux/initrd.h | |||
| @@ -25,3 +25,6 @@ extern phys_addr_t phys_initrd_start; | |||
| 25 | extern unsigned long phys_initrd_size; | 25 | extern unsigned long phys_initrd_size; |
| 26 | 26 | ||
| 27 | extern unsigned int real_root_dev; | 27 | extern unsigned int real_root_dev; |
| 28 | |||
| 29 | extern char __initramfs_start[]; | ||
| 30 | extern unsigned long __initramfs_size; | ||
