1 #ifndef __NVKM_CLIENT_H__
2 #define __NVKM_CLIENT_H__
3 #include <core/namedb.h>
6 struct nvkm_namedb namedb;
7 struct nvkm_handle *root;
15 int (*ntfy)(const void *, u32, const void *, u32);
16 struct nvkm_client_notify *notify[16];
18 struct rb_root objroot;
21 bool nvkm_client_insert(struct nvkm_client *, struct nvkm_handle *);
22 void nvkm_client_remove(struct nvkm_client *, struct nvkm_handle *);
23 struct nvkm_handle *nvkm_client_search(struct nvkm_client *, u64 handle);
25 static inline struct nvkm_client *
26 nvkm_client(void *obj)
28 struct nvkm_object *client = nv_object(obj);
29 while (client && client->parent)
30 client = client->parent;
31 return (void *)client;
34 int nvkm_client_new(const char *name, u64 device, const char *cfg,
35 const char *dbg, struct nvkm_client **);
36 void nvkm_client_del(struct nvkm_client **);
37 int nvkm_client_init(struct nvkm_client *);
38 int nvkm_client_fini(struct nvkm_client *, bool suspend);
39 const char *nvkm_client_name(void *obj);
41 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
42 void *data, u32 size);
43 int nvkm_client_notify_del(struct nvkm_client *, int index);
44 int nvkm_client_notify_get(struct nvkm_client *, int index);
45 int nvkm_client_notify_put(struct nvkm_client *, int index);
47 /* logging for client-facing objects */
48 #define nvif_printk(o,l,p,f,a...) do { \
49 struct nvkm_object *_object = (o); \
50 struct nvkm_client *_client = nvkm_client(_object); \
51 if (_client->debug >= NV_DBG_##l) \
52 printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \
54 #define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a)
55 #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
56 #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
57 #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)