]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/gpu/drm/nouveau/core/include/core/namedb.h
Merge tag 'pm+acpi-3.15-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafae...
[mirror_ubuntu-hirsute-kernel.git] / drivers / gpu / drm / nouveau / core / include / core / namedb.h
1 #ifndef __NOUVEAU_NAMEDB_H__
2 #define __NOUVEAU_NAMEDB_H__
3
4 #include <core/parent.h>
5
6 struct nouveau_handle;
7
8 struct nouveau_namedb {
9 struct nouveau_parent base;
10 rwlock_t lock;
11 struct list_head list;
12 };
13
14 static inline struct nouveau_namedb *
15 nv_namedb(void *obj)
16 {
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));
20 #endif
21 return obj;
22 }
23
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)
33
34 int nouveau_namedb_create_(struct nouveau_object *, struct nouveau_object *,
35 struct nouveau_oclass *, u32 pclass,
36 struct nouveau_oclass *, u64 engcls,
37 int size, void **);
38
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
45
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 *);
49
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 *);
55
56 #endif