drm/nouveau/instmem: namespace + nvidia gpu names (no binary change)
authorBen Skeggs <bskeggs@redhat.com>
Wed, 14 Jan 2015 05:05:26 +0000 (15:05 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:17:55 +0000 (12:17 +1000)
The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bit.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.h
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/priv.h

index 4953e6c6c86b7488a3dc45505343281911f51c90..d104c1aac807f1cd37e7dbd92bf5c073c7f80106 100644 (file)
@@ -1,19 +1,16 @@
-#ifndef __NOUVEAU_INSTMEM_H__
-#define __NOUVEAU_INSTMEM_H__
-
+#ifndef __NVKM_INSTMEM_H__
+#define __NVKM_INSTMEM_H__
 #include <core/subdev.h>
-#include <core/device.h>
-#include <core/mm.h>
 
-struct nouveau_instobj {
-       struct nouveau_object base;
+struct nvkm_instobj {
+       struct nvkm_object base;
        struct list_head head;
        u32 *suspend;
        u64 addr;
        u32 size;
 };
 
-static inline struct nouveau_instobj *
+static inline struct nvkm_instobj *
 nv_memobj(void *obj)
 {
 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
@@ -23,17 +20,17 @@ nv_memobj(void *obj)
        return obj;
 }
 
-struct nouveau_instmem {
-       struct nouveau_subdev base;
+struct nvkm_instmem {
+       struct nvkm_subdev base;
        struct list_head list;
 
        u32 reserved;
-       int (*alloc)(struct nouveau_instmem *, struct nouveau_object *,
-                    u32 size, u32 align, struct nouveau_object **);
+       int (*alloc)(struct nvkm_instmem *, struct nvkm_object *,
+                    u32 size, u32 align, struct nvkm_object **);
 };
 
-static inline struct nouveau_instmem *
-nouveau_instmem(void *obj)
+static inline struct nvkm_instmem *
+nvkm_instmem(void *obj)
 {
        /* nv04/nv40 impls need to create objects in their constructor,
         * which is before the subdev pointer is valid
@@ -42,11 +39,10 @@ nouveau_instmem(void *obj)
            nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
                return obj;
 
-       return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_INSTMEM);
+       return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_INSTMEM);
 }
 
-extern struct nouveau_oclass *nv04_instmem_oclass;
-extern struct nouveau_oclass *nv40_instmem_oclass;
-extern struct nouveau_oclass *nv50_instmem_oclass;
-
+extern struct nvkm_oclass *nv04_instmem_oclass;
+extern struct nvkm_oclass *nv40_instmem_oclass;
+extern struct nvkm_oclass *nv50_instmem_oclass;
 #endif
index bfb0388f8d5b860b008721cfa076f325edc18d71..9200f122c02ccf2e8e70504b9b100d5e2b2de652 100644 (file)
@@ -34,7 +34,7 @@
  * interface to linux i2c bit-banging algorithm
  *****************************************************************************/
 
-#ifdef CONFIG_NVKM_I2C_INTERNAL_DEFAULT
+#ifdef CONFIG_NOUVEAU_I2C_INTERNAL_DEFAULT
 #define CSTMSEL true
 #else
 #define CSTMSEL false
index 35132badaa8fef5441500d63708ee32932ad393c..861a453d2a6753003a56cd02a66ae33430d6bc9c 100644 (file)
@@ -23,7 +23,7 @@
  */
 #include "priv.h"
 
-#ifdef CONFIG_NVKM_I2C_INTERNAL
+#ifdef CONFIG_NOUVEAU_I2C_INTERNAL
 #define T_TIMEOUT  2200000
 #define T_RISEFALL 1000
 #define T_HOLD     5000
index 767fcf70f98f4930f7ba3b113603a9fc517423d4..d16358cc6cbba50ff5e5e9848349ae928107d152 100644 (file)
  *
  * Authors: Ben Skeggs
  */
-
 #include "priv.h"
 
+#include <core/engine.h>
+
 /******************************************************************************
  * instmem object base implementation
  *****************************************************************************/
 
 void
-_nouveau_instobj_dtor(struct nouveau_object *object)
+_nvkm_instobj_dtor(struct nvkm_object *object)
 {
-       struct nouveau_instmem *imem = nouveau_instmem(object);
-       struct nouveau_instobj *iobj = (void *)object;
+       struct nvkm_instmem *imem = nvkm_instmem(object);
+       struct nvkm_instobj *iobj = (void *)object;
 
        mutex_lock(&nv_subdev(imem)->mutex);
        list_del(&iobj->head);
        mutex_unlock(&nv_subdev(imem)->mutex);
 
-       return nouveau_object_destroy(&iobj->base);
+       return nvkm_object_destroy(&iobj->base);
 }
 
 int
-nouveau_instobj_create_(struct nouveau_object *parent,
-                       struct nouveau_object *engine,
-                       struct nouveau_oclass *oclass,
-                       int length, void **pobject)
+nvkm_instobj_create_(struct nvkm_object *parent, struct nvkm_object *engine,
+                    struct nvkm_oclass *oclass, int length, void **pobject)
 {
-       struct nouveau_instmem *imem = nouveau_instmem(parent);
-       struct nouveau_instobj *iobj;
+       struct nvkm_instmem *imem = nvkm_instmem(parent);
+       struct nvkm_instobj *iobj;
        int ret;
 
-       ret = nouveau_object_create_(parent, engine, oclass, NV_MEMOBJ_CLASS,
-                                    length, pobject);
+       ret = nvkm_object_create_(parent, engine, oclass, NV_MEMOBJ_CLASS,
+                                 length, pobject);
        iobj = *pobject;
        if (ret)
                return ret;
@@ -68,26 +67,24 @@ nouveau_instobj_create_(struct nouveau_object *parent,
  *****************************************************************************/
 
 static int
-nouveau_instmem_alloc(struct nouveau_instmem *imem,
-                     struct nouveau_object *parent, u32 size, u32 align,
-                     struct nouveau_object **pobject)
+nvkm_instmem_alloc(struct nvkm_instmem *imem, struct nvkm_object *parent,
+                  u32 size, u32 align, struct nvkm_object **pobject)
 {
-       struct nouveau_instmem_impl *impl = (void *)imem->base.object.oclass;
-       struct nouveau_instobj_args args = { .size = size, .align = align };
-       return nouveau_object_ctor(parent, &parent->engine->subdev.object,
-                                  impl->instobj, &args, sizeof(args), pobject);
+       struct nvkm_instmem_impl *impl = (void *)imem->base.object.oclass;
+       struct nvkm_instobj_args args = { .size = size, .align = align };
+       return nvkm_object_ctor(parent, &parent->engine->subdev.object,
+                               impl->instobj, &args, sizeof(args), pobject);
 }
 
 int
-_nouveau_instmem_fini(struct nouveau_object *object, bool suspend)
+_nvkm_instmem_fini(struct nvkm_object *object, bool suspend)
 {
-       struct nouveau_instmem *imem = (void *)object;
-       struct nouveau_instobj *iobj;
+       struct nvkm_instmem *imem = (void *)object;
+       struct nvkm_instobj *iobj;
        int i, ret = 0;
 
        if (suspend) {
                mutex_lock(&imem->base.mutex);
-
                list_for_each_entry(iobj, &imem->list, head) {
                        iobj->suspend = vmalloc(iobj->size);
                        if (!iobj->suspend) {
@@ -98,29 +95,26 @@ _nouveau_instmem_fini(struct nouveau_object *object, bool suspend)
                        for (i = 0; i < iobj->size; i += 4)
                                iobj->suspend[i / 4] = nv_ro32(iobj, i);
                }
-
                mutex_unlock(&imem->base.mutex);
-
                if (ret)
                        return ret;
        }
 
-       return nouveau_subdev_fini(&imem->base, suspend);
+       return nvkm_subdev_fini(&imem->base, suspend);
 }
 
 int
-_nouveau_instmem_init(struct nouveau_object *object)
+_nvkm_instmem_init(struct nvkm_object *object)
 {
-       struct nouveau_instmem *imem = (void *)object;
-       struct nouveau_instobj *iobj;
+       struct nvkm_instmem *imem = (void *)object;
+       struct nvkm_instobj *iobj;
        int ret, i;
 
-       ret = nouveau_subdev_init(&imem->base);
+       ret = nvkm_subdev_init(&imem->base);
        if (ret)
                return ret;
 
        mutex_lock(&imem->base.mutex);
-
        list_for_each_entry(iobj, &imem->list, head) {
                if (iobj->suspend) {
                        for (i = 0; i < iobj->size; i += 4)
@@ -129,28 +123,24 @@ _nouveau_instmem_init(struct nouveau_object *object)
                        iobj->suspend = NULL;
                }
        }
-
        mutex_unlock(&imem->base.mutex);
-
        return 0;
 }
 
 int
-nouveau_instmem_create_(struct nouveau_object *parent,
-                       struct nouveau_object *engine,
-                       struct nouveau_oclass *oclass,
-                       int length, void **pobject)
+nvkm_instmem_create_(struct nvkm_object *parent, struct nvkm_object *engine,
+                    struct nvkm_oclass *oclass, int length, void **pobject)
 {
-       struct nouveau_instmem *imem;
+       struct nvkm_instmem *imem;
        int ret;
 
-       ret = nouveau_subdev_create_(parent, engine, oclass, 0,
-                                    "INSTMEM", "instmem", length, pobject);
+       ret = nvkm_subdev_create_(parent, engine, oclass, 0, "INSTMEM",
+                                 "instmem", length, pobject);
        imem = *pobject;
        if (ret)
                return ret;
 
        INIT_LIST_HEAD(&imem->list);
-       imem->alloc = nouveau_instmem_alloc;
+       imem->alloc = nvkm_instmem_alloc;
        return 0;
 }
index 9ffd2d8d73c472139c4fe4fab8c19ca81e1c2346..80614f1b207474ae407251d6811add96925e8241 100644 (file)
  *
  * Authors: Ben Skeggs
  */
-
 #include "nv04.h"
 
+#include <core/ramht.h>
+
 /******************************************************************************
  * instmem object implementation
  *****************************************************************************/
 
 static u32
-nv04_instobj_rd32(struct nouveau_object *object, u64 addr)
+nv04_instobj_rd32(struct nvkm_object *object, u64 addr)
 {
-       struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
+       struct nv04_instmem_priv *priv = (void *)nvkm_instmem(object);
        struct nv04_instobj_priv *node = (void *)object;
        return nv_ro32(priv, node->mem->offset + addr);
 }
 
 static void
-nv04_instobj_wr32(struct nouveau_object *object, u64 addr, u32 data)
+nv04_instobj_wr32(struct nvkm_object *object, u64 addr, u32 data)
 {
-       struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
+       struct nv04_instmem_priv *priv = (void *)nvkm_instmem(object);
        struct nv04_instobj_priv *node = (void *)object;
        nv_wo32(priv, node->mem->offset + addr, data);
 }
 
 static void
-nv04_instobj_dtor(struct nouveau_object *object)
+nv04_instobj_dtor(struct nvkm_object *object)
 {
-       struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
+       struct nv04_instmem_priv *priv = (void *)nvkm_instmem(object);
        struct nv04_instobj_priv *node = (void *)object;
-       nouveau_mm_free(&priv->heap, &node->mem);
-       nouveau_instobj_destroy(&node->base);
+       nvkm_mm_free(&priv->heap, &node->mem);
+       nvkm_instobj_destroy(&node->base);
 }
 
 static int
-nv04_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+nv04_instobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
-       struct nv04_instmem_priv *priv = (void *)nouveau_instmem(parent);
+       struct nv04_instmem_priv *priv = (void *)nvkm_instmem(parent);
        struct nv04_instobj_priv *node;
-       struct nouveau_instobj_args *args = data;
+       struct nvkm_instobj_args *args = data;
        int ret;
 
        if (!args->align)
                args->align = 1;
 
-       ret = nouveau_instobj_create(parent, engine, oclass, &node);
+       ret = nvkm_instobj_create(parent, engine, oclass, &node);
        *pobject = nv_object(node);
        if (ret)
                return ret;
 
-       ret = nouveau_mm_head(&priv->heap, 0, 1, args->size, args->size,
-                             args->align, &node->mem);
+       ret = nvkm_mm_head(&priv->heap, 0, 1, args->size, args->size,
+                          args->align, &node->mem);
        if (ret)
                return ret;
 
@@ -81,13 +82,13 @@ nv04_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        return 0;
 }
 
-struct nouveau_instobj_impl
+struct nvkm_instobj_impl
 nv04_instobj_oclass = {
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv04_instobj_ctor,
                .dtor = nv04_instobj_dtor,
-               .init = _nouveau_instobj_init,
-               .fini = _nouveau_instobj_fini,
+               .init = _nvkm_instobj_init,
+               .fini = _nvkm_instobj_fini,
                .rd32 = nv04_instobj_rd32,
                .wr32 = nv04_instobj_wr32,
        },
@@ -98,40 +99,40 @@ nv04_instobj_oclass = {
  *****************************************************************************/
 
 static u32
-nv04_instmem_rd32(struct nouveau_object *object, u64 addr)
+nv04_instmem_rd32(struct nvkm_object *object, u64 addr)
 {
        return nv_rd32(object, 0x700000 + addr);
 }
 
 static void
-nv04_instmem_wr32(struct nouveau_object *object, u64 addr, u32 data)
+nv04_instmem_wr32(struct nvkm_object *object, u64 addr, u32 data)
 {
        return nv_wr32(object, 0x700000 + addr, data);
 }
 
 void
-nv04_instmem_dtor(struct nouveau_object *object)
+nv04_instmem_dtor(struct nvkm_object *object)
 {
        struct nv04_instmem_priv *priv = (void *)object;
-       nouveau_gpuobj_ref(NULL, &priv->ramfc);
-       nouveau_gpuobj_ref(NULL, &priv->ramro);
-       nouveau_ramht_ref(NULL, &priv->ramht);
-       nouveau_gpuobj_ref(NULL, &priv->vbios);
-       nouveau_mm_fini(&priv->heap);
+       nvkm_gpuobj_ref(NULL, &priv->ramfc);
+       nvkm_gpuobj_ref(NULL, &priv->ramro);
+       nvkm_ramht_ref(NULL, &priv->ramht);
+       nvkm_gpuobj_ref(NULL, &priv->vbios);
+       nvkm_mm_fini(&priv->heap);
        if (priv->iomem)
                iounmap(priv->iomem);
-       nouveau_instmem_destroy(&priv->base);
+       nvkm_instmem_destroy(&priv->base);
 }
 
 static int
-nv04_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+nv04_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
        struct nv04_instmem_priv *priv;
        int ret;
 
-       ret = nouveau_instmem_create(parent, engine, oclass, &priv);
+       ret = nvkm_instmem_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (ret)
                return ret;
@@ -139,44 +140,44 @@ nv04_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        /* PRAMIN aperture maps over the end of VRAM, reserve it */
        priv->base.reserved = 512 * 1024;
 
-       ret = nouveau_mm_init(&priv->heap, 0, priv->base.reserved, 1);
+       ret = nvkm_mm_init(&priv->heap, 0, priv->base.reserved, 1);
        if (ret)
                return ret;
 
        /* 0x00000-0x10000: reserve for probable vbios image */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x10000, 0, 0,
-                               &priv->vbios);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x10000, 0, 0,
+                             &priv->vbios);
        if (ret)
                return ret;
 
        /* 0x10000-0x18000: reserve for RAMHT */
-       ret = nouveau_ramht_new(nv_object(priv), NULL, 0x08000, 0, &priv->ramht);
+       ret = nvkm_ramht_new(nv_object(priv), NULL, 0x08000, 0, &priv->ramht);
        if (ret)
                return ret;
 
        /* 0x18000-0x18800: reserve for RAMFC (enough for 32 nv30 channels) */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x00800, 0,
-                                NVOBJ_FLAG_ZERO_ALLOC, &priv->ramfc);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x00800, 0,
+                             NVOBJ_FLAG_ZERO_ALLOC, &priv->ramfc);
        if (ret)
                return ret;
 
        /* 0x18800-0x18a00: reserve for RAMRO */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x00200, 0, 0,
-                               &priv->ramro);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x00200, 0, 0,
+                             &priv->ramro);
        if (ret)
                return ret;
 
        return 0;
 }
 
-struct nouveau_oclass *
-nv04_instmem_oclass = &(struct nouveau_instmem_impl) {
+struct nvkm_oclass *
+nv04_instmem_oclass = &(struct nvkm_instmem_impl) {
        .base.handle = NV_SUBDEV(INSTMEM, 0x04),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv04_instmem_ctor,
                .dtor = nv04_instmem_dtor,
-               .init = _nouveau_instmem_init,
-               .fini = _nouveau_instmem_fini,
+               .init = _nvkm_instmem_init,
+               .fini = _nvkm_instmem_fini,
                .rd32 = nv04_instmem_rd32,
                .wr32 = nv04_instmem_wr32,
        },
index 095fbc6fc099a852bfee334dea9aba389448adcb..42b6c928047c100fd54bc2c4b31d527775e9200b 100644 (file)
@@ -1,40 +1,36 @@
 #ifndef __NV04_INSTMEM_H__
 #define __NV04_INSTMEM_H__
+#include "priv.h"
 
-#include <core/gpuobj.h>
-#include <core/ramht.h>
 #include <core/mm.h>
 
-#include "priv.h"
-
-extern struct nouveau_instobj_impl nv04_instobj_oclass;
+extern struct nvkm_instobj_impl nv04_instobj_oclass;
 
 struct nv04_instmem_priv {
-       struct nouveau_instmem base;
+       struct nvkm_instmem base;
 
        void __iomem *iomem;
-       struct nouveau_mm heap;
+       struct nvkm_mm heap;
 
-       struct nouveau_gpuobj *vbios;
-       struct nouveau_ramht  *ramht;
-       struct nouveau_gpuobj *ramro;
-       struct nouveau_gpuobj *ramfc;
+       struct nvkm_gpuobj *vbios;
+       struct nvkm_ramht  *ramht;
+       struct nvkm_gpuobj *ramro;
+       struct nvkm_gpuobj *ramfc;
 };
 
 static inline struct nv04_instmem_priv *
 nv04_instmem(void *obj)
 {
-       return (void *)nouveau_instmem(obj);
+       return (void *)nvkm_instmem(obj);
 }
 
 struct nv04_instobj_priv {
-       struct nouveau_instobj base;
-       struct nouveau_mm_node *mem;
+       struct nvkm_instobj base;
+       struct nvkm_mm_node *mem;
 };
 
-void nv04_instmem_dtor(struct nouveau_object *);
-
-int nv04_instmem_alloc(struct nouveau_instmem *, struct nouveau_object *,
-                      u32 size, u32 align, struct nouveau_object **pobject);
+void nv04_instmem_dtor(struct nvkm_object *);
 
+int nv04_instmem_alloc(struct nvkm_instmem *, struct nvkm_object *,
+                      u32 size, u32 align, struct nvkm_object **pobject);
 #endif
index f65bc796bcdefdd369c3ae6681c1b471a3b6ba69..b42b8588fc0e8ba00522740a4e215839c27ee401 100644 (file)
  *
  * Authors: Ben Skeggs
  */
+#include "nv04.h"
 
+#include <core/ramht.h>
 #include <engine/gr/nv40.h>
 
-#include "nv04.h"
-
 /******************************************************************************
  * instmem subdev implementation
  *****************************************************************************/
 
 static u32
-nv40_instmem_rd32(struct nouveau_object *object, u64 addr)
+nv40_instmem_rd32(struct nvkm_object *object, u64 addr)
 {
        struct nv04_instmem_priv *priv = (void *)object;
        return ioread32_native(priv->iomem + addr);
 }
 
 static void
-nv40_instmem_wr32(struct nouveau_object *object, u64 addr, u32 data)
+nv40_instmem_wr32(struct nvkm_object *object, u64 addr, u32 data)
 {
        struct nv04_instmem_priv *priv = (void *)object;
        iowrite32_native(data, priv->iomem + addr);
 }
 
 static int
-nv40_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+nv40_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
-       struct nouveau_device *device = nv_device(parent);
+       struct nvkm_device *device = nv_device(parent);
        struct nv04_instmem_priv *priv;
        int ret, bar, vs;
 
-       ret = nouveau_instmem_create(parent, engine, oclass, &priv);
+       ret = nvkm_instmem_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (ret)
                return ret;
@@ -87,49 +87,48 @@ nv40_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 
        priv->base.reserved = round_up(priv->base.reserved, 4096);
 
-       ret = nouveau_mm_init(&priv->heap, 0, priv->base.reserved, 1);
+       ret = nvkm_mm_init(&priv->heap, 0, priv->base.reserved, 1);
        if (ret)
                return ret;
 
        /* 0x00000-0x10000: reserve for probable vbios image */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x10000, 0, 0,
-                               &priv->vbios);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x10000, 0, 0,
+                             &priv->vbios);
        if (ret)
                return ret;
 
        /* 0x10000-0x18000: reserve for RAMHT */
-       ret = nouveau_ramht_new(nv_object(priv), NULL, 0x08000, 0,
-                              &priv->ramht);
+       ret = nvkm_ramht_new(nv_object(priv), NULL, 0x08000, 0, &priv->ramht);
        if (ret)
                return ret;
 
        /* 0x18000-0x18200: reserve for RAMRO
         * 0x18200-0x20000: padding
         */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x08000, 0, 0,
-                               &priv->ramro);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x08000, 0, 0,
+                             &priv->ramro);
        if (ret)
                return ret;
 
        /* 0x20000-0x21000: reserve for RAMFC
         * 0x21000-0x40000: padding and some unknown crap
         */
-       ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x20000, 0,
-                                NVOBJ_FLAG_ZERO_ALLOC, &priv->ramfc);
+       ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x20000, 0,
+                             NVOBJ_FLAG_ZERO_ALLOC, &priv->ramfc);
        if (ret)
                return ret;
 
        return 0;
 }
 
-struct nouveau_oclass *
-nv40_instmem_oclass = &(struct nouveau_instmem_impl) {
+struct nvkm_oclass *
+nv40_instmem_oclass = &(struct nvkm_instmem_impl) {
        .base.handle = NV_SUBDEV(INSTMEM, 0x40),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv40_instmem_ctor,
                .dtor = nv04_instmem_dtor,
-               .init = _nouveau_instmem_init,
-               .fini = _nouveau_instmem_fini,
+               .init = _nvkm_instmem_init,
+               .fini = _nvkm_instmem_fini,
                .rd32 = nv40_instmem_rd32,
                .wr32 = nv40_instmem_wr32,
        },
index 64ee680232e2233cbfd4061df948fd8cbfbdbe4f..8404143f93ee4b6721ca198e03861b5308570dbc 100644 (file)
  *
  * Authors: Ben Skeggs
  */
+#include "priv.h"
 
 #include <subdev/fb.h>
-#include <core/mm.h>
-
-#include "priv.h"
 
 struct nv50_instmem_priv {
-       struct nouveau_instmem base;
+       struct nvkm_instmem base;
        spinlock_t lock;
        u64 addr;
 };
 
 struct nv50_instobj_priv {
-       struct nouveau_instobj base;
-       struct nouveau_mem *mem;
+       struct nvkm_instobj base;
+       struct nvkm_mem *mem;
 };
 
 /******************************************************************************
@@ -43,9 +41,9 @@ struct nv50_instobj_priv {
  *****************************************************************************/
 
 static u32
-nv50_instobj_rd32(struct nouveau_object *object, u64 offset)
+nv50_instobj_rd32(struct nvkm_object *object, u64 offset)
 {
-       struct nv50_instmem_priv *priv = (void *)nouveau_instmem(object);
+       struct nv50_instmem_priv *priv = (void *)nvkm_instmem(object);
        struct nv50_instobj_priv *node = (void *)object;
        unsigned long flags;
        u64 base = (node->mem->offset + offset) & 0xffffff00000ULL;
@@ -63,9 +61,9 @@ nv50_instobj_rd32(struct nouveau_object *object, u64 offset)
 }
 
 static void
-nv50_instobj_wr32(struct nouveau_object *object, u64 offset, u32 data)
+nv50_instobj_wr32(struct nvkm_object *object, u64 offset, u32 data)
 {
-       struct nv50_instmem_priv *priv = (void *)nouveau_instmem(object);
+       struct nv50_instmem_priv *priv = (void *)nvkm_instmem(object);
        struct nv50_instobj_priv *node = (void *)object;
        unsigned long flags;
        u64 base = (node->mem->offset + offset) & 0xffffff00000ULL;
@@ -81,28 +79,28 @@ nv50_instobj_wr32(struct nouveau_object *object, u64 offset, u32 data)
 }
 
 static void
-nv50_instobj_dtor(struct nouveau_object *object)
+nv50_instobj_dtor(struct nvkm_object *object)
 {
        struct nv50_instobj_priv *node = (void *)object;
-       struct nouveau_fb *pfb = nouveau_fb(object);
+       struct nvkm_fb *pfb = nvkm_fb(object);
        pfb->ram->put(pfb, &node->mem);
-       nouveau_instobj_destroy(&node->base);
+       nvkm_instobj_destroy(&node->base);
 }
 
 static int
-nv50_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+nv50_instobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
-       struct nouveau_fb *pfb = nouveau_fb(parent);
-       struct nouveau_instobj_args *args = data;
+       struct nvkm_fb *pfb = nvkm_fb(parent);
+       struct nvkm_instobj_args *args = data;
        struct nv50_instobj_priv *node;
        int ret;
 
        args->size  = max((args->size  + 4095) & ~4095, (u32)4096);
        args->align = max((args->align + 4095) & ~4095, (u32)4096);
 
-       ret = nouveau_instobj_create(parent, engine, oclass, &node);
+       ret = nvkm_instobj_create(parent, engine, oclass, &node);
        *pobject = nv_object(node);
        if (ret)
                return ret;
@@ -117,13 +115,13 @@ nv50_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        return 0;
 }
 
-static struct nouveau_instobj_impl
+static struct nvkm_instobj_impl
 nv50_instobj_oclass = {
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv50_instobj_ctor,
                .dtor = nv50_instobj_dtor,
-               .init = _nouveau_instobj_init,
-               .fini = _nouveau_instobj_fini,
+               .init = _nvkm_instobj_init,
+               .fini = _nvkm_instobj_fini,
                .rd32 = nv50_instobj_rd32,
                .wr32 = nv50_instobj_wr32,
        },
@@ -134,22 +132,22 @@ nv50_instobj_oclass = {
  *****************************************************************************/
 
 static int
-nv50_instmem_fini(struct nouveau_object *object, bool suspend)
+nv50_instmem_fini(struct nvkm_object *object, bool suspend)
 {
        struct nv50_instmem_priv *priv = (void *)object;
        priv->addr = ~0ULL;
-       return nouveau_instmem_fini(&priv->base, suspend);
+       return nvkm_instmem_fini(&priv->base, suspend);
 }
 
 static int
-nv50_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+nv50_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
        struct nv50_instmem_priv *priv;
        int ret;
 
-       ret = nouveau_instmem_create(parent, engine, oclass, &priv);
+       ret = nvkm_instmem_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (ret)
                return ret;
@@ -158,13 +156,13 @@ nv50_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        return 0;
 }
 
-struct nouveau_oclass *
-nv50_instmem_oclass = &(struct nouveau_instmem_impl) {
+struct nvkm_oclass *
+nv50_instmem_oclass = &(struct nvkm_instmem_impl) {
        .base.handle = NV_SUBDEV(INSTMEM, 0x50),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv50_instmem_ctor,
-               .dtor = _nouveau_instmem_dtor,
-               .init = _nouveau_instmem_init,
+               .dtor = _nvkm_instmem_dtor,
+               .init = _nvkm_instmem_init,
                .fini = nv50_instmem_fini,
        },
        .instobj = &nv50_instobj_oclass.base,
index 8d67dedc5bb23118fa06293f17ef20a80b3e6c31..b10e292e5607dec3563fd5d5c3c79a86924bde25 100644 (file)
@@ -1,56 +1,54 @@
 #ifndef __NVKM_INSTMEM_PRIV_H__
 #define __NVKM_INSTMEM_PRIV_H__
-
 #include <subdev/instmem.h>
 
-struct nouveau_instobj_impl {
-       struct nouveau_oclass base;
+struct nvkm_instobj_impl {
+       struct nvkm_oclass base;
 };
 
-struct nouveau_instobj_args {
+struct nvkm_instobj_args {
        u32 size;
        u32 align;
 };
 
-#define nouveau_instobj_create(p,e,o,d)                                        \
-       nouveau_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
-#define nouveau_instobj_destroy(p) ({                                          \
-       struct nouveau_instobj *iobj = (p);                                    \
-       _nouveau_instobj_dtor(nv_object(iobj));                                \
+#define nvkm_instobj_create(p,e,o,d)                                        \
+       nvkm_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
+#define nvkm_instobj_destroy(p) ({                                          \
+       struct nvkm_instobj *iobj = (p);                                    \
+       _nvkm_instobj_dtor(nv_object(iobj));                                \
 })
-#define nouveau_instobj_init(p)                                                \
-       nouveau_object_init(&(p)->base)
-#define nouveau_instobj_fini(p,s)                                              \
-       nouveau_object_fini(&(p)->base, (s))
-
-int  nouveau_instobj_create_(struct nouveau_object *, struct nouveau_object *,
-                            struct nouveau_oclass *, int, void **);
-void _nouveau_instobj_dtor(struct nouveau_object *);
-#define _nouveau_instobj_init nouveau_object_init
-#define _nouveau_instobj_fini nouveau_object_fini
-
-struct nouveau_instmem_impl {
-       struct nouveau_oclass base;
-       struct nouveau_oclass *instobj;
+#define nvkm_instobj_init(p)                                                \
+       nvkm_object_init(&(p)->base)
+#define nvkm_instobj_fini(p,s)                                              \
+       nvkm_object_fini(&(p)->base, (s))
+
+int  nvkm_instobj_create_(struct nvkm_object *, struct nvkm_object *,
+                            struct nvkm_oclass *, int, void **);
+void _nvkm_instobj_dtor(struct nvkm_object *);
+#define _nvkm_instobj_init nvkm_object_init
+#define _nvkm_instobj_fini nvkm_object_fini
+
+struct nvkm_instmem_impl {
+       struct nvkm_oclass base;
+       struct nvkm_oclass *instobj;
 };
 
-#define nouveau_instmem_create(p,e,o,d)                                        \
-       nouveau_instmem_create_((p), (e), (o), sizeof(**d), (void **)d)
-#define nouveau_instmem_destroy(p)                                             \
-       nouveau_subdev_destroy(&(p)->base)
-#define nouveau_instmem_init(p) ({                                             \
-       struct nouveau_instmem *imem = (p);                                    \
-       _nouveau_instmem_init(nv_object(imem));                                \
+#define nvkm_instmem_create(p,e,o,d)                                        \
+       nvkm_instmem_create_((p), (e), (o), sizeof(**d), (void **)d)
+#define nvkm_instmem_destroy(p)                                             \
+       nvkm_subdev_destroy(&(p)->base)
+#define nvkm_instmem_init(p) ({                                             \
+       struct nvkm_instmem *imem = (p);                                    \
+       _nvkm_instmem_init(nv_object(imem));                                \
 })
-#define nouveau_instmem_fini(p,s) ({                                           \
-       struct nouveau_instmem *imem = (p);                                    \
-       _nouveau_instmem_fini(nv_object(imem), (s));                           \
+#define nvkm_instmem_fini(p,s) ({                                           \
+       struct nvkm_instmem *imem = (p);                                    \
+       _nvkm_instmem_fini(nv_object(imem), (s));                           \
 })
 
-int nouveau_instmem_create_(struct nouveau_object *, struct nouveau_object *,
-                           struct nouveau_oclass *, int, void **);
-#define _nouveau_instmem_dtor _nouveau_subdev_dtor
-int _nouveau_instmem_init(struct nouveau_object *);
-int _nouveau_instmem_fini(struct nouveau_object *, bool);
-
+int nvkm_instmem_create_(struct nvkm_object *, struct nvkm_object *,
+                           struct nvkm_oclass *, int, void **);
+#define _nvkm_instmem_dtor _nvkm_subdev_dtor
+int _nvkm_instmem_init(struct nvkm_object *);
+int _nvkm_instmem_fini(struct nvkm_object *, bool);
 #endif