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>
(cherry picked from commit 2f0183222b)
[hdegoede: backport to 1.16 which doesn't have syspath directly in OdevAttributes]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Thierry Reding 2014-02-13 13:31:31 +01:00 committed by Julien Cristau
parent af2e9e3bb1
commit 484b881ecd
3 changed files with 21 additions and 0 deletions

View File

@ -210,6 +210,9 @@ xf86BusProbe(void)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
#ifdef XSERVER_PLATFORM_BUS
xf86platformPrimary();
#endif
}
/*

View File

@ -635,4 +635,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);
primaryBus.id.plat = &xf86_platform_devices[0];
primaryBus.type = BUS_PLATFORM;
xf86Msg(X_NONE, "\tfalling back to %s\n", syspath);
}
}
}
#endif

View File

@ -77,6 +77,7 @@ extern _X_EXPORT int
xf86PlatformMatchDriver(char *matches[], int nmatches);
extern void xf86platformVTProbe(void);
extern void xf86platformPrimary(void);
#endif
#endif