xref: /linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 #ifndef __NVKM_PMU_H__
2 #define __NVKM_PMU_H__
3 #include <core/subdev.h>
4 #include <engine/falcon.h>
5 
6 struct nvkm_pmu {
7 	const struct nvkm_pmu_func *func;
8 	struct nvkm_subdev subdev;
9 	struct nvkm_falcon *falcon;
10 	struct nvkm_msgqueue *queue;
11 
12 	struct {
13 		u32 base;
14 		u32 size;
15 	} send;
16 
17 	struct {
18 		u32 base;
19 		u32 size;
20 
21 		struct work_struct work;
22 		wait_queue_head_t wait;
23 		u32 process;
24 		u32 message;
25 		u32 data[2];
26 	} recv;
27 };
28 
29 int nvkm_pmu_send(struct nvkm_pmu *, u32 reply[2], u32 process,
30 		  u32 message, u32 data0, u32 data1);
31 void nvkm_pmu_pgob(struct nvkm_pmu *, bool enable);
32 
33 int gt215_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
34 int gf100_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
35 int gf119_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
36 int gk104_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
37 int gk110_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
38 int gk208_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
39 int gk20a_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
40 int gm107_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
41 int gm20b_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
42 int gp100_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
43 int gp102_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
44 
45 /* interface to MEMX process running on PMU */
46 struct nvkm_memx;
47 int  nvkm_memx_init(struct nvkm_pmu *, struct nvkm_memx **);
48 int  nvkm_memx_fini(struct nvkm_memx **, bool exec);
49 void nvkm_memx_wr32(struct nvkm_memx *, u32 addr, u32 data);
50 void nvkm_memx_wait(struct nvkm_memx *, u32 addr, u32 mask, u32 data, u32 nsec);
51 void nvkm_memx_nsec(struct nvkm_memx *, u32 nsec);
52 void nvkm_memx_wait_vblank(struct nvkm_memx *);
53 void nvkm_memx_train(struct nvkm_memx *);
54 int  nvkm_memx_train_result(struct nvkm_pmu *, u32 *, int);
55 void nvkm_memx_block(struct nvkm_memx *);
56 void nvkm_memx_unblock(struct nvkm_memx *);
57 #endif
58