Skip to contentSkip to conversation

Problem with radeon new ROM probe code

DISCUSSION Benjamin Herrenschmidt 4 participants 6 messages Sep 24, 2003 – Sep 25, 2003 1 message not in the archive Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hi Jon !

Your new code for looking at the card's ROM is causing a problem for me. On some cards, typically the "Mac" cards, the ROM doesn't contain an x86 BIOS, but rather an OF driver. The current code will blindly tap that, though it contains none of the expected tables, and will use completely wrong values.

Do you have ideas how to make some sanity checking on the ROM content ?

Ben.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw
Quoted 8 lines · Benjamin Herrenschmidt

Your new code for looking at the card's ROM is causing a problem for me. On some cards, typically the "Mac" cards, the ROM doesn't contain an x86 BIOS, but rather an OF driver. The current code will blindly tap that, though it contains none of the expected tables, and will use completely wrong values.

Do you have ideas how to make some sanity checking on the ROM content ?

The X radeon driver has this in RADEONGetBIOSParameters():

if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
	xfree(info->VBIOS);
	info->FPBIOSstart = 0;
	info->VBIOS = NULL;
	info->BIOSAddr = 0x00000000;
	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
		   "Video BIOS not found!\n");
    }
Signature · 9 lines
Earthling Michel Dänzer   \  Debian (powerpc), XFree86 and DRI developer
Software libre enthusiast  \     http://svcs.affero.net/rm.php?r=daenzer



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#2 lore raw
Quoted 8 lines · Michel Dänzer
Quoted 7 lines · Benjamin Herrenschmidt

Your new code for looking at the card's ROM is causing a problem for me. On some cards, typically the "Mac" cards, the ROM doesn't contain an x86 BIOS, but rather an OF driver. The current code will blindly tap that, though it contains none of the expected tables, and will use completely wrong values.

Quoted 5 lines
Quoted 1 line

Do you have ideas how to make some sanity checking on the ROM content ?

The X radeon driver has this in RADEONGetBIOSParameters():

if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {

We check that, but that isn't enough, an OF ROM will trigger that as well

Ben.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw
In reply to a message not in the archive
Quoted 2 lines · Jon Smirl

Is the 'Mac' card being used on a x86 machine?
I thought the ROM code was compiled out on non-X86 machines.

Notice that not all powerpc boxes are in this case. The pegasos at least includes an x86 emulator in the OF which runs the cards bios. I know that the amigaone does the same. So testing for powerpc may well not be enough for detecting OF cards.

Friendly,

Sven Luther

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#5 lore raw
Quoted 8 lines · Sven Luther
Quoted 2 lines · Jon Smirl

Is the 'Mac' card being used on a x86 machine?
I thought the ROM code was compiled out on non-X86 machines.

Notice that not all powerpc boxes are in this case. The pegasos at least includes an x86 emulator in the OF which runs the cards bios. I know that the amigaone does the same. So testing for powerpc may well not be enough for detecting OF cards.

Whether it's an Open Firmware card or not can be read from the PCI headers stored in the ROM. Check the romheaders utility from OpenBIOS CVS ( http://www.openbios.org/ )

Look at the code here:
http://cvs.openbios.org/cgi-dom/viewcvs.cgi/utils/romheaders.c?rev=1.2&content-type=text/vnd.viewcvs-markup

The program prints whether the rom is OpenFirmware, x86 or HP PA-Risc. Note that graphics cards can theoretically contain ROM images for both x86 and OF in one chip.

Stefan

Signature · 8 lines
Architecture Team
    SuSE Linux AG


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#6 lore raw
Quoted 11 lines

Whether it's an Open Firmware card or not can be read from the PCI headers stored in the ROM. Check the romheaders utility from OpenBIOS CVS ( http://www.openbios.org/ )

Look at the code here:
http://cvs.openbios.org/cgi-dom/viewcvs.cgi/utils/romheaders.c?rev=1.2&content-type=text/vnd.viewcvs-markup

The program prints whether the rom is OpenFirmware, x86 or HP PA-Risc. Note that graphics cards can theoretically contain ROM images for both x86 and OF in one chip.

Yup, "Mac" cards can contain in theory both OF and x86 BIOS drivers, though I yet have to find a vendor doing that....

Thanks for the pointers to code, I'll dig that out.

Regards,
Ben.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf