Commit 78b2b4e7 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/instmem: namespace + nvidia gpu names (no binary change)

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