Commit ba0b2275 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: use memcpy_to/fromio for UVD fw upload

Also use the firmware size from the header instead of calculating it.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 39a5830a
...@@ -298,7 +298,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev) ...@@ -298,7 +298,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
if (!adev->uvd.saved_bo) if (!adev->uvd.saved_bo)
return -ENOMEM; return -ENOMEM;
memcpy(adev->uvd.saved_bo, ptr, size); memcpy_fromio(adev->uvd.saved_bo, ptr, size);
return 0; return 0;
} }
...@@ -315,7 +315,7 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev) ...@@ -315,7 +315,7 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
ptr = adev->uvd.cpu_addr; ptr = adev->uvd.cpu_addr;
if (adev->uvd.saved_bo != NULL) { if (adev->uvd.saved_bo != NULL) {
memcpy(ptr, adev->uvd.saved_bo, size); memcpy_toio(ptr, adev->uvd.saved_bo, size);
kfree(adev->uvd.saved_bo); kfree(adev->uvd.saved_bo);
adev->uvd.saved_bo = NULL; adev->uvd.saved_bo = NULL;
} else { } else {
...@@ -324,11 +324,11 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev) ...@@ -324,11 +324,11 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
hdr = (const struct common_firmware_header *)adev->uvd.fw->data; hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
offset = le32_to_cpu(hdr->ucode_array_offset_bytes); offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
memcpy(adev->uvd.cpu_addr, (adev->uvd.fw->data) + offset, memcpy_toio(adev->uvd.cpu_addr, adev->uvd.fw->data + offset,
(adev->uvd.fw->size) - offset); le32_to_cpu(hdr->ucode_size_bytes));
size -= le32_to_cpu(hdr->ucode_size_bytes); size -= le32_to_cpu(hdr->ucode_size_bytes);
ptr += le32_to_cpu(hdr->ucode_size_bytes); ptr += le32_to_cpu(hdr->ucode_size_bytes);
memset(ptr, 0, size); memset_io(ptr, 0, size);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment