xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/acr/priv.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
167e7c6cfSBen Skeggs #ifndef __NVKM_ACR_PRIV_H__
267e7c6cfSBen Skeggs #define __NVKM_ACR_PRIV_H__
367e7c6cfSBen Skeggs #include <subdev/acr.h>
422dcda45SBen Skeggs struct lsb_header_tail;
567e7c6cfSBen Skeggs 
667e7c6cfSBen Skeggs struct nvkm_acr_fwif {
767e7c6cfSBen Skeggs 	int version;
867e7c6cfSBen Skeggs 	int (*load)(struct nvkm_acr *, int version,
967e7c6cfSBen Skeggs 		    const struct nvkm_acr_fwif *);
1067e7c6cfSBen Skeggs 	const struct nvkm_acr_func *func;
1167e7c6cfSBen Skeggs };
1267e7c6cfSBen Skeggs 
1390e9cf74SBen Skeggs int gm200_acr_nofw(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
1467e7c6cfSBen Skeggs int gm20b_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
1567e7c6cfSBen Skeggs int gp102_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
1667e7c6cfSBen Skeggs 
1722dcda45SBen Skeggs struct nvkm_acr_lsf;
1867e7c6cfSBen Skeggs struct nvkm_acr_func {
1922dcda45SBen Skeggs 	const struct nvkm_acr_hsf_fwif *load;
2022dcda45SBen Skeggs 	const struct nvkm_acr_hsf_fwif *ahesasc;
2122dcda45SBen Skeggs 	const struct nvkm_acr_hsf_fwif *asb;
2222dcda45SBen Skeggs 	const struct nvkm_acr_hsf_fwif *unload;
2322dcda45SBen Skeggs 	int (*wpr_parse)(struct nvkm_acr *);
2422dcda45SBen Skeggs 	u32 (*wpr_layout)(struct nvkm_acr *);
2522dcda45SBen Skeggs 	int (*wpr_alloc)(struct nvkm_acr *, u32 wpr_size);
2622dcda45SBen Skeggs 	int (*wpr_build)(struct nvkm_acr *, struct nvkm_acr_lsf *rtos);
27*4b569dedSBen Skeggs 	int (*wpr_patch)(struct nvkm_acr *, s64 adjust);
2822dcda45SBen Skeggs 	void (*wpr_check)(struct nvkm_acr *, u64 *start, u64 *limit);
2922dcda45SBen Skeggs 	int (*init)(struct nvkm_acr *);
3022dcda45SBen Skeggs 	void (*fini)(struct nvkm_acr *);
31587debc9SBen Skeggs 	u64 bootstrap_falcons;
3267e7c6cfSBen Skeggs };
3367e7c6cfSBen Skeggs 
3490e9cf74SBen Skeggs extern const struct nvkm_acr_func gm200_acr;
3522dcda45SBen Skeggs int gm200_acr_wpr_parse(struct nvkm_acr *);
3622dcda45SBen Skeggs u32 gm200_acr_wpr_layout(struct nvkm_acr *);
3722dcda45SBen Skeggs int gm200_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
38*4b569dedSBen Skeggs int gm200_acr_wpr_patch(struct nvkm_acr *, s64);
3922dcda45SBen Skeggs void gm200_acr_wpr_check(struct nvkm_acr *, u64 *, u64 *);
4022dcda45SBen Skeggs void gm200_acr_wpr_build_lsb_tail(struct nvkm_acr_lsfw *,
4122dcda45SBen Skeggs 				  struct lsb_header_tail *);
4222dcda45SBen Skeggs int gm200_acr_init(struct nvkm_acr *);
4322dcda45SBen Skeggs 
4422dcda45SBen Skeggs int gm20b_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
4522dcda45SBen Skeggs 
4622dcda45SBen Skeggs int gp102_acr_wpr_parse(struct nvkm_acr *);
4722dcda45SBen Skeggs u32 gp102_acr_wpr_layout(struct nvkm_acr *);
4822dcda45SBen Skeggs int gp102_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
4922dcda45SBen Skeggs int gp102_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
5022dcda45SBen Skeggs int gp102_acr_wpr_build_lsb(struct nvkm_acr *, struct nvkm_acr_lsfw *);
51*4b569dedSBen Skeggs int gp102_acr_wpr_patch(struct nvkm_acr *, s64);
52*4b569dedSBen Skeggs 
53*4b569dedSBen Skeggs int tu102_acr_init(struct nvkm_acr *);
54*4b569dedSBen Skeggs 
55*4b569dedSBen Skeggs void ga100_acr_wpr_check(struct nvkm_acr *, u64 *, u64 *);
5622dcda45SBen Skeggs 
5722dcda45SBen Skeggs struct nvkm_acr_hsfw {
582541626cSBen Skeggs 	struct nvkm_falcon_fw fw;
592541626cSBen Skeggs 
602541626cSBen Skeggs 	enum nvkm_acr_hsf_id {
612541626cSBen Skeggs 		NVKM_ACR_HSF_PMU,
622541626cSBen Skeggs 		NVKM_ACR_HSF_SEC2,
632541626cSBen Skeggs 		NVKM_ACR_HSF_GSP,
642541626cSBen Skeggs 	} falcon_id;
652541626cSBen Skeggs 	u32 boot_mbox0;
662541626cSBen Skeggs 	u32 intr_clear;
672541626cSBen Skeggs 
6822dcda45SBen Skeggs 	struct list_head head;
6922dcda45SBen Skeggs };
7022dcda45SBen Skeggs 
712541626cSBen Skeggs int nvkm_acr_hsfw_boot(struct nvkm_acr *, const char *name);
722541626cSBen Skeggs 
7322dcda45SBen Skeggs struct nvkm_acr_hsf_fwif {
7422dcda45SBen Skeggs 	int version;
7522dcda45SBen Skeggs 	int (*load)(struct nvkm_acr *, const char *bl, const char *fw,
7622dcda45SBen Skeggs 		    const char *name, int version,
7722dcda45SBen Skeggs 		    const struct nvkm_acr_hsf_fwif *);
782541626cSBen Skeggs 	const struct nvkm_falcon_fw_func *func;
792541626cSBen Skeggs 
802541626cSBen Skeggs 	enum nvkm_acr_hsf_id falcon_id;
812541626cSBen Skeggs 	u32 boot_mbox0;
822541626cSBen Skeggs 	u32 intr_clear;
8322dcda45SBen Skeggs };
8422dcda45SBen Skeggs 
8522dcda45SBen Skeggs 
862541626cSBen Skeggs int gm200_acr_hsfw_ctor(struct nvkm_acr *, const char *, const char *, const char *, int,
872541626cSBen Skeggs 			const struct nvkm_acr_hsf_fwif *);
882541626cSBen Skeggs int gm200_acr_hsfw_load_bld(struct nvkm_falcon_fw *);
892541626cSBen Skeggs extern const struct nvkm_falcon_fw_func gm200_acr_unload_0;
9022dcda45SBen Skeggs 
912541626cSBen Skeggs extern const struct nvkm_falcon_fw_func gm20b_acr_load_0;
9222dcda45SBen Skeggs 
932541626cSBen Skeggs int gp102_acr_load_setup(struct nvkm_falcon_fw *);
9422dcda45SBen Skeggs 
952541626cSBen Skeggs extern const struct nvkm_falcon_fw_func gp108_acr_load_0;
9622dcda45SBen Skeggs 
972541626cSBen Skeggs extern const struct nvkm_falcon_fw_func gp108_acr_hsfw_0;
982541626cSBen Skeggs int gp108_acr_hsfw_load_bld(struct nvkm_falcon_fw *);
9922dcda45SBen Skeggs 
100*4b569dedSBen Skeggs int ga100_acr_hsfw_ctor(struct nvkm_acr *, const char *, const char *, const char *, int,
101*4b569dedSBen Skeggs 			const struct nvkm_acr_hsf_fwif *);
102*4b569dedSBen Skeggs 
103c288b4deSBen Skeggs int nvkm_acr_new_(const struct nvkm_acr_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
104c288b4deSBen Skeggs 		  int inst, struct nvkm_acr **);
105c63fe2e7SBen Skeggs 
10686ce2a71SBen Skeggs struct nvkm_acr_lsf {
10786ce2a71SBen Skeggs 	const struct nvkm_acr_lsf_func *func;
10886ce2a71SBen Skeggs 	struct nvkm_falcon *falcon;
10986ce2a71SBen Skeggs 	enum nvkm_acr_lsf_id id;
11086ce2a71SBen Skeggs 	struct list_head head;
11186ce2a71SBen Skeggs };
11286ce2a71SBen Skeggs 
113c63fe2e7SBen Skeggs struct nvkm_acr_lsfw *nvkm_acr_lsfw_add(const struct nvkm_acr_lsf_func *,
114c63fe2e7SBen Skeggs 					struct nvkm_acr *, struct nvkm_falcon *,
115c63fe2e7SBen Skeggs 					enum nvkm_acr_lsf_id);
116c63fe2e7SBen Skeggs void nvkm_acr_lsfw_del(struct nvkm_acr_lsfw *);
117c63fe2e7SBen Skeggs void nvkm_acr_lsfw_del_all(struct nvkm_acr *);
11867e7c6cfSBen Skeggs #endif
119