Commit 6189f1b0 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fifo: cosmetic changes

This is purely preparation for upcoming commits, there should be no
code changes here.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a317aa21
...@@ -68,7 +68,7 @@ struct nvkm_fifo_base { ...@@ -68,7 +68,7 @@ struct nvkm_fifo_base {
#include <core/event.h> #include <core/event.h>
struct nvkm_fifo { struct nvkm_fifo {
struct nvkm_engine base; struct nvkm_engine engine;
struct nvkm_event cevent; /* channel creation event */ struct nvkm_event cevent; /* channel creation event */
struct nvkm_event uevent; /* async user trigger */ struct nvkm_event uevent; /* async user trigger */
...@@ -92,9 +92,9 @@ nvkm_fifo(void *obj) ...@@ -92,9 +92,9 @@ nvkm_fifo(void *obj)
#define nvkm_fifo_create(o,e,c,fc,lc,d) \ #define nvkm_fifo_create(o,e,c,fc,lc,d) \
nvkm_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d) nvkm_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d)
#define nvkm_fifo_init(p) \ #define nvkm_fifo_init(p) \
nvkm_engine_init(&(p)->base) nvkm_engine_init(&(p)->engine)
#define nvkm_fifo_fini(p,s) \ #define nvkm_fifo_fini(p,s) \
nvkm_engine_fini(&(p)->base, (s)) nvkm_engine_fini(&(p)->engine, (s))
int nvkm_fifo_create_(struct nvkm_object *, struct nvkm_object *, int nvkm_fifo_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, int min, int max, struct nvkm_oclass *, int min, int max,
......
...@@ -213,7 +213,7 @@ nv84_fence_destroy(struct nouveau_drm *drm) ...@@ -213,7 +213,7 @@ nv84_fence_destroy(struct nouveau_drm *drm)
int int
nv84_fence_create(struct nouveau_drm *drm) nv84_fence_create(struct nouveau_drm *drm)
{ {
struct nvkm_fifo *pfifo = nvxx_fifo(&drm->device); struct nvkm_fifo *fifo = nvxx_fifo(&drm->device);
struct nv84_fence_priv *priv; struct nv84_fence_priv *priv;
u32 domain; u32 domain;
int ret; int ret;
...@@ -228,7 +228,7 @@ nv84_fence_create(struct nouveau_drm *drm) ...@@ -228,7 +228,7 @@ nv84_fence_create(struct nouveau_drm *drm)
priv->base.context_new = nv84_fence_context_new; priv->base.context_new = nv84_fence_context_new;
priv->base.context_del = nv84_fence_context_del; priv->base.context_del = nv84_fence_context_del;
priv->base.contexts = pfifo->max + 1; priv->base.contexts = fifo->max + 1;
priv->base.context_base = fence_context_alloc(priv->base.contexts); priv->base.context_base = fence_context_alloc(priv->base.contexts);
priv->base.uevent = true; priv->base.uevent = true;
......
...@@ -72,7 +72,7 @@ gt215_ce_isr_error_name[] = { ...@@ -72,7 +72,7 @@ gt215_ce_isr_error_name[] = {
void void
gt215_ce_intr(struct nvkm_subdev *subdev) gt215_ce_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_falcon *falcon = (void *)subdev; struct nvkm_falcon *falcon = (void *)subdev;
struct nvkm_object *engctx; struct nvkm_object *engctx;
...@@ -87,7 +87,7 @@ gt215_ce_intr(struct nvkm_subdev *subdev) ...@@ -87,7 +87,7 @@ gt215_ce_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & 0x00000040) { if (stat & 0x00000040) {
nv_error(falcon, "DISPATCH_ERROR ["); nv_error(falcon, "DISPATCH_ERROR [");
......
...@@ -104,7 +104,7 @@ g84_cipher_intr_mask[] = { ...@@ -104,7 +104,7 @@ g84_cipher_intr_mask[] = {
static void static void
g84_cipher_intr(struct nvkm_subdev *subdev) g84_cipher_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct nvkm_engine *cipher = (void *)subdev; struct nvkm_engine *cipher = (void *)subdev;
...@@ -115,7 +115,7 @@ g84_cipher_intr(struct nvkm_subdev *subdev) ...@@ -115,7 +115,7 @@ g84_cipher_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat) { if (stat) {
nv_error(cipher, "%s", ""); nv_error(cipher, "%s", "");
......
...@@ -58,7 +58,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent, ...@@ -58,7 +58,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
u64 engmask, int len, void **ptr) u64 engmask, int len, void **ptr)
{ {
struct nvkm_device *device = nv_device(engine); struct nvkm_device *device = nv_device(engine);
struct nvkm_fifo *priv = (void *)engine; struct nvkm_fifo *fifo = (void *)engine;
struct nvkm_fifo_chan *chan; struct nvkm_fifo_chan *chan;
struct nvkm_dmaeng *dmaeng; struct nvkm_dmaeng *dmaeng;
unsigned long flags; unsigned long flags;
...@@ -90,39 +90,39 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent, ...@@ -90,39 +90,39 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
return ret; return ret;
/* find a free fifo channel */ /* find a free fifo channel */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&fifo->lock, flags);
for (chan->chid = priv->min; chan->chid < priv->max; chan->chid++) { for (chan->chid = fifo->min; chan->chid < fifo->max; chan->chid++) {
if (!priv->channel[chan->chid]) { if (!fifo->channel[chan->chid]) {
priv->channel[chan->chid] = nv_object(chan); fifo->channel[chan->chid] = nv_object(chan);
break; break;
} }
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&fifo->lock, flags);
if (chan->chid == priv->max) { if (chan->chid == fifo->max) {
nv_error(priv, "no free channels\n"); nv_error(fifo, "no free channels\n");
return -ENOSPC; return -ENOSPC;
} }
chan->addr = nv_device_resource_start(device, bar) + chan->addr = nv_device_resource_start(device, bar) +
addr + size * chan->chid; addr + size * chan->chid;
chan->size = size; chan->size = size;
nvkm_event_send(&priv->cevent, 1, 0, NULL, 0); nvkm_event_send(&fifo->cevent, 1, 0, NULL, 0);
return 0; return 0;
} }
void void
nvkm_fifo_channel_destroy(struct nvkm_fifo_chan *chan) nvkm_fifo_channel_destroy(struct nvkm_fifo_chan *chan)
{ {
struct nvkm_fifo *priv = (void *)nv_object(chan)->engine; struct nvkm_fifo *fifo = (void *)nv_object(chan)->engine;
unsigned long flags; unsigned long flags;
if (chan->user) if (chan->user)
iounmap(chan->user); iounmap(chan->user);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&fifo->lock, flags);
priv->channel[chan->chid] = NULL; fifo->channel[chan->chid] = NULL;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&fifo->lock, flags);
nvkm_gpuobj_ref(NULL, &chan->pushgpu); nvkm_gpuobj_ref(NULL, &chan->pushgpu);
nvkm_object_ref(NULL, (struct nvkm_object **)&chan->pushdma); nvkm_object_ref(NULL, (struct nvkm_object **)&chan->pushdma);
...@@ -214,9 +214,9 @@ _nvkm_fifo_channel_ntfy(struct nvkm_object *object, u32 type, ...@@ -214,9 +214,9 @@ _nvkm_fifo_channel_ntfy(struct nvkm_object *object, u32 type,
} }
static int static int
nvkm_fifo_chid(struct nvkm_fifo *priv, struct nvkm_object *object) nvkm_fifo_chid(struct nvkm_fifo *fifo, struct nvkm_object *object)
{ {
int engidx = nv_hclass(priv) & 0xff; int engidx = nv_hclass(fifo) & 0xff;
while (object && object->parent) { while (object && object->parent) {
if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) && if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) &&
...@@ -243,12 +243,12 @@ nvkm_client_name_for_fifo_chid(struct nvkm_fifo *fifo, u32 chid) ...@@ -243,12 +243,12 @@ nvkm_client_name_for_fifo_chid(struct nvkm_fifo *fifo, u32 chid)
} }
void void
nvkm_fifo_destroy(struct nvkm_fifo *priv) nvkm_fifo_destroy(struct nvkm_fifo *fifo)
{ {
kfree(priv->channel); kfree(fifo->channel);
nvkm_event_fini(&priv->uevent); nvkm_event_fini(&fifo->uevent);
nvkm_event_fini(&priv->cevent); nvkm_event_fini(&fifo->cevent);
nvkm_engine_destroy(&priv->base); nvkm_engine_destroy(&fifo->engine);
} }
int int
...@@ -256,26 +256,26 @@ nvkm_fifo_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -256,26 +256,26 @@ nvkm_fifo_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, struct nvkm_oclass *oclass,
int min, int max, int length, void **pobject) int min, int max, int length, void **pobject)
{ {
struct nvkm_fifo *priv; struct nvkm_fifo *fifo;
int ret; int ret;
ret = nvkm_engine_create_(parent, engine, oclass, true, "PFIFO", ret = nvkm_engine_create_(parent, engine, oclass, true, "PFIFO",
"fifo", length, pobject); "fifo", length, pobject);
priv = *pobject; fifo = *pobject;
if (ret) if (ret)
return ret; return ret;
priv->min = min; fifo->min = min;
priv->max = max; fifo->max = max;
priv->channel = kzalloc(sizeof(*priv->channel) * (max + 1), GFP_KERNEL); fifo->channel = kzalloc(sizeof(*fifo->channel) * (max + 1), GFP_KERNEL);
if (!priv->channel) if (!fifo->channel)
return -ENOMEM; return -ENOMEM;
ret = nvkm_event_init(&nvkm_fifo_event_func, 1, 1, &priv->cevent); ret = nvkm_event_init(&nvkm_fifo_event_func, 1, 1, &fifo->cevent);
if (ret) if (ret)
return ret; return ret;
priv->chid = nvkm_fifo_chid; fifo->chid = nvkm_fifo_chid;
spin_lock_init(&priv->lock); spin_lock_init(&fifo->lock);
return 0; return 0;
} }
...@@ -81,7 +81,7 @@ g84_fifo_context_detach(struct nvkm_object *parent, bool suspend, ...@@ -81,7 +81,7 @@ g84_fifo_context_detach(struct nvkm_object *parent, bool suspend,
struct nvkm_object *object) struct nvkm_object *object)
{ {
struct nvkm_bar *bar = nvkm_bar(parent); struct nvkm_bar *bar = nvkm_bar(parent);
struct nv50_fifo_priv *priv = (void *)parent->engine; struct nv50_fifo *fifo = (void *)parent->engine;
struct nv50_fifo_base *base = (void *)parent->parent; struct nv50_fifo_base *base = (void *)parent->parent;
struct nv50_fifo_chan *chan = (void *)parent; struct nv50_fifo_chan *chan = (void *)parent;
u32 addr, save, engn; u32 addr, save, engn;
...@@ -103,12 +103,12 @@ g84_fifo_context_detach(struct nvkm_object *parent, bool suspend, ...@@ -103,12 +103,12 @@ g84_fifo_context_detach(struct nvkm_object *parent, bool suspend,
return -EINVAL; return -EINVAL;
} }
save = nv_mask(priv, 0x002520, 0x0000003f, 1 << engn); save = nv_mask(fifo, 0x002520, 0x0000003f, 1 << engn);
nv_wr32(priv, 0x0032fc, nv_gpuobj(base)->addr >> 12); nv_wr32(fifo, 0x0032fc, nv_gpuobj(base)->addr >> 12);
done = nv_wait_ne(priv, 0x0032fc, 0xffffffff, 0xffffffff); done = nv_wait_ne(fifo, 0x0032fc, 0xffffffff, 0xffffffff);
nv_wr32(priv, 0x002520, save); nv_wr32(fifo, 0x002520, save);
if (!done) { if (!done) {
nv_error(priv, "channel %d [%s] unload timeout\n", nv_error(fifo, "channel %d [%s] unload timeout\n",
chan->base.chid, nvkm_client_name(chan)); chan->base.chid, nvkm_client_name(chan));
if (suspend) if (suspend)
return -EBUSY; return -EBUSY;
...@@ -309,7 +309,7 @@ g84_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -309,7 +309,7 @@ g84_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine,
static int static int
g84_fifo_chan_init(struct nvkm_object *object) g84_fifo_chan_init(struct nvkm_object *object)
{ {
struct nv50_fifo_priv *priv = (void *)object->engine; struct nv50_fifo *fifo = (void *)object->engine;
struct nv50_fifo_base *base = (void *)object->parent; struct nv50_fifo_base *base = (void *)object->parent;
struct nv50_fifo_chan *chan = (void *)object; struct nv50_fifo_chan *chan = (void *)object;
struct nvkm_gpuobj *ramfc = base->ramfc; struct nvkm_gpuobj *ramfc = base->ramfc;
...@@ -320,8 +320,8 @@ g84_fifo_chan_init(struct nvkm_object *object) ...@@ -320,8 +320,8 @@ g84_fifo_chan_init(struct nvkm_object *object)
if (ret) if (ret)
return ret; return ret;
nv_wr32(priv, 0x002600 + (chid * 4), 0x80000000 | ramfc->addr >> 8); nv_wr32(fifo, 0x002600 + (chid * 4), 0x80000000 | ramfc->addr >> 8);
nv50_fifo_playlist_update(priv); nv50_fifo_playlist_update(fifo);
return 0; return 0;
} }
...@@ -444,34 +444,34 @@ g84_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -444,34 +444,34 @@ g84_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nv50_fifo_priv *priv; struct nv50_fifo *fifo;
int ret; int ret;
ret = nvkm_fifo_create(parent, engine, oclass, 1, 127, &priv); ret = nvkm_fifo_create(parent, engine, oclass, 1, 127, &fifo);
*pobject = nv_object(priv); *pobject = nv_object(fifo);
if (ret) if (ret)
return ret; return ret;
ret = nvkm_gpuobj_new(nv_object(priv), NULL, 128 * 4, 0x1000, 0, ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 128 * 4, 0x1000, 0,
&priv->playlist[0]); &fifo->playlist[0]);
if (ret) if (ret)
return ret; return ret;
ret = nvkm_gpuobj_new(nv_object(priv), NULL, 128 * 4, 0x1000, 0, ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 128 * 4, 0x1000, 0,
&priv->playlist[1]); &fifo->playlist[1]);
if (ret) if (ret)
return ret; return ret;
ret = nvkm_event_init(&g84_fifo_uevent_func, 1, 1, &priv->base.uevent); ret = nvkm_event_init(&g84_fifo_uevent_func, 1, 1, &fifo->base.uevent);
if (ret) if (ret)
return ret; return ret;
nv_subdev(priv)->unit = 0x00000100; nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(priv)->intr = nv04_fifo_intr; nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(priv)->cclass = &g84_fifo_cclass; nv_engine(fifo)->cclass = &g84_fifo_cclass;
nv_engine(priv)->sclass = g84_fifo_sclass; nv_engine(fifo)->sclass = g84_fifo_sclass;
priv->base.pause = nv04_fifo_pause; fifo->base.pause = nv04_fifo_pause;
priv->base.start = nv04_fifo_start; fifo->base.start = nv04_fifo_start;
return 0; return 0;
} }
......
...@@ -38,8 +38,8 @@ gm204_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -38,8 +38,8 @@ gm204_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
{ {
int ret = gk104_fifo_ctor(parent, engine, oclass, data, size, pobject); int ret = gk104_fifo_ctor(parent, engine, oclass, data, size, pobject);
if (ret == 0) { if (ret == 0) {
struct gk104_fifo_priv *priv = (void *)*pobject; struct gk104_fifo *fifo = (void *)*pobject;
nv_engine(priv)->sclass = gm204_fifo_sclass; nv_engine(fifo)->sclass = gm204_fifo_sclass;
} }
return ret; return ret;
} }
......
...@@ -139,7 +139,7 @@ struct ramfc_desc { ...@@ -139,7 +139,7 @@ struct ramfc_desc {
unsigned regp; unsigned regp;
}; };
struct nv04_fifo_priv { struct nv04_fifo {
struct nvkm_fifo base; struct nvkm_fifo base;
struct ramfc_desc *ramfc_desc; struct ramfc_desc *ramfc_desc;
struct nvkm_ramht *ramht; struct nvkm_ramht *ramht;
......
...@@ -58,7 +58,7 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -58,7 +58,7 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent,
union { union {
struct nv03_channel_dma_v0 v0; struct nv03_channel_dma_v0 v0;
} *args = data; } *args = data;
struct nv04_fifo_priv *priv = (void *)engine; struct nv04_fifo *fifo = (void *)engine;
struct nv04_fifo_chan *chan; struct nv04_fifo_chan *chan;
int ret; int ret;
...@@ -86,10 +86,10 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -86,10 +86,10 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent,
nv_parent(chan)->context_attach = nv04_fifo_context_attach; nv_parent(chan)->context_attach = nv04_fifo_context_attach;
chan->ramfc = chan->base.chid * 32; chan->ramfc = chan->base.chid * 32;
nv_wo32(priv->ramfc, chan->ramfc + 0x00, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x04, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4); nv_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
nv_wo32(priv->ramfc, chan->ramfc + 0x14, nv_wo32(fifo->ramfc, chan->ramfc + 0x14,
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
...@@ -144,25 +144,25 @@ nv10_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -144,25 +144,25 @@ nv10_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nv04_instmem *imem = nv04_instmem(parent); struct nv04_instmem *imem = nv04_instmem(parent);
struct nv04_fifo_priv *priv; struct nv04_fifo *fifo;
int ret; int ret;
ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &priv); ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &fifo);
*pobject = nv_object(priv); *pobject = nv_object(fifo);
if (ret) if (ret)
return ret; return ret;
nvkm_ramht_ref(imem->ramht, &priv->ramht); nvkm_ramht_ref(imem->ramht, &fifo->ramht);
nvkm_gpuobj_ref(imem->ramro, &priv->ramro); nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
nvkm_gpuobj_ref(imem->ramfc, &priv->ramfc); nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
nv_subdev(priv)->unit = 0x00000100; nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(priv)->intr = nv04_fifo_intr; nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(priv)->cclass = &nv10_fifo_cclass; nv_engine(fifo)->cclass = &nv10_fifo_cclass;
nv_engine(priv)->sclass = nv10_fifo_sclass; nv_engine(fifo)->sclass = nv10_fifo_sclass;
priv->base.pause = nv04_fifo_pause; fifo->base.pause = nv04_fifo_pause;
priv->base.start = nv04_fifo_start; fifo->base.start = nv04_fifo_start;
priv->ramfc_desc = nv10_ramfc; fifo->ramfc_desc = nv10_ramfc;
return 0; return 0;
} }
......
...@@ -63,7 +63,7 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -63,7 +63,7 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent,
union { union {
struct nv03_channel_dma_v0 v0; struct nv03_channel_dma_v0 v0;
} *args = data; } *args = data;
struct nv04_fifo_priv *priv = (void *)engine; struct nv04_fifo *fifo = (void *)engine;
struct nv04_fifo_chan *chan; struct nv04_fifo_chan *chan;
int ret; int ret;
...@@ -93,10 +93,10 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -93,10 +93,10 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent,
nv_parent(chan)->context_attach = nv04_fifo_context_attach; nv_parent(chan)->context_attach = nv04_fifo_context_attach;
chan->ramfc = chan->base.chid * 64; chan->ramfc = chan->base.chid * 64;
nv_wo32(priv->ramfc, chan->ramfc + 0x00, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x04, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4); nv_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
nv_wo32(priv->ramfc, chan->ramfc + 0x14, nv_wo32(fifo->ramfc, chan->ramfc + 0x14,
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
...@@ -151,55 +151,55 @@ nv17_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -151,55 +151,55 @@ nv17_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nv04_instmem *imem = nv04_instmem(parent); struct nv04_instmem *imem = nv04_instmem(parent);
struct nv04_fifo_priv *priv; struct nv04_fifo *fifo;
int ret; int ret;
ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &priv); ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &fifo);
*pobject = nv_object(priv); *pobject = nv_object(fifo);
if (ret) if (ret)
return ret; return ret;
nvkm_ramht_ref(imem->ramht, &priv->ramht); nvkm_ramht_ref(imem->ramht, &fifo->ramht);
nvkm_gpuobj_ref(imem->ramro, &priv->ramro); nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
nvkm_gpuobj_ref(imem->ramfc, &priv->ramfc); nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
nv_subdev(priv)->unit = 0x00000100; nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(priv)->intr = nv04_fifo_intr; nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(priv)->cclass = &nv17_fifo_cclass; nv_engine(fifo)->cclass = &nv17_fifo_cclass;
nv_engine(priv)->sclass = nv17_fifo_sclass; nv_engine(fifo)->sclass = nv17_fifo_sclass;
priv->base.pause = nv04_fifo_pause; fifo->base.pause = nv04_fifo_pause;
priv->base.start = nv04_fifo_start; fifo->base.start = nv04_fifo_start;
priv->ramfc_desc = nv17_ramfc; fifo->ramfc_desc = nv17_ramfc;
return 0; return 0;
} }
static int static int
nv17_fifo_init(struct nvkm_object *object) nv17_fifo_init(struct nvkm_object *object)
{ {
struct nv04_fifo_priv *priv = (void *)object; struct nv04_fifo *fifo = (void *)object;
int ret; int ret;
ret = nvkm_fifo_init(&priv->base); ret = nvkm_fifo_init(&fifo->base);
if (ret) if (ret)
return ret; return ret;
nv_wr32(priv, NV04_PFIFO_DELAY_0, 0x000000ff); nv_wr32(fifo, NV04_PFIFO_DELAY_0, 0x000000ff);
nv_wr32(priv, NV04_PFIFO_DMA_TIMESLICE, 0x0101ffff); nv_wr32(fifo, NV04_PFIFO_DMA_TIMESLICE, 0x0101ffff);
nv_wr32(priv, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ | nv_wr32(fifo, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
((priv->ramht->bits - 9) << 16) | ((fifo->ramht->bits - 9) << 16) |
(priv->ramht->gpuobj.addr >> 8)); (fifo->ramht->gpuobj.addr >> 8));
nv_wr32(priv, NV03_PFIFO_RAMRO, priv->ramro->addr >> 8); nv_wr32(fifo, NV03_PFIFO_RAMRO, fifo->ramro->addr >> 8);
nv_wr32(priv, NV03_PFIFO_RAMFC, priv->ramfc->addr >> 8 | 0x00010000); nv_wr32(fifo, NV03_PFIFO_RAMFC, fifo->ramfc->addr >> 8 | 0x00010000);
nv_wr32(priv, NV03_PFIFO_CACHE1_PUSH1, priv->base.max); nv_wr32(fifo, NV03_PFIFO_CACHE1_PUSH1, fifo->base.max);
nv_wr32(priv, NV03_PFIFO_INTR_0, 0xffffffff); nv_wr32(fifo, NV03_PFIFO_INTR_0, 0xffffffff);
nv_wr32(priv, NV03_PFIFO_INTR_EN_0, 0xffffffff); nv_wr32(fifo, NV03_PFIFO_INTR_EN_0, 0xffffffff);
nv_wr32(priv, NV03_PFIFO_CACHE1_PUSH0, 1); nv_wr32(fifo, NV03_PFIFO_CACHE1_PUSH0, 1);
nv_wr32(priv, NV04_PFIFO_CACHE1_PULL0, 1); nv_wr32(fifo, NV04_PFIFO_CACHE1_PULL0, 1);
nv_wr32(priv, NV03_PFIFO_CACHES, 1); nv_wr32(fifo, NV03_PFIFO_CACHES, 1);
return 0; return 0;
} }
......
...@@ -67,7 +67,7 @@ static int ...@@ -67,7 +67,7 @@ static int
nv40_fifo_object_attach(struct nvkm_object *parent, nv40_fifo_object_attach(struct nvkm_object *parent,
struct nvkm_object *object, u32 handle) struct nvkm_object *object, u32 handle)
{ {
struct nv04_fifo_priv *priv = (void *)parent->engine; struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent; struct nv04_fifo_chan *chan = (void *)parent;
u32 context, chid = chan->base.chid; u32 context, chid = chan->base.chid;
int ret; int ret;
...@@ -94,16 +94,16 @@ nv40_fifo_object_attach(struct nvkm_object *parent, ...@@ -94,16 +94,16 @@ nv40_fifo_object_attach(struct nvkm_object *parent,
context |= chid << 23; context |= chid << 23;
mutex_lock(&nv_subdev(priv)->mutex); mutex_lock(&nv_subdev(fifo)->mutex);
ret = nvkm_ramht_insert(priv->ramht, chid, handle, context); ret = nvkm_ramht_insert(fifo->ramht, chid, handle, context);
mutex_unlock(&nv_subdev(priv)->mutex); mutex_unlock(&nv_subdev(fifo)->mutex);
return ret; return ret;
} }
static int static int
nv40_fifo_context_attach(struct nvkm_object *parent, struct nvkm_object *engctx) nv40_fifo_context_attach(struct nvkm_object *parent, struct nvkm_object *engctx)
{ {
struct nv04_fifo_priv *priv = (void *)parent->engine; struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent; struct nv04_fifo_chan *chan = (void *)parent;
unsigned long flags; unsigned long flags;
u32 reg, ctx; u32 reg, ctx;
...@@ -123,16 +123,16 @@ nv40_fifo_context_attach(struct nvkm_object *parent, struct nvkm_object *engctx) ...@@ -123,16 +123,16 @@ nv40_fifo_context_attach(struct nvkm_object *parent, struct nvkm_object *engctx)
return -EINVAL; return -EINVAL;
} }
spin_lock_irqsave(&priv->base.lock, flags); spin_lock_irqsave(&fifo->base.lock, flags);
nv_engctx(engctx)->addr = nv_gpuobj(engctx)->addr >> 4; nv_engctx(engctx)->addr = nv_gpuobj(engctx)->addr >> 4;
nv_mask(priv, 0x002500, 0x00000001, 0x00000000); nv_mask(fifo, 0x002500, 0x00000001, 0x00000000);
if ((nv_rd32(priv, 0x003204) & priv->base.max) == chan->base.chid) if ((nv_rd32(fifo, 0x003204) & fifo->base.max) == chan->base.chid)
nv_wr32(priv, reg, nv_engctx(engctx)->addr); nv_wr32(fifo, reg, nv_engctx(engctx)->addr);
nv_wo32(priv->ramfc, chan->ramfc + ctx, nv_engctx(engctx)->addr); nv_wo32(fifo->ramfc, chan->ramfc + ctx, nv_engctx(engctx)->addr);
nv_mask(priv, 0x002500, 0x00000001, 0x00000001); nv_mask(fifo, 0x002500, 0x00000001, 0x00000001);
spin_unlock_irqrestore(&priv->base.lock, flags); spin_unlock_irqrestore(&fifo->base.lock, flags);
return 0; return 0;
} }
...@@ -140,7 +140,7 @@ static int ...@@ -140,7 +140,7 @@ static int
nv40_fifo_context_detach(struct nvkm_object *parent, bool suspend, nv40_fifo_context_detach(struct nvkm_object *parent, bool suspend,
struct nvkm_object *engctx) struct nvkm_object *engctx)
{ {
struct nv04_fifo_priv *priv = (void *)parent->engine; struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent; struct nv04_fifo_chan *chan = (void *)parent;
unsigned long flags; unsigned long flags;
u32 reg, ctx; u32 reg, ctx;
...@@ -160,15 +160,15 @@ nv40_fifo_context_detach(struct nvkm_object *parent, bool suspend, ...@@ -160,15 +160,15 @@ nv40_fifo_context_detach(struct nvkm_object *parent, bool suspend,
return -EINVAL; return -EINVAL;
} }
spin_lock_irqsave(&priv->base.lock, flags); spin_lock_irqsave(&fifo->base.lock, flags);
nv_mask(priv, 0x002500, 0x00000001, 0x00000000); nv_mask(fifo, 0x002500, 0x00000001, 0x00000000);
if ((nv_rd32(priv, 0x003204) & priv->base.max) == chan->base.chid) if ((nv_rd32(fifo, 0x003204) & fifo->base.max) == chan->base.chid)
nv_wr32(priv, reg, 0x00000000); nv_wr32(fifo, reg, 0x00000000);
nv_wo32(priv->ramfc, chan->ramfc + ctx, 0x00000000); nv_wo32(fifo->ramfc, chan->ramfc + ctx, 0x00000000);
nv_mask(priv, 0x002500, 0x00000001, 0x00000001); nv_mask(fifo, 0x002500, 0x00000001, 0x00000001);
spin_unlock_irqrestore(&priv->base.lock, flags); spin_unlock_irqrestore(&fifo->base.lock, flags);
return 0; return 0;
} }
...@@ -180,7 +180,7 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -180,7 +180,7 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
union { union {
struct nv03_channel_dma_v0 v0; struct nv03_channel_dma_v0 v0;
} *args = data; } *args = data;
struct nv04_fifo_priv *priv = (void *)engine; struct nv04_fifo *fifo = (void *)engine;
struct nv04_fifo_chan *chan; struct nv04_fifo_chan *chan;
int ret; int ret;
...@@ -210,17 +210,17 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -210,17 +210,17 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
nv_parent(chan)->object_detach = nv04_fifo_object_detach; nv_parent(chan)->object_detach = nv04_fifo_object_detach;
chan->ramfc = chan->base.chid * 128; chan->ramfc = chan->base.chid * 128;
nv_wo32(priv->ramfc, chan->ramfc + 0x00, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x04, args->v0.offset); nv_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
nv_wo32(priv->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4); nv_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
nv_wo32(priv->ramfc, chan->ramfc + 0x18, 0x30000000 | nv_wo32(fifo->ramfc, chan->ramfc + 0x18, 0x30000000 |
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES | NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
NV_PFIFO_CACHE1_BIG_ENDIAN | NV_PFIFO_CACHE1_BIG_ENDIAN |
#endif #endif
NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8); NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8);
nv_wo32(priv->ramfc, chan->ramfc + 0x3c, 0x0001ffff); nv_wo32(fifo->ramfc, chan->ramfc + 0x3c, 0x0001ffff);
return 0; return 0;
} }
...@@ -269,77 +269,77 @@ nv40_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -269,77 +269,77 @@ nv40_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nv04_instmem *imem = nv04_instmem(parent); struct nv04_instmem *imem = nv04_instmem(parent);
struct nv04_fifo_priv *priv; struct nv04_fifo *fifo;
int ret; int ret;
ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &priv); ret = nvkm_fifo_create(parent, engine, oclass, 0, 31, &fifo);
*pobject = nv_object(priv); *pobject = nv_object(fifo);
if (ret) if (ret)
return ret; return ret;
nvkm_ramht_ref(imem->ramht, &priv->ramht); nvkm_ramht_ref(imem->ramht, &fifo->ramht);
nvkm_gpuobj_ref(imem->ramro, &priv->ramro); nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
nvkm_gpuobj_ref(imem->ramfc, &priv->ramfc); nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
nv_subdev(priv)->unit = 0x00000100; nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(priv)->intr = nv04_fifo_intr; nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(priv)->cclass = &nv40_fifo_cclass; nv_engine(fifo)->cclass = &nv40_fifo_cclass;
nv_engine(priv)->sclass = nv40_fifo_sclass; nv_engine(fifo)->sclass = nv40_fifo_sclass;
priv->base.pause = nv04_fifo_pause; fifo->base.pause = nv04_fifo_pause;
priv->base.start = nv04_fifo_start; fifo->base.start = nv04_fifo_start;
priv->ramfc_desc = nv40_ramfc; fifo->ramfc_desc = nv40_ramfc;
return 0; return 0;
} }
static int static int
nv40_fifo_init(struct nvkm_object *object) nv40_fifo_init(struct nvkm_object *object)
{ {
struct nv04_fifo_priv *priv = (void *)object; struct nv04_fifo *fifo = (void *)object;
struct nvkm_fb *fb = nvkm_fb(object); struct nvkm_fb *fb = nvkm_fb(object);
int ret; int ret;
ret = nvkm_fifo_init(&priv->base); ret = nvkm_fifo_init(&fifo->base);
if (ret) if (ret)
return ret; return ret;
nv_wr32(priv, 0x002040, 0x000000ff); nv_wr32(fifo, 0x002040, 0x000000ff);
nv_wr32(priv, 0x002044, 0x2101ffff); nv_wr32(fifo, 0x002044, 0x2101ffff);
nv_wr32(priv, 0x002058, 0x00000001); nv_wr32(fifo, 0x002058, 0x00000001);
nv_wr32(priv, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ | nv_wr32(fifo, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
((priv->ramht->bits - 9) << 16) | ((fifo->ramht->bits - 9) << 16) |
(priv->ramht->gpuobj.addr >> 8)); (fifo->ramht->gpuobj.addr >> 8));
nv_wr32(priv, NV03_PFIFO_RAMRO, priv->ramro->addr >> 8); nv_wr32(fifo, NV03_PFIFO_RAMRO, fifo->ramro->addr >> 8);
switch (nv_device(priv)->chipset) { switch (nv_device(fifo)->chipset) {
case 0x47: case 0x47:
case 0x49: case 0x49:
case 0x4b: case 0x4b:
nv_wr32(priv, 0x002230, 0x00000001); nv_wr32(fifo, 0x002230, 0x00000001);
case 0x40: case 0x40:
case 0x41: case 0x41:
case 0x42: case 0x42:
case 0x43: case 0x43:
case 0x45: case 0x45:
case 0x48: case 0x48:
nv_wr32(priv, 0x002220, 0x00030002); nv_wr32(fifo, 0x002220, 0x00030002);
break; break;
default: default:
nv_wr32(priv, 0x002230, 0x00000000); nv_wr32(fifo, 0x002230, 0x00000000);
nv_wr32(priv, 0x002220, ((fb->ram->size - 512 * 1024 + nv_wr32(fifo, 0x002220, ((fb->ram->size - 512 * 1024 +
priv->ramfc->addr) >> 16) | fifo->ramfc->addr) >> 16) |
0x00030000); 0x00030000);
break; break;
} }
nv_wr32(priv, NV03_PFIFO_CACHE1_PUSH1, priv->base.max); nv_wr32(fifo, NV03_PFIFO_CACHE1_PUSH1, fifo->base.max);
nv_wr32(priv, NV03_PFIFO_INTR_0, 0xffffffff); nv_wr32(fifo, NV03_PFIFO_INTR_0, 0xffffffff);
nv_wr32(priv, NV03_PFIFO_INTR_EN_0, 0xffffffff); nv_wr32(fifo, NV03_PFIFO_INTR_EN_0, 0xffffffff);
nv_wr32(priv, NV03_PFIFO_CACHE1_PUSH0, 1); nv_wr32(fifo, NV03_PFIFO_CACHE1_PUSH0, 1);
nv_wr32(priv, NV04_PFIFO_CACHE1_PULL0, 1); nv_wr32(fifo, NV04_PFIFO_CACHE1_PULL0, 1);
nv_wr32(priv, NV03_PFIFO_CACHES, 1); nv_wr32(fifo, NV03_PFIFO_CACHES, 1);
return 0; return 0;
} }
......
...@@ -39,33 +39,33 @@ ...@@ -39,33 +39,33 @@
******************************************************************************/ ******************************************************************************/
static void static void
nv50_fifo_playlist_update_locked(struct nv50_fifo_priv *priv) nv50_fifo_playlist_update_locked(struct nv50_fifo *fifo)
{ {
struct nvkm_bar *bar = nvkm_bar(priv); struct nvkm_bar *bar = nvkm_bar(fifo);
struct nvkm_gpuobj *cur; struct nvkm_gpuobj *cur;
int i, p; int i, p;
cur = priv->playlist[priv->cur_playlist]; cur = fifo->playlist[fifo->cur_playlist];
priv->cur_playlist = !priv->cur_playlist; fifo->cur_playlist = !fifo->cur_playlist;
for (i = priv->base.min, p = 0; i < priv->base.max; i++) { for (i = fifo->base.min, p = 0; i < fifo->base.max; i++) {
if (nv_rd32(priv, 0x002600 + (i * 4)) & 0x80000000) if (nv_rd32(fifo, 0x002600 + (i * 4)) & 0x80000000)
nv_wo32(cur, p++ * 4, i); nv_wo32(cur, p++ * 4, i);
} }
bar->flush(bar); bar->flush(bar);
nv_wr32(priv, 0x0032f4, cur->addr >> 12); nv_wr32(fifo, 0x0032f4, cur->addr >> 12);
nv_wr32(priv, 0x0032ec, p); nv_wr32(fifo, 0x0032ec, p);
nv_wr32(priv, 0x002500, 0x00000101); nv_wr32(fifo, 0x002500, 0x00000101);
} }
void void
nv50_fifo_playlist_update(struct nv50_fifo_priv *priv) nv50_fifo_playlist_update(struct nv50_fifo *fifo)
{ {
mutex_lock(&nv_subdev(priv)->mutex); mutex_lock(&nv_subdev(fifo)->mutex);
nv50_fifo_playlist_update_locked(priv); nv50_fifo_playlist_update_locked(fifo);
mutex_unlock(&nv_subdev(priv)->mutex); mutex_unlock(&nv_subdev(fifo)->mutex);
} }
static int static int
...@@ -103,7 +103,7 @@ nv50_fifo_context_detach(struct nvkm_object *parent, bool suspend, ...@@ -103,7 +103,7 @@ nv50_fifo_context_detach(struct nvkm_object *parent, bool suspend,
struct nvkm_object *object) struct nvkm_object *object)
{ {
struct nvkm_bar *bar = nvkm_bar(parent); struct nvkm_bar *bar = nvkm_bar(parent);
struct nv50_fifo_priv *priv = (void *)parent->engine; struct nv50_fifo *fifo = (void *)parent->engine;
struct nv50_fifo_base *base = (void *)parent->parent; struct nv50_fifo_base *base = (void *)parent->parent;
struct nv50_fifo_chan *chan = (void *)parent; struct nv50_fifo_chan *chan = (void *)parent;
u32 addr, me; u32 addr, me;
...@@ -129,17 +129,17 @@ nv50_fifo_context_detach(struct nvkm_object *parent, bool suspend, ...@@ -129,17 +129,17 @@ nv50_fifo_context_detach(struct nvkm_object *parent, bool suspend,
* there's also a "ignore these engines" bitmask reg we can use * there's also a "ignore these engines" bitmask reg we can use
* if we hit the issue there.. * if we hit the issue there..
*/ */
me = nv_mask(priv, 0x00b860, 0x00000001, 0x00000001); me = nv_mask(fifo, 0x00b860, 0x00000001, 0x00000001);
/* do the kickoff... */ /* do the kickoff... */
nv_wr32(priv, 0x0032fc, nv_gpuobj(base)->addr >> 12); nv_wr32(fifo, 0x0032fc, nv_gpuobj(base)->addr >> 12);
if (!nv_wait_ne(priv, 0x0032fc, 0xffffffff, 0xffffffff)) { if (!nv_wait_ne(fifo, 0x0032fc, 0xffffffff, 0xffffffff)) {
nv_error(priv, "channel %d [%s] unload timeout\n", nv_error(fifo, "channel %d [%s] unload timeout\n",
chan->base.chid, nvkm_client_name(chan)); chan->base.chid, nvkm_client_name(chan));
if (suspend) if (suspend)
ret = -EBUSY; ret = -EBUSY;
} }
nv_wr32(priv, 0x00b860, me); nv_wr32(fifo, 0x00b860, me);
if (ret == 0) { if (ret == 0) {
nv_wo32(base->eng, addr + 0x00, 0x00000000); nv_wo32(base->eng, addr + 0x00, 0x00000000);
...@@ -320,7 +320,7 @@ nv50_fifo_chan_dtor(struct nvkm_object *object) ...@@ -320,7 +320,7 @@ nv50_fifo_chan_dtor(struct nvkm_object *object)
static int static int
nv50_fifo_chan_init(struct nvkm_object *object) nv50_fifo_chan_init(struct nvkm_object *object)
{ {
struct nv50_fifo_priv *priv = (void *)object->engine; struct nv50_fifo *fifo = (void *)object->engine;
struct nv50_fifo_base *base = (void *)object->parent; struct nv50_fifo_base *base = (void *)object->parent;
struct nv50_fifo_chan *chan = (void *)object; struct nv50_fifo_chan *chan = (void *)object;
struct nvkm_gpuobj *ramfc = base->ramfc; struct nvkm_gpuobj *ramfc = base->ramfc;
...@@ -331,22 +331,22 @@ nv50_fifo_chan_init(struct nvkm_object *object) ...@@ -331,22 +331,22 @@ nv50_fifo_chan_init(struct nvkm_object *object)
if (ret) if (ret)
return ret; return ret;
nv_wr32(priv, 0x002600 + (chid * 4), 0x80000000 | ramfc->addr >> 12); nv_wr32(fifo, 0x002600 + (chid * 4), 0x80000000 | ramfc->addr >> 12);
nv50_fifo_playlist_update(priv); nv50_fifo_playlist_update(fifo);
return 0; return 0;
} }
int int
nv50_fifo_chan_fini(struct nvkm_object *object, bool suspend) nv50_fifo_chan_fini(struct nvkm_object *object, bool suspend)
{ {
struct nv50_fifo_priv *priv = (void *)object->engine; struct nv50_fifo *fifo = (void *)object->engine;
struct nv50_fifo_chan *chan = (void *)object; struct nv50_fifo_chan *chan = (void *)object;
u32 chid = chan->base.chid; u32 chid = chan->base.chid;
/* remove channel from playlist, fifo will unload context */ /* remove channel from playlist, fifo will unload context */
nv_mask(priv, 0x002600 + (chid * 4), 0x80000000, 0x00000000); nv_mask(fifo, 0x002600 + (chid * 4), 0x80000000, 0x00000000);
nv50_fifo_playlist_update(priv); nv50_fifo_playlist_update(fifo);
nv_wr32(priv, 0x002600 + (chid * 4), 0x00000000); nv_wr32(fifo, 0x002600 + (chid * 4), 0x00000000);
return nvkm_fifo_channel_fini(&chan->base, suspend); return nvkm_fifo_channel_fini(&chan->base, suspend);
} }
...@@ -456,69 +456,69 @@ nv50_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -456,69 +456,69 @@ nv50_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nv50_fifo_priv *priv; struct nv50_fifo *fifo;
int ret; int ret;
ret = nvkm_fifo_create(parent, engine, oclass, 1, 127, &priv); ret = nvkm_fifo_create(parent, engine, oclass, 1, 127, &fifo);
*pobject = nv_object(priv); *pobject = nv_object(fifo);
if (ret) if (ret)
return ret; return ret;
ret = nvkm_gpuobj_new(nv_object(priv), NULL, 128 * 4, 0x1000, 0, ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 128 * 4, 0x1000, 0,
&priv->playlist[0]); &fifo->playlist[0]);
if (ret) if (ret)
return ret; return ret;
ret = nvkm_gpuobj_new(nv_object(priv), NULL, 128 * 4, 0x1000, 0, ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 128 * 4, 0x1000, 0,
&priv->playlist[1]); &fifo->playlist[1]);
if (ret) if (ret)
return ret; return ret;
nv_subdev(priv)->unit = 0x00000100; nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(priv)->intr = nv04_fifo_intr; nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(priv)->cclass = &nv50_fifo_cclass; nv_engine(fifo)->cclass = &nv50_fifo_cclass;
nv_engine(priv)->sclass = nv50_fifo_sclass; nv_engine(fifo)->sclass = nv50_fifo_sclass;
priv->base.pause = nv04_fifo_pause; fifo->base.pause = nv04_fifo_pause;
priv->base.start = nv04_fifo_start; fifo->base.start = nv04_fifo_start;
return 0; return 0;
} }
void void
nv50_fifo_dtor(struct nvkm_object *object) nv50_fifo_dtor(struct nvkm_object *object)
{ {
struct nv50_fifo_priv *priv = (void *)object; struct nv50_fifo *fifo = (void *)object;
nvkm_gpuobj_ref(NULL, &priv->playlist[1]); nvkm_gpuobj_ref(NULL, &fifo->playlist[1]);
nvkm_gpuobj_ref(NULL, &priv->playlist[0]); nvkm_gpuobj_ref(NULL, &fifo->playlist[0]);
nvkm_fifo_destroy(&priv->base); nvkm_fifo_destroy(&fifo->base);
} }
int int
nv50_fifo_init(struct nvkm_object *object) nv50_fifo_init(struct nvkm_object *object)
{ {
struct nv50_fifo_priv *priv = (void *)object; struct nv50_fifo *fifo = (void *)object;
int ret, i; int ret, i;
ret = nvkm_fifo_init(&priv->base); ret = nvkm_fifo_init(&fifo->base);
if (ret) if (ret)
return ret; return ret;
nv_mask(priv, 0x000200, 0x00000100, 0x00000000); nv_mask(fifo, 0x000200, 0x00000100, 0x00000000);
nv_mask(priv, 0x000200, 0x00000100, 0x00000100); nv_mask(fifo, 0x000200, 0x00000100, 0x00000100);
nv_wr32(priv, 0x00250c, 0x6f3cfc34); nv_wr32(fifo, 0x00250c, 0x6f3cfc34);
nv_wr32(priv, 0x002044, 0x01003fff); nv_wr32(fifo, 0x002044, 0x01003fff);
nv_wr32(priv, 0x002100, 0xffffffff); nv_wr32(fifo, 0x002100, 0xffffffff);
nv_wr32(priv, 0x002140, 0xbfffffff); nv_wr32(fifo, 0x002140, 0xbfffffff);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
nv_wr32(priv, 0x002600 + (i * 4), 0x00000000); nv_wr32(fifo, 0x002600 + (i * 4), 0x00000000);
nv50_fifo_playlist_update_locked(priv); nv50_fifo_playlist_update_locked(fifo);
nv_wr32(priv, 0x003200, 0x00000001); nv_wr32(fifo, 0x003200, 0x00000001);
nv_wr32(priv, 0x003250, 0x00000001); nv_wr32(fifo, 0x003250, 0x00000001);
nv_wr32(priv, 0x002500, 0x00000001); nv_wr32(fifo, 0x002500, 0x00000001);
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define __NV50_FIFO_H__ #define __NV50_FIFO_H__
#include <engine/fifo.h> #include <engine/fifo.h>
struct nv50_fifo_priv { struct nv50_fifo {
struct nvkm_fifo base; struct nvkm_fifo base;
struct nvkm_gpuobj *playlist[2]; struct nvkm_gpuobj *playlist[2];
int cur_playlist; int cur_playlist;
...@@ -23,7 +23,7 @@ struct nv50_fifo_chan { ...@@ -23,7 +23,7 @@ struct nv50_fifo_chan {
struct nvkm_ramht *ramht; struct nvkm_ramht *ramht;
}; };
void nv50_fifo_playlist_update(struct nv50_fifo_priv *); void nv50_fifo_playlist_update(struct nv50_fifo *);
void nv50_fifo_object_detach(struct nvkm_object *, int); void nv50_fifo_object_detach(struct nvkm_object *, int);
void nv50_fifo_chan_dtor(struct nvkm_object *); void nv50_fifo_chan_dtor(struct nvkm_object *);
......
...@@ -1121,7 +1121,7 @@ gf100_gr_ctxctl_isr(struct gf100_gr_priv *priv) ...@@ -1121,7 +1121,7 @@ gf100_gr_ctxctl_isr(struct gf100_gr_priv *priv)
static void static void
gf100_gr_intr(struct nvkm_subdev *subdev) gf100_gr_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct nvkm_handle *handle; struct nvkm_handle *handle;
...@@ -1142,7 +1142,7 @@ gf100_gr_intr(struct nvkm_subdev *subdev) ...@@ -1142,7 +1142,7 @@ gf100_gr_intr(struct nvkm_subdev *subdev)
class = 0x0000; class = 0x0000;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & 0x00000001) { if (stat & 0x00000001) {
/* /*
......
...@@ -1119,18 +1119,18 @@ static void ...@@ -1119,18 +1119,18 @@ static void
nv10_gr_tile_prog(struct nvkm_engine *engine, int i) nv10_gr_tile_prog(struct nvkm_engine *engine, int i)
{ {
struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i]; struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i];
struct nvkm_fifo *pfifo = nvkm_fifo(engine); struct nvkm_fifo *fifo = nvkm_fifo(engine);
struct nv10_gr_priv *priv = (void *)engine; struct nv10_gr_priv *priv = (void *)engine;
unsigned long flags; unsigned long flags;
pfifo->pause(pfifo, &flags); fifo->pause(fifo, &flags);
nv04_gr_idle(priv); nv04_gr_idle(priv);
nv_wr32(priv, NV10_PGRAPH_TLIMIT(i), tile->limit); nv_wr32(priv, NV10_PGRAPH_TLIMIT(i), tile->limit);
nv_wr32(priv, NV10_PGRAPH_TSIZE(i), tile->pitch); nv_wr32(priv, NV10_PGRAPH_TSIZE(i), tile->pitch);
nv_wr32(priv, NV10_PGRAPH_TILE(i), tile->addr); nv_wr32(priv, NV10_PGRAPH_TILE(i), tile->addr);
pfifo->start(pfifo, &flags); fifo->start(fifo, &flags);
} }
const struct nvkm_bitfield nv10_gr_intr_name[] = { const struct nvkm_bitfield nv10_gr_intr_name[] = {
......
...@@ -157,11 +157,11 @@ void ...@@ -157,11 +157,11 @@ void
nv20_gr_tile_prog(struct nvkm_engine *engine, int i) nv20_gr_tile_prog(struct nvkm_engine *engine, int i)
{ {
struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i]; struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i];
struct nvkm_fifo *pfifo = nvkm_fifo(engine); struct nvkm_fifo *fifo = nvkm_fifo(engine);
struct nv20_gr_priv *priv = (void *)engine; struct nv20_gr_priv *priv = (void *)engine;
unsigned long flags; unsigned long flags;
pfifo->pause(pfifo, &flags); fifo->pause(fifo, &flags);
nv04_gr_idle(priv); nv04_gr_idle(priv);
nv_wr32(priv, NV20_PGRAPH_TLIMIT(i), tile->limit); nv_wr32(priv, NV20_PGRAPH_TLIMIT(i), tile->limit);
...@@ -181,7 +181,7 @@ nv20_gr_tile_prog(struct nvkm_engine *engine, int i) ...@@ -181,7 +181,7 @@ nv20_gr_tile_prog(struct nvkm_engine *engine, int i)
nv_wr32(priv, NV10_PGRAPH_RDI_DATA, tile->zcomp); nv_wr32(priv, NV10_PGRAPH_RDI_DATA, tile->zcomp);
} }
pfifo->start(pfifo, &flags); fifo->start(fifo, &flags);
} }
void void
......
...@@ -206,11 +206,11 @@ static void ...@@ -206,11 +206,11 @@ static void
nv40_gr_tile_prog(struct nvkm_engine *engine, int i) nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
{ {
struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i]; struct nvkm_fb_tile *tile = &nvkm_fb(engine)->tile.region[i];
struct nvkm_fifo *pfifo = nvkm_fifo(engine); struct nvkm_fifo *fifo = nvkm_fifo(engine);
struct nv40_gr_priv *priv = (void *)engine; struct nv40_gr_priv *priv = (void *)engine;
unsigned long flags; unsigned long flags;
pfifo->pause(pfifo, &flags); fifo->pause(fifo, &flags);
nv04_gr_idle(priv); nv04_gr_idle(priv);
switch (nv_device(priv)->chipset) { switch (nv_device(priv)->chipset) {
...@@ -277,13 +277,13 @@ nv40_gr_tile_prog(struct nvkm_engine *engine, int i) ...@@ -277,13 +277,13 @@ nv40_gr_tile_prog(struct nvkm_engine *engine, int i)
break; break;
} }
pfifo->start(pfifo, &flags); fifo->start(fifo, &flags);
} }
static void static void
nv40_gr_intr(struct nvkm_subdev *subdev) nv40_gr_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct nvkm_handle *handle = NULL; struct nvkm_handle *handle = NULL;
...@@ -301,7 +301,7 @@ nv40_gr_intr(struct nvkm_subdev *subdev) ...@@ -301,7 +301,7 @@ nv40_gr_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & NV_PGRAPH_INTR_ERROR) { if (stat & NV_PGRAPH_INTR_ERROR) {
if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) { if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) {
......
...@@ -782,7 +782,7 @@ nv50_gr_trap_handler(struct nv50_gr_priv *priv, u32 display, ...@@ -782,7 +782,7 @@ nv50_gr_trap_handler(struct nv50_gr_priv *priv, u32 display,
static void static void
nv50_gr_intr(struct nvkm_subdev *subdev) nv50_gr_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct nvkm_handle *handle = NULL; struct nvkm_handle *handle = NULL;
...@@ -798,7 +798,7 @@ nv50_gr_intr(struct nvkm_subdev *subdev) ...@@ -798,7 +798,7 @@ nv50_gr_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & 0x00000010) { if (stat & 0x00000010) {
handle = nvkm_handle_get_class(engctx, class); handle = nvkm_handle_get_class(engctx, class);
......
...@@ -194,7 +194,7 @@ void ...@@ -194,7 +194,7 @@ void
nv31_mpeg_intr(struct nvkm_subdev *subdev) nv31_mpeg_intr(struct nvkm_subdev *subdev)
{ {
struct nv31_mpeg_priv *priv = (void *)subdev; struct nv31_mpeg_priv *priv = (void *)subdev;
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_handle *handle; struct nvkm_handle *handle;
struct nvkm_object *engctx; struct nvkm_object *engctx;
u32 stat = nv_rd32(priv, 0x00b100); u32 stat = nv_rd32(priv, 0x00b100);
...@@ -227,7 +227,7 @@ nv31_mpeg_intr(struct nvkm_subdev *subdev) ...@@ -227,7 +227,7 @@ nv31_mpeg_intr(struct nvkm_subdev *subdev)
if (show) { if (show) {
nv_error(priv, "ch %d [%s] 0x%08x 0x%08x 0x%08x 0x%08x\n", nv_error(priv, "ch %d [%s] 0x%08x 0x%08x 0x%08x 0x%08x\n",
pfifo->chid(pfifo, engctx), fifo->chid(fifo, engctx),
nvkm_client_name(engctx), stat, type, mthd, data); nvkm_client_name(engctx), stat, type, mthd, data);
} }
......
...@@ -93,7 +93,7 @@ nv44_mpeg_cclass = { ...@@ -93,7 +93,7 @@ nv44_mpeg_cclass = {
static void static void
nv44_mpeg_intr(struct nvkm_subdev *subdev) nv44_mpeg_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct nvkm_handle *handle; struct nvkm_handle *handle;
...@@ -107,7 +107,7 @@ nv44_mpeg_intr(struct nvkm_subdev *subdev) ...@@ -107,7 +107,7 @@ nv44_mpeg_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & 0x01000000) { if (stat & 0x01000000) {
/* happens on initial binding of the object */ /* happens on initial binding of the object */
......
...@@ -75,7 +75,7 @@ static const struct nvkm_enum g98_sec_isr_error_name[] = { ...@@ -75,7 +75,7 @@ static const struct nvkm_enum g98_sec_isr_error_name[] = {
static void static void
g98_sec_intr(struct nvkm_subdev *subdev) g98_sec_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(subdev); struct nvkm_fifo *fifo = nvkm_fifo(subdev);
struct nvkm_engine *engine = nv_engine(subdev); struct nvkm_engine *engine = nv_engine(subdev);
struct nvkm_object *engctx; struct nvkm_object *engctx;
struct g98_sec_priv *priv = (void *)subdev; struct g98_sec_priv *priv = (void *)subdev;
...@@ -90,7 +90,7 @@ g98_sec_intr(struct nvkm_subdev *subdev) ...@@ -90,7 +90,7 @@ g98_sec_intr(struct nvkm_subdev *subdev)
int chid; int chid;
engctx = nvkm_engctx_get(engine, inst); engctx = nvkm_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx); chid = fifo->chid(fifo, engctx);
if (stat & 0x00000040) { if (stat & 0x00000040) {
nv_error(priv, "DISPATCH_ERROR ["); nv_error(priv, "DISPATCH_ERROR [");
......
...@@ -297,7 +297,7 @@ calc_host(struct gt215_clk *clk, struct nvkm_cstate *cstate) ...@@ -297,7 +297,7 @@ calc_host(struct gt215_clk *clk, struct nvkm_cstate *cstate)
int int
gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags) gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(clk); struct nvkm_fifo *fifo = nvkm_fifo(clk);
/* halt and idle execution engines */ /* halt and idle execution engines */
nv_mask(clk, 0x020060, 0x00070000, 0x00000000); nv_mask(clk, 0x020060, 0x00070000, 0x00000000);
...@@ -306,8 +306,8 @@ gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags) ...@@ -306,8 +306,8 @@ gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags)
if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000)) if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000))
return -EBUSY; return -EBUSY;
if (pfifo) if (fifo)
pfifo->pause(pfifo, flags); fifo->pause(fifo, flags);
if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010)) if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010))
return -EIO; return -EIO;
...@@ -320,10 +320,10 @@ gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags) ...@@ -320,10 +320,10 @@ gt215_clk_pre(struct nvkm_clk *clk, unsigned long *flags)
void void
gt215_clk_post(struct nvkm_clk *clk, unsigned long *flags) gt215_clk_post(struct nvkm_clk *clk, unsigned long *flags)
{ {
struct nvkm_fifo *pfifo = nvkm_fifo(clk); struct nvkm_fifo *fifo = nvkm_fifo(clk);
if (pfifo && flags) if (fifo && flags)
pfifo->start(pfifo, flags); fifo->start(fifo, flags);
nv_mask(clk, 0x002504, 0x00000001, 0x00000000); nv_mask(clk, 0x002504, 0x00000001, 0x00000000);
nv_mask(clk, 0x020060, 0x00070000, 0x00040000); nv_mask(clk, 0x020060, 0x00070000, 0x00040000);
......
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