Sapphire HD6670 on OS X 10.7.5 – Enabling the HDMI port

One of the problems using the Apple drivers drivers is that they are produced for a very small subset of cards that Apple support. My particualr card has three ports, HDMI, DVI and VGA. While it’s possible to get this particular Sapphire HD6670 card mostly supported by setting it’s personality to Pithecia in the boot plist, there will be no output from the HDMI port, as the Pithecia personality is for a card with DisplayPort, DVI and VGA.

So….some hacking is required……..

1. Dump the personality out of the kext.

To get a list of the supported personalities, you will need to dump them out of the kext. Download ati-personality.pl (Google it), and run it against /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller – the bit I’m interested in is as follows:

Kext /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller
Personality: Pithecia
ConnectorInfo count in decimal: 3
Disk offset in decimal 181984
0000000    00  04  00  00  04  03  00  00  00  01  00  00  21  03  02  04
0000010    04  00  00  00  14  02  00  00  00  01  00  00  00  00  04  03
0000020    10  00  00  00  10  00  00  00  00  01  00  00  00  00  00  01
0000030

The three lines of hex detail the configuration of each port. Taking the first line, it can be broken down as follows::

Connector                00  04  00  00
ATY, Control Flags    04  03  00  00
Features                   00  01
Unknown                  00  00
Transmitter               21
Encoder                   03
Hotplug ID               02
Sense ID                  04

2. Dump the card BIOS

You will need a dos boot USB drive (Google it), and atiflash.exe (Google it). boot off the dos drive, and run

atiflash -s o atirom.rom 20000

3. Get the card details out of the BIOS

Boot back into OS X, and run redsock_bios_decoder agains the BIOS (Google it). The output of mine looks like this:

198X14A5.S23:

AMD HD6770 2G

Subsystem Vendor ID: 174b
 Subsystem ID: e198
Object Header Structure Size: 203
Connector Object Table Offset: 34
Router Object Table Offset: 0
Encoder Object Table Offset: 9d
Display Path Table Offset: 12
Connector Object Id [12] which is [HDMI_TYPE_A]
 encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false
Connector Object Id [4] which is [DVI_D]
 encoder obj id [0x1e] which is [INTERNAL_UNIPHY (osx txmit 0x10 [duallink 0x0] enc 0x0)] linkb: false
Connector Object Id [5] which is [VGA]
 encoder obj id [0x15] which is [INTERNAL_KLDSCP_DAC1 (osx txmit 0x00 enc 0x10?)] linkb: false

Run radion_bios_decode against the BIOS. The output of mine looks like this:

ATOM BIOS Rom: 
    SubsystemVendorID: 0x174b SubsystemID: 0xe198
    IOBaseAddress: 0x0000
    Filename: 198X14A5.S23
    BIOS Bootup Message: 
AMD HD6770 2G                                                               

PCI ID: 1002:6758
Connector at index 0
    Type [@offset 44274]: HDMI-A (11)
    Encoder [@offset 44278]: INTERNAL_UNIPHY2 (0x21)
    i2cid [@offset 44348]: 0x94, OSX senseid: 0x5
Connector at index 1
    Type [@offset 44284]: DVI-D (3)
    Encoder [@offset 44288]: INTERNAL_UNIPHY (0x1e)
    i2cid [@offset 44375]: 0x92, OSX senseid: 0x3
Connector at index 2
    Type [@offset 44294]: VGA (1)
    Encoder [@offset 44298]: INTERNAL_KLDSCP_DAC1 (0x15)
    i2cid [@offset 44402]: 0x90, OSX senseid: 0x1

We now have all of the information we need.

4. The Connector

OK, so both BIOS decodes tell us that connector 0 is the HDMI connector. Looking at the Pithecia dump, we can see this is set to 00 04 00 00

But what does this mean?

Well, the connector type is defined as follows:

LVDS            02 00 00 00
DVI_DUAL    04 00 00 00
VGA             10 00 00 00
SVIDEO        80 00 00 00
DVI               00 02 00 00
DP               00 04 00 00
HDMI           00 08 00 00

So we can see that it’s set to Display Port. We want HDMI, so were going to use 00 08 00 00

5. The ATY and Control Flags

Again, looking at the Pithecia dump, we see that the control flags for connector 0 are set to 04 03 00 00.

What does this mean?

The ATY and control flags are defined as follows:

LVDS           40 00 00 00 or 00 01 00 00
DVI_DUAL    16 00 00 00 or 14 00 00 00 or 14 02 00 00
VGA             10 00 00 00
S-Video        02 00 00 00
DVI-?            14 00 00 00 or 14 02 00 00 or 04 02 00 00 or 16 00 00 00
DisplayPort   00 01 00 00 or 04 01 00 00 or 04 03 00 00 or 06 04 00 00 or 00 04 00 00
HDMI            00 02 00 00 or 04 02 00 00

Again, we can see that it’s set to Display Port. We want HDMI, so were going to use 04 02 00 00 as this is the option that enable HDMI audio

6. The Features

Again, looking at the Pithecia dump, we see that the features for connector 0 are set to 00 01.

What does this mean?

The features are defined as follows:

FIRST NUMBER

FEATURE_USE_INTERNAL                 01
FEATURE_USE_RGB_ON_YUV          04
FEATURE_USE_BACKLIGHT              08
FEATURE_BACKLIGHT_INVERTED    10
FEATURE_USE_CLAMSHELL             20

SECOND NUMBER

LVDS            09
DVI_DUAL    00
VGA             00
SVIDEO        04
DVI               00
DP               00
HDMI           00

As none of the options for the first number are relevant, we’ll use 00 for that, and )) for the second, as we’re setting it for HDMI, so we will use 00 00

7. Unknown.

It’s unknown. Who cares? leave it at 00 00

8. Transmitter.

Now we look at the decodes, and see this for connector 0:

encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false

Look at the bold text.

So we’ll use 12

9. Encoder

Again, we look at the decodes, and see this for connector 0:

encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false

Look at the bold text.

So we’ll use 04

10. Hotplug ID.

This must be a unique value for each connector. Leave it as it, 02

11. Sense ID.

Again, we look at the decodes, and see this for connector 0:

i2cid [@offset 44348]: 0x94, OSX senseid: 0x5

Look at the bold text.

So we’ll use 05

12. Putting it all together

So what we have is this:

Connector                00  08  00  00
ATY, Control Flags    04  02  00  00
Features                   00  01
Unknown                  00  00
Transmitter               02
Encoder                   04
Hotplug ID               02
Sense ID                  05

to give us:

00  08  00  00  04  02  00  00  00  01  00  00  02  04  02  05

13. So how do I get this working exactly?

Download HexEdit (Google it).

Backup /System/Library/Extensions/ATI6000Controller.kext

Open /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller with HexEdit

replace all instances of:

00  04  00  00  04  03  00  00  00  01  00  00  21  03  02  04

with:

00  08  00  00  04  02  00  00  00  01  00  00  02  04  02  05

Save your edited ATI6000Controller in a location that your are able to, as you won’t be able to save it in /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/

Open a terminal, and copy your saved ATI6000Controller to /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ using sudo

touch /System/Library/Extensions

Reboot.

Installing OS X Lion 10.7.4 on a Gigabyte X58A-UD3R Motherboard

I’ve been playing with Hackintoshes for quite a while now. Things have got a lot easier since the early days, but there are still a lot of quirks to it. The following is the installation procedure I followed for my set up. Of note is that I have a fairly problematic video card, based on the Radeon HD6670, mine is a Sapphire, PN 299-1E198-300SA.

Gather Your Prerequisites:

You will need:

  • An already functioning OS X machine (Easiest is to install 10.6 by following the procedures at http://tonymacx86.com for Snow Leopard)
  • An 8GB USB key for the installation media
  • Another USB key for the rest of what is required
  • myHack from http://myhack.sojugarden.com/
  • 10.7 installation media – You can buy this from Apple, or visit a torrent site
  • Your computer, based on an Gigabyte X58A-UD3R motherboard
  • From http://tonymacx86.comyou will need:
    • The correct DSDT for your board and BIOS version
    • Multibeast

Build Your Installation Media

If you don’t already have access to an OS X machine, build your Snow Leopard machine, or you can run up a VM. Once you have this going, follow the myHack instructions to build your installation binaries on the 8GB USB stick

Installing

When the Chameleon Bootloader starts counting down (While prompting you to hit any key to define boot parameters), go ahead an hit any key. If you don’t the boot WILL fail…

At the “Boot: ” prompt, type “-v -f cpus=1 arch=i386” – this also works as a general rule of thumb for ALL first-time boots.

Select your target, and let it build. Go and have a coffee. By the time you’ve finished your coffee, it will be asking you if you want to use a generic Extra directory – of course you do! Next it will ask if you want to remove the AppleTyMCEDriver.kext – May as well keep it. Do you want to remove the AppleUpstreamUserClient.kext? No…..I think we’ll keep that too……Restart when prompted

Configuring

When the Chameleon Bootloader starts counting down (While prompting you to hit any key to define boot parameters), go ahead an hit any key. If you don’t the boot WILL fail…

At the “Boot: ” prompt, type: “-v GraphicsEnabler=n cpus=1” (Minus the quotes)

Be prepared for much Matrix like crud scrolling on your screen. Eventually, you will get to the usual OS X initial account setup. Answer the questions. If you don’t know how to, give up, and go back to Windoze, OS X is not for you.

Right, you’ve got it booted, now the fun starts. There are a few initial considerations in order to achieve a clean boot, and also ensure that you can upgrade using the combo updater: The first is the DSDT. Remember that DSDT you downloaded for your board and firmware version? Copy it to the /Extra directory, ensuring it is named DSDT.aml. Remember, sudo is your friend. This will remove the requirement for the “cpus=1” boot flag. The second is to add some info specific to the Sapphire Radeon HD6670 graphics card. Edit /Extra/org.chameleon.Boot.plist, again, remember sudo is your friend. Just above the </dict> tag, add the following keys:

   <key>AtiConfig</key>
   <string>Pithecia</string>
   <key>AtiPorts</key>
   <string>3</string>

This will remove the requirement for the “GraphicsEnabler=No” boot flag, and ensure that you have a fully functioning graphics card Third, we want to be able to run the combo update without get a kernel panic. This requires a model identifier that is compatible, and the default model identifier (4,1) is not. So, again, editing org.chameleon.Boot.plist, just above the closing </dict> tag, add the following key:

    <key>SMBIOS</key>
    <string>/Extra/smbios.plist</string>

Now, add /Extra/smbios.plist – touch and edit, or just vi will do it. Give it the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>SMbiosversion</key>
    <string>MP51.007F.B03</string>
    <key>SMboardproduct</key>
    <string>Mac-F221BEC8</string>
    <key>SMfamily</key>
    <string>MacPro</string>
    <key>SMproductname</key>
    <string>MacPro5,1</string>
</dict>
</plist>

This will ensure that you can install the 10.7.4 combo update Now reboot. No boot flags required!

Combo Update and Kext Installation

OK, you’ve rebooted, you’ve got a flash OS X 10.7.0 Lion Hackintosh. You want 10.7.4, though. That’s easy, just run the combo updater you’ve already downloaded – Simple, isn’t it! Reboot Now, you’re ready to install the network, sound and SATA kexts. Note that you need to do this AFTER running the update. The updaters usually blow away the modified kexts.

Fire up Multibeast. Of note here is the Disk kext. You have two choices to make, “3rd Party SATA”, or “3rd Party eSATA”. Selecting “3rd Part SATA” will enable the eSATA ports, but they will not be hot-swappable. Using the eSATA option will make all of the SATA ports hot-swappable, except for those controlled by the Southbridge.  Make the following selections:

Multibeast Selections for X58A-UD3R

Reboot, and that’s it, all done!