forked from luck/tmp_suning_uos_patched
drm/nouveau/secboot: pass max supported FW version to LS load funcs
Will be passed to the FW loader function as an upper bound on the supported FW version to attempt to load. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
475cf02b83
commit
c26f3061fe
|
@ -243,6 +243,7 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,
|
||||||
enum nvkm_secboot_falcon falcon_id)
|
enum nvkm_secboot_falcon falcon_id)
|
||||||
{
|
{
|
||||||
const struct nvkm_subdev *subdev = acr->base.subdev;
|
const struct nvkm_subdev *subdev = acr->base.subdev;
|
||||||
|
const struct acr_r352_ls_func *func = acr->func->ls_func[falcon_id];
|
||||||
struct ls_ucode_img_r352 *img;
|
struct ls_ucode_img_r352 *img;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -252,9 +253,8 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,
|
||||||
|
|
||||||
img->base.falcon_id = falcon_id;
|
img->base.falcon_id = falcon_id;
|
||||||
|
|
||||||
ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);
|
ret = func->load(sb, func->version_max, &img->base);
|
||||||
|
if (ret < 0) {
|
||||||
if (ret) {
|
|
||||||
kfree(img->base.ucode_data);
|
kfree(img->base.ucode_data);
|
||||||
kfree(img->base.sig);
|
kfree(img->base.sig);
|
||||||
kfree(img);
|
kfree(img);
|
||||||
|
|
|
@ -57,12 +57,14 @@ hsf_load_header_app_size(const struct hsf_load_header *hdr, u32 app)
|
||||||
* @lhdr_flags: LS flags
|
* @lhdr_flags: LS flags
|
||||||
*/
|
*/
|
||||||
struct acr_r352_ls_func {
|
struct acr_r352_ls_func {
|
||||||
int (*load)(const struct nvkm_secboot *, struct ls_ucode_img *);
|
int (*load)(const struct nvkm_secboot *, int maxver,
|
||||||
|
struct ls_ucode_img *);
|
||||||
void (*generate_bl_desc)(const struct nvkm_acr *,
|
void (*generate_bl_desc)(const struct nvkm_acr *,
|
||||||
const struct ls_ucode_img *, u64, void *);
|
const struct ls_ucode_img *, u64, void *);
|
||||||
u32 bl_desc_size;
|
u32 bl_desc_size;
|
||||||
int (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
|
int (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
|
||||||
u32 lhdr_flags;
|
u32 lhdr_flags;
|
||||||
|
int version_max;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acr_r352;
|
struct acr_r352;
|
||||||
|
|
|
@ -111,6 +111,7 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,
|
||||||
enum nvkm_secboot_falcon falcon_id)
|
enum nvkm_secboot_falcon falcon_id)
|
||||||
{
|
{
|
||||||
const struct nvkm_subdev *subdev = acr->base.subdev;
|
const struct nvkm_subdev *subdev = acr->base.subdev;
|
||||||
|
const struct acr_r352_ls_func *func = acr->func->ls_func[falcon_id];
|
||||||
struct ls_ucode_img_r367 *img;
|
struct ls_ucode_img_r367 *img;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -120,8 +121,8 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,
|
||||||
|
|
||||||
img->base.falcon_id = falcon_id;
|
img->base.falcon_id = falcon_id;
|
||||||
|
|
||||||
ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);
|
ret = func->load(sb, func->version_max, &img->base);
|
||||||
if (ret) {
|
if (ret < 0) {
|
||||||
kfree(img->base.ucode_data);
|
kfree(img->base.ucode_data);
|
||||||
kfree(img->base.sig);
|
kfree(img->base.sig);
|
||||||
kfree(img);
|
kfree(img);
|
||||||
|
|
|
@ -147,11 +147,15 @@ struct fw_bl_desc {
|
||||||
u32 data_size;
|
u32 data_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
|
int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, int,
|
||||||
int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
|
struct ls_ucode_img *);
|
||||||
int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
|
int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, int,
|
||||||
|
struct ls_ucode_img *);
|
||||||
|
int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, int,
|
||||||
|
struct ls_ucode_img *);
|
||||||
int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
|
int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
|
||||||
int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
|
int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, int,
|
||||||
|
struct ls_ucode_img *);
|
||||||
int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
|
int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,8 +90,8 @@ ls_ucode_img_build(const struct firmware *bl, const struct firmware *code,
|
||||||
* blob. Also generate the corresponding ucode descriptor.
|
* blob. Also generate the corresponding ucode descriptor.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img,
|
ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, int maxver,
|
||||||
const char *falcon_name)
|
struct ls_ucode_img *img, const char *falcon_name)
|
||||||
{
|
{
|
||||||
const struct firmware *bl, *code, *data, *sig;
|
const struct firmware *bl, *code, *data, *sig;
|
||||||
char f[64];
|
char f[64];
|
||||||
|
@ -146,13 +146,15 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acr_ls_ucode_load_fecs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
|
acr_ls_ucode_load_fecs(const struct nvkm_secboot *sb, int maxver,
|
||||||
|
struct ls_ucode_img *img)
|
||||||
{
|
{
|
||||||
return ls_ucode_img_load_gr(&sb->subdev, img, "fecs");
|
return ls_ucode_img_load_gr(&sb->subdev, maxver, img, "fecs");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acr_ls_ucode_load_gpccs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
|
acr_ls_ucode_load_gpccs(const struct nvkm_secboot *sb, int maxver,
|
||||||
|
struct ls_ucode_img *img)
|
||||||
{
|
{
|
||||||
return ls_ucode_img_load_gr(&sb->subdev, img, "gpccs");
|
return ls_ucode_img_load_gr(&sb->subdev, maxver, img, "gpccs");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
|
acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
|
||||||
struct ls_ucode_img *img)
|
int maxver, struct ls_ucode_img *img)
|
||||||
{
|
{
|
||||||
const struct firmware *image, *desc, *sig;
|
const struct firmware *image, *desc, *sig;
|
||||||
char f[64];
|
char f[64];
|
||||||
|
@ -99,12 +99,13 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acr_ls_ucode_load_pmu(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
|
acr_ls_ucode_load_pmu(const struct nvkm_secboot *sb, int maxver,
|
||||||
|
struct ls_ucode_img *img)
|
||||||
{
|
{
|
||||||
struct nvkm_pmu *pmu = sb->subdev.device->pmu;
|
struct nvkm_pmu *pmu = sb->subdev.device->pmu;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "pmu", img);
|
ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "pmu", maxver, img);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -136,12 +137,13 @@ acr_ls_pmu_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acr_ls_ucode_load_sec2(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
|
acr_ls_ucode_load_sec2(const struct nvkm_secboot *sb, int maxver,
|
||||||
|
struct ls_ucode_img *img)
|
||||||
{
|
{
|
||||||
struct nvkm_sec2 *sec = sb->subdev.device->sec2;
|
struct nvkm_sec2 *sec = sb->subdev.device->sec2;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "sec2", img);
|
ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "sec2", maxver, img);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user