mirror of https://github.com/thesofproject/sof.git
Fix IMR type parsing
The IMR type can be specified either in the TOML configuration file or on the command line. The command line value should override the one from the configuration file. But the current code overwrites the configuration file value with the default value even if no value has been specified on the command line, which is wrong. Fix this by using the default value when reading the configuration file and only overwriting it when the respective command line parameter is used. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
bdba8259fe
commit
f3eef3cfb6
|
@ -1579,7 +1579,8 @@ static int parse_adsp_file_ext_v1_8(const toml_table_t *toml, struct parse_ctx *
|
|||
out->ext_len = sizeof(struct sof_man_adsp_meta_file_ext_v1_8);
|
||||
|
||||
/* configurable fields */
|
||||
out->imr_type = parse_uint32_hex_key(adsp_file_ext, &ctx, "imr_type", 0, &ret);
|
||||
out->imr_type = parse_uint32_hex_key(adsp_file_ext, &ctx, "imr_type",
|
||||
MAN_DEFAULT_IMR_TYPE, &ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -1699,7 +1700,8 @@ static int parse_adsp_file_ext_v2_5(const toml_table_t *toml, struct parse_ctx *
|
|||
out->ext_len = sizeof(struct sof_man_adsp_meta_file_ext_v2_5);
|
||||
|
||||
/* configurable fields */
|
||||
out->imr_type = parse_uint32_hex_key(adsp_file_ext, &ctx, "imr_type", 0, &ret);
|
||||
out->imr_type = parse_uint32_hex_key(adsp_file_ext, &ctx, "imr_type",
|
||||
MAN_DEFAULT_IMR_TYPE, &ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
11
src/rimage.c
11
src/rimage.c
|
@ -43,6 +43,7 @@ int main(int argc, char *argv[])
|
|||
int imr_type = MAN_DEFAULT_IMR_TYPE;
|
||||
int use_ext_man = 0;
|
||||
unsigned int pv_bit = 0;
|
||||
bool imr_type_override = false;
|
||||
|
||||
memset(&image, 0, sizeof(image));
|
||||
|
||||
|
@ -68,6 +69,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
case 'i':
|
||||
imr_type = atoi(optarg);
|
||||
imr_type_override = true;
|
||||
break;
|
||||
case 'f':
|
||||
image.fw_ver_string = optarg;
|
||||
|
@ -170,17 +172,20 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* set IMR Type and the PV bit in found machine definition */
|
||||
if (image.adsp->man_v1_8) {
|
||||
image.adsp->man_v1_8->adsp_file_ext.imr_type = imr_type;
|
||||
if (imr_type_override)
|
||||
image.adsp->man_v1_8->adsp_file_ext.imr_type = imr_type;
|
||||
image.adsp->man_v1_8->css.reserved0 = pv_bit;
|
||||
}
|
||||
|
||||
if (image.adsp->man_v2_5) {
|
||||
image.adsp->man_v2_5->adsp_file_ext.imr_type = imr_type;
|
||||
if (imr_type_override)
|
||||
image.adsp->man_v2_5->adsp_file_ext.imr_type = imr_type;
|
||||
image.adsp->man_v2_5->css.reserved0 = pv_bit;
|
||||
}
|
||||
|
||||
if (image.adsp->man_ace_v1_5) {
|
||||
image.adsp->man_ace_v1_5->adsp_file_ext.imr_type = imr_type;
|
||||
if (imr_type_override)
|
||||
image.adsp->man_ace_v1_5->adsp_file_ext.imr_type = imr_type;
|
||||
image.adsp->man_ace_v1_5->css.reserved0 = pv_bit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue