* initrd DSDT override (Re: Feedback about your talk in Rennes France (20080124) : Evolution of the Linux kernel & virtualization technologies)
[not found] ` <20080125063328.4e3b4752.akpm@linux-foundation.org>
@ 2008-01-26 4:39 ` Len Brown
2008-01-30 17:27 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
0 siblings, 1 reply; 38+ messages in thread
From: Len Brown @ 2008-01-26 4:39 UTC (permalink / raw)
To: trenn; +Cc: Andrew Morton, Philippe Coval, linux-acpi
> > I am annoyed by this missing (or rejected) feature upstream : DSDT
> > http://gaugusch.at/kernel.shtml
> >
> > So to use "custom DSDT loading" I have to patch my laptop buggy BIOS
> >
> > As usual, I reported this issue to the vendor (which goes nowhere so far) :
> > http://support.fujitsu-siemens.de/forum/viewtopic.php?p=37001
> >
> > Hopefully many distro already include this patch, but not all of them
> > such as debian :
> > http://bugs.debian.org/251023
> > http://wiki.debian.org/DebianKernelPatchAcceptanceGuidelines
> >
> > So as a debian contributor, I keep staying on debian and compile my own
> > kernel
> > and provide it to a "amiloa laptop" community I am managing :
> > http://tech.groups.yahoo.com/group/amilo/
> >
> > It's ok for me I can live with this, but what average users have to do
> > with their (buggy) hardware ?
>
> Philosophically speaking: we sholdn't be making decisions for other people
> like this.
>
> Practically speaking: the fact that distros are shipping it is a huge
> indication that the decision was wrong.
>
> Len? I think we goofed here.
Here is the existing supported DSDT override method:
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
and at the bottom of that page I point to the alternate initrd
method and explain why I've not applied it upstream.
My goal for the Linux/ACPI project is to make Linux
work out-of-the-box on any system where Windows works.
Giving "Joe User", who is incapable of compiling
a kernel, an easy method to override his BIOS image
makes him more likely to settle for a workaround.
And that effort undermines, rather than supports, our goal.
However, Philippe points out that the FSC Amilo box
also fails the same way under Windows -- and the
vendor is unwilling or unable to fix their BIOS.
While Phillippe could build a kernel from source
and link in a DSDT via the supported developer method above,
or he could run SuSE or Ubuntu which include the initrd
patch, he'd prefer to track Debian w/o re-compiling.
I'm fine with making it more convenient for
FSC Amilo ownersr to make their laptops work better
under Linux than under Windows -- even if it is impossible
for a Linux distro to support the resulting configuration.
They're otherwise stuck with junk hardware or extra work.
Also, Thomas continues to assert that this patch
makes SuSE easier to debug in the field b/c he can convince
users who are unable to re-compile their kernel
go ahead and override their BIOS image for debugging
(bless their trusting hearts;-)
So at the risk that we're giving "Joe User" more
than enough rope to hang themselves, lets do it --
with some strings attached...
Thomas,
Since you've been a big supporter of this patch, perhaps you
can update it and submit it to the list for review?
I think it needs the following changes:
1. tainted bit needs to be set when a DSDT override is used.
(this is common both to the new patch and the current
override method)
2. upon setting the tainted bit, print a BIG FAT WARNING
that this is not a supported configuration.
3. cmdline option needs to be available to disable
an override. Otherwise a bad image in the intrd
may be a serious pickle for some users.
4. get rid of alarming failure message:
+ printk(KERN_INFO "Looking for DSDT in initrd ...");
...
+ printk(" not found!\n");
Probably it is best to forward the original patch
w/ proper credits, and then send updates to address 1-4.
thanks,
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] Override DSDT and SSDTs via initramfs
2008-01-26 4:39 ` initrd DSDT override (Re: Feedback about your talk in Rennes France (20080124) : Evolution of the Linux kernel & virtualization technologies) Len Brown
@ 2008-01-30 17:27 ` Thomas Renninger
2008-01-30 22:36 ` Éric Piel
0 siblings, 1 reply; 38+ messages in thread
From: Thomas Renninger @ 2008-01-30 17:27 UTC (permalink / raw)
To: Len Brown; +Cc: Andrew Morton, Philippe Coval, linux-acpi, eric, dsdt
Hi,
you find some comments inlined and the patch which is shipped in
OpenSUSE at the end.
On Fri, 2008-01-25 at 23:39 -0500, Len Brown wrote:
> > > I am annoyed by this missing (or rejected) feature upstream : DSDT
> > > http://gaugusch.at/kernel.shtml
> > >
> > > So to use "custom DSDT loading" I have to patch my laptop buggy BIOS
> > >
> > > As usual, I reported this issue to the vendor (which goes nowhere so far) :
> > > http://support.fujitsu-siemens.de/forum/viewtopic.php?p=37001
> > >
> > > Hopefully many distro already include this patch, but not all of them
> > > such as debian :
> > > http://bugs.debian.org/251023
> > > http://wiki.debian.org/DebianKernelPatchAcceptanceGuidelines
> > >
> > > So as a debian contributor, I keep staying on debian and compile my own
> > > kernel
> > > and provide it to a "amiloa laptop" community I am managing :
> > > http://tech.groups.yahoo.com/group/amilo/
> > >
> > > It's ok for me I can live with this, but what average users have to do
> > > with their (buggy) hardware ?
> >
> > Philosophically speaking: we sholdn't be making decisions for other people
> > like this.
> >
> > Practically speaking: the fact that distros are shipping it is a huge
> > indication that the decision was wrong.
IMO, Vista providing a feature to easily override the DSDT via a simple
registry pointer to a modified DSDT, is an argument you cannot come
around...
The purpose of the feature should definitely not be to provide the
possibility to workaround buggy BIOSes, but as done by Vista for
debugging and testing.
> > Len? I think we goofed here.
>
> Here is the existing supported DSDT override method:
>
> http://www.lesswatts.org/projects/acpi/overridingDSDT.php
>
> and at the bottom of that page I point to the alternate initrd
> method and explain why I've not applied it upstream.
>
> My goal for the Linux/ACPI project is to make Linux
> work out-of-the-box on any system where Windows works.
>
> Giving "Joe User", who is incapable of compiling
> a kernel, an easy method to override his BIOS image
> makes him more likely to settle for a workaround.
> And that effort undermines, rather than supports, our goal.
>
> However, Philippe points out that the FSC Amilo box
> also fails the same way under Windows -- and the
> vendor is unwilling or unable to fix their BIOS.
> While Phillippe could build a kernel from source
> and link in a DSDT via the supported developer method above,
> or he could run SuSE or Ubuntu which include the initrd
> patch, he'd prefer to track Debian w/o re-compiling.
>
> I'm fine with making it more convenient for
> FSC Amilo ownersr to make their laptops work better
> under Linux than under Windows -- even if it is impossible
> for a Linux distro to support the resulting configuration.
> They're otherwise stuck with junk hardware or extra work.
>
> Also, Thomas continues to assert that this patch
> makes SuSE easier to debug in the field b/c he can convince
> users who are unable to re-compile their kernel
> go ahead and override their BIOS image for debugging
> (bless their trusting hearts;-)
>
> So at the risk that we're giving "Joe User" more
> than enough rope to hang themselves, lets do it --
> with some strings attached...
>
> Thomas,
> Since you've been a big supporter of this patch, perhaps you
> can update it and submit it to the list for review?
>
> I think it needs the following changes:
>
> 1. tainted bit needs to be set when a DSDT override is used.
> (this is common both to the new patch and the current
> override method)
>
> 2. upon setting the tainted bit, print a BIG FAT WARNING
> that this is not a supported configuration.
>
> 3. cmdline option needs to be available to disable
> an override. Otherwise a bad image in the intrd
> may be a serious pickle for some users.
>
> 4. get rid of alarming failure message:
>
> + printk(KERN_INFO "Looking for DSDT in initrd ...");
> ...
> + printk(" not found!\n");
>
> Probably it is best to forward the original patch
> w/ proper credits, and then send updates to address 1-4.
I do not know who initially came up with this, I just modified/adjusted
the patch sometimes. I expect it's Markus, possibly Eric or best both
who should be mentioned as author.
The patch should be against a quite recent vanilla kernel, tell me if
you have problems with patching/merging and tell me against which
kernel/git version/tree you like to have it.
Jeff (Mahony) has adjusted the last bits of it when he updated it to the
latest rcX-gitY version:
Changes:
We no longer call populate_rootfs() twice. If we want the custom DSDT,
we load the rootfs before ACPI. Otherwise, it is loaded at the
appropriate
initcall time. -jeffm
There is a new version at
http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.4-2.6.21.patch,
but there doesn't seem to be any real changes other than elminating the
file
name array.
In fact, I added the array some time ago.
Not sure whether the latest Version of Eric/Markus can also load several
DSDT/SSDTs? Maybe you found a more elegant way?
This is a quite useful feature (which is not provided by the current
"override via compile into kernel" method). You can add several SSDTs
and let them load before any other table is loaded. Duplicated tables
will be ignored later. Like this you can also override single and
multiple SSDTs easily.
There just need to be files:
/DSDT.aml, /SSDT[1-9]?.aml
in the initrd fs.
If you take this one, please do not forget to mention Eric and Markus as
authors.
Thomas
-----------------
Override DSDT and SSDTs via initramfs
Searches and reads in the root of initramfs a DSDT.aml and SSDT[1-9]?.aml files.
The found DSDT and SSDTs are loaded into the ACPI namespace prior any BIOS
provided table. Later (BIOS provided) tables with the same signature are ignored
automatically. Like that the BIOS provided tables can be replaced.
Once a table is loaded via initrd, the kernel gets tainted.
More information can be found here: http://gaugusch.at/kernel.shtml
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
drivers/acpi/Kconfig | 17 ++++++
drivers/acpi/osl.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++--
include/acpi/acpiosxf.h | 4 +
init/initramfs.c | 4 +
init/main.c | 9 +++
5 files changed, 156 insertions(+), 5 deletions(-)
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--- linux-2.6.24.orig/drivers/acpi/Kconfig
+++ linux-2.6.24/drivers/acpi/Kconfig
@@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
Enter the full path name to the file which includes the AmlCode
declaration.
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default y
+ help
+ The DSDT (Differentiated System Description Table) often needs to be
+ overridden because of broken BIOS implementations. If this feature is
+ activated you will be able to provide a customized DSDT by adding it
+ to your initramfs. For now you need to use a special mkinitrd tool.
+ For more details see <file:Documentation/dsdt-initrd.txt> or
+ <http://gaugusch.at/kernel.shtml>. If there is no table found, it
+ will fallback to the custom DSDT in-kernel (if activated) or to the
+ DSDT from the BIOS.
+
+ Even if you do not need a new one at the moment, you may want to use a
+ better implemented DSDT later. It is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
--- linux-2.6.24.orig/drivers/acpi/osl.c
+++ linux-2.6.24/drivers/acpi/osl.c
@@ -68,6 +68,10 @@ EXPORT_SYMBOL(acpi_in_debugger);
extern char line_buf[80];
#endif /*ENABLE_DEBUGGER */
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+int acpi_must_unregister_table = FALSE;
+#endif
+
static unsigned int acpi_irq_irq;
static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context;
@@ -312,6 +316,113 @@ acpi_os_predefined_override(const struct
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+#define MAX_DS_SDTS 10
+static struct acpi_table_header *ds_sdt_buffers[MAX_DS_SDTS];
+static unsigned int tables_loaded = 0;
+
+void acpi_load_override_tables(void){
+ struct file *firmware_file;
+ mm_segment_t oldfs;
+ unsigned long len, len2;
+ struct kstat stat;
+ unsigned int x, y;
+ char *ramfs_ds_sdt_names[MAX_DS_SDTS] = {
+ "/DSDT.aml",
+ "/SSDT.aml",
+ "/SSDT1.aml",
+ "/SSDT2.aml",
+ "/SSDT3.aml",
+ "/SSDT4.aml",
+ "/SSDT5.aml",
+ "/SSDT6.aml",
+ "/SSDT7.aml",
+ "/SSDT8.aml",
+ };
+ /*
+ * Never do this at home, only the user-space is allowed to open a file.
+ * The clean way would be to use the firmware loader. But this code must be run
+ * before there is any userspace available. So we need a static/init firmware
+ * infrastructure, which doesn't exist yet...
+ */
+ for (x = 0; x < MAX_DS_SDTS; x++){
+ if (vfs_stat(ramfs_ds_sdt_names[x], &stat) < 0) {
+ continue;
+ }
+ len = stat.size;
+ /* check especially against empty files */
+ if (len <= 4) {
+ printk("error file %s is too small, only %lu bytes.\n",
+ ramfs_ds_sdt_names[x], len);
+ continue;
+ }
+
+ ds_sdt_buffers[x] = kmalloc(len, GFP_KERNEL);
+ if (!ds_sdt_buffers[x]) {
+ printk("error when allocating %lu bytes of memory.\n",
+ len);
+ /* better free all tables again */
+ for (y = 0; y < x; y++){
+ if (ds_sdt_buffers[y])
+ kfree(ds_sdt_buffers[x]);
+ }
+ acpi_must_unregister_table = FALSE;
+ return;
+ }
+
+ firmware_file = filp_open(ramfs_ds_sdt_names[x], O_RDONLY, 0);
+ if (IS_ERR(firmware_file)) {
+ printk("error, could not open file %s.\n",
+ ramfs_ds_sdt_names[x]);
+ kfree(ds_sdt_buffers[x]);
+ continue;
+ }
+
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ len2 = vfs_read(firmware_file,
+ (char __user *)ds_sdt_buffers[x],
+ len,
+ &firmware_file->f_pos);
+ set_fs(oldfs);
+ filp_close(firmware_file, NULL);
+ if (len2 < len) {
+ printk("error trying to read %lu bytes from %s.\n",
+ len, ramfs_ds_sdt_names[x]);
+ kfree(ds_sdt_buffers[x]);
+ continue;
+ }
+ printk(PREFIX "successfully read %lu bytes from file %s\n",
+ len, ramfs_ds_sdt_names[x]);
+ }
+}
+
+struct acpi_table_header * acpi_find_dsdt_initrd(struct acpi_table_header * t)
+{
+ struct acpi_table_header *ret = NULL;
+ unsigned int x;
+ for (x = 0; x < MAX_DS_SDTS; x++){
+ if (ds_sdt_buffers[x]){
+ if (!memcmp(ds_sdt_buffers[x]->signature,
+ t->signature, 4) &&
+ !memcmp(ds_sdt_buffers[x]->oem_table_id,
+ t->oem_table_id, 8)){
+ ret = ds_sdt_buffers[x];
+ printk(PREFIX "Override [%4.4s-%8.8s]"
+ " from initramfs -"
+ " tainting kernel\n",
+ t->signature,
+ t->oem_table_id);
+ add_taint(TAINT_NO_SUPPORT);
+ acpi_must_unregister_table = TRUE;
+ break;
+ }
+ }
+ }
+ return ret;
+}
+#endif
+
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
@@ -319,13 +430,21 @@ acpi_os_table_override(struct acpi_table
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
+ *new_table = NULL;
+
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
- else
- *new_table = NULL;
-#else
- *new_table = NULL;
+#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if (!tables_loaded){
+ acpi_load_override_tables();
+ tables_loaded = 1;
+ }
+ if (!strncmp(existing_table->signature, "DSDT", 4) ||
+ !strncmp(existing_table->signature, "SSDT", 4)){
+ *new_table = acpi_find_dsdt_initrd(existing_table);
+ }
#endif
return AE_OK;
}
--- linux-2.6.24.orig/include/acpi/acpiosxf.h
+++ linux-2.6.24/include/acpi/acpiosxf.h
@@ -95,6 +95,10 @@ acpi_status
acpi_os_table_override(struct acpi_table_header *existing_table,
struct acpi_table_header **new_table);
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+extern int acpi_must_unregister_table;
+#endif
+
/*
* Spinlock primitives
*/
--- linux-2.6.24.orig/init/initramfs.c
+++ linux-2.6.24/init/initramfs.c
@@ -541,7 +541,7 @@ skip:
#endif
-static int __init populate_rootfs(void)
+int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
@@ -582,4 +582,6 @@ static int __init populate_rootfs(void)
#endif
return 0;
}
+#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
rootfs_initcall(populate_rootfs);
+#endif
--- linux-2.6.24.orig/init/main.c
+++ linux-2.6.24/init/main.c
@@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void)
extern void tc_init(void);
#endif
+#ifdef CONFIG_BLK_DEV_INITRD
+extern int populate_rootfs(void);
+#else
+static inline void populate_rootfs(void) {}
+#endif
+
enum system_states system_state;
EXPORT_SYMBOL(system_state);
@@ -642,6 +648,9 @@ asmlinkage void __init start_kernel(void
check_bugs();
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ populate_rootfs(); /* For DSDT override from initramfs */
+#endif
acpi_early_init(); /* before LAPIC and SMP init */
/* Do the rest non-__init'ed, we're now alive */
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-01-30 17:27 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
@ 2008-01-30 22:36 ` Éric Piel
2008-01-31 19:17 ` Len Brown
` (2 more replies)
0 siblings, 3 replies; 38+ messages in thread
From: Éric Piel @ 2008-01-30 22:36 UTC (permalink / raw)
To: trenn; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
Hi,
Just a few comments for now as I don't have much time until this weekend.
30/01/08 18:27, Thomas Renninger wrote/a écrit:
:
> On Fri, 2008-01-25 at 23:39 -0500, Len Brown wrote:
:
>> Probably it is best to forward the original patch
>> w/ proper credits, and then send updates to address 1-4.
Thomas, the patch you have included is only the "original" patch, right?
We need to address the points 1-4 (which seem very reasonable) later on
with additional patches. I think most of them are already implemented in
http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.2-2.6.17-ssdt.patch
So that should be quite easy :-)
> I do not know who initially came up with this, I just modified/adjusted
> the patch sometimes. I expect it's Markus, possibly Eric or best both
> who should be mentioned as author.
Yep, to be precise, Markus Gaugusch is the original author, I'm just the
current maintainer, and Thomas has been very helpful for a looong time :-)
:
> Jeff (Mahony) has adjusted the last bits of it when he updated it to the
> latest rcX-gitY version:
> Changes:
> We no longer call populate_rootfs() twice. If we want the custom DSDT,
> we load the rootfs before ACPI. Otherwise, it is loaded at the
> appropriate
> initcall time. -jeffm
I had left it this way because I though Linus had a good reason for
delaying populate_rootfs(). But if it works, fine! Maybe some additional
comments should be added in before the #ifdef's to clearly show that
populate_rootfs() is _always_ called, and they modify only the moment it
is called.
> There is a new version at
> http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.4-2.6.21.patch,
> but there doesn't seem to be any real changes other than elminating the
> file
> name array.
Yes, exactly.
> In fact, I added the array some time ago.
> Not sure whether the latest Version of Eric/Markus can also load several
> DSDT/SSDTs? Maybe you found a more elegant way?
Nope. On the website (http://gaugusch.at/kernel.shtml) you can just find
two versions of the patch: one simple and one with your addition for
SSDTs support. At least with SSDTs support there is even an advantage
over the DSDT-in-kernel version :-)
Just one comment about the patch for now: it misses
Documentation/dsdt-initrd.txt . Please include this file too so that the
documentation is provided at the same time (it's in the official patch).
I'll test the patch and try to be productive this weekend.
See you,
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-01-30 22:36 ` Éric Piel
@ 2008-01-31 19:17 ` Len Brown
2008-02-01 9:53 ` Thomas Renninger
2008-02-01 10:21 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
2008-02-07 2:49 ` Len Brown
2 siblings, 1 reply; 38+ messages in thread
From: Len Brown @ 2008-01-31 19:17 UTC (permalink / raw)
To: Éric Piel; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
> > In fact, I added the array some time ago.
> > Not sure whether the latest Version of Eric/Markus can also load several
> > DSDT/SSDTs? Maybe you found a more elegant way?
> Nope. On the website (http://gaugusch.at/kernel.shtml) you can just find
> two versions of the patch: one simple and one with your addition for
> SSDTs support. At least with SSDTs support there is even an advantage
> over the DSDT-in-kernel version :-)
At one point there was a proposal to allow in-kernel SSDT overrides,
but we determined that it was problematic because there can be any
number of SSDTs (so which one does an override apply to?),
some of them auto loaded at RSDT time, and the others
loaded at run-time via Load() in the DSDT (and possibly SSDT) AML.
So we decided that to override an SSDT, you need to override a DSDT,
incorporate whatever SSDT code you want into your DSDT, and boot with the
"acpi_no_auto_ssdt" cmdline parameter to inhibit autoloading
of the RSDT enumerated SSDTs. That gives you complete and total
control over what AML gets run. (you omit that cmdline param
to overide the DSDT but keep the native SSDTs) It also gives you
just 1 DSDT to keep track of.
I'm not clear on how to use the proposed initrd SSDT override capability,
and why it needs to be different from the simple scheme above,
but I wouldn't want a mess there to hold up the rest of the initrd
DSDT override patch series -- since only very rarely is an SSDT
override needed.
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-01-31 19:17 ` Len Brown
@ 2008-02-01 9:53 ` Thomas Renninger
2008-02-01 11:07 ` Alexey Starikovskiy
2008-02-02 4:36 ` Len Brown
0 siblings, 2 replies; 38+ messages in thread
From: Thomas Renninger @ 2008-02-01 9:53 UTC (permalink / raw)
To: Len Brown; +Cc: Éric Piel, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Thu, 2008-01-31 at 14:17 -0500, Len Brown wrote:
> > > In fact, I added the array some time ago.
> > > Not sure whether the latest Version of Eric/Markus can also load several
> > > DSDT/SSDTs? Maybe you found a more elegant way?
>
> > Nope. On the website (http://gaugusch.at/kernel.shtml) you can just find
> > two versions of the patch: one simple and one with your addition for
> > SSDTs support. At least with SSDTs support there is even an advantage
> > over the DSDT-in-kernel version :-)
>
>
> At one point there was a proposal to allow in-kernel SSDT overrides,
> but we determined that it was problematic because there can be any
> number of SSDTs (so which one does an override apply to?),
> some of them auto loaded at RSDT time, and the others
> loaded at run-time via Load() in the DSDT (and possibly SSDT) AML.
Yes and this is easy to solve via initrd.
> So we decided that to override an SSDT, you need to override a DSDT,
> incorporate whatever SSDT code you want into your DSDT, and boot with the
> "acpi_no_auto_ssdt" cmdline parameter to inhibit autoloading
> of the RSDT enumerated SSDTs. That gives you complete and total
> control over what AML gets run. (you omit that cmdline param
> to overide the DSDT but keep the native SSDTs) It also gives you
> just 1 DSDT to keep track of.
I know and it's a rather complex way.
You need to open the DSDT and copy and paste in an editor all SSDTs into
DSDT (inside the last bracket, the global namespace, so simply attaching
it at the very end is not working). Is that correct?
> That gives you complete and total control over what AML gets run
I doubt that. You said there can be any number of SSDTs. If you know
what you are doing..., but how do you explain someone in a bug that he
has to collect all SSDTs (some via acpidump --addr xy) open an editor,
paste them into the DSDT and so on...
I know what you mean and in what pits you could fall, because I've tried
it already, but...
> I'm not clear on how to use the proposed initrd SSDT override capability,
> and why it needs to be different from the simple scheme above,
... it is far away from a simple scheme, sorry.
> but I wouldn't want a mess there to hold up the rest of the initrd
> DSDT override patch series -- since only very rarely is an SSDT
> override needed.
That's true, it's not needed that often and the patch shouldn't be hold
off because of that.
Let me explain again what the intend is:
You pass to initrd e.g.:
/
/DSDT.aml /SSDT1.aml /SSDT2.aml
(maybe it should be done in an own dsdt directory. Like that, one could
check for each file in this directory, instead of the static array files
that get checked, hmmm this possibly should decided now to avoid
incompatibilities).
Anyway, say you have a directory:
/dsdt
with two SSDTs sitting there that get loaded before any other table gets
loaded.
Those tables have been extracted with acpidump, disassembled with iasl
-d, modified (e.g. added some debug code to get printed to syslog) and
recompiled.
Those tables have the same OEM id then the original ones, right?
Tables with the same OEM id (the original ones) should get ignored later
automatically. IIRC I had some problems with dynamically loaded tables,
don't know anymore, they are not that often used and theoretically it
should just work for them also.
I haven't tried too much here, but SSDTs are used more and more often (I
saw a machine with 12 SSDTs, especially on IA64 there might be dozens in
the future). We should think about the problem now, before we have bugs
and need to write down half a book how the reporter finally could
provide some useful information.
Have I overseen something?
Thomas
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-01-30 22:36 ` Éric Piel
2008-01-31 19:17 ` Len Brown
@ 2008-02-01 10:21 ` Thomas Renninger
2008-02-01 10:38 ` Eric Piel
2008-02-07 2:51 ` Len Brown
2008-02-07 2:49 ` Len Brown
2 siblings, 2 replies; 38+ messages in thread
From: Thomas Renninger @ 2008-02-01 10:21 UTC (permalink / raw)
To: Éric Piel; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Wed, 2008-01-30 at 23:36 +0100, Éric Piel wrote:
> Hi,
> Just a few comments for now as I don't have much time until this weekend.
> 30/01/08 18:27, Thomas Renninger wrote/a écrit:
> :
> > On Fri, 2008-01-25 at 23:39 -0500, Len Brown wrote:
> :
> >> Probably it is best to forward the original patch
> >> w/ proper credits, and then send updates to address 1-4.
> Thomas, the patch you have included is only the "original" patch, right?
> We need to address the points 1-4 (which seem very reasonable) later on
> with additional patches. I think most of them are already implemented in
> http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.2-2.6.17-ssdt.patch
> So that should be quite easy :-)
>
> > I do not know who initially came up with this, I just modified/adjusted
> > the patch sometimes. I expect it's Markus, possibly Eric or best both
> > who should be mentioned as author.
> Yep, to be precise, Markus Gaugusch is the original author, I'm just the
> current maintainer, and Thomas has been very helpful for a looong time :-)
Long time is true..., very helpful, don't know, I didn't do that much...
> > Jeff (Mahony) has adjusted the last bits of it when he updated it to the
> > latest rcX-gitY version:
> > Changes:
> > We no longer call populate_rootfs() twice. If we want the custom DSDT,
> > we load the rootfs before ACPI. Otherwise, it is loaded at the
> > appropriate
> > initcall time. -jeffm
> I had left it this way because I though Linus had a good reason for
> delaying populate_rootfs(). But if it works, fine! Maybe some additional
> comments should be added in before the #ifdef's to clearly show that
> populate_rootfs() is _always_ called, and they modify only the moment it
> is called.
I don't know about this, I took that change from your patches...
>
> > There is a new version at
> > http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.4-2.6.21.patch,
> > but there doesn't seem to be any real changes other than elminating the
> > file
> > name array.
> Yes, exactly.
>
> > In fact, I added the array some time ago.
> > Not sure whether the latest Version of Eric/Markus can also load several
> > DSDT/SSDTs? Maybe you found a more elegant way?
> Nope. On the website (http://gaugusch.at/kernel.shtml) you can just find
> two versions of the patch: one simple and one with your addition for
> SSDTs support. At least with SSDTs support there is even an advantage
> over the DSDT-in-kernel version :-)
>
> Just one comment about the patch for now: it misses
> Documentation/dsdt-initrd.txt . Please include this file too so that the
> documentation is provided at the same time (it's in the official patch).
>
> I'll test the patch and try to be productive this weekend.
There is no real need for testing the patch.
It is in OpenSUSE for quite some time. While I don't know how much it
got used, it shouldn't break anything if unused.
As Jeff stated (I haven't had a look at your current version) it should
be nearly the same.
About Len's points 1-4:
1. tainted bit needs to be set when a DSDT override is used.
(this is common both to the new patch and the current
override method)
2. upon setting the tainted bit, print a BIG FAT WARNING
that this is not a supported configuration.
3. cmdline option needs to be available to disable
an override. Otherwise a bad image in the intrd
may be a serious pickle for some users.
4. get rid of alarming failure message:
+ printk(KERN_INFO "Looking for DSDT in initrd ...");
...
+ printk(" not found!\n");
Most of this should be included in the one I sent:
1+2 should be covered by this:
+ printk(PREFIX "Override [%4.4s-%8.8s]"
+ " from initramfs -"
+ " tainting kernel\n",
+ t->signature,
+ t->oem_table_id);
+ add_taint(TAINT_NO_SUPPORT);
I remember that I introduced a new TAINT flag, this got probably ripped
out because I expect it needed conflict solving with new kernels all the
time.
Now when it goes mainline a TAINT_DSDT_OVERRIDE flag might be
appropriate, so that if you see a kernel panic or whatever bug, you
immediately see why the kernel is tainted.
Problem from 4. should also not exist in this patch anymore.
The boot parameter (3.) is still missing.
Eric, would you mind bringing this all together (if Len agrees with my
aspects).
I'd vote for moving the current location of the DSDT file to:
/dsdt/DSDT.aml
This would break current userspace apps (including SuSE's mkinitrd), but
would prepare the patch for further SSDT enhancements.
Thomas
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-01 10:21 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
@ 2008-02-01 10:38 ` Eric Piel
2008-02-07 2:51 ` Len Brown
1 sibling, 0 replies; 38+ messages in thread
From: Eric Piel @ 2008-02-01 10:38 UTC (permalink / raw)
To: trenn; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
Thomas Renninger wrote:
> About Len's points 1-4:
>
> 1. tainted bit needs to be set when a DSDT override is used.
> (this is common both to the new patch and the current
> override method)
>
> 2. upon setting the tainted bit, print a BIG FAT WARNING
> that this is not a supported configuration.
>
> 3. cmdline option needs to be available to disable
> an override. Otherwise a bad image in the intrd
> may be a serious pickle for some users.
>
> 4. get rid of alarming failure message:
>
> + printk(KERN_INFO "Looking for DSDT in initrd ...");
> ...
> + printk(" not found!\n");
>
> Most of this should be included in the one I sent:
> 1+2 should be covered by this:
> + printk(PREFIX "Override [%4.4s-%8.8s]"
> + " from initramfs -"
> + " tainting kernel\n",
> + t->signature,
> + t->oem_table_id);
> + add_taint(TAINT_NO_SUPPORT);
> I remember that I introduced a new TAINT flag, this got probably ripped
> out because I expect it needed conflict solving with new kernels all the
> time.
> Now when it goes mainline a TAINT_DSDT_OVERRIDE flag might be
> appropriate, so that if you see a kernel panic or whatever bug, you
> immediately see why the kernel is tainted.
>
> Problem from 4. should also not exist in this patch anymore.
>
> The boot parameter (3.) is still missing.
Indeed, points 2 and 4 are already solved in your patch :-)
> Eric, would you mind bringing this all together (if Len agrees with my
> aspects).
> I'd vote for moving the current location of the DSDT file to:
> /dsdt/DSDT.aml
> This would break current userspace apps (including SuSE's mkinitrd), but
> would prepare the patch for further SSDT enhancements.
Ok, I'll try to have something ready by the beginning of next week. I'm
waiting from Len for his comments on the best names of the files and the
SSDTs inclusion...
See you,
Eric
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-01 9:53 ` Thomas Renninger
@ 2008-02-01 11:07 ` Alexey Starikovskiy
2008-02-01 11:29 ` Thomas Renninger
2008-02-02 4:36 ` Len Brown
1 sibling, 1 reply; 38+ messages in thread
From: Alexey Starikovskiy @ 2008-02-01 11:07 UTC (permalink / raw)
To: trenn
Cc: Len Brown, Éric Piel, Andrew Morton, Philippe Coval,
linux-acpi, dsdt
Thomas Renninger wrote:
> On Thu, 2008-01-31 at 14:17 -0500, Len Brown wrote:
>
> [skipped]
> Those tables have the same OEM id then the original ones, right?
> Tables with the same OEM id (the original ones) should get ignored later
> automatically. IIRC I had some problems with dynamically loaded tables,
> don't know anymore, they are not that often used and theoretically it
> should just work for them also.
>
Comparing SSDT by their OEM ID is proved to not work. Right now,
code checks the whole length of the table to be the same, and only then
does not load it. It is not the case with any of modified tables, so
original tables will be tried to load as well.
> I haven't tried too much here, but SSDTs are used more and more often (I
> saw a machine with 12 SSDTs, especially on IA64 there might be dozens in
> the future). We should think about the problem now, before we have bugs
> and need to write down half a book how the reporter finally could
> provide some useful information.
>
>
> Have I overseen something?
>
> Thomas
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-01 11:07 ` Alexey Starikovskiy
@ 2008-02-01 11:29 ` Thomas Renninger
0 siblings, 0 replies; 38+ messages in thread
From: Thomas Renninger @ 2008-02-01 11:29 UTC (permalink / raw)
To: Alexey Starikovskiy
Cc: Len Brown, Éric Piel, Andrew Morton, Philippe Coval,
linux-acpi, dsdt
On Fri, 2008-02-01 at 14:07 +0300, Alexey Starikovskiy wrote:
> Thomas Renninger wrote:
> > On Thu, 2008-01-31 at 14:17 -0500, Len Brown wrote:
> >
> > [skipped]
> > Those tables have the same OEM id then the original ones, right?
> > Tables with the same OEM id (the original ones) should get ignored later
> > automatically. IIRC I had some problems with dynamically loaded tables,
> > don't know anymore, they are not that often used and theoretically it
> > should just work for them also.
> >
> Comparing SSDT by their OEM ID is proved to not work. Right now,
> code checks the whole length of the table to be the same, and only then
> does not load it. It is not the case with any of modified tables, so
> original tables will be tried to load as well.
Ahh, now when you say it, I remember about this darkly...
What a pity..., maybe just comparing the whole header (without the
checksum) could be an option? Or only do this if dsdt_got_overridden
flag is set (ugly, but should be sufficient).
Thomas
> > I haven't tried too much here, but SSDTs are used more and more often (I
> > saw a machine with 12 SSDTs, especially on IA64 there might be dozens in
> > the future). We should think about the problem now, before we have bugs
> > and need to write down half a book how the reporter finally could
> > provide some useful information.
> >
> >
> > Have I overseen something?
Damn, I have :(
Thomas
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-01 9:53 ` Thomas Renninger
2008-02-01 11:07 ` Alexey Starikovskiy
@ 2008-02-02 4:36 ` Len Brown
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
` (3 more replies)
1 sibling, 4 replies; 38+ messages in thread
From: Len Brown @ 2008-02-02 4:36 UTC (permalink / raw)
To: trenn; +Cc: Éric Piel, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Friday 01 February 2008 04:53, Thomas Renninger wrote:
> > That gives you complete and total control over what AML gets run
> I doubt that. You said there can be any number of SSDTs. If you know
> what you are doing..., but how do you explain someone in a bug that he
> has to collect all SSDTs (some via acpidump --addr xy) open an editor,
> paste them into the DSDT and so on...
Dynamic SSDT's are loaded from OpRegions by address.
If you want to change the AML in those opregions,
you have to acquire it with acpidump --addr xy.
That is true no mater what override scheme you're using.
However, if you don't want to modify the dynamic SSDT,
then it does not have to be dumped -- it will continue
to be accessed via Load() of the opregion; and it
is totally unrelated to a DSDT or a DSDT+static-SSDT override.
I am doubtful that SSDT override support past what
we have already justifies its own complexity.
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 0/3] Override DSDT via initramfs
2008-02-02 4:36 ` Len Brown
@ 2008-02-03 17:28 ` Éric Piel
2008-02-04 17:53 ` Thomas Renninger
2008-02-07 0:15 ` Len Brown
2008-02-03 17:28 ` [PATCH 1/3] The basics of DSDT from initramfs Éric Piel
` (2 subsequent siblings)
3 siblings, 2 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-03 17:28 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
Hello,
Here are three patches to implement the override of DSDT via initramfs.
I haven't included the feature for overriding the SSDTs as it's seems
it's still a bit controversial, and anyway for now there is very little
need for it. It should be fairly trivial to add it later if need arises.
The patches are against 2.6.24-git-du-jour, and they have been
boot-tested on my laptop.
See you,
Eric
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/3] The basics of DSDT from initramfs
2008-02-02 4:36 ` Len Brown
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
@ 2008-02-03 17:28 ` Éric Piel
2008-02-03 17:39 ` Markus Gaugusch
2008-02-05 14:43 ` [PATCH 1/3] The basics of DSDT from initramfs Thomas Renninger
2008-02-03 17:29 ` [PATCH 2/3] Taint kernel on ACPI table override Éric Piel
2008-02-03 17:29 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter Éric Piel
3 siblings, 2 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-03 17:28 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
The basics of DSDT from initramfs. In case this option is selected,
populate_rootfs() is called a bit earlier to have the initramfs content
available during ACPI initialisation.
This is a very similar path to the one available at
http://gaugusch.at/kernel.shtml but with some update in the
documentation, default set to No and the change of populate_rootfs() the
"Jeff Mahony way" (which avoids reading the initramfs twice).
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
Documentation/dsdt-initrd.txt | 100 +++++++++++++++++++++++++++++++++++++++++
drivers/acpi/Kconfig | 17 +++++++
drivers/acpi/osl.c | 73 ++++++++++++++++++++++++++++--
init/initramfs.c | 8 +++-
init/main.c | 7 +++
5 files changed, 200 insertions(+), 5 deletions(-)
create mode 100644 Documentation/dsdt-initrd.txt
diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
new file mode 100644
index 0000000..b2e9460
--- /dev/null
+++ b/Documentation/dsdt-initrd.txt
@@ -0,0 +1,100 @@
+ACPI Custom DSDT read from initramfs
+
+2003 by Markuss Gaugusch < dsdt at gaugusch dot org >
+Special thanks go to Thomas Renninger from SuSE, who updated the patch for
+2.6.0 and later modified it to read inside initramfs
+2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
+
+This option is intended for people who would like to hack their DSDT and don't
+want to recompile their kernel after every change. It can also be useful to
+distros which offers pre-compiled kernels and want to allow their users to use
+a modified DSDT. In the Kernel config, enable the initial RAM filesystem
+support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
+options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
+
+A custom DSDT (Differentiated System Description Table) is useful when your
+computer uses ACPI but problems occur due to broken implementation. Typically,
+your computer works but there are some troubles with the hardware detection or
+the power management. You can check that troubles come from errors in the DSDT by
+activating the ACPI debug option and reading the logs. This table is provided
+by the BIOS, therefore it might be a good idea to check for BIOS update on your
+vendor website before going any further. Errors are often caused by vendors
+testing their hardware only with Windows or because there is code which is
+executed only on a specific OS with a specific version and Linux hasn't been
+considered during the development.
+
+Before you run away from customising your DSDT, you should note that already
+corrected tables are available for a fair amount of computers on this web-page:
+http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
+match closely the hardware, including the amount of RAM, the frequency of the
+processor and the PCI cards present! If you are part of the unluckies who
+cannot find their hardware in this database, you can modify your DSDT by
+yourself. This process is less painful than it sounds. Download the Intel ASL
+compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
+As root, you then have to dump your DSDT and decompile it. By using the
+compiler messages as well as the kernel ACPI debug messages and the reference
+book (available at the Intel website and also at http://www.acpi.info), it is
+quite easy to obtain a fully working table.
+
+Once your new DSDT is ready you'll have to add it to an initramfs so that the
+kernel can read the table at the very beginning of the boot. As the file has to
+be accessed very early during the boot process the initramfs has to be an
+initramfs. The file is contained into the initramfs under the name /DSDT.aml .
+To obtain such an initramfs, you might have to modify your initramfs script or
+you can add it later to the initramfs with the script appended to this
+document. The command will look like:
+initramfs-add-dsdt initramfs.img my-dsdt.aml
+
+In case you don't use any initramfs, the possibilities you have are to either
+start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
+configure option to directly include your DSDT inside the kernel.
+
+The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
+found or not. If you need to update your DSDT, generate a new initramfs and
+perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
+
+
+====================== Here starts initramfs-add-dsdt ==========================
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index ccf6ea9..8607ed3 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
Enter the full path name to the file which includes the AmlCode
declaration.
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default n
+ help
+ The DSDT (Differentiated System Description Table) often needs to be
+ overridden because of broken BIOS implementations. If this feature is
+ activated you will be able to provide a customized DSDT by adding it
+ to your initramfs. If your mkinitrd tool does not support this feature
+ a script is provided in the documentation. For more details see
+ <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
+ If there is no table found, it will fall-back to the custom DSDT
+ in-kernel (if activated) or to the DSDT from the BIOS.
+
+ Even if you do not need a new one at the moment, you may want to use a
+ better DSDT later. It is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e53fb51..4568a59 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header *acpi_find_dsdt_initrd(void)
+{
+ struct file *firmware_file;
+ mm_segment_t oldfs;
+ unsigned long len, len2;
+ struct acpi_table_header *dsdt_buffer, *ret = NULL;
+ struct kstat stat;
+ char *ramfs_dsdt_name = "/DSDT.aml";
+
+ printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
+
+ /*
+ * Never do this at home, only the user-space is allowed to open a file.
+ * The clean way would be to use the firmware loader. But this code must be run
+ * before there is any userspace available. So we need a static/init firmware
+ * infrastructure, which doesn't exist yet...
+ */
+ if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
+ printk("not found.\n");
+ return ret;
+ }
+
+ len = stat.size;
+ /* check especially against empty files */
+ if (len <= 4) {
+ printk("error, file is too small: only %lu bytes.\n", len);
+ return ret;
+ }
+
+ firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
+ if (IS_ERR(firmware_file)) {
+ printk("error, could not open file %s.\n", ramfs_dsdt_name);
+ return ret;
+ }
+
+ dsdt_buffer = ACPI_ALLOCATE(len);
+ if (!dsdt_buffer) {
+ printk("error when allocating %lu bytes of memory.\n", len);
+ goto err;
+ }
+
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
+ set_fs(oldfs);
+ if (len2 < len) {
+ printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ACPI_FREE(dsdt_buffer);
+ goto err;
+ }
+
+ printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ret = dsdt_buffer;
+err:
+ filp_close(firmware_file, NULL);
+ return ret;
+}
+#endif
+
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
@@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
+ *new_table = NULL;
+
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
- else
- *new_table = NULL;
-#else
- *new_table = NULL;
+#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
+ if (initrd_table)
+ *new_table = initrd_table;
+ }
#endif
return AE_OK;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index 1db02a0..f2662e2 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -541,7 +541,7 @@ skip:
#endif
-static int __init populate_rootfs(void)
+int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
@@ -582,4 +582,10 @@ static int __init populate_rootfs(void)
#endif
return 0;
}
+#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+/*
+ * if this option is enabled, populate_rootfs() is called _earlier_ in the
+ * boot sequence. This insures that the ACPI initialisation can find the file.
+ */
rootfs_initcall(populate_rootfs);
+#endif
diff --git a/init/main.c b/init/main.c
index f287ca5..7eb1b89 100644
--- a/init/main.c
+++ b/init/main.c
@@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
extern void tc_init(void);
#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+extern int populate_rootfs(void);
+#else
+static inline void populate_rootfs(void) {}
+#endif
+
enum system_states system_state;
EXPORT_SYMBOL(system_state);
@@ -643,6 +649,7 @@ asmlinkage void __init start_kernel(void)
check_bugs();
+ populate_rootfs(); /* For DSDT override from initramfs */
acpi_early_init(); /* before LAPIC and SMP init */
/* Do the rest non-__init'ed, we're now alive */
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 2/3] Taint kernel on ACPI table override
2008-02-02 4:36 ` Len Brown
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
2008-02-03 17:28 ` [PATCH 1/3] The basics of DSDT from initramfs Éric Piel
@ 2008-02-03 17:29 ` Éric Piel
2008-02-04 23:04 ` [PATCH 2/3] Taint kernel on ACPI table override (format corrected) Éric Piel
2008-02-03 17:29 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter Éric Piel
3 siblings, 1 reply; 38+ messages in thread
From: Éric Piel @ 2008-02-03 17:29 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
When an ACPI table is overridden (for now this can happen only for DSDT)
display a big warning and taint the kernel with flag A.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
drivers/acpi/osl.c | 7 +++++++
include/linux/kernel.h | 1 +
kernel/panic.c | 5 +++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 4568a59..549daea 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -392,6 +392,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = initrd_table;
}
#endif
+ if (*new_table != NULL) {
+ printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
+ "this is unsafe: tainting kernel\n",
+ existing_table->signature,
+ existing_table->oem_table_id);
+ add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
+ }
return AE_OK;
}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a7283c9..f51f8bd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -240,6 +240,7 @@ extern enum system_states {
#define TAINT_BAD_PAGE (1<<5)
#define TAINT_USER (1<<6)
#define TAINT_DIE (1<<7)
+#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
extern void dump_stack(void) __cold;
diff --git a/kernel/panic.c b/kernel/panic.c
index da4d6ba..1b7a002 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -160,7 +160,7 @@ const char *print_tainted(void)
{
static char buf[20];
if (tainted) {
- snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c",
+ snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c",
tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
@@ -168,7 +168,8 @@ const char *print_tainted(void)
tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
tainted & TAINT_BAD_PAGE ? 'B' : ' ',
tainted & TAINT_USER ? 'U' : ' ',
- tainted & TAINT_DIE ? 'D' : ' ');
+ tainted & TAINT_DIE ? 'D' : ' ',
+ tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ');
}
else
snprintf(buf, sizeof(buf), "Not tainted");
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 3/3] Add acpi_no_initrd_override kernel parameter
2008-02-02 4:36 ` Len Brown
` (2 preceding siblings ...)
2008-02-03 17:29 ` [PATCH 2/3] Taint kernel on ACPI table override Éric Piel
@ 2008-02-03 17:29 ` Éric Piel
2008-02-04 23:04 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter (format corrected) Éric Piel
3 siblings, 1 reply; 38+ messages in thread
From: Éric Piel @ 2008-02-03 17:29 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
The acpi_no_initrd_override parameter permits to disable the load of an ACPI
table from the initramfs.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/acpi/osl.c | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 17fc60e..9bda965 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -170,6 +170,9 @@ and is between 256 and 4096 characters. It is defined in the file
acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
+ acpi_no_initrd_override [KNL,ACPI]
+ Disable loading custom ACPI tables from the initramfs
+
acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
Format: To spoof as Windows 98: ="Microsoft Windows"
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 549daea..73d838f 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,6 +77,10 @@ static struct workqueue_struct *kacpi_notify_wq;
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int acpi_no_initrd_override;
+#endif
+
/*
* "Ode to _OSI(Linux)"
*
@@ -386,7 +390,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = (struct acpi_table_header *)AmlCode;
#endif
#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
- if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
+ !acpi_no_initrd_override) {
struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
if (initrd_table)
*new_table = initrd_table;
@@ -402,6 +407,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
return AE_OK;
}
+int __init acpi_no_initrd_override_setup(char *s)
+{
+ acpi_no_initrd_override = 1;
+ return 1;
+}
+__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
+
static irqreturn_t acpi_irq(int irq, void *dev_id)
{
return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs
2008-02-03 17:28 ` [PATCH 1/3] The basics of DSDT from initramfs Éric Piel
@ 2008-02-03 17:39 ` Markus Gaugusch
2008-02-03 17:55 ` Éric Piel
2008-02-05 14:43 ` [PATCH 1/3] The basics of DSDT from initramfs Thomas Renninger
1 sibling, 1 reply; 38+ messages in thread
From: Markus Gaugusch @ 2008-02-03 17:39 UTC (permalink / raw)
To: Éric Piel
Cc: Len Brown, trenn, Andrew Morton, Philippe Coval, linux-acpi
[-- Attachment #1: Type: TEXT/PLAIN, Size: 727 bytes --]
On Feb 3, Éric Piel <Eric.Piel@tremplin-utc.net> wrote:
> diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
> new file mode 100644
> index 0000000..b2e9460
> --- /dev/null
> +++ b/Documentation/dsdt-initrd.txt
> @@ -0,0 +1,100 @@
> +ACPI Custom DSDT read from initramfs
> +
> +2003 by Markuss Gaugusch < dsdt at gaugusch dot org >
Hi,
My email address is dsdt at gaugusch dot at (not "dot org")
And the Markus has only one "s".
It's great to see that the little project which I started some years ago
is now in the kernel :)
regards,
Markus
--
__________________ /"\
Markus Gaugusch \ / ASCII Ribbon Campaign
markus(at)gaugusch.at X Against HTML Mail
/ \
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs
2008-02-03 17:39 ` Markus Gaugusch
@ 2008-02-03 17:55 ` Éric Piel
2008-02-04 23:04 ` [PATCH 1/3] The basics of DSDT from initramfs (format corrected) Éric Piel
0 siblings, 1 reply; 38+ messages in thread
From: Éric Piel @ 2008-02-03 17:55 UTC (permalink / raw)
To: Markus Gaugusch
Cc: Len Brown, trenn, Andrew Morton, Philippe Coval, linux-acpi
03/02/08 18:39, Markus Gaugusch wrote/a écrit:
> Hi,
> My email address is dsdt at gaugusch dot at (not "dot org")
> And the Markus has only one "s".
Duh! It was too simple for me to notice ;-) Sorry, here is a fixed version.
See you,
Eric
--
The basics of DSDT from initramfs. In case this option is selected,
populate_rootfs() is called a bit earlier to have the initramfs content
available during ACPI initialisation.
This is a very similar path to the one available at
http://gaugusch.at/kernel.shtml but with some update in the
documentation, default set to No and the change of populate_rootfs() the
"Jeff Mahony way" (which avoids reading the initramfs twice).
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
Documentation/dsdt-initrd.txt | 100 +++++++++++++++++++++++++++++++++++++++++
drivers/acpi/Kconfig | 17 +++++++
drivers/acpi/osl.c | 73 ++++++++++++++++++++++++++++--
init/initramfs.c | 8 +++-
init/main.c | 7 +++
5 files changed, 200 insertions(+), 5 deletions(-)
create mode 100644 Documentation/dsdt-initrd.txt
diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
new file mode 100644
index 0000000..b2e9460
--- /dev/null
+++ b/Documentation/dsdt-initrd.txt
@@ -0,0 +1,100 @@
+ACPI Custom DSDT read from initramfs
+
+2003 by Markus Gaugusch < dsdt at gaugusch dot at >
+Special thanks go to Thomas Renninger from SuSE, who updated the patch for
+2.6.0 and later modified it to read inside initramfs
+2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
+
+This option is intended for people who would like to hack their DSDT and don't
+want to recompile their kernel after every change. It can also be useful to
+distros which offers pre-compiled kernels and want to allow their users to use
+a modified DSDT. In the Kernel config, enable the initial RAM filesystem
+support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
+options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
+
+A custom DSDT (Differentiated System Description Table) is useful when your
+computer uses ACPI but problems occur due to broken implementation. Typically,
+your computer works but there are some troubles with the hardware detection or
+the power management. You can check that troubles come from errors in the DSDT by
+activating the ACPI debug option and reading the logs. This table is provided
+by the BIOS, therefore it might be a good idea to check for BIOS update on your
+vendor website before going any further. Errors are often caused by vendors
+testing their hardware only with Windows or because there is code which is
+executed only on a specific OS with a specific version and Linux hasn't been
+considered during the development.
+
+Before you run away from customising your DSDT, you should note that already
+corrected tables are available for a fair amount of computers on this web-page:
+http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
+match closely the hardware, including the amount of RAM, the frequency of the
+processor and the PCI cards present! If you are part of the unluckies who
+cannot find their hardware in this database, you can modify your DSDT by
+yourself. This process is less painful than it sounds. Download the Intel ASL
+compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
+As root, you then have to dump your DSDT and decompile it. By using the
+compiler messages as well as the kernel ACPI debug messages and the reference
+book (available at the Intel website and also at http://www.acpi.info), it is
+quite easy to obtain a fully working table.
+
+Once your new DSDT is ready you'll have to add it to an initramfs so that the
+kernel can read the table at the very beginning of the boot. As the file has to
+be accessed very early during the boot process the initramfs has to be an
+initramfs. The file is contained into the initramfs under the name /DSDT.aml .
+To obtain such an initramfs, you might have to modify your initramfs script or
+you can add it later to the initramfs with the script appended to this
+document. The command will look like:
+initramfs-add-dsdt initramfs.img my-dsdt.aml
+
+In case you don't use any initramfs, the possibilities you have are to either
+start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
+configure option to directly include your DSDT inside the kernel.
+
+The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
+found or not. If you need to update your DSDT, generate a new initramfs and
+perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
+
+
+====================== Here starts initramfs-add-dsdt ==========================
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index ccf6ea9..8607ed3 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
Enter the full path name to the file which includes the AmlCode
declaration.
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default n
+ help
+ The DSDT (Differentiated System Description Table) often needs to be
+ overridden because of broken BIOS implementations. If this feature is
+ activated you will be able to provide a customized DSDT by adding it
+ to your initramfs. If your mkinitrd tool does not support this feature
+ a script is provided in the documentation. For more details see
+ <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
+ If there is no table found, it will fall-back to the custom DSDT
+ in-kernel (if activated) or to the DSDT from the BIOS.
+
+ Even if you do not need a new one at the moment, you may want to use a
+ better DSDT later. It is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e53fb51..4568a59 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header *acpi_find_dsdt_initrd(void)
+{
+ struct file *firmware_file;
+ mm_segment_t oldfs;
+ unsigned long len, len2;
+ struct acpi_table_header *dsdt_buffer, *ret = NULL;
+ struct kstat stat;
+ char *ramfs_dsdt_name = "/DSDT.aml";
+
+ printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
+
+ /*
+ * Never do this at home, only the user-space is allowed to open a file.
+ * The clean way would be to use the firmware loader. But this code must be run
+ * before there is any userspace available. So we need a static/init firmware
+ * infrastructure, which doesn't exist yet...
+ */
+ if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
+ printk("not found.\n");
+ return ret;
+ }
+
+ len = stat.size;
+ /* check especially against empty files */
+ if (len <= 4) {
+ printk("error, file is too small: only %lu bytes.\n", len);
+ return ret;
+ }
+
+ firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
+ if (IS_ERR(firmware_file)) {
+ printk("error, could not open file %s.\n", ramfs_dsdt_name);
+ return ret;
+ }
+
+ dsdt_buffer = ACPI_ALLOCATE(len);
+ if (!dsdt_buffer) {
+ printk("error when allocating %lu bytes of memory.\n", len);
+ goto err;
+ }
+
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
+ set_fs(oldfs);
+ if (len2 < len) {
+ printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ACPI_FREE(dsdt_buffer);
+ goto err;
+ }
+
+ printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ret = dsdt_buffer;
+err:
+ filp_close(firmware_file, NULL);
+ return ret;
+}
+#endif
+
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
@@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
+ *new_table = NULL;
+
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
- else
- *new_table = NULL;
-#else
- *new_table = NULL;
+#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
+ if (initrd_table)
+ *new_table = initrd_table;
+ }
#endif
return AE_OK;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index 1db02a0..f2662e2 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -541,7 +541,7 @@ skip:
#endif
-static int __init populate_rootfs(void)
+int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
@@ -582,4 +582,10 @@ static int __init populate_rootfs(void)
#endif
return 0;
}
+#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+/*
+ * if this option is enabled, populate_rootfs() is called _earlier_ in the
+ * boot sequence. This insures that the ACPI initialisation can find the file.
+ */
rootfs_initcall(populate_rootfs);
+#endif
diff --git a/init/main.c b/init/main.c
index f287ca5..7eb1b89 100644
--- a/init/main.c
+++ b/init/main.c
@@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
extern void tc_init(void);
#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+extern int populate_rootfs(void);
+#else
+static inline void populate_rootfs(void) {}
+#endif
+
enum system_states system_state;
EXPORT_SYMBOL(system_state);
@@ -643,6 +649,7 @@ asmlinkage void __init start_kernel(void)
check_bugs();
+ populate_rootfs(); /* For DSDT override from initramfs */
acpi_early_init(); /* before LAPIC and SMP init */
/* Do the rest non-__init'ed, we're now alive */
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 0/3] Override DSDT via initramfs
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
@ 2008-02-04 17:53 ` Thomas Renninger
2008-02-04 22:57 ` Éric Piel
2008-02-07 0:15 ` Len Brown
1 sibling, 1 reply; 38+ messages in thread
From: Thomas Renninger @ 2008-02-04 17:53 UTC (permalink / raw)
To: Éric Piel; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Sun, 2008-02-03 at 18:28 +0100, Éric Piel wrote:
> Hello,
>
> Here are three patches to implement the override of DSDT via initramfs.
> I haven't included the feature for overriding the SSDTs as it's seems
> it's still a bit controversial, and anyway for now there is very little
> need for it. It should be fairly trivial to add it later if need arises.
>
> The patches are against 2.6.24-git-du-jour, and they have been
> boot-tested on my laptop.
I have some problems with the diff format.
Is this a git diff, incompatible with normal patch/diff tools?
Hmm, I tried git-apply --check -p1, but it also didn't work for me.
Thanks,
Thomas
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 0/3] Override DSDT via initramfs
2008-02-04 17:53 ` Thomas Renninger
@ 2008-02-04 22:57 ` Éric Piel
0 siblings, 0 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-04 22:57 UTC (permalink / raw)
To: trenn; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
04/02/08 18:53, Thomas Renninger wrote/a écrit:
> On Sun, 2008-02-03 at 18:28 +0100, Éric Piel wrote:
>> Hello,
>>
>> Here are three patches to implement the override of DSDT via initramfs.
>> I haven't included the feature for overriding the SSDTs as it's seems
>> it's still a bit controversial, and anyway for now there is very little
>> need for it. It should be fairly trivial to add it later if need arises.
>>
>> The patches are against 2.6.24-git-du-jour, and they have been
>> boot-tested on my laptop.
>
> I have some problems with the diff format.
> Is this a git diff, incompatible with normal patch/diff tools?
> Hmm, I tried git-apply --check -p1, but it also didn't work for me.
>
No, git is not to blame. It's might fault, I forgot to deactivate
"format=flowed" in Thunderbird (well, I thought using an external editor
was automatically avoiding the problem). So basically, you have to remove
one space on each line starting with two spaces... or wait a little bit,
I'll resend the patches right now!
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs (format corrected)
2008-02-03 17:55 ` Éric Piel
@ 2008-02-04 23:04 ` Éric Piel
2008-02-06 23:54 ` Len Brown
0 siblings, 1 reply; 38+ messages in thread
From: Éric Piel @ 2008-02-04 23:04 UTC (permalink / raw)
To: Markus Gaugusch
Cc: Len Brown, trenn, Andrew Morton, Philippe Coval, linux-acpi
The basics of DSDT from initramfs. In case this option is selected,
populate_rootfs() is called a bit earlier to have the initramfs content
available during ACPI initialization.
This is a very similar path to the one available at
http://gaugusch.at/kernel.shtml but with some update in the
documentation, default set to No and the change of populate_rootfs() the
"Jeff Mahony way" (which avoids reading the initramfs twice).
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
Documentation/dsdt-initrd.txt | 100 +++++++++++++++++++++++++++++++++++++++++
drivers/acpi/Kconfig | 17 +++++++
drivers/acpi/osl.c | 73 ++++++++++++++++++++++++++++--
init/initramfs.c | 8 +++-
init/main.c | 7 +++
5 files changed, 200 insertions(+), 5 deletions(-)
create mode 100644 Documentation/dsdt-initrd.txt
diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
new file mode 100644
index 0000000..b2e9460
--- /dev/null
+++ b/Documentation/dsdt-initrd.txt
@@ -0,0 +1,100 @@
+ACPI Custom DSDT read from initramfs
+
+2003 by Markus Gaugusch < dsdt at gaugusch dot at >
+Special thanks go to Thomas Renninger from SuSE, who updated the patch for
+2.6.0 and later modified it to read inside initramfs
+2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
+
+This option is intended for people who would like to hack their DSDT and don't
+want to recompile their kernel after every change. It can also be useful to
+distros which offers pre-compiled kernels and want to allow their users to use
+a modified DSDT. In the Kernel config, enable the initial RAM filesystem
+support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
+options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
+
+A custom DSDT (Differentiated System Description Table) is useful when your
+computer uses ACPI but problems occur due to broken implementation. Typically,
+your computer works but there are some troubles with the hardware detection or
+the power management. You can check that troubles come from errors in the DSDT by
+activating the ACPI debug option and reading the logs. This table is provided
+by the BIOS, therefore it might be a good idea to check for BIOS update on your
+vendor website before going any further. Errors are often caused by vendors
+testing their hardware only with Windows or because there is code which is
+executed only on a specific OS with a specific version and Linux hasn't been
+considered during the development.
+
+Before you run away from customising your DSDT, you should note that already
+corrected tables are available for a fair amount of computers on this web-page:
+http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
+match closely the hardware, including the amount of RAM, the frequency of the
+processor and the PCI cards present! If you are part of the unluckies who
+cannot find their hardware in this database, you can modify your DSDT by
+yourself. This process is less painful than it sounds. Download the Intel ASL
+compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
+As root, you then have to dump your DSDT and decompile it. By using the
+compiler messages as well as the kernel ACPI debug messages and the reference
+book (available at the Intel website and also at http://www.acpi.info), it is
+quite easy to obtain a fully working table.
+
+Once your new DSDT is ready you'll have to add it to an initramfs so that the
+kernel can read the table at the very beginning of the boot. As the file has to
+be accessed very early during the boot process the initramfs has to be an
+initramfs. The file is contained into the initramfs under the name /DSDT.aml .
+To obtain such an initramfs, you might have to modify your initramfs script or
+you can add it later to the initramfs with the script appended to this
+document. The command will look like:
+initramfs-add-dsdt initramfs.img my-dsdt.aml
+
+In case you don't use any initramfs, the possibilities you have are to either
+start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
+configure option to directly include your DSDT inside the kernel.
+
+The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
+found or not. If you need to update your DSDT, generate a new initramfs and
+perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
+
+
+====================== Here starts initramfs-add-dsdt ==========================
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index ccf6ea9..8607ed3 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
Enter the full path name to the file which includes the AmlCode
declaration.
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default n
+ help
+ The DSDT (Differentiated System Description Table) often needs to be
+ overridden because of broken BIOS implementations. If this feature is
+ activated you will be able to provide a customized DSDT by adding it
+ to your initramfs. If your mkinitrd tool does not support this feature
+ a script is provided in the documentation. For more details see
+ <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
+ If there is no table found, it will fall-back to the custom DSDT
+ in-kernel (if activated) or to the DSDT from the BIOS.
+
+ Even if you do not need a new one at the moment, you may want to use a
+ better DSDT later. It is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e53fb51..4568a59 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header *acpi_find_dsdt_initrd(void)
+{
+ struct file *firmware_file;
+ mm_segment_t oldfs;
+ unsigned long len, len2;
+ struct acpi_table_header *dsdt_buffer, *ret = NULL;
+ struct kstat stat;
+ char *ramfs_dsdt_name = "/DSDT.aml";
+
+ printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
+
+ /*
+ * Never do this at home, only the user-space is allowed to open a file.
+ * The clean way would be to use the firmware loader. But this code must be run
+ * before there is any userspace available. So we need a static/init firmware
+ * infrastructure, which doesn't exist yet...
+ */
+ if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
+ printk("not found.\n");
+ return ret;
+ }
+
+ len = stat.size;
+ /* check especially against empty files */
+ if (len <= 4) {
+ printk("error, file is too small: only %lu bytes.\n", len);
+ return ret;
+ }
+
+ firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
+ if (IS_ERR(firmware_file)) {
+ printk("error, could not open file %s.\n", ramfs_dsdt_name);
+ return ret;
+ }
+
+ dsdt_buffer = ACPI_ALLOCATE(len);
+ if (!dsdt_buffer) {
+ printk("error when allocating %lu bytes of memory.\n", len);
+ goto err;
+ }
+
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
+ set_fs(oldfs);
+ if (len2 < len) {
+ printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ACPI_FREE(dsdt_buffer);
+ goto err;
+ }
+
+ printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ret = dsdt_buffer;
+err:
+ filp_close(firmware_file, NULL);
+ return ret;
+}
+#endif
+
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
@@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
+ *new_table = NULL;
+
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
- else
- *new_table = NULL;
-#else
- *new_table = NULL;
+#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
+ if (initrd_table)
+ *new_table = initrd_table;
+ }
#endif
return AE_OK;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index 1db02a0..f2662e2 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -541,7 +541,7 @@ skip:
#endif
-static int __init populate_rootfs(void)
+int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
@@ -582,4 +582,10 @@ static int __init populate_rootfs(void)
#endif
return 0;
}
+#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+/*
+ * if this option is enabled, populate_rootfs() is called _earlier_ in the
+ * boot sequence. This insures that the ACPI initialisation can find the file.
+ */
rootfs_initcall(populate_rootfs);
+#endif
diff --git a/init/main.c b/init/main.c
index f287ca5..7eb1b89 100644
--- a/init/main.c
+++ b/init/main.c
@@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
extern void tc_init(void);
#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+extern int populate_rootfs(void);
+#else
+static inline void populate_rootfs(void) {}
+#endif
+
enum system_states system_state;
EXPORT_SYMBOL(system_state);
@@ -643,6 +649,7 @@ asmlinkage void __init start_kernel(void)
check_bugs();
+ populate_rootfs(); /* For DSDT override from initramfs */
acpi_early_init(); /* before LAPIC and SMP init */
/* Do the rest non-__init'ed, we're now alive */
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 2/3] Taint kernel on ACPI table override (format corrected)
2008-02-03 17:29 ` [PATCH 2/3] Taint kernel on ACPI table override Éric Piel
@ 2008-02-04 23:04 ` Éric Piel
0 siblings, 0 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-04 23:04 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
When an ACPI table is overridden (for now this can happen only for DSDT)
display a big warning and taint the kernel with flag A.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
drivers/acpi/osl.c | 7 +++++++
include/linux/kernel.h | 1 +
kernel/panic.c | 5 +++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 4568a59..549daea 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -392,6 +392,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = initrd_table;
}
#endif
+ if (*new_table != NULL) {
+ printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
+ "this is unsafe: tainting kernel\n",
+ existing_table->signature,
+ existing_table->oem_table_id);
+ add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
+ }
return AE_OK;
}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a7283c9..f51f8bd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -240,6 +240,7 @@ extern enum system_states {
#define TAINT_BAD_PAGE (1<<5)
#define TAINT_USER (1<<6)
#define TAINT_DIE (1<<7)
+#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
extern void dump_stack(void) __cold;
diff --git a/kernel/panic.c b/kernel/panic.c
index da4d6ba..1b7a002 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -160,7 +160,7 @@ const char *print_tainted(void)
{
static char buf[20];
if (tainted) {
- snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c",
+ snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c",
tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
@@ -168,7 +168,8 @@ const char *print_tainted(void)
tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
tainted & TAINT_BAD_PAGE ? 'B' : ' ',
tainted & TAINT_USER ? 'U' : ' ',
- tainted & TAINT_DIE ? 'D' : ' ');
+ tainted & TAINT_DIE ? 'D' : ' ',
+ tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ');
}
else
snprintf(buf, sizeof(buf), "Not tainted");
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 3/3] Add acpi_no_initrd_override kernel parameter (format corrected)
2008-02-03 17:29 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter Éric Piel
@ 2008-02-04 23:04 ` Éric Piel
0 siblings, 0 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-04 23:04 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
The acpi_no_initrd_override parameter permits to disable the load of an ACPI
table from the initramfs.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/acpi/osl.c | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 17fc60e..9bda965 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -170,6 +170,9 @@ and is between 256 and 4096 characters. It is defined in the file
acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
+ acpi_no_initrd_override [KNL,ACPI]
+ Disable loading custom ACPI tables from the initramfs
+
acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
Format: To spoof as Windows 98: ="Microsoft Windows"
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 549daea..73d838f 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,6 +77,10 @@ static struct workqueue_struct *kacpi_notify_wq;
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int acpi_no_initrd_override;
+#endif
+
/*
* "Ode to _OSI(Linux)"
*
@@ -386,7 +390,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = (struct acpi_table_header *)AmlCode;
#endif
#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
- if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
+ !acpi_no_initrd_override) {
struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
if (initrd_table)
*new_table = initrd_table;
@@ -402,6 +407,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
return AE_OK;
}
+int __init acpi_no_initrd_override_setup(char *s)
+{
+ acpi_no_initrd_override = 1;
+ return 1;
+}
+__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
+
static irqreturn_t acpi_irq(int irq, void *dev_id)
{
return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs
2008-02-03 17:28 ` [PATCH 1/3] The basics of DSDT from initramfs Éric Piel
2008-02-03 17:39 ` Markus Gaugusch
@ 2008-02-05 14:43 ` Thomas Renninger
2008-02-05 14:56 ` Carlos Corbacho
1 sibling, 1 reply; 38+ messages in thread
From: Thomas Renninger @ 2008-02-05 14:43 UTC (permalink / raw)
To: Éric Piel; +Cc: Len Brown, Andrew Morton, Philippe Coval, linux-acpi, dsdt
Hi Eric,
nice. Some minor comments below...
On Sun, 2008-02-03 at 18:28 +0100, Éric Piel wrote:
> The basics of DSDT from initramfs. In case this option is selected,
> populate_rootfs() is called a bit earlier to have the initramfs content
> available during ACPI initialisation.
>
> This is a very similar path to the one available at
> http://gaugusch.at/kernel.shtml but with some update in the
> documentation, default set to No and the change of populate_rootfs() the
> "Jeff Mahony way" (which avoids reading the initramfs twice).
>
> Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
>
> ---
> Documentation/dsdt-initrd.txt | 100 +++++++++++++++++++++++++++++++++++++++++
> drivers/acpi/Kconfig | 17 +++++++
> drivers/acpi/osl.c | 73 ++++++++++++++++++++++++++++--
> init/initramfs.c | 8 +++-
> init/main.c | 7 +++
> 5 files changed, 200 insertions(+), 5 deletions(-)
> create mode 100644 Documentation/dsdt-initrd.txt
>
> diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
> new file mode 100644
> index 0000000..b2e9460
> --- /dev/null
> +++ b/Documentation/dsdt-initrd.txt
> @@ -0,0 +1,100 @@
> +ACPI Custom DSDT read from initramfs
> +
> +2003 by Markuss Gaugusch < dsdt at gaugusch dot org >
> +Special thanks go to Thomas Renninger from SuSE, who updated the patch for
> +2.6.0 and later modified it to read inside initramfs
> +2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
> +
> +This option is intended for people who would like to hack their DSDT and don't
> +want to recompile their kernel after every change. It can also be useful to
> +distros which offers pre-compiled kernels and want to allow their users to use
> +a modified DSDT. In the Kernel config, enable the initial RAM filesystem
> +support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
> +options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
> +
> +A custom DSDT (Differentiated System Description Table) is useful when your
> +computer uses ACPI but problems occur due to broken implementation. Typically,
> +your computer works but there are some troubles with the hardware detection or
> +the power management. You can check that troubles come from errors in the DSDT by
> +activating the ACPI debug option and reading the logs. This table is provided
> +by the BIOS, therefore it might be a good idea to check for BIOS update on your
> +vendor website before going any further. Errors are often caused by vendors
> +testing their hardware only with Windows or because there is code which is
> +executed only on a specific OS with a specific version and Linux hasn't been
> +considered during the development.
> +
> +Before you run away from customising your DSDT, you should note that already
> +corrected tables are available for a fair amount of computers on this web-page:
> +http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
> +match closely the hardware, including the amount of RAM, the frequency of the
> +processor and the PCI cards present! If you are part of the unluckies who
> +cannot find their hardware in this database, you can modify your DSDT by
> +yourself. This process is less painful than it sounds. Download the Intel ASL
> +compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
AFAIK Intel wants to move away from this address.
There should have been an opensource project for the ACPICA code
started, we should reference this one instead. Len?
> +As root, you then have to dump your DSDT and decompile it. By using the
> +compiler messages as well as the kernel ACPI debug messages and the reference
> +book (available at the Intel website and also at http://www.acpi.info), it is
> +quite easy to obtain a fully working table.
Hmm, IMO this sentence should not go in, but instead a reference to:
Something like: You can learn how to extract your BIOS ACPI tables,
disassemble, modify and recompile them here:
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
(which then still needs to be updated).
> +Once your new DSDT is ready you'll have to add it to an initramfs so that the
> +kernel can read the table at the very beginning of the boot. As the file has to
> +be accessed very early during the boot process the initramfs has to be an
> +initramfs. The file is contained into the initramfs under the name /DSDT.aml .
So this patch is still using /DSDT.aml...
> +To obtain such an initramfs, you might have to modify your initramfs script or
> +you can add it later to the initramfs with the script appended to this
> +document. The command will look like:
> +initramfs-add-dsdt initramfs.img my-dsdt.aml
> +
> +In case you don't use any initramfs, the possibilities you have are to either
> +start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
> +configure option to directly include your DSDT inside the kernel.
> +
> +The message "Looking for DSDT in initramfs..."
Removing this was point 4. of Len's wish list.
IMO it can stay, but I don't really care.
> will tell you if the DSDT was
> +found or not. If you need to update your DSDT, generate a new initramfs and
> +perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
> +
> +
> +====================== Here starts initramfs-add-dsdt ==========================
> +#!/bin/bash
> +# Adds a DSDT file to the initrd (if it's an initramfs)
> +# first argument is the name of archive
> +# second argument is the name of the file to add
> +# The file will be copied as /DSDT.aml
> +
> +# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
> +# 20060205: this time it should really work
> +
> +# check the arguments
> +if [ $# -ne 2 ]; then
> + program_name=$(basename $0)
> + echo "\
> +$program_name: too few arguments
> +Usage: $program_name initrd-name.img DSDT-to-add.aml
> +Adds a DSDT file to an initrd (in initramfs format)
> +
> + initrd-name.img: filename of the initrd in initramfs format
> + DSDT-to-add.aml: filename of the DSDT file to add
> + " 1>&2
> + exit 1
> +fi
> +
> +# we should check it's an initramfs
> +
> +tempcpio=$(mktemp -d)
> +# cleanup on exit, hangup, interrupt, quit, termination
> +trap 'rm -rf $tempcpio' 0 1 2 3 15
> +
> +# extract the archive
> +gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
> +
> +# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
> +cp -f "$2" "$tempcpio"/DSDT.aml
DSDT.aml...
> +
> +# add the file
> +cd "$tempcpio"
> +(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
> +cd "$OLDPWD"
> +
> +# re-compress the archive
> +gzip -c "$tempcpio"/initramfs.cpio > "$1"
> +
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index ccf6ea9..8607ed3 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
> Enter the full path name to the file which includes the AmlCode
> declaration.
>
> +config ACPI_CUSTOM_DSDT_INITRD
> + bool "Read Custom DSDT from initramfs"
> + depends on BLK_DEV_INITRD
> + default n
> + help
> + The DSDT (Differentiated System Description Table) often needs to be
> + overridden because of broken BIOS implementations. If this feature is
> + activated you will be able to provide a customized DSDT by adding it
> + to your initramfs. If your mkinitrd tool does not support this feature
> + a script is provided in the documentation. For more details see
> + <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
> + If there is no table found, it will fall-back to the custom DSDT
> + in-kernel (if activated) or to the DSDT from the BIOS.
> +
> + Even if you do not need a new one at the moment, you may want to use a
> + better DSDT later. It is safe to say Y here.
This one should be rephrased. Don't invite all users to modify or use
foreign DSDTs just for little improvements.
I think the main goal of this patch should be debugging/testing
purposes.
Better phrase it like:
If you have problems with ACPI on your machine and you have fixed it up
by modifying the DSDT, don't override the DSDT as a long term solution.
E.g. if you add new memory to your machine, it will invalidate the
modified DSDT (BIOS would generate a slightly adjusted one).
Always report bugs in a DSDT to bugzilla.kernel.org and assign it to the
ACPI component.
Overriding of the DSDT is mainly thought for developing/testing
purposes!
> +
> config ACPI_BLACKLIST_YEAR
> int "Disable ACPI for systems before Jan 1st this year" if X86_32
> default 0
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index e53fb51..4568a59 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> return AE_OK;
> }
>
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +struct acpi_table_header *acpi_find_dsdt_initrd(void)
> +{
> + struct file *firmware_file;
> + mm_segment_t oldfs;
> + unsigned long len, len2;
> + struct acpi_table_header *dsdt_buffer, *ret = NULL;
> + struct kstat stat;
> + char *ramfs_dsdt_name = "/DSDT.aml";
DSDT.aml
> +
> + printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
> +
> + /*
> + * Never do this at home, only the user-space is allowed to open a file.
> + * The clean way would be to use the firmware loader. But this code must be run
> + * before there is any userspace available. So we need a static/init firmware
> + * infrastructure, which doesn't exist yet...
> + */
> + if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
> + printk("not found.\n");
> + return ret;
> + }
> +
> + len = stat.size;
> + /* check especially against empty files */
> + if (len <= 4) {
> + printk("error, file is too small: only %lu bytes.\n", len);
> + return ret;
> + }
> +
> + firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
> + if (IS_ERR(firmware_file)) {
> + printk("error, could not open file %s.\n", ramfs_dsdt_name);
> + return ret;
> + }
> +
> + dsdt_buffer = ACPI_ALLOCATE(len);
> + if (!dsdt_buffer) {
> + printk("error when allocating %lu bytes of memory.\n", len);
> + goto err;
> + }
> +
> + oldfs = get_fs();
> + set_fs(KERNEL_DS);
> + len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
> + set_fs(oldfs);
> + if (len2 < len) {
> + printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
> + ACPI_FREE(dsdt_buffer);
> + goto err;
> + }
> +
> + printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
> + ret = dsdt_buffer;
> +err:
> + filp_close(firmware_file, NULL);
> + return ret;
> +}
> +#endif
> +
> acpi_status
> acpi_os_table_override(struct acpi_table_header * existing_table,
> struct acpi_table_header ** new_table)
> @@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
> if (!existing_table || !new_table)
> return AE_BAD_PARAMETER;
>
> + *new_table = NULL;
> +
> #ifdef CONFIG_ACPI_CUSTOM_DSDT
> if (strncmp(existing_table->signature, "DSDT", 4) == 0)
> *new_table = (struct acpi_table_header *)AmlCode;
> - else
> - *new_table = NULL;
> -#else
> - *new_table = NULL;
> +#endif
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> + if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
> + struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
> + if (initrd_table)
> + *new_table = initrd_table;
> + }
> #endif
> return AE_OK;
> }
> diff --git a/init/initramfs.c b/init/initramfs.c
> index 1db02a0..f2662e2 100644
> --- a/init/initramfs.c
> +++ b/init/initramfs.c
> @@ -541,7 +541,7 @@ skip:
>
> #endif
>
> -static int __init populate_rootfs(void)
> +int __init populate_rootfs(void)
> {
> char *err = unpack_to_rootfs(__initramfs_start,
> __initramfs_end - __initramfs_start, 0);
> @@ -582,4 +582,10 @@ static int __init populate_rootfs(void)
> #endif
> return 0;
> }
> +#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +/*
> + * if this option is enabled, populate_rootfs() is called _earlier_ in the
> + * boot sequence. This insures that the ACPI initialisation can find the file.
> + */
> rootfs_initcall(populate_rootfs);
> +#endif
> diff --git a/init/main.c b/init/main.c
> index f287ca5..7eb1b89 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
> extern void tc_init(void);
> #endif
>
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +extern int populate_rootfs(void);
> +#else
> +static inline void populate_rootfs(void) {}
> +#endif
> +
> enum system_states system_state;
> EXPORT_SYMBOL(system_state);
>
> @@ -643,6 +649,7 @@ asmlinkage void __init start_kernel(void)
>
> check_bugs();
>
> + populate_rootfs(); /* For DSDT override from initramfs */
> acpi_early_init(); /* before LAPIC and SMP init */
>
> /* Do the rest non-__init'ed, we're now alive */
IMO it should go in as it is for now.
It could still be extended on the next rcX cycle. All comments are only
minor enhancements.
About the /DSDT.aml vs. /dsdt/DSDT.aml location:
As said this is for SSDT overrides.
If someone sees (beside the table signature, I think I can
handle/workaround this), why this has no use or not worth to look at it,
pls let me know.
Otherwise I will have a look at it (but possibly not that soon...)
I expect it need to be checked then whether /dsdt exists at all, is a
directory and find all files in it.
The advantage to at least change the name now to dsdt/DSDT.aml, would be
to have a consistent naming. If DSDT.aml changes to dsdt/DSDT.aml at
some later time we need to adjust userspace tools and will get userspace
vs kernel version problems.
I test-compiled the patches on various archs and configs, but didn't do
any real DSDT override tests (the patches are in use for quite some
time...). All builds succeeded.
Thomas
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs
2008-02-05 14:43 ` [PATCH 1/3] The basics of DSDT from initramfs Thomas Renninger
@ 2008-02-05 14:56 ` Carlos Corbacho
0 siblings, 0 replies; 38+ messages in thread
From: Carlos Corbacho @ 2008-02-05 14:56 UTC (permalink / raw)
To: trenn
Cc: Éric Piel, Len Brown, Andrew Morton, Philippe Coval,
linux-acpi, dsdt
On Tuesday 05 February 2008 14:43:48 Thomas Renninger wrote:
> > Download the Intel ASL
> > +compiler/decompiler at
http://www.intel.com/technology/IAPC/acpi/downloads.htm .
> AFAIK Intel wants to move away from this address.
> There should have been an opensource project for the ACPICA code
> started, we should reference this one instead. Len?
http://www.acpica.org/downloads/
(Although at the moment, it's a bit of a trek through the new site to figure
out that Linux needs the tools under 'UNIX source code' - a big fat link on
the Linux page to the UNIX tools would be better, and all the compiling
instructions from the Linux page can then just be moved to the 'UNIX source
code' page, since they're clearly not Linux specific).
-Carlos
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/3] The basics of DSDT from initramfs (format corrected)
2008-02-04 23:04 ` [PATCH 1/3] The basics of DSDT from initramfs (format corrected) Éric Piel
@ 2008-02-06 23:54 ` Len Brown
0 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-06 23:54 UTC (permalink / raw)
To: Éric Piel
Cc: Markus Gaugusch, trenn, Andrew Morton, Philippe Coval, linux-acpi
On Monday 04 February 2008 18:04, Éric Piel wrote:
> The basics of DSDT from initramfs. In case this option is selected,
> populate_rootfs() is called a bit earlier to have the initramfs content
> available during ACPI initialization.
>
> This is a very similar path to the one available at
> http://gaugusch.at/kernel.shtml but with some update in the
> documentation, default set to No and the change of populate_rootfs() the
> "Jeff Mahony way" (which avoids reading the initramfs twice).
>
> Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
>
> ---
> Documentation/dsdt-initrd.txt | 100 +++++++++++++++++++++++++++++++++++++++++
I'd like to move any ACPI-specific documents under a sub-directory,
eg. Documentation/acpi/dsdt-initrd.txt
> drivers/acpi/Kconfig | 17 +++++++
> drivers/acpi/osl.c | 73 ++++++++++++++++++++++++++++--
> init/initramfs.c | 8 +++-
> init/main.c | 7 +++
> 5 files changed, 200 insertions(+), 5 deletions(-)
> create mode 100644 Documentation/dsdt-initrd.txt
>
> diff --git a/Documentation/dsdt-initrd.txt b/Documentation/dsdt-initrd.txt
> new file mode 100644
> index 0000000..b2e9460
> --- /dev/null
> +++ b/Documentation/dsdt-initrd.txt
> @@ -0,0 +1,100 @@
> +ACPI Custom DSDT read from initramfs
> +
> +2003 by Markus Gaugusch < dsdt at gaugusch dot at >
> +Special thanks go to Thomas Renninger from SuSE, who updated the patch for
> +2.6.0 and later modified it to read inside initramfs
> +2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
> +
I'd like to re-write this to largely point to
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
which I can update.
I don't want to maintain two copies of this documentation.
> +This option is intended for people who would like to hack their DSDT and don't
> +want to recompile their kernel after every change. It can also be useful to
> +distros which offers pre-compiled kernels and want to allow their users to use
> +a modified DSDT. In the Kernel config, enable the initial RAM filesystem
> +support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
> +options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
> +
> +A custom DSDT (Differentiated System Description Table) is useful when your
> +computer uses ACPI but problems occur due to broken implementation. Typically,
> +your computer works but there are some troubles with the hardware detection or
> +the power management. You can check that troubles come from errors in the DSDT by
> +activating the ACPI debug option and reading the logs. This table is provided
> +by the BIOS, therefore it might be a good idea to check for BIOS update on your
> +vendor website before going any further. Errors are often caused by vendors
> +testing their hardware only with Windows or because there is code which is
> +executed only on a specific OS with a specific version and Linux hasn't been
> +considered during the development.
> +
> +Before you run away from customising your DSDT, you should note that already
> +corrected tables are available for a fair amount of computers on this web-page:
> +http://acpi.sf.net/dsdt .
I'd like to discourage use of http://acpi.sf.net/dsdt
except in the extreme cases of permanently broken BIOS
that Linux otherwise has no hope of dealing with.
> Be careful though, to work correctly a DSDT has to
> +match closely the hardware, including the amount of RAM, the frequency of the
> +processor and the PCI cards present! If you are part of the unluckies who
> +cannot find their hardware in this database, you can modify your DSDT by
> +yourself. This process is less painful than it sounds. Download the Intel ASL
> +compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
http://acpica.org/downloads/, but that is on the page above
and shouldn't need to be referenced in this file.
> +As root, you then have to dump your DSDT and decompile it. By using the
> +compiler messages as well as the kernel ACPI debug messages and the reference
> +book (available at the Intel website and also at http://www.acpi.info), it is
> +quite easy to obtain a fully working table.
> +
> +Once your new DSDT is ready you'll have to add it to an initramfs so that the
> +kernel can read the table at the very beginning of the boot. As the file has to
> +be accessed very early during the boot process the initramfs has to be an
> +initramfs. The file is contained into the initramfs under the name /DSDT.aml .
> +To obtain such an initramfs, you might have to modify your initramfs script or
> +you can add it later to the initramfs with the script appended to this
> +document. The command will look like:
> +initramfs-add-dsdt initramfs.img my-dsdt.aml
> +
> +In case you don't use any initramfs, the possibilities you have are to either
> +start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
> +configure option to directly include your DSDT inside the kernel.
> +
> +The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
> +found or not. If you need to update your DSDT, generate a new initramfs and
> +perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
> +
> +====================== Here starts initramfs-add-dsdt ==========================
Since we'll have Documentation/acpi/, I think it would be better
to have this as a script there rather than a script embedded in a text file.
> +#!/bin/bash
> +# Adds a DSDT file to the initrd (if it's an initramfs)
> +# first argument is the name of archive
> +# second argument is the name of the file to add
> +# The file will be copied as /DSDT.aml
> +
> +# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
> +# 20060205: this time it should really work
> +
> +# check the arguments
> +if [ $# -ne 2 ]; then
> + program_name=$(basename $0)
> + echo "\
> +$program_name: too few arguments
> +Usage: $program_name initrd-name.img DSDT-to-add.aml
> +Adds a DSDT file to an initrd (in initramfs format)
> +
> + initrd-name.img: filename of the initrd in initramfs format
> + DSDT-to-add.aml: filename of the DSDT file to add
> + " 1>&2
> + exit 1
> +fi
> +
> +# we should check it's an initramfs
> +
> +tempcpio=$(mktemp -d)
> +# cleanup on exit, hangup, interrupt, quit, termination
> +trap 'rm -rf $tempcpio' 0 1 2 3 15
> +
> +# extract the archive
> +gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
> +
> +# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
> +cp -f "$2" "$tempcpio"/DSDT.aml
> +
> +# add the file
> +cd "$tempcpio"
> +(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
> +cd "$OLDPWD"
> +
> +# re-compress the archive
> +gzip -c "$tempcpio"/initramfs.cpio > "$1"
> +
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index ccf6ea9..8607ed3 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
> Enter the full path name to the file which includes the AmlCode
> declaration.
>
> +config ACPI_CUSTOM_DSDT_INITRD
> + bool "Read Custom DSDT from initramfs"
> + depends on BLK_DEV_INITRD
> + default n
> + help
> + The DSDT (Differentiated System Description Table) often needs to be
> + overridden because of broken BIOS implementations. If this feature is
> + activated you will be able to provide a customized DSDT by adding it
> + to your initramfs. If your mkinitrd tool does not support this feature
> + a script is provided in the documentation. For more details see
> + <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
update this for in-tree location only
> + If there is no table found, it will fall-back to the custom DSDT
> + in-kernel (if activated) or to the DSDT from the BIOS.
> +
> + Even if you do not need a new one at the moment, you may want to use a
> + better DSDT later. It is safe to say Y here.
> +
> config ACPI_BLACKLIST_YEAR
> int "Disable ACPI for systems before Jan 1st this year" if X86_32
> default 0
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index e53fb51..4568a59 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> return AE_OK;
> }
>
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +struct acpi_table_header *acpi_find_dsdt_initrd(void)
> +{
> + struct file *firmware_file;
> + mm_segment_t oldfs;
> + unsigned long len, len2;
> + struct acpi_table_header *dsdt_buffer, *ret = NULL;
> + struct kstat stat;
> + char *ramfs_dsdt_name = "/DSDT.aml";
> +
> + printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
> +
> + /*
> + * Never do this at home, only the user-space is allowed to open a file.
> + * The clean way would be to use the firmware loader. But this code must be run
> + * before there is any userspace available. So we need a static/init firmware
> + * infrastructure, which doesn't exist yet...
> + */
> + if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
> + printk("not found.\n");
> + return ret;
> + }
lets delete the "not found" -- even without the '!' I think it is not
what we want to print on effectively 100% of systems in the field.
How about simply
ACPI: Checking initramfs for custom DSDT.
which doesn't imply anything bad when read in dmesg.
if something bad happens, it will result in one of the messages below
Note that none of the printk's below are checkpatchl.pl clean
> +
> + len = stat.size;
> + /* check especially against empty files */
> + if (len <= 4) {
> + printk("error, file is too small: only %lu bytes.\n", len);
> + return ret;
> + }
> +
> + firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
> + if (IS_ERR(firmware_file)) {
> + printk("error, could not open file %s.\n", ramfs_dsdt_name);
> + return ret;
> + }
> +
> + dsdt_buffer = ACPI_ALLOCATE(len);
> + if (!dsdt_buffer) {
> + printk("error when allocating %lu bytes of memory.\n", len);
> + goto err;
> + }
> +
> + oldfs = get_fs();
> + set_fs(KERNEL_DS);
> + len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
> + set_fs(oldfs);
> + if (len2 < len) {
> + printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
> + ACPI_FREE(dsdt_buffer);
> + goto err;
> + }
> +
> + printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
> + ret = dsdt_buffer;
> +err:
> + filp_close(firmware_file, NULL);
> + return ret;
> +}
> +#endif
> +
> acpi_status
> acpi_os_table_override(struct acpi_table_header * existing_table,
> struct acpi_table_header ** new_table)
> @@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
> if (!existing_table || !new_table)
> return AE_BAD_PARAMETER;
>
> + *new_table = NULL;
> +
> #ifdef CONFIG_ACPI_CUSTOM_DSDT
> if (strncmp(existing_table->signature, "DSDT", 4) == 0)
> *new_table = (struct acpi_table_header *)AmlCode;
> - else
> - *new_table = NULL;
> -#else
> - *new_table = NULL;
> +#endif
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> + if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
> + struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
> + if (initrd_table)
> + *new_table = initrd_table;
> + }
> #endif
> return AE_OK;
I think up here in acpi_os_table_override() is where we should
print _which_ override we are using -- to cover the case
where there may be one from the kernel and also one from the initrd.
If we are using neither, we should print nothing.
> }
> diff --git a/init/initramfs.c b/init/initramfs.c
> index 1db02a0..f2662e2 100644
> --- a/init/initramfs.c
> +++ b/init/initramfs.c
> @@ -541,7 +541,7 @@ skip:
>
> #endif
>
> -static int __init populate_rootfs(void)
> +int __init populate_rootfs(void)
> {
> char *err = unpack_to_rootfs(__initramfs_start,
> __initramfs_end - __initramfs_start, 0);
> @@ -582,4 +582,10 @@ static int __init populate_rootfs(void)
> #endif
> return 0;
> }
> +#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +/*
> + * if this option is enabled, populate_rootfs() is called _earlier_ in the
> + * boot sequence. This insures that the ACPI initialisation can find the file.
> + */
> rootfs_initcall(populate_rootfs);
> +#endif
> diff --git a/init/main.c b/init/main.c
> index f287ca5..7eb1b89 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
> extern void tc_init(void);
> #endif
>
> +#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
> +extern int populate_rootfs(void);
> +#else
> +static inline void populate_rootfs(void) {}
> +#endif
> +
> enum system_states system_state;
> EXPORT_SYMBOL(system_state);
>
> @@ -643,6 +649,7 @@ asmlinkage void __init start_kernel(void)
>
> check_bugs();
>
> + populate_rootfs(); /* For DSDT override from initramfs */
but this is also done as an initcall, yes?
> acpi_early_init(); /* before LAPIC and SMP init */
>
> /* Do the rest non-__init'ed, we're now alive */
>
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 0/3] Override DSDT via initramfs
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
2008-02-04 17:53 ` Thomas Renninger
@ 2008-02-07 0:15 ` Len Brown
2008-02-07 0:23 ` Éric Piel
1 sibling, 1 reply; 38+ messages in thread
From: Len Brown @ 2008-02-07 0:15 UTC (permalink / raw)
To: Éric Piel; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Sunday 03 February 2008 12:28, Éric Piel wrote:
> Hello,
>
> Here are three patches to implement the override of DSDT via initramfs.
> I haven't included the feature for overriding the SSDTs as it's seems
> it's still a bit controversial, and anyway for now there is very little
> need for it. It should be fairly trivial to add it later if need arises.
>
> The patches are against 2.6.24-git-du-jour, and they have been
> boot-tested on my laptop.
Thanks Eric,
I'll take Thomas, Carlos and my comments and my comments
and try to address them w/ a follow-up patch tonight.
-Len
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 0/3] Override DSDT via initramfs
2008-02-07 0:15 ` Len Brown
@ 2008-02-07 0:23 ` Éric Piel
2008-02-07 1:07 ` Len Brown
` (6 more replies)
0 siblings, 7 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-07 0:23 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
07/02/08 01:15, Len Brown wrote/a écrit:
> On Sunday 03 February 2008 12:28, Éric Piel wrote:
>> Hello,
>>
>> Here are three patches to implement the override of DSDT via initramfs.
>> I haven't included the feature for overriding the SSDTs as it's seems
>> it's still a bit controversial, and anyway for now there is very little
>> need for it. It should be fairly trivial to add it later if need arises.
>>
>> The patches are against 2.6.24-git-du-jour, and they have been
>> boot-tested on my laptop.
>
> Thanks Eric,
> I'll take Thomas, Carlos and my comments and my comments
> and try to address them w/ a follow-up patch tonight.
>
> -Len
Ah, Great! Just for info, I had started answering the comments from Thomas and Carlos. Here is my proposed version as description for Kconfig:
With this feature you will be able to provide a customized DSDT by
adding it to your initramfs. Overriding of the DSDT is mainly thought
for developing/testing purposes! If you have problems with ACPI on
your machine and you have fixed it up by modifying the DSDT, do not
override the DSDT as a long term solution. E.g. if you add new
memory to your machine, the modified DSDT will not work (BIOS would
generate a slightly adjusted one). Always report bugs in a DSDT to
your computer vendor and to bugzilla.kernel.org (assigned to the ACPI
component).
In case your mkinitrd tool does not support this feature, a script is
provided in the documentation. For more details on this option see
<file:Documentation/dsdt-initrd.txt>.
If you feel like tinkering with the DSDT or might have to test a
corrected DSDT one day select this option. It is safe to say Y here.
You can use it as inspiration ;-) More over, I was thinking of adding a note in dsdt-initrd.txt like this:
Do note that
the format of the table included in the initramfs is binary (iasl -ta), while
if you include the DSDT straight inside the kernel, the format is hexadecimal
(iasl -tc).
See you,
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 0/3] Override DSDT via initramfs
2008-02-07 0:23 ` Éric Piel
@ 2008-02-07 1:07 ` Len Brown
2008-02-07 1:12 ` initrd DSDT override patch series Len Brown
` (5 subsequent siblings)
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:07 UTC (permalink / raw)
To: Éric Piel; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
On Wednesday 06 February 2008 19:23, Éric Piel wrote:
> 07/02/08 01:15, Len Brown wrote/a écrit:
> > On Sunday 03 February 2008 12:28, Éric Piel wrote:
> >> Hello,
> >>
> >> Here are three patches to implement the override of DSDT via initramfs.
> >> I haven't included the feature for overriding the SSDTs as it's seems
> >> it's still a bit controversial, and anyway for now there is very little
> >> need for it. It should be fairly trivial to add it later if need arises.
> >>
> >> The patches are against 2.6.24-git-du-jour, and they have been
> >> boot-tested on my laptop.
> >
> > Thanks Eric,
> > I'll take Thomas, Carlos and my comments and my comments
> > and try to address them w/ a follow-up patch tonight.
> >
> > -Len
> Ah, Great! Just for info, I had started answering the comments from Thomas and Carlos. Here is my proposed version as description for Kconfig:
>
> With this feature you will be able to provide a customized DSDT by
> adding it to your initramfs. Overriding of the DSDT is mainly thought
> for developing/testing purposes! If you have problems with ACPI on
> your machine and you have fixed it up by modifying the DSDT, do not
> override the DSDT as a long term solution. E.g. if you add new
> memory to your machine, the modified DSDT will not work (BIOS would
> generate a slightly adjusted one). Always report bugs in a DSDT to
> your computer vendor and to bugzilla.kernel.org (assigned to the ACPI
> component).
>
> In case your mkinitrd tool does not support this feature, a script is
> provided in the documentation. For more details on this option see
> <file:Documentation/dsdt-initrd.txt>.
>
> If you feel like tinkering with the DSDT or might have to test a
> corrected DSDT one day select this option. It is safe to say Y here.
>
> You can use it as inspiration ;-) More over, I was thinking of adding a note in dsdt-initrd.txt like this:
>
> Do note that
> the format of the table included in the initramfs is binary (iasl -ta), while
> if you include the DSDT straight inside the kernel, the format is hexadecimal
> (iasl -tc).
i think we can add that to the detailed how-to, which I'd
rather have on a web page with a pointer to the latest tools etc.
(yes, i hold the pen on the web page too:-)
let me send those patches now before dinner break...
thanks,
-Len
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* initrd DSDT override patch series
2008-02-07 0:23 ` Éric Piel
2008-02-07 1:07 ` Len Brown
@ 2008-02-07 1:12 ` Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: basic initramfs DSDT override support Len Brown
` (4 subsequent siblings)
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi
Okay, Eric, here's what I've got in the tree now.
Can you give it a whirl?
thanks,
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] ACPI: basic initramfs DSDT override support
2008-02-07 0:23 ` Éric Piel
2008-02-07 1:07 ` Len Brown
2008-02-07 1:12 ` initrd DSDT override patch series Len Brown
@ 2008-02-07 1:12 ` Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: Taint kernel on ACPI table override (format corrected) Len Brown
` (3 subsequent siblings)
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi; +Cc: Éric Piel, Eric Piel, Len Brown
From: Éric Piel <Eric.Piel@tremplin-utc.net>
The basics of DSDT from initramfs. In case this option is selected,
populate_rootfs() is called a bit earlier to have the initramfs content
available during ACPI initialization.
This is a very similar path to the one available at
http://gaugusch.at/kernel.shtml but with some update in the
documentation, default set to No and the change of populate_rootfs() the
"Jeff Mahony way" (which avoids reading the initramfs twice).
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Len Brown <len.brown@intel.com>
---
Documentation/acpi/dsdt-initrd.txt | 100 ++++++++++++++++++++++++++++++++++++
drivers/acpi/Kconfig | 17 ++++++
drivers/acpi/osl.c | 73 +++++++++++++++++++++++++--
init/initramfs.c | 8 +++-
init/main.c | 7 +++
5 files changed, 200 insertions(+), 5 deletions(-)
create mode 100644 Documentation/acpi/dsdt-initrd.txt
diff --git a/Documentation/acpi/dsdt-initrd.txt b/Documentation/acpi/dsdt-initrd.txt
new file mode 100644
index 0000000..59f8609
--- /dev/null
+++ b/Documentation/acpi/dsdt-initrd.txt
@@ -0,0 +1,100 @@
+ACPI Custom DSDT read from initramfs
+
+2003 by Markus Gaugusch < dsdt at gaugusch dot at >
+Special thanks go to Thomas Renninger from SuSE, who updated the patch for
+2.6.0 and later modified it to read inside initramfs
+2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
+
+This option is intended for people who would like to hack their DSDT and don't
+want to recompile their kernel after every change. It can also be useful to
+distros which offers pre-compiled kernels and want to allow their users to use
+a modified DSDT. In the Kernel config, enable the initial RAM filesystem
+support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
+options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
+
+A custom DSDT (Differentiated System Description Table) is useful when your
+computer uses ACPI but problems occur due to broken implementation. Typically,
+your computer works but there are some troubles with the hardware detection or
+the power management. You can check that troubles come from errors in the DSDT by
+activating the ACPI debug option and reading the logs. This table is provided
+by the BIOS, therefore it might be a good idea to check for BIOS update on your
+vendor website before going any further. Errors are often caused by vendors
+testing their hardware only with Windows or because there is code which is
+executed only on a specific OS with a specific version and Linux hasn't been
+considered during the development.
+
+Before you run away from customising your DSDT, you should note that already
+corrected tables are available for a fair amount of computers on this web-page:
+http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
+match closely the hardware, including the amount of RAM, the frequency of the
+processor and the PCI cards present! If you are part of the unluckies who
+cannot find their hardware in this database, you can modify your DSDT by
+yourself. This process is less painful than it sounds. Download the Intel ASL
+compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
+As root, you then have to dump your DSDT and decompile it. By using the
+compiler messages as well as the kernel ACPI debug messages and the reference
+book (available at the Intel website and also at http://www.acpi.info), it is
+quite easy to obtain a fully working table.
+
+Once your new DSDT is ready you'll have to add it to an initramfs so that the
+kernel can read the table at the very beginning of the boot. As the file has to
+be accessed very early during the boot process the initramfs has to be an
+initramfs. The file is contained into the initramfs under the name /DSDT.aml .
+To obtain such an initramfs, you might have to modify your initramfs script or
+you can add it later to the initramfs with the script appended to this
+document. The command will look like:
+initramfs-add-dsdt initramfs.img my-dsdt.aml
+
+In case you don't use any initramfs, the possibilities you have are to either
+start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
+configure option to directly include your DSDT inside the kernel.
+
+The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
+found or not. If you need to update your DSDT, generate a new initramfs and
+perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
+
+
+====================== Here starts initramfs-add-dsdt ==========================
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index ccf6ea9..0442ae1 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -274,6 +274,23 @@ config ACPI_CUSTOM_DSDT_FILE
Enter the full path name to the file which includes the AmlCode
declaration.
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default n
+ help
+ The DSDT (Differentiated System Description Table) often needs to be
+ overridden because of broken BIOS implementations. If this feature is
+ activated you will be able to provide a customized DSDT by adding it
+ to your initramfs. If your mkinitrd tool does not support this feature
+ a script is provided in the documentation. For more details see
+ <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
+ If there is no table found, it will fall-back to the custom DSDT
+ in-kernel (if activated) or to the DSDT from the BIOS.
+
+ Even if you do not need a new one at the moment, you may want to use a
+ better DSDT later. It is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e53fb51..131936e 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -312,6 +312,66 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header *acpi_find_dsdt_initrd(void)
+{
+ struct file *firmware_file;
+ mm_segment_t oldfs;
+ unsigned long len, len2;
+ struct acpi_table_header *dsdt_buffer, *ret = NULL;
+ struct kstat stat;
+ char *ramfs_dsdt_name = "/DSDT.aml";
+
+ printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
+
+ /*
+ * Never do this at home, only the user-space is allowed to open a file.
+ * The clean way would be to use the firmware loader. But this code must be run
+ * before there is any userspace available. So we need a static/init firmware
+ * infrastructure, which doesn't exist yet...
+ */
+ if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
+ printk("not found.\n");
+ return ret;
+ }
+
+ len = stat.size;
+ /* check especially against empty files */
+ if (len <= 4) {
+ printk("error, file is too small: only %lu bytes.\n", len);
+ return ret;
+ }
+
+ firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
+ if (IS_ERR(firmware_file)) {
+ printk("error, could not open file %s.\n", ramfs_dsdt_name);
+ return ret;
+ }
+
+ dsdt_buffer = ACPI_ALLOCATE(len);
+ if (!dsdt_buffer) {
+ printk("error when allocating %lu bytes of memory.\n", len);
+ goto err;
+ }
+
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
+ set_fs(oldfs);
+ if (len2 < len) {
+ printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ACPI_FREE(dsdt_buffer);
+ goto err;
+ }
+
+ printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ ret = dsdt_buffer;
+err:
+ filp_close(firmware_file, NULL);
+ return ret;
+}
+#endif
+
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
@@ -319,13 +379,18 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
+ *new_table = NULL;
+
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
- else
- *new_table = NULL;
-#else
- *new_table = NULL;
+#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
+ if (initrd_table)
+ *new_table = initrd_table;
+ }
#endif
return AE_OK;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index d53fee8..c0b1e05 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -538,7 +538,7 @@ skip:
initrd_end = 0;
}
-static int __init populate_rootfs(void)
+int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
@@ -577,4 +577,10 @@ static int __init populate_rootfs(void)
}
return 0;
}
+#ifndef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+/*
+ * if this option is enabled, populate_rootfs() is called _earlier_ in the
+ * boot sequence. This insures that the ACPI initialisation can find the file.
+ */
rootfs_initcall(populate_rootfs);
+#endif
diff --git a/init/main.c b/init/main.c
index c691f5f..2a78932 100644
--- a/init/main.c
+++ b/init/main.c
@@ -102,6 +102,12 @@ static inline void mark_rodata_ro(void) { }
extern void tc_init(void);
#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+extern int populate_rootfs(void);
+#else
+static inline void populate_rootfs(void) {}
+#endif
+
enum system_states system_state;
EXPORT_SYMBOL(system_state);
@@ -648,6 +654,7 @@ asmlinkage void __init start_kernel(void)
check_bugs();
+ populate_rootfs(); /* For DSDT override from initramfs */
acpi_early_init(); /* before LAPIC and SMP init */
/* Do the rest non-__init'ed, we're now alive */
--
1.5.4.23.gef5b9
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] ACPI: Taint kernel on ACPI table override (format corrected)
2008-02-07 0:23 ` Éric Piel
` (2 preceding siblings ...)
2008-02-07 1:12 ` [PATCH] ACPI: basic initramfs DSDT override support Len Brown
@ 2008-02-07 1:12 ` Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: Add "acpi_no_initrd_override" kernel parameter Len Brown
` (2 subsequent siblings)
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi; +Cc: Éric Piel, Eric Piel, Len Brown
From: Éric Piel <Eric.Piel@tremplin-utc.net>
When an ACPI table is overridden (for now this can happen only for DSDT)
display a big warning and taint the kernel with flag A.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/acpi/osl.c | 7 +++++++
include/linux/kernel.h | 1 +
kernel/panic.c | 5 +++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 131936e..bbd8360 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -392,6 +392,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = initrd_table;
}
#endif
+ if (*new_table != NULL) {
+ printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
+ "this is unsafe: tainting kernel\n",
+ existing_table->signature,
+ existing_table->oem_table_id);
+ add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
+ }
return AE_OK;
}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 18222f2..9e01f37 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -243,6 +243,7 @@ extern enum system_states {
#define TAINT_BAD_PAGE (1<<5)
#define TAINT_USER (1<<6)
#define TAINT_DIE (1<<7)
+#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
extern void dump_stack(void) __cold;
diff --git a/kernel/panic.c b/kernel/panic.c
index d9e90cf..24af9f8 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -161,7 +161,7 @@ const char *print_tainted(void)
{
static char buf[20];
if (tainted) {
- snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c",
+ snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c",
tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
@@ -169,7 +169,8 @@ const char *print_tainted(void)
tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
tainted & TAINT_BAD_PAGE ? 'B' : ' ',
tainted & TAINT_USER ? 'U' : ' ',
- tainted & TAINT_DIE ? 'D' : ' ');
+ tainted & TAINT_DIE ? 'D' : ' ',
+ tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ');
}
else
snprintf(buf, sizeof(buf), "Not tainted");
--
1.5.4.23.gef5b9
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] ACPI: Add "acpi_no_initrd_override" kernel parameter
2008-02-07 0:23 ` Éric Piel
` (3 preceding siblings ...)
2008-02-07 1:12 ` [PATCH] ACPI: Taint kernel on ACPI table override (format corrected) Len Brown
@ 2008-02-07 1:12 ` Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: update DSDT override documentation Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: update intrd DSDT override console messages Len Brown
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi; +Cc: Éric Piel, Eric Piel, Len Brown
From: Éric Piel <Eric.Piel@tremplin-utc.net>
The acpi_no_initrd_override parameter permits to disable the load of an ACPI
table from the initramfs.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Len Brown <len.brown@intel.com>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/acpi/osl.c | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 8fd5aa4..ef2316a 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -175,6 +175,9 @@ and is between 256 and 4096 characters. It is defined in the file
acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
+ acpi_no_initrd_override [KNL,ACPI]
+ Disable loading custom ACPI tables from the initramfs
+
acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
Format: To spoof as Windows 98: ="Microsoft Windows"
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index bbd8360..40adf0d 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,6 +77,10 @@ static struct workqueue_struct *kacpi_notify_wq;
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int acpi_no_initrd_override;
+#endif
+
/*
* "Ode to _OSI(Linux)"
*
@@ -386,7 +390,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
*new_table = (struct acpi_table_header *)AmlCode;
#endif
#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
- if (strncmp(existing_table->signature, "DSDT", 4) == 0) {
+ if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
+ !acpi_no_initrd_override) {
struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
if (initrd_table)
*new_table = initrd_table;
@@ -402,6 +407,13 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
return AE_OK;
}
+int __init acpi_no_initrd_override_setup(char *s)
+{
+ acpi_no_initrd_override = 1;
+ return 1;
+}
+__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
+
static irqreturn_t acpi_irq(int irq, void *dev_id)
{
return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
--
1.5.4.23.gef5b9
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] ACPI: update DSDT override documentation
2008-02-07 0:23 ` Éric Piel
` (4 preceding siblings ...)
2008-02-07 1:12 ` [PATCH] ACPI: Add "acpi_no_initrd_override" kernel parameter Len Brown
@ 2008-02-07 1:12 ` Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: update intrd DSDT override console messages Len Brown
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi; +Cc: Len Brown
From: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
Documentation/acpi/dsdt-initrd.txt | 100 ------------------------------
Documentation/acpi/dsdt-override.txt | 15 +++++
Documentation/acpi/initramfs-add-dsdt.sh | 43 +++++++++++++
drivers/acpi/Kconfig | 22 +++----
4 files changed, 67 insertions(+), 113 deletions(-)
delete mode 100644 Documentation/acpi/dsdt-initrd.txt
create mode 100644 Documentation/acpi/dsdt-override.txt
create mode 100755 Documentation/acpi/initramfs-add-dsdt.sh
diff --git a/Documentation/acpi/dsdt-initrd.txt b/Documentation/acpi/dsdt-initrd.txt
deleted file mode 100644
index 59f8609..0000000
--- a/Documentation/acpi/dsdt-initrd.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-ACPI Custom DSDT read from initramfs
-
-2003 by Markus Gaugusch < dsdt at gaugusch dot at >
-Special thanks go to Thomas Renninger from SuSE, who updated the patch for
-2.6.0 and later modified it to read inside initramfs
-2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
-
-This option is intended for people who would like to hack their DSDT and don't
-want to recompile their kernel after every change. It can also be useful to
-distros which offers pre-compiled kernels and want to allow their users to use
-a modified DSDT. In the Kernel config, enable the initial RAM filesystem
-support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
-options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
-
-A custom DSDT (Differentiated System Description Table) is useful when your
-computer uses ACPI but problems occur due to broken implementation. Typically,
-your computer works but there are some troubles with the hardware detection or
-the power management. You can check that troubles come from errors in the DSDT by
-activating the ACPI debug option and reading the logs. This table is provided
-by the BIOS, therefore it might be a good idea to check for BIOS update on your
-vendor website before going any further. Errors are often caused by vendors
-testing their hardware only with Windows or because there is code which is
-executed only on a specific OS with a specific version and Linux hasn't been
-considered during the development.
-
-Before you run away from customising your DSDT, you should note that already
-corrected tables are available for a fair amount of computers on this web-page:
-http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
-match closely the hardware, including the amount of RAM, the frequency of the
-processor and the PCI cards present! If you are part of the unluckies who
-cannot find their hardware in this database, you can modify your DSDT by
-yourself. This process is less painful than it sounds. Download the Intel ASL
-compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
-As root, you then have to dump your DSDT and decompile it. By using the
-compiler messages as well as the kernel ACPI debug messages and the reference
-book (available at the Intel website and also at http://www.acpi.info), it is
-quite easy to obtain a fully working table.
-
-Once your new DSDT is ready you'll have to add it to an initramfs so that the
-kernel can read the table at the very beginning of the boot. As the file has to
-be accessed very early during the boot process the initramfs has to be an
-initramfs. The file is contained into the initramfs under the name /DSDT.aml .
-To obtain such an initramfs, you might have to modify your initramfs script or
-you can add it later to the initramfs with the script appended to this
-document. The command will look like:
-initramfs-add-dsdt initramfs.img my-dsdt.aml
-
-In case you don't use any initramfs, the possibilities you have are to either
-start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
-configure option to directly include your DSDT inside the kernel.
-
-The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
-found or not. If you need to update your DSDT, generate a new initramfs and
-perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
-
-
-====================== Here starts initramfs-add-dsdt ==========================
-#!/bin/bash
-# Adds a DSDT file to the initrd (if it's an initramfs)
-# first argument is the name of archive
-# second argument is the name of the file to add
-# The file will be copied as /DSDT.aml
-
-# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
-# 20060205: this time it should really work
-
-# check the arguments
-if [ $# -ne 2 ]; then
- program_name=$(basename $0)
- echo "\
-$program_name: too few arguments
-Usage: $program_name initrd-name.img DSDT-to-add.aml
-Adds a DSDT file to an initrd (in initramfs format)
-
- initrd-name.img: filename of the initrd in initramfs format
- DSDT-to-add.aml: filename of the DSDT file to add
- " 1>&2
- exit 1
-fi
-
-# we should check it's an initramfs
-
-tempcpio=$(mktemp -d)
-# cleanup on exit, hangup, interrupt, quit, termination
-trap 'rm -rf $tempcpio' 0 1 2 3 15
-
-# extract the archive
-gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
-
-# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
-cp -f "$2" "$tempcpio"/DSDT.aml
-
-# add the file
-cd "$tempcpio"
-(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
-cd "$OLDPWD"
-
-# re-compress the archive
-gzip -c "$tempcpio"/initramfs.cpio > "$1"
-
diff --git a/Documentation/acpi/dsdt-override.txt b/Documentation/acpi/dsdt-override.txt
new file mode 100644
index 0000000..5008f25
--- /dev/null
+++ b/Documentation/acpi/dsdt-override.txt
@@ -0,0 +1,15 @@
+Linux supports two methods of overriding the BIOS DSDT:
+
+CONFIG_ACPI_CUSTOM_DSDT builds the image into the kernel.
+
+CONFIG_ACPI_CUSTOM_DSDT_INITRD adds the image to the initrd.
+
+When to use these methods is described in detail on the
+Linux/ACPI home page:
+http://www.lesswatts.org/projects/acpi/overridingDSDT.php
+
+Note that if both options are used, the DSDT supplied
+by the INITRD method takes precedence.
+
+Documentation/initramfs-add-dsdt.sh is provided for convenience
+for 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
new file mode 100755
index 0000000..17ef6e8
--- /dev/null
+++ b/Documentation/acpi/initramfs-add-dsdt.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 0442ae1..c8e8320 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -263,8 +263,10 @@ config ACPI_CUSTOM_DSDT
depends on !STANDALONE
default n
help
- This option is to load a custom ACPI DSDT
- If you don't know what that is, say N.
+ This option supports a custom DSDT by linking it into the kernel.
+ See Documentation/acpi/dsdt-override.txt
+
+ If unsure, say N.
config ACPI_CUSTOM_DSDT_FILE
string "Custom DSDT Table file to include"
@@ -279,17 +281,11 @@ config ACPI_CUSTOM_DSDT_INITRD
depends on BLK_DEV_INITRD
default n
help
- The DSDT (Differentiated System Description Table) often needs to be
- overridden because of broken BIOS implementations. If this feature is
- activated you will be able to provide a customized DSDT by adding it
- to your initramfs. If your mkinitrd tool does not support this feature
- a script is provided in the documentation. For more details see
- <file:Documentation/dsdt-initrd.txt> or <http://gaugusch.at/kernel.shtml>.
- If there is no table found, it will fall-back to the custom DSDT
- in-kernel (if activated) or to the DSDT from the BIOS.
-
- Even if you do not need a new one at the moment, you may want to use a
- better DSDT later. It is safe to say Y here.
+ This option supports a custom DSDT by optionally loading it from initrd.
+ See Documentation/acpi/dsdt-override.txt
+
+ If you are not using this feature now, but may use it later,
+ it is safe to say Y here.
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
--
1.5.4.23.gef5b9
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] ACPI: update intrd DSDT override console messages
2008-02-07 0:23 ` Éric Piel
` (5 preceding siblings ...)
2008-02-07 1:12 ` [PATCH] ACPI: update DSDT override documentation Len Brown
@ 2008-02-07 1:12 ` Len Brown
6 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 1:12 UTC (permalink / raw)
To: linux-acpi; +Cc: Len Brown
From: Len Brown <len.brown@intel.com>
also, address some checkpatch.pl violations
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/acpi/osl.c | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 40adf0d..60e80bb 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -326,49 +326,50 @@ struct acpi_table_header *acpi_find_dsdt_initrd(void)
struct kstat stat;
char *ramfs_dsdt_name = "/DSDT.aml";
- printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
+ printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT");
/*
* Never do this at home, only the user-space is allowed to open a file.
- * The clean way would be to use the firmware loader. But this code must be run
- * before there is any userspace available. So we need a static/init firmware
- * infrastructure, which doesn't exist yet...
+ * The clean way would be to use the firmware loader.
+ * But this code must be run before there is any userspace available.
+ * A static/init firmware infrastructure doesn't exist yet...
*/
- if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
- printk("not found.\n");
+ if (vfs_stat(ramfs_dsdt_name, &stat) < 0)
return ret;
- }
len = stat.size;
/* check especially against empty files */
if (len <= 4) {
- printk("error, file is too small: only %lu bytes.\n", len);
+ printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len);
return ret;
}
firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
if (IS_ERR(firmware_file)) {
- printk("error, could not open file %s.\n", ramfs_dsdt_name);
+ printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name);
return ret;
}
- dsdt_buffer = ACPI_ALLOCATE(len);
+ dsdt_buffer = kmalloc(len, GFP_ATOMIC);
if (!dsdt_buffer) {
- printk("error when allocating %lu bytes of memory.\n", len);
+ printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len);
goto err;
}
oldfs = get_fs();
set_fs(KERNEL_DS);
- len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
+ len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len,
+ &firmware_file->f_pos);
set_fs(oldfs);
if (len2 < len) {
- printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n",
+ len, ramfs_dsdt_name);
ACPI_FREE(dsdt_buffer);
goto err;
}
- printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
+ printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n",
+ len, ramfs_dsdt_name);
ret = dsdt_buffer;
err:
filp_close(firmware_file, NULL);
@@ -392,7 +393,9 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
!acpi_no_initrd_override) {
- struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
+ struct acpi_table_header *initrd_table;
+
+ initrd_table = acpi_find_dsdt_initrd();
if (initrd_table)
*new_table = initrd_table;
}
--
1.5.4.23.gef5b9
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-01-30 22:36 ` Éric Piel
2008-01-31 19:17 ` Len Brown
2008-02-01 10:21 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
@ 2008-02-07 2:49 ` Len Brown
2 siblings, 0 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 2:49 UTC (permalink / raw)
To: Éric Piel; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
> >> Probably it is best to forward the original patch
> >> w/ proper credits, and then send updates to address 1-4.
> Thomas, the patch you have included is only the "original" patch, right?
> We need to address the points 1-4 (which seem very reasonable) later on
> with additional patches. I think most of them are already implemented in
> http://gaugusch.at/acpi-dsdt-initrd-patches/acpi-dsdt-initrd-v0.8.2-2.6.17-ssdt.patch
> So that should be quite easy :-)
>
> > I do not know who initially came up with this, I just modified/adjusted
> > the patch sometimes. I expect it's Markus, possibly Eric or best both
> > who should be mentioned as author.
> Yep, to be precise, Markus Gaugusch is the original author, I'm just the
> current maintainer, and Thomas has been very helpful for a looong time :-)
okay, i'll update the original author to be Markus Gaugusch <dsdt@gaugusch.at>
(for future reference, if you start the patch comments with a From:
you can specific the original author as somebody else that way)
thanks,
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-01 10:21 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
2008-02-01 10:38 ` Eric Piel
@ 2008-02-07 2:51 ` Len Brown
2008-02-07 7:57 ` Éric Piel
2008-04-18 22:07 ` Philippe Coval
1 sibling, 2 replies; 38+ messages in thread
From: Len Brown @ 2008-02-07 2:51 UTC (permalink / raw)
To: trenn; +Cc: Éric Piel, Andrew Morton, Philippe Coval, linux-acpi, dsdt
> > > Jeff (Mahony) has adjusted the last bits of it when he updated it to the
> > > latest rcX-gitY version:
> > > Changes:
> > > We no longer call populate_rootfs() twice. If we want the custom DSDT,
> > > we load the rootfs before ACPI. Otherwise, it is loaded at the
> > > appropriate
> > > initcall time. -jeffm
> > I had left it this way because I though Linus had a good reason for
> > delaying populate_rootfs(). But if it works, fine! Maybe some additional
> > comments should be added in before the #ifdef's to clearly show that
> > populate_rootfs() is _always_ called, and they modify only the moment it
> > is called.
> I don't know about this, I took that change from your patches...
So is the populate_rootfs() change in the pach I have correct, or not?
thanks,
-Len
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-07 2:51 ` Len Brown
@ 2008-02-07 7:57 ` Éric Piel
2008-04-18 22:07 ` Philippe Coval
1 sibling, 0 replies; 38+ messages in thread
From: Éric Piel @ 2008-02-07 7:57 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Andrew Morton, Philippe Coval, linux-acpi, dsdt
07/02/08 03:51, Len Brown wrote/a écrit:
>>>> Jeff (Mahony) has adjusted the last bits of it when he updated it to the
>>>> latest rcX-gitY version:
>>>> Changes:
>>>> We no longer call populate_rootfs() twice. If we want the custom DSDT,
>>>> we load the rootfs before ACPI. Otherwise, it is loaded at the
>>>> appropriate
>>>> initcall time. -jeffm
>
>>> I had left it this way because I though Linus had a good reason for
>>> delaying populate_rootfs(). But if it works, fine! Maybe some additional
>>> comments should be added in before the #ifdef's to clearly show that
>>> populate_rootfs() is _always_ called, and they modify only the moment it
>>> is called.
>
>> I don't know about this, I took that change from your patches...
>
> So is the populate_rootfs() change in the pach I have correct, or not?
Yes, it's correct. This is the SuSE version, which is slightly different
from the one I had written for the official patch, but which avoids
calling twice populate_rootfs(). Both versions work fine anyway :-)
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-02-07 2:51 ` Len Brown
2008-02-07 7:57 ` Éric Piel
@ 2008-04-18 22:07 ` Philippe Coval
2008-04-18 23:25 ` Eric Piel
1 sibling, 1 reply; 38+ messages in thread
From: Philippe Coval @ 2008-04-18 22:07 UTC (permalink / raw)
To: Len Brown; +Cc: trenn, Éric Piel, Andrew Morton, linux-acpi, dsdt
[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]
Hi,
First let me introduce myself, my name does not appear,
but I am the quoted one by Andrew Morton on his 1st post of this thread :
http://thread.gmane.org/gmane.linux.acpi.devel/27726
> > I am annoyed by this missing (or rejected) feature upstream : DSDT
> > http://gaugusch.at/kernel.shtml
> > So to use "custom DSDT loading" I have to patch my laptop buggy BIOS
...
> > Hopefully many distro already include this patch, but not all of them
> > such as debian :
> > http://bugs.debian.org/251023
You may be aware of that yet, but It seems that the patch was rejected
for 2.6.25
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a9e0d685553af76cb6ae2af93cca4913e7fcd47
Quoting linus : "the relevant ACPI code should either run much later,"
So was next then ? how can we help to fix this recurrent issue ?
Anyway I'd like to thank you all for all time spent on this job,
and I am happy with the patch as it is...
Regards
--
# mailto:rzr[a]users.sf.net -- gpg:0x467094BC
# http://rzr.online.fr/contribs.htm -- Libre Software Addict
# xmpp:rzr[a]jabber.fr -- sip:rzr[a]ekiga.net
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] Override DSDT and SSDTs via initramfs
2008-04-18 22:07 ` Philippe Coval
@ 2008-04-18 23:25 ` Eric Piel
0 siblings, 0 replies; 38+ messages in thread
From: Eric Piel @ 2008-04-18 23:25 UTC (permalink / raw)
To: Philippe Coval; +Cc: Len Brown, trenn, Andrew Morton, linux-acpi, dsdt
[-- Attachment #1: Type: text/plain, Size: 2417 bytes --]
Philippe Coval wrote:
> Hi,
:
> You may be aware of that yet, but It seems that the patch was rejected
> for 2.6.25
>
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a9e0d685553af76cb6ae2af93cca4913e7fcd47
>
> Quoting linus : "the relevant ACPI code should either run much later,"
Hi,
Yes, I'm aware of it. The problem was that the code was using fake
userspace commands to access the filesystem (it's was not really wrong
but it always warm the blood of people) _and_ it was reordering the
initialisation code in a rather incompatible way with the some of the
part of the kernel (which is indeed a good reason to reject a patch!).
> So was next then ? how can we help to fix this recurrent issue ?
Now that 2.6.26-rc is open, I can try to summarize all the discussions
that have been about this patch during previous cycle. There are
basically three solutions:
* Make the ACPI layer able to update the DSDT (or other table) at any
time. This was proposed by Linus, and sounds the most beautiful
approach... until you realize that it will lead to lots of limitations
on what update can be done on the DSDT and that it requires basically a
full rewrite of the ACPI layer (and some other parts of the kernel).
* Leverage the kexec infrastructure: instead of inserting the DSDT in
the initramfs, you first boot calmly, read the DSDT from userspace as
you feel like, reboot with kexec to the same kernel while passing this
DSDT to the next kernel instance, which will then use it. It seems quite
a reasonable approach. So far the only problem I have is that I don't
know how to reliably pass the DSDT as argument to the second kernel
(mainly due to lack of time to look for).
* Add 20 lines to the initramfs parser so that it can also just read
one file and copy it to memory without populating the rootfs. This
permits an approach very similar to the previous one but without fake
userspace commands and without reordering the initialisation. Attached
is a patch doing this.
Actually, I'd be interested to know how likely this last approach would
be acceptable for the kernel. Andrew, would you accept the patch in your
tree, for testing?
> Anyway I'd like to thank you all for all time spent on this job,
> and I am happy with the patch as it is...
One small thing to do to help is to test this patch and report success
or failure :-)
See you,
Eric
[-- Attachment #2: acpi-dsdt-initrd-v0.9-2.6.25.patch --]
[-- Type: text/plain, Size: 9675 bytes --]
From de31945e20bc0bd255d0264c5d97a6b24906b30a Mon Sep 17 00:00:00 2001
From: Eric Piel <piel@localhost.(none)>
Date: Wed, 19 Mar 2008 23:00:04 +0100
Subject: [PATCH 1/1] ACPI: initramfs DSDT override support
Permits to load of DSDT (the main ACPI table) from initramfs. In case this
option is selected, the initramfs is parsed at ACPI initialization (very early
boot time) to look for a file DSDT.aml . This aims at allowing users to
override the DSDT without recompiling the kernel
This is derived from the patch from http://gaugusch.at/kernel.shtml but with
some clean-up's in the documentation, default set to No, a kernel paramater to
disable it at runtime, and most important, a different approach for reading the
initramfs which avoids using the filesystem infrastructure.
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
Documentation/acpi/dsdt-override.txt | 12 ++++-
Documentation/acpi/initramfs-add-dsdt.sh | 43 +++++++++++++++++
Documentation/kernel-parameters.txt | 3 +
drivers/acpi/Kconfig | 11 ++++
drivers/acpi/osl.c | 24 ++++++++++
init/initramfs.c | 74 ++++++++++++++++++++++++++++++
6 files changed, 165 insertions(+), 2 deletions(-)
create mode 100644 Documentation/acpi/initramfs-add-dsdt.sh
diff --git a/Documentation/acpi/dsdt-override.txt b/Documentation/acpi/dsdt-override.txt
index febbb1b..5008f25 100644
--- a/Documentation/acpi/dsdt-override.txt
+++ b/Documentation/acpi/dsdt-override.txt
@@ -1,7 +1,15 @@
-Linux supports a method of overriding the BIOS DSDT:
+Linux supports two methods of overriding the BIOS DSDT:
CONFIG_ACPI_CUSTOM_DSDT builds the image into the kernel.
-When to use this method is described in detail on the
+CONFIG_ACPI_CUSTOM_DSDT_INITRD adds the image to the initrd.
+
+When to use these methods is described in detail on the
Linux/ACPI home page:
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
+
+Note that if both options are used, the DSDT supplied
+by the INITRD method takes precedence.
+
+Documentation/initramfs-add-dsdt.sh is provided for convenience
+for 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
new file mode 100644
index 0000000..17ef6e8
--- /dev/null
+++ b/Documentation/acpi/initramfs-add-dsdt.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Adds a DSDT file to the initrd (if it's an initramfs)
+# first argument is the name of archive
+# second argument is the name of the file to add
+# The file will be copied as /DSDT.aml
+
+# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
+# 20060205: this time it should really work
+
+# check the arguments
+if [ $# -ne 2 ]; then
+ program_name=$(basename $0)
+ echo "\
+$program_name: too few arguments
+Usage: $program_name initrd-name.img DSDT-to-add.aml
+Adds a DSDT file to an initrd (in initramfs format)
+
+ initrd-name.img: filename of the initrd in initramfs format
+ DSDT-to-add.aml: filename of the DSDT file to add
+ " 1>&2
+ exit 1
+fi
+
+# we should check it's an initramfs
+
+tempcpio=$(mktemp -d)
+# cleanup on exit, hangup, interrupt, quit, termination
+trap 'rm -rf $tempcpio' 0 1 2 3 15
+
+# extract the archive
+gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
+
+# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
+cp -f "$2" "$tempcpio"/DSDT.aml
+
+# add the file
+cd "$tempcpio"
+(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
+cd "$OLDPWD"
+
+# re-compress the archive
+gzip -c "$tempcpio"/initramfs.cpio > "$1"
+
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 622f784..49318b9 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -177,6 +177,9 @@ and is between 256 and 4096 characters. It is defined in the file
acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
+ acpi_no_initrd_override [KNL,ACPI]
+ Disable loading custom ACPI tables from the initramfs
+
acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
Format: To spoof as Windows 98: ="Microsoft Windows"
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index b4f5e85..fbcaa06 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -300,6 +300,17 @@ config ACPI_CUSTOM_DSDT
bool
default ACPI_CUSTOM_DSDT_FILE != ""
+config ACPI_CUSTOM_DSDT_INITRD
+ bool "Read Custom DSDT from initramfs"
+ depends on BLK_DEV_INITRD
+ default n
+ help
+ This option supports a custom DSDT by optionally loading it from initrd.
+ See Documentation/acpi/dsdt-override.txt
+
+ If you are not using this feature now, but may use it later,
+ it is safe to say Y here.
+
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index a697fb6..8fa630f 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -91,6 +91,11 @@ static DEFINE_SPINLOCK(acpi_res_lock);
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int acpi_no_initrd_override;
+extern struct acpi_table_header *acpi_find_dsdt_initrd(void);
+#endif
+
/*
* "Ode to _OSI(Linux)"
*
@@ -333,6 +338,16 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
#endif
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+ if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
+ !acpi_no_initrd_override) {
+ struct acpi_table_header *initrd_table;
+
+ initrd_table = acpi_find_dsdt_initrd();
+ if (initrd_table)
+ *new_table = initrd_table;
+ }
+#endif
if (*new_table != NULL) {
printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
"this is unsafe: tainting kernel\n",
@@ -343,6 +358,15 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
return AE_OK;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int __init acpi_no_initrd_override_setup(char *s)
+{
+ acpi_no_initrd_override = 1;
+ return 1;
+}
+__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
+#endif
+
static irqreturn_t acpi_irq(int irq, void *dev_id)
{
u32 handled;
diff --git a/init/initramfs.c b/init/initramfs.c
index d53fee8..495380c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -6,6 +6,7 @@
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/syscalls.h>
+#include <acpi/acpi.h>
static __initdata char *message;
static void __init error(char *x)
@@ -90,6 +91,12 @@ static __initdata unsigned long body_len, name_len;
static __initdata uid_t uid;
static __initdata gid_t gid;
static __initdata unsigned rdev;
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static __initdata char *file_looked_for;
+static __initdata struct acpi_table_header *file_mem;
+#else
+const char *file_looked_for = NULL;
+#endif
static void __init parse_header(char *s)
{
@@ -123,6 +130,7 @@ static __initdata enum state {
SkipIt,
GotName,
CopyFile,
+ CopyFileMem,
GotSymlink,
Reset
} state, next_state;
@@ -267,6 +275,9 @@ static int __init do_name(void)
free_hash();
return 0;
}
+ if (file_looked_for && S_ISREG(mode) &&
+ (strcmp(collected, file_looked_for) == 0))
+ state = CopyFileMem;
if (dry_run)
return 0;
clean_path(collected, mode);
@@ -299,6 +310,40 @@ static int __init do_name(void)
return 0;
}
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+static int __init do_copy_mem(void)
+{
+ static void *file_current; /* current position in the memory */
+ if (file_mem == NULL) {
+ if (body_len < 4) { /* check especially against empty files */
+ error("file is less than 4 bytes");
+ return 1;
+ }
+ file_mem = kmalloc(body_len, GFP_ATOMIC);
+ if (!file_mem) {
+ error("failed to allocate enough memory");
+ return 1;
+ }
+ file_current = file_mem;
+ }
+ if (count >= body_len) {
+ memcpy(file_current, victim, body_len);
+ eat(body_len);
+ file_looked_for = NULL; /* don't find files with same name */
+ state = SkipIt;
+ return 0;
+ } else {
+ memcpy(file_current, victim, count);
+ file_current += count;
+ body_len -= count;
+ eat(count);
+ return 1;
+ }
+}
+#else
+#define do_copy_mem NULL
+#endif
+
static int __init do_copy(void)
{
if (count >= body_len) {
@@ -333,6 +378,7 @@ static __initdata int (*actions[])(void) = {
[SkipIt] = do_skip,
[GotName] = do_name,
[CopyFile] = do_copy,
+ [CopyFileMem] = do_copy_mem,
[GotSymlink] = do_symlink,
[Reset] = do_reset,
};
@@ -578,3 +624,31 @@ static int __init populate_rootfs(void)
return 0;
}
rootfs_initcall(populate_rootfs);
+
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header *acpi_find_dsdt_initrd(void)
+{
+ char *err, *ramfs_dsdt_name = "DSDT.aml";
+
+ printk(KERN_INFO "ACPI: Checking initramfs for custom DSDT\n");
+ file_mem = NULL;
+ file_looked_for = ramfs_dsdt_name;
+ err = unpack_to_rootfs((char *)initrd_start,
+ initrd_end - initrd_start, 1);
+ file_looked_for = NULL;
+
+ if (err) {
+ /*
+ * Even if reading the DSDT file was successful,
+ * we give up if the initramfs cannot be entirely read.
+ */
+ kfree(file_mem);
+ printk(KERN_ERR "ACPI: Aborded because %s.\n", err);
+ return NULL;
+ }
+ if (file_mem)
+ printk(KERN_INFO "ACPI: Found DSDT in %s.\n", ramfs_dsdt_name);
+
+ return file_mem;
+}
+#endif
--
1.5.4.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
end of thread, other threads:[~2008-04-18 23:26 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4798E2A5.6020804@users.sf.net>
[not found] ` <20080125063328.4e3b4752.akpm@linux-foundation.org>
2008-01-26 4:39 ` initrd DSDT override (Re: Feedback about your talk in Rennes France (20080124) : Evolution of the Linux kernel & virtualization technologies) Len Brown
2008-01-30 17:27 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
2008-01-30 22:36 ` Éric Piel
2008-01-31 19:17 ` Len Brown
2008-02-01 9:53 ` Thomas Renninger
2008-02-01 11:07 ` Alexey Starikovskiy
2008-02-01 11:29 ` Thomas Renninger
2008-02-02 4:36 ` Len Brown
2008-02-03 17:28 ` [PATCH 0/3] Override DSDT " Éric Piel
2008-02-04 17:53 ` Thomas Renninger
2008-02-04 22:57 ` Éric Piel
2008-02-07 0:15 ` Len Brown
2008-02-07 0:23 ` Éric Piel
2008-02-07 1:07 ` Len Brown
2008-02-07 1:12 ` initrd DSDT override patch series Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: basic initramfs DSDT override support Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: Taint kernel on ACPI table override (format corrected) Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: Add "acpi_no_initrd_override" kernel parameter Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: update DSDT override documentation Len Brown
2008-02-07 1:12 ` [PATCH] ACPI: update intrd DSDT override console messages Len Brown
2008-02-03 17:28 ` [PATCH 1/3] The basics of DSDT from initramfs Éric Piel
2008-02-03 17:39 ` Markus Gaugusch
2008-02-03 17:55 ` Éric Piel
2008-02-04 23:04 ` [PATCH 1/3] The basics of DSDT from initramfs (format corrected) Éric Piel
2008-02-06 23:54 ` Len Brown
2008-02-05 14:43 ` [PATCH 1/3] The basics of DSDT from initramfs Thomas Renninger
2008-02-05 14:56 ` Carlos Corbacho
2008-02-03 17:29 ` [PATCH 2/3] Taint kernel on ACPI table override Éric Piel
2008-02-04 23:04 ` [PATCH 2/3] Taint kernel on ACPI table override (format corrected) Éric Piel
2008-02-03 17:29 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter Éric Piel
2008-02-04 23:04 ` [PATCH 3/3] Add acpi_no_initrd_override kernel parameter (format corrected) Éric Piel
2008-02-01 10:21 ` [PATCH] Override DSDT and SSDTs via initramfs Thomas Renninger
2008-02-01 10:38 ` Eric Piel
2008-02-07 2:51 ` Len Brown
2008-02-07 7:57 ` Éric Piel
2008-04-18 22:07 ` Philippe Coval
2008-04-18 23:25 ` Eric Piel
2008-02-07 2:49 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).