]> Git Repo - J-linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
Merge tag 'cxl-for-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
[J-linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ucode.c
index 58e812ae5865540902e64bdc6412b339a796649c..ffa4c0d207db68ea7fef0d9c0ff0ec6c21a63a73 100644 (file)
@@ -126,6 +126,19 @@ void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr)
        }
 }
 
+void amdgpu_ucode_print_imu_hdr(const struct common_firmware_header *hdr)
+{
+       uint16_t version_major = le16_to_cpu(hdr->header_version_major);
+       uint16_t version_minor = le16_to_cpu(hdr->header_version_minor);
+
+       DRM_DEBUG("IMU\n");
+       amdgpu_ucode_print_common_hdr(hdr);
+
+       if (version_major != 1) {
+               DRM_ERROR("Unknown GFX ucode version: %u.%u\n", version_major, version_minor);
+       }
+}
+
 void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr)
 {
        uint16_t version_major = le16_to_cpu(hdr->header_version_major);
@@ -244,6 +257,17 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr)
                                container_of(sdma_hdr, struct sdma_firmware_header_v1_1, v1_0);
                        DRM_DEBUG("digest_size: %u\n", le32_to_cpu(sdma_v1_1_hdr->digest_size));
                }
+       } else if (version_major == 2) {
+               const struct sdma_firmware_header_v2_0 *sdma_hdr =
+                       container_of(hdr, struct sdma_firmware_header_v2_0, header);
+
+               DRM_DEBUG("ucode_feature_version: %u\n",
+                         le32_to_cpu(sdma_hdr->ucode_feature_version));
+               DRM_DEBUG("ctx_jt_offset: %u\n", le32_to_cpu(sdma_hdr->ctx_jt_offset));
+               DRM_DEBUG("ctx_jt_size: %u\n", le32_to_cpu(sdma_hdr->ctx_jt_size));
+               DRM_DEBUG("ctl_ucode_offset: %u\n", le32_to_cpu(sdma_hdr->ctl_ucode_offset));
+               DRM_DEBUG("ctl_jt_offset: %u\n", le32_to_cpu(sdma_hdr->ctl_jt_offset));
+               DRM_DEBUG("ctl_jt_size: %u\n", le32_to_cpu(sdma_hdr->ctl_jt_size));
        } else {
                DRM_ERROR("Unknown SDMA ucode version: %u.%u\n",
                          version_major, version_minor);
@@ -661,6 +685,7 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
 {
        const struct common_firmware_header *header = NULL;
        const struct gfx_firmware_header_v1_0 *cp_hdr = NULL;
+       const struct gfx_firmware_header_v2_0 *cpv2_hdr = NULL;
        const struct dmcu_firmware_header_v1_0 *dmcu_hdr = NULL;
        const struct dmcub_firmware_header_v1_0 *dmcub_hdr = NULL;
        const struct mes_firmware_header_v1_0 *mes_hdr = NULL;
@@ -679,6 +704,7 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
 
        header = (const struct common_firmware_header *)ucode->fw->data;
        cp_hdr = (const struct gfx_firmware_header_v1_0 *)ucode->fw->data;
+       cpv2_hdr = (const struct gfx_firmware_header_v2_0 *)ucode->fw->data;
        dmcu_hdr = (const struct dmcu_firmware_header_v1_0 *)ucode->fw->data;
        dmcub_hdr = (const struct dmcub_firmware_header_v1_0 *)ucode->fw->data;
        mes_hdr = (const struct mes_firmware_header_v1_0 *)ucode->fw->data;
@@ -688,12 +714,12 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
        if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
                switch (ucode->ucode_id) {
                case AMDGPU_UCODE_ID_SDMA_UCODE_TH0:
-                       ucode->ucode_size = le32_to_cpu(sdma_hdr->ctx_jt_offset + sdma_hdr->ctx_jt_size);
+                       ucode->ucode_size = le32_to_cpu(sdma_hdr->ctx_ucode_size_bytes);
                        ucode_addr = (u8 *)ucode->fw->data +
                                le32_to_cpu(sdma_hdr->header.ucode_array_offset_bytes);
                        break;
                case AMDGPU_UCODE_ID_SDMA_UCODE_TH1:
-                       ucode->ucode_size = le32_to_cpu(sdma_hdr->ctl_jt_offset + sdma_hdr->ctl_jt_size);
+                       ucode->ucode_size = le32_to_cpu(sdma_hdr->ctl_ucode_size_bytes);
                        ucode_addr = (u8 *)ucode->fw->data +
                                le32_to_cpu(sdma_hdr->ctl_ucode_offset);
                        break;
@@ -791,6 +817,61 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
                                le32_to_cpu(imu_hdr->header.ucode_array_offset_bytes) +
                                le32_to_cpu(imu_hdr->imu_iram_ucode_size_bytes);
                        break;
+               case AMDGPU_UCODE_ID_CP_RS64_PFP:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->ucode_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(header->ucode_array_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_PFP_P1_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_ME:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->ucode_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(header->ucode_array_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_ME_P0_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_ME_P1_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_MEC:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->ucode_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(header->ucode_array_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_MEC_P0_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_MEC_P1_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_MEC_P2_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
+               case AMDGPU_UCODE_ID_CP_RS64_MEC_P3_STACK:
+                       ucode->ucode_size = le32_to_cpu(cpv2_hdr->data_size_bytes);
+                       ucode_addr = (u8 *)ucode->fw->data +
+                               le32_to_cpu(cpv2_hdr->data_offset_bytes);
+                       break;
                default:
                        ucode->ucode_size = le32_to_cpu(header->ucode_size_bytes);
                        ucode_addr = (u8 *)ucode->fw->data +
This page took 0.049854 seconds and 4 git commands to generate.