const struct nvkm_instmem_func *func;
- struct nvkm_gpuobj *vbios;
+ struct nvkm_memory *vbios;
struct nvkm_ramht *ramht;
- struct nvkm_gpuobj *ramro;
- struct nvkm_gpuobj *ramfc;
+ struct nvkm_memory *ramro;
+ struct nvkm_memory *ramfc;
};
struct nvkm_instmem_func {
{
struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
u32 context, chid = chan->base.chid;
int ret;
context |= chid << 24;
mutex_lock(&nv_subdev(fifo)->mutex);
- ret = nvkm_ramht_insert(fifo->ramht, chid, handle, context);
+ ret = nvkm_ramht_insert(imem->ramht, chid, handle, context);
mutex_unlock(&nv_subdev(fifo)->mutex);
return ret;
}
nv04_fifo_object_detach(struct nvkm_object *parent, int cookie)
{
struct nv04_fifo *fifo = (void *)parent->engine;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
mutex_lock(&nv_subdev(fifo)->mutex);
- nvkm_ramht_remove(fifo->ramht, cookie);
+ nvkm_ramht_remove(imem->ramht, cookie);
mutex_unlock(&nv_subdev(fifo)->mutex);
}
struct nv03_channel_dma_v0 v0;
} *args = data;
struct nv04_fifo *fifo = (void *)engine;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
struct nv04_fifo_chan *chan;
int ret;
nv_parent(chan)->context_attach = nv04_fifo_context_attach;
chan->ramfc = chan->base.chid * 32;
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x08, chan->base.pushgpu->addr >> 4);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x10,
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x00, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x04, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x08, chan->base.pushgpu->addr >> 4);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x10,
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN
NV_PFIFO_CACHE1_BIG_ENDIAN |
#endif
NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8);
- nvkm_done(fifo->ramfc);
+ nvkm_done(imem->ramfc);
return 0;
}
{
struct nv04_fifo *fifo = (void *)object->engine;
struct nv04_fifo_chan *chan = (void *)object;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
struct ramfc_desc *c = fifo->ramfc_desc;
- nvkm_kmap(fifo->ramfc);
+ nvkm_kmap(imem->ramfc);
do {
- nvkm_wo32(fifo->ramfc, chan->ramfc + c->ctxp, 0x00000000);
+ nvkm_wo32(imem->ramfc, chan->ramfc + c->ctxp, 0x00000000);
} while ((++c)->bits);
- nvkm_done(fifo->ramfc);
+ nvkm_done(imem->ramfc);
nvkm_fifo_channel_destroy(&chan->base);
}
{
struct nv04_fifo *fifo = (void *)object->engine;
struct nv04_fifo_chan *chan = (void *)object;
- struct nvkm_gpuobj *fctx = fifo->ramfc;
struct nvkm_device *device = fifo->base.engine.subdev.device;
+ struct nvkm_memory *fctx = device->imem->ramfc;
struct ramfc_desc *c;
unsigned long flags;
u32 data = chan->ramfc;
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
- struct nvkm_device *device = (void *)parent;
- struct nvkm_instmem *imem = device->imem;
struct nv04_fifo *fifo;
int ret;
if (ret)
return ret;
- nvkm_ramht_ref(imem->ramht, &fifo->ramht);
- nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
- nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
-
nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(fifo)->cclass = &nv04_fifo_cclass;
nv04_fifo_dtor(struct nvkm_object *object)
{
struct nv04_fifo *fifo = (void *)object;
- nvkm_gpuobj_ref(NULL, &fifo->ramfc);
- nvkm_gpuobj_ref(NULL, &fifo->ramro);
- nvkm_ramht_ref(NULL, &fifo->ramht);
nvkm_fifo_destroy(&fifo->base);
}
{
struct nv04_fifo *fifo = (void *)object;
struct nvkm_device *device = fifo->base.engine.subdev.device;
+ struct nvkm_instmem *imem = device->imem;
+ struct nvkm_ramht *ramht = imem->ramht;
+ struct nvkm_memory *ramro = imem->ramro;
+ struct nvkm_memory *ramfc = imem->ramfc;
int ret;
ret = nvkm_fifo_init(&fifo->base);
nvkm_wr32(device, NV04_PFIFO_DMA_TIMESLICE, 0x0101ffff);
nvkm_wr32(device, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
- ((fifo->ramht->bits - 9) << 16) |
- (fifo->ramht->gpuobj.addr >> 8));
- nvkm_wr32(device, NV03_PFIFO_RAMRO, fifo->ramro->addr >> 8);
- nvkm_wr32(device, NV03_PFIFO_RAMFC, fifo->ramfc->addr >> 8);
+ ((ramht->bits - 9) << 16) |
+ (ramht->gpuobj.addr >> 8));
+ nvkm_wr32(device, NV03_PFIFO_RAMRO, nvkm_memory_addr(ramro) >> 8);
+ nvkm_wr32(device, NV03_PFIFO_RAMFC, nvkm_memory_addr(ramfc) >> 8);
nvkm_wr32(device, NV03_PFIFO_CACHE1_PUSH1, fifo->base.max);
struct nv04_fifo {
struct nvkm_fifo base;
struct ramfc_desc *ramfc_desc;
- struct nvkm_ramht *ramht;
- struct nvkm_gpuobj *ramro;
- struct nvkm_gpuobj *ramfc;
};
struct nv04_fifo_base {
#include <core/client.h>
#include <core/engctx.h>
-#include <core/ramht.h>
#include <subdev/instmem.h>
#include <nvif/class.h>
struct nv03_channel_dma_v0 v0;
} *args = data;
struct nv04_fifo *fifo = (void *)engine;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
struct nv04_fifo_chan *chan;
int ret;
nv_parent(chan)->context_attach = nv04_fifo_context_attach;
chan->ramfc = chan->base.chid * 32;
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x14,
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x00, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x04, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x14,
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN
NV_PFIFO_CACHE1_BIG_ENDIAN |
#endif
NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8);
- nvkm_done(fifo->ramfc);
+ nvkm_done(imem->ramfc);
return 0;
}
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
- struct nvkm_device *device = (void *)parent;
- struct nvkm_instmem *imem = device->imem;
struct nv04_fifo *fifo;
int ret;
if (ret)
return ret;
- nvkm_ramht_ref(imem->ramht, &fifo->ramht);
- nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
- nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
-
nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(fifo)->cclass = &nv10_fifo_cclass;
struct nv03_channel_dma_v0 v0;
} *args = data;
struct nv04_fifo *fifo = (void *)engine;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
struct nv04_fifo_chan *chan;
int ret;
nv_parent(chan)->context_attach = nv04_fifo_context_attach;
chan->ramfc = chan->base.chid * 64;
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x14,
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x00, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x04, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x14,
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN
NV_PFIFO_CACHE1_BIG_ENDIAN |
#endif
NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8);
- nvkm_done(fifo->ramfc);
+ nvkm_done(imem->ramfc);
return 0;
}
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
- struct nvkm_device *device = (void *)parent;
- struct nvkm_instmem *imem = device->imem;
struct nv04_fifo *fifo;
int ret;
if (ret)
return ret;
- nvkm_ramht_ref(imem->ramht, &fifo->ramht);
- nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
- nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
-
nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(fifo)->cclass = &nv17_fifo_cclass;
{
struct nv04_fifo *fifo = (void *)object;
struct nvkm_device *device = fifo->base.engine.subdev.device;
+ struct nvkm_instmem *imem = device->imem;
+ struct nvkm_ramht *ramht = imem->ramht;
+ struct nvkm_memory *ramro = imem->ramro;
+ struct nvkm_memory *ramfc = imem->ramfc;
int ret;
ret = nvkm_fifo_init(&fifo->base);
nvkm_wr32(device, NV04_PFIFO_DMA_TIMESLICE, 0x0101ffff);
nvkm_wr32(device, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
- ((fifo->ramht->bits - 9) << 16) |
- (fifo->ramht->gpuobj.addr >> 8));
- nvkm_wr32(device, NV03_PFIFO_RAMRO, fifo->ramro->addr >> 8);
- nvkm_wr32(device, NV03_PFIFO_RAMFC, fifo->ramfc->addr >> 8 | 0x00010000);
+ ((ramht->bits - 9) << 16) |
+ (ramht->gpuobj.addr >> 8));
+ nvkm_wr32(device, NV03_PFIFO_RAMRO, nvkm_memory_addr(ramro) >> 8);
+ nvkm_wr32(device, NV03_PFIFO_RAMFC, nvkm_memory_addr(ramfc) >> 8 |
+ 0x00010000);
nvkm_wr32(device, NV03_PFIFO_CACHE1_PUSH1, fifo->base.max);
{
struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
u32 context, chid = chan->base.chid;
int ret;
context |= chid << 23;
mutex_lock(&nv_subdev(fifo)->mutex);
- ret = nvkm_ramht_insert(fifo->ramht, chid, handle, context);
+ ret = nvkm_ramht_insert(imem->ramht, chid, handle, context);
mutex_unlock(&nv_subdev(fifo)->mutex);
return ret;
}
struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent;
struct nvkm_device *device = fifo->base.engine.subdev.device;
+ struct nvkm_instmem *imem = device->imem;
unsigned long flags;
u32 reg, ctx;
if ((nvkm_rd32(device, 0x003204) & fifo->base.max) == chan->base.chid)
nvkm_wr32(device, reg, nv_engctx(engctx)->addr);
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + ctx, nv_engctx(engctx)->addr);
- nvkm_done(fifo->ramfc);
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + ctx, nv_engctx(engctx)->addr);
+ nvkm_done(imem->ramfc);
nvkm_mask(device, 0x002500, 0x00000001, 0x00000001);
spin_unlock_irqrestore(&fifo->base.lock, flags);
struct nv04_fifo *fifo = (void *)parent->engine;
struct nv04_fifo_chan *chan = (void *)parent;
struct nvkm_device *device = fifo->base.engine.subdev.device;
+ struct nvkm_instmem *imem = device->imem;
unsigned long flags;
u32 reg, ctx;
if ((nvkm_rd32(device, 0x003204) & fifo->base.max) == chan->base.chid)
nvkm_wr32(device, reg, 0x00000000);
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + ctx, 0x00000000);
- nvkm_done(fifo->ramfc);
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + ctx, 0x00000000);
+ nvkm_done(imem->ramfc);
nvkm_mask(device, 0x002500, 0x00000001, 0x00000001);
spin_unlock_irqrestore(&fifo->base.lock, flags);
struct nv03_channel_dma_v0 v0;
} *args = data;
struct nv04_fifo *fifo = (void *)engine;
+ struct nvkm_instmem *imem = fifo->base.engine.subdev.device->imem;
struct nv04_fifo_chan *chan;
int ret;
nv_parent(chan)->object_detach = nv04_fifo_object_detach;
chan->ramfc = chan->base.chid * 128;
- nvkm_kmap(fifo->ramfc);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x00, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x04, args->v0.offset);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x18, 0x30000000 |
+ nvkm_kmap(imem->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x00, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x04, args->v0.offset);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x0c, chan->base.pushgpu->addr >> 4);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x18, 0x30000000 |
NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
#ifdef __BIG_ENDIAN
NV_PFIFO_CACHE1_BIG_ENDIAN |
#endif
NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8);
- nvkm_wo32(fifo->ramfc, chan->ramfc + 0x3c, 0x0001ffff);
- nvkm_done(fifo->ramfc);
+ nvkm_wo32(imem->ramfc, chan->ramfc + 0x3c, 0x0001ffff);
+ nvkm_done(imem->ramfc);
return 0;
}
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
- struct nvkm_device *device = (void *)parent;
- struct nvkm_instmem *imem = device->imem;
struct nv04_fifo *fifo;
int ret;
if (ret)
return ret;
- nvkm_ramht_ref(imem->ramht, &fifo->ramht);
- nvkm_gpuobj_ref(imem->ramro, &fifo->ramro);
- nvkm_gpuobj_ref(imem->ramfc, &fifo->ramfc);
-
nv_subdev(fifo)->unit = 0x00000100;
nv_subdev(fifo)->intr = nv04_fifo_intr;
nv_engine(fifo)->cclass = &nv40_fifo_cclass;
struct nv04_fifo *fifo = (void *)object;
struct nvkm_device *device = fifo->base.engine.subdev.device;
struct nvkm_fb *fb = device->fb;
+ struct nvkm_instmem *imem = device->imem;
+ struct nvkm_ramht *ramht = imem->ramht;
+ struct nvkm_memory *ramro = imem->ramro;
+ struct nvkm_memory *ramfc = imem->ramfc;
int ret;
ret = nvkm_fifo_init(&fifo->base);
nvkm_wr32(device, 0x002058, 0x00000001);
nvkm_wr32(device, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
- ((fifo->ramht->bits - 9) << 16) |
- (fifo->ramht->gpuobj.addr >> 8));
- nvkm_wr32(device, NV03_PFIFO_RAMRO, fifo->ramro->addr >> 8);
+ ((ramht->bits - 9) << 16) |
+ (ramht->gpuobj.addr >> 8));
+ nvkm_wr32(device, NV03_PFIFO_RAMRO, nvkm_memory_addr(ramro) >> 8);
switch (nv_device(fifo)->chipset) {
case 0x47:
default:
nvkm_wr32(device, 0x002230, 0x00000000);
nvkm_wr32(device, 0x002220, ((fb->ram->size - 512 * 1024 +
- fifo->ramfc->addr) >> 16) |
- 0x00030000);
+ nvkm_memory_addr(ramfc)) >> 16) |
+ 0x00030000);
break;
}
nv04_instmem_dtor(struct nvkm_object *object)
{
struct nv04_instmem *imem = (void *)object;
- nvkm_gpuobj_ref(NULL, &imem->base.ramfc);
- nvkm_gpuobj_ref(NULL, &imem->base.ramro);
+ nvkm_memory_del(&imem->base.ramfc);
+ nvkm_memory_del(&imem->base.ramro);
nvkm_ramht_ref(NULL, &imem->base.ramht);
- nvkm_gpuobj_ref(NULL, &imem->base.vbios);
+ nvkm_memory_del(&imem->base.vbios);
nvkm_mm_fini(&imem->heap);
nvkm_instmem_destroy(&imem->base);
}
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
+ struct nvkm_device *device = (void *)parent;
struct nv04_instmem *imem;
int ret;
return ret;
/* 0x00000-0x10000: reserve for probable vbios image */
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x10000, 0, 0,
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x10000, 0, false,
&imem->base.vbios);
if (ret)
return ret;
return ret;
/* 0x18000-0x18800: reserve for RAMFC (enough for 32 nv30 channels) */
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x00800, 0,
- NVOBJ_FLAG_ZERO_ALLOC,
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x00800, 0, true,
&imem->base.ramfc);
if (ret)
return ret;
/* 0x18800-0x18a00: reserve for RAMRO */
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x00200, 0, 0,
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x00200, 0, false,
&imem->base.ramro);
if (ret)
return ret;
nv40_instmem_dtor(struct nvkm_object *object)
{
struct nv40_instmem *imem = (void *)object;
- nvkm_gpuobj_ref(NULL, &imem->base.ramfc);
- nvkm_gpuobj_ref(NULL, &imem->base.ramro);
+ nvkm_memory_del(&imem->base.ramfc);
+ nvkm_memory_del(&imem->base.ramro);
nvkm_ramht_ref(NULL, &imem->base.ramht);
- nvkm_gpuobj_ref(NULL, &imem->base.vbios);
+ nvkm_memory_del(&imem->base.vbios);
nvkm_mm_fini(&imem->heap);
if (imem->iomem)
iounmap(imem->iomem);
return ret;
/* 0x00000-0x10000: reserve for probable vbios image */
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x10000, 0, 0,
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x10000, 0, false,
&imem->base.vbios);
if (ret)
return ret;
/* 0x18000-0x18200: reserve for RAMRO
* 0x18200-0x20000: padding
*/
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x08000, 0, 0,
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x08000, 0, false,
&imem->base.ramro);
if (ret)
return ret;
/* 0x20000-0x21000: reserve for RAMFC
* 0x21000-0x40000: padding and some unknown crap
*/
- ret = nvkm_gpuobj_new(nv_object(imem), NULL, 0x20000, 0,
- NVOBJ_FLAG_ZERO_ALLOC, &imem->base.ramfc);
+ ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x20000, 0, true,
+ &imem->base.ramfc);
if (ret)
return ret;