aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-03-15 14:53:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-15 14:58:04 -0400
commit9a9e0d685553af76cb6ae2af93cca4913e7fcd47 (patch)
treec4f041b0f7fa28db46841336135d493d587435ea
parentce636452343af0522d2666157dab9c2096f4f996 (diff)
ACPI: Remove ACPI_CUSTOM_DSDT_INITRD option
This essentially reverts commit 71fc47a9adf8ee89e5c96a47222915c5485ac437 ("ACPI: basic initramfs DSDT override support"), because the code simply isn't ready. It did ugly things to the init sequence to populate the rootfs image early, but that just ended up showing other problems with the whole approach. The fact is, the VFS layer simply isn't initialized this early, and the relevant ACPI code should either run much later, or this shouldn't be done at all. For 2.6.25, we'll just pick the latter option. We can revisit this concept later if necessary. Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Tilman Schmidt <tilman@imap.cc> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Renninger <trenn@suse.de> Cc: Eric Piel <eric.piel@tremplin-utc.net> Cc: Len Brown <len.brown@intel.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Markus Gaugusch <dsdt@gaugusch.at> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/acpi/dsdt-override.txt12
-rwxr-xr-xDocumentation/acpi/initramfs-add-dsdt.sh43
-rw-r--r--Documentation/kernel-parameters.txt3
-rw-r--r--drivers/acpi/Kconfig11
-rw-r--r--drivers/acpi/osl.c84
-rw-r--r--init/initramfs.c8
-rw-r--r--init/main.c7
7 files changed, 3 insertions, 165 deletions
diff --git a/Documentation/acpi/dsdt-override.txt b/Documentation/acpi/dsdt-override.txt
index 5008f256a2db..febbb1ba4d23 100644
--- a/Documentation/acpi/dsdt-override.txt
+++ b/Documentation/acpi/dsdt-override.txt
@@ -1,15 +1,7 @@
1Linux supports two methods of overriding the BIOS DSDT: 1Linux supports a method of overriding the BIOS DSDT:
2 2
3CONFIG_ACPI_CUSTOM_DSDT builds the image into the kernel. 3CONFIG_ACPI_CUSTOM_DSDT builds the image into the kernel.
4 4
5CONFIG_ACPI_CUSTOM_DSDT_INITRD adds the image to the initrd. 5When to use this method is described in detail on the
6
7When to use these methods is described in detail on the
8Linux/ACPI home page: 6Linux/ACPI home page:
9http://www.lesswatts.org/projects/acpi/overridingDSDT.php 7http://www.lesswatts.org/projects/acpi/overridingDSDT.php
10
11Note that if both options are used, the DSDT supplied
12by the INITRD method takes precedence.
13
14Documentation/initramfs-add-dsdt.sh is provided for convenience
15for use with the CONFIG_ACPI_CUSTOM_DSDT_INITRD method.
diff --git a/Documentation/acpi/initramfs-add-dsdt.sh b/Documentation/acpi/initramfs-add-dsdt.sh
deleted file mode 100755
index 17ef6e838e14..000000000000
--- a/Documentation/acpi/initramfs-add-dsdt.sh
+++ /dev/null
@@ -1,43 +0,0 @@
1#!/bin/bash
2# Adds a DSDT file to the initrd (if it's an initramfs)
3# first argument is the name of archive
4# second argument is the name of the file to add
5# The file will be copied as /DSDT.aml
6
7# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
8# 20060205: this time it should really work
9
10# check the arguments
11if [ $# -ne 2 ]; then
12 program_name=$(basename $0)
13 echo "\
14$program_name: too few arguments
15Usage: $program_name initrd-name.img DSDT-to-add.aml
16Adds a DSDT file to an initrd (in initramfs format)
17
18 initrd-name.img: filename of the initrd in initramfs format
19 DSDT-to-add.aml: filename of the DSDT file to add
20 " 1>&2
21 exit 1
22fi
23
24# we should check it's an initramfs
25
26tempcpio=$(mktemp -d)
27# cleanup on exit, hangup, interrupt, quit, termination
28trap 'rm -rf $tempcpio' 0 1 2 3 15
29
30# extract the archive
31gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
32
33# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
34cp -f "$2" "$tempcpio"/DSDT.aml
35
36# add the file
37cd "$tempcpio"
38(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
39cd "$OLDPWD"
40
41# re-compress the archive
42gzip -c "$tempcpio"/initramfs.cpio > "$1"
43
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 49318b99e581..622f7849edb9 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -177,9 +177,6 @@ and is between 256 and 4096 characters. It is defined in the file
177 177
178 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT 178 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
179 179
180 acpi_no_initrd_override [KNL,ACPI]
181 Disable loading custom ACPI tables from the initramfs
182
183 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 180 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
184 Format: To spoof as Windows 98: ="Microsoft Windows" 181 Format: To spoof as Windows 98: ="Microsoft Windows"
185 182
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index fbcaa069be86..b4f5e8542829 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -300,17 +300,6 @@ config ACPI_CUSTOM_DSDT
300 bool 300 bool
301 default ACPI_CUSTOM_DSDT_FILE != "" 301 default ACPI_CUSTOM_DSDT_FILE != ""
302 302
303config ACPI_CUSTOM_DSDT_INITRD
304 bool "Read Custom DSDT from initramfs"
305 depends on BLK_DEV_INITRD
306 default n
307 help
308 This option supports a custom DSDT by optionally loading it from initrd.
309 See Documentation/acpi/dsdt-override.txt
310
311 If you are not using this feature now, but may use it later,
312 it is safe to say Y here.
313
314config ACPI_BLACKLIST_YEAR 303config ACPI_BLACKLIST_YEAR
315 int "Disable ACPI for systems before Jan 1st this year" if X86_32 304 int "Disable ACPI for systems before Jan 1st this year" if X86_32
316 default 0 305 default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 065819ba87c7..a697fb6cf050 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -91,10 +91,6 @@ static DEFINE_SPINLOCK(acpi_res_lock);
91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
92static char osi_additional_string[OSI_STRING_LENGTH_MAX]; 92static char osi_additional_string[OSI_STRING_LENGTH_MAX];
93 93
94#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
95static int acpi_no_initrd_override;
96#endif
97
98/* 94/*
99 * "Ode to _OSI(Linux)" 95 * "Ode to _OSI(Linux)"
100 * 96 *
@@ -324,67 +320,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
324 return AE_OK; 320 return AE_OK;
325} 321}
326 322
327#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
328static struct acpi_table_header *acpi_find_dsdt_initrd(void)
329{
330 struct file *firmware_file;
331 mm_segment_t oldfs;
332 unsigned long len, len2;
333 struct acpi_table_header *dsdt_buffer, *ret = NULL;
334 struct kstat stat;
335 char *ramfs_dsdt_name = "/DSDT.aml";
336
337 printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT\n");
338
339 /*
340 * Never do this at home, only the user-space is allowed to open a file.
341 * The clean way would be to use the firmware loader.
342 * But this code must be run before there is any userspace available.
343 * A static/init firmware infrastructure doesn't exist yet...
344 */
345 if (vfs_stat(ramfs_dsdt_name, &stat) < 0)
346 return ret;
347
348 len = stat.size;
349 /* check especially against empty files */
350 if (len <= 4) {
351 printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len);
352 return ret;
353 }
354
355 firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
356 if (IS_ERR(firmware_file)) {
357 printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name);
358 return ret;
359 }
360
361 dsdt_buffer = kmalloc(len, GFP_ATOMIC);
362 if (!dsdt_buffer) {
363 printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len);
364 goto err;
365 }
366
367 oldfs = get_fs();
368 set_fs(KERNEL_DS);
369 len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len,
370 &firmware_file->f_pos);
371 set_fs(oldfs);
372 if (len2 < len) {
373 printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n",
374 len, ramfs_dsdt_name);
375 ACPI_FREE(dsdt_buffer);
376 goto err;
377 }
378
379 printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n",
380 len, ramfs_dsdt_name);
381 ret = dsdt_buffer;
382err:
383 filp_close(firmware_file, NULL);
384 return ret;
385}
386#endif
387
388acpi_status 323acpi_status
389acpi_os_table_override(struct acpi_table_header * existing_table, 324acpi_os_table_override(struct acpi_table_header * existing_table,
390 struct acpi_table_header ** new_table) 325 struct acpi_table_header ** new_table)
@@ -398,16 +333,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
398 if (strncmp(existing_table->signature, "DSDT", 4) == 0) 333 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
399 *new_table = (struct acpi_table_header *)AmlCode; 334 *new_table = (struct acpi_table_header *)AmlCode;
400#endif 335#endif
401#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
402 if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
403 !acpi_no_initrd_override) {
404 struct acpi_table_header *initrd_table;
405
406 initrd_table = acpi_find_dsdt_initrd();
407 if (initrd_table)
408 *new_table = initrd_table;
409 }
410#endif
411 if (*new_table != NULL) { 336 if (*new_table != NULL) {
412 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " 337 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
413 "this is unsafe: tainting kernel\n", 338 "this is unsafe: tainting kernel\n",
@@ -418,15 +343,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
418 return AE_OK; 343 return AE_OK;
419} 344}
420 345
421#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
422static int __init acpi_no_initrd_override_setup(char *s)
423{
424 acpi_no_initrd_override = 1;
425 return 1;
426}
427__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
428#endif
429
430static irqreturn_t acpi_irq(int irq, void *dev_id) 346static irqreturn_t acpi_irq(int irq, void *dev_id)
431{ 347{
432 u32 handled; 348 u32 handled;
diff --git a/init/initramfs.c b/init/initramfs.c
index c0b1e0533d80..d53fee8d8604 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -538,7 +538,7 @@ skip:
538 initrd_end = 0; 538 initrd_end = 0;
539} 539}
540 540
541int __init populate_rootfs(void) 541static int __init populate_rootfs(void)
542{ 542{
543 char *err = unpack_to_rootfs(__initramfs_start, 543 char *err = unpack_to_rootfs(__initramfs_start,
544 __initramfs_end - __initramfs_start, 0); 544 __initramfs_end - __initramfs_start, 0);
@@ -577,10 +577,4 @@ int __init populate_rootfs(void)
577 } 577 }
578 return 0; 578 return 0;
579} 579}
580#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
581/*
582 * if this option is enabled, populate_rootfs() is called _earlier_ in the
583 * boot sequence. This insures that the ACPI initialisation can find the file.
584 */
585rootfs_initcall(populate_rootfs); 580rootfs_initcall(populate_rootfs);
586#endif
diff --git a/init/main.c b/init/main.c
index fbb0167c6b8a..99ce94930b09 100644
--- a/init/main.c
+++ b/init/main.c
@@ -102,12 +102,6 @@ static inline void mark_rodata_ro(void) { }
102extern void tc_init(void); 102extern void tc_init(void);
103#endif 103#endif
104 104
105#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
106extern int populate_rootfs(void);
107#else
108static inline void populate_rootfs(void) {}
109#endif
110
111enum system_states system_state; 105enum system_states system_state;
112EXPORT_SYMBOL(system_state); 106EXPORT_SYMBOL(system_state);
113 107
@@ -650,7 +644,6 @@ asmlinkage void __init start_kernel(void)
650 644
651 check_bugs(); 645 check_bugs();
652 646
653 populate_rootfs(); /* For DSDT override from initramfs */
654 acpi_early_init(); /* before LAPIC and SMP init */ 647 acpi_early_init(); /* before LAPIC and SMP init */
655 648
656 /* Do the rest non-__init'ed, we're now alive */ 649 /* Do the rest non-__init'ed, we're now alive */