This is for advanced users experienced with DSDT modification ONLY
As a primer, read a few of the 700+ pages of the ACPI specs from here: http://www.acpi.info/spec.htm
Many issues related to power management (speedstep, sleep and hibernation etc.) are governed by your board's ACPI tables.
Debugging ACPI is a royal pain as often the display is off when you would like it to output debug info.
Using a second machine you can attach to the kernel and obtain valuable data, but I have never done this myself. Rather, I'm collecting here hints on how to debug ACPI using facilities available to all of us.
Kernel Arguments
First off, using these kernel arguments, you can obtain some output to the console:
CODE
-v acpi_layer="ACPI_ALL_COMPONENTS ACPI_ALL_DRIVERS" acpi_level="ACPI_LV_ALL_EXCEPTIONS" debug=0x12a
In order to see the console at all times, set "Display login window" to "Name and password" in System Preferences/Accounts/Login Options; then log out and enter ">console" as user name and an empty password. Now you can log in on the console (type your user name, hit enter, then type your password).
To put the machine to sleep from the console, use
CODE
sudo pmset sleepnow
DSDT Debug Code
ACPI allows some debug code to be output by writing to the debug device, however if the display is off, this is useless. Instead, you can send some morse code using the power LED.
Here is an example snippet I added to my _WAK method that flashes the power LED and thus shows me, where in _WAK it is hanging on resume.
CODE
Method (_WAK, 1, Serialized)
{
Store ("Method _WAK begin...", Debug)
/*
* Blink power led slow 3 times */
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
/*
* Enough */
\_SB.PCI0.LPCB.WAK (Arg0)
/*
* Blink power led long on 3 times */
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
/*
* Enough */
Store ("Called method WAK returned", Debug)
If (CondRefOf (_OSI, Local0))
{
Store (0x21, OSTY)
}
/*
* Blink power led long off 3 times */
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x1f4)
Store (0x0F, \_SB.PCI0.LPCB.LED)
/*
* Enough */
Notify (\_SB.PCI0.UHC1, Zero)
Notify (\_SB.PCI0.UHC2, Zero)
Notify (\_SB.PCI0.UHC3, Zero)
Notify (\_SB.PCI0.UHC4, Zero)
Notify (\_SB.PCI0.UHC5, Zero)
Notify (\_SB.PCI0.UHC6, Zero)
Notify (\_SB.PCI0.EHC1, Zero)
Notify (\_SB.PCI0.UHCX, Zero)
Notify (\_SB.PCI0.EHC2, Zero)
If (LEqual (Arg0, 0x04))
{
If (LEqual (WAS4, One))
{
Notify (\_SB.SLPB, 0x02)
}
}
Store ("Method _WAK end", Debug)
/*
* Blink power led fast 6 times */
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x02, \_SB.PCI0.LPCB.LED)
Sleep (0x64)
Store (0x0F, \_SB.PCI0.LPCB.LED)
/*
* Enough */
Return (Zero)
}
You need to find out how to turn on and off the power LED on your own, as this is totally specific to each board. As a hint, look at method _PTS, as this method usually turns off the power LED.
I admit that this code should be replaced by a dedicated method which takes as argument a string and flashes the power LED accordingly to the morse code representation of the string. Writing this method is left as an exercise for the reader. Please post your solutions below :-)
USB Debugging
Many issues related to sleep are related to USB and I recommend to install the debug version of the USB kexts. You can obtain them from this page (requires free ADC membership): http://developer.apple.com/hardwaredrivers...d/usbdebug.html
This post has been edited by zhell: Aug 11 2009, 03:32 PM





Aug 11 2009, 03:24 PM



