Skip to content

Commit e0cfedd

Browse files
committed
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>
1 parent 589d9d9 commit e0cfedd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

include/sound/sof/ext_manifest.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct sof_ext_man_header {
5959
enum sof_ext_man_elem_type {
6060
SOF_EXT_MAN_ELEM_FW_VERSION = 0,
6161
SOF_EXT_MAN_ELEM_WINDOW = SOF_IPC_EXT_WINDOW,
62+
SOF_EXT_MAN_ELEM_CC_VERSION = SOF_IPC_EXT_CC_INFO,
6263
};
6364

6465
/* extended manifest element header */
@@ -84,4 +85,11 @@ struct sof_ext_man_window {
8485
struct sof_ipc_window ipc_window;
8586
} __packed;
8687

88+
/* Used C compiler description */
89+
struct sof_ext_man_cc_version {
90+
struct sof_ext_man_elem_header hdr;
91+
/* use sof_ipc struct because of code re-use */
92+
struct sof_ipc_cc_version cc_version;
93+
} __packed;
94+
8795
#endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */

sound/soc/sof/loader.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ static int get_cc_info(struct snd_sof_dev *sdev,
4949
const struct sof_ipc_cc_version *cc =
5050
container_of(ext_hdr, struct sof_ipc_cc_version, ext_hdr);
5151

52+
if (sdev->cc_version) {
53+
if (memcmp(sdev->cc_version, cc, cc->ext_hdr.hdr.size)) {
54+
dev_err(sdev->dev, "error: receive diverged cc_version descriptions");
55+
return -EINVAL;
56+
}
57+
return 0;
58+
}
59+
5260
dev_dbg(sdev->dev, "Firmware info: used compiler %s %d:%d:%d%s used optimization flags %s\n",
5361
cc->name, cc->major, cc->minor, cc->micro, cc->desc,
5462
cc->optim);
@@ -158,6 +166,16 @@ static int ext_man_get_windows(struct snd_sof_dev *sdev,
158166
return get_ext_windows(sdev, &w->ipc_window.ext_hdr);
159167
}
160168

169+
static int ext_man_get_cc_info(struct snd_sof_dev *sdev,
170+
const struct sof_ext_man_elem_header *hdr)
171+
{
172+
const struct sof_ext_man_cc_version *cc;
173+
174+
cc = container_of(hdr, struct sof_ext_man_cc_version, hdr);
175+
176+
return get_cc_info(sdev, &cc->cc_version.ext_hdr);
177+
}
178+
161179
static ssize_t snd_sof_ext_man_size(const struct firmware *fw)
162180
{
163181
const struct sof_ext_man_header *head;
@@ -234,6 +252,9 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
234252
case SOF_EXT_MAN_ELEM_WINDOW:
235253
ret = ext_man_get_windows(sdev, elem_hdr);
236254
break;
255+
case SOF_EXT_MAN_ELEM_CC_VERSION:
256+
ret = ext_man_get_cc_info(sdev, elem_hdr);
257+
break;
237258
default:
238259
dev_warn(sdev->dev, "warning: unknown sof_ext_man header type %d size 0x%X\n",
239260
elem_hdr->type, elem_hdr->size);

0 commit comments

Comments
 (0)