]>
Commit | Line | Data |
---|---|---|
5025407b BS |
1 | #ifndef __NVKM_NAMEDB_H__ |
2 | #define __NVKM_NAMEDB_H__ | |
9274f4a9 | 3 | #include <core/parent.h> |
5025407b | 4 | struct nvkm_handle; |
9274f4a9 | 5 | |
5025407b BS |
6 | struct nvkm_namedb { |
7 | struct nvkm_parent parent; | |
9274f4a9 BS |
8 | rwlock_t lock; |
9 | struct list_head list; | |
10 | }; | |
11 | ||
5025407b | 12 | static inline struct nvkm_namedb * |
9274f4a9 BS |
13 | nv_namedb(void *obj) |
14 | { | |
15 | #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA | |
53003941 | 16 | BUG_ON(!nv_iclass(obj, NV_NAMEDB_CLASS)); |
9274f4a9 BS |
17 | #endif |
18 | return obj; | |
19 | } | |
20 | ||
5025407b BS |
21 | #define nvkm_namedb_create(p,e,c,v,s,m,d) \ |
22 | nvkm_namedb_create_((p), (e), (c), (v), (s), (m), \ | |
9274f4a9 | 23 | sizeof(**d), (void **)d) |
5025407b BS |
24 | #define nvkm_namedb_init(p) \ |
25 | nvkm_parent_init(&(p)->parent) | |
26 | #define nvkm_namedb_fini(p,s) \ | |
27 | nvkm_parent_fini(&(p)->parent, (s)) | |
28 | #define nvkm_namedb_destroy(p) \ | |
29 | nvkm_parent_destroy(&(p)->parent) | |
30 | ||
31 | int nvkm_namedb_create_(struct nvkm_object *, struct nvkm_object *, | |
32 | struct nvkm_oclass *, u32 pclass, | |
33 | struct nvkm_oclass *, u64 engcls, | |
9274f4a9 BS |
34 | int size, void **); |
35 | ||
5025407b BS |
36 | int _nvkm_namedb_ctor(struct nvkm_object *, struct nvkm_object *, |
37 | struct nvkm_oclass *, void *, u32, | |
38 | struct nvkm_object **); | |
39 | #define _nvkm_namedb_dtor _nvkm_parent_dtor | |
40 | #define _nvkm_namedb_init _nvkm_parent_init | |
41 | #define _nvkm_namedb_fini _nvkm_parent_fini | |
42 | ||
43 | int nvkm_namedb_insert(struct nvkm_namedb *, u32 name, struct nvkm_object *, | |
44 | struct nvkm_handle *); | |
45 | void nvkm_namedb_remove(struct nvkm_handle *); | |
46 | ||
47 | struct nvkm_handle *nvkm_namedb_get(struct nvkm_namedb *, u32); | |
f58ddf95 | 48 | struct nvkm_handle *nvkm_namedb_get_class(struct nvkm_namedb *, s32); |
5025407b BS |
49 | struct nvkm_handle *nvkm_namedb_get_vinst(struct nvkm_namedb *, u64); |
50 | struct nvkm_handle *nvkm_namedb_get_cinst(struct nvkm_namedb *, u32); | |
51 | void nvkm_namedb_put(struct nvkm_handle *); | |
9274f4a9 | 52 | #endif |