All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	tiwai@suse.de,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	broonie@kernel.org,
	Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Subject: [PATCH 07/24] ASoC: SOF: ext_manifest: parse compiler version
Date: Wed, 15 Apr 2020 15:27:59 -0500	[thread overview]
Message-ID: <20200415202816.934-8-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20200415202816.934-1-pierre-louis.bossart@linux.intel.com>

From: Karol Trzcinski <karolx.trzcinski@linux.intel.com>

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.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/uapi/sound/sof/ext_manifest.h |  8 ++++++++
 sound/soc/sof/loader.c                | 23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/include/uapi/sound/sof/ext_manifest.h b/include/uapi/sound/sof/ext_manifest.h
index 203c203f6531..d49c47d08c7f 100644
--- a/include/uapi/sound/sof/ext_manifest.h
+++ b/include/uapi/sound/sof/ext_manifest.h
@@ -56,6 +56,7 @@ struct sof_ext_man_header {
 enum sof_ext_man_elem_type {
 	SOF_EXT_MAN_ELEM_FW_VERSION		= 0,
 	SOF_EXT_MAN_ELEM_WINDOW			= SOF_IPC_EXT_WINDOW,
+	SOF_EXT_MAN_ELEM_CC_VERSION		= SOF_IPC_EXT_CC_INFO,
 };
 
 /* extended manifest element header */
@@ -80,4 +81,11 @@ struct sof_ext_man_window {
 	struct sof_ipc_window ipc_window;
 } __packed;
 
+/* Used C compiler description */
+struct sof_ext_man_cc_version {
+	struct sof_ext_man_elem_header hdr;
+	/* use sof_ipc struct because of code re-use */
+	struct sof_ipc_cc_version cc_version;
+} __packed;
+
 #endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */
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);
-- 
2.20.1


  parent reply	other threads:[~2020-04-15 20:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 20:27 [PATCH 00/24] ASoC: SOF: topology and firmware IPC updates for 5.8 Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 01/24] ASoC: SOF: topology: fix: handle DAI widget connections properly with multiple CPU DAI's Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 02/24] ASoC: SOF: Mark get_ext* function ext_hdr arguments as const Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 03/24] ASoC: SOF: Introduce offset in firmware data Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 04/24] ASoC: SOF: Introduce extended manifest Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 05/24] ASoC: SOF: ext_manifest: parse firmware version Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 06/24] ASoC: SOF: ext_manifest: parse windows Pierre-Louis Bossart
2020-04-15 20:27 ` Pierre-Louis Bossart [this message]
2020-04-15 20:28 ` [PATCH 08/24] ASoC: SOF: topology: Add support for DC Blocker Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 09/24] ASoC: SOF: add probe support extend data Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 10/24] ASoC: SOF: add debug ABI version Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 11/24] ASoC: SOF: change type char to uint8_t in info.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 12/24] ASoC: SOF: change type char to uint8_t in trace.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 13/24] ASoC: SOF: change type char to uint8_t in topology.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 14/24] ASoC: SOF: make sof_ipc_cc_version to fixed length Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 15/24] ASoC: SOF: Add XRUN flags field to struct sof_ipc_buffer Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 16/24] ASoC: SOF: Intel: Fix typo in header file comment text Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 17/24] ASoC: SOF: Intel: Change DMIC load IPC to fixed length Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 18/24] ASoC: SOF: Intel: Rename deprecated DMIC IPC struct field Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 19/24] ASoC: SOF: align sof_ipc_dai_alh_params with FW Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 20/24] ASoC: SOF: topology: Get ALH rate amd channels from topology Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 21/24] ASoC: SOF: topology: fix: parse hda_tokens to &config->hda Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 22/24] ASoC: SOF: topology: Get HDA rate and channels from topology Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 23/24] ASoC: SOF: topology: stop parsing when all tokens have been found Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 24/24] ASoC: SOF: topology: handle multiple sets of tuple arrays Pierre-Louis Bossart
2020-04-15 23:36 ` [PATCH 00/24] ASoC: SOF: topology and firmware IPC updates for 5.8 Mark Brown

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=20200415202816.934-8-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=karolx.trzcinski@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    /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.