xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h (revision 6fdcba32711044c35c0e1b094cbd8f3f0b4472c9)
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 *,
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 	void (*intr_hack)(struct nvkm_mc *, bool *handled);
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 *, 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