Difference between revisions of "DSDT"

From ArchWiki
Jump to: navigation, search
(Tell the kernel to report a version of Windows)
(48 intermediate revisions by 16 users not shown)
Line 1: Line 1:
[[Category:Boot process (English)]]
+
[[Category:Boot process]]
[[Category:Kernel (English)]]
+
[[Category:Kernel]]
[[Category:HOWTOs (English)]]
+
[[Category:Power management]]
[[Category: Power management (English)]]
+
DSDT (Differentiated System Description Table) is a part of the [[Wikipedia:ACPI|ACPI]] specification. It supplies information about supported power events in a given system. ACPI tables are provided in firmware from the manufacturer. A common Linux problems are missing ACPI functionality, such as: fans not running, screens not turning off when the lid is closed, etc.  This can stem from DSDTs made with Windows specifically in mind, which can be patched after installation. The goal of this article is to analyze and rebuild a faulty DSDT, so that the kernel can override the default one.
  
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 preinstalled DSDT from the manufacturer. A common linux problem is missing ACPI functionality (fans not runninng, 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. AFAICT there is no difference between using the installation method and doing it later.
+
{{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...==
===Step one: Get hold of fixed DSDT===
+
* It is possible that the hardware manufacturer has released an updated firmware which fixes ACPI related problems. Installing an updated firmware is often preferred over this method because it would avoid duplication of effort.
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.
+
* 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.
==== "Compiling it yourself" ====
+
* Even before attempting to fix your DSDT yourself, you can attempt a couple of different shortcuts:  
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 and better at the [http://gentoo-wiki.com/ACPI/Fix_common_problems Gentoo wiki]. It's well written and the process is a lot easier than it sounds and far faster than reading about it.
+
==== "Some guy on the internet" ====
+
* 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. 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.
+
  
Remember, regardless of how you get a file, you'll need a compiled ACPI Machine Language file for the next step.
+
===Tell the kernel to report a version of Windows===
  
===Step Two: Get the file loaded at startup===
+
Use the variable '''acpi_os_name''' as a kernel parameter. For example:
  
==== Disclaimer ====
+
  acpi_os_name="Microsoft Windows NT"
This part is going to describe how to rebuild your startup image (kernel26.img) so that your custom DSDT file will get loaded instead of the maunfacturer's. This is fairly technical subject mattter (which I don't understand much of) so this is pretty much pure howto. See  [[Configuring mkinitcpio]] for a more detailed description of the things at work here. If things go wrong this shifts the blame back to you.
+
appended to the kernel line in grub legacy configuration
  
==== Howto ====
+
other strings to test:
* Cp your compiled file to /lib/initcpio/custom.dsdt
+
* "Microsoft Windows XP"
* The last line of /etc/mkinitcpio.conf (HOOKS="....") lists in standard arch style "the hooks that are executed on image creation and on runtime in the exact order they are listed". You'll need to add 'dsdt' to this list if it's not already there. Save the file.
+
* "Microsoft Windows 2000"
* mkinitcpio is the program that creates the startup image based on /etc/mkinitcpio.conf. Get it from the repos:  
+
* "Microsoft Windows 2000.1"
<pre>pacman -Sy mkinitcpio.</pre>
+
* "Microsoft Windows ME: Millennium Edition"
* Run mkinitcpio as root. Simply entering
+
* "Windows 2001"
<pre>mkinitcpio</pre>
+
* "Windows 2006"
will do a dry test run. Note that a succes here or when you run the command for real is no guarantee that the generated image will actually work. The 'succes' announced is whether or not an image file was generated.
+
* "Windows 2009"
<pre>mkinitcpio -p kernel26</pre>
+
* when all that fails, you can even try "Linux"
will create both the standard and the fallback image. If you're feeling less adventurous, you might wish to first try  
+
<pre>mkinitcpio -g /boot/kernel26.img</pre>
+
which will only create the standard image, so you can.. well fall back on the other one in case things don't work out. If/when they do work out, you can always run the command with the -p option after the first test.
+
  
Note that as long as you can restart your Arch install using the fallback image, you have nothing that cannot be reversed. Simply remove the dsdt hook from /etc/mkinitcpio.conf and delete the custom.dsdt file and use mkinitcpio to create the images again.
+
Out of curiousity, you can follow the steps below to extract your DSDT and search the .dsl file.  Just grep for "Windows" and see what pops up.
  
=== Step three: Test your new image ===
+
===Find a fixed DSDT===
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 don't
+
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 will 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 will most likely be a compressed .asl file.  So you will need to unzip it and compile it. The upside to this is that you won't have to research specific code fixes yourself.
* Make a note of the error messages
+
* Restart
+
* Choose the fallback image option from GRUB
+
* Read the other wiki articles (really) and try again.
+
* Try forums (again)
+
* Read/edit wiki
+
* Leave distro in anger vowing revenge
+
  
== External Links ==
+
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 savvy -- someone there has produced a working DSDT and maybe even provides a precompiled version (again, use at your own risk).
* [http://gentoo-wiki.com/ACPI/Fix_common_problems The Gentoo wiki article]
+
Search engines are your best tools. Try keeping it short: 'model name' + 'dsdt' will probably produce results.
* [http://acpi.sourceforge.net/dsdt/index.php The sourceforge database]
+
 
* [http://www.cpqlinux.com/acpi-howto.html#fix_broken_dsdt Howto for fixing errors in DSDT files]
+
== Recompiling it yourself ==
* [http://news.skelter.net/articles/2008/07/28/bill-gates-on-sabotaging-acpi-for-linux Bill Gates on Making ACPI Not Work with Linux] - when things go wrong it's nice to have someone to yell at...
+
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''.
 +
In a nutshell, you can use Intel's ASL compiler to turn your systems DSDT table into source code, locate/fix the errors, and recompile. This process is detailed more comprehensively at the [http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems Gentoo wiki].
 +
You'll need to install {{Pkg|iasl}} to modify code, and be familiar with [[Kernel_Compilation#Compilation]] to install it.
 +
 
 +
'''What compiled the original code?'''
 +
Check if your system's DSDT was compiled using Intel or Microsoft compiler:
 +
{{hc|<nowiki> $ dmesg|grep DSDT</nowiki> |
 +
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.
 +
 
 +
1.) Extract ACPI tables (as root): {{ic|# cat /sys/firmware/acpi/tables/DSDT > dsdt.dat}}
 +
 
 +
2.) Decompile: {{ic|iasl -d dsdt.dat}}
 +
 
 +
3.) Recompile: {{ic|iasl -tc dsdt.dsl}}
 +
 
 +
4.) Examine errors and fix. e.g.:{{bc|
 +
dsdt.dsl  6727:                        Name (_PLD, Buffer (0x10) 
 +
Error    4105 -         Invalid object type for reserved name ^  (found BUFFER, requires Package) }}
 +
{{hc| nano +6727 dsdt.dsl|
 +
(_PLD, Package(1) {Buffer (0x10)...}}
 +
 
 +
5.) Compile fixed code: {{ic|iasl -tc dsdt.dsl}} (Might want to try option -ic for C include file to insert into kernel source)
 +
 
 +
If it says no errors and no warnings you should be good to go.
 +
 
 +
6.) Insert code into kernel source.
 +
 
 +
You'll want to be familiar with [[Kernels | compiling your own kernel]]. The most straightforward way is with the "traditional" approach.
 +
 
 +
Using ''make menuconfig'':
 +
* Disable "Select only drivers that don't need compile-time external firmware".
 +
* Enable "Include Custom DSDT" and specify the absolute path of your fixed DSDT file.

Revision as of 06:15, 24 January 2013

DSDT (Differentiated System Description Table) is a part of the ACPI specification. It supplies information about supported power events in a given system. ACPI tables are provided in firmware from the manufacturer. A common Linux problems are missing ACPI functionality, such as: fans not running, screens not turning off when the lid is closed, etc. This can stem from DSDTs made with Windows specifically in mind, which can be patched after installation. The goal of this article is to analyze and rebuild a faulty DSDT, so that the kernel can override the default one.

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...

  • It is possible that the hardware manufacturer has released an updated firmware which fixes ACPI related problems. Installing an updated firmware is often preferred over this method because it would avoid duplication of effort.
  • 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 of different shortcuts:

Tell the kernel to report a version of Windows

Use the variable acpi_os_name as a kernel parameter. For example:

 acpi_os_name="Microsoft Windows NT"

appended to the kernel line in grub legacy configuration

other strings to test:

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

Out of curiousity, you can follow the steps below to extract your DSDT and search the .dsl file. Just grep for "Windows" and see what pops up.

Find a 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 will 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 will most likely be a compressed .asl file. So you will need to unzip it and compile it. The upside to this 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 savvy -- someone there has produced a working DSDT and maybe even provides a precompiled version (again, use at your own risk). Search engines are your best tools. Try keeping it short: 'model name' + '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/fix the errors, and recompile. This process is detailed more comprehensively at the Gentoo wiki. You'll need to install iasl to modify code, and be familiar with Kernel_Compilation#Compilation to install it.

What 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.

1.) Extract ACPI tables (as root): # cat /sys/firmware/acpi/tables/DSDT > dsdt.dat

2.) Decompile: iasl -d dsdt.dat

3.) Recompile: iasl -tc dsdt.dsl

4.) Examine errors and fix. e.g.:
dsdt.dsl   6727:                         Name (_PLD, Buffer (0x10)  
Error    4105 -          Invalid object type for reserved name ^  (found BUFFER, requires Package) 
 nano +6727 dsdt.dsl
(_PLD, Package(1) {Buffer (0x10)...

5.) Compile fixed code: iasl -tc dsdt.dsl (Might want to try option -ic for C include file to insert into kernel source)

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

6.) Insert code into kernel source.

You'll want to be familiar with compiling your own kernel. The most straightforward way is with the "traditional" approach.

Using make menuconfig:

  • Disable "Select only drivers that don't need compile-time external firmware".
  • Enable "Include Custom DSDT" and specify the absolute path of your fixed DSDT file.