summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-07-19 13:40:23 +1000
committerDave Airlie <airlied@gmail.com>2012-08-16 14:42:08 +1000
commit2f48b8f462a03cb92db9e9a7ae1957eb27473965 (patch)
treec262611e73ac8bbb31549180fd2387a73a7ef865
parent3aa9a296f508089a247f92b829036ca6a55b7b42 (diff)
nouveau: add platform bus support
This adds the ability to load nouveau via the new platform apis. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/nv_driver.c44
-rw-r--r--src/nv_include.h4
2 files changed, 46 insertions, 2 deletions
diff --git a/src/nv_driver.c b/src/nv_driver.c
index e8725f5..6988b55 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -73,6 +73,39 @@ static Bool NVPciProbe ( DriverPtr drv,
struct pci_device *dev,
intptr_t match_data );
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+NVPlatformProbe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *dev, intptr_t dev_match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ uint32_t scr_flags = 0;
+
+ if (!dev->pdev)
+ return FALSE;
+
+ if (flags & PLATFORM_PROBE_GPU_SCREEN)
+ scr_flags = XF86_ALLOCATE_GPU_SCREEN;
+
+ scrn = xf86AllocateScreen(driver, scr_flags);
+ xf86AddEntityToScreen(scrn, entity_num);
+
+ scrn->driverVersion = NV_VERSION;
+ scrn->driverName = NV_DRIVER_NAME;
+ scrn->name = NV_NAME;
+
+ scrn->Probe = NULL;
+ scrn->PreInit = NVPreInit;
+ scrn->ScreenInit = NVScreenInit;
+ scrn->SwitchMode = NVSwitchMode;
+ scrn->AdjustFrame = NVAdjustFrame;
+ scrn->EnterVT = NVEnterVT;
+ scrn->LeaveVT = NVLeaveVT;
+ scrn->FreeScreen = NVFreeScreen;
+ return scrn != NULL;
+}
+#endif
+
/*
* This contains the functions needed by the server after loading the
* driver module. It must be supplied, and gets added the driver list by
@@ -91,7 +124,10 @@ _X_EXPORT DriverRec NV = {
0,
NVDriverFunc,
nouveau_device_match,
- NVPciProbe
+ NVPciProbe,
+#ifdef XSERVER_PLATFORM_BUS
+ NVPlatformProbe,
+#endif
};
struct NvFamily
@@ -654,7 +690,11 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
/* Get the entity, and make sure it is PCI. */
pNv->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- if (pNv->pEnt->location.type != BUS_PCI)
+ if (pNv->pEnt->location.type != BUS_PCI
+#ifdef XSERVER_PLATFORM_BUS
+ && pNv->pEnt->location.type != BUS_PLATFORM
+#endif
+ )
return FALSE;
if (xf86IsEntityShared(pScrn->entityList[0])) {
diff --git a/src/nv_include.h b/src/nv_include.h
index 1e382b2..3984227 100644
--- a/src/nv_include.h
+++ b/src/nv_include.h
@@ -20,6 +20,10 @@
/* Drivers that need to access the PCI config space directly need this */
#include "xf86Pci.h"
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
+
/* All drivers initialising the SW cursor need this */
#include "mipointer.h"