drm/nouveau/nvdec: initialise SW state for falcon from constructor
This will allow us to register the falcon with ACR, and further customise its behaviour by providing the nvkm_falcon_func structure directly. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
98a34d9950
commit
3a900a5d9c
@ -3,13 +3,12 @@
|
||||
#define __NVKM_NVDEC_H__
|
||||
#define nvkm_nvdec(p) container_of((p), struct nvkm_nvdec, engine)
|
||||
#include <core/engine.h>
|
||||
#include <core/falcon.h>
|
||||
|
||||
struct nvkm_nvdec {
|
||||
const struct nvkm_nvdec_func *func;
|
||||
struct nvkm_engine engine;
|
||||
u32 addr;
|
||||
|
||||
struct nvkm_falcon *falcon;
|
||||
struct nvkm_falcon falcon;
|
||||
};
|
||||
|
||||
int gp102_nvdec_new(struct nvkm_device *, int, struct nvkm_nvdec **);
|
||||
|
@ -20,38 +20,19 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "priv.h"
|
||||
|
||||
#include <core/firmware.h>
|
||||
#include <subdev/top.h>
|
||||
#include <engine/falcon.h>
|
||||
|
||||
static int
|
||||
nvkm_nvdec_oneinit(struct nvkm_engine *engine)
|
||||
{
|
||||
struct nvkm_nvdec *nvdec = nvkm_nvdec(engine);
|
||||
struct nvkm_subdev *subdev = &nvdec->engine.subdev;
|
||||
|
||||
nvdec->addr = nvkm_top_addr(subdev->device, subdev->index);
|
||||
if (!nvdec->addr)
|
||||
return -EINVAL;
|
||||
|
||||
/*XXX: fix naming of this when adding support for multiple-NVDEC */
|
||||
return nvkm_falcon_v1_new(subdev, "NVDEC", nvdec->addr,
|
||||
&nvdec->falcon);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvkm_nvdec_dtor(struct nvkm_engine *engine)
|
||||
{
|
||||
struct nvkm_nvdec *nvdec = nvkm_nvdec(engine);
|
||||
nvkm_falcon_del(&nvdec->falcon);
|
||||
nvkm_falcon_dtor(&nvdec->falcon);
|
||||
return nvdec;
|
||||
}
|
||||
|
||||
static const struct nvkm_engine_func
|
||||
nvkm_nvdec = {
|
||||
.dtor = nvkm_nvdec_dtor,
|
||||
.oneinit = nvkm_nvdec_oneinit,
|
||||
};
|
||||
|
||||
int
|
||||
@ -74,5 +55,7 @@ nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *device,
|
||||
return -ENODEV;
|
||||
|
||||
nvdec->func = fwif->func;
|
||||
return 0;
|
||||
|
||||
return nvkm_falcon_ctor(nvdec->func->flcn, &nvdec->engine.subdev,
|
||||
nvkm_subdev_name[index], 0, &nvdec->falcon);
|
||||
};
|
||||
|
@ -21,8 +21,23 @@
|
||||
*/
|
||||
#include "priv.h"
|
||||
|
||||
static const struct nvkm_falcon_func
|
||||
gp102_nvdec_flcn = {
|
||||
.load_imem = nvkm_falcon_v1_load_imem,
|
||||
.load_dmem = nvkm_falcon_v1_load_dmem,
|
||||
.read_dmem = nvkm_falcon_v1_read_dmem,
|
||||
.bind_context = nvkm_falcon_v1_bind_context,
|
||||
.wait_for_halt = nvkm_falcon_v1_wait_for_halt,
|
||||
.clear_interrupt = nvkm_falcon_v1_clear_interrupt,
|
||||
.set_start_addr = nvkm_falcon_v1_set_start_addr,
|
||||
.start = nvkm_falcon_v1_start,
|
||||
.enable = nvkm_falcon_v1_enable,
|
||||
.disable = nvkm_falcon_v1_disable,
|
||||
};
|
||||
|
||||
static const struct nvkm_nvdec_func
|
||||
gp102_nvdec = {
|
||||
.flcn = &gp102_nvdec_flcn,
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <engine/nvdec.h>
|
||||
|
||||
struct nvkm_nvdec_func {
|
||||
const struct nvkm_falcon_func *flcn;
|
||||
};
|
||||
|
||||
struct nvkm_nvdec_fwif {
|
||||
|
@ -62,7 +62,7 @@ gp102_run_secure_scrub(struct nvkm_secboot *sb)
|
||||
engine = nvkm_engine_ref(&device->nvdec[0]->engine);
|
||||
if (IS_ERR(engine))
|
||||
return PTR_ERR(engine);
|
||||
falcon = device->nvdec[0]->falcon;
|
||||
falcon = &device->nvdec[0]->falcon;
|
||||
|
||||
nvkm_falcon_get(falcon, &sb->subdev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user