summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 14:54:10 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:40:17 +1000
commit276836d46e535c8ca299a1ea8302879dbdd3e93a (patch)
tree1d74d68b4998edf42bc88c667fe33388f988a603 /drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
parent8774440390cdfe37c5d003f850847c9fd67cdf61 (diff)
drm/nouveau/gr: switch to device pri macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c202
1 files changed, 103 insertions, 99 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
index 3c2df9d29ff3..edcaa65b1e09 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
@@ -42,7 +42,7 @@ struct nv40_gr_chan {
static u64
nv40_gr_units(struct nvkm_gr *gr)
{
- return nv_rd32(gr, 0x1540);
+ return nvkm_rd32(gr->engine.subdev.device, 0x1540);
}
/*******************************************************************************
@@ -155,31 +155,32 @@ nv40_gr_context_fini(struct nvkm_object *object, bool suspend)
{
struct nv40_gr *gr = (void *)object->engine;
struct nv40_gr_chan *chan = (void *)object;
+ struct nvkm_device *device = gr->base.engine.subdev.device;
u32 inst = 0x01000000 | nv_gpuobj(chan)->addr >> 4;
int ret = 0;
- nv_mask(gr, 0x400720, 0x00000001, 0x00000000);
+ nvkm_mask(device, 0x400720, 0x00000001, 0x00000000);
- if (nv_rd32(gr, 0x40032c) == inst) {
+ if (nvkm_rd32(device, 0x40032c) == inst) {
if (suspend) {
- nv_wr32(gr, 0x400720, 0x00000000);
- nv_wr32(gr, 0x400784, inst);
- nv_mask(gr, 0x400310, 0x00000020, 0x00000020);
- nv_mask(gr, 0x400304, 0x00000001, 0x00000001);
+ nvkm_wr32(device, 0x400720, 0x00000000);
+ nvkm_wr32(device, 0x400784, inst);
+ nvkm_mask(device, 0x400310, 0x00000020, 0x00000020);
+ nvkm_mask(device, 0x400304, 0x00000001, 0x00000001);
if (!nv_wait(gr, 0x400300, 0x00000001, 0x00000000)) {
- u32 insn = nv_rd32(gr, 0x400308);
+ u32 insn = nvkm_rd32(device, 0x400308);
nv_warn(gr, "ctxprog timeout 0x%08x\n", insn);
ret = -EBUSY;
}
}
- nv_mask(gr, 0x40032c, 0x01000000, 0x00000000);
+ nvkm_mask(device, 0x40032c, 0x01000000, 0x00000000);
}
- if (nv_rd32(gr, 0x400330) == inst)
- nv_mask(gr, 0x400330, 0x01000000, 0x00000000);
+ if (nvkm_rd32(device, 0x400330) == inst)
+ nvkm_mask(device, 0x400330, 0x01000000, 0x00000000);
- nv_mask(gr, 0x400720, 0x00000001, 0x00000001);
+ nvkm_mask(device, 0x400720, 0x00000001, 0x00000001);
return ret;
}
@@ -203,9 +204,10 @@ nv40_gr_cclass = {
static void
nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
{
- struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i];
- struct nvkm_fifo *fifo = nvkm_fifo(engine);
struct nv40_gr *gr = (void *)engine;
+ struct nvkm_device *device = gr->base.engine.subdev.device;
+ struct nvkm_fifo *fifo = device->fifo;
+ struct nvkm_fb_tile *tile = &device->fb->tile.region[i];
unsigned long flags;
fifo->pause(fifo, &flags);
@@ -218,23 +220,23 @@ nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
case 0x43:
case 0x45:
case 0x4e:
- nv_wr32(gr, NV20_PGRAPH_TSIZE(i), tile->pitch);
- nv_wr32(gr, NV20_PGRAPH_TLIMIT(i), tile->limit);
- nv_wr32(gr, NV20_PGRAPH_TILE(i), tile->addr);
- nv_wr32(gr, NV40_PGRAPH_TSIZE1(i), tile->pitch);
- nv_wr32(gr, NV40_PGRAPH_TLIMIT1(i), tile->limit);
- nv_wr32(gr, NV40_PGRAPH_TILE1(i), tile->addr);
+ nvkm_wr32(device, NV20_PGRAPH_TSIZE(i), tile->pitch);
+ nvkm_wr32(device, NV20_PGRAPH_TLIMIT(i), tile->limit);
+ nvkm_wr32(device, NV20_PGRAPH_TILE(i), tile->addr);
+ nvkm_wr32(device, NV40_PGRAPH_TSIZE1(i), tile->pitch);
+ nvkm_wr32(device, NV40_PGRAPH_TLIMIT1(i), tile->limit);
+ nvkm_wr32(device, NV40_PGRAPH_TILE1(i), tile->addr);
switch (nv_device(gr)->chipset) {
case 0x40:
case 0x45:
- nv_wr32(gr, NV20_PGRAPH_ZCOMP(i), tile->zcomp);
- nv_wr32(gr, NV40_PGRAPH_ZCOMP1(i), tile->zcomp);
+ nvkm_wr32(device, NV20_PGRAPH_ZCOMP(i), tile->zcomp);
+ nvkm_wr32(device, NV40_PGRAPH_ZCOMP1(i), tile->zcomp);
break;
case 0x41:
case 0x42:
case 0x43:
- nv_wr32(gr, NV41_PGRAPH_ZCOMP0(i), tile->zcomp);
- nv_wr32(gr, NV41_PGRAPH_ZCOMP1(i), tile->zcomp);
+ nvkm_wr32(device, NV41_PGRAPH_ZCOMP0(i), tile->zcomp);
+ nvkm_wr32(device, NV41_PGRAPH_ZCOMP1(i), tile->zcomp);
break;
default:
break;
@@ -242,9 +244,9 @@ nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
break;
case 0x44:
case 0x4a:
- nv_wr32(gr, NV20_PGRAPH_TSIZE(i), tile->pitch);
- nv_wr32(gr, NV20_PGRAPH_TLIMIT(i), tile->limit);
- nv_wr32(gr, NV20_PGRAPH_TILE(i), tile->addr);
+ nvkm_wr32(device, NV20_PGRAPH_TSIZE(i), tile->pitch);
+ nvkm_wr32(device, NV20_PGRAPH_TLIMIT(i), tile->limit);
+ nvkm_wr32(device, NV20_PGRAPH_TILE(i), tile->addr);
break;
case 0x46:
case 0x4c:
@@ -254,18 +256,18 @@ nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
case 0x63:
case 0x67:
case 0x68:
- nv_wr32(gr, NV47_PGRAPH_TSIZE(i), tile->pitch);
- nv_wr32(gr, NV47_PGRAPH_TLIMIT(i), tile->limit);
- nv_wr32(gr, NV47_PGRAPH_TILE(i), tile->addr);
- nv_wr32(gr, NV40_PGRAPH_TSIZE1(i), tile->pitch);
- nv_wr32(gr, NV40_PGRAPH_TLIMIT1(i), tile->limit);
- nv_wr32(gr, NV40_PGRAPH_TILE1(i), tile->addr);
+ nvkm_wr32(device, NV47_PGRAPH_TSIZE(i), tile->pitch);
+ nvkm_wr32(device, NV47_PGRAPH_TLIMIT(i), tile->limit);
+ nvkm_wr32(device, NV47_PGRAPH_TILE(i), tile->addr);
+ nvkm_wr32(device, NV40_PGRAPH_TSIZE1(i), tile->pitch);
+ nvkm_wr32(device, NV40_PGRAPH_TLIMIT1(i), tile->limit);
+ nvkm_wr32(device, NV40_PGRAPH_TILE1(i), tile->addr);
switch (nv_device(gr)->chipset) {
case 0x47:
case 0x49:
case 0x4b:
- nv_wr32(gr, NV47_PGRAPH_ZCOMP0(i), tile->zcomp);
- nv_wr32(gr, NV47_PGRAPH_ZCOMP1(i), tile->zcomp);
+ nvkm_wr32(device, NV47_PGRAPH_ZCOMP0(i), tile->zcomp);
+ nvkm_wr32(device, NV47_PGRAPH_ZCOMP1(i), tile->zcomp);
break;
default:
break;
@@ -286,15 +288,16 @@ nv40_gr_intr(struct nvkm_subdev *subdev)
struct nvkm_object *engctx;
struct nvkm_handle *handle = NULL;
struct nv40_gr *gr = (void *)subdev;
- u32 stat = nv_rd32(gr, NV03_PGRAPH_INTR);
- u32 nsource = nv_rd32(gr, NV03_PGRAPH_NSOURCE);
- u32 nstatus = nv_rd32(gr, NV03_PGRAPH_NSTATUS);
- u32 inst = nv_rd32(gr, 0x40032c) & 0x000fffff;
- u32 addr = nv_rd32(gr, NV04_PGRAPH_TRAPPED_ADDR);
+ struct nvkm_device *device = gr->base.engine.subdev.device;
+ u32 stat = nvkm_rd32(device, NV03_PGRAPH_INTR);
+ u32 nsource = nvkm_rd32(device, NV03_PGRAPH_NSOURCE);
+ u32 nstatus = nvkm_rd32(device, NV03_PGRAPH_NSTATUS);
+ u32 inst = nvkm_rd32(device, 0x40032c) & 0x000fffff;
+ u32 addr = nvkm_rd32(device, NV04_PGRAPH_TRAPPED_ADDR);
u32 subc = (addr & 0x00070000) >> 16;
u32 mthd = (addr & 0x00001ffc);
- u32 data = nv_rd32(gr, NV04_PGRAPH_TRAPPED_DATA);
- u32 class = nv_rd32(gr, 0x400160 + subc * 4) & 0xffff;
+ u32 data = nvkm_rd32(device, NV04_PGRAPH_TRAPPED_DATA);
+ u32 class = nvkm_rd32(device, 0x400160 + subc * 4) & 0xffff;
u32 show = stat;
int chid;
@@ -310,12 +313,12 @@ nv40_gr_intr(struct nvkm_subdev *subdev)
}
if (nsource & NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION) {
- nv_mask(gr, 0x402000, 0, 0);
+ nvkm_mask(device, 0x402000, 0, 0);
}
}
- nv_wr32(gr, NV03_PGRAPH_INTR, stat);
- nv_wr32(gr, NV04_PGRAPH_FIFO, 0x00000001);
+ nvkm_wr32(device, NV03_PGRAPH_INTR, stat);
+ nvkm_wr32(device, NV04_PGRAPH_FIFO, 0x00000001);
if (show) {
nv_error(gr, "%s", "");
@@ -364,8 +367,9 @@ static int
nv40_gr_init(struct nvkm_object *object)
{
struct nvkm_engine *engine = nv_engine(object);
- struct nvkm_fb *fb = nvkm_fb(object);
struct nv40_gr *gr = (void *)engine;
+ struct nvkm_device *device = gr->base.engine.subdev.device;
+ struct nvkm_fb *fb = device->fb;
int ret, i, j;
u32 vramsz;
@@ -379,89 +383,89 @@ nv40_gr_init(struct nvkm_object *object)
return ret;
/* No context present currently */
- nv_wr32(gr, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
+ nvkm_wr32(device, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
- nv_wr32(gr, NV03_PGRAPH_INTR , 0xFFFFFFFF);
- nv_wr32(gr, NV40_PGRAPH_INTR_EN, 0xFFFFFFFF);
+ nvkm_wr32(device, NV03_PGRAPH_INTR , 0xFFFFFFFF);
+ nvkm_wr32(device, NV40_PGRAPH_INTR_EN, 0xFFFFFFFF);
- nv_wr32(gr, NV04_PGRAPH_DEBUG_0, 0xFFFFFFFF);
- nv_wr32(gr, NV04_PGRAPH_DEBUG_0, 0x00000000);
- nv_wr32(gr, NV04_PGRAPH_DEBUG_1, 0x401287c0);
- nv_wr32(gr, NV04_PGRAPH_DEBUG_3, 0xe0de8055);
- nv_wr32(gr, NV10_PGRAPH_DEBUG_4, 0x00008000);
- nv_wr32(gr, NV04_PGRAPH_LIMIT_VIOL_PIX, 0x00be3c5f);
+ nvkm_wr32(device, NV04_PGRAPH_DEBUG_0, 0xFFFFFFFF);
+ nvkm_wr32(device, NV04_PGRAPH_DEBUG_0, 0x00000000);
+ nvkm_wr32(device, NV04_PGRAPH_DEBUG_1, 0x401287c0);
+ nvkm_wr32(device, NV04_PGRAPH_DEBUG_3, 0xe0de8055);
+ nvkm_wr32(device, NV10_PGRAPH_DEBUG_4, 0x00008000);
+ nvkm_wr32(device, NV04_PGRAPH_LIMIT_VIOL_PIX, 0x00be3c5f);
- nv_wr32(gr, NV10_PGRAPH_CTX_CONTROL, 0x10010100);
- nv_wr32(gr, NV10_PGRAPH_STATE , 0xFFFFFFFF);
+ nvkm_wr32(device, NV10_PGRAPH_CTX_CONTROL, 0x10010100);
+ nvkm_wr32(device, NV10_PGRAPH_STATE , 0xFFFFFFFF);
- j = nv_rd32(gr, 0x1540) & 0xff;
+ j = nvkm_rd32(device, 0x1540) & 0xff;
if (j) {
for (i = 0; !(j & 1); j >>= 1, i++)
;
- nv_wr32(gr, 0x405000, i);
+ nvkm_wr32(device, 0x405000, i);
}
if (nv_device(gr)->chipset == 0x40) {
- nv_wr32(gr, 0x4009b0, 0x83280fff);
- nv_wr32(gr, 0x4009b4, 0x000000a0);
+ nvkm_wr32(device, 0x4009b0, 0x83280fff);
+ nvkm_wr32(device, 0x4009b4, 0x000000a0);
} else {
- nv_wr32(gr, 0x400820, 0x83280eff);
- nv_wr32(gr, 0x400824, 0x000000a0);
+ nvkm_wr32(device, 0x400820, 0x83280eff);
+ nvkm_wr32(device, 0x400824, 0x000000a0);
}
switch (nv_device(gr)->chipset) {
case 0x40:
case 0x45:
- nv_wr32(gr, 0x4009b8, 0x0078e366);
- nv_wr32(gr, 0x4009bc, 0x0000014c);
+ nvkm_wr32(device, 0x4009b8, 0x0078e366);
+ nvkm_wr32(device, 0x4009bc, 0x0000014c);
break;
case 0x41:
case 0x42: /* pciid also 0x00Cx */
/* case 0x0120: XXX (pciid) */
- nv_wr32(gr, 0x400828, 0x007596ff);
- nv_wr32(gr, 0x40082c, 0x00000108);
+ nvkm_wr32(device, 0x400828, 0x007596ff);
+ nvkm_wr32(device, 0x40082c, 0x00000108);
break;
case 0x43:
- nv_wr32(gr, 0x400828, 0x0072cb77);
- nv_wr32(gr, 0x40082c, 0x00000108);
+ nvkm_wr32(device, 0x400828, 0x0072cb77);
+ nvkm_wr32(device, 0x40082c, 0x00000108);
break;
case 0x44:
case 0x46: /* G72 */
case 0x4a:
case 0x4c: /* G7x-based C51 */
case 0x4e:
- nv_wr32(gr, 0x400860, 0);
- nv_wr32(gr, 0x400864, 0);
+ nvkm_wr32(device, 0x400860, 0);
+ nvkm_wr32(device, 0x400864, 0);
break;
case 0x47: /* G70 */
case 0x49: /* G71 */
case 0x4b: /* G73 */
- nv_wr32(gr, 0x400828, 0x07830610);
- nv_wr32(gr, 0x40082c, 0x0000016A);
+ nvkm_wr32(device, 0x400828, 0x07830610);
+ nvkm_wr32(device, 0x40082c, 0x0000016A);
break;
default:
break;
}
- nv_wr32(gr, 0x400b38, 0x2ffff800);
- nv_wr32(gr, 0x400b3c, 0x00006000);
+ nvkm_wr32(device, 0x400b38, 0x2ffff800);
+ nvkm_wr32(device, 0x400b3c, 0x00006000);
/* Tiling related stuff. */
switch (nv_device(gr)->chipset) {
case 0x44:
case 0x4a:
- nv_wr32(gr, 0x400bc4, 0x1003d888);
- nv_wr32(gr, 0x400bbc, 0xb7a7b500);
+ nvkm_wr32(device, 0x400bc4, 0x1003d888);
+ nvkm_wr32(device, 0x400bbc, 0xb7a7b500);
break;
case 0x46:
- nv_wr32(gr, 0x400bc4, 0x0000e024);
- nv_wr32(gr, 0x400bbc, 0xb7a7b520);
+ nvkm_wr32(device, 0x400bc4, 0x0000e024);
+ nvkm_wr32(device, 0x400bbc, 0xb7a7b520);
break;
case 0x4c:
case 0x4e:
case 0x67:
- nv_wr32(gr, 0x400bc4, 0x1003d888);
- nv_wr32(gr, 0x400bbc, 0xb7a7b540);
+ nvkm_wr32(device, 0x400bc4, 0x1003d888);
+ nvkm_wr32(device, 0x400bbc, 0xb7a7b540);
break;
default:
break;
@@ -475,14 +479,14 @@ nv40_gr_init(struct nvkm_object *object)
vramsz = nv_device_resource_len(nv_device(gr), 1) - 1;
switch (nv_device(gr)->chipset) {
case 0x40:
- nv_wr32(gr, 0x4009A4, nv_rd32(gr, 0x100200));
- nv_wr32(gr, 0x4009A8, nv_rd32(gr, 0x100204));
- nv_wr32(gr, 0x4069A4, nv_rd32(gr, 0x100200));
- nv_wr32(gr, 0x4069A8, nv_rd32(gr, 0x100204));
- nv_wr32(gr, 0x400820, 0);
- nv_wr32(gr, 0x400824, 0);
- nv_wr32(gr, 0x400864, vramsz);
- nv_wr32(gr, 0x400868, vramsz);
+ nvkm_wr32(device, 0x4009A4, nvkm_rd32(device, 0x100200));
+ nvkm_wr32(device, 0x4009A8, nvkm_rd32(device, 0x100204));
+ nvkm_wr32(device, 0x4069A4, nvkm_rd32(device, 0x100200));
+ nvkm_wr32(device, 0x4069A8, nvkm_rd32(device, 0x100204));
+ nvkm_wr32(device, 0x400820, 0);
+ nvkm_wr32(device, 0x400824, 0);
+ nvkm_wr32(device, 0x400864, vramsz);
+ nvkm_wr32(device, 0x400868, vramsz);
break;
default:
switch (nv_device(gr)->chipset) {
@@ -493,20 +497,20 @@ nv40_gr_init(struct nvkm_object *object)
case 0x4e:
case 0x44:
case 0x4a:
- nv_wr32(gr, 0x4009F0, nv_rd32(gr, 0x100200));
- nv_wr32(gr, 0x4009F4, nv_rd32(gr, 0x100204));
+ nvkm_wr32(device, 0x4009F0, nvkm_rd32(device, 0x100200));
+ nvkm_wr32(device, 0x4009F4, nvkm_rd32(device, 0x100204));
break;
default:
- nv_wr32(gr, 0x400DF0, nv_rd32(gr, 0x100200));
- nv_wr32(gr, 0x400DF4, nv_rd32(gr, 0x100204));
+ nvkm_wr32(device, 0x400DF0, nvkm_rd32(device, 0x100200));
+ nvkm_wr32(device, 0x400DF4, nvkm_rd32(device, 0x100204));
break;
}
- nv_wr32(gr, 0x4069F0, nv_rd32(gr, 0x100200));
- nv_wr32(gr, 0x4069F4, nv_rd32(gr, 0x100204));
- nv_wr32(gr, 0x400840, 0);
- nv_wr32(gr, 0x400844, 0);
- nv_wr32(gr, 0x4008A0, vramsz);
- nv_wr32(gr, 0x4008A4, vramsz);
+ nvkm_wr32(device, 0x4069F0, nvkm_rd32(device, 0x100200));
+ nvkm_wr32(device, 0x4069F4, nvkm_rd32(device, 0x100204));
+ nvkm_wr32(device, 0x400840, 0);
+ nvkm_wr32(device, 0x400844, 0);
+ nvkm_wr32(device, 0x4008A0, vramsz);
+ nvkm_wr32(device, 0x4008A4, vramsz);
break;
}