xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/acr/priv.h (revision 8e07e0e3964ca4e23ce7b68e2096fe660a888942)
1 #ifndef __NVKM_ACR_PRIV_H__
2 #define __NVKM_ACR_PRIV_H__
3 #include <subdev/acr.h>
4 struct lsb_header_tail;
5 
6 struct nvkm_acr_fwif {
7 	int version;
8 	int (*load)(struct nvkm_acr *, int version,
9 		    const struct nvkm_acr_fwif *);
10 	const struct nvkm_acr_func *func;
11 };
12 
13 int gm200_acr_nofw(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
14 int gm20b_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
15 int gp102_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
16 
17 struct nvkm_acr_lsf;
18 struct nvkm_acr_func {
19 	const struct nvkm_acr_hsf_fwif *load;
20 	const struct nvkm_acr_hsf_fwif *ahesasc;
21 	const struct nvkm_acr_hsf_fwif *asb;
22 	const struct nvkm_acr_hsf_fwif *unload;
23 	int (*wpr_parse)(struct nvkm_acr *);
24 	u32 (*wpr_layout)(struct nvkm_acr *);
25 	int (*wpr_alloc)(struct nvkm_acr *, u32 wpr_size);
26 	int (*wpr_build)(struct nvkm_acr *, struct nvkm_acr_lsf *rtos);
27 	int (*wpr_patch)(struct nvkm_acr *, s64 adjust);
28 	void (*wpr_check)(struct nvkm_acr *, u64 *start, u64 *limit);
29 	int (*init)(struct nvkm_acr *);
30 	void (*fini)(struct nvkm_acr *);
31 	u64 bootstrap_falcons;
32 };
33 
34 extern const struct nvkm_acr_func gm200_acr;
35 int gm200_acr_wpr_parse(struct nvkm_acr *);
36 u32 gm200_acr_wpr_layout(struct nvkm_acr *);
37 int gm200_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
38 int gm200_acr_wpr_patch(struct nvkm_acr *, s64);
39 void gm200_acr_wpr_check(struct nvkm_acr *, u64 *, u64 *);
40 void gm200_acr_wpr_build_lsb_tail(struct nvkm_acr_lsfw *,
41 				  struct lsb_header_tail *);
42 int gm200_acr_init(struct nvkm_acr *);
43 
44 int gm20b_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
45 
46 int gp102_acr_wpr_parse(struct nvkm_acr *);
47 u32 gp102_acr_wpr_layout(struct nvkm_acr *);
48 int gp102_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
49 int gp102_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
50 int gp102_acr_wpr_build_lsb(struct nvkm_acr *, struct nvkm_acr_lsfw *);
51 int gp102_acr_wpr_patch(struct nvkm_acr *, s64);
52 
53 int tu102_acr_init(struct nvkm_acr *);
54 
55 void ga100_acr_wpr_check(struct nvkm_acr *, u64 *, u64 *);
56 
57 struct nvkm_acr_hsfw {
58 	struct nvkm_falcon_fw fw;
59 
60 	enum nvkm_acr_hsf_id {
61 		NVKM_ACR_HSF_PMU,
62 		NVKM_ACR_HSF_SEC2,
63 		NVKM_ACR_HSF_GSP,
64 	} falcon_id;
65 	u32 boot_mbox0;
66 	u32 intr_clear;
67 
68 	struct list_head head;
69 };
70 
71 int nvkm_acr_hsfw_boot(struct nvkm_acr *, const char *name);
72 
73 struct nvkm_acr_hsf_fwif {
74 	int version;
75 	int (*load)(struct nvkm_acr *, const char *bl, const char *fw,
76 		    const char *name, int version,
77 		    const struct nvkm_acr_hsf_fwif *);
78 	const struct nvkm_falcon_fw_func *func;
79 
80 	enum nvkm_acr_hsf_id falcon_id;
81 	u32 boot_mbox0;
82 	u32 intr_clear;
83 };
84 
85 
86 int gm200_acr_hsfw_ctor(struct nvkm_acr *, const char *, const char *, const char *, int,
87 			const struct nvkm_acr_hsf_fwif *);
88 int gm200_acr_hsfw_load_bld(struct nvkm_falcon_fw *);
89 extern const struct nvkm_falcon_fw_func gm200_acr_unload_0;
90 
91 extern const struct nvkm_falcon_fw_func gm20b_acr_load_0;
92 
93 int gp102_acr_load_setup(struct nvkm_falcon_fw *);
94 
95 extern const struct nvkm_falcon_fw_func gp108_acr_load_0;
96 
97 extern const struct nvkm_falcon_fw_func gp108_acr_hsfw_0;
98 int gp108_acr_hsfw_load_bld(struct nvkm_falcon_fw *);
99 
100 int ga100_acr_hsfw_ctor(struct nvkm_acr *, const char *, const char *, const char *, int,
101 			const struct nvkm_acr_hsf_fwif *);
102 
103 int nvkm_acr_new_(const struct nvkm_acr_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
104 		  int inst, struct nvkm_acr **);
105 
106 struct nvkm_acr_lsf {
107 	const struct nvkm_acr_lsf_func *func;
108 	struct nvkm_falcon *falcon;
109 	enum nvkm_acr_lsf_id id;
110 	struct list_head head;
111 };
112 
113 struct nvkm_acr_lsfw *nvkm_acr_lsfw_add(const struct nvkm_acr_lsf_func *,
114 					struct nvkm_acr *, struct nvkm_falcon *,
115 					enum nvkm_acr_lsf_id);
116 void nvkm_acr_lsfw_del(struct nvkm_acr_lsfw *);
117 void nvkm_acr_lsfw_del_all(struct nvkm_acr *);
118 #endif
119