diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/include/nvkm/core/object.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/core/object.h | 109 |
1 files changed, 53 insertions, 56 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h index 64c0038f1971..6e3cd3908400 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h @@ -1,6 +1,5 @@ -#ifndef __NOUVEAU_OBJECT_H__ -#define __NOUVEAU_OBJECT_H__ - +#ifndef __NVKM_OBJECT_H__ +#define __NVKM_OBJECT_H__ #include <core/os.h> #include <core/printk.h> @@ -14,52 +13,52 @@ #define NV_ENGCTX_CLASS 0x01000000 #define NV_OBJECT_CLASS 0x0000ffff -struct nouveau_object { - struct nouveau_oclass *oclass; - struct nouveau_object *parent; - struct nouveau_engine *engine; +struct nvkm_object { + struct nvkm_oclass *oclass; + struct nvkm_object *parent; + struct nvkm_engine *engine; atomic_t refcount; atomic_t usecount; #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA -#define NOUVEAU_OBJECT_MAGIC 0x75ef0bad +#define NVKM_OBJECT_MAGIC 0x75ef0bad struct list_head list; u32 _magic; #endif }; -static inline struct nouveau_object * +static inline struct nvkm_object * nv_object(void *obj) { #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA if (likely(obj)) { - struct nouveau_object *object = obj; - if (unlikely(object->_magic != NOUVEAU_OBJECT_MAGIC)) + struct nvkm_object *object = obj; + if (unlikely(object->_magic != NVKM_OBJECT_MAGIC)) nv_assert("BAD CAST -> NvObject, invalid magic"); } #endif return obj; } -#define nouveau_object_create(p,e,c,s,d) \ - nouveau_object_create_((p), (e), (c), (s), sizeof(**d), (void **)d) -int nouveau_object_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32, int size, void **); -void nouveau_object_destroy(struct nouveau_object *); -int nouveau_object_init(struct nouveau_object *); -int nouveau_object_fini(struct nouveau_object *, bool suspend); +#define nvkm_object_create(p,e,c,s,d) \ + nvkm_object_create_((p), (e), (c), (s), sizeof(**d), (void **)d) +int nvkm_object_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, u32, int size, void **); +void nvkm_object_destroy(struct nvkm_object *); +int nvkm_object_init(struct nvkm_object *); +int nvkm_object_fini(struct nvkm_object *, bool suspend); -int _nouveau_object_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); +int _nvkm_object_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); -extern struct nouveau_ofuncs nouveau_object_ofuncs; +extern struct nvkm_ofuncs nvkm_object_ofuncs; /* Don't allocate dynamically, because lockdep needs lock_class_keys to be in * ".data". */ -struct nouveau_oclass { +struct nvkm_oclass { u32 handle; - struct nouveau_ofuncs * const ofuncs; - struct nouveau_omthds * const omthds; + struct nvkm_ofuncs * const ofuncs; + struct nvkm_omthds * const omthds; struct lock_class_key lock_class_key; }; @@ -68,58 +67,57 @@ struct nouveau_oclass { #define nv_iclass(o,i) (nv_hclass(o) & (i)) #define nv_mclass(o) nv_iclass(o, NV_OBJECT_CLASS) -static inline struct nouveau_object * -nv_pclass(struct nouveau_object *parent, u32 oclass) +static inline struct nvkm_object * +nv_pclass(struct nvkm_object *parent, u32 oclass) { while (parent && !nv_iclass(parent, oclass)) parent = parent->parent; return parent; } -struct nouveau_omthds { +struct nvkm_omthds { u32 start; u32 limit; - int (*call)(struct nouveau_object *, u32, void *, u32); + int (*call)(struct nvkm_object *, u32, void *, u32); }; struct nvkm_event; -struct nouveau_ofuncs { - int (*ctor)(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *data, u32 size, - struct nouveau_object **); - void (*dtor)(struct nouveau_object *); - int (*init)(struct nouveau_object *); - int (*fini)(struct nouveau_object *, bool suspend); - int (*mthd)(struct nouveau_object *, u32, void *, u32); - int (*ntfy)(struct nouveau_object *, u32, struct nvkm_event **); - int (* map)(struct nouveau_object *, u64 *, u32 *); - u8 (*rd08)(struct nouveau_object *, u64 offset); - u16 (*rd16)(struct nouveau_object *, u64 offset); - u32 (*rd32)(struct nouveau_object *, u64 offset); - void (*wr08)(struct nouveau_object *, u64 offset, u8 data); - void (*wr16)(struct nouveau_object *, u64 offset, u16 data); - void (*wr32)(struct nouveau_object *, u64 offset, u32 data); +struct nvkm_ofuncs { + int (*ctor)(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *data, u32 size, + struct nvkm_object **); + void (*dtor)(struct nvkm_object *); + int (*init)(struct nvkm_object *); + int (*fini)(struct nvkm_object *, bool suspend); + int (*mthd)(struct nvkm_object *, u32, void *, u32); + int (*ntfy)(struct nvkm_object *, u32, struct nvkm_event **); + int (* map)(struct nvkm_object *, u64 *, u32 *); + u8 (*rd08)(struct nvkm_object *, u64 offset); + u16 (*rd16)(struct nvkm_object *, u64 offset); + u32 (*rd32)(struct nvkm_object *, u64 offset); + void (*wr08)(struct nvkm_object *, u64 offset, u8 data); + void (*wr16)(struct nvkm_object *, u64 offset, u16 data); + void (*wr32)(struct nvkm_object *, u64 offset, u32 data); }; -static inline struct nouveau_ofuncs * +static inline struct nvkm_ofuncs * nv_ofuncs(void *obj) { return nv_oclass(obj)->ofuncs; } -int nouveau_object_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void nouveau_object_ref(struct nouveau_object *, struct nouveau_object **); -int nouveau_object_inc(struct nouveau_object *); -int nouveau_object_dec(struct nouveau_object *, bool suspend); - -void nouveau_object_debug(void); +int nvkm_object_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); +void nvkm_object_ref(struct nvkm_object *, struct nvkm_object **); +int nvkm_object_inc(struct nvkm_object *); +int nvkm_object_dec(struct nvkm_object *, bool suspend); +void nvkm_object_debug(void); static inline int nv_exec(void *obj, u32 mthd, void *data, u32 size) { - struct nouveau_omthds *method = nv_oclass(obj)->omthds; + struct nvkm_omthds *method = nv_oclass(obj)->omthds; while (method && method->call) { if (mthd >= method->start && mthd <= method->limit) @@ -202,5 +200,4 @@ nv_memcmp(void *obj, u32 addr, const char *str, u32 len) } return 0; } - #endif |