aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 6d5c8ac64874..6fb3edaba0ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -318,14 +318,13 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
318 if (adev->sdma.instance[i].feature_version >= 20) 318 if (adev->sdma.instance[i].feature_version >= 20)
319 adev->sdma.instance[i].burst_nop = true; 319 adev->sdma.instance[i].burst_nop = true;
320 320
321 if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) { 321 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
322 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; 322 info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
323 info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i; 323 info->fw = adev->sdma.instance[i].fw;
324 info->fw = adev->sdma.instance[i].fw; 324 header = (const struct common_firmware_header *)info->fw->data;
325 header = (const struct common_firmware_header *)info->fw->data; 325 adev->firmware.fw_size +=
326 adev->firmware.fw_size += 326 ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
327 ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); 327
328 }
329 } 328 }
330out: 329out:
331 if (err) { 330 if (err) {
@@ -778,42 +777,6 @@ static int sdma_v3_0_rlc_resume(struct amdgpu_device *adev)
778} 777}
779 778
780/** 779/**
781 * sdma_v3_0_load_microcode - load the sDMA ME ucode
782 *
783 * @adev: amdgpu_device pointer
784 *
785 * Loads the sDMA0/1 ucode.
786 * Returns 0 for success, -EINVAL if the ucode is not available.
787 */
788static int sdma_v3_0_load_microcode(struct amdgpu_device *adev)
789{
790 const struct sdma_firmware_header_v1_0 *hdr;
791 const __le32 *fw_data;
792 u32 fw_size;
793 int i, j;
794
795 /* halt the MEs */
796 sdma_v3_0_enable(adev, false);
797
798 for (i = 0; i < adev->sdma.num_instances; i++) {
799 if (!adev->sdma.instance[i].fw)
800 return -EINVAL;
801 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data;
802 amdgpu_ucode_print_sdma_hdr(&hdr->header);
803 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
804 fw_data = (const __le32 *)
805 (adev->sdma.instance[i].fw->data +
806 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
807 WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);
808 for (j = 0; j < fw_size; j++)
809 WREG32(mmSDMA0_UCODE_DATA + sdma_offsets[i], le32_to_cpup(fw_data++));
810 WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], adev->sdma.instance[i].fw_version);
811 }
812
813 return 0;
814}
815
816/**
817 * sdma_v3_0_start - setup and start the async dma engines 780 * sdma_v3_0_start - setup and start the async dma engines
818 * 781 *
819 * @adev: amdgpu_device pointer 782 * @adev: amdgpu_device pointer
@@ -825,12 +788,6 @@ static int sdma_v3_0_start(struct amdgpu_device *adev)
825{ 788{
826 int r; 789 int r;
827 790
828 if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
829 r = sdma_v3_0_load_microcode(adev);
830 if (r)
831 return r;
832 }
833
834 /* disable sdma engine before programing it */ 791 /* disable sdma engine before programing it */
835 sdma_v3_0_ctx_switch_enable(adev, false); 792 sdma_v3_0_ctx_switch_enable(adev, false);
836 sdma_v3_0_enable(adev, false); 793 sdma_v3_0_enable(adev, false);