<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- /dev/null	2004-11-18 01:04:18.509511472 +0100
+++ linux-2.6.9/Documentation/dsdt-initrd.txt	2004-11-20 11:37:34.856629896 +0100
@@ -0,0 +1,48 @@
+ACPI Custom DSDT read from initrd
+
+2003 by Markuss Gaugusch &lt; dsdt at gaugusch dot org &gt;
+Special thanks go to Thomas Renninger from SuSE, who updated the patch for 2.6.0
+2004 maintained by Eric Piel &lt; eric dot piel at tremplin-utc dot net &gt;
+
+This option is intended for people who 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 ramdisk (not as module!) and initrd
+(in Block Devices) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
+options (General Setup|ACPI Support|Read custom DSDT from initrd).
+
+A custom DSDT (Differentiated System Description Table) is useful when your
+computer uses ACPI but problems occurs 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 . 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 initrd so that the
+kernel can read the table at the very beginning of the boot. If you don't have
+any initrd yet, you can just specify the table as an initrd file (in lilo or
+grub) and it will work. Otherwise you have to separate the DSDT from the rest
+by a signature. Do it like it:
+echo -n "INITRDDSDT123DSDT123" &gt;&gt; /boot/initrd #magic signature
+cat DSDT.aml &gt;&gt; /boot/initrd
+
+The message "Looking for DSDT in initrd..." will tell you if the DSDT was
+found or not. If you need to update your DSDT, generate a new initrd and
+perform the steps above.
+
+
--- linux-2.6.9.orig/drivers/acpi/osl.c	2004-10-18 23:54:55.000000000 +0200
+++ linux-2.6.9/drivers/acpi/osl.c	2004-11-20 11:14:22.000000000 +0100
@@ -34,6 +34,7 @@
 #include &lt;linux/interrupt.h&gt;
 #include &lt;linux/kmod.h&gt;
 #include &lt;linux/delay.h&gt;
+#include &lt;linux/initrd.h&gt;
 #include &lt;linux/workqueue.h&gt;
 #include &lt;linux/nmi.h&gt;
 #include &lt;acpi/acpi.h&gt;
@@ -237,6 +238,43 @@ acpi_os_predefined_override (const struc
 	return AE_OK;
 }
 
+#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
+struct acpi_table_header * acpi_find_dsdt_initrd(void)
+{
+	unsigned char start_signature[] = "INITRDDSDT123DSDT123";
+	unsigned char *data = (unsigned char*)initrd_start;
+	unsigned char *dsdt_start = NULL;
+
+	if (!initrd_start)
+		return NULL;
+
+	printk(KERN_INFO PREFIX "Looking for DSDT in initrd...");
+	if ((initrd_end - initrd_start) &gt; 4 &amp;&amp; 
+		!strncmp((unsigned char*)initrd_start, "DSDT", 4))
+		/* found DSDT at start of initrd */
+		dsdt_start = (unsigned char*)initrd_start; 
+	else { /* searching for start signature in initrd */
+		for (; data &lt; (unsigned char*)initrd_end; data++) {
+			if (!strncmp(data, start_signature,
+					   sizeof(start_signature) - 1)) {
+				dsdt_start = data + sizeof(start_signature) - 1;
+				break;
+			}
+		}
+	}
+	/* check if head of dsdt is valid */
+	if (dsdt_start &amp;&amp; !strncmp(dsdt_start, "DSDT", 4)) {
+		printk(" found (at offset 0x%02x).\n", 
+			(unsigned int) (dsdt_start - (unsigned char*)initrd_start));
+		return (struct acpi_table_header*)dsdt_start;
+	} else
+		printk(" not found.\n");
+	
+	/* no DSDT found */
+	return NULL;
+}
+#endif
+
 acpi_status
 acpi_os_table_override (struct acpi_table_header *existing_table,
 			struct acpi_table_header **new_table)
@@ -244,13 +282,18 @@ acpi_os_table_override (struct acpi_tabl
 	if (!existing_table || !new_table)
 		return AE_BAD_PARAMETER;
 
+	*new_table = NULL;
+
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
 	if (strncmp(existing_table-&gt;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-&gt;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;
 }
--- linux-2.6.9.orig/drivers/acpi/Kconfig	2004-10-18 23:55:29.000000000 +0200
+++ linux-2.6.9/drivers/acpi/Kconfig	2004-11-09 23:38:28.000000000 +0100
@@ -219,6 +219,23 @@ config ACPI_CUSTOM_DSDT_FILE
 	help
 	  Enter the full path name to the file wich includes the AmlCode declaration.
 
+config ACPI_CUSTOM_DSDT_INITRD
+	bool "Read Custom DSDT from initrd"
+	depends on X86
+	depends on ACPI_INTERPRETER
+	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 you want to use
+	  a customized DSDT, please use the mkinitrd tool (mkinitrd package) to
+	  attach the DSDT to the initrd. For more details see
+	  file:Documentation/dsdt-initrd.txt . If there is no table found in the
+	  initrd, the DSDT from the BIOS is used.
+
+	  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"
 	default 0
</pre></body></html>