Commit 11375021 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gr/gf100-: move some code around to make next commits nicer

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 0ceceaa9
...@@ -2055,22 +2055,6 @@ gf100_gr_dtor(struct nvkm_gr *base) ...@@ -2055,22 +2055,6 @@ gf100_gr_dtor(struct nvkm_gr *base)
return gr; return gr;
} }
static const struct nvkm_gr_func
gf100_gr_ = {
.dtor = gf100_gr_dtor,
.oneinit = gf100_gr_oneinit,
.init = gf100_gr_init_,
.fini = gf100_gr_fini,
.intr = gf100_gr_intr,
.units = gf100_gr_units,
.chan_new = gf100_gr_chan_new,
.object_get = gf100_gr_object_get,
.chsw_load = gf100_gr_chsw_load,
.ctxsw.pause = gf100_gr_fecs_stop_ctxsw,
.ctxsw.resume = gf100_gr_fecs_start_ctxsw,
.ctxsw.inst = gf100_gr_ctxsw_inst,
};
static const struct nvkm_falcon_func static const struct nvkm_falcon_func
gf100_gr_flcn = { gf100_gr_flcn = {
.load_imem = nvkm_falcon_v1_load_imem, .load_imem = nvkm_falcon_v1_load_imem,
...@@ -2078,42 +2062,6 @@ gf100_gr_flcn = { ...@@ -2078,42 +2062,6 @@ gf100_gr_flcn = {
.start = nvkm_falcon_v1_start, .start = nvkm_falcon_v1_start,
}; };
int
gf100_gr_new_(const struct gf100_gr_fwif *fwif, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
{
struct gf100_gr *gr;
int ret;
if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
return -ENOMEM;
*pgr = &gr->base;
ret = nvkm_gr_ctor(&gf100_gr_, device, type, inst, true, &gr->base);
if (ret)
return ret;
fwif = nvkm_firmware_load(&gr->base.engine.subdev, fwif, "Gr", gr);
if (IS_ERR(fwif))
return PTR_ERR(fwif);
gr->func = fwif->func;
ret = nvkm_falcon_ctor(&gf100_gr_flcn, &gr->base.engine.subdev,
"fecs", 0x409000, &gr->fecs.falcon);
if (ret)
return ret;
mutex_init(&gr->fecs.mutex);
ret = nvkm_falcon_ctor(&gf100_gr_flcn, &gr->base.engine.subdev,
"gpccs", 0x41a000, &gr->gpccs.falcon);
if (ret)
return ret;
return 0;
}
void void
gf100_gr_init_num_tpc_per_gpc(struct gf100_gr *gr, bool pd, bool ds) gf100_gr_init_num_tpc_per_gpc(struct gf100_gr *gr, bool pd, bool ds)
{ {
...@@ -2383,6 +2331,22 @@ gf100_gr_gpccs_ucode = { ...@@ -2383,6 +2331,22 @@ gf100_gr_gpccs_ucode = {
.data.size = sizeof(gf100_grgpc_data), .data.size = sizeof(gf100_grgpc_data),
}; };
static const struct nvkm_gr_func
gf100_gr_ = {
.dtor = gf100_gr_dtor,
.oneinit = gf100_gr_oneinit,
.init = gf100_gr_init_,
.fini = gf100_gr_fini,
.intr = gf100_gr_intr,
.units = gf100_gr_units,
.chan_new = gf100_gr_chan_new,
.object_get = gf100_gr_object_get,
.chsw_load = gf100_gr_chsw_load,
.ctxsw.pause = gf100_gr_fecs_stop_ctxsw,
.ctxsw.resume = gf100_gr_fecs_start_ctxsw,
.ctxsw.inst = gf100_gr_ctxsw_inst,
};
static const struct gf100_gr_func static const struct gf100_gr_func
gf100_gr = { gf100_gr = {
.oneinit_tiles = gf100_gr_oneinit_tiles, .oneinit_tiles = gf100_gr_oneinit_tiles,
...@@ -2474,6 +2438,42 @@ gf100_gr_fwif[] = { ...@@ -2474,6 +2438,42 @@ gf100_gr_fwif[] = {
{} {}
}; };
int
gf100_gr_new_(const struct gf100_gr_fwif *fwif, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
{
struct gf100_gr *gr;
int ret;
if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
return -ENOMEM;
*pgr = &gr->base;
ret = nvkm_gr_ctor(&gf100_gr_, device, type, inst, true, &gr->base);
if (ret)
return ret;
fwif = nvkm_firmware_load(&gr->base.engine.subdev, fwif, "Gr", gr);
if (IS_ERR(fwif))
return PTR_ERR(fwif);
gr->func = fwif->func;
ret = nvkm_falcon_ctor(&gf100_gr_flcn, &gr->base.engine.subdev,
"fecs", 0x409000, &gr->fecs.falcon);
if (ret)
return ret;
mutex_init(&gr->fecs.mutex);
ret = nvkm_falcon_ctor(&gf100_gr_flcn, &gr->base.engine.subdev,
"gpccs", 0x41a000, &gr->gpccs.falcon);
if (ret)
return ret;
return 0;
}
int int
gf100_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr) gf100_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
{ {
......
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