diff options
author | Thierry Reding <treding@nvidia.com> | 2014-02-13 13:31:31 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-06-25 15:13:25 +0200 |
commit | 3e5f80651b657d116bd18e4e4e7b3b00a1861837 (patch) | |
tree | b22816a3274be218f0904fa4d7254343a367821b | |
parent | 2f113d68f6c1572576bc57ecca12e44cc9e438eb (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>
-rw-r--r-- | hw/xfree86/common/xf86Bus.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86platformBus.c | 17 | ||||
-rw-r--r-- | hw/xfree86/common/xf86platformBus.h | 1 |
3 files changed, 21 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 dd118a285..467b26b1d 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -560,4 +560,21 @@ 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) { + char *syspath = xf86_get_platform_attrib(0, ODEV_ATTRIB_SYSPATH); + + xf86Msg(X_NONE, "\tfalling back to %s\n", syspath); + + primaryBus.id.plat = &xf86_platform_devices[0]; + primaryBus.type = BUS_PLATFORM; + } + } +} #endif diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h index 5dee4e0e0..dec195648 100644 --- a/hw/xfree86/common/xf86platformBus.h +++ b/hw/xfree86/common/xf86platformBus.h @@ -77,6 +77,7 @@ extern _X_EXPORT int xf86PlatformMatchDriver(char *matches[], int nmatches); extern void xf86platformVTProbe(void); +extern void xf86platformPrimary(void); #endif #endif |