public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] DSDT in initrd v0.2
@ 2003-05-06 12:51 Markus Gaugusch
       [not found] ` <Pine.LNX.4.53.0305061444120.1274-qopfHk9/S+VQK2oVCIMtW7NldLUNz+W/@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Gaugusch @ 2003-05-06 12:51 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: TEXT/PLAIN, Size: 490 bytes --]

* Fixed: don't scan beyond end of initrd
* printk output fixed
* Feature: Get DSDT from initrd without signature, if it starts with
  "DSDT". This way one can just copy the DSDT.aml file and use it as
  initrd

The patch is against 2.4.21-rc1+latest ACPI, please reverse the old patch
if you used it.

Markus
-- 
__________________    /"\
Markus Gaugusch       \ /    ASCII Ribbon Campaign
markus-z+rTbpWsRgbk7+2FdBfRIA@public.gmane.org     X     Against HTML Mail
                      / \

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3037 bytes --]

--- linux.orig/drivers/acpi/osl.c	2003-05-05 18:00:25.000000000 +0200
+++ linux/drivers/acpi/osl.c	2003-05-06 13:51:06.000000000 +0200
@@ -33,6 +33,10 @@
 #include <linux/interrupt.h>
 #include <linux/kmod.h>
 #include <linux/delay.h>
+#ifdef CONFIG_ACPI_INITRD
+#include <linux/init.h>
+#include <linux/vmalloc.h>
+#endif
 #include <asm/io.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi.h>
@@ -222,14 +226,57 @@
 	return AE_OK;
 }
 
+
+#ifdef CONFIG_ACPI_INITRD
+
+unsigned char* get_dsdt_from_initrd(unsigned char *start, unsigned char *end)
+{
+	unsigned char *data;
+	unsigned char signature[] = "INITRDDSDT123DSDT123";
+
+	if (start == NULL)
+		return NULL;
+	printk(KERN_INFO "Looking for DSDT in initrd ...");
+	if (!memcmp(signature+6, start, 4)) {
+		printk(" found at beginning!\n");
+		return start;
+	}
+	end-=sizeof(signature)+1; /* don't scan above end */
+	for (data=start; data < end ; ++data) {
+		if (!memcmp(data, signature, sizeof(signature)-1)) {
+			printk(" found (at offset %u)!\n", data+sizeof(signature)-start);
+			return data+sizeof(signature);
+		}
+	}
+	printk(" not found!\n");
+
+	return NULL;
+}
+#endif
+
 acpi_status
 acpi_os_table_override (struct acpi_table_header *existing_table,
 			struct acpi_table_header **new_table)
 {
+#ifdef CONFIG_ACPI_INITRD
+	extern unsigned long initrd_start, initrd_end;
+	unsigned char* new_dsdt=NULL;
+
+#endif
 	if (!existing_table || !new_table)
 		return AE_BAD_PARAMETER;
 
+#ifdef CONFIG_ACPI_INITRD
+	if (strncmp(existing_table->signature, "DSDT", 4) == 0 &&
+		(new_dsdt=get_dsdt_from_initrd((unsigned char*)initrd_start, 
+			(unsigned char*)initrd_end)) != NULL)
+		*new_table = (struct acpi_table_header*)new_dsdt;
+	else
+		*new_table = NULL;
+#else
 	*new_table = NULL;
+#endif
+
 	return AE_OK;
 }
 
--- linux.orig/drivers/acpi/Config.in	2003-05-05 18:44:41.000000000 +0200
+++ linux/drivers/acpi/Config.in	2003-05-05 20:19:06.000000000 +0200
@@ -12,6 +12,10 @@
       bool         'CPU Enumeration Only' CONFIG_ACPI_HT_ONLY
     fi
 
+    if [ "$CONFIG_BLK_DEV_INITRD" = "y" ]; then
+      bool         'Read DSDT from initrd' CONFIG_ACPI_INITRD
+    fi
+
     if [ "$CONFIG_ACPI_HT_ONLY" = "y" ]; then
       define_bool CONFIG_ACPI_BOOT		y
     else
--- linux.orig/Documentation/Configure.help	2003-05-05 19:51:09.000000000 +0200
+++ linux/Documentation/Configure.help	2003-05-05 20:18:56.000000000 +0200
@@ -18602,6 +18602,13 @@
   handles PnP messages.  All ACPI devices use its services, so using
   them requires saying Y here.
 
+ACPI DSDT in initrd
+CONFIG_ACPI_INITRD
+  The DSDT (Differentiated System Description Table) often needs to be 
+  overridden because of a broken BIOS implementation. If you want to put
+  the overriden DSDT into the initrd, see http://gaugusch.at/kernel.shtml
+  for more info. If unsure, say N here.
+
 ACPI System Driver
 CONFIG_ACPI_SYS
   This driver will enable your system to shut down using ACPI, and

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] DSDT in initrd v0.2
       [not found] ` <Pine.LNX.4.53.0305061444120.1274-qopfHk9/S+VQK2oVCIMtW7NldLUNz+W/@public.gmane.org>
@ 2003-05-06 17:56   ` Gunter Ohrner
       [not found]     ` <200305061957.00037-GfAVBl5OxjxchHfdsNF8vBvVK+yQ3ZXh@public.gmane.org>
  2003-05-08 21:24   ` Pavel Machek
  1 sibling, 1 reply; 7+ messages in thread
From: Gunter Ohrner @ 2003-05-06 17:56 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Dienstag, 6. Mai 2003 14:51 schrieb Markus Gaugusch:
> * Feature: Get DSDT from initrd without signature, if it starts with
>   "DSDT". This way one can just copy the DSDT.aml file and use it as
>   initrd

This doesn't work for me. How can I troubleshoot the problem? I've never used 
an initrd before.
I fetched the patch and it applied cleanly. Then I compiled RAM disk support 
into the kernel and enabled initrd and ACPI initrd support. Next I copied my 
DSDT.aml file, which starts with the string "DSDT" to /boot/initrd, added 
"initrd=/boot/initrd" to my kernel append line, installed the new kernel and 
re-ran lilo. The new kernel works but it uses the BIOS' buggy DSDT and not my 
just-being-fixed altered dump of it... :-(
dmesg does not seem to show any traces of something with initrd at all...

Greetings,

  Gunter

- -- 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+                   PGP-verschlüsselte Mails bevorzugt!                 +
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- - "What is it that a man may call the greatest things in life?"
- - "Hot water, good dentishtry and shoft lavatory paper."
        -- Cohen the Barbarian (about 90 years old) in conversation with 
Discworld nomads           (Terry Pratchett, The Light Fantastic)
+-+-+-+-+-+-+-+-+-+-+-+-+ http://www.lspace.org +-+-+-+-+-+-+-+-+-+-+-+-+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+t/dr0ORHvREo8l8RApU5AJ0Zq0Ab69ZaVjjZHzCFSr2B4q7nhQCfVxmX
JTvz+KRxZId4uoVJ2NoXuns=
=tWjY
-----END PGP SIGNATURE-----



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] DSDT in initrd v0.2
       [not found]     ` <200305061957.00037-GfAVBl5OxjxchHfdsNF8vBvVK+yQ3ZXh@public.gmane.org>
@ 2003-05-07  9:44       ` Markus Gaugusch
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Gaugusch @ 2003-05-07  9:44 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On May 6, Gunter Ohrner <G.Ohrner-6V9naDJErT6662+jY7v6MhvVK+yQ3ZXh@public.gmane.org> wrote:
> This doesn't work for me. How can I troubleshoot the problem? I've never used
> an initrd before.
To summarize up, the problem was that he wrote the initrd into the append=
line of lilo.conf and not using initrd= ...

Markus
-- 
__________________    /"\
Markus Gaugusch       \ /    ASCII Ribbon Campaign
markus-z+rTbpWsRgbk7+2FdBfRIA@public.gmane.org     X     Against HTML Mail
                      / \


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [Patch] DSDT in initrd v0.2
       [not found] ` <A3C83F41488BD61195C3000802252FC135C3A8-SI4JNLCqwGbcq19Bq1crS1aTQe2KTcn/@public.gmane.org>
@ 2003-05-08 10:02   ` Markus Gaugusch
  2003-05-08 12:11     ` Derek Broughton
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Gaugusch @ 2003-05-08 10:02 UTC (permalink / raw)
  To: Breathnach, Proinnsias (Dublin)
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On May 8, Breathnach, Proinnsias (Dublin) <breatpro-Lp/cVzEoVybn/p8AFm7ortBPR1lH4CV8@public.gmane.org> wrote:
> Markus,
> 	As a suggestion, adding a file, defaulting to something like
> default.dsdt to the initrd would probably be a better method, allowing
> distribution vendors to ship known working dsdt's for many platforms (with
> currently buggy dsdt's ...) they could then customise grub / lilo at install
> time and add the acpi-dsdt=compaq-evo.dsdt to the kernel parameters ?
> Does any of this make sense ?
I think that the initrd only contains the most necessary things, e.g. not
dsdt's for 1000 different models, but only for the one PC that needs it.

I think that my approach is good enough for that and there is no need to
pass any additional parameters with file names. Either there is a DSDT in
the initrd or not.

The initrd is also usually rebuilt for each machine after installation,
containing only the required drivers for the current machine and nothing
more. Same with the DSDT, it would just be appended to the just-created
initrd.

Maybe some kernel hacker can tell me, if filesystem drivers are
available at the ACPI init time, but it would just make everything more
complicated and my approach is clean enough for my taste.

Markus

-- 
__________________    /"\
Markus Gaugusch       \ /    ASCII Ribbon Campaign
markus-z+rTbpWsRgbk7+2FdBfRIA@public.gmane.org     X     Against HTML Mail
                      / \


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [Patch] DSDT in initrd v0.2
@ 2003-05-08 10:11 Breathnach, Proinnsias (Dublin)
  0 siblings, 0 replies; 7+ messages in thread
From: Breathnach, Proinnsias (Dublin) @ 2003-05-08 10:11 UTC (permalink / raw)
  To: 'Markus Gaugusch'; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

> ----Original Message-----
> On May 8, Breathnach, Proinnsias (Dublin) <breatpro-Lp/cVzEoVybn/p8AFm7ortBPR1lH4CV8@public.gmane.org>
> wrote:
> > Markus,
> > Does any of this make sense ?
> I think that the initrd only contains the most necessary things, e.g. not
> dsdt's for 1000 different models, but only for the one PC that needs it.
> 
	<snip>

> The initrd is also usually rebuilt for each machine after installation,
> containing only the required drivers for the current machine and nothing
> more. Same with the DSDT, it would just be appended to the just-created
> initrd.
Both valid points ... I think that it's fair to say that if the machine is
going to have a DSDT appended, it'll be done at initrd re-generation time
...

P



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] DSDT in initrd v0.2
  2003-05-08 10:02   ` [Patch] DSDT in initrd v0.2 Markus Gaugusch
@ 2003-05-08 12:11     ` Derek Broughton
  0 siblings, 0 replies; 7+ messages in thread
From: Derek Broughton @ 2003-05-08 12:11 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

> I think that my approach is good enough for that and there is no need to
> pass any additional parameters with file names. Either there is a DSDT in
> the initrd or not.

It's an elegant, simple, solution.  Thanks Markus.


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] DSDT in initrd v0.2
       [not found] ` <Pine.LNX.4.53.0305061444120.1274-qopfHk9/S+VQK2oVCIMtW7NldLUNz+W/@public.gmane.org>
  2003-05-06 17:56   ` Gunter Ohrner
@ 2003-05-08 21:24   ` Pavel Machek
  1 sibling, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2003-05-08 21:24 UTC (permalink / raw)
  To: Markus Gaugusch; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi!

> * Fixed: don't scan beyond end of initrd
> * printk output fixed
> * Feature: Get DSDT from initrd without signature, if it starts with
>   "DSDT". This way one can just copy the DSDT.aml file and use it as
>   initrd
> 
> The patch is against 2.4.21-rc1+latest ACPI, please reverse the old patch
> if you used it.

Please inline patches.

Don't put ifdefs around #include's.
									Pavel

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-05-08 21:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <A3C83F41488BD61195C3000802252FC135C3A8@dubim07742.ie.ml.com>
     [not found] ` <A3C83F41488BD61195C3000802252FC135C3A8-SI4JNLCqwGbcq19Bq1crS1aTQe2KTcn/@public.gmane.org>
2003-05-08 10:02   ` [Patch] DSDT in initrd v0.2 Markus Gaugusch
2003-05-08 12:11     ` Derek Broughton
2003-05-08 10:11 Breathnach, Proinnsias (Dublin)
  -- strict thread matches above, loose matches on Subject: below --
2003-05-06 12:51 Markus Gaugusch
     [not found] ` <Pine.LNX.4.53.0305061444120.1274-qopfHk9/S+VQK2oVCIMtW7NldLUNz+W/@public.gmane.org>
2003-05-06 17:56   ` Gunter Ohrner
     [not found]     ` <200305061957.00037-GfAVBl5OxjxchHfdsNF8vBvVK+yQ3ZXh@public.gmane.org>
2003-05-07  9:44       ` Markus Gaugusch
2003-05-08 21:24   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox