]>
Commit | Line | Data |
---|---|---|
5025407b BS |
1 | #ifndef __NVKM_CLIENT_H__ |
2 | #define __NVKM_CLIENT_H__ | |
24bd0930 | 3 | #include <core/object.h> |
9274f4a9 | 4 | |
5025407b | 5 | struct nvkm_client { |
24bd0930 | 6 | struct nvkm_object object; |
a2896ced | 7 | char name[32]; |
24bd0930 | 8 | u64 device; |
9274f4a9 | 9 | u32 debug; |
24bd0930 BS |
10 | |
11 | struct nvkm_client_notify *notify[16]; | |
12 | struct rb_root objroot; | |
0710cc31 | 13 | struct rb_root dmaroot; |
24bd0930 BS |
14 | |
15 | struct nvkm_handle *root; | |
16 | ||
8ec2a6ec BS |
17 | bool super; |
18 | void *data; | |
8ec2a6ec | 19 | int (*ntfy)(const void *, u32, const void *, u32); |
bf81df9b | 20 | |
24bd0930 | 21 | struct nvkm_vm *vm; |
9274f4a9 BS |
22 | }; |
23 | ||
bf81df9b BS |
24 | bool nvkm_client_insert(struct nvkm_client *, struct nvkm_handle *); |
25 | void nvkm_client_remove(struct nvkm_client *, struct nvkm_handle *); | |
26 | struct nvkm_handle *nvkm_client_search(struct nvkm_client *, u64 handle); | |
27 | ||
76ecea5b BS |
28 | int nvkm_client_new(const char *name, u64 device, const char *cfg, |
29 | const char *dbg, struct nvkm_client **); | |
30 | void nvkm_client_del(struct nvkm_client **); | |
5025407b BS |
31 | int nvkm_client_init(struct nvkm_client *); |
32 | int nvkm_client_fini(struct nvkm_client *, bool suspend); | |
33 | const char *nvkm_client_name(void *obj); | |
9274f4a9 | 34 | |
24bd0930 BS |
35 | static inline struct nvkm_client * |
36 | nvkm_client(struct nvkm_object *object) | |
37 | { | |
38 | while (object && object->parent) | |
39 | object = object->parent; | |
40 | return container_of(object, struct nvkm_client, object); | |
41 | } | |
42 | ||
5025407b | 43 | int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *, |
8ec2a6ec | 44 | void *data, u32 size); |
5025407b BS |
45 | int nvkm_client_notify_del(struct nvkm_client *, int index); |
46 | int nvkm_client_notify_get(struct nvkm_client *, int index); | |
47 | int nvkm_client_notify_put(struct nvkm_client *, int index); | |
6594363b BS |
48 | |
49 | /* logging for client-facing objects */ | |
50 | #define nvif_printk(o,l,p,f,a...) do { \ | |
51 | struct nvkm_object *_object = (o); \ | |
52 | struct nvkm_client *_client = nvkm_client(_object); \ | |
53 | if (_client->debug >= NV_DBG_##l) \ | |
54 | printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \ | |
55 | } while(0) | |
56 | #define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a) | |
57 | #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a) | |
58 | #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a) | |
59 | #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a) | |
9274f4a9 | 60 | #endif |