Howto override your buggy ECDT table for the IBM Thinkpad under Linux

If you have a recent linux kernel with a recent patch from http://www.sourceforge.net/projects/acpi/ for your IBM Thinkpad, you should have already noticed that it does'nt work as expected.

This is due to a bug in the firmware in their BIOS.

Even though IBM will release in the near future a BIOS upgrade in order to correct the bug in their ACPI ECDT table, you will want to use your laptop with the newest ACPI patch from sourceforge. Here is then a workaround in order to get it.

It sound like that IBM have released now newer BIOS which may fixed the ECDT bug.
You should look at their site before proceeding.

1- get pmtools from Intel site.

It is located at http://developer.intel.com/technology/iapc/acpi/downloads.htm at the end.

2- get over_ecdt_thinkpad.tar.bz2 from Poupinou site.

ftp://ftp.poupinou.org/acpi/over_ecdt_thinkpad.tar.bz2

3- Generate a corrected ECDT table

say you have pmtools-20010730.tar.gz and over_ecdt_thinkpad.tar.bz2 in the same directory (for example ~/tmp/).

First, unpack pmtools-20010730.tar.gz, go to the pmtools-20010730 created, then type make:

me@thinkpad:~/tmp$ tar xzvfp pmtools-20010730.tar.gz 
...
...
me@thinkpad:~/tmp$ cd pmtools-20010730
me@thinkpad:~/tmp/pmtools-20010730$ make
...
...
me@thinkpad:~/tmp/pmtools-20010730$ 
You now have in the directory ~/tmp/pmtools-20010730/acpidmp/ an executable called acpidmp that you can use in order to retrieve the ECDT ACPI table of your Thinkpad.

Next, go to ~/tmp

then unpack over_ecdt_thinkpad.tar.bz2. That will create over_ecdt_thinkpad.
me@thinkpad:~/tmp/pmtools-20010730$ cd ~/tmp
me@thinkpad:~/tmp$ bzcat over_ecdt_thinkpad.tar.bz2 | tar xvfp -
over_ecdt_thinkpad/
over_ecdt_thinkpad/over-ecdt-20030109.patch
over_ecdt_thinkpad/verify_ecdt.c
over_ecdt_thinkpad/over-ecdt-20020726.patch

Now compile over_ecdt_thinkpad/verify_ecdt.c

me@thinkpad:~/tmp$ cc over_ecdt_thinkpad/verify_ecdt.c -o verify_ecdt

You now have the two executables in order to generate an header file which will contain a corrected ECDT table.

As root, do something like that:
me@thinkpad:~/tmp$ su
Password: 
thinkpad:/home/me/tmp# ./pmtools-20010730/acpidmp/acpidmp ECDT | ./verify_ecdt > ecdt_table.h
thinkpad:/home/me/tmp# exit
me@thinkpad:~/tmp
Verify that ecdt_table.h contains at the end something like that:
unsigned char ecdt_table[]= {
0x45, 0x43, 0x44, 0x54, 0x52, 0x00, 0x00, 0x00, 0x01, 0x10, 0x49, 0x42, 0x4d, 0x20, 0x20, 0x20,
        0x54, 0x50, 0x2d, 0x31, 0x47, 0x20, 0x20, 0x20, 0x50, 0x10, 0x00, 0x00, 0x49, 0x42, 0x4d, 0x20,
        0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x01, 0x08, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x1c, 0x5c, 0x5f, 0x53, 0x42, 0x2e, 0x50, 0x43, 0x49, 0x30, 0x2e, 0x4c, 0x50, 0x43, 0x2e, 0x45,
        0x43, 0x00, 
};
if not, then this procedure has failed. You may already have a Thinkpad with a corrected ECDT table, or you don't have a thinkpad, or ?

4- patch, copy the generated ecdt_table.h, and then compile your kernel

Copy the generated ecdt_table.h in /path/to/linux/drivers/acpi/include/ for acpi older than 20030122, or in /path/to/linux/include/acpi/ for acpi equal or newer than 20030122.
then patch your your kernel. It depend of the version of the APCI patch you have used. type:

me@thinkpad:~/path/to/linux/$ patch -p1 -i ~/tmp/over_ecdt_thinkpad/over-ecdt-20030109.patch
if you have a patched kernel with acpi patch 20030109 or newer.

type:
me@thinkpad:~/path/to/linux/$ patch -p1 -i ~/tmp/over_ecdt_thinkpad/over-ecdt-20020726.patch
if you have a patched kernel with acpi patch from 20020726 to 20021212.

You can now compile and install your kernel as usual.