Bugzilla – Attachment 96867 Details for
Bug 197572
X.Org PCI patches stilll left
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
fixed compilation
p_pci-domain-xorg71.diff (text/plain), 20.37 KB, created by
Stefan Dirsch
on 2006-08-23 10:23:05 UTC
(
hide
)
Description:
fixed compilation
Filename:
MIME Type:
Creator:
Stefan Dirsch
Created:
2006-08-23 10:23:05 UTC
Size:
20.37 KB
patch
obsolete
>diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/int10/helper_exec.c ./hw/xfree86/int10/helper_exec.c >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/int10/helper_exec.c 2006-07-22 01:12:40.000000000 +0200 >+++ ./hw/xfree86/int10/helper_exec.c 2006-08-22 15:35:31.000000000 +0200 >@@ -480,7 +480,7 @@ pciCfg1in(CARD16 addr, CARD32 *val) > return 1; > } > if (addr == 0xCFC) { >- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr)); >+ *val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr)); > return 1; > } > return 0; >@@ -494,7 +494,7 @@ pciCfg1out(CARD16 addr, CARD32 val) > return 1; > } > if (addr == 0xCFC) { >- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr), val); >+ pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr),val); > return 1; > } > return 0; >Only in ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus: .linuxPci.c.swp >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/Pci.c ./hw/xfree86/os-support/bus/Pci.c >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/Pci.c 2006-08-22 15:35:31.000000000 +0200 >+++ ./hw/xfree86/os-support/bus/Pci.c 2006-08-22 17:39:17.000000000 +0200 >@@ -20,6 +20,8 @@ > * pciSetBitsByte() - Write an 8 bit value against a mask > * pciTag() - Return tag for a given PCI bus, device, & > * function >+ * pciDomTag() - Return tag for a given PCI domain, bus, >+ * device & function > * pciBusAddrToHostAddr() - Convert a PCI address to a host address > * pciHostAddrToBusAddr() - Convert a host address to a PCI address > * pciGetBaseSize() - Returns the number of bits in a PCI base >@@ -614,6 +616,12 @@ pciTag(int busnum, int devnum, int funcn > return(PCI_MAKE_TAG(busnum,devnum,funcnum)); > } > >+_X_EXPORT PCITAG >+pciDomTag(int domnum, int busnum, int devnum, int funcnum) >+{ >+ return(PCI_MAKE_TAG(PCI_MAKE_BUS(domnum,busnum),devnum,funcnum)); >+} >+ > #if defined(PCI_MFDEV_SUPPORT) > > Bool >@@ -879,6 +887,16 @@ pciInfoFromTag(PCITAG tag, int *domainnu > *funcnum = PCI_FUNC_FROM_TAG(tag); > } > >+void >+pciInfoFromTag(PCITAG tag, int *domainnum, int *busnum, >+ int *devnum, int *funcnum) >+{ >+ *domainnum = PCI_DOM_FROM_TAG(tag); >+ *busnum = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)); >+ *devnum = PCI_DEV_FROM_TAG(tag); >+ *funcnum = PCI_FUNC_FROM_TAG(tag); >+} >+ > PCITAG > pciGenFindFirst(void) > { >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/Pci.h ./hw/xfree86/os-support/bus/Pci.h >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/Pci.h 2006-08-22 15:35:31.000000000 +0200 >+++ ./hw/xfree86/os-support/bus/Pci.h 2006-08-22 17:34:26.000000000 +0200 >@@ -119,7 +119,7 @@ > /* by xf86scanpci */ > #if defined(sun) && defined(SVR4) && defined(sparc) > # define MAX_PCI_BUSES 4096 /* Max number of PCI buses */ >-#elif defined(__alpha__) && defined (linux) >+#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux) > # define MAX_PCI_DOMAINS 512 > # define PCI_DOM_MASK 0x01fful > # define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */ >@@ -258,7 +258,7 @@ > # endif > #elif defined(__ia64__) > # if defined(linux) >-# define ARCH_PCI_INIT linuxPciInit >+# define ARCH_PCI_INIT ia64linuxPciInit > # define INCLUDE_XF86_MAP_PCI_MEM > # elif defined(FreeBSD) > # define ARCH_PCI_INIT freebsdPciInit >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/altixPCI.c ./hw/xfree86/os-support/bus/altixPCI.c >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/altixPCI.c 2006-07-20 22:27:48.000000000 +0200 >+++ ./hw/xfree86/os-support/bus/altixPCI.c 2006-08-22 15:35:31.000000000 +0200 >@@ -41,13 +41,14 @@ static pciDevice *get_dev_on_bus(unsigne > static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev) > { > unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag); >- unsigned int parent_busnum, busnum = pdev->busnum; >+ unsigned int parent_busnum, parent_nodombus, busnum = pdev->busnum; >+ unsigned int nodombus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(pdev->tag)); > char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge"; > char bridge_target[] = "../../../devices/pci0000:00"; > > /* Path to this device's bridge */ > sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum, >- busnum); >+ nodombus); > > if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) { > perror("failed to dereference bridge link"); >@@ -56,7 +57,9 @@ static void get_bridge_info(pciBusInfo_t > } > > sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum, >- &parent_busnum); >+ &parent_nodombus); >+ >+ parent_busnum = PCI_MAKE_BUS(parent_segnum, parent_nodombus); > > /* > * If there's no bridge or the bridge points to the device, use >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/linuxPci.c ./hw/xfree86/os-support/bus/linuxPci.c >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/linuxPci.c 2006-07-22 01:12:40.000000000 +0200 >+++ ./hw/xfree86/os-support/bus/linuxPci.c 2006-08-22 17:47:35.000000000 +0200 >@@ -54,6 +54,7 @@ > #include "xf86Priv.h" > #include "xf86_OSlib.h" > #include "Pci.h" >+#include <dirent.h> > > /* > * linux platform specific PCI access functions -- using /proc/bus/pci >@@ -73,6 +74,7 @@ static void linuxPciCfgWriteByte(PCITAG > static CARD16 linuxPciCfgReadWord(PCITAG tag, int off); > static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val); > static int linuxPciHandleBIOS(PCITAG Tag, int basereg, unsigned char *buf, int len); >+static Bool linuxDomainSupport(void); > > static pciBusFuncs_t linuxFuncs0 = { > /* pciReadLong */ linuxPciCfgRead, >@@ -110,6 +112,8 @@ static pciBusInfo_t linuxPci0 = { > /* from lnx_pci.c. */ > extern int lnxPciInit(void); > >+static Bool domain_support = FALSE; >+ > void > linuxPciInit() > { >@@ -120,6 +124,9 @@ linuxPciInit() > we'll need a fallback for 2.0 kernels here */ > return; > } >+#ifndef INCLUDE_XF86_NO_DOMAIN >+ domain_support = linuxDomainSupport(); >+#endif > pciNumBuses = 1; > pciBusInfo[0] = &linuxPci0; > pciFindFirstFP = pciGenFindFirst; >@@ -131,13 +138,14 @@ linuxPciInit() > static int > linuxPciOpenFile(PCITAG tag, Bool write) > { >- static int lbus,ldev,lfunc,fd = -1,is_write = 0; >- int bus, dev, func; >+ static int ldomain, lbus,ldev,lfunc,fd = -1,is_write = 0; >+ int domain, bus, dev, func; > char file[64]; > struct stat ignored; > static int is26 = -1; > >- bus = PCI_BUS_FROM_TAG(tag); >+ domain = PCI_DOM_FROM_TAG(tag); >+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)); > dev = PCI_DEV_FROM_TAG(tag); > func = PCI_FUNC_FROM_TAG(tag); > if (is26 == -1) { >@@ -147,30 +155,41 @@ linuxPciOpenFile(PCITAG tag, Bool write) > is26 = 1; > } > >- if (fd == -1 || (write && (!is_write)) >+ if (!domain_support && domain > 0) >+ return -1; >+ >+ if (fd == -1 || (write && (!is_write)) || domain != ldomain > || bus != lbus || dev != ldev || func != lfunc) { >- if (fd != -1) >+ if (fd != -1) { > close(fd); >+ fd = -1; >+ } > if (is26) >- sprintf(file,"/sys/bus/pci/devices/0000:%02x:%02x.%01x/config", >- bus, dev, func); >+ sprintf(file,"/sys/bus/pci/devices/%04x:%02x:%02x.%01x/config", >+ domain, bus, dev, func); > else { > if (bus < 256) { >- sprintf(file,"/proc/bus/pci/%02x",bus); >- if (stat(file, &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); >+ sprintf(file, "/proc/bus/pci/%04x:%02x", domain, bus); >+ if (stat(file, &ignored) < 0) { >+ if (domain == 0) >+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x", >+ bus, dev, func); >+ else >+ goto bail; >+ } else >+ sprintf(file, "/proc/bus/pci/%04x:%02x/%02x.%1x", >+ domain, bus, dev, func); > } else { >- sprintf(file,"/proc/bus/pci/%04x",bus); >- if (stat(file, &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); >+ sprintf(file, "/proc/bus/pci/%04x:%04x", domain, bus); >+ if (stat(file, &ignored) < 0) { >+ if (domain == 0) >+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x", >+ bus, dev, func); >+ else >+ goto bail; >+ } else >+ sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x", >+ domain, bus, dev, func); > } > } > if (write) { >@@ -185,7 +204,8 @@ linuxPciOpenFile(PCITAG tag, Bool write) > fd = open(file,O_RDONLY); > is_write = FALSE; > } >- >+ bail: >+ ldomain = domain; > lbus = bus; > ldev = dev; > lfunc = func; >@@ -483,6 +503,32 @@ linuxGetSizes(PCITAG Tag, unsigned long > *mem_size = sizes->mem_size; > } > >+static Bool >+linuxDomainSupport(void) >+{ >+ DIR *dir; >+ struct dirent *dirent; >+ char *end; >+ >+ if (!(dir = opendir("/proc/bus/pci"))) >+ return FALSE; >+ while (1) { >+ if (!(dirent = readdir(dir))) >+ return FALSE; >+ strtol(dirent->d_name,&end,16); >+ /* entry of the form xx or xxxx : x=[0..f] no domain */ >+ if (*end == '\0') >+ return FALSE; >+ else if (*end == ':') { >+ /* ':' found immediately after: verify for xxxx:xx or xxxx:xxxx */ >+ strtol(end + 1,&end,16); >+ if (*end == '\0') >+ return TRUE; >+ } >+ } >+ return FALSE; >+} >+ > _X_EXPORT int > xf86GetPciDomain(PCITAG Tag) > { >@@ -495,15 +541,15 @@ xf86GetPciDomain(PCITAG Tag) > return result; > > if (!pPCI || pPCI->fakeDevice) >- return 1; /* Domain 0 is reserved */ >+ return 0; > > if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) >- return 0; >+ return -1; > > if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0) >- return 0; >+ return -1; > >- return result + 1; /* Domain 0 is reserved */ >+ return result; > } > > static pointer >@@ -575,7 +621,7 @@ linuxMapPci(int ScreenNum, int Flags, PC > return NULL; > } > >-#define MAX_DOMAINS 257 >+#define MAX_DOMAINS 256 > static pointer DomainMmappedIO[MAX_DOMAINS]; > static pointer DomainMmappedMem[MAX_DOMAINS]; > >@@ -597,11 +643,10 @@ linuxOpenLegacy(PCITAG Tag, char *name) > domain = xf86GetPciDomain(Tag); > bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)); > >- /* Domain 0 is reserved -- see xf86GetPciDomain() */ >- if ((domain <= 0) || (domain >= MAX_DOMAINS)) >+ if ((domain < 0) || (domain >= MAX_DOMAINS)) > FatalError("linuxOpenLegacy(): domain out of range\n"); > >- sprintf(path, PREFIX, domain - 1, bus, name); >+ sprintf(path, PREFIX, domain, bus, name); > fd = open(path, O_RDWR); > if (fd >= 0) { > xfree(path); >@@ -686,7 +731,7 @@ xf86MapDomainIO(int ScreenNum, int Flags > int domain = xf86GetPciDomain(Tag); > int fd; > >- if ((domain <= 0) || (domain >= MAX_DOMAINS)) >+ if ((domain < 0) || (domain >= MAX_DOMAINS)) > FatalError("xf86MapDomainIO(): domain out of range\n"); > > if (DomainMmappedIO[domain]) >@@ -725,7 +770,7 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS > struct stat st; > > dom = PCI_DOM_FROM_TAG(Tag); >- bus = PCI_BUS_FROM_TAG(Tag); >+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)); > dev = PCI_DEV_FROM_TAG(Tag); > func = PCI_FUNC_FROM_TAG(Tag); > sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom", >@@ -798,7 +843,7 @@ xf86BusAccWindowsFromOS(void) > RANGE_TYPE(ResExcIoBlock, domain)); > pRes = xf86AddResToList(pRes, &range, -1); > >- if (domain <= 0) >+ if (domain < 0) > break; > } > } >@@ -832,7 +877,7 @@ xf86PciBusAccWindowsFromOS(void) > RANGE_TYPE(ResExcIoBlock, domain)); > pRes = xf86AddResToList(pRes, &range, -1); > >- if (domain <= 0) >+ if (domain < 0) > break; > } > } >@@ -884,7 +929,7 @@ xf86AccResFromOS(resPtr pRes) > RANGE_TYPE(ResExcIoBlock, domain)); > pRes = xf86AddResToList(pRes, &range, -1); > >- if (domain <= 0) >+ if (domain < 0) > break; > } > } >@@ -904,7 +949,7 @@ int linuxPciHandleBIOS(PCITAG Tag, int b > int sofar = 0; > > dom = PCI_DOM_FROM_TAG(Tag); >- bus = PCI_BUS_FROM_TAG(Tag); >+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)); > dev = PCI_DEV_FROM_TAG(Tag); > func = PCI_FUNC_FROM_TAG(Tag); > sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/rom", >@@ -934,3 +979,106 @@ int linuxPciHandleBIOS(PCITAG Tag, int b > } > return 0; > } >+ >+#ifdef __ia64__ >+static PCITAG ia64linuxPciFindFirst(void); >+static PCITAG ia64linuxPciFindNext(void); >+ >+void >+ia64linuxPciInit() >+{ >+ struct stat st; >+ >+ linuxPciInit(); >+ >+ if (!stat("/proc/sgi_sn/licenseID", &st) && pciNumBuses) { >+ /* Be a little paranoid here and only use this code for Altix systems. >+ * It is generic, so it should work on any system, but depends on >+ * /proc/bus/pci entries for each domain/bus combination. Altix is >+ * guaranteed a recent enough kernel to have them. >+ */ >+ pciFindFirstFP = ia64linuxPciFindFirst; >+ pciFindNextFP = ia64linuxPciFindNext; >+ } >+} >+ >+static DIR *busdomdir; >+static DIR *devdir; >+ >+static PCITAG >+ia64linuxPciFindFirst(void) >+{ >+ busdomdir = opendir("/proc/bus/pci"); >+ devdir = NULL; >+ >+ return ia64linuxPciFindNext(); >+} >+ >+static struct dirent *getnextbus(int *domain, int *bus) >+{ >+ struct dirent *entry; >+ int dombus; >+ >+ for (;;) { >+ entry = readdir(busdomdir); >+ if (entry == NULL) { >+ *domain = 0; >+ *bus = 0; >+ closedir(busdomdir); >+ return NULL; >+ } >+ if (sscanf(entry->d_name, "%04x:%02x", domain, bus) != 2) >+ continue; >+ dombus = PCI_MAKE_BUS(*domain, *bus); >+ >+ if (pciNumBuses <= dombus) >+ pciNumBuses = dombus + 1; >+ if (!pciBusInfo[dombus]) { >+ pciBusInfo[dombus] = xnfalloc(sizeof(pciBusInfo_t)); >+ *pciBusInfo[dombus] = *pciBusInfo[0]; >+ } >+ >+ return entry; >+ } >+} >+ >+static PCITAG >+ia64linuxPciFindNext(void) >+{ >+ struct dirent *entry; >+ char file[40]; >+ static int bus, dev, func, domain; >+ PCITAG pciDeviceTag; >+ CARD32 devid; >+ >+ for (;;) { >+ if (devdir == NULL) { >+ entry = getnextbus(&domain, &bus); >+ if (!entry) >+ return PCI_NOT_FOUND; >+ snprintf(file, 40, "/proc/bus/pci/%s", entry->d_name); >+ devdir = opendir(file); >+ if (!devdir) >+ return PCI_NOT_FOUND; >+ >+ } >+ >+ entry = readdir(devdir); >+ >+ if (entry == NULL) { >+ closedir(devdir); >+ devdir = NULL; >+ continue; >+ } >+ >+ if (sscanf(entry->d_name, "%02x . %01x", &dev, &func) == 2) { >+ pciDeviceTag = PCI_MAKE_TAG(PCI_MAKE_BUS(domain, bus), dev, func); >+ devid = pciReadLong(pciDeviceTag, PCI_ID_REG); >+ if ((devid & pciDevidMask) == pciDevid) >+ /* Yes - Return it. Otherwise, next device */ >+ return pciDeviceTag; >+ } >+ } >+} >+#endif >+ >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/xf86Pci.h ./hw/xfree86/os-support/bus/xf86Pci.h >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/bus/xf86Pci.h 2006-07-22 01:12:40.000000000 +0200 >+++ ./hw/xfree86/os-support/bus/xf86Pci.h 2006-08-22 17:32:20.000000000 +0200 >@@ -766,6 +766,9 @@ void pciSetBitsByte(PCITAG tag, in > ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); > ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); > PCITAG pciTag(int busnum, int devnum, int funcnum); >+PCITAG pciDomTag(int domnum, int busnum, int devnum, int funcnum); >+void pciInfoFromTag(PCITAG tag, int *domainnum, >+ int *busnum, int *devnum, int *funcnum); > int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); > CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg); > pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, >diff -urp ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/linux/lnx_pci.c ./hw/xfree86/os-support/linux/lnx_pci.c >--- ../xorg-server-1.1.99.3.orig/hw/xfree86/os-support/linux/lnx_pci.c 2006-07-22 01:12:40.000000000 +0200 >+++ ./hw/xfree86/os-support/linux/lnx_pci.c 2006-08-22 17:41:23.000000000 +0200 >@@ -3,7 +3,9 @@ > #include <xorg-config.h> > #endif > >+#include <sys/types.h> > #include <stdio.h> >+#include <dirent.h> > #include <X11/X.h> > #include "os.h" > #include "xf86.h" >@@ -25,8 +27,10 @@ > int lnxPciInit(void); > > struct pci_dev { >+ unsigned int domain; > unsigned int bus; >- unsigned int devfn; >+ unsigned int dev; >+ unsigned int fn; > PCIADDR_TYPE offset[7]; > PCIADDR_TYPE size[7]; > struct pci_dev *next; >@@ -38,10 +42,60 @@ int xf86OSLinuxNumPciDevs = 0; > static struct pci_dev *xf86OSLinuxGetPciDevs(void) { > char c[0x200]; > FILE *file = NULL; >+ DIR *dir1, *dir2; >+ struct dirent *dirent1, *dirent2; > struct pci_dev *tmp, *ret = NULL; >- unsigned int num; >+ unsigned int i, num, devfn; >+ unsigned PCIADDR_TYPE begin, end; > char *res; > >+ /* Try 2.6 devices first, with domain support */ >+ if ( (dir1 = opendir ("/sys/devices")) ) { >+ while ( (dirent1 = readdir (dir1)) ) { >+ unsigned int domain, bus; >+ if (sscanf (dirent1->d_name, "pci%04x:%02x", &domain, &bus) == 2) { >+ sprintf (c, "/sys/devices/%.10s", dirent1->d_name); >+ if ( (dir2 = opendir (c)) ) { >+ while ( (dirent2 = readdir (dir2)) ) { >+ unsigned int domain2, bus2, dev, fn; >+ if (sscanf (dirent2->d_name, "%04x:%02x:%02x.%01x", >+ &domain2, &bus2, &dev, &fn) == 4 && >+ domain == domain2 && bus == bus2) { >+ tmp = xcalloc (sizeof(struct pci_dev), 1); >+ tmp->domain = domain; >+ tmp->bus = bus; >+ tmp->dev = dev; >+ tmp->fn = fn; >+ sprintf(c, "/sys/devices/%10s/%12s/resource", >+ dirent1->d_name, dirent2->d_name); >+ if ( (file = fopen (c, "r")) ) { >+ i = 0; >+ while (i < 7 && fgets (c, 0x200, file)) { >+ if (sscanf (c, PCIADDR_FMT " " PCIADDR_FMT " " PCIADDR_IGNORE_FMT, &begin, &end) == 2) { >+ tmp->offset[i] = begin; >+ tmp->size[i] = end - begin; >+ i++; >+ } >+ } >+ fclose (file); >+ } >+ if (i > 0) { >+ tmp->next = ret; >+ ret = tmp; >+ } else >+ xfree (tmp); >+ } >+ } >+ closedir (dir2); >+ } >+ } >+ } >+ closedir (dir1); >+ } >+ >+ if (ret) >+ return ret; >+ > file = fopen("/proc/bus/pci/devices", "r"); > if (!file) return NULL; > >@@ -70,9 +124,11 @@ static struct pci_dev *xf86OSLinuxGetPci > "\t" PCIADDR_FMT > "\t" PCIADDR_FMT > "\t" PCIADDR_FMT, >- &tmp->bus,&tmp->devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3], >+ &tmp->bus,&devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3], > &tmp->offset[4],&tmp->offset[5],&tmp->offset[6], &tmp->size[0], &tmp->size[1], &tmp->size[2], > &tmp->size[3], &tmp->size[4], &tmp->size[5], &tmp->size[6]); >+ tmp->dev = devfn >> 3; >+ tmp->fn = devfn & 0x7; > if (num != 16) { /* apparantly not 2.3 style */ > xfree(tmp); > fclose(file); >@@ -104,7 +160,7 @@ xf86GetPciSizeFromOS(PCITAG tag, int ind > signed PCIADDR_TYPE Size; > struct pci_dev *device; > >- if (index > 7) >+ if (index >= 7) > return FALSE; > > if (!xf86OSLinuxPCIDevs) { >@@ -114,10 +170,8 @@ xf86GetPciSizeFromOS(PCITAG tag, int ind > return FALSE; > > for (device = xf86OSLinuxPCIDevs; device; device = device->next) { >- dev = device->devfn >> 3; >- fn = device->devfn & 0x7; >- if (tag == pciTag(device->bus,dev,fn)) { >- *bits = 0; >+ if (tag == pciDomTag (device->domain, device->bus, >+ device->dev, device->fn)) { > if (device->size[index] != 0) { > Size = device->size[index] - ((PCIADDR_TYPE) 1); > while (Size & ((PCIADDR_TYPE) 0x01)) { >@@ -141,7 +195,7 @@ xf86GetPciOffsetFromOS(PCITAG tag, int i > unsigned int dev, fn; > struct pci_dev *device; > >- if (index > 7) >+ if (index >= 7) > return FALSE; > > if (!xf86OSLinuxPCIDevs) { >@@ -151,9 +205,8 @@ xf86GetPciOffsetFromOS(PCITAG tag, int i > return FALSE; > > for (device = xf86OSLinuxPCIDevs; device; device = device->next) { >- dev = device->devfn >> 3; >- fn = device->devfn & 0x7; >- if (tag == pciTag(device->bus,dev,fn)) { >+ if (tag == pciDomTag (device->domain, device->bus, >+ device->dev, device->fn)) { > /* return the offset for the index requested */ > *bases = device->offset[index]; > return TRUE; >@@ -179,9 +232,8 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int s > } > > for (device = xf86OSLinuxPCIDevs; device; device = device->next) { >- dev = device->devfn >> 3; >- fn = device->devfn & 0x7; >- if (tag == pciTag(device->bus, dev, fn)) { >+ if (tag == pciDomTag (device->domain, device->bus, >+ device->dev, device->fn)) { > /* ok now look through all the BAR values of this device */ > pciConfigPtr pDev = xf86GetPciConfigFromTag(tag); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 197572
:
95362
|
95365
|
95366
|
95367
|
95368
|
96794
|
96866
|
96867
|
96898
|
97000
|
97003
|
97027
|
97046
|
97112
|
100972
|
100983
|
101011