Commit 3e2a89d3 authored by Karol Trzcinski's avatar Karol Trzcinski Committed by Mark Brown

ASoC: SOF: ext_manifest: parse firmware version

The firmware version 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: default avatarKarol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-4-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a80cf198
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/bits.h> #include <linux/bits.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/types.h> #include <linux/types.h>
#include <sound/sof/info.h>
/* In ASCII `XMan` */ /* In ASCII `XMan` */
#define SOF_EXT_MAN_MAGIC_NUMBER 0x6e614d58 #define SOF_EXT_MAN_MAGIC_NUMBER 0x6e614d58
...@@ -54,6 +55,11 @@ struct sof_ext_man_header { ...@@ -54,6 +55,11 @@ struct sof_ext_man_header {
/* Now define extended manifest elements */ /* Now define extended manifest elements */
/* Extended manifest elements types */
enum sof_ext_man_elem_type {
SOF_EXT_MAN_ELEM_FW_VERSION = 0,
};
/* extended manifest element header */ /* extended manifest element header */
struct sof_ext_man_elem_header { struct sof_ext_man_elem_header {
uint32_t type; /*< SOF_EXT_MAN_ELEM_ */ uint32_t type; /*< SOF_EXT_MAN_ELEM_ */
...@@ -62,4 +68,12 @@ struct sof_ext_man_elem_header { ...@@ -62,4 +68,12 @@ struct sof_ext_man_elem_header {
/* just after this header should be type dependent content */ /* just after this header should be type dependent content */
} __packed; } __packed;
/* FW version */
struct sof_ext_man_fw_version {
struct sof_ext_man_elem_header hdr;
/* use sof_ipc struct because of code re-use */
struct sof_ipc_fw_version version;
uint32_t flags;
} __packed;
#endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */ #endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */
...@@ -127,6 +127,19 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset) ...@@ -127,6 +127,19 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset)
} }
EXPORT_SYMBOL(snd_sof_fw_parse_ext_data); EXPORT_SYMBOL(snd_sof_fw_parse_ext_data);
static int ext_man_get_fw_version(struct snd_sof_dev *sdev,
const struct sof_ext_man_elem_header *hdr)
{
const struct sof_ext_man_fw_version *v =
container_of(hdr, struct sof_ext_man_fw_version, hdr);
memcpy(&sdev->fw_ready.version, &v->version, sizeof(v->version));
sdev->fw_ready.flags = v->flags;
/* log ABI versions and check FW compatibility */
return snd_sof_ipc_valid(sdev);
}
static ssize_t snd_sof_ext_man_size(const struct firmware *fw) static ssize_t snd_sof_ext_man_size(const struct firmware *fw)
{ {
const struct sof_ext_man_header *head; const struct sof_ext_man_header *head;
...@@ -197,6 +210,9 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev, ...@@ -197,6 +210,9 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
/* process structure data */ /* process structure data */
switch (elem_hdr->type) { switch (elem_hdr->type) {
case SOF_EXT_MAN_ELEM_FW_VERSION:
ret = ext_man_get_fw_version(sdev, elem_hdr);
break;
default: default:
dev_warn(sdev->dev, "warning: unknown sof_ext_man header type %d size 0x%X\n", dev_warn(sdev->dev, "warning: unknown sof_ext_man header type %d size 0x%X\n",
elem_hdr->type, elem_hdr->size); elem_hdr->type, elem_hdr->size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment