summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 14:54:19 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:40:40 +1000
commit9d498e0f7a5ece8f61c8a174b40668a2621a82e3 (patch)
treeb4ede5e2fb34147754dcba948f74014972aaeaa0 /drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
parent8f0649b5c6e70ec18122255690e39f010c12a614 (diff)
drm/nouveau/falcon: convert user classes to new-style nvkm_object
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/falcon.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/falcon.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
index b0cbe819497a..3d3e73cfb6b0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
@@ -24,6 +24,35 @@
#include <subdev/timer.h>
+static int
+nvkm_falcon_oclass_get(struct nvkm_oclass *oclass, int index)
+{
+ struct nvkm_falcon *falcon = nvkm_falcon(oclass->engine);
+ int c = 0;
+
+ while (falcon->func->sclass[c].oclass) {
+ if (c++ == index) {
+ oclass->base = falcon->func->sclass[index];
+ return index;
+ }
+ }
+
+ return c;
+}
+
+static int
+nvkm_falcon_cclass_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent,
+ int align, struct nvkm_gpuobj **pgpuobj)
+{
+ return nvkm_gpuobj_new(object->engine->subdev.device, 256,
+ align, true, parent, pgpuobj);
+}
+
+static const struct nvkm_object_func
+nvkm_falcon_cclass = {
+ .bind = nvkm_falcon_cclass_bind,
+};
+
static void
nvkm_falcon_intr(struct nvkm_subdev *subdev)
{
@@ -275,6 +304,12 @@ _nvkm_falcon_fini(struct nvkm_object *object, bool suspend)
return nvkm_engine_fini_old(&falcon->engine, suspend);
}
+static const struct nvkm_engine_func
+nvkm_falcon = {
+ .fifo.sclass = nvkm_falcon_oclass_get,
+ .cclass = &nvkm_falcon_cclass,
+};
+
int
nvkm_falcon_create_(const struct nvkm_falcon_func *func,
struct nvkm_object *parent, struct nvkm_object *engine,
@@ -292,6 +327,7 @@ nvkm_falcon_create_(const struct nvkm_falcon_func *func,
return ret;
falcon->engine.subdev.intr = nvkm_falcon_intr;
+ falcon->engine.func = &nvkm_falcon;
falcon->func = func;
falcon->addr = addr;
return 0;