Commit 7f09f79d authored by Karol Trzcinski's avatar Karol Trzcinski Committed by Mark Brown

ASoC: SOF: ext_manifest: Parse firmware config dictionary

Values given in this dictionary describes used firmware configuration,
like feature availability, buffer size limits and similar properties.
Signed-off-by: default avatarKarol Trzcinski <karolx.trzcinski@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20201124180017.2232128-2-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6a8b8b58
......@@ -61,6 +61,7 @@ enum sof_ext_man_elem_type {
SOF_EXT_MAN_ELEM_WINDOW = SOF_IPC_EXT_WINDOW,
SOF_EXT_MAN_ELEM_CC_VERSION = SOF_IPC_EXT_CC_INFO,
SOF_EXT_MAN_ELEM_DBG_ABI = SOF_IPC_EXT_USER_ABI_INFO,
SOF_EXT_MAN_ELEM_CONFIG_DATA = 5, /**< ABI3.17 */
};
/* extended manifest element header */
......@@ -99,4 +100,22 @@ struct ext_man_dbg_abi {
struct sof_ipc_user_abi_version dbg_abi;
} __packed;
/* EXT_MAN_ELEM_CONFIG_DATA elements identificators, ABI3.17 */
enum config_elem_type {
SOF_EXT_MAN_CONFIG_EMPTY = 0,
SOF_EXT_MAN_CONFIG_IPC_MSG_SIZE = 1,
};
struct sof_config_elem {
uint32_t token;
uint32_t value;
} __packed;
/* firmware configuration information */
struct sof_ext_man_config_data {
struct sof_ext_man_elem_header hdr;
struct sof_config_elem elems[];
} __packed;
#endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */
......@@ -197,6 +197,44 @@ static int ext_man_get_dbg_abi_info(struct snd_sof_dev *sdev,
return 0;
}
static int ext_man_get_config_data(struct snd_sof_dev *sdev,
const struct sof_ext_man_elem_header *hdr)
{
const struct sof_ext_man_config_data *config =
container_of(hdr, struct sof_ext_man_config_data, hdr);
const struct sof_config_elem *elem;
int elems_counter;
int elems_size;
int i;
/* calculate elements counter */
elems_size = config->hdr.size - sizeof(struct sof_ext_man_elem_header);
elems_counter = elems_size / sizeof(struct sof_config_elem);
dev_dbg(sdev->dev, "%s can hold up to %d config elements\n",
__func__, elems_counter);
for (i = 0; i < elems_counter; ++i) {
elem = &config->elems[i];
dev_dbg(sdev->dev, "%s get index %d token %d val %d\n",
__func__, i, elem->token, elem->value);
switch (elem->token) {
case SOF_EXT_MAN_CONFIG_EMPTY:
/* unused memory space is zero filled - mapped to EMPTY elements */
break;
case SOF_EXT_MAN_CONFIG_IPC_MSG_SIZE:
/* TODO: use ipc msg size from config data */
break;
default:
dev_info(sdev->dev, "Unknown firmware configuration token %d value %d",
elem->token, elem->value);
break;
}
}
return 0;
}
static ssize_t snd_sof_ext_man_size(const struct firmware *fw)
{
const struct sof_ext_man_header *head;
......@@ -279,6 +317,9 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
case SOF_EXT_MAN_ELEM_DBG_ABI:
ret = ext_man_get_dbg_abi_info(sdev, elem_hdr);
break;
case SOF_EXT_MAN_ELEM_CONFIG_DATA:
ret = ext_man_get_config_data(sdev, elem_hdr);
break;
default:
dev_info(sdev->dev, "unknown sof_ext_man header type %d size 0x%X\n",
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