Wednesday, June 9, 2010

New Minimal DSDT Edits for Gigabyte Socket 1156 Motherboards



We know that using a DSDT is the best way to create a vanilla Hackintosh build.  The problem is that there have been numerous articles and forum posts on editing that are based on old versions of Gigabyte BIOS extracts. Many of them are retreads of the same information and are more complex than necessary. Since I am now doing the DSDT edits for the tonymacx86.com DSDT Database, I wanted to figure out what was the least amount of edits I can do, while trying to make the edits match a real Mac as much as possible.

Gigabyte's latest release cycle of P55/H55 BIOS updates in May 2010 includes a few Hackintosh-friendly enhancements.  They've included the CMOS reset fix and some other changes.  However, these modifications are not complete and some edits still need to be made. The way to tell if you have the Hackintosh-friendly BIOS is to search the decompiled DSDT for AMAC. If you find "Name (AMAC, 0x00)" then you have the new BIOS.

The following is a guide for editing the extracted DSDT from the new Hackintosh-friendly BIOSes only. Some of these edits can be used with the older BIOS extracts, but has not been tested or is the complete list for those versions.

First here are some cosmetic changes that will make your system look more Mac like. Gigabyte uses generic device names in it's DSDT instead of descriptive names like Apple does. One example is Gigabyte use PX40 instead of LPCB for the LPC Interface Bridge. So the first thing we can do is to search for PX40 and do a global replace with LPCB. The next is to rename the System Management Bus (SMBus) device PX43 to SBUS. Next would be to rename Device (IDE1) to Device (SATA) and then within it rename Device (PRIM) to Device (PRT0) and Device (SECD) to Device (PRT1). The final cosmetic edits deal with USB. You can rename the devices to more appropriate ones as shown within this table:

Rename USB0 to UHC1
Rename USB1 to UHC2
Rename USB2 to UHC3
Rename USB3 to UHC4
Rename USB4 to UHC5
Rename USB5 to UHC6
Rename USB6 to UHC7
Rename USBE to EHC1
Rename USE2 to EHC2

There are three required edits needed regardless of BIOS version. They are to include Method DTGP, add Return Package at the end of _WAK and fix the "Method local variable is not initialized (Local0)" error. 

Now let’s review the new edits. One of the common edits has been to add a Device (BUS0). The problem I found is that sometimes it was added to the incorrect place or was coded incorrectly. The proper place for this device is as a sub-device within Device (SBUS). Here is what the correct device code should look like:


                Device (BUS0)
                {
                    Name (_CID, "smbus")
                    Name (_ADR, 0x00)
                    Device (DVL0)
                    {

                        Name (_ADR, 0x57)
                        Name (_CID, "diagsvault")

                        Method (_DSM, 4, NotSerialized)
                        {
                            Store (Package (0x02)
                                {
                                       "address", 
                                       0x57
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                    }
                }

The next edit is for audio. Gigabyte uses a device name of AZAL, so we need to do a global replace with HDEF. Then we need to add codec information to Device (HDEF). Here I found that a lot of edits were injecting a lot of information that wasn't need. All that is required is to inject layout-id and PinConfigurations. Here is an example of what needs to be added for a board using and an ALC889 codec and using our Legacy889HDA.kext:

                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x04)
                        {
                            "layout-id",
                            Buffer (0x04)
                            {
                                0x79, 0x03, 0x00, 0x00   // decimal 889
                            },
                            "PinConfigurations",
                            Buffer (Zero)
                            {
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

There is a problem with Audio break ups in 10.6.3 that can be corrected in the DSDT. The first is in Device (PIC) remove these two lines:

IRQNoFlags ()
                {2}

The other fix for audio break ups is in Device (TMR) where Gigabyte has not yet added Hackintosh logic. We need to change:

                    Method (_CRS, 0, NotSerialized)
                    {
                        If (LGreaterEqual (OSFX, 0x03))
                        {
                            If (HPTF)
                            {
                                Return (ATT6)
                            }
                            Else
                            {
                                Return (ATT5)
                            }
                        }
                        Else
                        {
                            Return (ATT5)
                        }
                    }

To:

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

Gigabyte has not yet added Hackintosh logic to Device (HPET), so you will get kernel panics in AppleIntelCPUPowerManagement. The fix is easy; just change Method (_STA, 0, NotSerialized) to Return (0x0F) and to change Method (_CRS, 0, NotSerialized) to Return (ATT3).

tonymacx86.com forum user Lnx2Mac brought this next edit to my attention. This edit allows use of the power button to put the computer to sleep.  In Device (PWRB) change Name (_HID, EisaId ("PNP0C0C")) to Name (_CID, EisaId ("PNP0C0C")).

It seems that if the USB devices have no device-id or it's incorrect you won't have any USB 1.1 devices. So you have to add the following code to each USBx/UHCx device to enable it in Snow Leopard.

                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x02)
                        {
                            "device-id",
                            Buffer (0x04)
                            {
                                0x34, 0x3A, 0x00, 0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

I have found that the same device-id can be used for each USBx/UHCx device. They don't have to be unique, just valid.

Likewise for the USBE/EHC1 and USE2/EHC2 devices we need to add the following code:

                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x08)
                        {
                            "AAPL,current-available",
                            0x05DC,
                            "AAPL,current-extra",
                            0x044C,
                            "AAPL,current-in-sleep",
                            0x09C4,
                            "device-id",
                            Buffer (0x04)
                            {
                                0x3A, 0x3A, 0x00, 0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

The "AAPL, ..." insertion is for compatibility and for native USB power savings.  Again, it is safe to use duplicate device-ids.

If you have a Gigabyte P55/H55 motherboard whose current DSDT is not in the tonymacx86.com DSDT Database, you can submit it on the tonymacx86.com forum by clicking here.  The instructions are at the top of the topic.  After we receive it and verify that it is vanilla, we will do the edits and upload it to the database.

For discussions on this and other topics, register today at tonymacx86.com!

29 comments:

Quad said...

Wow, this is great stuff! I'm amazed; this is far beyond my skills. You sure have my admiration. I was wondering if I have the right BIOS? GB UD-2 f10 from the Database, dated 26.5.2010. When I open the *.aml file in DSDTSE I cannot find the exact AMAC line. It looks like this "Name (AMAC, Zero)" Now I'm probably too stupid to translate that "0x00" to "Zero". Is this Hex code or what? Anyways thanks for the effort! quad

MacManx86 said...

Yeah it's a hex code. Some DSDT compiler/de-compliers translate a 0x00 to Zero and vice-versa.

Glad you enjoyed.

Anonymous said...

"The following is a guide for editing the new Hackintosh-friendly BIOSes only. Some of these edits can be used with the older BIOSes, but has not been tested or is the complete list for those versions."

Are you editing the BIOS or the DSDT?

Anonymous said...

Pretty neat,amazing stuff :)

MacManx86 said...

Anonymous,

We are editing the DSDT that was extracted from new Hackintosh-friendly BIOSes. I'll revise the wording.

Anonymous said...

Would it be an idea to list a version number in the table of DSDT's so we can see if/when there has been an update?

MacManx86 said...

Anonymous,

On the forum we have a thread where we track when DSDT updates are posted. http://www.tonymacx86.com/viewtopic.php?f=14&t=2014

econ3000 said...

Awesome post. Do these changes apply to dsdt editing on recent x58 socket 1366 boards such as my gigabyte x58a-ud3r rev. 2.0?

MacManx86 said...

econ3000,

Thanks, I'm glad you liked it.

As for Gigabyte x58 boards, I don't know. I haven't looked at their DSDT extracts, but I think that some of it would apply.

Anonymous said...

hi MacManx86,
i saw you got a PNY XLR8 GF 9600 GT ?
how did you make osx detect it? via dsdt, graphics enabler or efi string?
mine works with efi string but mirroring wont work
and i think it keeps my hackmac from going to sleep that "half-configured", if you use dsdt or something different than efi string, could you explain how, when i tried it via dsdt it worked, but i didn't get ci/qe working, at least it seemed like because no ripples on dashboard when adding an item

MacManx86 said...

Anonymous,

I'm using a PNY 9800 GT and using GraphicsEnabler with full QE/CI.

econ3000 said...

There are three required edits needed regardless of BIOS version. They are to include Method DTGP, add Return Package at the end of _WAK and fix the "Method local variable is not initialized (Local0)" error.

is there a post that explains these 3 required edits in detail?

MacManx86 said...

econ3000,

These fixes are documented in DSDTse underDSDT Fixes.

AsVit said...

.. All that is required is to inject layout-id and PinConfigurations.
- Where i can find ayout-id and PinConfigurations ?
snX!

DreamTeam Studios said...

will this get my dual video cards working geforce 8400 gs

fester said...

hey, I tried your mods and tried to compile with DSDTSE but i get two errors:

6026: syntax error, unexpected '{', expecting '}'^

6611:syntax error, unexpected $end^

however... none of the edits i did from your list were on those lines? or am i missing something?

MacManx86 said...

fester,

What this typically means is that you either added an extra { somewhere or deleted a } that shouldn't have been and that produces both errors.

I find when I do this I start over from scratch. I do the mandatory edits and make sure it compiles. Then as I do each edit I compile to ensure that there are no errors and then do a save. Makes it easier to find where the error is.

fester said...

sweet, yeah I was thinking thats a better way of going about it.. thanks.

fester said...

for future ref, the // comments were playing havoc with my compiling for some strange reason, especially the HDEF section with "// decimal 889" so i used /* */ notes and it compiles fine. I guess we'll see soon if it actually works! thanks.

fester said...

so, it boots! with these minimal edits, can I run 64bit kernel? or is there something else that gets in the way of that?

MacManx86 said...

fester,

There should be no reason why you can't, I do.

Lui Bove said...

Hi MacMan, great work all you Hackintosh developers are doing, but thru out all the reading & searching I've done, I can make audio work on my GA-G31M-ES2L motherboard, it has the ALC883 codec, motherboard is running F8 bios. Not sure if you can help, but if you can lead me in the right direction?

Anonymous said...

it would be awesome if you could show the before and after version of your edits and place them inside a [code] block.

Unknown said...

how can i add code for the pci-e usb card. it shows up sleepcapability error during booting

LatinMcGruber75 said...

wow i been looking for those gigabyte AMAC changes in g31m-es2L rev 1.1 bios F10 and seems not there.
time to mod DSDT :P thanks.
also the X58A-UD3R ver2. bios FF has DMA1 instead of DMAC and MCHC isnt there. but working fine with lnx2mac driver as RTGmac 2.0.6 still has sleep wakeup issues
but i wonder if thats the power management option that says 1 watt sleep (NO WOL S5) default is disabled.

waqar2waqar said...

v good

Anonymous said...

I looked at my dsdt from the tonymac database and realized you guys have done a lot of work and just wanted to send my appreciation your way. Thank you.

Anonymous said...

Excellent post !!

finally someone who knows his stuff and can even explain it.
thanks !!

-vic

Anonymous said...

Great Work, I have a GA-P55-USB3 F9 bios Rev 2 the dsdt on the tonymac database didn't work for me so I followed this guide and all went quite well, apart from the onboard audio 892 chip, when my system is idle the audio breaks up, but if I have any app using some of the cpu time audio plays fine, I have applied all the fixes in the guide now I'm stuck can any one help please

Thanks

Pete

Post a Comment