1 #ifndef __NOUVEAU_NAMEDB_H__
2 #define __NOUVEAU_NAMEDB_H__
4 #include <core/parent.h>
8 struct nouveau_namedb {
9 struct nouveau_parent base;
11 struct list_head list;
14 static inline struct nouveau_namedb *
17 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
18 if (unlikely(!nv_iclass(obj, NV_NAMEDB_CLASS)))
19 nv_assert("BAD CAST -> NvNameDB, %08x", nv_hclass(obj));
24 #define nouveau_namedb_create(p,e,c,v,s,m,d) \
25 nouveau_namedb_create_((p), (e), (c), (v), (s), (m), \
26 sizeof(**d), (void **)d)
27 #define nouveau_namedb_init(p) \
28 nouveau_parent_init(&(p)->base)
29 #define nouveau_namedb_fini(p,s) \
30 nouveau_parent_fini(&(p)->base, (s))
31 #define nouveau_namedb_destroy(p) \
32 nouveau_parent_destroy(&(p)->base)
34 int nouveau_namedb_create_(struct nouveau_object *, struct nouveau_object *,
35 struct nouveau_oclass *, u32 pclass,
36 struct nouveau_oclass *, u64 engcls,
39 int _nouveau_namedb_ctor(struct nouveau_object *, struct nouveau_object *,
40 struct nouveau_oclass *, void *, u32,
41 struct nouveau_object **);
42 #define _nouveau_namedb_dtor _nouveau_parent_dtor
43 #define _nouveau_namedb_init _nouveau_parent_init
44 #define _nouveau_namedb_fini _nouveau_parent_fini
46 int nouveau_namedb_insert(struct nouveau_namedb *, u32 name,
47 struct nouveau_object *, struct nouveau_handle *);
48 void nouveau_namedb_remove(struct nouveau_handle *);
50 struct nouveau_handle *nouveau_namedb_get(struct nouveau_namedb *, u32);
51 struct nouveau_handle *nouveau_namedb_get_class(struct nouveau_namedb *, u16);
52 struct nouveau_handle *nouveau_namedb_get_vinst(struct nouveau_namedb *, u64);
53 struct nouveau_handle *nouveau_namedb_get_cinst(struct nouveau_namedb *, u32);
54 void nouveau_namedb_put(struct nouveau_handle *);