On Thu, Sep 09, 2004 at 01:21:58PM -0400, Ben Collins wrote: > I think the patch for sparc to allow scanning the newer style PCI proc > domain entries has broken 2.4's PCI scanning. I've attached the patch -- what looks wrong with it? -- G. Branden Robinson | Reality is what refuses to go away Debian GNU/Linux | when I stop believing in it. branden@debian.org | -- Philip K. Dick http://people.debian.org/~branden/ |
$Id: 049_Xserver_recognize_Linux_2.6_proc_bus_pci.diff 1510 2004-06-04 03:17:34Z branden $
Fix XFree86 X server's PCI bus support code to be able to cope with both
Linux 2.4 and Linux 2.6 styles of organization for /proc/bus/pci,
checking for the 2.6 style first.
This patch by Daniel Seyffer and Ciaran McCreesh.
Not submitted to XFree86.
--- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c~ 2004-06-03 09:52:19.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2004-06-03 09:54:49.000000000 -0500
@@ -104,6 +104,7 @@
static int lbus,ldev,lfunc,fd = -1;
int bus, dev, func;
char file[32];
+ struct stat ignored;
bus = PCI_BUS_FROM_TAG(tag);
dev = PCI_DEV_FROM_TAG(tag);
@@ -111,12 +112,21 @@
if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
if (fd != -1)
close(fd);
- if (bus < 256)
- sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
- bus, dev, func);
+ if (bus < 256) {
+ if (stat("/proc/bus/pci/00", &ignored) < 0)
+ sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
+ bus, dev, func);
+ else
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ bus, dev, func);
+ } else {
+ if (stat("/proc/bus/pci/00", &ignored) < 0)
+ sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
+ bus, dev, func);
+ else
+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
+ bus, dev, func);
+ }
fd = open(file,O_RDWR);
lbus = bus;
ldev = dev;
Attachment:
signature.asc
Description: Digital signature