1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NVKM_MC_PRIV_H__
3 #define __NVKM_MC_PRIV_H__
4 #define nvkm_mc(p) container_of((p), struct nvkm_mc, subdev)
5 #include <subdev/mc.h>
6 
7 void nvkm_mc_ctor(const struct nvkm_mc_func *, struct nvkm_device *,
8 		  int index, struct nvkm_mc *);
9 int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *,
10 		 int index, struct nvkm_mc **);
11 
12 struct nvkm_mc_map {
13 	u32 stat;
14 	u32 unit;
15 	bool noauto;
16 };
17 
18 struct nvkm_mc_func {
19 	void (*init)(struct nvkm_mc *);
20 	const struct nvkm_mc_map *intr;
21 	/* disable reporting of interrupts to host */
22 	void (*intr_unarm)(struct nvkm_mc *);
23 	/* enable reporting of interrupts to host */
24 	void (*intr_rearm)(struct nvkm_mc *);
25 	/* (un)mask delivery of specific interrupts */
26 	void (*intr_mask)(struct nvkm_mc *, u32 mask, u32 stat);
27 	/* retrieve pending interrupt mask (NV_PMC_INTR) */
28 	u32 (*intr_stat)(struct nvkm_mc *);
29 	const struct nvkm_mc_map *reset;
30 	void (*unk260)(struct nvkm_mc *, u32);
31 };
32 
33 void nv04_mc_init(struct nvkm_mc *);
34 void nv04_mc_intr_unarm(struct nvkm_mc *);
35 void nv04_mc_intr_rearm(struct nvkm_mc *);
36 u32 nv04_mc_intr_stat(struct nvkm_mc *);
37 extern const struct nvkm_mc_map nv04_mc_reset[];
38 
39 extern const struct nvkm_mc_map nv17_mc_intr[];
40 extern const struct nvkm_mc_map nv17_mc_reset[];
41 
42 void nv44_mc_init(struct nvkm_mc *);
43 
44 void nv50_mc_init(struct nvkm_mc *);
45 void gk104_mc_init(struct nvkm_mc *);
46 
47 void gf100_mc_intr_unarm(struct nvkm_mc *);
48 void gf100_mc_intr_rearm(struct nvkm_mc *);
49 void gf100_mc_intr_mask(struct nvkm_mc *, u32, u32);
50 u32 gf100_mc_intr_stat(struct nvkm_mc *);
51 void gf100_mc_unk260(struct nvkm_mc *, u32);
52 void gp100_mc_intr_unarm(struct nvkm_mc *);
53 void gp100_mc_intr_rearm(struct nvkm_mc *);
54 void gp100_mc_intr_mask(struct nvkm_mc *, u32, u32);
55 int gp100_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, int,
56 		  struct nvkm_mc **);
57 
58 extern const struct nvkm_mc_map gk104_mc_intr[];
59 extern const struct nvkm_mc_map gk104_mc_reset[];
60 
61 extern const struct nvkm_mc_map gp100_mc_intr[];
62 #endif
63