summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
diff options
context:
space:
mode:
authorJack Xiao <Jack.Xiao@amd.com>2019-04-12 18:53:35 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-06-21 18:59:28 -0500
commit02b61149486b3a33cf630095859a412f458a19f2 (patch)
tree7a67607f0f81786e9acdea10ca5823d3cbe76c3a /drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
parent086981052bd8fa7f2cf14c547f2b8990336c2b34 (diff)
drm/amdgpu/mes10.1: upload mes ucode to gpu buffer
Allocate GPU buffer and upload ucode firmware to the buffer. Signed-off-by: Jack Xiao <Jack.Xiao@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/mes_v10_1.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/mes_v10_1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
index e53819b99442..a19b2616d446 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
@@ -21,7 +21,9 @@
*
*/
+#include <linux/firmware.h>
#include "amdgpu.h"
+#include "soc15_common.h"
MODULE_FIRMWARE("amdgpu/navi10_mes.bin");
@@ -103,6 +105,38 @@ static void mes_v10_1_free_microcode(struct amdgpu_device *adev)
adev->mes.fw = NULL;
}
+static int mes_v10_1_allocate_ucode_buffer(struct amdgpu_device *adev)
+{
+ int r;
+ const struct mes_firmware_header_v1_0 *mes_hdr;
+ const __le32 *fw_data;
+ unsigned fw_size;
+
+ mes_hdr = (const struct mes_firmware_header_v1_0 *)
+ adev->mes.fw->data;
+
+ fw_data = (const __le32 *)(adev->mes.fw->data +
+ le32_to_cpu(mes_hdr->mes_ucode_offset_bytes));
+ fw_size = le32_to_cpu(mes_hdr->mes_ucode_size_bytes);
+
+ r = amdgpu_bo_create_reserved(adev, fw_size,
+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
+ &adev->mes.ucode_fw_obj,
+ &adev->mes.ucode_fw_gpu_addr,
+ (void **)&adev->mes.ucode_fw_ptr);
+ if (r) {
+ dev_err(adev->dev, "(%d) failed to create mes fw bo\n", r);
+ return r;
+ }
+
+ memcpy(adev->mes.ucode_fw_ptr, fw_data, fw_size);
+
+ amdgpu_bo_kunmap(adev->mes.ucode_fw_obj);
+ amdgpu_bo_unreserve(adev->mes.ucode_fw_obj);
+
+ return 0;
+}
+
static int mes_v10_1_sw_init(void *handle)
{
return 0;