Jump to content

Editing custom personalities for ATI Radeon HD[45]xx


  • Please log in to reply
765 replies to this topic

#641
k3nny

k3nny

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 560 posts
  • Gender:Male
Hi,

I want to share my results for the XFX Radeon HD 7870 DD (Device Id: 1002 6818, Subsystem Id: 1682 3250):

Connectors: 2x DVI, 2x MiniDP, 1x HDMI

(1) DVI 1:
04000000-14020000-0001-0100-10-00-01-06
(2) DVI 2:
04000000-14020000-0001-0200-21-03-02-05
(3) HDMI:
00080000-04020000-0001-0300-11-02-03-03
(4) MiniDP 1:
00040000-04030000-0001-0400-12-04-04-01
(5) MiniDP 2:
00040000-04030000-0001-0500-22-05-05-02

Find in ATI7000Controller (FB "Chutoro", 5 ports):
0200000000010000090101001204030300040000040300000001020011020101000400000001000000090300210302020004000000010000000904002205040400040000040300000001050010000505
Replace with:
0400000014020000000101001000010604000000140200000001020021030205000800000402000000010300110203030004000004030000000104001204040100040000040300000001050022050502


#642
myradon

myradon

    InsanelyMac Protégé

  • Members
  • Pip
  • 20 posts
  • Gender:Male
I've got a question concerning patching my Sapphire ATI 5770 with Vervet personality? 2nd screen has loads of artifacts after (re)booting. When I reconnect or fiddle with screen-resolutions artfiacts are gone. After reboot bam {censored} again. I followed Alexander's [Guide] Getting XFX HD6850 connectors to work to the letter, i mean I believe I did but doesn't help for 2nd screen artifacts. I did connector-patching in Clover bootloader confg.plist.

Ati-personality.pl dump
Personality: Vervet
ConnectorInfo count in decimal: 4
Disk offset in decimal 166224
0000000 00 04 00 00 00 04 00 00 00 71 00 00 12 04 04 02
0000010 04 00 00 00 14 00 00 00 00 71 00 00 01 12 01 04
0000020 00 02 00 00 14 00 00 00 00 71 00 00 00 00 06 03
0000030 00 08 00 00 00 02 00 00 00 71 00 00 22 05 05 01

Output radeon_bios_decoder
mercury:~ raymond$ sudo /Users/raymond/Desktop/radeon_bios_decode < /Volumes/efi/EFI/misc/c0000.bin
ATOM BIOS Rom:
SubsystemVendorID: 0x174b SubsystemID: 0x1482
IOBaseAddress: 0xe000
Filename: 148X0300.S26
BIOS Bootup Message:
JUNIPER BIOS UCODEv:126													
PCI ID: 1002:68b8
Connector at index 0
Type [@offset 44576]: DisplayPort (10)
Encoder [@offset 44580]: INTERNAL_UNIPHY2 (0x21)
i2cid [@offset 44704]: 0x91, OSX senseid: 0x2 <-- 02
Connector at index 1
Type [@offset 44586]: HDMI-A (11)
Encoder [@offset 44590]: INTERNAL_UNIPHY2 (0x21)
i2cid [@offset 44731]: 0x90, OSX senseid: 0x1 <-- 01
Connector at index 2
Type [@offset 44596]: DVI-I (2)
Encoder [@offset 44600]: INTERNAL_UNIPHY1 (0x20)
i2cid [@offset 44768]: 0x93, OSX senseid: 0x4 <-- 04
Connector at index 3
Type [@offset 44606]: DVI-I (2)
Encoder [@offset 44610]: INTERNAL_KLDSCP_DAC2 (0x16)
i2cid [@offset 44768]: 0x93, OSX senseid: 0x4 <-- 04
Connector at index 4
Type [@offset 44616]: DVI-I (2)
Encoder [@offset 44620]: INTERNAL_UNIPHY (0x1e)
i2cid [@offset 44805]: 0x92, OSX senseid: 0x3 <-- 03
Connector at index 5
Type [@offset 44626]: DVI-I (2)
Encoder [@offset 44630]: INTERNAL_KLDSCP_DAC1 (0x15)
i2cid [@offset 44805]: 0x92, OSX senseid: 0x3 <-- 03

Output redsock_bios_decoder
mercury:~ raymond$ sudo /Users/raymond/Desktop/redsock_bios_decoder < /Volumes/efi/EFI/misc/c0000.bin
148X0300.S26:
JUNIPER BIOS UCODEv:126													
Subsystem Vendor ID: 174b
	 Subsystem ID: 1482
Object Header Structure Size: 413
Connector Object Table Offset: 52
Router Object Table Offset: 0
Encoder Object Table Offset: 12c
Display Path Table Offset: 12
Connector Object Id [19] which is [DISPLAY_PORT]
encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false
Connector Object Id [12] which is [HDMI_TYPE_A]
encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x22 [duallink 0x2] enc 0x5)] linkb: true
Connector Object Id [2] which is [DVI_I]
encoder obj id [0x20] which is [INTERNAL_UNIPHY1 (osx txmit 0x11 [duallink 0x1] enc 0x2)] linkb: false
Connector Object Id [2] which is [DVI_I]
encoder obj id [0x16] which is [INTERNAL_KLDSCP_DAC2] linkb: false
Connector Object Id [2] which is [DVI_I]
encoder obj id [0x1e] which is [INTERNAL_UNIPHY (osx txmit 0x10 [duallink 0x0] enc 0x0)] linkb: false
Connector Object Id [2] which is [DVI_I]
encoder obj id [0x15] which is [INTERNAL_KLDSCP_DAC1 (osx txmit 0x00 enc 0x10?)] linkb: false

So I came up with this modified personality;

0000000 00 04 00 00 00 04 00 00 00 71 00 00 12 04 04 02
0000010 04 00 00 00 14 00 00 00 00 71 00 00 11 02 01 04
0000020 04 00 00 00 14 00 00 00 00 71 00 00 10 00 06 03
0000030 00 08 00 00 00 02 00 00 00 71 00 00 22 05 05 01

Injection with Clover
	 <key>ATIConnectorsController</key>
<string>5000</string>
<key>ATIConnectorsData</key>
<string>000000000040000000400000071000012040402000001004000000140000000071000001120104000002000020000140000000071000000000603000003000080000000200000071000022050501</string>
<key>ATIConnectorsPatch</key>
<string>000000000040000000400000071000012040402000003000080000000200000071000022050501000002004000000140000000071000010000603000001004000000140000000071000011020104</string>

Okay I know both DVI's are duallink cause my 27" 2560x1440px works on both ports, when only connecting 1 screen. I didn't alter HDMI and DP connector-IDs, only DVI's where not okay. I tried PCIRootUID=0/1, GraphicsInjector=Yes/No, FBName=Vervet is in. I also tried boot-args=WithKexts to be sure kext will be patched. I'm out of ideas Anyone got some real intelligent remark :superman: ?!

#643
mclaughlin

mclaughlin

    InsanelyMac Protégé

  • Members
  • Pip
  • 2 posts
Edit: Moved post as a new thread to Graphics Cards->Ati : http://www.insanelym...nalitypl-issue/

#644
elmad

elmad

    InsanelyMac Protégé

  • Members
  • Pip
  • 4 posts

Hope this helps others with non-working ports or with HDMI audio problems.
Questions/comments?


Hi,
this is my first message and I have an uncommon question. In first instance, thank you for your info & job.

I had a problem with my laptop and I think that the problem is that video bios was corrupted. Surfing the web for infos I came in this forum where I found precious informations. Now I'd like to use your tool "radeon_bios_decode" on the dump of my corrupted bios to analyze it, but I haven't an OsX installation to execute it.

Could you release open source code or something else that I can run on linux? Or could you suggest me a way to run your code on linux?


Best regards

#645
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male
I did already post the source in this very thread, here: http://www.insanelym...ost__p__1843525
(Zero feedback from anyone on that BTW). The code builds fine under linux last I touched it.

From linux, you can just run your X server with debug logging and see much of the same details.

I do think my model of parsing the bios details from a file is preferable for analysis to parsing the bios at run time from a driver (or bootloader).

#646
elmad

elmad

    InsanelyMac Protégé

  • Members
  • Pip
  • 4 posts

I did already post the source in this very thread, here: http://www.insanelym...ost__p__1843525
(Zero feedback from anyone on that BTW). The code builds fine under linux last I touched it.

From linux, you can just run your X server with debug logging and see much of the same details.

I do think my model of parsing the bios details from a file is preferable for analysis to parsing the bios at run time from a driver (or bootloader).


Thank you very much, the code built fine.

As I supposed, my problem seems a bios corruption. LVDS connector is missing. Here is the output of radeon-bios-decode:

ATOM BIOS Rom:
    SubsystemVendorID: 0x1028 SubsystemID: 0x02be
    IOBaseAddress: 0x2000
    Filename: BR32787.001
    BIOS Bootup Message:
BR32787-001 M92 GDDR3 64bit 500e/800m									   

PCI ID: 1002:9553
Connector at index 0
    Type [@offset 45712]: VGA (1)
    Encoder [@offset 45716]: INTERNAL_KLDSCP_DAC1 (0x15)
    i2cid [@offset 45774]: 0x95, OSX senseid: 0x6
Connector at index 1
    Type [@offset 45722]: HDMI-A (11)
    Encoder [@offset 45726]: INTERNAL_UNIPHY (0x1e)
    i2cid [@offset 45797]: 0x91, OSX senseid: 0x2



I dont know why, but it's happened when I used on linux "radeontool light off". Now, if I can ask, what way could you suggest me:

1. Copy the bios from a working laptop (equal model, a friend brought one in the same time).
2. Rebuild in some way the LVDS connector info on my bios.

#647
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

I dont know why, but it's happened when I used on linux "radeontool light off". Now, if I can ask, what way could you suggest me:

1. Copy the bios from a working laptop (equal model, a friend brought one in the same time).
2. Rebuild in some way the LVDS connector info on my bios.

If it was me, I'd first get to the bottom of exactly how radeontool corrupted the video bios, to be sure it's really corrupted. Maybe it's something more basic like the discrete video got turned off in your bios config? Looks to me like radeontool just does some DMA to the device which shouldn't result in the bios magically being reflashed. Normally you have to write a magic pattern to memory to initiate a flash, it wouldn't just happen by accident. You did of course power cycle the system fully?
Next, your laptop vendor may have a bios/firmware update you could use that would update the video bios.
Failing that, I think, yes, you could copy the bios from a system running the exact same bios revision as what you have. I'd verify matching version numbers with radeon_bios_decode of the other system's bios before trying to flash it yourself.

#648
elmad

elmad

    InsanelyMac Protégé

  • Members
  • Pip
  • 4 posts

If it was me, I'd first get to the bottom of exactly how radeontool corrupted the video bios, to be sure it's really corrupted. Maybe it's something more basic like the discrete video got turned off in your bios config? Looks to me like radeontool just does some DMA to the device which shouldn't result in the bios magically being reflashed. Normally you have to write a magic pattern to memory to initiate a flash, it wouldn't just happen by accident. You did of course power cycle the system fully?
Next, your laptop vendor may have a bios/firmware update you could use that would update the video bios.
Failing that, I think, yes, you could copy the bios from a system running the exact same bios revision as what you have. I'd verify matching version numbers with radeon_bios_decode of the other system's bios before trying to flash it yourself.


I'm not 100% sure about how it's happened, but here is the output from my friend bios:

ATOM BIOS Rom:
SubsystemVendorID: 0x1028 SubsystemID: 0x02be
IOBaseAddress: 0x2000
Filename: BR32787.001
BIOS Bootup Message:
BR32787-001 M92 GDDR3 64bit 500e/800m									
PCI ID: 1002:9553
Connector at index 0
Type [@offset 45712]: VGA (1)
Encoder [@offset 45716]: INTERNAL_KLDSCP_DAC1 (0x15)
i2cid [@offset 45774]: 0x95, OSX senseid: 0x6
Connector at index 1
Type [@offset 45722]: HDMI-A (11)
Encoder [@offset 45726]: INTERNAL_UNIPHY (0x1e)
i2cid [@offset 45797]: 0x91, OSX senseid: 0x2
Connector at index 2
Type [@offset 45732]: LVDS (7)
Encoder [@offset 45736]: INTERNAL_UNIPHY2 (0x21)
i2cid [@offset 45824]: 0x90, OSX senseid: 0x1

As you can see here there is info on LVDS connector that instead on my bios is missing. Now only VGA and HDMI connectors work in my laptop.

I tried to flash this bios, but every tool that I tried failed. Atiflash from dos, atiwinflash from windows7, I tried with linux but rom sysfs file is read-only. Maybe I can try to write some register with radeontool but I dont know what register.

And Dell didnt release any bios update tool for graphic card. I am on a blind spot now.

#649
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

I'm not 100% sure about how it's happened, but here is the output from my friend bios:

I'd still try to get to the bottom of that before proceeding if it was me. Last I tried, atiflash worked for me, but I don't use mobile ati hardware.
I would check netkas's forum for info on what's current with ati flashing tools, as those guys seem to flash their cards regularly (I don't).
Those bioses look like an exact match, maybe you should do a binary comparison to see if you can figure out whether just a couple bytes got clobbered in yours or what.


#650
elmad

elmad

    InsanelyMac Protégé

  • Members
  • Pip
  • 4 posts

I'd still try to get to the bottom of that before proceeding if it was me. Last I tried, atiflash worked for me, but I don't use mobile ati hardware.[/size]
I would check netkas's forum for info on what's current with ati flashing tools, as those guys seem to flash their cards regularly (I don't).
Those bioses look like an exact match, maybe you should do a binary comparison to see if you can figure out whether just a couple bytes got clobbered in yours or what.


Thank you for your time.

Finally I fixed it. The video bios wasn't corrupted. I learnt that in my laptop video bios was flashed inside the system bios.

But something was corrupted and this was... the EEPROM of LCD panel! I don't know how radeontool corrupted the eeprom, but I think that was it to corrupt the EDID informations. Video bios seemed corrupted because in some way, at the boot, the notebook disabled at runtime LVDS output in the video bios, because of the corrupted EDID. I fixed the EDID byte by byte comparing to the standard EDID and to EDID from my friend's LCD panel. To access it I had to boot my laptop with the working LCD panel and when the system was on I swapped LCD panel with my panel. In this way LCD was on and working, and I analyzed its EEPROM and fixed by i2c-bus.

Hard work, but now I know something more :)

Thank you for your replies.

#651
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male
Interesting. Since your EDID is something that is checked at run-time, then you were looking at a shadow copy of your bios in ram, and you never had a dump of your actual bios. Glad you got the underlying problem figured out.

#652
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,176 posts
  • Gender:Male
  • Location:Moscow

I did already post the source in this very thread, here: http://www.insanelym...ost__p__1843525
(Zero feedback from anyone on that BTW). The code builds fine under linux last I touched it.

No feedback because I have nothing to report. The idea to add something into bootloader remains idea only.

#653
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

No feedback because I have nothing to report. The idea to add something into bootloader remains idea only.

For this kind of involved patching to OSX, I believe it's best to keep the smarts out of the bootloader. But I know some have the motivation to keep /S/L/E unmodified and wish the bootloader to do all the actual patching on the fly at every boot. For that scenario, perhaps we can standardize on an xml patch file syntax (that is not boot loader specific) that can provide this. Something general purpose that could be used for any hackintosh kext changes. Maybe bsdiff encapsulated in xml for binary patches, and a lighter weight match/replace for text diffs. I know clover has some of my patches built-in but the syntax is clover-specific. If there was a standard general purpose patch syntax we could agree upon then scripts like the one here could just generate the patch config for the bootloader.

#654
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,176 posts
  • Gender:Male
  • Location:Moscow
I think this is very common syntax for kext patching
  <key>KextsToPatch</key>
  <array>
   <dict>
    <key>Name</key>
    <string>VoodooHDA</string>
    <key>Find</key>
    <data>SGVhZHBob25lcwA=</data>
    <key>Replace</key>
    <data>VGVsZXBob25lcwA=</data>
   </dict>
   <dict>
    <key>Name</key>
    <string>AppleHDAController</string>
    <key>Comment</key>
    <string>Patch_to_not_load_this_driver</string>
    <key>InfoPlistPatch</key>
    <true/>
    <key>Find</key>
    <string>0x04020000</string>
    <key>Replace</key>
    <string>0x44220000</string>
   </dict>
   <dict>
    <key>Name</key>
    <string>IOBlockStorage</string>
    <key>Find</key>
    <data>TA==</data>
    <key>Replace</key>
    <data>TA==</data>
   </dict>
   <dict>
    <key>Name</key>
    <string>AppleAHCIPort</string>
    <key>Find</key>
    <data>RXh0ZXJuYWw=</data>
    <key>Replace</key>
    <data>SW50ZXJuYWw=</data>
   </dict>
  </array>
Do you want more keys?

#655
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

I think this is very common syntax for kext patching

I don't think this clover syntax is sufficient to be a general purpose solution for supporting add/change/delete operations on the system kexts.
  • For adding to kexts, such as adding a plugin, you'd likely want the kext name to include the path to the kext. Textual additions to kexts (such as Info.plist-only kext additions) would be a lot more legible if the addition wasn't encoded in binary.
    Some examples: an Info.plist that contains most of one's codec specific AppleHDA plist changes, support for one of the ethernet drivers that isn't included in the base OS
  • For changing kexts, such as your patch example, you'd want to reference the script or thread that can be used to maintain the patch across releases. Also a range of OSX release numbers and or kext version numbers for which the patch is known to apply would help. The patch syntax should probably also provide for multiple different versions of the patch depending upon the versions. (At least with enough version information to handle the version of OSX currently running and the version of OSX that the system will boot into next).
    Some examples: My AppleHDA patch that varies depending upon OSX version but where the perl script works across a wide range of releases.
    Likewise for my AppleACPIPlatform patch for the nvidia mcp79 chipset.
    The CMOS reset patch could be handled this way as well (instead of having information about the support thread and versioning details hardcoded in the clover source).
  • For deleting, perhaps these can all be handled by modifying the kext match clauses, but it would be more failsafe to just effectively delete the kext (then you don't have to worry about changes in the kext's personality lists from release to release).


#656
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,176 posts
  • Gender:Male
  • Location:Moscow
Bootloaders can't modify kexts because HFS+ drivers are read-only. It is possible to create RW driver but this is not still happen.
A possible way is to write an startup script.... No! Kexts already loaded.
If you want to do patch for a kext then you can do it once or at every boot on the fly.

Other question. Will your method work with UEFI compatible VBIOS? My attempt with 7850 failed.

#657
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

Bootloaders can't modify kexts because HFS+ drivers are read-only.

Bootloaders effectively can; clover does exactly this in kext_patcher.c, which is the model I thought we were discussing as a starting point.

It is possible to create RW driver but this is not still happen.

HFS+ is read/write in linux open source, changes could be ported into UEFI code if one desired. Even hfs+ journaling has opensource support at this point (complete enough for an efi solution at least).

Other question. Will your method work with UEFI compatible VBIOS? My attempt with 7850 failed.

What problem are you having, decoding the connector info from the bios or patching the osx kext? I would think the later would work independent of whether the card was started up in uefi mode.
Personally I haven't used my radeon hd in about 2 years (gave it away actually). I could check with the person who has it now, as it's in a system with UEFI system bios at this point. But I'm not sure if that's what you mean.

#658
MJKhaani

MJKhaani

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts
  • Gender:Male

Sir, Many thanks for your guide. I'm trying to patch my personality to get LDVS working, Unsuccessful until now :( . I have some questions, if you answer them I'll be glad.

 

I use "Pithecia" frame buffer and it work with VGA and with 2 port matched (ATY_ActiveFlags = 10), Port 0 and 1. VGA works perfect and LDVS shows black screen with brightness control working. When I switch from VGA to LDVS, Screen become distorted, But cursor works fine and shown normally.

 

1. Are the port number of personalities In IOReg ( like Port@0 ), shows index of personalities (from top to down)? If it's true ConnectorType of Port 0 & 1 are not indicate to VGA!? So how VGA works?

Personality: Pithecia

0000000    00  04  00  00  04  03  00  00  00  01  00  00  21  03  02  04  >Port@0

0000010    04  00  00  00  14  02  00  00  00  01  00  00  00  00  04  03  >Port@1

0000020    10  00  00  00  10  00  00  00  00  01  00  00  00  00  00  01  >Port@2

 

2.When I change one of personalities it cause to load default frame buffer (AMD,FrameBuffer ...) instead of "Pithecia". Why?

Asus K54HR SEYMOUR M2 XTX 
DDR3                                             
Subsystem Vendor ID: 1043       Subsystem ID: 2002
Object Header Structure Size: 199
Connector Object Table Offset: 34
Router Object Table Offset: 0
Encoder Object Table Offset: 99
Display Path Table Offset: 12

Connector Object Id [14] which is [LVDS] 
        encoder obj id [0x1e] which is [INTERNAL_UNIPHY (osx txmit 0x10 [duallink 0x0] enc 0x0)] linkb: false
Connector Object Id [12] which is [HDMI_TYPE_A]
        encoder obj id [0x20] which is [INTERNAL_UNIPHY1 (osx txmit 0x21 [duallink 0x1] enc 0x3)] linkb: true
Connector Object Id [5] which is [VGA]
        encoder obj id [0x15] which is [INTERNAL_KLDSCP_DAC1 (osx txmit 0x00 enc 0x10?)] linkb: false

Sorry for my English.



#659
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male
Again, I don't use ATI mobility hardware, so I have no first hand experience getting LVDS ports working with this driver. There is a separate thread for ATI mobility support.
The order that ports show up in the ioregistry doesn't necessarily match the order of ConnectorInfo found in the personality.

#660
MJKhaani

MJKhaani

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts
  • Gender:Male

Again, I don't use ATI mobility hardware, so I have no first hand experience getting LVDS ports working with this driver. There is a separate thread for ATI mobility support.
The order that ports show up in the ioregistry doesn't necessarily match the order of ConnectorInfo found in the personality.

Thank you very much :thumbsup_anim:







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy