Skip to content

Legacy BIOS

Ausdauersportler edited this page Apr 16, 2022 · 11 revisions

This sections describes what you find in general on a PC Laptop MXM card and what tools are needed to make the vBIOS iMac compatible. The AMD BIOS contains in general two parts, the first is called legacy BIOS responsible for all functionality containing data and code for a number or modules, like the VRAM_INFO (responsible for VRAM type support). In general one can assume that the BIOS coming with a card already supports all hardware including the VRAM chips. We will focus on this first part here.

Basic structure of the legacy part.

  • header
  • tables of functional modules
  • vga bios itself
  • data of functional modules
  • code of functional modules

Tools to analyze:

  • atomdis (prints out module table structure and addresses
  • ATOMTableResuze (allow to change complete modules and recalculates the CRC32 checksum)

So very first step will be adjusting the output connector table (OBJ_INFO module) within the legacy BIOS part. This is in general necessary because the PC cards have been used in Laptops with different hardware and different video ports. We need at least one connector of type eDP with correct parameters, and another of type DP to drive the external (miniDP) connected monitor. Only in a single case the BIOS came already correctly configured.

More details to follow ...

some basics

The usable storage of the BIOS has a fixed length of 0x20000 bytes (131072 in decimal) regardless which chip size you may find on physical MXM cards. These 0x20000 bytes are divided in 256 blocks of 512 bytes. So all BIOS parts together (legacy and GOP and possible other parts) cannot exceed this 256 blocks. In general both the legacy and GOP part have nearly equal size near 120 blocks, which leaves literally no space for additional parts (aka code).

The internal structure demands to start on block boundaries, this is why you always start replace actions at the very same spot or you have to cross check if the starting address were you insert the new BIOS part is a multiple of 512 (byte).

All BIOS parts have a header starting with AA55 and a PCI data structure, short body, starting with PCIR. Even without the help of the pci_option_rom template of Hex Fiend one will find those points in the BIOS.

Recognizing the BIOS structure in Hex Fiend using the PCI_OPTIONS_ROM template

You can see the length of legacy BIOS part counted in blocks is mentioned two times within the print out on the right hand side, in the ROM Header 0 it is called Image Size (79) and within the PCI Data Structure it is called Image Length (79, too). In case you manually modify the BIOS cutting away parts you have to manually recalculate the new block size (measured in 512 byte) and change both entries. In the last step use ATOMTableResize to recalculate the checksum.

You may have noticed from the upper picture that there is a Last Image Index marked. If it has the value 0x80 the computer stops reading/interpreting code after that part. If you add additional parts you have to make sure, the last part has the value 0x80, all former ones the value 0x00. It is quite easy. If you want to disable training parts from being used just set the Last Image Index in the last module you want to use to 0x80 and recalculate the checksum (only if it is the first legacy part you have altered). The first part has an index value of 0x00, the latter GOP part an index value of 0x80. We will see EFI BIOS versions having four such parts.

The checksum does only apply to the first legacy part. Whenever you change data there a recalculation is necessary. Changing the next parts does not change the checksum at all!

use ATOMTableResize to replace modules and recalculate the CRC32 checksum of the legacy part

You can mix and match modules found within the legacy BIOS of a common AMD GPU family (e.g. Venus) using this software. So if you already have adjusted the OBJ_INFO module responsible for connector settings to drive the iMac internal display you can pull this module out of a working BIOS and transplant it into a currently non working vBIOS of the same family. In fact I used the OBJ_INFO module found in the W5170M BIOS from a blue AMD card later for all other cards to enable the backlight on internal display on iMacs (here a green HP W5170M, a red Dell M5100 and finally a blue MXM-B M6000). This is the most easy way to get this most important part done.

The same applies to adjustment for VRAM support. As you may have noticed there are mostly three suppliers of VRAM, Samsung, Hynix and Micron/Elpida. Not all BIOS versions support all memory types from the start. If you want to add support for a new card of the same family with different VRAM chips just pull the VRAM_INFO module out of the BIOS coming with that new card and replace it in the already working iMac BIOS. It is that easy.

After replacing modules always save the file either by pressing save or save and fix everything. This way the address tables are rebuild and the checksum will be updated-

use Hex Fiend to manually edit the OBJ_INFO module to adjust the connector settings

This is the dark art ....