acr.h (3708B)
1/* SPDX-License-Identifier: MIT */ 2#ifndef __NVKM_ACR_H__ 3#define __NVKM_ACR_H__ 4#define nvkm_acr(p) container_of((p), struct nvkm_acr, subdev) 5#include <core/subdev.h> 6#include <core/falcon.h> 7 8enum nvkm_acr_lsf_id { 9 NVKM_ACR_LSF_PMU = 0, 10 NVKM_ACR_LSF_GSPLITE = 1, 11 NVKM_ACR_LSF_FECS = 2, 12 NVKM_ACR_LSF_GPCCS = 3, 13 NVKM_ACR_LSF_NVDEC = 4, 14 NVKM_ACR_LSF_SEC2 = 7, 15 NVKM_ACR_LSF_MINION = 10, 16 NVKM_ACR_LSF_NUM 17}; 18 19static inline const char * 20nvkm_acr_lsf_id(enum nvkm_acr_lsf_id id) 21{ 22 switch (id) { 23 case NVKM_ACR_LSF_PMU : return "pmu"; 24 case NVKM_ACR_LSF_GSPLITE: return "gsplite"; 25 case NVKM_ACR_LSF_FECS : return "fecs"; 26 case NVKM_ACR_LSF_GPCCS : return "gpccs"; 27 case NVKM_ACR_LSF_NVDEC : return "nvdec"; 28 case NVKM_ACR_LSF_SEC2 : return "sec2"; 29 case NVKM_ACR_LSF_MINION : return "minion"; 30 default: 31 return "unknown"; 32 } 33} 34 35struct nvkm_acr { 36 const struct nvkm_acr_func *func; 37 struct nvkm_subdev subdev; 38 39 struct list_head hsfw, hsf; 40 struct list_head lsfw, lsf; 41 42 u64 managed_falcons; 43 44 struct nvkm_memory *wpr; 45 u64 wpr_start; 46 u64 wpr_end; 47 u64 shadow_start; 48 49 struct nvkm_memory *inst; 50 struct nvkm_vmm *vmm; 51 52 bool done; 53 54 const struct firmware *wpr_fw; 55 bool wpr_comp; 56 u64 wpr_prev; 57}; 58 59bool nvkm_acr_managed_falcon(struct nvkm_device *, enum nvkm_acr_lsf_id); 60int nvkm_acr_bootstrap_falcons(struct nvkm_device *, unsigned long mask); 61 62int gm200_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 63int gm20b_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 64int gp102_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 65int gp108_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 66int gp10b_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 67int tu102_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **); 68 69struct nvkm_acr_lsfw { 70 const struct nvkm_acr_lsf_func *func; 71 struct nvkm_falcon *falcon; 72 enum nvkm_acr_lsf_id id; 73 74 struct list_head head; 75 76 struct nvkm_blob img; 77 78 const struct firmware *sig; 79 80 u32 bootloader_size; 81 u32 bootloader_imem_offset; 82 83 u32 app_size; 84 u32 app_start_offset; 85 u32 app_imem_entry; 86 u32 app_resident_code_offset; 87 u32 app_resident_code_size; 88 u32 app_resident_data_offset; 89 u32 app_resident_data_size; 90 91 u32 ucode_size; 92 u32 data_size; 93 94 struct { 95 u32 lsb; 96 u32 img; 97 u32 bld; 98 } offset; 99 u32 bl_data_size; 100}; 101 102struct nvkm_acr_lsf_func { 103/* The (currently) map directly to LSB header flags. */ 104#define NVKM_ACR_LSF_LOAD_CODE_AT_0 0x00000001 105#define NVKM_ACR_LSF_DMACTL_REQ_CTX 0x00000004 106#define NVKM_ACR_LSF_FORCE_PRIV_LOAD 0x00000008 107 u32 flags; 108 u32 bld_size; 109 void (*bld_write)(struct nvkm_acr *, u32 bld, struct nvkm_acr_lsfw *); 110 void (*bld_patch)(struct nvkm_acr *, u32 bld, s64 adjust); 111 int (*boot)(struct nvkm_falcon *); 112 u64 bootstrap_falcons; 113 int (*bootstrap_falcon)(struct nvkm_falcon *, enum nvkm_acr_lsf_id); 114 int (*bootstrap_multiple_falcons)(struct nvkm_falcon *, u32 mask); 115}; 116 117int 118nvkm_acr_lsfw_load_sig_image_desc(struct nvkm_subdev *, struct nvkm_falcon *, 119 enum nvkm_acr_lsf_id, const char *path, 120 int ver, const struct nvkm_acr_lsf_func *); 121int 122nvkm_acr_lsfw_load_sig_image_desc_v1(struct nvkm_subdev *, struct nvkm_falcon *, 123 enum nvkm_acr_lsf_id, const char *path, 124 int ver, const struct nvkm_acr_lsf_func *); 125int 126nvkm_acr_lsfw_load_bl_inst_data_sig(struct nvkm_subdev *, struct nvkm_falcon *, 127 enum nvkm_acr_lsf_id, const char *path, 128 int ver, const struct nvkm_acr_lsf_func *); 129#endif