Difference between revisions of "DSDT"

From ArchWiki
Jump to: navigation, search
(Step three: Test your new image: Last triage before rewriting)
Line 3: Line 3:
 
[[Category:Power management]]
 
[[Category:Power management]]
 
{{Poor writing}}
 
{{Poor writing}}
{{Out of date}}
 
 
DSDT (Differentiated System Description Table) is a part of the [[Wikipedia:ACPI|ACPI]] specification and it supplies configuration information about a base system. ACPI capable computers come with a DSDT in firmware from the manufacturer. A common Linux problem is missing ACPI functionality (fans not running, screens not turning off when the lid is closed, etc.) stemming from DSDTs made with Windows specifically in mind. The solution that this article will try to detail is replacing the default DSDT with a 'fixed' version. Note that this fix can also be accomplished during installation ("Will you need support for custom DSDT?") but requires you to have a custom DSDT ready at hand.
 
DSDT (Differentiated System Description Table) is a part of the [[Wikipedia:ACPI|ACPI]] specification and it supplies configuration information about a base system. ACPI capable computers come with a DSDT in firmware from the manufacturer. A common Linux problem is missing ACPI functionality (fans not running, screens not turning off when the lid is closed, etc.) stemming from DSDTs made with Windows specifically in mind. The solution that this article will try to detail is replacing the default DSDT with a 'fixed' version. Note that this fix can also be accomplished during installation ("Will you need support for custom DSDT?") but requires you to have a custom DSDT ready at hand.
  
{{Note|It is possible that your hardware manufacture has released updated firmware which fixes ACPI related problems.  Installing an updated firmware is often perfected over this method because it can fix the problem without needing to apply a separate fix for each operating system installed.}}
+
{{Note|It is possible that your hardware manufacture has released updated firmware which fixes ACPI related problems.  Installing an updated firmware is often preferred over this method because it can fix the problem without needing to apply a separate fix for each operating system installed.}}
  
 
{{Note|The goal of the [http://www.lesswatts.org/projects/acpi/ Linux ACPI] project is that Linux should work on unmodified firmware.  If you still find this type of workaround necessary on modern kernels then you should consider [[Reporting Bug Guidelines|submiting a bug report]]. }}
 
{{Note|The goal of the [http://www.lesswatts.org/projects/acpi/ Linux ACPI] project is that Linux should work on unmodified firmware.  If you still find this type of workaround necessary on modern kernels then you should consider [[Reporting Bug Guidelines|submiting a bug report]]. }}
  
==Replacing the DSDT==
+
==Before you start...==
  
==="Lions and tigers and bears, oh my!"===
+
This process does tamper with some fairly fundamental code on your installation. You will want to be absolutely sure of the changes you make. You might also wish to [[Disk cloning | clone your disk]] beforehand.
This fix does tamper with some fairly fundamental code on your installation. You will want to be absolutely sure of the changes you make. You might also wish to [[Disk cloning | clone your disk]] beforehand.
+
  
=== Step zero ===
+
Even before attempting to fix your DSDT yourself, you can attempt a couple different venues of attack:  
Even before attempting to fix your DSDT, you can attempt a simple trick: tell the kernel to report a Windows system to the ACPI subsystem to work around test made inside the DSDT that check for a Windows system and else use some broken code and/or parameter.
+
  
 +
===Alternative #1:===
 +
Tell the kernel to report a version of Windows.
 
The trick is to use the variable '''acpi_os_name''' as kernel parameter. For example:
 
The trick is to use the variable '''acpi_os_name''' as kernel parameter. For example:
  
 
   acpi_os_name="Microsoft Windows NT"
 
   acpi_os_name="Microsoft Windows NT"
in the kernel line in grub configuration
+
in the kernel line in grub legacy configuration
  
 
other strings to test for:
 
other strings to test for:
Line 30: Line 29:
 
* "Windows 2001"
 
* "Windows 2001"
 
* "Windows 2006"
 
* "Windows 2006"
* and out of desperation, you can even try "Linux"
+
* when all that fails, you can even try "Linux"
  
 
If that does not work, you can follow the steps below not to recompile or fix your DSDT but just to find out what test is made on the OS inside it and find the string to use as acpi_os_name. Just search for "Microsoft" string in the decompiled DSDT and look at the test made.
 
If that does not work, you can follow the steps below not to recompile or fix your DSDT but just to find out what test is made on the OS inside it and find the string to use as acpi_os_name. Just search for "Microsoft" string in the decompiled DSDT and look at the test made.
  
===Step one: Get hold of fixed DSDT===
+
===Alternative #2:===
A DSDT file is originally written in ACPI Source language (an .asl/.dsl file). Using a compiler this can produce an 'ACPI Machine Language' file (.aml) or a hex table (.hex). To incorporate the file in your Arch install, you'll need to get hold of a compiled .aml file. - whether this means compiling it yourself or trusting some guy on the Internet is up to you.
+
Get hold of fixed DSDT.
==== "Compiling it yourself" ====
+
A DSDT file is originally written in ACPI Source language (an .asl/.dsl file). Using a compiler this can produce an 'ACPI Machine Language' file (.aml) or a hex table (.hex). To incorporate the file in your Arch install, you'll need to get hold of a compiled .aml file. - whether this means compiling it yourself or trusting some stranger on the Internet is at your discretion. If you do download a file from the world wide web, it'll most likely be a compressed .asl file, so you'll need to unzip it and compile it. You should really read the Gentoo wiki for that but the upshot is that you won't have to research specific code fixes yourself.
In short, you can use Intel's ASL compiler (in the repos) to turn your systems DSDT table (residing in /sys/firmware/acpi/tables/DSDT) into source code, locate and fix the errors (the compiled files will typically have been made using Microsoft's compiler rather than Intel's more stringent one... need we say more?), and recompile. This process is detailed far more comprehensively at the [http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems Gentoo wiki].
+
  
First check if your system's DSDT was compiled using Intel or Microsoft compiler:
+
* Arch users with the same laptop as you: are a minority of a minority of a minority. Try browsing other distro/linux forums for talk about the same model. Likelihood is that they have the same problems and either because there is a lot of them, or because they're tech wizards -- someone there has produced a working DSDT and maybe even provides a precompiled version (again, use at your own risk).
<pre> ~ [23:03:39] > dmesg|grep DSDT
+
ACPI: DSDT 00000000bf7e5000 0A35F (v02 Intel  CALPELLA 06040000 INTL 20060912)
+
ACPI: EC: Look up EC in DSDT
+
</pre>
+
In case Microsoft's compiler had been used, words INTL would instead be MSFT.
+
I still got 5 errors on decompiling/recompiling the DSDT. 2 were easy to fix after a bit of googling and delving into the ACPI specification. 3 of them were due to different versions of compiler used and are, as I found out later, handled by the ACPICA at boot-time. The ACPICA component of the kernel can handle most of the trivial errors you get while compiling the DSDT. So do not fret yourself over compile errors if your system if working the way it should.
+
 
+
==== "Some guy on the internet" ====
+
* <s>There is a database of sorts of user produced fixes on sourceforge: http://acpi.sourceforge.net/dsdt/. Sadly, this is not very well maintained and more than half the entries are just weird noise spam.</s> If you do download a file from there, it'll most likely be a compressed .asl file, so you'll need to unzip it and compile it. You should really read the Gentoo wiki for that but the upshot is: get iasl from the community repo, unzip the file into a directory of its own and run
+
<pre>iasl -tc ''.asl/.dsl file''</pre>
+
on it and if it says no errors and no warnings you should be good to go.
+
* Arch users with the same laptop as you are a minority of a minority of a minority. Try browsing other distro/linux forums for talk about the same model. Likelihood is that they have the same problems and either because there is a lot of them (Ubuntu) or because they're tech wizards (Gentoo?) someone there has produced a working DSDT and maybe even provides a precompiled version (again, use at your own risk).
+
 
* Google Is Your Friend: Try keeping it sweet and short - model name and dsdt will probably produce results.
 
* Google Is Your Friend: Try keeping it sweet and short - model name and dsdt will probably produce results.
  
Remember, regardless of how you get a file, you'll need a compiled ACPI Machine Language file for the next step.
+
== Recompiling it yourself ==
  
===<s>Step Two: Get the file loaded at startup</s>===
+
Your best resources in this endeavor are going to be [http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems  The Gentoo wiki article], [http://www.acpi.info ACPI Spec homepage], and [http://www.lesswatts.org/projects/acpi/ Linux ACPI Project] which supercedes the activity that occurred at ''acpi.sourceforge.net''.
<s>mkinitcpio provides a hook to use a custom dsdt table.</s> mkinitcpio no longer provides this hook, and this section is slated for removal. See the preceeding Gentoo link for alternative (albeit also outdated) instructions.
+
  
==== <s>Creating a new boot image ====
+
In a nutshell, you can use Intel's ASL compiler to turn your systems DSDT table into source code, locate and fix the errors (the compiled files will typically have been made using Microsoft's compiler rather than Intel's more stringent one... need we say more?), and recompile. This process is detailed more comprehensively at the [http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems Gentoo wiki].
* Cp your compiled file to /lib/initcpio/custom.dsdt
+
* Add 'dsdt' to the end of HOOKs array in /etc/mkinitcpio.conf
+
* Run mkinitcpio as root.
+
# mkinitcpio -p linux
+
will create both the standard and the fallback image. If you're feeling less adventurous, you might wish to first try
+
# mkinitcpio -g /boot/initramfs-linux.img
+
which will only create the standard image, so you can... well fall back on the other one in case things do not work out. If/when they do work out, you can always run the command with the -p option after the first test.</s>
+
  
=== <s>Step three: Test your new image ===
+
===Who compiled the original code?===
If mkinitcpio succesfully created an image, you should be ready to reboot now. If things go well, you'll boot into your ordinary Arch setup, the only difference being a properly working fan, lid, whatever misbehaved. If they do not
+
Check if your system's DSDT was compiled using Intel or Microsoft compiler:
* Make a note of the error messages
+
<pre> $ dmesg|grep DSDT
* Restart
+
ACPI: DSDT 00000000bf7e5000 0A35F (v02 Intel  CALPELLA 06040000 INTL 20060912)
* Choose the fallback image option from GRUB (assuming you didn't overwrites that one too)
+
ACPI: EC: Look up EC in DSDT
 +
</pre>
 +
In case Microsoft's compiler had been used, words INTL would instead be MSFT.
 +
In the example, there were 5 errors on decompiling/recompiling the DSDT. Two of them were easy to fix after a bit of googling and delving into the ACPI specification. Three of them were due to different versions of compiler used and are, as later discovered, handled by the ACPICA at boot-time. The ACPICA component of the kernel can handle most of the trivial errors you get while compiling the DSDT. So do not fret yourself over compile errors if your system is working the way it should.
  
====Recovery from a bad image====
+
===Extracting ACPI tables===
Remove the dsdt hook from /etc/mkinitcpio.conf, delete the custom.dsdt file and use mkinitcpio to create the images again:
+
(in progress)
# mkinitcpio -p linux </s>
+
===Examination===
  
If you want to persist, try one of the following:
+
* Read the other wiki articles (really) and try again.
+
* Try forums (again)
+
* Read/edit wiki
+
* Leave distro in anger, vow revenge
+
  
== External Links ==
+
<pre>iasl -tc ''.asl/.dsl file''</pre>
* [http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems  The Gentoo wiki article]
+
 
* [http://acpi.sourceforge.net/dsdt/index.php The sourceforge database]
+
on it and if it says no errors and no warnings you should be good to go.

Revision as of 08:57, 8 July 2012

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:DSDT#)

DSDT (Differentiated System Description Table) is a part of the ACPI specification and it supplies configuration information about a base system. ACPI capable computers come with a DSDT in firmware from the manufacturer. A common Linux problem is missing ACPI functionality (fans not running, screens not turning off when the lid is closed, etc.) stemming from DSDTs made with Windows specifically in mind. The solution that this article will try to detail is replacing the default DSDT with a 'fixed' version. Note that this fix can also be accomplished during installation ("Will you need support for custom DSDT?") but requires you to have a custom DSDT ready at hand.

Note: It is possible that your hardware manufacture has released updated firmware which fixes ACPI related problems. Installing an updated firmware is often preferred over this method because it can fix the problem without needing to apply a separate fix for each operating system installed.
Note: The goal of the Linux ACPI project is that Linux should work on unmodified firmware. If you still find this type of workaround necessary on modern kernels then you should consider submiting a bug report.

Before you start...

This process does tamper with some fairly fundamental code on your installation. You will want to be absolutely sure of the changes you make. You might also wish to clone your disk beforehand.

Even before attempting to fix your DSDT yourself, you can attempt a couple different venues of attack:

Alternative #1:

Tell the kernel to report a version of Windows. The trick is to use the variable acpi_os_name as kernel parameter. For example:

 acpi_os_name="Microsoft Windows NT"

in the kernel line in grub legacy configuration

other strings to test for:

  • "Microsoft Windows XP"
  • "Microsoft Windows 2000"
  • "Microsoft Windows 2000.1"
  • "Microsoft Windows ME: Millennium Edition"
  • "Windows 2001"
  • "Windows 2006"
  • when all that fails, you can even try "Linux"

If that does not work, you can follow the steps below not to recompile or fix your DSDT but just to find out what test is made on the OS inside it and find the string to use as acpi_os_name. Just search for "Microsoft" string in the decompiled DSDT and look at the test made.

Alternative #2:

Get hold of fixed DSDT. A DSDT file is originally written in ACPI Source language (an .asl/.dsl file). Using a compiler this can produce an 'ACPI Machine Language' file (.aml) or a hex table (.hex). To incorporate the file in your Arch install, you'll need to get hold of a compiled .aml file. - whether this means compiling it yourself or trusting some stranger on the Internet is at your discretion. If you do download a file from the world wide web, it'll most likely be a compressed .asl file, so you'll need to unzip it and compile it. You should really read the Gentoo wiki for that but the upshot is that you won't have to research specific code fixes yourself.

  • Arch users with the same laptop as you: are a minority of a minority of a minority. Try browsing other distro/linux forums for talk about the same model. Likelihood is that they have the same problems and either because there is a lot of them, or because they're tech wizards -- someone there has produced a working DSDT and maybe even provides a precompiled version (again, use at your own risk).
  • Google Is Your Friend: Try keeping it sweet and short - model name and dsdt will probably produce results.

Recompiling it yourself

Your best resources in this endeavor are going to be The Gentoo wiki article, ACPI Spec homepage, and Linux ACPI Project which supercedes the activity that occurred at acpi.sourceforge.net.

In a nutshell, you can use Intel's ASL compiler to turn your systems DSDT table into source code, locate and fix the errors (the compiled files will typically have been made using Microsoft's compiler rather than Intel's more stringent one... need we say more?), and recompile. This process is detailed more comprehensively at the Gentoo wiki.

Who compiled the original code?

Check if your system's DSDT was compiled using Intel or Microsoft compiler:

 $ dmesg|grep DSDT
ACPI: DSDT 00000000bf7e5000 0A35F (v02 Intel  CALPELLA 06040000 INTL 20060912)
ACPI: EC: Look up EC in DSDT

In case Microsoft's compiler had been used, words INTL would instead be MSFT. In the example, there were 5 errors on decompiling/recompiling the DSDT. Two of them were easy to fix after a bit of googling and delving into the ACPI specification. Three of them were due to different versions of compiler used and are, as later discovered, handled by the ACPICA at boot-time. The ACPICA component of the kernel can handle most of the trivial errors you get while compiling the DSDT. So do not fret yourself over compile errors if your system is working the way it should.

Extracting ACPI tables

(in progress)

Examination

iasl -tc ''.asl/.dsl file''

on it and if it says no errors and no warnings you should be good to go.