summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-10-02 14:45:12 -0700
committerKeith Packard <keithp@keithp.com>2008-10-02 14:45:12 -0700
commitf1dbc266ccfe26c6b9a272e40a5bbe9afaa4f2e0 (patch)
treee59d1c140cd03392aed419e677060bac949c30c9
parent8304b405e0dc2f31fd2d2fd82e150ba502ab74e2 (diff)
Work around libpciaccess reporting a 0 rom size by guessing.
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.
-rw-r--r--src/i830_bios.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 726fe30f..007530dc 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -159,6 +159,8 @@ parse_general_features(I830Ptr pI830, struct bdb_header *bdb)
}
}
+#define INTEL_VBIOS_SIZE (64 * 1024) /* XXX */
+
/**
* i830_bios_init - map VBIOS, find VBT
*
@@ -182,25 +184,35 @@ 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));
+ xfree (bios);
return -1;
+ }
#else
/* xf86ReadPciBIOS returns the length read */
ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
- if (ret <= 0)
+ if (ret <= 0) {
+ xfree (bios);
return -1;
+ }
#endif
vbt_off = INTEL_BIOS_16(0x1a);