Commit 8bf2d348 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gr/gf100-: move fecs discover_pm_image_size into a function

Makes the code somewhat less magic.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7d3f0688
...@@ -715,6 +715,22 @@ gf100_gr_pack_mmio[] = { ...@@ -715,6 +715,22 @@ gf100_gr_pack_mmio[] = {
* PGRAPH engine/subdev functions * PGRAPH engine/subdev functions
******************************************************************************/ ******************************************************************************/
static int
gf100_gr_fecs_discover_pm_image_size(struct gf100_gr *gr, u32 *psize)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
nvkm_wr32(device, 0x409840, 0xffffffff);
nvkm_wr32(device, 0x409500, 0x00000000);
nvkm_wr32(device, 0x409504, 0x00000025);
nvkm_msec(device, 2000,
if ((*psize = nvkm_rd32(device, 0x409800)))
return 0;
);
return -ETIMEDOUT;
}
static int static int
gf100_gr_fecs_discover_zcull_image_size(struct gf100_gr *gr, u32 *psize) gf100_gr_fecs_discover_zcull_image_size(struct gf100_gr *gr, u32 *psize)
{ {
...@@ -1579,14 +1595,10 @@ gf100_gr_init_ctxctl_ext(struct gf100_gr *gr) ...@@ -1579,14 +1595,10 @@ gf100_gr_init_ctxctl_ext(struct gf100_gr *gr)
if (ret) if (ret)
return ret; return ret;
nvkm_wr32(device, 0x409840, 0xffffffff); /* Determine how much memory is required to store PerfMon image. */
nvkm_wr32(device, 0x409500, 0x00000000); ret = gf100_gr_fecs_discover_pm_image_size(gr, &gr->size_pm);
nvkm_wr32(device, 0x409504, 0x00000025); if (ret)
if (nvkm_msec(device, 2000, return ret;
if (nvkm_rd32(device, 0x409800))
break;
) < 0)
return -EBUSY;
if (device->chipset >= 0xe0) { if (device->chipset >= 0xe0) {
nvkm_wr32(device, 0x409800, 0x00000000); nvkm_wr32(device, 0x409800, 0x00000000);
......
...@@ -129,6 +129,7 @@ struct gf100_gr { ...@@ -129,6 +129,7 @@ struct gf100_gr {
u32 size; u32 size;
u32 *data; u32 *data;
u32 size_zcull; u32 size_zcull;
u32 size_pm;
}; };
int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *, int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *,
......
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