1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_PMU_PRIV_H__
3 #define __NVKM_PMU_PRIV_H__
4 #define nvkm_pmu(p) container_of((p), struct nvkm_pmu, subdev)
5 #include <subdev/pmu.h>
6 #include <subdev/pmu/fuc/os.h>
7 
8 struct nvkm_pmu_func {
9 	const struct nvkm_falcon_func *flcn;
10 
11 	struct {
12 		u32 *data;
13 		u32  size;
14 	} code;
15 
16 	struct {
17 		u32 *data;
18 		u32  size;
19 	} data;
20 
21 	bool (*enabled)(struct nvkm_pmu *);
22 	void (*reset)(struct nvkm_pmu *);
23 	int (*init)(struct nvkm_pmu *);
24 	void (*fini)(struct nvkm_pmu *);
25 	void (*intr)(struct nvkm_pmu *);
26 	int (*send)(struct nvkm_pmu *, u32 reply[2], u32 process,
27 		    u32 message, u32 data0, u32 data1);
28 	void (*recv)(struct nvkm_pmu *);
29 	void (*pgob)(struct nvkm_pmu *, bool);
30 };
31 
32 extern const struct nvkm_falcon_func gt215_pmu_flcn;
33 int gt215_pmu_init(struct nvkm_pmu *);
34 void gt215_pmu_fini(struct nvkm_pmu *);
35 void gt215_pmu_intr(struct nvkm_pmu *);
36 void gt215_pmu_recv(struct nvkm_pmu *);
37 int gt215_pmu_send(struct nvkm_pmu *, u32[2], u32, u32, u32, u32);
38 
39 bool gf100_pmu_enabled(struct nvkm_pmu *);
40 void gf100_pmu_reset(struct nvkm_pmu *);
41 
42 void gk110_pmu_pgob(struct nvkm_pmu *, bool);
43 
44 void gm20b_pmu_recv(struct nvkm_pmu *);
45 
46 struct nvkm_pmu_fwif {
47 	int version;
48 	int (*load)(struct nvkm_pmu *, int ver, const struct nvkm_pmu_fwif *);
49 	const struct nvkm_pmu_func *func;
50 	const struct nvkm_acr_lsf_func *acr;
51 };
52 
53 int gf100_pmu_nofw(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
54 int gm20b_pmu_load(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
55 
56 int nvkm_pmu_ctor(const struct nvkm_pmu_fwif *, struct nvkm_device *,
57 		  int index, struct nvkm_pmu *);
58 int nvkm_pmu_new_(const struct nvkm_pmu_fwif *, struct nvkm_device *,
59 		  int index, struct nvkm_pmu **);
60 #endif
61