#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
#ifndef __NVKM_FALCON_H__
#define __NVKM_FALCON_H__
-#include <core/engctx.h>
+#define nvkm_falcon(p) container_of((p), struct nvkm_falcon, engine)
+#include <core/engine.h>
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 <core/engine.h>
-
struct nvkm_falcon {
struct nvkm_engine engine;
const struct nvkm_falcon_func *func;
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)
#include <engine/falcon.h>
#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 <nvif/class.h>
static int
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
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;
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,
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;
#include <core/client.h>
#include <core/enum.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static const struct nvkm_enum
gt215_ce_isr_error_name[] = {
static const struct nvkm_falcon_func
gt215_ce_func = {
.intr = gt215_ce_intr,
+ .sclass = {
+ { -1, -1, GT212_DMA },
+ {}
+ }
};
static int
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;
#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)
{
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,
return ret;
falcon->engine.subdev.intr = nvkm_falcon_intr;
+ falcon->engine.func = &nvkm_falcon;
falcon->func = func;
falcon->addr = addr;
return 0;
#include <engine/mspdec.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
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
return ret;
nv_subdev(mspdec)->unit = 0x01020000;
- nv_engine(mspdec)->cclass = &g98_mspdec_cclass;
- nv_engine(mspdec)->sclass = g98_mspdec_sclass;
return 0;
}
#include <engine/mspdec.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
gf100_mspdec_init(struct nvkm_object *object)
static const struct nvkm_falcon_func
gf100_mspdec_func = {
+ .sclass = {
+ { -1, -1, GF100_MSPDEC },
+ {}
+ }
};
static int
return ret;
nv_subdev(mspdec)->unit = 0x00020000;
- nv_engine(mspdec)->cclass = &gf100_mspdec_cclass;
- nv_engine(mspdec)->sclass = gf100_mspdec_sclass;
return 0;
}
#include <engine/mspdec.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
gk104_mspdec_init(struct nvkm_object *object)
static const struct nvkm_falcon_func
gk104_mspdec_func = {
+ .sclass = {
+ { -1, -1, GK104_MSPDEC },
+ {}
+ }
};
static int
return ret;
nv_subdev(falcon)->unit = 0x00020000;
- nv_engine(falcon)->cclass = &gk104_mspdec_cclass;
- nv_engine(falcon)->sclass = gk104_mspdec_sclass;
return 0;
}
#include <engine/msppp.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
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
return ret;
nv_subdev(msppp)->unit = 0x00400002;
- nv_engine(msppp)->cclass = &g98_msppp_cclass;
- nv_engine(msppp)->sclass = g98_msppp_sclass;
return 0;
}
#include <engine/msppp.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
gf100_msppp_init(struct nvkm_object *object)
static const struct nvkm_falcon_func
gf100_msppp_func = {
+ .sclass = {
+ { -1, -1, GF100_MSPPP },
+ {}
+ }
};
static int
return ret;
nv_subdev(msppp)->unit = 0x00000002;
- nv_engine(msppp)->cclass = &gf100_msppp_cclass;
- nv_engine(msppp)->sclass = gf100_msppp_sclass;
return 0;
}
#include <engine/msvld.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
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
return ret;
nv_subdev(msvld)->unit = 0x04008000;
- nv_engine(msvld)->cclass = &g98_msvld_cclass;
- nv_engine(msvld)->sclass = g98_msvld_sclass;
return 0;
}
#include <engine/msvld.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
gf100_msvld_init(struct nvkm_object *object)
static const struct nvkm_falcon_func
gf100_msvld_func = {
+ .sclass = {
+ { -1, -1, GF100_MSVLD },
+ {}
+ }
};
static int
return ret;
nv_subdev(msvld)->unit = 0x00008000;
- nv_engine(msvld)->cclass = &gf100_msvld_cclass;
- nv_engine(msvld)->sclass = gf100_msvld_sclass;
return 0;
}
#include <engine/msvld.h>
#include <engine/falcon.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static int
gk104_msvld_init(struct nvkm_object *object)
static const struct nvkm_falcon_func
gk104_msvld_func = {
+ .sclass = {
+ { -1, -1, GK104_MSVLD },
+ {}
+ }
};
static int
return ret;
nv_subdev(msvld)->unit = 0x00008000;
- nv_engine(msvld)->cclass = &gk104_msvld_cclass;
- nv_engine(msvld)->sclass = gk104_msvld_sclass;
return 0;
}
#include <core/client.h>
#include <core/enum.h>
-/*******************************************************************************
- * 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 <nvif/class.h>
static const struct nvkm_enum g98_sec_isr_error_name[] = {
{ 0x0000, "ILLEGAL_MTHD" },
static const struct nvkm_falcon_func
g98_sec_func = {
.intr = g98_sec_intr,
+ .sclass = {
+ { -1, -1, G98_SEC },
+ {}
+ }
};
static int
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;