Skip to contentSkip to conversation

ACPI: Store valid ACPI tables passed via early initrd in reserved memblock areas

tip:x86/acpi In review tip-bot for Thomas Renninger 2 participants 3 messages Oct 1, 2012 – Oct 2, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Commit-ID:  53aac44c904abbad9f474f652f099de13b5c3563
Gitweb:     http://git.kernel.org/tip/53aac44c904abbad9f474f652f099de13b5c3563
Author:     Thomas Renninger <[email protected]>
AuthorDate: Mon, 1 Oct 2012 00:23:54 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Sun, 30 Sep 2012 18:03:23 -0700

ACPI: Store valid ACPI tables passed via early initrd in reserved memblock areas

A later patch will compare them with ACPI tables that get loaded at boot or runtime and if criteria match, a stored one is loaded.

---
 arch/x86/kernel/setup.c |    2 +
 drivers/acpi/Kconfig    |    9 ++++
 drivers/acpi/osl.c      |  122 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/acpi.h    |    8 +++
 4 files changed, 141 insertions(+), 0 deletions(-)
arch/x86/kernel/setup.c +2 -0
index f4b9b80..764e543 100644
@@ -941,6 +941,8 @@ void __init setup_arch(char **cmdline_p)
 
 	reserve_initrd();
 
+	acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
+
 	reserve_crashkernel();
 
 	vsmp_init();
drivers/acpi/Kconfig +9 -0
index 8099895..8cf7195 100644
@@ -261,6 +261,15 @@ config ACPI_CUSTOM_DSDT
 	bool
 	default ACPI_CUSTOM_DSDT_FILE != ""
 
+config ACPI_INITRD_TABLE_OVERRIDE
+	bool "ACPI tables can be passed via uncompressed cpio in initrd"
+	default n
+	help
+	  This option provides functionality to override arbitrary ACPI tables
+	  via initrd. No functional change if no ACPI tables are passed via
+	  initrd, therefore it's safe to say Y.
+	  See Documentation/acpi/initrd_table_override.txt for details
+
 config ACPI_BLACKLIST_YEAR
 	int "Disable ACPI for systems before Jan 1st this year" if X86_32
 	default 0
drivers/acpi/osl.c +122 -0

128 lines not on this page · raw message

include/linux/acpi.h +8 -0
index 946fd1e..d14081c 100644
@@ -76,6 +76,14 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
 
 typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
 
+#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
+void acpi_initrd_override(void *data, size_t size);
+#else
+static inline void acpi_initrd_override(void *data, size_t size)
+{
+}
+#endif
+
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 void __acpi_unmap_table(char *map, unsigned long size);
 int early_acpi_boot_init(void);
#2 lore raw

PATCH 1/1 ACPI: Fix build when disabled

"ACPI: Store valid ACPI tables passed via early initrd in reserved memblock areas" breaks the build if either CONFIG_ACPI or CONFIG_BLK_DEV_INITRD is disabled:

arch/x86/kernel/setup.c: In function 'setup_arch':
arch/x86/kernel/setup.c:944: error: implicit declaration of function 'acpi_initrd_override'

or

arch/x86/built-in.o: In function `setup_arch':
(.init.text+0x1397): undefined reference to initrd_start' arch/x86/built-in.o: In function setup_arch':
(.init.text+0x139e): undefined reference to `initrd_end'

The dummy acpi_initrd_override() function in acpi.h isn't defined without CONFIG_ACPI and initrd_{start,end} are declared but not defined without CONFIG_BLK_DEV_INITRD.

---
 arch/x86/kernel/setup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/setup.c +2 -0
@@ -941,7 +941,9 @@ void __init setup_arch(char **cmdline_p)
 
 	reserve_initrd();
 
+#if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
 	acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
+#endif
 
 	reserve_crashkernel();
 
#3 lore raw

[tip:x86/acpi] ACPI: Fix build when disabled

Commit-ID:  3dfd8235002727dbd759bb0f80f8ac862f392071
Gitweb:     http://git.kernel.org/tip/3dfd8235002727dbd759bb0f80f8ac862f392071
Author:     David Rientjes <[email protected]>
AuthorDate: Mon, 1 Oct 2012 20:38:47 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Mon, 1 Oct 2012 20:41:43 -0700

ACPI: Fix build when disabled

"ACPI: Store valid ACPI tables passed via early initrd in reserved memblock areas" breaks the build if either CONFIG_ACPI or CONFIG_BLK_DEV_INITRD is disabled:

arch/x86/kernel/setup.c: In function 'setup_arch':
arch/x86/kernel/setup.c:944: error: implicit declaration of function 'acpi_initrd_override'

or

arch/x86/built-in.o: In function `setup_arch':
(.init.text+0x1397): undefined reference to initrd_start' arch/x86/built-in.o: In function setup_arch':
(.init.text+0x139e): undefined reference to `initrd_end'

The dummy acpi_initrd_override() function in acpi.h isn't defined without CONFIG_ACPI and initrd_{start,end} are declared but not defined without CONFIG_BLK_DEV_INITRD.

[ hpa: applying this as a fix, but this really should be done cleaner ]

---
 arch/x86/kernel/setup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/setup.c +2 -0
index 764e543..bf82c1e 100644
@@ -941,7 +941,9 @@ void __init setup_arch(char **cmdline_p)
 
 	reserve_initrd();
 
+#if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
 	acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
+#endif
 
 	reserve_crashkernel();