summaryrefslogtreecommitdiff
path: root/src/radeon_bios.c
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger_lists@hispeed.ch>2006-09-30 15:14:42 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2006-09-30 15:14:42 +0200
commitc979c7f87fc449cc9631820101edff82c3013e66 (patch)
treee448d30e59445830174b0f619053027f11a8216f /src/radeon_bios.c
parent37c114acbabe35881c39642e293519e2635907aa (diff)
radeon: Check ROM more thoroughly before treating it as an x86 BIOS.
This prevents the ROMs on some Mac cards getting treated as x86 BIOSen, resulting in garbage values.
Diffstat (limited to 'src/radeon_bios.c')
-rw-r--r--src/radeon_bios.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index a4597219..38a5f8b5 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -45,6 +45,7 @@ Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
int tmp;
+ unsigned short dptr;
if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -76,7 +77,22 @@ Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
xfree (info->VBIOS);
info->VBIOS = NULL;
return FALSE;
- }
+ }
+
+ /* Verify it's an x86 BIOS not OF firmware, copied from radeonfb */
+ dptr = RADEON_BIOS16(0x18);
+ /* If PCI data signature is wrong assume x86 video BIOS anyway */
+ if (RADEON_BIOS32(dptr) != (('R' << 24) | ('I' << 16) | ('C' << 8) | 'P')) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "ROM PCI data signature incorrect, ignoring\n");
+ }
+ else if (info->VBIOS[dptr + 0x14] != 0x0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Not an x86 BIOS ROM image, BIOS data will not be used\n");
+ xfree (info->VBIOS);
+ info->VBIOS = NULL;
+ return FALSE;
+ }
if (info->VBIOS) info->ROMHeaderStart = RADEON_BIOS16(0x48);