- libpciaccess-0.10.6-rom-sanity.patch: If we hit the /dev/mem path for
reading a device's ROM, verify that it looks like it at least might belong to the device in question by checking vendor and device ID match. Fixes vbetool post hanging forever (and thus blocking boot) on some dual-gpu laptops.
This commit is contained in:
parent
975e140deb
commit
7f6800064f
41
libpciaccess-0.10.6-rom-sanity.patch
Normal file
41
libpciaccess-0.10.6-rom-sanity.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
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
|
Name: libpciaccess
|
||||||
Version: 0.10.6
|
Version: 0.10.6
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
Summary: PCI access library
|
Summary: PCI access library
|
||||||
|
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -21,6 +21,7 @@ Patch0: libpciaccess-fd-cache.patch
|
|||||||
Patch2: libpciaccess-rom-size.patch
|
Patch2: libpciaccess-rom-size.patch
|
||||||
Patch3: libpciaccess-boot-vga.patch
|
Patch3: libpciaccess-boot-vga.patch
|
||||||
Patch4: libpciaccess-vga-arbiter.patch
|
Patch4: libpciaccess-vga-arbiter.patch
|
||||||
|
Patch5: libpciaccess-0.10.6-rom-sanity.patch
|
||||||
|
|
||||||
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
|
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
|
||||||
Requires: hwdata
|
Requires: hwdata
|
||||||
@ -44,6 +45,7 @@ Development package for libpciaccess.
|
|||||||
%patch2 -p1 -b .rom-size
|
%patch2 -p1 -b .rom-size
|
||||||
%patch3 -p1 -b .bootvga
|
%patch3 -p1 -b .bootvga
|
||||||
%patch4 -p1 -b .vgaarb
|
%patch4 -p1 -b .vgaarb
|
||||||
|
%patch5 -p1 -b .jx
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -v --install
|
autoreconf -v --install
|
||||||
@ -74,6 +76,13 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/pkgconfig/pciaccess.pc
|
%{_libdir}/pkgconfig/pciaccess.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Aug 05 2009 Adam Jackson <ajax@redhat.com> 0.10.6-5
|
||||||
|
- libpciaccess-0.10.6-rom-sanity.patch: If we hit the /dev/mem path for
|
||||||
|
reading a device's ROM, verify that it looks like it at least might belong
|
||||||
|
to the device in question by checking vendor and device ID match. Fixes
|
||||||
|
vbetool post hanging forever (and thus blocking boot) on some dual-gpu
|
||||||
|
laptops.
|
||||||
|
|
||||||
* Mon Aug 03 2009 Dave Airlie <airlied@redhat.com> 0.10.6-4
|
* Mon Aug 03 2009 Dave Airlie <airlied@redhat.com> 0.10.6-4
|
||||||
- Add support for default vga arb device selection
|
- Add support for default vga arb device selection
|
||||||
- Update libpciaccess VGA arb code for newer kernel API
|
- Update libpciaccess VGA arb code for newer kernel API
|
||||||
|
Loading…
Reference in New Issue
Block a user