summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-02-13 13:31:31 +0100
committerKeith Packard <keithp@keithp.com>2014-08-21 20:03:48 -0500
commit2f0183222b4279266e6ef60b923738ff55f0afba (patch)
treed63a0cb83681cee70cc356f2f62abe5c50b63f4d /hw/xfree86
parent33aeec8a11bc75a06d32956bbdd9efb216790a02 (diff)
xfree86: Fallback to first platform device as primary
When neither of the various bus implementations was able to find a primary bus and device, fallback to using the platform bus as primary bus and the first platform device as primary device. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Tested-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/common/xf86Bus.c3
-rw-r--r--hw/xfree86/common/xf86platformBus.c15
-rw-r--r--hw/xfree86/common/xf86platformBus.h1
3 files changed, 19 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index b3b3f8cc5..bd3e4e37b 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -210,6 +210,9 @@ xf86BusProbe(void)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
+#ifdef XSERVER_PLATFORM_BUS
+ xf86platformPrimary();
+#endif
}
/*
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 946039940..1bacc49e6 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -594,4 +594,19 @@ void xf86platformVTProbe(void)
xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
}
}
+
+void xf86platformPrimary(void)
+{
+ /* use the first platform device as a fallback */
+ if (primaryBus.type == BUS_NONE) {
+ xf86Msg(X_INFO, "no primary bus or device found\n");
+
+ if (xf86_num_platform_devices > 0) {
+ primaryBus.id.plat = &xf86_platform_devices[0];
+ primaryBus.type = BUS_PLATFORM;
+
+ xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
+ }
+ }
+}
#endif
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index 317dd24d5..a7335b9da 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -155,6 +155,7 @@ extern _X_EXPORT int
xf86PlatformMatchDriver(char *matches[], int nmatches);
extern void xf86platformVTProbe(void);
+extern void xf86platformPrimary(void);
#endif
#endif