1 #ifndef __NOUVEAU_PMU_H__
2 #define __NOUVEAU_PMU_H__
3 
4 #include <core/subdev.h>
5 #include <core/device.h>
6 
7 struct nouveau_pmu {
8 	struct nouveau_subdev base;
9 
10 	struct {
11 		u32 base;
12 		u32 size;
13 	} send;
14 
15 	struct {
16 		u32 base;
17 		u32 size;
18 
19 		struct work_struct work;
20 		wait_queue_head_t wait;
21 		u32 process;
22 		u32 message;
23 		u32 data[2];
24 	} recv;
25 
26 	int  (*message)(struct nouveau_pmu *, u32[2], u32, u32, u32, u32);
27 	void (*pgob)(struct nouveau_pmu *, bool);
28 };
29 
30 static inline struct nouveau_pmu *
31 nouveau_pmu(void *obj)
32 {
33 	return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_PMU);
34 }
35 
36 extern struct nouveau_oclass *nva3_pmu_oclass;
37 extern struct nouveau_oclass *nvc0_pmu_oclass;
38 extern struct nouveau_oclass *nvd0_pmu_oclass;
39 extern struct nouveau_oclass *gk104_pmu_oclass;
40 extern struct nouveau_oclass *nv108_pmu_oclass;
41 extern struct nouveau_oclass *gk20a_pmu_oclass;
42 
43 /* interface to MEMX process running on PMU */
44 struct nouveau_memx;
45 int  nouveau_memx_init(struct nouveau_pmu *, struct nouveau_memx **);
46 int  nouveau_memx_fini(struct nouveau_memx **, bool exec);
47 void nouveau_memx_wr32(struct nouveau_memx *, u32 addr, u32 data);
48 void nouveau_memx_wait(struct nouveau_memx *,
49 		       u32 addr, u32 mask, u32 data, u32 nsec);
50 void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec);
51 void nouveau_memx_wait_vblank(struct nouveau_memx *);
52 void nouveau_memx_train(struct nouveau_memx *);
53 int  nouveau_memx_train_result(struct nouveau_pmu *, u32 *, int);
54 void nouveau_memx_block(struct nouveau_memx *);
55 void nouveau_memx_unblock(struct nouveau_memx *);
56 
57 #endif
58