From 9d498e0f7a5ece8f61c8a174b40668a2621a82e3 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:19 +1000 Subject: [PATCH] drm/nouveau/falcon: convert user classes to new-style nvkm_object Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/include/nvif/class.h | 22 ++++++ .../drm/nouveau/include/nvkm/engine/falcon.h | 26 +------ .../gpu/drm/nouveau/nvkm/engine/ce/gf100.c | 69 +++++-------------- .../gpu/drm/nouveau/nvkm/engine/ce/gt215.c | 38 ++-------- drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 36 ++++++++++ .../gpu/drm/nouveau/nvkm/engine/mspdec/g98.c | 39 ++--------- .../drm/nouveau/nvkm/engine/mspdec/gf100.c | 37 ++-------- .../drm/nouveau/nvkm/engine/mspdec/gk104.c | 37 ++-------- .../gpu/drm/nouveau/nvkm/engine/msppp/g98.c | 39 ++--------- .../gpu/drm/nouveau/nvkm/engine/msppp/gf100.c | 37 ++-------- .../gpu/drm/nouveau/nvkm/engine/msvld/g98.c | 41 ++--------- .../gpu/drm/nouveau/nvkm/engine/msvld/gf100.c | 37 ++-------- .../gpu/drm/nouveau/nvkm/engine/msvld/gk104.c | 37 ++-------- drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c | 37 ++-------- 14 files changed, 132 insertions(+), 400 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/class.h b/drivers/gpu/drm/nouveau/include/nvif/class.h index d8bad60642ac..10b6685cf5e7 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/class.h +++ b/drivers/gpu/drm/nouveau/include/nvif/class.h @@ -94,6 +94,28 @@ #define MAXWELL_A 0x0000b097 #define MAXWELL_B 0x0000b197 +#define GT212_MSVLD 0x000085b1 +#define IGT21A_MSVLD 0x000086b1 +#define G98_MSVLD 0x000088b1 +#define GF100_MSVLD 0x000090b1 +#define GK104_MSVLD 0x000095b1 + +#define GT212_MSPDEC 0x000085b2 +#define G98_MSPDEC 0x000088b2 +#define GF100_MSPDEC 0x000090b2 +#define GK104_MSPDEC 0x000095b2 + +#define GT212_MSPPP 0x000085b3 +#define G98_MSPPP 0x000088b3 +#define GF100_MSPPP 0x000090b3 + +#define G98_SEC 0x000088b4 + +#define GT212_DMA 0x000085b5 +#define FERMI_DMA 0x000090b5 + +#define FERMI_DECOMPRESS 0x000090b8 + #define FERMI_COMPUTE_A 0x000090c0 #define FERMI_COMPUTE_B 0x000091c0 diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h index bdadc8b60281..cd113fcbfccb 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h @@ -1,34 +1,13 @@ #ifndef __NVKM_FALCON_H__ #define __NVKM_FALCON_H__ -#include +#define nvkm_falcon(p) container_of((p), struct nvkm_falcon, engine) +#include struct nvkm_fifo_chan; -struct nvkm_falcon_chan { - struct nvkm_engctx base; -}; - -#define nvkm_falcon_context_create(p,e,c,g,s,a,f,d) \ - nvkm_engctx_create((p), (e), (c), (g), (s), (a), (f), (d)) -#define nvkm_falcon_context_destroy(d) \ - nvkm_engctx_destroy(&(d)->base) -#define nvkm_falcon_context_init(d) \ - nvkm_engctx_init(&(d)->base) -#define nvkm_falcon_context_fini(d,s) \ - nvkm_engctx_fini(&(d)->base, (s)) - -#define _nvkm_falcon_context_ctor _nvkm_engctx_ctor -#define _nvkm_falcon_context_dtor _nvkm_engctx_dtor -#define _nvkm_falcon_context_init _nvkm_engctx_init -#define _nvkm_falcon_context_fini _nvkm_engctx_fini -#define _nvkm_falcon_context_rd32 _nvkm_engctx_rd32 -#define _nvkm_falcon_context_wr32 _nvkm_engctx_wr32 - struct nvkm_falcon_data { bool external; }; -#include - struct nvkm_falcon { struct nvkm_engine engine; const struct nvkm_falcon_func *func; @@ -55,6 +34,7 @@ struct nvkm_falcon { struct nvkm_falcon_func { void (*intr)(struct nvkm_falcon *, struct nvkm_fifo_chan *); + struct nvkm_sclass sclass[]; }; #define nv_falcon(priv) ((struct nvkm_falcon *)priv) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c index 6faf38e3dbbc..3abab3992e7c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c @@ -25,51 +25,7 @@ #include #include "fuc/gf100.fuc3.h" -/******************************************************************************* - * Copy object classes - ******************************************************************************/ - -static struct nvkm_oclass -gf100_ce0_sclass[] = { - { 0x90b5, &nvkm_object_ofuncs }, - {}, -}; - -static struct nvkm_oclass -gf100_ce1_sclass[] = { - { 0x90b8, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PCE context - ******************************************************************************/ - -static struct nvkm_ofuncs -gf100_ce_context_ofuncs = { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, -}; - -static struct nvkm_oclass -gf100_ce0_cclass = { - .handle = NV_ENGCTX(CE0, 0xc0), - .ofuncs = &gf100_ce_context_ofuncs, -}; - -static struct nvkm_oclass -gf100_ce1_cclass = { - .handle = NV_ENGCTX(CE1, 0xc0), - .ofuncs = &gf100_ce_context_ofuncs, -}; - -/******************************************************************************* - * PCE engine/subdev functions - ******************************************************************************/ +#include static int gf100_ce_init(struct nvkm_object *object) @@ -89,8 +45,12 @@ gf100_ce_init(struct nvkm_object *object) } static const struct nvkm_falcon_func -gf100_ce_func = { +gf100_ce0_func = { .intr = gt215_ce_intr, + .sclass = { + { -1, -1, FERMI_DMA }, + {} + } }; static int @@ -101,15 +61,13 @@ gf100_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine, struct nvkm_falcon *ce; int ret; - ret = nvkm_falcon_create(&gf100_ce_func, parent, engine, oclass, + ret = nvkm_falcon_create(&gf100_ce0_func, parent, engine, oclass, 0x104000, true, "PCE0", "ce0", &ce); *pobject = nv_object(ce); if (ret) return ret; nv_subdev(ce)->unit = 0x00000040; - nv_engine(ce)->cclass = &gf100_ce0_cclass; - nv_engine(ce)->sclass = gf100_ce0_sclass; nv_falcon(ce)->code.data = gf100_ce_code; nv_falcon(ce)->code.size = sizeof(gf100_ce_code); nv_falcon(ce)->data.data = gf100_ce_data; @@ -117,6 +75,15 @@ gf100_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return 0; } +static const struct nvkm_falcon_func +gf100_ce1_func = { + .intr = gt215_ce_intr, + .sclass = { + { -1, -1, FERMI_DECOMPRESS }, + {} + } +}; + static int gf100_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine, struct nvkm_oclass *oclass, void *data, u32 size, @@ -125,15 +92,13 @@ gf100_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine, struct nvkm_falcon *ce; int ret; - ret = nvkm_falcon_create(&gf100_ce_func, parent, engine, oclass, + ret = nvkm_falcon_create(&gf100_ce1_func, parent, engine, oclass, 0x105000, true, "PCE1", "ce1", &ce); *pobject = nv_object(ce); if (ret) return ret; nv_subdev(ce)->unit = 0x00000080; - nv_engine(ce)->cclass = &gf100_ce1_cclass; - nv_engine(ce)->sclass = gf100_ce1_sclass; nv_falcon(ce)->code.data = gf100_ce_code; nv_falcon(ce)->code.size = sizeof(gf100_ce_code); nv_falcon(ce)->data.data = gf100_ce_data; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c index 1a15b8d6fece..35e4d578b153 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c @@ -28,37 +28,7 @@ #include #include -/******************************************************************************* - * Copy object classes - ******************************************************************************/ - -static struct nvkm_oclass -gt215_ce_sclass[] = { - { 0x85b5, &nvkm_object_ofuncs }, - {} -}; - -/******************************************************************************* - * PCE context - ******************************************************************************/ - -static struct nvkm_oclass -gt215_ce_cclass = { - .handle = NV_ENGCTX(CE0, 0xa3), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - - }, -}; - -/******************************************************************************* - * PCE engine/subdev functions - ******************************************************************************/ +#include static const struct nvkm_enum gt215_ce_isr_error_name[] = { @@ -93,6 +63,10 @@ gt215_ce_intr(struct nvkm_falcon *ce, struct nvkm_fifo_chan *chan) static const struct nvkm_falcon_func gt215_ce_func = { .intr = gt215_ce_intr, + .sclass = { + { -1, -1, GT212_DMA }, + {} + } }; static int @@ -111,8 +85,6 @@ gt215_ce_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(ce)->unit = 0x00802000; - nv_engine(ce)->cclass = >215_ce_cclass; - nv_engine(ce)->sclass = gt215_ce_sclass; nv_falcon(ce)->code.data = gt215_ce_code; nv_falcon(ce)->code.size = sizeof(gt215_ce_code); nv_falcon(ce)->data.data = gt215_ce_data; 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 +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; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c index fbb38450f1e5..f14971783270 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c @@ -24,37 +24,7 @@ #include #include -/******************************************************************************* - * MSPDEC object classes - ******************************************************************************/ - -static struct nvkm_oclass -g98_mspdec_sclass[] = { - { 0x88b2, &nvkm_object_ofuncs }, - { 0x85b2, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSPDEC context - ******************************************************************************/ - -static struct nvkm_oclass -g98_mspdec_cclass = { - .handle = NV_ENGCTX(MSPDEC, 0x98), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSPDEC engine/subdev functions - ******************************************************************************/ +#include static int g98_mspdec_init(struct nvkm_object *object) @@ -74,6 +44,11 @@ g98_mspdec_init(struct nvkm_object *object) static const struct nvkm_falcon_func g98_mspdec_func = { + .sclass = { + { -1, -1, G98_MSPDEC }, + { -1, -1, GT212_MSPDEC }, + {} + }, }; static int @@ -91,8 +66,6 @@ g98_mspdec_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(mspdec)->unit = 0x01020000; - nv_engine(mspdec)->cclass = &g98_mspdec_cclass; - nv_engine(mspdec)->sclass = g98_mspdec_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c index 71b75e9177b4..1296f775ea31 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c @@ -24,36 +24,7 @@ #include #include -/******************************************************************************* - * MSPDEC object classes - ******************************************************************************/ - -static struct nvkm_oclass -gf100_mspdec_sclass[] = { - { 0x90b2, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSPDEC context - ******************************************************************************/ - -static struct nvkm_oclass -gf100_mspdec_cclass = { - .handle = NV_ENGCTX(MSPDEC, 0xc0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSPDEC engine/subdev functions - ******************************************************************************/ +#include static int gf100_mspdec_init(struct nvkm_object *object) @@ -73,6 +44,10 @@ gf100_mspdec_init(struct nvkm_object *object) static const struct nvkm_falcon_func gf100_mspdec_func = { + .sclass = { + { -1, -1, GF100_MSPDEC }, + {} + } }; static int @@ -90,8 +65,6 @@ gf100_mspdec_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(mspdec)->unit = 0x00020000; - nv_engine(mspdec)->cclass = &gf100_mspdec_cclass; - nv_engine(mspdec)->sclass = gf100_mspdec_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c index a103789a2611..315da1695c72 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c @@ -24,36 +24,7 @@ #include #include -/******************************************************************************* - * MSPDEC object classes - ******************************************************************************/ - -static struct nvkm_oclass -gk104_mspdec_sclass[] = { - { 0x95b2, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSPDEC context - ******************************************************************************/ - -static struct nvkm_oclass -gk104_mspdec_cclass = { - .handle = NV_ENGCTX(MSPDEC, 0xe0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSPDEC engine/subdev functions - ******************************************************************************/ +#include static int gk104_mspdec_init(struct nvkm_object *object) @@ -73,6 +44,10 @@ gk104_mspdec_init(struct nvkm_object *object) static const struct nvkm_falcon_func gk104_mspdec_func = { + .sclass = { + { -1, -1, GK104_MSPDEC }, + {} + } }; static int @@ -90,8 +65,6 @@ gk104_mspdec_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(falcon)->unit = 0x00020000; - nv_engine(falcon)->cclass = &gk104_mspdec_cclass; - nv_engine(falcon)->sclass = gk104_mspdec_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c index 9029ff0ea86d..314736d6aa5b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c @@ -24,37 +24,7 @@ #include #include -/******************************************************************************* - * MSPPP object classes - ******************************************************************************/ - -static struct nvkm_oclass -g98_msppp_sclass[] = { - { 0x88b3, &nvkm_object_ofuncs }, - { 0x85b3, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSPPP context - ******************************************************************************/ - -static struct nvkm_oclass -g98_msppp_cclass = { - .handle = NV_ENGCTX(MSPPP, 0x98), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSPPP engine/subdev functions - ******************************************************************************/ +#include static int g98_msppp_init(struct nvkm_object *object) @@ -74,6 +44,11 @@ g98_msppp_init(struct nvkm_object *object) static const struct nvkm_falcon_func g98_msppp_func = { + .sclass = { + { -1, -1, G98_MSPPP }, + { -1, -1, GT212_MSPPP }, + {} + } }; static int @@ -91,8 +66,6 @@ g98_msppp_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(msppp)->unit = 0x00400002; - nv_engine(msppp)->cclass = &g98_msppp_cclass; - nv_engine(msppp)->sclass = g98_msppp_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c index 2b21fe5dafda..f977c2adf9d2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c @@ -24,36 +24,7 @@ #include #include -/******************************************************************************* - * MSPPP object classes - ******************************************************************************/ - -static struct nvkm_oclass -gf100_msppp_sclass[] = { - { 0x90b3, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSPPP context - ******************************************************************************/ - -static struct nvkm_oclass -gf100_msppp_cclass = { - .handle = NV_ENGCTX(MSPPP, 0xc0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSPPP engine/subdev functions - ******************************************************************************/ +#include static int gf100_msppp_init(struct nvkm_object *object) @@ -73,6 +44,10 @@ gf100_msppp_init(struct nvkm_object *object) static const struct nvkm_falcon_func gf100_msppp_func = { + .sclass = { + { -1, -1, GF100_MSPPP }, + {} + } }; static int @@ -90,8 +65,6 @@ gf100_msppp_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(msppp)->unit = 0x00000002; - nv_engine(msppp)->cclass = &gf100_msppp_cclass; - nv_engine(msppp)->sclass = gf100_msppp_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c index cdb7de5a7305..0ee767373f79 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c @@ -24,38 +24,7 @@ #include #include -/******************************************************************************* - * MSVLD object classes - ******************************************************************************/ - -static struct nvkm_oclass -g98_msvld_sclass[] = { - { 0x88b1, &nvkm_object_ofuncs }, - { 0x85b1, &nvkm_object_ofuncs }, - { 0x86b1, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSVLD context - ******************************************************************************/ - -static struct nvkm_oclass -g98_msvld_cclass = { - .handle = NV_ENGCTX(MSVLD, 0x98), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSVLD engine/subdev functions - ******************************************************************************/ +#include static int g98_msvld_init(struct nvkm_object *object) @@ -75,6 +44,12 @@ g98_msvld_init(struct nvkm_object *object) static const struct nvkm_falcon_func g98_msvld_func = { + .sclass = { + { -1, -1, G98_MSVLD }, + { -1, -1, GT212_MSVLD }, + { -1, -1, IGT21A_MSVLD }, + {} + } }; static int @@ -92,8 +67,6 @@ g98_msvld_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(msvld)->unit = 0x04008000; - nv_engine(msvld)->cclass = &g98_msvld_cclass; - nv_engine(msvld)->sclass = g98_msvld_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c index 1124373be920..839d648dcfdf 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c @@ -24,36 +24,7 @@ #include #include -/******************************************************************************* - * MSVLD object classes - ******************************************************************************/ - -static struct nvkm_oclass -gf100_msvld_sclass[] = { - { 0x90b1, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSVLD context - ******************************************************************************/ - -static struct nvkm_oclass -gf100_msvld_cclass = { - .handle = NV_ENGCTX(MSVLD, 0xc0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSVLD engine/subdev functions - ******************************************************************************/ +#include static int gf100_msvld_init(struct nvkm_object *object) @@ -73,6 +44,10 @@ gf100_msvld_init(struct nvkm_object *object) static const struct nvkm_falcon_func gf100_msvld_func = { + .sclass = { + { -1, -1, GF100_MSVLD }, + {} + } }; static int @@ -90,8 +65,6 @@ gf100_msvld_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(msvld)->unit = 0x00008000; - nv_engine(msvld)->cclass = &gf100_msvld_cclass; - nv_engine(msvld)->sclass = gf100_msvld_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c index addef2bbfe76..74bdca359d4a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c @@ -24,36 +24,7 @@ #include #include -/******************************************************************************* - * MSVLD object classes - ******************************************************************************/ - -static struct nvkm_oclass -gk104_msvld_sclass[] = { - { 0x95b1, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PMSVLD context - ******************************************************************************/ - -static struct nvkm_oclass -gk104_msvld_cclass = { - .handle = NV_ENGCTX(MSVLD, 0xe0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PMSVLD engine/subdev functions - ******************************************************************************/ +#include static int gk104_msvld_init(struct nvkm_object *object) @@ -73,6 +44,10 @@ gk104_msvld_init(struct nvkm_object *object) static const struct nvkm_falcon_func gk104_msvld_func = { + .sclass = { + { -1, -1, GK104_MSVLD }, + {} + } }; static int @@ -90,8 +65,6 @@ gk104_msvld_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(msvld)->unit = 0x00008000; - nv_engine(msvld)->cclass = &gk104_msvld_cclass; - nv_engine(msvld)->sclass = gk104_msvld_sclass; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c index c15934d7ff63..aae0e85b1075 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c @@ -29,36 +29,7 @@ #include #include -/******************************************************************************* - * Crypt object classes - ******************************************************************************/ - -static struct nvkm_oclass -g98_sec_sclass[] = { - { 0x88b4, &nvkm_object_ofuncs }, - {}, -}; - -/******************************************************************************* - * PSEC context - ******************************************************************************/ - -static struct nvkm_oclass -g98_sec_cclass = { - .handle = NV_ENGCTX(SEC, 0x98), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = _nvkm_falcon_context_ctor, - .dtor = _nvkm_falcon_context_dtor, - .init = _nvkm_falcon_context_init, - .fini = _nvkm_falcon_context_fini, - .rd32 = _nvkm_falcon_context_rd32, - .wr32 = _nvkm_falcon_context_wr32, - }, -}; - -/******************************************************************************* - * PSEC engine/subdev functions - ******************************************************************************/ +#include static const struct nvkm_enum g98_sec_isr_error_name[] = { { 0x0000, "ILLEGAL_MTHD" }, @@ -92,6 +63,10 @@ g98_sec_intr(struct nvkm_falcon *sec, struct nvkm_fifo_chan *chan) static const struct nvkm_falcon_func g98_sec_func = { .intr = g98_sec_intr, + .sclass = { + { -1, -1, G98_SEC }, + {} + } }; static int @@ -109,8 +84,6 @@ g98_sec_ctor(struct nvkm_object *parent, struct nvkm_object *engine, return ret; nv_subdev(sec)->unit = 0x00004000; - nv_engine(sec)->cclass = &g98_sec_cclass; - nv_engine(sec)->sclass = g98_sec_sclass; nv_falcon(sec)->code.data = g98_sec_code; nv_falcon(sec)->code.size = sizeof(g98_sec_code); nv_falcon(sec)->data.data = g98_sec_data; -- GitLab