[Intel-gfx] [PATCH] Eliminate INT10 call to get BIOS contents

Eric Anholt eric at anholt.net
Thu Oct 2 23:30:49 CEST 2008


On Wed, 2008-10-01 at 16:36 -0700, Keith Packard wrote:
> On Mon, 2008-09-29 at 19:09 -0700, Keith Packard wrote:
> > Here's another pass at this patch, it moves the remaining vbe defines to
> > i810.h to make sure no modern driver can use them. It also error-checks
> > the return from the BIOS read functions in case something bad happens
> > there. Please take a look, send comments and test results.
> 
> Sigh. I think I must have posted the first patch here; let me try this
> again. Thanks, Eric, for noticing that I didn't manage to actually post
> the new patch.

I required the following patch on top of this to work around
libpciaccess brokenness.  libpciaccess reports 0 rom size if there's no
rom resource, even if the rom file exists in sysfs.

From b7f90cce7d056f8061a85dafd8003152d6b34a58 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric at anholt.net>
Date: Thu, 2 Oct 2008 14:25:50 -0700
Subject: [PATCH] Work around libpciaccess reporting a 0 rom size by
guessing.

---
 src/i830_bios.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/i830_bios.c b/src/i830_bios.c
index fbc7707..a4b0e28 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -158,6 +158,8 @@ parse_general_features(I830Ptr pI830, struct
bdb_header *bdb)
     }
 }
 
+#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
+
 /**
  * i830_bios_init - map VBIOS, find VBT
  *
@@ -181,20 +183,27 @@ i830_bios_init(ScrnInfoPtr pScrn)
 
 #if XSERVER_LIBPCIACCESS
     size = pI830->PciInfo->rom_size;
+    if (size == 0) {
+	size = INTEL_VBIOS_SIZE;
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "libpciaccess reported 0 rom size, guessing %dkB\n",
+		   size / 1024);
+    }
 #else
-#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
     size = INTEL_VBIOS_SIZE;
 #endif
-    if (size == 0)
-	return -1;
     bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
 #if XSERVER_LIBPCIACCESS
     ret = pci_device_read_rom (pI830->PciInfo, bios);
-    if (ret != 0)
+    if (ret != 0) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "libpciaccess failed to read %dkB video BIOS: %s\n",
+		   size / 1024, strerror(-ret));
 	return -1;
+    }
 #else
     /* xf86ReadPciBIOS returns the length read */
     ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
-- 
1.5.6.3



-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081002/98914f60/attachment.sig>


More information about the Intel-gfx mailing list