diff options
author | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2006-09-30 15:14:42 +0200 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-10-04 00:49:49 +1000 |
commit | 14f6d58d4b5a277a68d9d8ddee7f79be2179f34f (patch) | |
tree | 0ece63e37d9c73be416487a1ac41f04aa9681f37 | |
parent | 4921228fb76ec26249aa0f6f0f1ddebf26661b82 (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.
(cherry picked from c979c7f87fc449cc9631820101edff82c3013e66 commit)
-rw-r--r-- | src/radeon_bios.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/radeon_bios.c b/src/radeon_bios.c index 1ea0550..7857ff1 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -46,6 +46,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, @@ -77,7 +78,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); |