summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-07-25 16:11:23 +1000
committerDave Airlie <airlied@redhat.com>2012-09-03 12:25:07 +1000
commit0768ac4d195214825137152893deb74a87fcd11e (patch)
treed46989b247671ea12bf45711814b47bbd29e90e8
parent164ae7a4f9fd3e538f1b506031d297088fc0c659 (diff)
intel: add platform probing support.
This allows the driver to be loaded by the platform loading code. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/intel_driver.c9
-rw-r--r--src/intel_module.c50
2 files changed, 57 insertions, 2 deletions
diff --git a/src/intel_driver.c b/src/intel_driver.c
index c5be6793..76d56d92 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -452,7 +452,14 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
return FALSE;
pEnt = xf86GetEntityInfo(scrn->entityList[0]);
- if (pEnt == NULL || pEnt->location.type != BUS_PCI)
+ if (pEnt == NULL)
+ return NULL;
+
+ if (pEnt->location.type != BUS_PCI
+#ifdef XSERVER_PLATFORM_BUS
+ && pEnt->location.type != BUS_PLATFORM
+#endif
+ )
return FALSE;
if (flags & PROBE_DETECT)
diff --git a/src/intel_module.c b/src/intel_module.c
index e5f98d4c..cfd92e97 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -47,6 +47,10 @@
#include "legacy/legacy.h"
#include "sna/sna_module.h"
+#ifdef XSERVER_PLATFORM_BUS
+#include <xf86platformBus.h>
+#endif
+
static const struct intel_device_info intel_generic_info = {
.gen = -1,
};
@@ -525,6 +529,47 @@ static Bool intel_pci_probe(DriverPtr driver,
}
}
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+intel_platform_probe(DriverPtr driver,
+ int entity_num, int flags,
+ struct xf86_platform_device *dev,
+ intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
+
+ if (!dev->pdev)
+ return FALSE;
+ /* if we get any flags we don't understand fail to probe for now */
+ if (flags)
+ return FALSE;
+
+ scrn = xf86AllocateScreen(driver, 0);
+ xf86AddEntityToScreen(scrn, entity_num);
+
+ scrn->driverVersion = INTEL_VERSION;
+ scrn->driverName = INTEL_DRIVER_NAME;
+ scrn->name = INTEL_NAME;
+ scrn->driverPrivate = (void *)(match_data | 1);
+ scrn->Probe = NULL;
+ switch (get_accel_method()) {
+#if USE_SNA
+ case SNA: sna_init_scrn(scrn, entity_num); break;
+#endif
+
+#if USE_UXA
+ case UXA: intel_init_scrn(scrn); break;
+#endif
+ default: break;
+ }
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using drv %s\n", path ? path : "Default device");
+ return scrn != NULL;
+}
+#endif
+
#ifdef XFree86LOADER
static MODULESETUPPROTO(intel_setup);
@@ -569,7 +614,10 @@ static DriverRec intel = {
0,
intel_driver_func,
intel_device_match,
- intel_pci_probe
+ intel_pci_probe,
+#ifdef XSERVER_PLATFORM_BUS
+ intel_platform_probe
+#endif
};
static pointer intel_setup(pointer module,