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