diff options
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 37 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 7 |
3 files changed, 30 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 0ac38ee298d1..f5a42ab1f65c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
| @@ -587,6 +587,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 587 | int err; | 587 | int err; |
| 588 | struct amdgpu_firmware_info *info = NULL; | 588 | struct amdgpu_firmware_info *info = NULL; |
| 589 | const struct common_firmware_header *header = NULL; | 589 | const struct common_firmware_header *header = NULL; |
| 590 | const struct gfx_firmware_header_v1_0 *cp_hdr; | ||
| 590 | 591 | ||
| 591 | DRM_DEBUG("\n"); | 592 | DRM_DEBUG("\n"); |
| 592 | 593 | ||
| @@ -611,6 +612,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 611 | err = amdgpu_ucode_validate(adev->gfx.pfp_fw); | 612 | err = amdgpu_ucode_validate(adev->gfx.pfp_fw); |
| 612 | if (err) | 613 | if (err) |
| 613 | goto out; | 614 | goto out; |
| 615 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; | ||
| 616 | adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 617 | adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 614 | 618 | ||
| 615 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); | 619 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); |
| 616 | err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); | 620 | err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); |
| @@ -619,6 +623,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 619 | err = amdgpu_ucode_validate(adev->gfx.me_fw); | 623 | err = amdgpu_ucode_validate(adev->gfx.me_fw); |
| 620 | if (err) | 624 | if (err) |
| 621 | goto out; | 625 | goto out; |
| 626 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; | ||
| 627 | adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 628 | adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 622 | 629 | ||
| 623 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); | 630 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); |
| 624 | err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); | 631 | err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); |
| @@ -627,12 +634,18 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 627 | err = amdgpu_ucode_validate(adev->gfx.ce_fw); | 634 | err = amdgpu_ucode_validate(adev->gfx.ce_fw); |
| 628 | if (err) | 635 | if (err) |
| 629 | goto out; | 636 | goto out; |
| 637 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; | ||
| 638 | adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 639 | adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 630 | 640 | ||
| 631 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); | 641 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); |
| 632 | err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); | 642 | err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); |
| 633 | if (err) | 643 | if (err) |
| 634 | goto out; | 644 | goto out; |
| 635 | err = amdgpu_ucode_validate(adev->gfx.rlc_fw); | 645 | err = amdgpu_ucode_validate(adev->gfx.rlc_fw); |
| 646 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; | ||
| 647 | adev->gfx.rlc_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 648 | adev->gfx.rlc_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 636 | 649 | ||
| 637 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); | 650 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); |
| 638 | err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); | 651 | err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); |
| @@ -641,6 +654,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 641 | err = amdgpu_ucode_validate(adev->gfx.mec_fw); | 654 | err = amdgpu_ucode_validate(adev->gfx.mec_fw); |
| 642 | if (err) | 655 | if (err) |
| 643 | goto out; | 656 | goto out; |
| 657 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
| 658 | adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 659 | adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 644 | 660 | ||
| 645 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); | 661 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); |
| 646 | err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); | 662 | err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); |
| @@ -648,6 +664,12 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 648 | err = amdgpu_ucode_validate(adev->gfx.mec2_fw); | 664 | err = amdgpu_ucode_validate(adev->gfx.mec2_fw); |
| 649 | if (err) | 665 | if (err) |
| 650 | goto out; | 666 | goto out; |
| 667 | cp_hdr = (const struct gfx_firmware_header_v1_0 *) | ||
| 668 | adev->gfx.mec2_fw->data; | ||
| 669 | adev->gfx.mec2_fw_version = le32_to_cpu( | ||
| 670 | cp_hdr->header.ucode_version); | ||
| 671 | adev->gfx.mec2_feature_version = le32_to_cpu( | ||
| 672 | cp_hdr->ucode_feature_version); | ||
| 651 | } else { | 673 | } else { |
| 652 | err = 0; | 674 | err = 0; |
| 653 | adev->gfx.mec2_fw = NULL; | 675 | adev->gfx.mec2_fw = NULL; |
| @@ -2272,9 +2294,6 @@ static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) | |||
| 2272 | 2294 | ||
| 2273 | hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; | 2295 | hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; |
| 2274 | amdgpu_ucode_print_rlc_hdr(&hdr->header); | 2296 | amdgpu_ucode_print_rlc_hdr(&hdr->header); |
| 2275 | adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 2276 | adev->gfx.rlc_feature_version = le32_to_cpu( | ||
| 2277 | hdr->ucode_feature_version); | ||
| 2278 | 2297 | ||
| 2279 | fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + | 2298 | fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + |
| 2280 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 2299 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
| @@ -2360,12 +2379,6 @@ static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) | |||
| 2360 | amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); | 2379 | amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); |
| 2361 | amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); | 2380 | amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); |
| 2362 | amdgpu_ucode_print_gfx_hdr(&me_hdr->header); | 2381 | amdgpu_ucode_print_gfx_hdr(&me_hdr->header); |
| 2363 | adev->gfx.pfp_fw_version = le32_to_cpu(pfp_hdr->header.ucode_version); | ||
| 2364 | adev->gfx.ce_fw_version = le32_to_cpu(ce_hdr->header.ucode_version); | ||
| 2365 | adev->gfx.me_fw_version = le32_to_cpu(me_hdr->header.ucode_version); | ||
| 2366 | adev->gfx.me_feature_version = le32_to_cpu(me_hdr->ucode_feature_version); | ||
| 2367 | adev->gfx.ce_feature_version = le32_to_cpu(ce_hdr->ucode_feature_version); | ||
| 2368 | adev->gfx.pfp_feature_version = le32_to_cpu(pfp_hdr->ucode_feature_version); | ||
| 2369 | 2382 | ||
| 2370 | gfx_v8_0_cp_gfx_enable(adev, false); | 2383 | gfx_v8_0_cp_gfx_enable(adev, false); |
| 2371 | 2384 | ||
| @@ -2621,9 +2634,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 2621 | 2634 | ||
| 2622 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | 2635 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; |
| 2623 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); | 2636 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); |
| 2624 | adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); | ||
| 2625 | adev->gfx.mec_feature_version = le32_to_cpu( | ||
| 2626 | mec_hdr->ucode_feature_version); | ||
| 2627 | 2637 | ||
| 2628 | fw_data = (const __le32 *) | 2638 | fw_data = (const __le32 *) |
| 2629 | (adev->gfx.mec_fw->data + | 2639 | (adev->gfx.mec_fw->data + |
| @@ -2642,9 +2652,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 2642 | 2652 | ||
| 2643 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; | 2653 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; |
| 2644 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); | 2654 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); |
| 2645 | adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); | ||
| 2646 | adev->gfx.mec2_feature_version = le32_to_cpu( | ||
| 2647 | mec2_hdr->ucode_feature_version); | ||
| 2648 | 2655 | ||
| 2649 | fw_data = (const __le32 *) | 2656 | fw_data = (const __le32 *) |
| 2650 | (adev->gfx.mec2_fw->data + | 2657 | (adev->gfx.mec2_fw->data + |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index 01bd5c903f9b..a988dfb1d394 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | |||
| @@ -121,6 +121,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) | |||
| 121 | int err, i; | 121 | int err, i; |
| 122 | struct amdgpu_firmware_info *info = NULL; | 122 | struct amdgpu_firmware_info *info = NULL; |
| 123 | const struct common_firmware_header *header = NULL; | 123 | const struct common_firmware_header *header = NULL; |
| 124 | const struct sdma_firmware_header_v1_0 *hdr; | ||
| 124 | 125 | ||
| 125 | DRM_DEBUG("\n"); | 126 | DRM_DEBUG("\n"); |
| 126 | 127 | ||
| @@ -142,6 +143,9 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) | |||
| 142 | err = amdgpu_ucode_validate(adev->sdma[i].fw); | 143 | err = amdgpu_ucode_validate(adev->sdma[i].fw); |
| 143 | if (err) | 144 | if (err) |
| 144 | goto out; | 145 | goto out; |
| 146 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | ||
| 147 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 148 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 145 | 149 | ||
| 146 | if (adev->firmware.smu_load) { | 150 | if (adev->firmware.smu_load) { |
| 147 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; | 151 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; |
| @@ -541,9 +545,6 @@ static int sdma_v2_4_load_microcode(struct amdgpu_device *adev) | |||
| 541 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | 545 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; |
| 542 | amdgpu_ucode_print_sdma_hdr(&hdr->header); | 546 | amdgpu_ucode_print_sdma_hdr(&hdr->header); |
| 543 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | 547 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
| 544 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 545 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 546 | |||
| 547 | fw_data = (const __le32 *) | 548 | fw_data = (const __le32 *) |
| 548 | (adev->sdma[i].fw->data + | 549 | (adev->sdma[i].fw->data + |
| 549 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 550 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index cf9bc2e126fc..2b86569b18d3 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
| @@ -159,6 +159,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) | |||
| 159 | int err, i; | 159 | int err, i; |
| 160 | struct amdgpu_firmware_info *info = NULL; | 160 | struct amdgpu_firmware_info *info = NULL; |
| 161 | const struct common_firmware_header *header = NULL; | 161 | const struct common_firmware_header *header = NULL; |
| 162 | const struct sdma_firmware_header_v1_0 *hdr; | ||
| 162 | 163 | ||
| 163 | DRM_DEBUG("\n"); | 164 | DRM_DEBUG("\n"); |
| 164 | 165 | ||
| @@ -183,6 +184,9 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) | |||
| 183 | err = amdgpu_ucode_validate(adev->sdma[i].fw); | 184 | err = amdgpu_ucode_validate(adev->sdma[i].fw); |
| 184 | if (err) | 185 | if (err) |
| 185 | goto out; | 186 | goto out; |
| 187 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | ||
| 188 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 189 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 186 | 190 | ||
| 187 | if (adev->firmware.smu_load) { | 191 | if (adev->firmware.smu_load) { |
| 188 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; | 192 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; |
| @@ -630,9 +634,6 @@ static int sdma_v3_0_load_microcode(struct amdgpu_device *adev) | |||
| 630 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | 634 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; |
| 631 | amdgpu_ucode_print_sdma_hdr(&hdr->header); | 635 | amdgpu_ucode_print_sdma_hdr(&hdr->header); |
| 632 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | 636 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
| 633 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 634 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 635 | |||
| 636 | fw_data = (const __le32 *) | 637 | fw_data = (const __le32 *) |
| 637 | (adev->sdma[i].fw->data + | 638 | (adev->sdma[i].fw->data + |
| 638 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 639 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
