xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_GSP_PRIV_H__
3 #define __NVKM_GSP_PRIV_H__
4 #include <subdev/gsp.h>
5 enum nvkm_acr_lsf_id;
6 
7 int nvkm_gsp_fwsec_frts(struct nvkm_gsp *);
8 int nvkm_gsp_fwsec_sb(struct nvkm_gsp *);
9 
10 struct nvkm_gsp_fwif {
11 	int version;
12 	int (*load)(struct nvkm_gsp *, int ver, const struct nvkm_gsp_fwif *);
13 	const struct nvkm_gsp_func *func;
14 	const char *ver;
15 	bool enable;
16 };
17 
18 int gv100_gsp_nofw(struct nvkm_gsp *, int, const struct nvkm_gsp_fwif *);
19 int  r535_gsp_load(struct nvkm_gsp *, int, const struct nvkm_gsp_fwif *);
20 
21 struct nvkm_gsp_func {
22 	const struct nvkm_falcon_func *flcn;
23 	const struct nvkm_falcon_fw_func *fwsec;
24 
25 	char *sig_section;
26 
27 	struct {
28 		u32 os_carveout_size;
29 		u32 base_size;
30 		u64 min_size;
31 	} wpr_heap;
32 
33 	struct {
34 		int (*ctor)(struct nvkm_gsp *, const char *name, const struct firmware *,
35 			    struct nvkm_falcon *, struct nvkm_falcon_fw *);
36 	} booter;
37 
38 	void (*dtor)(struct nvkm_gsp *);
39 	int (*oneinit)(struct nvkm_gsp *);
40 	int (*init)(struct nvkm_gsp *);
41 	int (*fini)(struct nvkm_gsp *, bool suspend);
42 	int (*reset)(struct nvkm_gsp *);
43 
44 	const struct nvkm_gsp_rm *rm;
45 };
46 
47 extern const struct nvkm_falcon_func tu102_gsp_flcn;
48 extern const struct nvkm_falcon_fw_func tu102_gsp_fwsec;
49 int tu102_gsp_booter_ctor(struct nvkm_gsp *, const char *, const struct firmware *,
50 			  struct nvkm_falcon *, struct nvkm_falcon_fw *);
51 int tu102_gsp_oneinit(struct nvkm_gsp *);
52 int tu102_gsp_reset(struct nvkm_gsp *);
53 
54 extern const struct nvkm_falcon_func ga102_gsp_flcn;
55 extern const struct nvkm_falcon_fw_func ga102_gsp_fwsec;
56 int ga102_gsp_booter_ctor(struct nvkm_gsp *, const char *, const struct firmware *,
57 			  struct nvkm_falcon *, struct nvkm_falcon_fw *);
58 int ga102_gsp_reset(struct nvkm_gsp *);
59 
60 void r535_gsp_dtor(struct nvkm_gsp *);
61 int r535_gsp_oneinit(struct nvkm_gsp *);
62 int r535_gsp_init(struct nvkm_gsp *);
63 int r535_gsp_fini(struct nvkm_gsp *, bool suspend);
64 extern const struct nvkm_gsp_rm r535_gsp_rm;
65 
66 int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
67 		  struct nvkm_gsp **);
68 
69 extern const struct nvkm_gsp_func gv100_gsp;
70 #endif
71