drm/nouveau/secboot: abstract fixup_hs_desc function
authorAlexandre Courbot <acourbot@nvidia.com>
Tue, 1 Nov 2016 06:05:03 +0000 (15:05 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 7 Mar 2017 07:05:12 +0000 (17:05 +1000)
As different firmare versions use different HS descriptor formats, we
need to abstract this part as well.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r361.c

index 60c7b9e0fc47b5c8094989ad0182f71b82acfada..e6edde0bdf9060bf51baee1b0d950bad2cf8da0f 100644 (file)
@@ -583,10 +583,11 @@ acr_r352_hsf_patch_signature(struct nvkm_secboot *sb, void *acr_image)
        memcpy(hs_data + fw_hdr->patch_loc, sig + fw_hdr->patch_sig, sig_size);
 }
 
-static void
+void
 acr_r352_fixup_hs_desc(struct acr_r352 *acr, struct nvkm_secboot *sb,
-                      struct hsflcn_acr_desc *desc)
+                      void *_desc)
 {
+       struct hsflcn_acr_desc *desc = _desc;
        struct nvkm_gpuobj *ls_blob = acr->ls_blob;
 
        /* WPR region information if WPR is not fixed */
@@ -668,7 +669,7 @@ acr_r352_prepare_hs_blob(struct acr_r352 *acr, struct nvkm_secboot *sb,
                struct hsflcn_acr_desc *desc;
 
                desc = acr_data + load_hdr->data_dma_base;
-               acr_r352_fixup_hs_desc(acr, sb, desc);
+               acr->func->fixup_hs_desc(acr, sb, desc);
        }
 
        if (load_hdr->num_apps > ACR_R352_MAX_APPS) {
@@ -952,6 +953,7 @@ acr_r352_ls_gpccs_func = {
 
 const struct acr_r352_func
 acr_r352_func = {
+       .fixup_hs_desc = acr_r352_fixup_hs_desc,
        .generate_hs_bl_desc = acr_r352_generate_hs_bl_desc,
        .hs_bl_desc_size = sizeof(struct acr_r352_flcn_bl_desc),
        .ls_ucode_img_load = acr_r352_ls_ucode_img_load,
index 6634fb0d982daba3a1d71fbd15f36cd6acd31f2c..3e86d45eabd9b3259ad36fb8f5a83529f706629b 100644 (file)
@@ -100,6 +100,7 @@ struct acr_r352;
 struct acr_r352_func {
        void (*generate_hs_bl_desc)(const struct hsf_load_header *, void *,
                                    u64);
+       void (*fixup_hs_desc)(struct acr_r352 *, struct nvkm_secboot *, void *);
        u32 hs_bl_desc_size;
 
        struct ls_ucode_img *(*ls_ucode_img_load)(const struct acr_r352 *,
@@ -168,4 +169,6 @@ int acr_r352_ls_fill_headers(struct acr_r352 *, struct list_head *);
 int acr_r352_ls_write_wpr(struct acr_r352 *, struct list_head *,
                          struct nvkm_gpuobj *, u64);
 
+void acr_r352_fixup_hs_desc(struct acr_r352 *, struct nvkm_secboot *, void *);
+
 #endif
index ea6230cfb87017f060658d7f2d91317bd5c55d30..8561037d4cb7eaf11e2e18dcbfadf6c27e46929e 100644 (file)
@@ -118,6 +118,7 @@ acr_r361_ls_gpccs_func = {
 
 const struct acr_r352_func
 acr_r361_func = {
+       .fixup_hs_desc = acr_r352_fixup_hs_desc,
        .generate_hs_bl_desc = acr_r361_generate_hs_bl_desc,
        .hs_bl_desc_size = sizeof(struct acr_r361_flcn_bl_desc),
        .ls_ucode_img_load = acr_r352_ls_ucode_img_load,