summaryrefslogtreecommitdiff
path: root/sound/soc/sof/loader.c
diff options
context:
space:
mode:
authorKarol Trzcinski <karolx.trzcinski@linux.intel.com>2020-04-15 23:27:59 +0300
committerMark Brown <broonie@kernel.org>2020-04-16 02:23:04 +0300
commit7c024b948c206935e69aafa56187bff9dd36abed (patch)
treec90aff3b7f41a0899d737fa09f1ee73b90e64357 /sound/soc/sof/loader.c
parent9e72f13ee541ccae34dd4a6735bcdf0c78090216 (diff)
downloadlinux-7c024b948c206935e69aafa56187bff9dd36abed.tar.xz
ASoC: SOF: ext_manifest: parse compiler version
The compiler version and description can be extracted from the extended manifest content. This information known at build time does not need to be provided in a mailbox. Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200415202816.934-8-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/loader.c')
-rw-r--r--sound/soc/sof/loader.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index bbfdf07fa6f5..8be30cd5e038 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -49,6 +49,14 @@ static int get_cc_info(struct snd_sof_dev *sdev,
const struct sof_ipc_cc_version *cc =
container_of(ext_hdr, struct sof_ipc_cc_version, ext_hdr);
+ if (sdev->cc_version) {
+ if (memcmp(sdev->cc_version, cc, cc->ext_hdr.hdr.size)) {
+ dev_err(sdev->dev, "error: receive diverged cc_version descriptions");
+ return -EINVAL;
+ }
+ return 0;
+ }
+
dev_dbg(sdev->dev, "Firmware info: used compiler %s %d:%d:%d%s used optimization flags %s\n",
cc->name, cc->major, cc->minor, cc->micro, cc->desc,
cc->optim);
@@ -161,6 +169,18 @@ static int ext_man_get_windows(struct snd_sof_dev *sdev,
return get_ext_windows(sdev, w_ipc);
}
+static int ext_man_get_cc_info(struct snd_sof_dev *sdev,
+ const struct sof_ext_man_elem_header *hdr)
+{
+ const struct sof_ext_man_cc_version *cc;
+ const struct sof_ipc_ext_data_hdr *cc_version;
+
+ cc = container_of(hdr, struct sof_ext_man_cc_version, hdr);
+ cc_version = (const struct sof_ipc_ext_data_hdr *)&cc->cc_version;
+
+ return get_cc_info(sdev, cc_version);
+}
+
static ssize_t snd_sof_ext_man_size(const struct firmware *fw)
{
const struct sof_ext_man_header *head = (void *)fw->data;
@@ -241,6 +261,9 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
case SOF_EXT_MAN_ELEM_WINDOW:
ret = ext_man_get_windows(sdev, elem_hdr);
break;
+ case SOF_EXT_MAN_ELEM_CC_VERSION:
+ ret = ext_man_get_cc_info(sdev, elem_hdr);
+ break;
default:
dev_warn(sdev->dev, "warning: unknown sof_ext_man header type %d size 0x%X\n",
elem_hdr->type, elem_hdr->size);