Skip to contentSkip to conversation

Overriding DSDT Tables with external files - 2 Methods

PATCH John M Trostel 2 participants 3 messages Sep 5, 2002 – Sep 6, 2002 2 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

There seem to be 2 closely related methods of overriding the DSDT in a BIOS with your own files.

My question is... Do they both work? If they do both work, is one prefered over the other?

***********************************
Method 1 (from http://www.cpqlinux.com/acpi-howto.html and others)

1. get the dsdt.hex file

2. cp -a dsdt.hex to drivers/acpi/tables/acpi_dsdt.c

3. apply the following patch

drivers/acpi/osl.c Sat Jul 13 14:33:09 2002 renamed from drivers/acpi/osl.c Sat Jul 13 16:16:25 2002 +5 -1
@@ -70,6 +70,7 @@
 static OSD_HANDLER acpi_irq_handler = NULL;
 static void *acpi_irq_context = NULL;
 
+extern unsigned char AmlCode[];
 
 acpi_status
 acpi_os_initialize(void)
@@ -221,7 +222,10 @@
        if (!existing_table || !new_table)
                return AE_BAD_PARAMETER;
 
-       *new_table = NULL;
+       if (strncmp(existing_table->signature, "DSDT", 4) == 0)
+               *new_table = (acpi_table_header*)AmlCode;
+       else
+               *new_table = NULL;
        return AE_OK;
 }
 

***********************************
Method 2 (from Christophe Boyanique) :

1. get the dsdt.hex file

2. copy that file into drivers/acpi

3. patch drivers/acpi/osl.c as follows:

diff -urP drivers/acpi/osl.c /usr/src/linux/drivers/acpi/osl.c
--- drivers/acpi/osl.c Mon Jul 29 23:30:42 2002
+++ /usr/src/linux/drivers/acpi/osl.c Sat Jul 27 18:32:34 2002
@@ -71,6 +71,9 @@
static void *acpi_irq_context = NULL;

+#include "dsdt.hex"
+acpi_table_header *myDST = (acpi_table_header *) AmlCode; +
acpi_status
acpi_os_initialize(void)
{
@@ -221,7 +224,10 @@

         if (!existing_table || !new_table)
                 return AE_BAD_PARAMETER;

- *new_table = NULL;
+ if (!strncmp(existing_table->signature, DSDT_SIG, 4))
+ *new_table = myDST;
+ else

 +               *new_table = NULL;
         return AE_OK;

}

Signature · 11 lines
John M. Trostel
Senior Software Engineer
Quantum Corp.
[email protected]



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
#2 lore raw
In reply to a message not in the archive

I prefer the method 1 because with gcc of RedHat doesn't include .hex files

Quoted 64 lines · John M Trostel

There seem to be 2 closely related methods of overriding the DSDT in a BIOS with your own files.

My question is... Do they both work? If they do both work, is one prefered over the other?

***********************************
Method 1 (from http://www.cpqlinux.com/acpi-howto.html and others)

1. get the dsdt.hex file

2. cp -a dsdt.hex to drivers/acpi/tables/acpi_dsdt.c

3. apply the following patch

drivers/acpi/osl.c Sat Jul 13 14:33:09 2002 renamed from drivers/acpi/osl.c Sat Jul 13 16:16:25 2002 +5 -1
@@ -70,6 +70,7 @@
 static OSD_HANDLER acpi_irq_handler = NULL;
 static void *acpi_irq_context = NULL;
 
+extern unsigned char AmlCode[];
 
 acpi_status
 acpi_os_initialize(void)
@@ -221,7 +222,10 @@
        if (!existing_table || !new_table)
                return AE_BAD_PARAMETER;
 
-       *new_table = NULL;
+       if (strncmp(existing_table->signature, "DSDT", 4) == 0)
+               *new_table = (acpi_table_header*)AmlCode;
+       else
+               *new_table = NULL;
        return AE_OK;
 }
 

***********************************
Method 2 (from Christophe Boyanique) :

1. get the dsdt.hex file

2. copy that file into drivers/acpi

3. patch drivers/acpi/osl.c as follows:

diff -urP drivers/acpi/osl.c /usr/src/linux/drivers/acpi/osl.c
--- drivers/acpi/osl.c Mon Jul 29 23:30:42 2002
+++ /usr/src/linux/drivers/acpi/osl.c Sat Jul 27 18:32:34 2002
@@ -71,6 +71,9 @@
static void *acpi_irq_context = NULL;

+#include "dsdt.hex"
+acpi_table_header *myDST = (acpi_table_header *) AmlCode; +
acpi_status
acpi_os_initialize(void)
{
@@ -221,7 +224,10 @@

         if (!existing_table || !new_table)
                 return AE_BAD_PARAMETER;
Quoted 15 lines

- *new_table = NULL;
+ if (!strncmp(existing_table->signature, DSDT_SIG, 4))
+ *new_table = myDST;
+ else

 +               *new_table = NULL;
         return AE_OK;

}

Signature · 4 lines
John M. Trostel
Senior Software Engineer
Quantum Corp.
[email protected]

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

#4 lore raw
In reply to a message not in the archive

And method #1 was the one I ended up using. And it works :-)

Thanks to all who made suggestions, I appreciate the help.

Quoted 42 lines · Sérgio Monteiro Basto

I prefer the method 1 because with gcc of RedHat doesn't include .hex files

Quoted 38 lines · John M Trostel

There seem to be 2 closely related methods of overriding the DSDT in a BIOS with your own files.

My question is... Do they both work? If they do both work, is one prefered over the other?

***********************************
Method 1 (from http://www.cpqlinux.com/acpi-howto.html and others)

1. get the dsdt.hex file

2. cp -a dsdt.hex to drivers/acpi/tables/acpi_dsdt.c

3. apply the following patch

drivers/acpi/osl.c Sat Jul 13 14:33:09 2002 renamed from drivers/acpi/osl.c Sat Jul 13 16:16:25 2002 +5 -1
@@ -70,6 +70,7 @@
 static OSD_HANDLER acpi_irq_handler = NULL;
 static void *acpi_irq_context = NULL;
 
+extern unsigned char AmlCode[];
 
 acpi_status
 acpi_os_initialize(void)
@@ -221,7 +222,10 @@
        if (!existing_table || !new_table)
                return AE_BAD_PARAMETER;
 
-       *new_table = NULL;
+       if (strncmp(existing_table->signature, "DSDT", 4) == 0)
+               *new_table = (acpi_table_header*)AmlCode;
+       else
+               *new_table = NULL;
        return AE_OK;
 }
 
Signature · 11 lines
John M. Trostel
Senior Software Engineer
Quantum Corp.
[email protected]



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390