- disable rom reading fallbacks
This commit is contained in:
parent
d1d2442b6c
commit
3c14e49c47
60
libpciaccess-0.10.6-no-rom-fallback.patch
Normal file
60
libpciaccess-0.10.6-no-rom-fallback.patch
Normal file
@ -0,0 +1,60 @@
|
||||
From 57cf6f1f428ab73fb2a88c39c694e7d14c2c96c6 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Airlie <airlied@redhat.com>
|
||||
Date: Thu, 6 Aug 2009 09:39:01 +1000
|
||||
Subject: [PATCH] pciaccess: make linux rom reading fallback optional
|
||||
|
||||
On kernels which have ROM files, the boot VGA rom file
|
||||
will contain the 0xc0000 file anyways. If another card
|
||||
is missing a rom file there is no need for this.
|
||||
|
||||
This is fallback is disabled by default, on the premise
|
||||
that distro shipping this new a pciaccess will be running
|
||||
on kernels with working rom support which is been upstream
|
||||
for a long time
|
||||
---
|
||||
configure.ac | 8 ++++++++
|
||||
src/linux_sysfs.c | 5 +++++
|
||||
2 files changed, 13 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index c55112c..528e32b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -43,6 +43,14 @@ AC_ARG_WITH(pciids-path, AC_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
|
||||
[Path to pci.ids file]), [pciids_path="$withval"])
|
||||
AC_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids])
|
||||
|
||||
+AC_ARG_ENABLE(linux-rom-fallback, AS_HELP_STRING([--enable-linux-rom-fallback],
|
||||
+ [Enable support for falling back to /dev/mem for roms (default: enabled)]),
|
||||
+ [LINUX_ROM=$enableval],[LINUX_ROM=no])
|
||||
+
|
||||
+if test "x$LINUX_ROM" = xyes; then
|
||||
+ AC_DEFINE(LINUX_ROM, 1, [Linux ROM read fallback])
|
||||
+fi
|
||||
+
|
||||
use_zlib=no
|
||||
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],
|
||||
[Enable zlib support to read gzip compressed pci.ids]),
|
||||
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
|
||||
index 65e1cf6..02fbd13 100644
|
||||
--- a/src/linux_sysfs.c
|
||||
+++ b/src/linux_sysfs.c
|
||||
@@ -327,10 +327,15 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
|
||||
|
||||
fd = open( name, O_RDWR );
|
||||
if ( fd == -1 ) {
|
||||
+#ifdef LINUX_ROM
|
||||
/* If reading the ROM using sysfs fails, fall back to the old
|
||||
* /dev/mem based interface.
|
||||
+ * disable this for newer kernels using configure
|
||||
*/
|
||||
return pci_device_linux_devmem_read_rom(dev, buffer);
|
||||
+#else
|
||||
+ return errno;
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
1.5.4.1
|
||||
|
@ -1,41 +0,0 @@
|
||||
diff -up libpciaccess-0.10.6/src/linux_devmem.c.jx libpciaccess-0.10.6/src/linux_devmem.c
|
||||
--- libpciaccess-0.10.6/src/linux_devmem.c.jx 2008-10-15 18:35:54.000000000 -0400
|
||||
+++ libpciaccess-0.10.6/src/linux_devmem.c 2009-08-05 11:43:14.000000000 -0400
|
||||
@@ -50,6 +50,30 @@
|
||||
#include "pciaccess_private.h"
|
||||
#include "linux_devmem.h"
|
||||
|
||||
+static int
|
||||
+rom_sanity_check(struct pci_device *info, void *buffer)
|
||||
+{
|
||||
+ unsigned char *bios = buffer;
|
||||
+ int offset;
|
||||
+ unsigned short vendor, device;
|
||||
+
|
||||
+ if (bios[0] != 0x55 || bios[1] != 0xAA)
|
||||
+ return 0;
|
||||
+
|
||||
+ offset = (bios[0x19] << 8) + bios[0x18];
|
||||
+
|
||||
+ if (bios[offset] != 'P' ||
|
||||
+ bios[offset+1] != 'C' ||
|
||||
+ bios[offset+2] != 'I' ||
|
||||
+ bios[offset+3] != 'R')
|
||||
+ return 0;
|
||||
+
|
||||
+ vendor = (bios[offset+5] << 8) + bios[offset+4];
|
||||
+ device = (bios[offset+7] << 8) + bios[offset+6];
|
||||
+
|
||||
+ return (info->vendor_id == vendor) && (info->device_id == device);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Read a device's expansion ROM using /dev/mem.
|
||||
*
|
||||
@@ -152,5 +176,5 @@ pci_device_linux_devmem_read_rom(struct
|
||||
}
|
||||
}
|
||||
|
||||
- return err;
|
||||
+ return !rom_sanity_check(dev, buffer);
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
|
||||
Name: libpciaccess
|
||||
Version: 0.10.6
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: PCI access library
|
||||
|
||||
Group: System Environment/Libraries
|
||||
@ -21,7 +21,7 @@ Patch0: libpciaccess-fd-cache.patch
|
||||
Patch2: libpciaccess-rom-size.patch
|
||||
Patch3: libpciaccess-boot-vga.patch
|
||||
Patch4: libpciaccess-vga-arbiter.patch
|
||||
Patch5: libpciaccess-0.10.6-rom-sanity.patch
|
||||
Patch5: libpciaccess-0.10.6-no-rom-fallback.patch
|
||||
|
||||
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
|
||||
Requires: hwdata
|
||||
@ -45,7 +45,7 @@ Development package for libpciaccess.
|
||||
%patch2 -p1 -b .rom-size
|
||||
%patch3 -p1 -b .bootvga
|
||||
%patch4 -p1 -b .vgaarb
|
||||
%patch5 -p1 -b .jx
|
||||
%patch5 -p1 -b .romfall
|
||||
|
||||
%build
|
||||
autoreconf -v --install
|
||||
@ -76,6 +76,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_libdir}/pkgconfig/pciaccess.pc
|
||||
|
||||
%changelog
|
||||
* Thu Aug 06 2009 Dave Airlie <airlied@redhat.com> 0.10.6-7
|
||||
- disable rom reading fallbacks
|
||||
|
||||
* Wed Aug 05 2009 Adam Jackson <ajax@redhat.com> 0.10.6-6
|
||||
- D'oh. Fix obvious sense inversion in the previous patch.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user