summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support/bus/linuxPci.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-15 16:34:16 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-15 16:34:16 +0000
commit696b137d5855cdcd0e6b95e16ce2dad00510a41d (patch)
tree93d38eaf0eb8fd4bb2d9725dc242c5434ceabfa8 /hw/xfree86/os-support/bus/linuxPci.c
parent2c971497fc9fc09d342cdb13a985fdde81f82351 (diff)
Pull XORG-6_8_0 to CYGWIN branchCYGWIN-6_8_0-MERGE
Diffstat (limited to 'hw/xfree86/os-support/bus/linuxPci.c')
-rw-r--r--hw/xfree86/os-support/bus/linuxPci.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 4846ee0ed..6e33c2550 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -104,6 +104,7 @@ linuxPciOpenFile(PCITAG tag)
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 @@ linuxPciOpenFile(PCITAG tag)
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;