All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hawking Zhang <Hawking.Zhang@amd.com>
To: amd-gfx@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>,
	John Clements <john.clements@amd.com>,
	Guchun Chen <Guchun.Chen@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Subject: [PATCH 4/8] drm/amdgpu: add helper function to init asd ucode
Date: Mon, 20 Apr 2020 18:16:40 +0800	[thread overview]
Message-ID: <1587377804-3836-5-git-send-email-Hawking.Zhang@amd.com> (raw)
In-Reply-To: <1587377804-3836-1-git-send-email-Hawking.Zhang@amd.com>

asd is unified ucode across asic. it is not necessary
to keep its software structure to be ip specific one

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  2 ++
 2 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 7797065..3656068 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -1840,6 +1840,42 @@ int psp_ring_cmd_submit(struct psp_context *psp,
 	return 0;
 }
 
+int psp_init_asd_microcode(struct psp_context *psp,
+			   const char *chip_name)
+{
+	struct amdgpu_device *adev = psp->adev;
+	char fw_name[30];
+	const struct psp_firmware_header_v1_0 *asd_hdr;
+	int err = 0;
+
+	if (!chip_name) {
+		dev_err(adev->dev, "invalid chip name for asd microcode\n");
+		return -EINVAL;
+	}
+
+	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name);
+	err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev);
+	if (err)
+		goto out;
+
+	err = amdgpu_ucode_validate(adev->psp.asd_fw);
+	if (err)
+		goto out;
+
+	asd_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.asd_fw->data;
+	adev->psp.asd_fw_version = le32_to_cpu(asd_hdr->header.ucode_version);
+	adev->psp.asd_feature_version = le32_to_cpu(asd_hdr->ucode_feature_version);
+	adev->psp.asd_ucode_size = le32_to_cpu(asd_hdr->header.ucode_size_bytes);
+	adev->psp.asd_start_addr = (uint8_t *)asd_hdr +
+				le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes);
+	return 0;
+out:
+	dev_err(adev->dev, "fail to initialize asd microcode\n");
+	release_firmware(adev->psp.asd_fw);
+	adev->psp.asd_fw = NULL;
+	return err;
+}
+
 static int psp_set_clockgating_state(void *handle,
 				     enum amd_clockgating_state state)
 {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index f8b1f03..a763148 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -385,4 +385,6 @@ int psp_ring_cmd_submit(struct psp_context *psp,
 			uint64_t cmd_buf_mc_addr,
 			uint64_t fence_mc_addr,
 			int index);
+int psp_init_asd_microcode(struct psp_context *psp,
+			   const char *chip_name);
 #endif
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2020-04-20 10:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 10:16 [PATCH 0/8] psp code clean up Hawking Zhang
2020-04-20 10:16 ` [PATCH 1/8] drm/amdgpu: retire support_vmr_ring interface Hawking Zhang
2020-04-20 10:16 ` [PATCH 2/8] drm/amdgpu: remove unnecessary tOS version check Hawking Zhang
2020-04-20 10:16 ` [PATCH 3/8] drm/amdgpu: retire unused check_fw_loading status Hawking Zhang
2020-04-20 14:45   ` Luben Tuikov
2020-04-20 17:39     ` Alex Deucher
2020-04-20 10:16 ` Hawking Zhang [this message]
2020-04-20 15:29   ` [PATCH 4/8] drm/amdgpu: add helper function to init asd ucode Luben Tuikov
2020-04-20 15:32     ` Luben Tuikov
2020-04-20 10:16 ` [PATCH 5/8] drm/amdgpu: switch to " Hawking Zhang
2020-04-20 10:16 ` [PATCH 6/8] drm/amdgpu: add helper function to init sos ucode Hawking Zhang
2020-04-20 15:37   ` Luben Tuikov
2020-04-20 10:16 ` [PATCH 7/8] drm/amdgpu: switch to " Hawking Zhang
2020-04-20 10:16 ` [PATCH 8/8] drm/amdgpu: retire legacy vega10 sos version check Hawking Zhang
2020-04-20 12:55 ` [PATCH 0/8] psp code clean up Chen, Guchun
2020-04-21  6:49   ` Clements, John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587377804-3836-5-git-send-email-Hawking.Zhang@amd.com \
    --to=hawking.zhang@amd.com \
    --cc=Guchun.Chen@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=john.clements@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.