xserver: Branch 'pci-rework' - 3 commits
Ian Romanick
idr at kemper.freedesktop.org
Thu Jul 6 23:00:59 EEST 2006
hw/xfree86/loader/dlloader.c | 8 ++++
hw/xfree86/os-support/bus/linuxPci.c | 59 +++++++++++++----------------------
2 files changed, 31 insertions(+), 36 deletions(-)
New commits:
diff-tree 37838de62edc474f44c0a48bd56470a6c23f8956 (from parents)
Merge: fd49a0dcc13280cf195bd6c7ee0f23d0840cb665 8d07ee070ecf0d403d9d27c80764d343b80af6f0
Author: Ian Romanick <idr at umwelt.(none)>
Date: Thu Jul 6 13:01:57 2006 -0700
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework
Conflicts:
hw/xfree86/os-support/bus/linuxPci.c
diff --cc hw/xfree86/os-support/bus/linuxPci.c
index 84ec8ad,7f6376a..9ecac8d
@@@ -449,15 -457,10 +452,10 @@@
if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) {
/* Look up vendor/device */
for (i = 0; i < NUM_SIZES; i++) {
- if (pPCI->pci_vendor > pciControllerSizes[i].vendor)
- continue;
- if (pPCI->pci_vendor < pciControllerSizes[i].vendor)
- break;
- if (pPCI->_pci_device > pciControllerSizes[i].device)
- continue;
- if (pPCI->_pci_device < pciControllerSizes[i].device)
- break;
- return pciControllerSizes[i].io_size;
+ if ((pPCI->pci_vendor == pciControllerSizes[i].vendor)
- && (pPCI->pci_device == pciControllerSizes[i].device)) {
++ && (pPCI->_pci_device == pciControllerSizes[i].device)) {
+ return & pciControllerSizes[i];
+ }
}
}
diff-tree 8d07ee070ecf0d403d9d27c80764d343b80af6f0 (from 704e645207d88a2d0a372cf69f6abd778ed4c30b)
Author: Ian Romanick <idr at umwelt.(none)>
Date: Thu Jul 6 12:48:51 2006 -0700
Refactor linuxGetIOSize and linuxGetSizes. Eliminate the unnecessary
optimization in the search loop.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 0714c9c..7f6376a 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -421,7 +421,7 @@ xf86GetPciHostConfigFromTag(PCITAG Tag)
*
* Please keep this table in ascending vendor/device order.
*/
-static struct pciSizes {
+static const struct pciSizes {
unsigned short vendor, device;
unsigned long io_size, mem_size;
} pciControllerSizes[] = {
@@ -444,9 +444,12 @@ static struct pciSizes {
};
#define NUM_SIZES (sizeof(pciControllerSizes) / sizeof(pciControllerSizes[0]))
-static unsigned long
-linuxGetIOSize(PCITAG Tag)
+static const struct pciSizes *
+linuxGetSizesStruct(PCITAG Tag)
{
+ static const struct pciSizes default_size = {
+ 0, 0, 1U << 16, (unsigned long)(1ULL << 32)
+ };
pciConfigPtr pPCI;
int i;
@@ -454,47 +457,31 @@ linuxGetIOSize(PCITAG Tag)
if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) {
/* Look up vendor/device */
for (i = 0; i < NUM_SIZES; i++) {
- if (pPCI->pci_vendor > pciControllerSizes[i].vendor)
- continue;
- if (pPCI->pci_vendor < pciControllerSizes[i].vendor)
- break;
- if (pPCI->pci_device > pciControllerSizes[i].device)
- continue;
- if (pPCI->pci_device < pciControllerSizes[i].device)
- break;
- return pciControllerSizes[i].io_size;
+ if ((pPCI->pci_vendor == pciControllerSizes[i].vendor)
+ && (pPCI->pci_device == pciControllerSizes[i].device)) {
+ return & pciControllerSizes[i];
+ }
}
}
- return 1U << 16; /* Default to 64K */
+ /* Default to 64KB I/O and 4GB memory. */
+ return & default_size;
}
-static void
-linuxGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size)
+static __inline__ unsigned long
+linuxGetIOSize(PCITAG Tag)
{
- pciConfigPtr pPCI;
- int i;
+ const struct pciSizes * const sizes = linuxGetSizesStruct(Tag);
+ return sizes->io_size;
+}
- *io_size = (1U << 16); /* Default to 64K */
- *mem_size = (unsigned long)(1ULL << 32); /* Default to 4G */
+static __inline__ void
+linuxGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size)
+{
+ const struct pciSizes * const sizes = linuxGetSizesStruct(Tag);
- /* Find host bridge */
- if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) {
- /* Look up vendor/device */
- for (i = 0; i < NUM_SIZES; i++) {
- if (pPCI->pci_vendor > pciControllerSizes[i].vendor)
- continue;
- if (pPCI->pci_vendor < pciControllerSizes[i].vendor)
- break;
- if (pPCI->pci_device > pciControllerSizes[i].device)
- continue;
- if (pPCI->pci_device < pciControllerSizes[i].device)
- break;
- *io_size = pciControllerSizes[i].io_size;
- *mem_size = pciControllerSizes[i].mem_size;
- break;
- }
- }
+ *io_size = sizes->io_size;
+ *mem_size = sizes->mem_size;
}
_X_EXPORT int
diff-tree 704e645207d88a2d0a372cf69f6abd778ed4c30b (from 28b95fd9d1c2f078aaaac75c310a27b17c74a6fc)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date: Thu Jul 6 14:22:33 2006 -0400
Remind dlloader that it needs to search the global scope as well as the
loaded modules. Fixes LoaderSymbol() on symbols provided by the server.
Spotted by Aaron Plattner.
diff --git a/hw/xfree86/loader/dlloader.c b/hw/xfree86/loader/dlloader.c
index 3c62f86..7db04b1 100644
--- a/hw/xfree86/loader/dlloader.c
+++ b/hw/xfree86/loader/dlloader.c
@@ -105,6 +105,8 @@ DLFindSymbolLocal(pointer module, const
return p;
}
+static void *global_scope = NULL;
+
void *
DLFindSymbol(const char *name)
{
@@ -117,6 +119,12 @@ DLFindSymbol(const char *name)
return p;
}
+ if (!global_scope)
+ global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
+
+ if (global_scope)
+ return dlsym(global_scope, name);
+
return NULL;
}
More information about the xorg-commit
mailing list