The following is revised and extended from MacManx86's original post,
a link to which was found within tonymacx86's site.
The original post may be found at
http://macmanx86.blogspot.com/2010/06/new-minimal-dsdt-edits-for-gigabyte.html.
Where the "first person" is used, it is MacManx86 who is writing.
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. 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.
PH's note: If your BIOS does not have the AMAC stuff, it may be added
using the following prototype:
Name (OSFX, One)
Name (LINX, Zero) // Insert
Name (AMAC, Zero) // Insert
Name (OSFL, One)
Scope (\) // Replace all ...
{
OperationRegion (SCPP, SystemIO, 0xB2, One)
Field (SCPP, ByteAcc, NoLock, Preserve)
{
SMIP, 8
}
}
Method (^_INI, 0, NotSerialized)
{
If (STRC (_OS, "Microsoft Windows"))
{
Store (0x56, SMIP)
}
Else
{
If (STRC (_OS, "Microsoft Windows NT"))
{
If (CondRefOf (\_OSI, Local0))
{
Store (Zero, Local2)
If (_OSI ("Windows 2001"))
{
Store (Zero, OSFL)
Store (0x59, Local1)
Store (0x03, OSFX)
Store (One, Local2)
}
If (_OSI ("Windows 2006"))
{
Store (Zero, OSFL)
Store (0x5B, Local1)
Store (0x05, OSFX)
Store (One, Local2)
}
If (_OSI ("Windows 2009")) {}
If (LNotEqual (Local2, Zero))
{
Store (Local1, SMIP)
}
}
Else
{
Store (0x58, SMIP)
Store (Zero, OSFL)
}
}
Else
{
If (CondRefOf (\_OSI, Local0))
{
If (_OSI ("Linux"))
{
Store (One, LINX)
}
If (_OSI ("Darwin"))
{
Store (One, AMAC)
}
}
Store (0x57, SMIP)
Store (0x02, OSFL)
}
}
}
Scope (\)
{
Method (OSTP, 0, NotSerialized)
{
If (LEqual (OSFL, One))
{
Store (0x56, SMIP)
}
If (LEqual (OSFL, 0x02))
{
Store (0x57, SMIP)
}
If (LEqual (OSFL, Zero))
{
Store (0x58, Local1)
If (LGreaterEqual (OSFX, 0x03))
{
Store (0x59, Local1)
If (LEqual (OSFX, 0x05))
{
Store (0x5B, Local1)
}
}
Store (Local1, SMIP)
}
}
} // ... end of replace
Device (RTC) // Replace all ...
{
Name (_HID, EisaId ("PNP0B00"))
Name (ATT0, ResourceTemplate ()
{
IO (Decode16,
0x0070, // Range Minimum
0x0070, // Range Maximum
0x00, // Alignment
0x04, // Length
)
IRQNoFlags ()
{8}
})
Name (ATT1, ResourceTemplate ()
{
IO (Decode16,
0x0070, // Range Minimum
0x0070, // Range Maximum
0x00, // Alignment
0x04, // Length
)
})
Name (ATT2, ResourceTemplate ()
{
IO (Decode16,
0x0070, // Range Minimum
0x0070, // Range Maximum
0x00, // Alignment
0x02, // Length
)
IRQNoFlags ()
{8}
})
Name (ATT3, ResourceTemplate ()
{
IO (Decode16,
0x0070, // Range Minimum
0x0070, // Range Maximum
0x00, // Alignment
0x02, // Length
)
})
Method (_CRS, 0, NotSerialized)
{
If (LGreaterEqual (OSFX, 0x03))
{
If (HPTF)
{
Return (ATT1)
}
Else
{
Return (ATT0)
}
}
Else
{
If (LEqual (AMAC, One))
{
Return (ATT2)
}
Return (ATT0)
}
}
} // ... end of replace
The following is a guide for editing the extracted DSDT from the new
Hackintosh-friendly BIOSes only, or DSDTs in which the AMAC stuff has
been retrofitted (this includes not only H55/P55 DSDTs but also G31,
P35, G41 and P45 DSDTs). 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).
PH's note: Although this does indeed work, a better alternative is to
incorporate a true SATA device tree:
Device (SATA) // Replace all ...
{
Name (_ADR, 0x001F0002)
Name (_SUN, One)
Device (PRT0)
{
Name (_ADR, Zero)
Method (_GTF, 0, NotSerialized)
{
Name (PIB0, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xF5
})
Return (PIB0)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Int 1"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Device (PRT1)
{
Name (_ADR, One)
Method (_GTF, 0, NotSerialized)
{
Name (PIB1, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xF5
})
Return (PIB1)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Int 2"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Device (PRT2)
{
Name (_ADR, 0x02)
Method (_GTF, 0, NotSerialized)
{
Name (PIB2, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xF5
})
Return (PIB2)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Int 3"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Device (PRT3)
{
Name (_ADR, 0x03)
Method (_GTF, 0, NotSerialized)
{
Name (PIB3, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xF5
})
Return (PIB3)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Int 4"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Device (PRT4)
{
Name (_ADR, 0x04)
Method (_GTF, 0, NotSerialized)
{
Name (PIB4, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xF5
})
Return (PIB4)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Ext 1"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Device (PRT5)
{
Name (_ADR, 0x05)
Method (_GTF, 0, NotSerialized)
{
Name (PIB5, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xF5
})
Return (PIB5)
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"io-device-location",
Buffer (0x06)
{
"Ext 2"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x06)
{
"device_type",
Buffer (0x10)
{
"AHCI Controller"
},
"model",
Buffer (0x1C)
{
"ICH9-R SATA/AHCI Controller"
},
"name",
Buffer (0x1C)
{
"ICH9-R SATA/AHCI Controller"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
} // … end of replace
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.
PH's note: DSDTSE's DSDT Hacks menu provides prototypes.
PH's note: Sometimes, there is an obvious error which prevents a clean
compile. The Or (0x03, PARM) statement should be replaced by Or (PARM,
0x03, PARM).
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")
}
}
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)
}
PH's note: In most instances, the comment "// decimal 889" must be
deleted to obtain a clean DSDTSE compile.
PH's note: Other alternatives are 0x78 for ALC888 and 0x77 for
ALC888b. Also 0x75 for ALC889a.
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.