Commit 400c2a45 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/sec: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent e73d371a
...@@ -60,7 +60,6 @@ struct nvkm_device { ...@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb; struct notifier_block nb;
} acpi; } acpi;
struct nvkm_engine *sec;
struct nvkm_sec2 *sec2; struct nvkm_sec2 *sec2;
struct nvkm_sw *sw; struct nvkm_sw *sw;
struct nvkm_engine *vic; struct nvkm_engine *vic;
...@@ -105,7 +104,6 @@ struct nvkm_device_chip { ...@@ -105,7 +104,6 @@ struct nvkm_device_chip {
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
int (*sec )(struct nvkm_device *, int idx, struct nvkm_engine **);
int (*sec2 )(struct nvkm_device *, int idx, struct nvkm_sec2 **); int (*sec2 )(struct nvkm_device *, int idx, struct nvkm_sec2 **);
int (*sw )(struct nvkm_device *, int idx, struct nvkm_sw **); int (*sw )(struct nvkm_device *, int idx, struct nvkm_sw **);
int (*vic )(struct nvkm_device *, int idx, struct nvkm_engine **); int (*vic )(struct nvkm_device *, int idx, struct nvkm_engine **);
......
...@@ -42,4 +42,5 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld) ...@@ -42,4 +42,5 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld)
NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 3) NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 3)
NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3) NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm , pm) NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm , pm)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC , struct nvkm_engine , sec)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP , struct nvkm_engine , vp) NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP , struct nvkm_engine , vp)
...@@ -63,12 +63,8 @@ void nvkm_falcon_del(struct nvkm_falcon **); ...@@ -63,12 +63,8 @@ void nvkm_falcon_del(struct nvkm_falcon **);
int nvkm_falcon_get(struct nvkm_falcon *, const struct nvkm_subdev *); int nvkm_falcon_get(struct nvkm_falcon *, const struct nvkm_subdev *);
void nvkm_falcon_put(struct nvkm_falcon *, const struct nvkm_subdev *); void nvkm_falcon_put(struct nvkm_falcon *, const struct nvkm_subdev *);
int nvkm_falcon_new__(const struct nvkm_falcon_func *, bool old, struct nvkm_device *, int nvkm_falcon_new_(const struct nvkm_falcon_func *, struct nvkm_device *,
enum nvkm_subdev_type, int inst, bool enable, u32 addr, struct nvkm_engine **); enum nvkm_subdev_type, int inst, bool enable, u32 addr, struct nvkm_engine **);
#define nvkm_falcon_new__o(f,d,i, e,a,s) nvkm_falcon_new__((f), true, (d), (i), -1 , (e), (a), (s))
#define nvkm_falcon_new__n(f,d,t,i,e,a,s) nvkm_falcon_new__((f), false, (d), (t), (i), (e), (a), (s))
#define nvkm_falcon_new___(_1,_2,_3,_4,_5,_6,_7,IMPL,...) IMPL
#define nvkm_falcon_new_(A...) nvkm_falcon_new___(A, nvkm_falcon_new__n, nvkm_falcon_new__o)(A)
struct nvkm_falcon_func { struct nvkm_falcon_func {
struct { struct {
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
#ifndef __NVKM_SEC_H__ #ifndef __NVKM_SEC_H__
#define __NVKM_SEC_H__ #define __NVKM_SEC_H__
#include <engine/falcon.h> #include <engine/falcon.h>
int g98_sec_new(struct nvkm_device *, int, struct nvkm_engine **); int g98_sec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
#endif #endif
...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = { ...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
[NVKM_ENGINE_SEC ] = "sec",
[NVKM_ENGINE_SEC2 ] = "sec2", [NVKM_ENGINE_SEC2 ] = "sec2",
[NVKM_ENGINE_SW ] = "sw", [NVKM_ENGINE_SW ] = "sw",
[NVKM_ENGINE_VIC ] = "vic", [NVKM_ENGINE_VIC ] = "vic",
......
...@@ -1102,7 +1102,7 @@ nv98_chipset = { ...@@ -1102,7 +1102,7 @@ nv98_chipset = {
.msppp = { 0x00000001, g98_msppp_new }, .msppp = { 0x00000001, g98_msppp_new },
.msvld = { 0x00000001, g98_msvld_new }, .msvld = { 0x00000001, g98_msvld_new },
.pm = { 0x00000001, g84_pm_new }, .pm = { 0x00000001, g84_pm_new },
.sec = g98_sec_new, .sec = { 0x00000001, g98_sec_new },
.sw = nv50_sw_new, .sw = nv50_sw_new,
}; };
...@@ -1266,7 +1266,7 @@ nvaa_chipset = { ...@@ -1266,7 +1266,7 @@ nvaa_chipset = {
.msppp = { 0x00000001, g98_msppp_new }, .msppp = { 0x00000001, g98_msppp_new },
.msvld = { 0x00000001, g98_msvld_new }, .msvld = { 0x00000001, g98_msvld_new },
.pm = { 0x00000001, g84_pm_new }, .pm = { 0x00000001, g84_pm_new },
.sec = g98_sec_new, .sec = { 0x00000001, g98_sec_new },
.sw = nv50_sw_new, .sw = nv50_sw_new,
}; };
...@@ -1298,7 +1298,7 @@ nvac_chipset = { ...@@ -1298,7 +1298,7 @@ nvac_chipset = {
.msppp = { 0x00000001, g98_msppp_new }, .msppp = { 0x00000001, g98_msppp_new },
.msvld = { 0x00000001, g98_msvld_new }, .msvld = { 0x00000001, g98_msvld_new },
.pm = { 0x00000001, g84_pm_new }, .pm = { 0x00000001, g84_pm_new },
.sec = g98_sec_new, .sec = { 0x00000001, g98_sec_new },
.sw = nv50_sw_new, .sw = nv50_sw_new,
}; };
...@@ -3162,7 +3162,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3162,7 +3162,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
_(NVKM_ENGINE_SEC , sec);
_(NVKM_ENGINE_SEC2 , sec2); _(NVKM_ENGINE_SEC2 , sec2);
_(NVKM_ENGINE_SW , sw); _(NVKM_ENGINE_SW , sw);
_(NVKM_ENGINE_VIC , vic); _(NVKM_ENGINE_VIC , vic);
......
...@@ -335,7 +335,7 @@ nvkm_falcon = { ...@@ -335,7 +335,7 @@ nvkm_falcon = {
}; };
int int
nvkm_falcon_new__(const struct nvkm_falcon_func *func, bool old, struct nvkm_device *device, nvkm_falcon_new_(const struct nvkm_falcon_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, bool enable, u32 addr, enum nvkm_subdev_type type, int inst, bool enable, u32 addr,
struct nvkm_engine **pengine) struct nvkm_engine **pengine)
{ {
...@@ -351,5 +351,5 @@ nvkm_falcon_new__(const struct nvkm_falcon_func *func, bool old, struct nvkm_dev ...@@ -351,5 +351,5 @@ nvkm_falcon_new__(const struct nvkm_falcon_func *func, bool old, struct nvkm_dev
falcon->data.size = func->data.size; falcon->data.size = func->data.size;
*pengine = &falcon->engine; *pengine = &falcon->engine;
return nvkm_engine_ctor_(&nvkm_falcon, old, device, type, inst, enable, &falcon->engine); return nvkm_engine_ctor(&nvkm_falcon, device, type, inst, enable, &falcon->engine);
} }
...@@ -74,9 +74,8 @@ g98_sec = { ...@@ -74,9 +74,8 @@ g98_sec = {
}; };
int int
g98_sec_new(struct nvkm_device *device, int index, g98_sec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_engine **pengine) struct nvkm_engine **pengine)
{ {
return nvkm_falcon_new_(&g98_sec, device, index, return nvkm_falcon_new_(&g98_sec, device, type, inst, true, 0x087000, pengine);
true, 0x087000, pengine);
} }
...@@ -45,7 +45,7 @@ g98_devinit_disable(struct nvkm_devinit *init) ...@@ -45,7 +45,7 @@ g98_devinit_disable(struct nvkm_devinit *init)
if (!(r00154c & 0x00000020)) if (!(r00154c & 0x00000020))
nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0); nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
if (!(r00154c & 0x00000040)) if (!(r00154c & 0x00000040))
disable |= (1ULL << NVKM_ENGINE_SEC); nvkm_subdev_disable(device, NVKM_ENGINE_SEC, 0);
return disable; return disable;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment