drm/amdgpu/psp: initialization PSP SPL fw
authorLikun Gao <Likun.Gao@amd.com>
Wed, 6 May 2020 08:16:08 +0000 (16:16 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2020 05:59:13 +0000 (01:59 -0400)
Support for psp firmware header version v1_3 initialization and
information print.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c

index 2fd40d0..cd52b6e 100644 (file)
@@ -2108,6 +2108,7 @@ int psp_init_sos_microcode(struct psp_context *psp,
        const struct psp_firmware_header_v1_0 *sos_hdr;
        const struct psp_firmware_header_v1_1 *sos_hdr_v1_1;
        const struct psp_firmware_header_v1_2 *sos_hdr_v1_2;
+       const struct psp_firmware_header_v1_3 *sos_hdr_v1_3;
        int err = 0;
 
        if (!chip_name) {
@@ -2152,6 +2153,18 @@ int psp_init_sos_microcode(struct psp_context *psp,
                        adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +
                                                    le32_to_cpu(sos_hdr_v1_2->kdb_offset_bytes);
                }
+               if (sos_hdr->header.header_version_minor == 3) {
+                       sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
+                       adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.toc_size_bytes);
+                       adev->psp.toc_start_addr = (uint8_t *)adev->psp.sys_start_addr +
+                               le32_to_cpu(sos_hdr_v1_3->v1_1.toc_offset_bytes);
+                       adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.kdb_size_bytes);
+                       adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +
+                               le32_to_cpu(sos_hdr_v1_3->v1_1.kdb_offset_bytes);
+                       adev->psp.spl_bin_size = le32_to_cpu(sos_hdr_v1_3->spl_size_bytes);
+                       adev->psp.spl_start_addr = (uint8_t *)adev->psp.sys_start_addr +
+                               le32_to_cpu(sos_hdr_v1_3->spl_offset_bytes);
+               }
                break;
        default:
                dev_err(adev->dev,
index cf34386..744404a 100644 (file)
@@ -279,6 +279,30 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr)
                        DRM_DEBUG("kdb_size_bytes: %u\n",
                                  le32_to_cpu(psp_hdr_v1_2->kdb_size_bytes));
                }
+               if (version_minor == 3) {
+                       const struct psp_firmware_header_v1_1 *psp_hdr_v1_1 =
+                               container_of(psp_hdr, struct psp_firmware_header_v1_1, v1_0);
+                       const struct psp_firmware_header_v1_3 *psp_hdr_v1_3 =
+                               container_of(psp_hdr_v1_1, struct psp_firmware_header_v1_3, v1_1);
+                       DRM_DEBUG("toc_header_version: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.toc_header_version));
+                       DRM_DEBUG("toc_offset_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.toc_offset_bytes));
+                       DRM_DEBUG("toc_size_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.toc_size_bytes));
+                       DRM_DEBUG("kdb_header_version: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.kdb_header_version));
+                       DRM_DEBUG("kdb_offset_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.kdb_offset_bytes));
+                       DRM_DEBUG("kdb_size_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->v1_1.kdb_size_bytes));
+                       DRM_DEBUG("spl_header_version: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->spl_header_version));
+                       DRM_DEBUG("spl_offset_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->spl_offset_bytes));
+                       DRM_DEBUG("spl_size_bytes: %u\n",
+                                 le32_to_cpu(psp_hdr_v1_3->spl_size_bytes));
+               }
        } else {
                DRM_ERROR("Unknown PSP ucode version: %u.%u\n",
                          version_major, version_minor);