These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / include / nvkm / core / subdev.h
1 #ifndef __NVKM_SUBDEV_H__
2 #define __NVKM_SUBDEV_H__
3 #include <core/device.h>
4
5 struct nvkm_subdev {
6         const struct nvkm_subdev_func *func;
7         struct nvkm_device *device;
8         enum nvkm_devidx index;
9         u32 pmc_enable;
10         struct mutex mutex;
11         u32 debug;
12
13         bool oneinit;
14 };
15
16 struct nvkm_subdev_func {
17         void *(*dtor)(struct nvkm_subdev *);
18         int (*preinit)(struct nvkm_subdev *);
19         int (*oneinit)(struct nvkm_subdev *);
20         int (*init)(struct nvkm_subdev *);
21         int (*fini)(struct nvkm_subdev *, bool suspend);
22         void (*intr)(struct nvkm_subdev *);
23 };
24
25 extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR];
26 void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *,
27                       int index, u32 pmc_enable, struct nvkm_subdev *);
28 void nvkm_subdev_del(struct nvkm_subdev **);
29 int  nvkm_subdev_preinit(struct nvkm_subdev *);
30 int  nvkm_subdev_init(struct nvkm_subdev *);
31 int  nvkm_subdev_fini(struct nvkm_subdev *, bool suspend);
32 void nvkm_subdev_intr(struct nvkm_subdev *);
33
34 /* subdev logging */
35 #define nvkm_printk_(s,l,p,f,a...) do {                                        \
36         struct nvkm_subdev *_subdev = (s);                                     \
37         if (_subdev->debug >= (l)) {                                           \
38                 dev_##p(_subdev->device->dev, "%s: "f,                         \
39                         nvkm_subdev_name[_subdev->index], ##a);                \
40         }                                                                      \
41 } while(0)
42 #define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a)
43 #define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL,   crit, f, ##a)
44 #define nvkm_error(s,f,a...) nvkm_printk((s), ERROR,    err, f, ##a)
45 #define nvkm_warn(s,f,a...)  nvkm_printk((s),  WARN, notice, f, ##a)
46 #define nvkm_info(s,f,a...)  nvkm_printk((s),  INFO,   info, f, ##a)
47 #define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG,   info, f, ##a)
48 #define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE,   info, f, ##a)
49 #define nvkm_spam(s,f,a...)  nvkm_printk((s),  SPAM,    dbg, f, ##a)
50 #endif