Skip to content

Commit 98a455d

Browse files
Shunyong Yangrafaeljw
authored andcommitted
ACPI / tables: table override from built-in initrd
In some scenario, we need to build initrd with kernel in a single image. This can simplify system deployment process by downloading the whole system once, such as in IC verification. This patch adds support to override ACPI tables from built-in initrd. Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com> [ rjw: Minor cleanups ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1c7fc5c commit 98a455d

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

Documentation/acpi/initrd_table_override.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ upgrade the ACPI execution environment that is defined by the ACPI tables
1414
via upgrading the ACPI tables provided by the BIOS with an instrumented,
1515
modified, more recent version one, or installing brand new ACPI tables.
1616

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+
1721
For a full list of ACPI tables that can be upgraded/installed, take a look
1822
at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in
1923
drivers/acpi/tables.c.

drivers/acpi/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,16 @@ config ACPI_TABLE_UPGRADE
357357
initrd, therefore it's safe to say Y.
358358
See Documentation/acpi/initrd_table_override.txt for details
359359

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+
360370
config ACPI_DEBUG
361371
bool "Debug Statements"
362372
help

drivers/acpi/tables.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,22 @@ static DECLARE_BITMAP(acpi_initrd_installed, NR_ACPI_INITRD_TABLES);
473473

474474
void __init acpi_table_upgrade(void)
475475
{
476-
void *data = (void *)initrd_start;
477-
size_t size = initrd_end - initrd_start;
476+
void *data;
477+
size_t size;
478478
int sig, no, table_nr = 0, total_offset = 0;
479479
long offset = 0;
480480
struct acpi_table_header *table;
481481
char cpio_path[32] = "kernel/firmware/acpi/";
482482
struct cpio_data file;
483483

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+
484492
if (data == NULL || size == 0)
485493
return;
486494

include/linux/initrd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ extern phys_addr_t phys_initrd_start;
2525
extern unsigned long phys_initrd_size;
2626

2727
extern unsigned int real_root_dev;
28+
29+
extern char __initramfs_start[];
30+
extern unsigned long __initramfs_size;

0 commit comments

Comments
 (0)