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