Adding ACPI and DSDT to your 2.4.19 kernel
Perform the following as a user:
- Unpack the 2.4.19 kernel source and name the 2.4.19 directory
- mkdir /usr/src/unpack
- cd /usr/src/unpack
- cat /tmp/linux-2.4.19.tar.bz2 | bunzip2 | tar -xvf -
(http://www.kernel.org/pub/linux/kernel/v2.4/)
- mv linux-2.4.19 ../linux-2.4.19-acpi-dsdt
- cd ../linux-2.4.19-acpi-dsdt
- rmdir ../unpack
- Apply the ACPI patch (acpi-20020821-2.4.19.diff.gz)
- zcat /tmp/acpi-20020832-2.4.19.diff.gz | patch -p1
(http://sourceforge.net/project/showfiles.php?group_id=36832)
The results from patching should look very clean.
- If including your own DSDT table, then patch osl.c (so it will include your dsdt table)
- zcat /tmp/linux-2.4.18-acpi-20020709-dsdt.patch.bz2 | bunzip2 | patch -p1
(http://dude.noc.clara.net/~faye/compaq2701ea/linux-2.4.18-acpi-20020709-dsdt.patch.bz2)
This too should patch cleanly.
- If including your own DSDT table, then insert your fixed one now
- cp -a /tmp/dsdt.hex drivers/acpi/tables/acpi_dsdt.c
- Now build your kernel as normal (http://www.cpqlinux.com/kernel.html)
- edit the Makefile
Change "EXTRAVERSION = " (located at the top) to something like "EXTRAVERSION = -acpi-dsdt-20020905-1"
Increment this "EXTRAVERSION =" value each time you build a new kernel.
- grab a default Red Hat kernel "config" file
cp ../linux-2.4/configs/kernel-2.4.7-10 arch/i386/defconfig
- set up your new .config file
make mrproper
yes "" | make oldconfig
- make sure acpi is turned on as static and not built as a module. Might be a good idea to turn off APM unless you know what you're doing.
make xconfig
Also, if you ran make mrproper, then it is a good idea to save and exit "make xconfig", even if you are not making any changes in "make xconfig" -- "make mrproper" removes some links that "make xconfig" needs to put back for you.
- Now build your kernel and modules
make clean dep bzImage modules
- Now install your kernel and modules
As root user do the following in this same directory (/usr/src/linux-2.4.19-acpi-dsdt)
make modules_install
Look at the value you put in your Makefile and use that value for the following entries: "cat Makefile | grep ^EXTRAVERSION"
cp -a arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-acpi-dsdt-20020905-1
cp -a System.map /boot/System.map-2.4.19-acpi-dsdt-20020905-1
mkinitrd /boot/initrd-2.4.19-acpi-dsdt-20020905-1.img 2.4.19-acpi-dsdt-20020905-1
- Be sure to edit /boot/grub/grub.conf or /etc/lilo.conf; if using LILO, then you must run /sbin/lilo after modifying /etc/lilo.conf
See http://www.cpqlinux.com/kernel.html for more details.
Also, once you boot on your new kernel, if you use VMWARE or a LinModem or any other similar add on that depends on the kernel you are running, then go ahead and set them up right after you boot while you still have your kernel source directory (usually this requires root power as well):
yes "" | /usr/bin/vmware-config.pl
yes "" | /usr/sbin/hsfconfig
I would recommend doing a dmesg right after boot to get the fewest messages possible:
cd /tmp
dmesg > dmesg.txt
Then start looking for errors, failures, unknowns, warnings, etc. Also check in /proc/acpi for the various components of interest to you.
Oh, and battstat probably needs patching, search this current web page for the battstat patch.
battstat_applet
2.0.13 - http://sourceforge.net/projects/battstat/
08/16/2002 - battstat_applet-2.0.13.patch - patch to adjust to new /proc structure in current ACPI (08/2002) This applet doesn't show bat2 though, maybe I'll work on that next...
09/05/2002 - battstat_applet-2.0.13-patch.diff - adjusts to new /proc structure and displays "battery time remaining"
If running Red Hat you may also want to change the "prefix" entry in "Makefile" from /usr/local to /usr as suggested by the warning message that ./configure displays. This allowed battstat_applet to install directly into my gnome desktop without me having to move anything around.
Hang Recovery
Recovering from a GUI hard lock up:
If you get no feedback either from the keyboard or monitor, then to recover you should:
1. if your network is up, then ssh/rsh/telnet into your box and tell it to reboot
2. if network is not up, then try this key sequence: CTRL+ALT+F1 CTRL+ALT+DEL. You will not get any video or keyboard feedback but this _MAY_ blindly switch to tty1 (CTRL+ALT+F1) and press ing CTRL+ALT+DEL _MAY_ cause your system to do a polite reboot rather than a hard shutdown, then wait an appropriate amount of time that it usually takes to reboot your machine.
Definitions
.ASL - assembly source language (source code)
.AML - assembly machine language (binary code)
dsdt.dat - binary version of the dsdt table
iASL vs. MS Compiler
The iASL compiler will catch this problem (Access width of Field Unit extends beyond region limit) at compile time, as well as many, many others that the MS compiler does not.
Further, the iASL compiler will optimize the AML, shrinking the output anywhere from 5% to 20%.
Fixing your broken DSDT Table
Based on the error you get when trying to recompile your dsdt table (./iasl-linux-20020725/iasl -tc dsdt.asl), one of the following fixes should help you:
- Warning 2026 - Reserved method must return a value
>> dsdt.asl 134: Method(_WAK, 1) {
>> Warning 2026 - ^ Reserved method must return a value (_WAK)
You should probably add a "Return(Package(0x02){0x00, 0x00})" on a new
line just before the closing curly brace like so:
Method(_WAK, 1) {
... ... ...
Return(Package(0x02){0x00, 0x00})
}
More notes on this _WAK method suggest a different return line:
Currently, the acpi-ca under linux didn't check the return value of the _WAK
method, so that it is safe to ignore this warning. Anynow, if you want
to get ride of this warning, you should add:
Return(Package(0x02){0x00, 0x00})
at the end of the function. Not sure for the 0x00, 0x00, though.
Error 1022 - Object does not exist
>> dsdt.asl 281: If(\_OSI) {
>> Error 1022 - Object does not exist ^ (\_OSI)
You should probably look for any "Scope" lines and add the leading "\" there that is missing:
Change from:
Scope(_SB_) {
to:
Scope(\_SB_) {
Also ignore any "name" lines that do not have the leading slash. I do not believe that the name lines would have to be modified in this manner. I believe that it is written in such a way that the "\" among other stuff is prepended to the beginning of these "name" lines.
Error 1051 - Access width of Field Unit extends beyond region limit
>> dsdt.asl 848: SRST, 1,
>> Error 1051 - ^ Access width of Field Unit extends beyond region limit
You should increase the length of the parent operation region
Here's the problem
1) The length of the Op region is xA7 (0 - A6)
2) The access width of the field is DwordAcc (4 bytes per read or write)
3) Field PWST is at byte offset xA4. An aligned Dword read from that field reads bytes A4, A5, A6, and A7. Offset A7 is beyond the end of the region.
4) Similarly, Field PMST is at byte offset A5. An aligned Dword read from that field reads bytes A4, A5, A6, and A7 also.
Since the hardware probably only supports DWORD access, the probable bug in the code is that the op region is too short and should be declared with a length of 0xA8.
NOTE: -- the AML interpreter cannot guess at this, it could be very serious to access beyond the end of the region. This is a severe error that is not caught by the MS compiler, but is caught by the iASL compiler.
More info on this error as well:
This is a 'common' error in the AML of a lot of laptop, since the implementation
under windows 98/2000 didn't check actually the lenght of the operation region.
Note that under windows XP, this behaviour is now corrected (I guess) so that
it can also be a trouble with this OS as well...
It is sufficiant increase a little the lenght of the OP (only add 1), and all
should be OK. For example, under a toshiba satellite 3000-514, we have that:
OperationRegion(GPIO,SystemIo,0x1180,0x3B)
Field(GPIO /* \_SB.PCI0.LPCB.GPIO */,WordAcc,Lock,Preserve)
{
AccessAs(DWordAcc,0x00),
Offset(0x0F),
,4,
LV28,1,
Offset(0x2D),
,5,
LPOL,1,
Offset(0x38),
,1,
SRST,1,
Offset(0x39),
,2,
ACPW,1
}
so that the ACPW, which is located at bit 3 at 0x39 as a word is not acceded.
The correct line for the OP should be:
OperationRegion(GPIO,SystemIo,0x1180,0x3C)
or another fix could be:
Offset(0x38),
,1,
SRST,1,
,9,
ACPW,1
and let the lenght could be 0x3B (but, anynow, a length '0x3B', that is
59, for an OP acceded by words, is a non-sense.
This simple bug prevented the read of the batteries, and the ac adapter will
not be read as expected. Note that under Windows 98/2000, it work well, but
the same trouble appar under XP...
http://www.mobilix.org/toshiba_s3000_601.html
for a model really similar of the one I describe have the same trouble, and
it was stated:
<quote>
APM / ACPI
well, apm does not work properly. no reliable info is available, although powering the machine off and power saving seems to work. did not try very much here, since acpi _should_ be superior.
acpi does not work properly either. does it anywhere? the info given for instance in /proc/acpi/battery/1/status seems to be static and seems to break when switching between power supply by battery and line. this could also be a problem with the hardware. the acpi software for winXP crashes, too, when fiddling around with the power cord to switch between ac/dc and battery.
</quote>
Reporting this bug, and the correction, to Toshiba did absolutely _nothing_,
even not a reply.
Error 1022 - Object does not exist
>> dsdt.asl 281: If(\_OSI) {
>> Error 1022 - Object does not exist ^ (\_OSI)
Add "External (\_OSI)". The next version of the compiler understands that
_OSI is a reserved method name and the External won't be required.
Error 1048 - Host Operating Region requires ByteAcc access
dsdt.asl 2256: Field(ERAM, AnyAcc, Lock, Preserve) {
Error 1048 - ^ Host Operation Region requires
ByteAcc access
Any operation region in EC space must use ByteAcc, change the region
declaration
Error 1013 - Method local variable is not initialized (Local0)
Intel ACPI Component Architecture
ASL Compiler / AML Disassembler version 20020725 [Jul 25 2002]
Copyright (C) 2000 - 2002 Intel Corporation
Supports ACPI Specification Revision 2.0a
/tmp/acpi/dsdt.asl 257: Store(Local0, Debug)
Error 1013 - ^ Method local
variable is not initialized (Local0)
/tmp/acpi/dsdt.asl 258: If(LGreater(Local0, 0x56)) {
Error 1013 - Method local variable is not initialized ^ (Local0)
ASL Input: /tmp/acpi/dsdt.asl - 2357 lines, 84721 bytes, 1702 keywords
Compilation complete. 2 Errors 0 Warnings
The offending section is here:
Method(_TMP) {
If(\_SB_.OKEC) {
If(LEqual(INBT, 0x0)) {
Store(0x1, INBT)
\_SB_.BAT1.SEBI()
Notify(\_SB_.ACAD, 0x0)
Notify(\_SB_.BAT1, 0x81)
Notify(\_SB_.BAT1, 0x80)
}
Return(TPTM)
Store("Current Temperature C is ----------- ", Debug)
Store(Local0, Debug)
If(LGreater(Local0, 0x56)) {
Store(0x56, Local0)
}
Store(Local0, Local2)
Multiply(Local0, 0xa, Local1)
Add(Local1, TBSE, Local0)
Store("Current Temperature K is ----------- ", Debug)
Store(Local0, Debug)
CHTR(Local2)
Return(Local0)
}
Else {
Return(TPTM)
}
}
Values are taken from the left and then stored in the right on "Store" operations. So the value of Local0 should be placed into the variable "Debug". The problem is that Local0 is never initialized. However, looking again at this code we see a "Return(TPTM)" just before this offending section. This offending section never even has a chance to run so we should comment out this section so that the errors will go away. So the above should be written as follows
Method(_TMP) {
If(\_SB_.OKEC) {
If(LEqual(INBT, 0x0)) {
Store(0x1, INBT)
\_SB_.BAT1.SEBI()
Notify(\_SB_.ACAD, 0x0)
Notify(\_SB_.BAT1, 0x81)
Notify(\_SB_.BAT1, 0x80)
}
Return(TPTM)
/*
Store("Current Temperature C is ----------- ", Debug)
Store(Local0, Debug)
If(LGreater(Local0, 0x56)) {
Store(0x56, Local0)
}
Store(Local0, Local2)
Multiply(Local0, 0xa, Local1)
Add(Local1, TBSE, Local0)
Store("Current Temperature K is ----------- ", Debug)
Store(Local0, Debug)
CHTR(Local2)
Return(Local0)
*/
}
Else {
Return(TPTM)
}
}
The errors from this unused section will then go away.