drm/nouveau/imem: use object accessor function for suspend/resume
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:14 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:29 +0000 (12:40 +1000)
Very much not ideal, but this will be improved later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c

index 15caf553501b2c36ae830c6a0b681eb869a4de0d..04e8a62ade32f54c9d155f72d56fae6c7e1f177a 100644 (file)
@@ -138,51 +138,4 @@ nv_call(void *obj, u32 mthd, u32 data)
 {
        return nv_exec(obj, mthd, &data, sizeof(data));
 }
-
-static inline u8
-nv_ro08(void *obj, u64 addr)
-{
-       u8 data = nv_ofuncs(obj)->rd08(obj, addr);
-       return data;
-}
-
-static inline u16
-nv_ro16(void *obj, u64 addr)
-{
-       u16 data = nv_ofuncs(obj)->rd16(obj, addr);
-       return data;
-}
-
-static inline u32
-nv_ro32(void *obj, u64 addr)
-{
-       u32 data = nv_ofuncs(obj)->rd32(obj, addr);
-       return data;
-}
-
-static inline void
-nv_wo08(void *obj, u64 addr, u8 data)
-{
-       nv_ofuncs(obj)->wr08(obj, addr, data);
-}
-
-static inline void
-nv_wo16(void *obj, u64 addr, u16 data)
-{
-       nv_ofuncs(obj)->wr16(obj, addr, data);
-}
-
-static inline void
-nv_wo32(void *obj, u64 addr, u32 data)
-{
-       nv_ofuncs(obj)->wr32(obj, addr, data);
-}
-
-static inline u32
-nv_mo32(void *obj, u64 addr, u32 mask, u32 data)
-{
-       u32 temp = nv_ro32(obj, addr);
-       nv_wo32(obj, addr, (temp & ~mask) | data);
-       return temp;
-}
 #endif
index b6906f436e402c2221b0cb22b7c3c11bb89f0571..7ba3ff27e89ec4c628b9d308dce981d3a7ad6267 100644 (file)
@@ -3,7 +3,7 @@
 #include <core/subdev.h>
 
 struct nvkm_instobj {
-       struct nvkm_object base;
+       struct nvkm_object object;
        struct list_head head;
        u32 *suspend;
        u64 addr;
index 43a8f4e19eb6b6b5e339bd22426fd3b47b30c405..4219eb39cf450962f75f6e61a920f5406297b636 100644 (file)
@@ -39,7 +39,7 @@ _nvkm_instobj_dtor(struct nvkm_object *object)
        list_del(&iobj->head);
        mutex_unlock(&nv_subdev(imem)->mutex);
 
-       return nvkm_object_destroy(&iobj->base);
+       return nvkm_object_destroy(&iobj->object);
 }
 
 int
@@ -92,8 +92,10 @@ _nvkm_instmem_fini(struct nvkm_object *object, bool suspend)
                                break;
                        }
 
-                       for (i = 0; i < iobj->size; i += 4)
-                               iobj->suspend[i / 4] = nv_ro32(iobj, i);
+                       for (i = 0; i < iobj->size; i += 4) {
+                               nvkm_object_rd32(&iobj->object, i, (u32 *)
+                                                &iobj->suspend[i/4]);
+                       }
                }
                mutex_unlock(&imem->subdev.mutex);
                if (ret)
@@ -117,8 +119,10 @@ _nvkm_instmem_init(struct nvkm_object *object)
        mutex_lock(&imem->subdev.mutex);
        list_for_each_entry(iobj, &imem->list, head) {
                if (iobj->suspend) {
-                       for (i = 0; i < iobj->size; i += 4)
-                               nv_wo32(iobj, i, iobj->suspend[i / 4]);
+                       for (i = 0; i < iobj->size; i += 4) {
+                               nvkm_object_wr32(&iobj->object, i, *(u32 *)
+                                                &iobj->suspend[i/4]);
+                       }
                        vfree(iobj->suspend);
                        iobj->suspend = NULL;
                }