Your Ad Here

ACPI DSDT Table


I started diving into all this wired ACPI-DSDT stuff. The ACPI-Spec has more than 700 pages! Part of the ACPI is the DSDT. DSDT is an acronym for Differentiated System Description Table. This table contains the Differentiated Definition Block, which supplies the information and configuration information about the base system.


Here are some useful link to start reading:
ACPI - Advanced Configuration and Power Interface
Linux/ACPI - DSDT: Overview
HOWTO: Fix Common ACPI Problems (DSDT, ECDT, etc.)
ACPI Downloads (eg. iASL Compiler/Disassembler, Source)
DSDT Patcher - InsanelyMac Forum (contains Mac OS X iASL binary)

Each mainboard, even different BIOS version, has it's own DSDT. All Information I'm giving you here in this Blog is specific to the Gigabyte GA-EP45-DS3 mainboard with BIOS version F9. Your DSDT might look very similar and the patches/fixes/solutions should be done in a similar way, but I cannot guarantee this.

I managed to get, disassemble, compile the DSDT. I had to fix some errors in the DSDT, which is very common if you use the Intel iASL Compiler. Seems that the Microsoft Compiler is not so piggy and almost all mainboard makers using the Microsoft Compiler for their ACPI stuff. After this very first steps I started to modify the DSDT. I modified the RTC and the HPET section to make AppleRTC.kext and AppleIntelCPUPowerManagement.kext work. After that I could delete Disabler.kext from the Extra/Extensions folder of the Chameleon USB-stick. Great, isn't it!

To start working with DSDT you need the DSDT of your mainboard and an ASL Compiler/Disassembler like the iASL. You can download the tools from the InsanelyMac forum or here. These are tools for Mac OS X. Windows and Linux versions are also available in the net.

How to obtain the DSDT. Under Mac OS X run the script getDSDT.sh in the Terminal:


admin@MacBook [~/Downloads/Tools] > ls -la
total 1160
drwxr-xr-x@  4 admin  staff     136 Jul 16 18:20 .
drwx------+ 38 admin  staff    1292 Jul 16 18:20 ..
-rwxr-xr-x@  1 admin  staff     252 Nov  2  2008 getDSDT.sh
-rwxr-xr-x@  1 admin  staff  587968 Oct 25  2008 iasl
admin@MacBook [~/Downloads/Tools] > ./getDSDT.sh
admin@MacBook [~/Downloads/Tools] > ls -la
total 1208
drwxr-xr-x@  5 admin  staff     170 Jul 16 18:20 .
drwx------+ 38 admin  staff    1292 Jul 16 18:20 ..
-rw-r--r--   1 admin  staff   23454 Jul 16 18:20 dsdt.dat
-rwxr-xr-x@  1 admin  staff     252 Nov  2  2008 getDSDT.sh
-rwxr-xr-x@  1 admin  staff  587968 Oct 25  2008 iasl

It gives you the file dsdt.dat, which is the compiled DSDT. Under Linux it's even much easier. Issue "cat /proc/acpi/dsdt > dsdt.aml" and you have the compiled DSDT. Don't get the DSDT under an EFI-X™ controlled Mac, because it might be already modified/patched in some way. Use a Linux Live-CD (Ubuntu) or Chameleon without a DSDT in the Extra folder. Now disassemble the compiled DSDT:


admin@MacBook [~/Downloads/Tools] > ./iasl -d dsdt.dat

Intel ACPI Component Architecture
AML Disassembler version 20080926 [Oct  4 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

Loading Acpi table from file dsdt.dat
Acpi table [DSDT] successfully installed and loaded
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)
...............................
Parsing completed
Disassembly completed, written to "dsdt.dsl"

Now you can open the file "dsdt.dsl" with your favorite editor, but take care to save it as plain text. But first I will check whether I can compile the original DSDT without errors and warnings:


admin@MacBook [~/Downloads/Tools] > ./iasl -ta dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080926 [Oct  4 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

dsdt.dsl 222:   Method (\_WAK, 1, NotSerialized)
Warning  1080 - ^ Reserved method must return a value (_WAK)

dsdt.dsl 285:   Store (Local0, Local0)
Error    4050 - ^ Method local variable is not initialized
(Local0)

dsdt.dsl 290:   Store (Local0, Local0)
Error    4050 - ^ Method local variable is not initialized
(Local0)

ASL Input:  dsdt.dsl - 5683 lines, 189412 bytes,
2339 keywords
Compilation complete. 2 Errors, 1 Warnings, 0 Remarks,
661 Optimizations

As you can see I got 2 errors and 1 warning. The original Gigabyte DSDT is buggy. The error 4050 can be fixed very easy. Actually Store(Local0, Local0) means nothing but a NOP. It stores the content of the local variable Local0 into Local0. The problem is, that Local0 is not initialized. Change it to for instance Store ("Local0", Local0) or Store(Zero, Local0). The warning 1080 comes out because the _WAK method must return a value. ACPI-spec 7.3.7 defines a return of a package with 2 integers. So inserting Return (Package (0x02) {Zero, Zero}) will fix the warning. Returning Zero is not critical, even Apple returns Zero in their DSDTs. All fixes are colored green


Method (_WAK, 1, NotSerialized)
{
...

If (OSFL)
{
Notify (\_SB.PWRB, 0x02)
}
Else
{
If (LEqual (RTCW, Zero))
{
Notify (\_SB.PWRB, 0x02)
}
}

Notify (\_SB.PCI0.USB0, Zero)
Notify (\_SB.PCI0.USB1, Zero)
Notify (\_SB.PCI0.USB2, Zero)
Notify (\_SB.PCI0.USB3, Zero)
Notify (\_SB.PCI0.USB4, Zero)
Notify (\_SB.PCI0.USB5, Zero)
Return (Package (0x02)
{
Zero,
Zero
})
}

Scope (_SI)
{
Method (_MSG, 1, NotSerialized)
{
Store ("Local0", Local0)
}

Method (_SST, 1, NotSerialized)
{
Store ("Local0", Local0)
}
}

Now lets compile the fixed DSDT:


admin@MacBook [~/Downloads/Tools] > ./iasl -ta dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080926 [Oct  4 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

ASL Input:  dsdt.dsl - 5686 lines, 188406 bytes,
2340 keywords
AML Output: dsdt.aml - 18151 bytes, 661 named objects,
1679 executable opcodes

Compilation complete. 0 Errors, 0 Warnings, 0 Remarks,
31 Optimizations

No warnings, no errors. Fine! You can download the fixed DSDT for my Gigabyte GA-EP45-DS3 mainboard here. To get AppleIntelCPUPowerManagement.kext and AppleRTC working, the devices HPET, RTC and TMR must be modified. The device order in my DSDT is TMR, HPET and RTC.

For the TMR device patch the method _CSR to return ATT6 (ResourceTemplate without IRQNoFlags:


Method (_CRS, 0, NotSerialized)
{
Return (ATT6)
}

For the HPET device patch method _CRS to return ATT1 (ResourceTemplate with IRQNoFlags) and method _STA to return 0x0f:


Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}

Method (_CRS, 0, NotSerialized)
{
Return (ATT3)
}

For the RTC device patch method _CRS to return ATT1 (ResourceTemplate without IRQNoFlags):


Method (_CRS, 0, NotSerialized)
{
Return (ATT1)
}

Save and then compile it:


admin@MacBook [~/Downloads/Tools] > ./iasl -ta dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080926 [Oct  4 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

ASL Input:  dsdt.dsl - 5631 lines, 186571 bytes,
2312 keywords
AML Output: dsdt.aml - 18040 bytes, 661 named objects,
1651 executable opcodes

Compilation complete. 0 Errors, 0 Warnings, 0 Remarks,
31 Optimizations

Put the resulting compiled DSDT "dsdt.aml" in the Extra folder of the Chameleon USB-stick. You are now safe to remove Disabler.kext from the Extra/Extensions folder. Don't forget to rebuild Extensions.mkext. Download the final DSDT here.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.