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.