]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
5025407b BS |
2 | #ifndef __NVKM_CLIENT_H__ |
3 | #define __NVKM_CLIENT_H__ | |
03295eab | 4 | #define nvkm_client(p) container_of((p), struct nvkm_client, object) |
24bd0930 | 5 | #include <core/object.h> |
9274f4a9 | 6 | |
5025407b | 7 | struct nvkm_client { |
24bd0930 | 8 | struct nvkm_object object; |
a2896ced | 9 | char name[32]; |
24bd0930 | 10 | u64 device; |
9274f4a9 | 11 | u32 debug; |
24bd0930 | 12 | |
86d7442b | 13 | struct nvkm_client_notify *notify[32]; |
24bd0930 BS |
14 | struct rb_root objroot; |
15 | ||
8ec2a6ec BS |
16 | bool super; |
17 | void *data; | |
8ec2a6ec | 18 | int (*ntfy)(const void *, u32, const void *, u32); |
bf81df9b | 19 | |
c83c4097 BS |
20 | struct list_head umem; |
21 | spinlock_t lock; | |
9274f4a9 BS |
22 | }; |
23 | ||
76ecea5b | 24 | int nvkm_client_new(const char *name, u64 device, const char *cfg, |
7c413feb BS |
25 | const char *dbg, |
26 | int (*)(const void *, u32, const void *, u32), | |
27 | struct nvkm_client **); | |
04b88677 | 28 | struct nvkm_client *nvkm_client_search(struct nvkm_client *, u64 handle); |
9274f4a9 | 29 | |
5025407b | 30 | int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *, |
8ec2a6ec | 31 | void *data, u32 size); |
5025407b BS |
32 | int nvkm_client_notify_del(struct nvkm_client *, int index); |
33 | int nvkm_client_notify_get(struct nvkm_client *, int index); | |
34 | int nvkm_client_notify_put(struct nvkm_client *, int index); | |
6594363b BS |
35 | |
36 | /* logging for client-facing objects */ | |
37 | #define nvif_printk(o,l,p,f,a...) do { \ | |
c1fcb148 AC |
38 | const struct nvkm_object *_object = (o); \ |
39 | const struct nvkm_client *_client = _object->client; \ | |
6594363b | 40 | if (_client->debug >= NV_DBG_##l) \ |
fbd58ebd BS |
41 | printk(KERN_##p "nouveau: %s:%08x:%08x: "f, _client->name, \ |
42 | _object->handle, _object->oclass, ##a); \ | |
6594363b | 43 | } while(0) |
fbd58ebd | 44 | #define nvif_fatal(o,f,a...) nvif_printk((o), FATAL, CRIT, f, ##a) |
6594363b BS |
45 | #define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a) |
46 | #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a) | |
47 | #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a) | |
fbd58ebd | 48 | #define nvif_info(o,f,a...) nvif_printk((o), INFO, INFO, f, ##a) |
6594363b | 49 | #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a) |
9274f4a9 | 50 | #endif |