Commit 45ea5031 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/core: switch to gpuobj accessor macros

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 384af9ac
...@@ -34,8 +34,10 @@ nvkm_gpuobj_destroy(struct nvkm_gpuobj *gpuobj) ...@@ -34,8 +34,10 @@ nvkm_gpuobj_destroy(struct nvkm_gpuobj *gpuobj)
int i; int i;
if (gpuobj->flags & NVOBJ_FLAG_ZERO_FREE) { if (gpuobj->flags & NVOBJ_FLAG_ZERO_FREE) {
nvkm_kmap(gpuobj);
for (i = 0; i < gpuobj->size; i += 4) for (i = 0; i < gpuobj->size; i += 4)
nv_wo32(gpuobj, i, 0x00000000); nvkm_wo32(gpuobj, i, 0x00000000);
nvkm_done(gpuobj);
} }
if (gpuobj->node) if (gpuobj->node)
...@@ -123,8 +125,10 @@ nvkm_gpuobj_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -123,8 +125,10 @@ nvkm_gpuobj_create_(struct nvkm_object *parent, struct nvkm_object *engine,
} }
if (flags & NVOBJ_FLAG_ZERO_ALLOC) { if (flags & NVOBJ_FLAG_ZERO_ALLOC) {
nvkm_kmap(gpuobj);
for (i = 0; i < gpuobj->size; i += 4) for (i = 0; i < gpuobj->size; i += 4)
nv_wo32(gpuobj, i, 0x00000000); nvkm_wo32(gpuobj, i, 0x00000000);
nvkm_done(gpuobj);
} }
return ret; return ret;
......
...@@ -42,35 +42,43 @@ nvkm_ramht_hash(struct nvkm_ramht *ramht, int chid, u32 handle) ...@@ -42,35 +42,43 @@ nvkm_ramht_hash(struct nvkm_ramht *ramht, int chid, u32 handle)
int int
nvkm_ramht_insert(struct nvkm_ramht *ramht, int chid, u32 handle, u32 context) nvkm_ramht_insert(struct nvkm_ramht *ramht, int chid, u32 handle, u32 context)
{ {
struct nvkm_gpuobj *gpuobj = &ramht->gpuobj;
struct nvkm_bar *bar = nvkm_bar(ramht); struct nvkm_bar *bar = nvkm_bar(ramht);
int ret = -ENOSPC;
u32 co, ho; u32 co, ho;
co = ho = nvkm_ramht_hash(ramht, chid, handle); co = ho = nvkm_ramht_hash(ramht, chid, handle);
nvkm_kmap(gpuobj);
do { do {
if (!nv_ro32(ramht, co + 4)) { if (!nvkm_ro32(gpuobj, co + 4)) {
nv_wo32(ramht, co + 0, handle); nvkm_wo32(gpuobj, co + 0, handle);
nv_wo32(ramht, co + 4, context); nvkm_wo32(gpuobj, co + 4, context);
if (bar) if (bar)
bar->flush(bar); bar->flush(bar);
return co; ret = co;
break;
} }
co += 8; co += 8;
if (co >= nv_gpuobj(ramht)->size) if (co >= nv_gpuobj(ramht)->size)
co = 0; co = 0;
} while (co != ho); } while (co != ho);
nvkm_done(gpuobj);
return -ENOMEM; return ret;
} }
void void
nvkm_ramht_remove(struct nvkm_ramht *ramht, int cookie) nvkm_ramht_remove(struct nvkm_ramht *ramht, int cookie)
{ {
struct nvkm_gpuobj *gpuobj = &ramht->gpuobj;
struct nvkm_bar *bar = nvkm_bar(ramht); struct nvkm_bar *bar = nvkm_bar(ramht);
nv_wo32(ramht, cookie + 0, 0x00000000); nvkm_kmap(gpuobj);
nv_wo32(ramht, cookie + 4, 0x00000000); nvkm_wo32(gpuobj, cookie + 0, 0x00000000);
nvkm_wo32(gpuobj, cookie + 4, 0x00000000);
if (bar) if (bar)
bar->flush(bar); bar->flush(bar);
nvkm_done(gpuobj);
} }
static struct nvkm_oclass static struct nvkm_oclass
......
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