Add the rt linux 4.1.3-rt3 as base
[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/namedb.h>
4
5 struct nvkm_client {
6         struct nvkm_namedb namedb;
7         struct nvkm_handle *root;
8         struct nvkm_object *device;
9         char name[32];
10         u32 debug;
11         struct nvkm_vm *vm;
12         bool super;
13         void *data;
14
15         int (*ntfy)(const void *, u32, const void *, u32);
16         struct nvkm_client_notify *notify[16];
17 };
18
19 static inline struct nvkm_client *
20 nv_client(void *obj)
21 {
22 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
23         if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS)))
24                 nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj));
25 #endif
26         return obj;
27 }
28
29 static inline struct nvkm_client *
30 nvkm_client(void *obj)
31 {
32         struct nvkm_object *client = nv_object(obj);
33         while (client && !(nv_iclass(client, NV_CLIENT_CLASS)))
34                 client = client->parent;
35         return (void *)client;
36 }
37
38 #define nvkm_client_create(n,c,oc,od,d)                                     \
39         nvkm_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
40
41 int  nvkm_client_create_(const char *name, u64 device, const char *cfg,
42                             const char *dbg, int, void **);
43 #define nvkm_client_destroy(p)                                              \
44         nvkm_namedb_destroy(&(p)->base)
45
46 int  nvkm_client_init(struct nvkm_client *);
47 int  nvkm_client_fini(struct nvkm_client *, bool suspend);
48 const char *nvkm_client_name(void *obj);
49
50 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
51                            void *data, u32 size);
52 int nvkm_client_notify_del(struct nvkm_client *, int index);
53 int nvkm_client_notify_get(struct nvkm_client *, int index);
54 int nvkm_client_notify_put(struct nvkm_client *, int index);
55 #endif