summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-04-13 14:47:40 +0100
committerDave Airlie <airlied@redhat.com>2012-04-13 14:47:40 +0100
commit0d8da12f06b66a8bc9bd23059e20f60544160af7 (patch)
treee2199158a080468aa54033dd75c0a2def1cf5338
parentb6425bd1e41dc39de99bd689c31dc3433cc6c7b8 (diff)
xf86udev: make work with real driver
-rw-r--r--hw/xfree86/common/Makefile.am2
-rw-r--r--hw/xfree86/common/xf86Bus.c22
-rw-r--r--hw/xfree86/common/xf86Bus.h1
3 files changed, 21 insertions, 4 deletions
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 331fad599..363956cfb 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -60,7 +60,7 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
- xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h
+ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86udev.h
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 49b1606d2..950a4df26 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -250,6 +250,10 @@ xf86BusConfig(void)
void
xf86BusProbe(void)
{
+#if defined(CONFIG_UDEV)
+ if (xf86udevProbe())
+ return;
+#endif
#ifdef XSERVER_LIBPCIACCESS
xf86PciProbe();
#endif
@@ -282,6 +286,9 @@ StringToBusType(const char *busID, const char **retID)
free(s);
return BUS_NONE;
}
+ if (!xf86NameCmp(p, "udev"))
+ ret = BUS_UDEV;
+
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
ret = BUS_PCI;
if (!xf86NameCmp(p, "sbus"))
@@ -310,14 +317,23 @@ xf86IsEntityPrimary(int entityIndex)
{
EntityPtr pEnt = xf86Entities[entityIndex];
- if (primaryBus.type != pEnt->bus.type)
- return FALSE;
-
switch (pEnt->bus.type) {
case BUS_PCI:
+ if (primaryBus.type != pEnt->bus.type)
+ return FALSE;
return pEnt->bus.id.pci == primaryBus.id.pci;
case BUS_SBUS:
+ if (primaryBus.type != pEnt->bus.type)
+ return FALSE;
return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum;
+ case BUS_UDEV:
+ if (!pEnt->bus.id.udev->pdev)
+ return FALSE;
+ return ((pEnt->bus.id.udev->pdev->domain == primaryBus.id.pci->domain) &&
+ (pEnt->bus.id.udev->pdev->bus == primaryBus.id.pci->bus) &&
+ (pEnt->bus.id.udev->pdev->dev == primaryBus.id.pci->dev) &&
+ (pEnt->bus.id.udev->pdev->func == primaryBus.id.pci->func));
+ return FALSE;
default:
return FALSE;
}
diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h
index abf2efd1a..a5e147c0c 100644
--- a/hw/xfree86/common/xf86Bus.h
+++ b/hw/xfree86/common/xf86Bus.h
@@ -42,6 +42,7 @@
#if defined(__sparc__) || defined(__sparc)
#include "xf86sbusBus.h"
#endif
+#include "xf86udev.h"
typedef struct {
DriverPtr driver;