Jump to content

ACPI debugging


Õun
 Share

11 posts in this topic

Recommended Posts

How to debug your DSDT code in (Snow) Leopard?

 

I will try to gather different options into a single thread, maybe it will help other ACPI coders as well. What I have tried so far:

 

1. acpiexec

Doesn't compile on Mac OS. Otherwise it would be the best option. I'm not good enough in C to figure out if its fixable or not.

 

2. ACPI spec Debug constant

Debugging is disabled in Mac OS ACPI CA. So boot arguments acpi, acpi_level and acpi_layer don't work.

 

3. Remote kernel debugging

I can't use that option as I don't have firewire or ethernet port. If someone has success story, please provide details.

 

4. i/o port 80

It has been defined as the debugging port on a lot of DSDT implementations, but I haven't figured out a method to use it.

 

5. Kernel debugging with boot arguments

debug=0x12A provides some feedback on obvious errors (0x100, 0x20, 0x8 and 0x2 are the flags I'm using) -

http://developer.apple.com/mac/library/doc...-CH221-BABDGEGF

 

io=0x80 provides a lot of information from IOKit that is related to Power - http://www.opensource.apple.com/source/xnu...it/IOKitDebug.h

 

6. _DSM method

In DSDT use _DSM Method to save information, see http://www.insanelymac.com/forum/index.php?showtopic=168014

 

Later you can view that information in IORegistry Explorer. But the execution time for _DSM method is a big limiting factor. You can't view the information that gets changed after the _DSM execution.

 

7. SATA Scratch Pad Register - Best Option

Create this Operation Region under the SATA device, on ICH boards it's usually 0x001F0002. Check your board spec for the SATA device address and Scratch Pad Offset. On ICH8 and ICH10 it has been confirmed to be 0xD0.

 

OperationRegion (DBGP, PCI_Config, 0xD0, 0x04)
Field (DBGP, DWordAcc, NoLock, Preserve)
{
   DBGR,   32
}

 

Then you can use this sentence to write information to that register:

Store (\PDC0, \_SB.PCI0.SATA.DBGR)

(You will have to change it as needed, for example your PCI0 Device might be called differently)

 

Remember that writing more than once will overwrite the value in that register.

 

When you want to see the value you have to type this to your terminal:

lspci -v -xxx -s 00:1f.2

(Your SATA device might be on a different address)

 

If you have better ideas, let us know.

Link to comment
Share on other sites

Has anyone worked out a good way to debug DSDT code in SL?

acpiexec compilation fails, as OSX is not UNIX. I'm not good enough in C to figure out if its fixable or not.

 

kernel debug and io doesn't seem to provide much info neither. Well debug=0x14e and io=0x80 do provide some, but still not exactly what i'm looking for. Remote debugging ain't for me either (even if it did open some doors) as my second computer is without Firewire and Ethernet adapter (Macbook Air).

 

For some tasks I have used _DSM to write the value to ioreg, but this doesn't work for things that get executed later (_PDC for example).

 

Maybe thres someone who has found a good method. Right now I would really want to know what value does SL send with _PDC

 

Value of PDC is 0x319 on both my boards. Scratchpad register on page 524 of ICH10 datasheet is handy for simple dsdt debugging.

Link to comment
Share on other sites

Value of PDC is 0x319 on both my boards. Scratchpad register on page 524 of ICH10 datasheet is handy for simple dsdt debugging.

Yup, ICH8 seems to have it too. I know how to write to it:

Create OpRegion for it and use Store

 

But how do you read it in SL? ioreg?

Link to comment
Share on other sites

  • 2 months later...

hi Õun,

First off, thank u for this rear knowledge

Create this Operation Region under the SATA device...

mine is ich9-m, and sata looks like so:

Name (_ADR, 0x001F0002)
OperationRegion (SACS, PCI_Config, [color="#0000FF"]0x40[/color], [color="#8B0000"]0xC0[/color])
Field (SACS, DWordAcc, NoLock, Preserve)

just to be sure, what should I input in this case ?!

Then you can use this sentence to write information to that register:

Store (\PDC0, \_SB.PCI0.SATA.DBGR)

sorry for lasting, but this remains unclear to me, please show further guidance, as in witch section it should be written to.

Greetz,

Link to comment
Share on other sites

  • 4 weeks later...
There's a similar topic by zhell over at the Project:

 

http://www.projectosx.com/forum/index.php?showtopic=456

I am afraid those only work for leo. as am on snow, I wished I could get acpi debugging from there, but nobody (besides u Beerkex'd :D ) over here seems to take time explain to the rest of us how to get this accomplished. thanx anyway

Link to comment
Share on other sites

I am afraid those only work for leo.

Do you mean the ACPI_LAYER= kernel flag? What happens when you try it?

 

The LED blinking DSDT code should work provided you can find how to toggle the LED on your motherboard, and the USB debug kexts exist for both 10.5.x and 10.6.x.

Link to comment
Share on other sites

I think you misunderstand.

 

Do you mean the ACPI_LAYER= kernel flag? What happens when you try it?

 

The LED blinking DSDT code should work provided you can find how to toggle the LED on your motherboard, and the USB debug kexts exist for both 10.5.x and 10.6.x.

my problem is with the debug=0x14e and debug=0x12a

just can't boot with those args

Link to comment
Share on other sites

 Share

×
×
  • Create New...