These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / include / nvkm / core / client.h
1 #ifndef __NVKM_CLIENT_H__
2 #define __NVKM_CLIENT_H__
3 #include <core/object.h>
4
5 struct nvkm_client {
6         struct nvkm_object object;
7         char name[32];
8         u64 device;
9         u32 debug;
10
11         struct nvkm_client_notify *notify[16];
12         struct rb_root objroot;
13         struct rb_root dmaroot;
14
15         bool super;
16         void *data;
17         int (*ntfy)(const void *, u32, const void *, u32);
18
19         struct nvkm_vm *vm;
20 };
21
22 bool nvkm_client_insert(struct nvkm_client *, struct nvkm_object *);
23 void nvkm_client_remove(struct nvkm_client *, struct nvkm_object *);
24 struct nvkm_object *nvkm_client_search(struct nvkm_client *, u64 object);
25
26 int  nvkm_client_new(const char *name, u64 device, const char *cfg,
27                      const char *dbg, struct nvkm_client **);
28 void nvkm_client_del(struct nvkm_client **);
29 int  nvkm_client_init(struct nvkm_client *);
30 int  nvkm_client_fini(struct nvkm_client *, bool suspend);
31
32 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
33                            void *data, u32 size);
34 int nvkm_client_notify_del(struct nvkm_client *, int index);
35 int nvkm_client_notify_get(struct nvkm_client *, int index);
36 int nvkm_client_notify_put(struct nvkm_client *, int index);
37
38 /* logging for client-facing objects */
39 #define nvif_printk(o,l,p,f,a...) do {                                         \
40         struct nvkm_object *_object = (o);                                     \
41         struct nvkm_client *_client = _object->client;                         \
42         if (_client->debug >= NV_DBG_##l)                                      \
43                 printk(KERN_##p "nouveau: %s:%08x:%08x: "f, _client->name,     \
44                        _object->handle, _object->oclass, ##a);                 \
45 } while(0)
46 #define nvif_fatal(o,f,a...) nvif_printk((o), FATAL, CRIT, f, ##a)
47 #define nvif_error(o,f,a...) nvif_printk((o), ERROR,  ERR, f, ##a)
48 #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
49 #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
50 #define nvif_info(o,f,a...)  nvif_printk((o),  INFO, INFO, f, ##a)
51 #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
52 #endif