1 #ifndef __NVKM_SUBDEV_H__
2 #define __NVKM_SUBDEV_H__
3 #include <core/object.h>
5 #define NV_SUBDEV_(sub,var) (((var) << 8) | (sub))
6 #define NV_SUBDEV(name,var) NV_SUBDEV_(NVDEV_SUBDEV_##name, (var))
9 struct nvkm_object object
;
10 const struct nvkm_subdev_func
*func
;
11 struct nvkm_device
*device
;
19 void (*intr
)(struct nvkm_subdev
*);
23 struct nvkm_subdev_func
{
24 void *(*dtor
)(struct nvkm_subdev
*);
25 int (*preinit
)(struct nvkm_subdev
*);
26 int (*oneinit
)(struct nvkm_subdev
*);
27 int (*init
)(struct nvkm_subdev
*);
28 int (*fini
)(struct nvkm_subdev
*, bool suspend
);
29 void (*intr
)(struct nvkm_subdev
*);
32 extern const char *nvkm_subdev_name
[64];
33 void nvkm_subdev_ctor(const struct nvkm_subdev_func
*, struct nvkm_device
*,
34 int index
, u32 pmc_enable
, struct nvkm_subdev
*);
35 void nvkm_subdev_del(struct nvkm_subdev
**);
36 int nvkm_subdev_preinit(struct nvkm_subdev
*);
37 int nvkm_subdev_init(struct nvkm_subdev
*);
38 int nvkm_subdev_fini(struct nvkm_subdev
*, bool suspend
);
39 void nvkm_subdev_intr(struct nvkm_subdev
*);
41 static inline struct nvkm_subdev
*
44 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
45 BUG_ON(!nv_iclass(obj
, NV_SUBDEV_CLASS
));
51 nv_subidx(struct nvkm_subdev
*subdev
)
53 return nv_hclass(subdev
) & 0xff;
56 struct nvkm_subdev
*nvkm_subdev(void *obj
, int idx
);
58 #define nvkm_subdev_create(p,e,o,v,s,f,d) \
59 nvkm_subdev_create_((p), (e), (o), (v), (s), (f), \
60 sizeof(**d),(void **)d)
62 int nvkm_subdev_create_(struct nvkm_object
*, struct nvkm_object
*,
63 struct nvkm_oclass
*, u32 pclass
,
64 const char *sname
, const char *fname
,
66 void nvkm_subdev_destroy(struct nvkm_subdev
*);
67 int nvkm_subdev_init_old(struct nvkm_subdev
*);
68 int nvkm_subdev_fini_old(struct nvkm_subdev
*, bool suspend
);
69 void nvkm_subdev_reset(struct nvkm_object
*);
71 void _nvkm_subdev_dtor(struct nvkm_object
*);
72 int _nvkm_subdev_init(struct nvkm_object
*);
73 int _nvkm_subdev_fini(struct nvkm_object
*, bool suspend
);
76 #define nvkm_printk_(s,l,p,f,a...) do { \
77 struct nvkm_subdev *_subdev = (s); \
78 if (_subdev->debug >= (l)) { \
79 dev_##p(_subdev->device->dev, "%s: "f, \
80 nvkm_subdev_name[_subdev->index], ##a); \
83 #define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a)
84 #define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL, crit, f, ##a)
85 #define nvkm_error(s,f,a...) nvkm_printk((s), ERROR, err, f, ##a)
86 #define nvkm_warn(s,f,a...) nvkm_printk((s), WARN, notice, f, ##a)
87 #define nvkm_info(s,f,a...) nvkm_printk((s), INFO, info, f, ##a)
88 #define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a)
89 #define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a)
90 #define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a)
92 #include <core/engine.h>
This page took 0.042841 seconds and 5 git commands to generate.