summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>2026-07-01 15:25:08 +0530
committerMark Brown <broonie@kernel.org>2026-07-03 17:30:52 +0100
commitcbdafd2acdee72f698edd4ab9429bf1f7613ff94 (patch)
treeb9392b518f8c3f60025343c1eca398ccb5b2c428
parenta3674345f90226758b1dfd55c594cc3d4cdf80f6 (diff)
ASoC: SOF: amd: extend signed firmware pre-run for ACP7x
Parse SizeFWSigned from the ACP image header when loading signed firmware on ACP7.B/7.F platforms. Keep the legacy ACP_FIRMWARE_SIGNATURE subtraction for pre-7B platforms using quirks. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://patch.msgid.link/20260701095759.1012929-8-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sof/amd/acp-loader.c14
-rw-r--r--sound/soc/sof/amd/acp.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/sound/soc/sof/amd/acp-loader.c b/sound/soc/sof/amd/acp-loader.c
index 98324bbade15..af04f053fd65 100644
--- a/sound/soc/sof/amd/acp-loader.c
+++ b/sound/soc/sof/amd/acp-loader.c
@@ -14,6 +14,7 @@
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/unaligned.h>
#include "../ops.h"
#include "acp-dsp-offset.h"
@@ -173,10 +174,19 @@ int acp_dsp_pre_fw_run(struct snd_sof_dev *sdev)
adata = sdev->pdata->hw_pdata;
- if (adata->quirks && adata->quirks->signed_fw_image)
+ if (adata->pci_rev >= ACP7B_PCI_ID) {
+ if (adata->acp_sof_signed_firmware_image) {
+ size_fw = get_unaligned_le32(adata->bin_buf +
+ ACP_IMAGE_HDR_SIZE_FW_SIGNED_OFF);
+ size_fw += ACP_IMAGE_HEADER_SIZE;
+ } else {
+ size_fw = adata->fw_bin_size;
+ }
+ } else if (adata->quirks && adata->quirks->signed_fw_image) {
size_fw = adata->fw_bin_size - ACP_FIRMWARE_SIGNATURE;
- else
+ } else {
size_fw = adata->fw_bin_size;
+ }
page_count = PAGE_ALIGN(size_fw) >> PAGE_SHIFT;
adata->fw_bin_page_count = page_count;
diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h
index 46b946132de8..c2f3add05d0c 100644
--- a/sound/soc/sof/amd/acp.h
+++ b/sound/soc/sof/amd/acp.h
@@ -113,6 +113,9 @@
#define PROBE_STATUS_BIT BIT(31)
#define ACP_FIRMWARE_SIGNATURE 0x100
+#define ACP_IMAGE_HEADER_SIZE ACP_FIRMWARE_SIGNATURE
+#define ACP_IMAGE_HDR_SIZE_FW_SIGNED_OFF 0x14
+
#define ACP_ERROR_IRQ_MASK BIT(29)
#define ACP_SDW0_IRQ_MASK BIT(21)
#define ACP_SDW1_IRQ_MASK BIT(2)