firmware: cirrus: cs_dsp: Add long-offset WMDR blocks
Subsystems (2)
Richard Fitzgerald
maintainerv2 cover firmware: cirrus: cs_dsp: Add long-offset WMDR blocks
Version 3 of the WMDR file format introduces a new block type that has a 32-bit address offset.
The first patch of this series adds the support to the cs_dsp driver.
The rest of the series is adding KUnit tests for this.
Changes in V2:
- Fixed inconsistent commit title prefix on patch #8.
Richard Fitzgerald (8):
firmware: cs_dsp: Handle long-offset data blocks
firmware: cs_dsp: test_bin: Run test cases with v3 file format
firmware: cs_dsp: test_bin: Make patch function a test parameter
firmware: cs_dsp: mock_bin: Pass offset32 to
cs_dsp_mock_bin_add_raw_block()
firmware: cs_dsp: mock_bin: Add function to create long-offset patches
firmware: cs_dsp: test: Increase size of XM and YM on Halo Core
firmware: cs_dsp: test_bin: Run test cases on long-offset blocks
firmware: cs_dsp: test_bin: Add tests for offsets > 0xffff
drivers/firmware/cirrus/cs_dsp.c | 19 +- .../firmware/cirrus/test/cs_dsp_mock_bin.c | 38 +- .../cirrus/test/cs_dsp_mock_mem_maps.c | 8 +- .../firmware/cirrus/test/cs_dsp_mock_regmap.c | 16 +- .../firmware/cirrus/test/cs_dsp_test_bin.c | 1017 +++++++++++------ .../cirrus/test/cs_dsp_test_bin_error.c | 14 +- .../linux/firmware/cirrus/cs_dsp_test_utils.h | 6 +- include/linux/firmware/cirrus/wmfw.h | 7 +- 8 files changed, 731 insertions(+), 394 deletions(-)
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 1/8 firmware: cs_dsp: Handle long-offset data blocks
Handle a new type of data block that has a 32-bit offset. These are identical to the normal blocks except that the offset is now in the 32-bit field that was previously 'sr'.
A new file version of 3 indicates that it is mandatory to process the long-offset blocks, so that older code without that support will reject the file.
The original 'sr' field was never used by the driver so it has been renamed offset32.
---
No changes since V1.
drivers/firmware/cirrus/cs_dsp.c | 19 +++++++++++++++---- include/linux/firmware/cirrus/wmfw.h | 7 ++++++- 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/firmware/cirrus/cs_dsp.c +15 -4
@@ -2138,7 +2138,8 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmwareconst struct cs_dsp_region *mem;struct cs_dsp_alg_region *alg_region;const char *region_name; -int ret, pos, blocks, type, offset, reg, version; +int ret, pos, blocks, type, version; +unsigned int offset, reg;u8 *buf =NULL ;size_t buf_len =0 ;size_t region_len;
@@ -2163,6 +2164,7 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmwareswitch (be32_to_cpu (hdr->rev) &0xff ) {case 1 :case 2 : +case 3 :break ;default : cs_dsp_err(dsp, "%s: Unsupported coefficient file format %d\n",
@@ -2171,7 +2173,8 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware goto out_fw; } -cs_dsp_info (dsp,"%s: v%d.%d.%d\n" , file, +cs_dsp_info (dsp,"%s (v%d): v%d.%d.%d\n" , file, +be32_to_cpu (hdr->rev) &0xff , (le32_to_cpu (hdr->ver) >>16 ) &0xff , (le32_to_cpu (hdr->ver) >>8 ) &0xff ,le32_to_cpu (hdr->ver) &0xff );
@@ -2202,8 +2205,9 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware (le32_to_cpu (blk->ver) >>16 ) &0xff , (le32_to_cpu (blk->ver) >>8 ) &0xff , le32_to_cpu(blk->ver) & 0xff); -cs_dsp_dbg (dsp,"%s.%d: %d bytes at 0x%x in %x\n" , - file, blocks,le32_to_cpu (blk->len), offset, type); +cs_dsp_dbg (dsp,"%s.%d: %d bytes off:%#x off32:%#x in %#x\n" , + file, blocks,le32_to_cpu (blk->len), offset, +le32_to_cpu (blk->offset32), type); reg =0 ; region_name ="Unknown" ;
@@ -2236,6 +2240,13 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware }break ; +case WMFW_ADSP2_XM_LONG : +case WMFW_ADSP2_YM_LONG : +case WMFW_HALO_XM_PACKED_LONG : +case WMFW_HALO_YM_PACKED_LONG : + offset =le32_to_cpu (blk->offset32); + type &=0xff ;/* strip extended block type flags */ + fallthrough;case WMFW_ADSP1_DM :case WMFW_ADSP1_ZM :case WMFW_ADSP2_XM :
include/linux/firmware/cirrus/wmfw.h +6 -1
@@ -172,7 +172,7 @@ struct wmfw_coeff_item {__le16 type;__le32 id;__le32 ver; -__le32 sr; +__le32 offset32;__le32 len;u8 data[]; } __packed;
@@ -200,4 +200,9 @@ struct wmfw_coeff_item {#define WMFW_HALO_XM_PACKED 0x11#define WMFW_HALO_YM_PACKED 0x12 +#define WMFW_ADSP2_XM_LONG 0xf405 +#define WMFW_ADSP2_YM_LONG 0xf406 +#define WMFW_HALO_XM_PACKED_LONG 0xf411 +#define WMFW_HALO_YM_PACKED_LONG 0xf412 +#endif
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 2/8 firmware: cs_dsp: test_bin: Run test cases with v3 file format
In reply to Richard FitzgeraldThe new v3 file format has all the same functionality as the earlier formats, so run all the existing test cases with a file type of 3. This is only done for Halo Core because v3 files are not used with the older ADSP cores.
---
No changes since V1.
.../firmware/cirrus/test/cs_dsp_test_bin.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_bin.c +24 -6
@@ -2149,7 +2149,8 @@ static void bin_patch_name_and_info(struct kunit *test)KUNIT_EXPECT_EQ (test, reg_val, payload_data); } -static int cs_dsp_bin_test_common_init (struct kunit *test,struct cs_dsp *dsp) +static int cs_dsp_bin_test_common_init (struct kunit *test,struct cs_dsp *dsp, +int wmdr_ver) {struct cs_dsp_test *priv;struct cs_dsp_mock_xm_header *xm_hdr;
@@ -2197,7 +2198,7 @@ static int cs_dsp_bin_test_common_init(struct kunit *test, struct cs_dsp *dsp)KUNIT_ASSERT_EQ (test, ret,0 ); priv->local->bin_builder = -cs_dsp_mock_bin_init (priv,1 , +cs_dsp_mock_bin_init (priv, wmdr_ver,cs_dsp_mock_xm_header_get_fw_version (xm_hdr));KUNIT_ASSERT_NOT_ERR_OR_NULL (test, priv->local->bin_builder);
@@ -2227,7 +2228,7 @@ static int cs_dsp_bin_test_common_init(struct kunit *test, struct cs_dsp *dsp)return kunit_add_action_or_reset (priv->test, _cs_dsp_remove_wrapper, dsp); } -static int cs_dsp_bin_test_halo_init (struct kunit *test) +static int cs_dsp_bin_test_halo_init_common (struct kunit *test,int wmdr_ver) {struct cs_dsp *dsp;
@@ -2243,7 +2244,17 @@ static int cs_dsp_bin_test_halo_init(struct kunit *test) dsp->base = cs_dsp_mock_halo_core_base; dsp->base_sysinfo = cs_dsp_mock_halo_sysinfo_base; -return cs_dsp_bin_test_common_init (test, dsp); +return cs_dsp_bin_test_common_init (test, dsp, wmdr_ver); +} + +static int cs_dsp_bin_test_halo_init (struct kunit *test) +{ +return cs_dsp_bin_test_halo_init_common (test,1 ); +} + +static int cs_dsp_bin_test_halo_wmdr3_init (struct kunit *test) +{ +return cs_dsp_bin_test_halo_init_common (test,3 ); }static int cs_dsp_bin_test_adsp2_32bit_init (struct kunit *test)
@@ -2262,7 +2273,7 @@ static int cs_dsp_bin_test_adsp2_32bit_init(struct kunit *test) dsp->num_mems =cs_dsp_mock_count_regions (cs_dsp_mock_adsp2_32bit_dsp1_region_sizes); dsp->base = cs_dsp_mock_adsp2_32bit_sysbase; -return cs_dsp_bin_test_common_init (test, dsp); +return cs_dsp_bin_test_common_init (test, dsp,1 ); }static int cs_dsp_bin_test_adsp2_16bit_init (struct kunit *test)
@@ -2281,7 +2292,7 @@ static int cs_dsp_bin_test_adsp2_16bit_init(struct kunit *test) dsp->num_mems =cs_dsp_mock_count_regions (cs_dsp_mock_adsp2_16bit_dsp1_region_sizes); dsp->base = cs_dsp_mock_adsp2_16bit_sysbase; -return cs_dsp_bin_test_common_init (test, dsp); +return cs_dsp_bin_test_common_init (test, dsp,1 ); }/* Parameterize on choice of XM or YM with a range of word offsets */
@@ -2539,6 +2550,12 @@ static struct kunit_suite cs_dsp_bin_test_halo = { .test_cases = cs_dsp_bin_test_cases_halo, }; +static struct kunit_suite cs_dsp_bin_test_halo_wmdr3 = { + .name ="cs_dsp_bin_halo_wmdr_v3" , + .init = cs_dsp_bin_test_halo_wmdr3_init, + .test_cases = cs_dsp_bin_test_cases_halo, +}; +static struct kunit_suite cs_dsp_bin_test_adsp2_32bit = { .name ="cs_dsp_bin_adsp2_32bit" , .init = cs_dsp_bin_test_adsp2_32bit_init,
@@ -2552,5 +2569,6 @@ static struct kunit_suite cs_dsp_bin_test_adsp2_16bit = { };kunit_test_suites (&cs_dsp_bin_test_halo, + &cs_dsp_bin_test_halo_wmdr3, &cs_dsp_bin_test_adsp2_32bit, &cs_dsp_bin_test_adsp2_16bit);
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 3/8 firmware: cs_dsp: test_bin: Make patch function a test parameter
In reply to Richard FitzgeraldMake the call to cs_dsp_mock_bin_add_patch() a function pointer in the test case parameters, instead of calling it directly.
This is to allow for future parameterization by which function to call to add a patch.
---
No changes since V1.
.../firmware/cirrus/test/cs_dsp_test_bin.c | 708 +++++++++--------- 1 file changed, 357 insertions(+), 351 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_bin.c +357 -351
@@ -69,6 +69,10 @@ struct bin_test_param {int mem_type;unsigned int offset_words;int alg_idx; +void (*add_patch)(struct cs_dsp_mock_bin_builder *builder, +unsigned int alg_id,unsigned int alg_ver, +int mem_region,unsigned int reg_addr_offset, +const void *payload_data,size_t payload_len_bytes); };static const struct cs_dsp_mock_alg_def bin_test_mock_algs[] = {
@@ -128,12 +132,12 @@ static void bin_patch_one_word(struct kunit *test) bin_test_mock_algs[param->alg_idx].id, param->mem_type); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - param->offset_words * reg_inc_per_word, - &payload_data,sizeof (payload_data)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + param->offset_words * reg_inc_per_word, + &payload_data,sizeof (payload_data)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -177,12 +181,12 @@ static void bin_patch_one_multiword(struct kunit *test) bin_test_mock_algs[param->alg_idx].id, param->mem_type); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - param->offset_words * reg_inc_per_word, - payload_data,sizeof (payload_data)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + param->offset_words * reg_inc_per_word, + payload_data,sizeof (payload_data)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -228,12 +232,12 @@ static void bin_patch_multi_oneword(struct kunit *test)/* Add one payload per word */ for (i =0 ; i <ARRAY_SIZE (payload_data); ++i) { -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (param->offset_words + i) * reg_inc_per_word, - &payload_data[i],sizeof (payload_data[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (param->offset_words + i) * reg_inc_per_word, + &payload_data[i],sizeof (payload_data[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -285,13 +289,13 @@ static void bin_patch_multi_oneword_unordered(struct kunit *test)/* Add one payload per word */ for (i =0 ; i <ARRAY_SIZE (word_order); ++i) { -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (param->offset_words + word_order[i]) * - reg_inc_per_word, - &payload_data[word_order[i]],sizeof (payload_data[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (param->offset_words + word_order[i]) * + reg_inc_per_word, + &payload_data[word_order[i]],sizeof (payload_data[0 ])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -346,12 +350,12 @@ static void bin_patch_multi_oneword_sparse_unordered(struct kunit *test)/* Add one payload per word */ for (i =0 ; i <ARRAY_SIZE (word_offsets); ++i) { -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - word_offsets[i] * reg_inc_per_word, - &payload_data[i],sizeof (payload_data[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + word_offsets[i] * reg_inc_per_word, + &payload_data[i],sizeof (payload_data[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -413,27 +417,27 @@ static void bin_patch_one_word_multiple_mems(struct kunit *test) }/* Add words to XM, YM and ZM */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, -WMFW_ADSP2_XM , - param->offset_words * reg_inc_per_word, - &payload_data[0 ],sizeof (payload_data[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, +WMFW_ADSP2_XM , + param->offset_words * reg_inc_per_word, + &payload_data[0 ],sizeof (payload_data[0 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, -WMFW_ADSP2_YM , - param->offset_words * reg_inc_per_word, - &payload_data[1 ],sizeof (payload_data[1 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, +WMFW_ADSP2_YM , + param->offset_words * reg_inc_per_word, + &payload_data[1 ],sizeof (payload_data[1 ]));if (cs_dsp_mock_has_zm (priv)) { -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, -WMFW_ADSP2_ZM , - param->offset_words * reg_inc_per_word, - &payload_data[2 ],sizeof (payload_data[2 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, +WMFW_ADSP2_ZM , + param->offset_words * reg_inc_per_word, + &payload_data[2 ],sizeof (payload_data[2 ])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -502,12 +506,12 @@ static void bin_patch_one_word_multiple_algs(struct kunit *test)for (i =0 ; i <ARRAY_SIZE (bin_test_mock_algs); ++i) { reg_inc_per_word =cs_dsp_mock_reg_addr_inc_per_unpacked_word (priv); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[i].id, - bin_test_mock_algs[i].ver, - param->mem_type, - param->offset_words * reg_inc_per_word, - &payload_data[i],sizeof (payload_data[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[i].id, + bin_test_mock_algs[i].ver, + param->mem_type, + param->offset_words * reg_inc_per_word, + &payload_data[i],sizeof (payload_data[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -565,12 +569,12 @@ static void bin_patch_one_word_multiple_algs_unordered(struct kunit *test) alg_idx = alg_order[i]; reg_inc_per_word =cs_dsp_mock_reg_addr_inc_per_unpacked_word (priv); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[alg_idx].id, - bin_test_mock_algs[alg_idx].ver, - param->mem_type, - param->offset_words * reg_inc_per_word, - &payload_data[i],sizeof (payload_data[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[alg_idx].id, + bin_test_mock_algs[alg_idx].ver, + param->mem_type, + param->offset_words * reg_inc_per_word, + &payload_data[i],sizeof (payload_data[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -628,12 +632,12 @@ static void bin_patch_1_packed(struct kunit *test) patch_pos_words =round_up (alg_base_words + param->offset_words,4 ); patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -688,20 +692,20 @@ static void bin_patch_1_packed_1_single_trailing(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words);/* Patch packed block */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload));/* ... and the unpacked word following that */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +4 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +4 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -768,27 +772,27 @@ static void bin_patch_1_packed_2_single_trailing(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words);/* Patch packed block */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload));/* ... and the unpacked words following that */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +4 ) - alg_base_words) *4 , - &unpacked_payloads[0 ],sizeof (unpacked_payloads[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +4 ) - alg_base_words) *4 , + &unpacked_payloads[0 ],sizeof (unpacked_payloads[0 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +5 ) - alg_base_words) *4 , - &unpacked_payloads[1 ],sizeof (unpacked_payloads[1 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +5 ) - alg_base_words) *4 , + &unpacked_payloads[1 ],sizeof (unpacked_payloads[1 ])); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -857,34 +861,34 @@ static void bin_patch_1_packed_3_single_trailing(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words);/* Patch packed block */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload));/* ... and the unpacked words following that */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +4 ) - alg_base_words) *4 , - &unpacked_payloads[0 ],sizeof (unpacked_payloads[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +4 ) - alg_base_words) *4 , + &unpacked_payloads[0 ],sizeof (unpacked_payloads[0 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +5 ) - alg_base_words) *4 , - &unpacked_payloads[1 ],sizeof (unpacked_payloads[1 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +5 ) - alg_base_words) *4 , + &unpacked_payloads[1 ],sizeof (unpacked_payloads[1 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +6 ) - alg_base_words) *4 , - &unpacked_payloads[2 ],sizeof (unpacked_payloads[2 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +6 ) - alg_base_words) *4 , + &unpacked_payloads[2 ],sizeof (unpacked_payloads[2 ])); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -953,20 +957,20 @@ static void bin_patch_1_packed_2_trailing(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words);/* Patch packed block */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload));/* ... and the unpacked words following that */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +4 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +4 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1035,20 +1039,20 @@ static void bin_patch_1_packed_3_trailing(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words);/* Patch packed block */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload));/* ... and the unpacked words following that */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((patch_pos_words +4 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((patch_pos_words +4 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1117,20 +1121,20 @@ static void bin_patch_1_single_leading_1_packed(struct kunit *test) packed_patch_pos_words =round_up (alg_base_words + param->offset_words,4 ) +4 ;/* Patch the leading unpacked word */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -1 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -1 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload));/* ... then the packed block */ patch_pos_in_packed_regs =_num_words_to_num_packed_regs (packed_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1196,26 +1200,26 @@ static void bin_patch_2_single_leading_1_packed(struct kunit *test) packed_patch_pos_words =round_up (alg_base_words + param->offset_words,4 ) +4 ;/* Patch the leading unpacked words */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -2 ) - alg_base_words) *4 , - &unpacked_payload[0 ],sizeof (unpacked_payload[0 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -1 ) - alg_base_words) *4 , - &unpacked_payload[1 ],sizeof (unpacked_payload[1 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -2 ) - alg_base_words) *4 , + &unpacked_payload[0 ],sizeof (unpacked_payload[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -1 ) - alg_base_words) *4 , + &unpacked_payload[1 ],sizeof (unpacked_payload[1 ]));/* ... then the packed block */ patch_pos_in_packed_regs =_num_words_to_num_packed_regs (packed_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1283,20 +1287,20 @@ static void bin_patch_2_leading_1_packed(struct kunit *test) packed_patch_pos_words =round_up (alg_base_words + param->offset_words,4 ) +4 ;/* Patch the leading unpacked words */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -2 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -2 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload));/* ... then the packed block */ patch_pos_in_packed_regs =_num_words_to_num_packed_regs (packed_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1364,32 +1368,32 @@ static void bin_patch_3_single_leading_1_packed(struct kunit *test) packed_patch_pos_words =round_up (alg_base_words + param->offset_words,4 ) +4 ;/* Patch the leading unpacked words */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -3 ) - alg_base_words) *4 , - &unpacked_payload[0 ],sizeof (unpacked_payload[0 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -2 ) - alg_base_words) *4 , - &unpacked_payload[1 ],sizeof (unpacked_payload[1 ])); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -1 ) - alg_base_words) *4 , - &unpacked_payload[2 ],sizeof (unpacked_payload[2 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -3 ) - alg_base_words) *4 , + &unpacked_payload[0 ],sizeof (unpacked_payload[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -2 ) - alg_base_words) *4 , + &unpacked_payload[1 ],sizeof (unpacked_payload[1 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -1 ) - alg_base_words) *4 , + &unpacked_payload[2 ],sizeof (unpacked_payload[2 ]));/* ... then the packed block */ patch_pos_in_packed_regs =_num_words_to_num_packed_regs (packed_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1457,20 +1461,20 @@ static void bin_patch_3_leading_1_packed(struct kunit *test) packed_patch_pos_words =round_up (alg_base_words + param->offset_words,4 ) +4 ;/* Patch the leading unpacked words */ -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - unpacked_mem_type, - ((packed_patch_pos_words -3 ) - alg_base_words) *4 , - unpacked_payload,sizeof (unpacked_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + unpacked_mem_type, + ((packed_patch_pos_words -3 ) - alg_base_words) *4 , + unpacked_payload,sizeof (unpacked_payload));/* ... then the packed block */ patch_pos_in_packed_regs =_num_words_to_num_packed_regs (packed_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - &packed_payload,sizeof (packed_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + &packed_payload,sizeof (packed_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1537,12 +1541,12 @@ static void bin_patch_multi_onepacked(struct kunit *test)for (i =0 ; i <ARRAY_SIZE (packed_payloads); ++i) { patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words + (i *4 )); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - payload_offset, - &packed_payloads[i],sizeof (packed_payloads[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + payload_offset, + &packed_payloads[i],sizeof (packed_payloads[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -1602,13 +1606,13 @@ static void bin_patch_multi_onepacked_unordered(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words + (payload_order[i] *4 )); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - payload_offset, - &packed_payloads[payload_order[i]], -sizeof (packed_payloads[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + payload_offset, + &packed_payloads[payload_order[i]], +sizeof (packed_payloads[0 ])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -1665,13 +1669,13 @@ static void bin_patch_multi_onepacked_sparse_unordered(struct kunit *test) patch_pos_words =round_up (alg_base_words + word_offsets[i],4 ); patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, - param->mem_type, - payload_offset, - &packed_payloads[i], -sizeof (packed_payloads[0 ])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, + param->mem_type, + payload_offset, + &packed_payloads[i], +sizeof (packed_payloads[0 ])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -1737,21 +1741,21 @@ static void bin_patch_1_packed_multiple_mems(struct kunit *test)/* Add XM and YM patches */ alg_base_in_packed_regs =_num_words_to_num_packed_regs (alg_xm_base_words); patch_pos_in_packed_regs =_num_words_to_num_packed_regs (xm_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, -WMFW_HALO_XM_PACKED , - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - packed_xm_payload,sizeof (packed_xm_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, +WMFW_HALO_XM_PACKED , + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + packed_xm_payload,sizeof (packed_xm_payload)); alg_base_in_packed_regs =_num_words_to_num_packed_regs (alg_ym_base_words); patch_pos_in_packed_regs =_num_words_to_num_packed_regs (ym_patch_pos_words); -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[param->alg_idx].id, - bin_test_mock_algs[param->alg_idx].ver, -WMFW_HALO_YM_PACKED , - (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , - packed_ym_payload,sizeof (packed_ym_payload)); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[param->alg_idx].id, + bin_test_mock_algs[param->alg_idx].ver, +WMFW_HALO_YM_PACKED , + (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 , + packed_ym_payload,sizeof (packed_ym_payload)); fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder); KUNIT_ASSERT_EQ(test,
@@ -1821,12 +1825,12 @@ static void bin_patch_1_packed_multiple_algs(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[i].id, - bin_test_mock_algs[i].ver, - param->mem_type, - payload_offset, - packed_payload[i],sizeof (packed_payload[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[i].id, + bin_test_mock_algs[i].ver, + param->mem_type, + payload_offset, + packed_payload[i],sizeof (packed_payload[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -1907,12 +1911,12 @@ static void bin_patch_1_packed_multiple_algs_unordered(struct kunit *test) patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[alg_idx].id, - bin_test_mock_algs[alg_idx].ver, - param->mem_type, - payload_offset, - packed_payload[i],sizeof (packed_payload[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[alg_idx].id, + bin_test_mock_algs[alg_idx].ver, + param->mem_type, + payload_offset, + packed_payload[i],sizeof (packed_payload[i])); } fw =cs_dsp_mock_bin_get_firmware (priv->local->bin_builder);
@@ -2004,22 +2008,22 @@ static void bin_patch_mixed_packed_unpacked_random(struct kunit *test) alg_base_in_packed_regs =_num_words_to_num_packed_regs (alg_base_words); patch_pos_in_packed_regs =_num_words_to_num_packed_regs (patch_pos_words); payload_offset = (patch_pos_in_packed_regs - alg_base_in_packed_regs) *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[0 ].id, - bin_test_mock_algs[0 ].ver, - param->mem_type, - payload_offset, - payload->packed[i], -sizeof (payload->packed[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[0 ].id, + bin_test_mock_algs[0 ].ver, + param->mem_type, + payload_offset, + payload->packed[i], +sizeof (payload->packed[i])); }else { payload_offset = offset_words[i] *4 ; -cs_dsp_mock_bin_add_patch (priv->local->bin_builder, - bin_test_mock_algs[0 ].id, - bin_test_mock_algs[0 ].ver, - unpacked_mem_type, - payload_offset, - &payload->unpacked[i], -sizeof (payload->unpacked[i])); + param->add_patch (priv->local->bin_builder, + bin_test_mock_algs[0 ].id, + bin_test_mock_algs[0 ].ver, + unpacked_mem_type, + payload_offset, + &payload->unpacked[i], +sizeof (payload->unpacked[i])); } }
@@ -2295,53 +2299,55 @@ static int cs_dsp_bin_test_adsp2_16bit_init(struct kunit *test)return cs_dsp_bin_test_common_init (test, dsp,1 ); } +#define WMDR_PATCH_SHORT .add_patch = cs_dsp_mock_bin_add_patch +/* Parameterize on choice of XM or YM with a range of word offsets */ static const struct bin_test_param x_or_y_and_offset_param_cases[] = { - { .mem_type =WMFW_ADSP2_XM , .offset_words =0 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =1 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =2 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =3 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =4 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =23 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =22 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =21 }, - { .mem_type =WMFW_ADSP2_XM , .offset_words =20 }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =3 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =4 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =23 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =22 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =21 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =20 ,WMDR_PATCH_SHORT }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =0 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =1 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =2 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =3 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =4 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =23 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =22 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =21 }, - { .mem_type =WMFW_ADSP2_YM , .offset_words =20 }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =3 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =4 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =23 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =22 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =21 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =20 ,WMDR_PATCH_SHORT }, };/* Parameterize on ZM with a range of word offsets */ static const struct bin_test_param z_and_offset_param_cases[] = { - { .mem_type =WMFW_ADSP2_ZM , .offset_words =0 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =1 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =2 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =3 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =4 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =23 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =22 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =21 }, - { .mem_type =WMFW_ADSP2_ZM , .offset_words =20 }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =3 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =4 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =23 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =22 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =21 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .offset_words =20 ,WMDR_PATCH_SHORT }, };/* Parameterize on choice of packed XM or YM with a range of word offsets */ static const struct bin_test_param packed_x_or_y_and_offset_param_cases[] = { - { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 }, - { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =4 }, - { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =8 }, - { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =12 }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =4 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =8 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =12 ,WMDR_PATCH_SHORT }, - { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 }, - { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =4 }, - { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =8 }, - { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =12 }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =4 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =8 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =12 ,WMDR_PATCH_SHORT }, }; static void x_or_y_or_z_and_offset_param_desc(const struct bin_test_param *param,
@@ -2366,8 +2372,8 @@ KUNIT_ARRAY_PARAM(packed_x_or_y_and_offset,/* Parameterize on choice of packed XM or YM */ static const struct bin_test_param packed_x_or_y_param_cases[] = { - { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 }, - { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, }; static void x_or_y_or_z_param_desc(const struct bin_test_param *param,
@@ -2379,15 +2385,15 @@ static void x_or_y_or_z_param_desc(const struct bin_test_param *param,KUNIT_ARRAY_PARAM (packed_x_or_y, packed_x_or_y_param_cases, x_or_y_or_z_param_desc);static const struct bin_test_param offset_param_cases[] = { - { .offset_words =0 }, - { .offset_words =1 }, - { .offset_words =2 }, - { .offset_words =3 }, - { .offset_words =4 }, - { .offset_words =23 }, - { .offset_words =22 }, - { .offset_words =21 }, - { .offset_words =20 }, + { .offset_words =0 ,WMDR_PATCH_SHORT }, + { .offset_words =1 ,WMDR_PATCH_SHORT }, + { .offset_words =2 ,WMDR_PATCH_SHORT }, + { .offset_words =3 ,WMDR_PATCH_SHORT }, + { .offset_words =4 ,WMDR_PATCH_SHORT }, + { .offset_words =23 ,WMDR_PATCH_SHORT }, + { .offset_words =22 ,WMDR_PATCH_SHORT }, + { .offset_words =21 ,WMDR_PATCH_SHORT }, + { .offset_words =20 ,WMDR_PATCH_SHORT }, };static void offset_param_desc (const struct bin_test_param *param,char *desc)
@@ -2398,10 +2404,10 @@ static void offset_param_desc(const struct bin_test_param *param, char *desc)KUNIT_ARRAY_PARAM (offset, offset_param_cases, offset_param_desc);static const struct bin_test_param alg_param_cases[] = { - { .alg_idx =0 }, - { .alg_idx =1 }, - { .alg_idx =2 }, - { .alg_idx =3 }, + { .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .alg_idx =3 ,WMDR_PATCH_SHORT }, };static void alg_param_desc (const struct bin_test_param *param,char *desc)
@@ -2415,15 +2421,15 @@ static void alg_param_desc(const struct bin_test_param *param, char *desc)KUNIT_ARRAY_PARAM (alg, alg_param_cases, alg_param_desc);static const struct bin_test_param x_or_y_and_alg_param_cases[] = { - { .mem_type =WMFW_ADSP2_XM , .alg_idx =0 }, - { .mem_type =WMFW_ADSP2_XM , .alg_idx =1 }, - { .mem_type =WMFW_ADSP2_XM , .alg_idx =2 }, - { .mem_type =WMFW_ADSP2_XM , .alg_idx =3 }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =3 ,WMDR_PATCH_SHORT }, - { .mem_type =WMFW_ADSP2_YM , .alg_idx =0 }, - { .mem_type =WMFW_ADSP2_YM , .alg_idx =1 }, - { .mem_type =WMFW_ADSP2_YM , .alg_idx =2 }, - { .mem_type =WMFW_ADSP2_YM , .alg_idx =3 }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =3 ,WMDR_PATCH_SHORT }, };static void x_or_y_or_z_and_alg_param_desc (const struct bin_test_param *param,char *desc)
@@ -2438,24 +2444,24 @@ static void x_or_y_or_z_and_alg_param_desc(const struct bin_test_param *param, cKUNIT_ARRAY_PARAM (x_or_y_and_alg, x_or_y_and_alg_param_cases, x_or_y_or_z_and_alg_param_desc);static const struct bin_test_param z_and_alg_param_cases[] = { - { .mem_type =WMFW_ADSP2_ZM , .alg_idx =0 }, - { .mem_type =WMFW_ADSP2_ZM , .alg_idx =1 }, - { .mem_type =WMFW_ADSP2_ZM , .alg_idx =2 }, - { .mem_type =WMFW_ADSP2_ZM , .alg_idx =3 }, + { .mem_type =WMFW_ADSP2_ZM , .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_ADSP2_ZM , .alg_idx =3 ,WMDR_PATCH_SHORT }, };KUNIT_ARRAY_PARAM (z_and_alg, z_and_alg_param_cases, x_or_y_or_z_and_alg_param_desc);static const struct bin_test_param packed_x_or_y_and_alg_param_cases[] = { - { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =0 }, - { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =1 }, - { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =2 }, - { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =3 }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =3 ,WMDR_PATCH_SHORT }, - { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =0 }, - { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =1 }, - { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =2 }, - { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =3 }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =0 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =1 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =2 ,WMDR_PATCH_SHORT }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =3 ,WMDR_PATCH_SHORT }, }; KUNIT_ARRAY_PARAM(packed_x_or_y_and_alg, packed_x_or_y_and_alg_param_cases,
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 4/8 firmware: cs_dsp: mock_bin: Pass offset32 to cs_dsp_mock_bin_add_raw_block()
In reply to Richard FitzgeraldAdd an argument to cs_dsp_mock_bin_add_raw_block() to pass a 32-bit offset, and change the type of the existing offset argument to u16.
The cs_dsp_test_bin_error.c test uses cs_dsp_mock_bin_add_raw_block() so it needs corresponding updates to pass 0 as the 32-bit offset.
Version 1 and 2 of the bin file format had a 16-bit offset on blocks and the sample rate field of the blocks was not used. Version 3 adds new block types that change the old sample rate field to be a 32-bit offset with the old offset currently unused.
cs_dsp_mock_bin_add_raw_block() doesn't attempt to do any magic - its purpose is to create a raw block exactly as specified by the calling test code. So the test case can pass a value for both offset fields.
---
No changes since V1.
drivers/firmware/cirrus/test/cs_dsp_mock_bin.c | 10 ++++++---- .../firmware/cirrus/test/cs_dsp_test_bin_error.c | 14 +++++++------- include/linux/firmware/cirrus/cs_dsp_test_utils.h | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_mock_bin.c +6 -4
@@ -56,13 +56,14 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_mock_bin_get_firmware, "FW_CS_DSP_KUNIT_TEST_UTILS")* @alg_id: Algorithm ID. * @alg_ver: Algorithm version. * @type: Type of the block. -* @offset: Offset. +* @offset: 16-bit offset. +* @offset32: 32-bit offset (sample rate on V1 and V2 file formats). * @payload_data: Pointer to buffer containing the payload data. * @payload_len_bytes: Length of payload data in bytes. */ void cs_dsp_mock_bin_add_raw_block (struct cs_dsp_mock_bin_builder *builder,unsigned int alg_id,unsigned int alg_ver, -int type,unsigned int offset, +int type,u16 offset,u32 offset32,const void *payload_data,size_t payload_len_bytes) {struct wmfw_coeff_item *item;
@@ -75,6 +76,7 @@ void cs_dsp_mock_bin_add_raw_block(struct cs_dsp_mock_bin_builder *builder, item = builder->write_p; item->offset =cpu_to_le16 (offset); + item->offset32 =cpu_to_le32 (offset32); item->type =cpu_to_le16 (type); item->id =cpu_to_le32 (alg_id); item->ver =cpu_to_le32 (alg_ver <<8 );
@@ -104,7 +106,7 @@ static void cs_dsp_mock_bin_add_name_or_info(struct cs_dsp_mock_bin_builder *bui info = tmp; } -cs_dsp_mock_bin_add_raw_block (builder,0 ,0 ,WMFW_INFO_TEXT ,0 , info, info_len); +cs_dsp_mock_bin_add_raw_block (builder,0 ,0 ,WMFW_INFO_TEXT ,0 ,0 , info, info_len);kunit_kfree (builder->test_priv->test, tmp); }
@@ -156,7 +158,7 @@ void cs_dsp_mock_bin_add_patch(struct cs_dsp_mock_bin_builder *builder,KUNIT_ASSERT_EQ (builder->test_priv->test, payload_len_bytes %4 ,0 );cs_dsp_mock_bin_add_raw_block (builder, alg_id, alg_ver, - mem_region, reg_addr_offset, + mem_region, (u16 )reg_addr_offset,0 , payload_data, payload_len_bytes); }EXPORT_SYMBOL_NS_GPL (cs_dsp_mock_bin_add_patch,"FW_CS_DSP_KUNIT_TEST_UTILS" );
drivers/firmware/cirrus/test/cs_dsp_test_bin_error.c +7 -7
@@ -66,24 +66,24 @@ static void bin_load_with_unknown_blocks(struct kunit *test)cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, -0xf5 ,0 , +0xf5 ,0 ,0 , random_data,sizeof (random_data));cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, -0xf500 ,0 , +0xf500 ,0 ,0 , random_data,sizeof (random_data));cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, -0xc300 ,0 , +0xc300 ,0 ,0 , random_data,sizeof (random_data));/* Add a single payload to be written to DSP memory */ cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, -WMFW_ADSP2_YM ,0 , +WMFW_ADSP2_YM ,0 ,0 , payload_data, payload_size_bytes); bin =cs_dsp_mock_bin_get_firmware (local->bin_builder);
@@ -277,7 +277,7 @@ static void bin_too_short_for_block_header(struct kunit *test)cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, - param->block_type,0 , + param->block_type,0 ,0 ,NULL ,0 ); bin =cs_dsp_mock_bin_get_firmware (local->bin_builder);
@@ -309,7 +309,7 @@ static void bin_too_short_for_block_payload(struct kunit *test)cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, - param->block_type,0 , + param->block_type,0 ,0 , payload,sizeof (payload)); bin =cs_dsp_mock_bin_get_firmware (local->bin_builder);
@@ -341,7 +341,7 @@ static void bin_block_payload_len_garbage(struct kunit *test)cs_dsp_mock_bin_add_raw_block (local->bin_builder, cs_dsp_bin_err_test_mock_algs[0 ].id, cs_dsp_bin_err_test_mock_algs[0 ].ver, - param->block_type,0 , + param->block_type,0 ,0 , &payload,sizeof (payload)); bin =cs_dsp_mock_bin_get_firmware (local->bin_builder);
include/linux/firmware/cirrus/cs_dsp_test_utils.h +1 -1
@@ -126,7 +126,7 @@ struct cs_dsp_mock_bin_builder *cs_dsp_mock_bin_init(struct cs_dsp_test *priv, unsigned int fw_version);void cs_dsp_mock_bin_add_raw_block (struct cs_dsp_mock_bin_builder *builder,unsigned int alg_id,unsigned int alg_ver, -int type,unsigned int offset, +int type,u16 offset,u32 offset32,const void *payload_data,size_t payload_len_bytes);void cs_dsp_mock_bin_add_info (struct cs_dsp_mock_bin_builder *builder,const char *info);
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 5/8 firmware: cs_dsp: mock_bin: Add function to create long-offset patches
In reply to Richard FitzgeraldAdd cs_dsp_mock_bin_add_patch_off32(). This is the same as cs_dsp_mock_bin_add_patch() except that it puts the offset in the new 32-bit offset field and modifies the block type to indicate that it uses the long offset.
---
No changes since V1.
.../firmware/cirrus/test/cs_dsp_mock_bin.c | 28 +++++++++++++++++++ .../linux/firmware/cirrus/cs_dsp_test_utils.h | 4 +++ 2 files changed, 32 insertions(+)
drivers/firmware/cirrus/test/cs_dsp_mock_bin.c +28 -0
@@ -163,6 +163,34 @@ void cs_dsp_mock_bin_add_patch(struct cs_dsp_mock_bin_builder *builder, }EXPORT_SYMBOL_NS_GPL (cs_dsp_mock_bin_add_patch,"FW_CS_DSP_KUNIT_TEST_UTILS" ); +/** +* cs_dsp_mock_bin_add_patch_off32() - Add a patch data block with 32-bit offset. +* +* @builder: Pointer to struct cs_dsp_mock_bin_builder. +* @alg_id: Algorithm ID for the patch. +* @alg_ver: Algorithm version for the patch. +* @mem_region: Memory region for the patch. +* @reg_addr_offset: Offset to start of data in register addresses. +* @payload_data: Pointer to buffer containing the payload data. +* @payload_len_bytes: Length of payload data in bytes. +*/ +void cs_dsp_mock_bin_add_patch_off32 (struct cs_dsp_mock_bin_builder *builder, +unsigned int alg_id,unsigned int alg_ver, +int mem_region,unsigned int reg_addr_offset, +const void *payload_data,size_t payload_len_bytes) +{ +/* Payload length must be a multiple of 4 */ +KUNIT_ASSERT_EQ (builder->test_priv->test, payload_len_bytes %4 ,0 ); + +/* Mark the block as using the 32-bit offset */ + mem_region |=0xf400 ; + +cs_dsp_mock_bin_add_raw_block (builder, alg_id, alg_ver, + mem_region,0 , reg_addr_offset, + payload_data, payload_len_bytes); +} +EXPORT_SYMBOL_NS_GPL (cs_dsp_mock_bin_add_patch_off32,"FW_CS_DSP_KUNIT_TEST_UTILS" ); +/** * cs_dsp_mock_bin_init() - Initialize a struct cs_dsp_mock_bin_builder. *
include/linux/firmware/cirrus/cs_dsp_test_utils.h +4 -0
@@ -136,6 +136,10 @@ void cs_dsp_mock_bin_add_patch(struct cs_dsp_mock_bin_builder *builder, unsigned int alg_id, unsigned int alg_ver, int mem_region, unsigned int reg_addr_offset, const void *payload_data, size_t payload_len_bytes); +void cs_dsp_mock_bin_add_patch_off32 (struct cs_dsp_mock_bin_builder *builder, +unsigned int alg_id,unsigned int alg_ver, +int mem_region,unsigned int reg_addr_offset, +const void *payload_data,size_t payload_len_bytes);struct firmware *cs_dsp_mock_bin_get_firmware (struct cs_dsp_mock_bin_builder *builder); struct cs_dsp_mock_wmfw_builder *cs_dsp_mock_wmfw_init(struct cs_dsp_test *priv,
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 6/8 firmware: cs_dsp: test: Increase size of XM and YM on Halo Core
In reply to Richard FitzgeraldIncrease the size of the XM and YM regions in the mock Halo Core register map for testing patch blocks with 32-bit offsets.
---
No changes since V1.
.../firmware/cirrus/test/cs_dsp_mock_mem_maps.c | 8 ++++---- .../firmware/cirrus/test/cs_dsp_mock_regmap.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_mock_mem_maps.c +4 -4
@@ -23,10 +23,10 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_mock_halo_dsp1_regions, "FW_CS_DSP_KUNIT_TEST_UTILS"/* List of sizes in bytes, for each entry above */ const unsigned int cs_dsp_mock_halo_dsp1_region_sizes[] = {0x5000 ,/* PM_PACKED */ -0x6000 ,/* XM_PACKED */ -0x47F4 ,/* YM_PACKED */ -0x8000 ,/* XM_UNPACKED_24 */ -0x5FF8 ,/* YM_UNPACKED_24 */ +0x8fff4 ,/* XM_PACKED */ +0x8fff4 ,/* YM_PACKED */ +0xbfff8 ,/* XM_UNPACKED_24 */ +0xbfff8 ,/* YM_UNPACKED_24 */ 0 /* terminator */ };
drivers/firmware/cirrus/test/cs_dsp_mock_regmap.c +8 -8
@@ -157,22 +157,22 @@ static const struct reg_default halo_register_defaults[] = { };static const struct regmap_range halo_readable_registers[] = { -regmap_reg_range (0x2000000 ,0x2005fff ),/* XM_PACKED */ +regmap_reg_range (0x2000000 ,0x208fff0 ),/* XM_PACKED */ regmap_reg_range (0x25e0000 ,0x25e004f ),/* SYSINFO */ regmap_reg_range (0x25e2000 ,0x25e2047 ),/* SYSINFO */ -regmap_reg_range (0x2800000 ,0x2807fff ),/* XM */ +regmap_reg_range (0x2800000 ,0x28bfff4 ),/* XM */ regmap_reg_range (0x2b80000 ,0x2bc700b ),/* CORE CTRL */ -regmap_reg_range (0x2c00000 ,0x2c047f3 ),/* YM_PACKED */ -regmap_reg_range (0x3400000 ,0x3405ff7 ),/* YM */ +regmap_reg_range (0x2c00000 ,0x2c8fff0 ),/* YM_PACKED */ +regmap_reg_range (0x3400000 ,0x34bfff4 ),/* YM */ regmap_reg_range (0x3800000 ,0x3804fff ),/* PM_PACKED */ };static const struct regmap_range halo_writeable_registers[] = { -regmap_reg_range (0x2000000 ,0x2005fff ),/* XM_PACKED */ -regmap_reg_range (0x2800000 ,0x2807fff ),/* XM */ +regmap_reg_range (0x2000000 ,0x208fff0 ),/* XM_PACKED */ +regmap_reg_range (0x2800000 ,0x28bfff4 ),/* XM */ regmap_reg_range (0x2b80000 ,0x2bc700b ),/* CORE CTRL */ -regmap_reg_range (0x2c00000 ,0x2c047f3 ),/* YM_PACKED */ -regmap_reg_range (0x3400000 ,0x3405ff7 ),/* YM */ +regmap_reg_range (0x2c00000 ,0x2c8fff0 ),/* YM_PACKED */ +regmap_reg_range (0x3400000 ,0x34bfff4 ),/* YM */ regmap_reg_range (0x3800000 ,0x3804fff ),/* PM_PACKED */ };
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 7/8 firmware: cs_dsp: test_bin: Run test cases on long-offset blocks
In reply to Richard FitzgeraldRun the patch block test cases using the new long-offset block type.
This adds a new set of parameterization that uses cs_dsp_mock_bin_add_patch_off32() to create the patch blocks in the test bin file.
The test cases for Halo Core with V3 file format include another run of the tests with the new parameterization, so that the tests are run on the standard blocks and the long-offset blocks.
This commit does not add any new cases for offsets > 0xffff.
---
No changes since V1.
.../firmware/cirrus/test/cs_dsp_test_bin.c | 229 +++++++++++++++++- 1 file changed, 220 insertions(+), 9 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_bin.c +220 -9
@@ -2300,6 +2300,7 @@ static int cs_dsp_bin_test_adsp2_16bit_init(struct kunit *test) }#define WMDR_PATCH_SHORT .add_patch = cs_dsp_mock_bin_add_patch +#define WMDR_PATCH_LONG .add_patch = cs_dsp_mock_bin_add_patch_off32/* Parameterize on choice of XM or YM with a range of word offsets */ static const struct bin_test_param x_or_y_and_offset_param_cases[] = {
@@ -2324,6 +2325,28 @@ static const struct bin_test_param x_or_y_and_offset_param_cases[] = { { .mem_type = WMFW_ADSP2_YM, .offset_words = 20, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param x_or_y_and_long_offset_param_cases[] = { + { .mem_type =WMFW_ADSP2_XM , .offset_words =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =3 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =4 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =23 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =22 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =21 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .offset_words =20 ,WMDR_PATCH_LONG }, + + { .mem_type =WMFW_ADSP2_YM , .offset_words =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =3 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =4 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =23 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =22 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =21 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .offset_words =20 ,WMDR_PATCH_LONG }, +}; +/* Parameterize on ZM with a range of word offsets */ static const struct bin_test_param z_and_offset_param_cases[] = { { .mem_type = WMFW_ADSP2_ZM, .offset_words = 0, WMDR_PATCH_SHORT },
@@ -2350,18 +2373,35 @@ static const struct bin_test_param packed_x_or_y_and_offset_param_cases[] = { { .mem_type = WMFW_HALO_YM_PACKED, .offset_words = 12, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param packed_x_or_y_and_long_offset_param_cases[] = { + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =4 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =8 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =12 ,WMDR_PATCH_LONG }, + + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =4 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =8 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =12 ,WMDR_PATCH_LONG }, +}; +static void x_or_y_or_z_and_offset_param_desc (const struct bin_test_param *param,char *desc) { -snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s@%u" , +snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s@%u %s" ,cs_dsp_mem_region_name (param->mem_type), - param->offset_words); + param->offset_words, + (param->add_patch == cs_dsp_mock_bin_add_patch_off32) ?"offs32" :"" ); }KUNIT_ARRAY_PARAM (x_or_y_and_offset, x_or_y_and_offset_param_cases, x_or_y_or_z_and_offset_param_desc); +KUNIT_ARRAY_PARAM (x_or_y_and_long_offset, + x_or_y_and_long_offset_param_cases, + x_or_y_or_z_and_offset_param_desc); +KUNIT_ARRAY_PARAM (z_and_offset, z_and_offset_param_cases, x_or_y_or_z_and_offset_param_desc);
@@ -2370,19 +2410,31 @@ KUNIT_ARRAY_PARAM(packed_x_or_y_and_offset, packed_x_or_y_and_offset_param_cases, x_or_y_or_z_and_offset_param_desc); +KUNIT_ARRAY_PARAM (packed_x_or_y_and_long_offset, + packed_x_or_y_and_long_offset_param_cases, + x_or_y_or_z_and_offset_param_desc); +/* Parameterize on choice of packed XM or YM */ static const struct bin_test_param packed_x_or_y_param_cases[] = { { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_SHORT }, }; +static const struct bin_test_param packed_x_or_y_long_param_cases[] = { + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, +}; +static void x_or_y_or_z_param_desc (const struct bin_test_param *param,char *desc) { -snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s" ,cs_dsp_mem_region_name (param->mem_type)); +snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s %s" , +cs_dsp_mem_region_name (param->mem_type), + (param->add_patch == cs_dsp_mock_bin_add_patch_off32) ?"offs32" :"" ); }KUNIT_ARRAY_PARAM (packed_x_or_y, packed_x_or_y_param_cases, x_or_y_or_z_param_desc); +KUNIT_ARRAY_PARAM (packed_x_or_y_long, packed_x_or_y_long_param_cases, x_or_y_or_z_param_desc);static const struct bin_test_param offset_param_cases[] = { { .offset_words =0 ,WMDR_PATCH_SHORT },
@@ -2396,12 +2448,27 @@ static const struct bin_test_param offset_param_cases[] = { { .offset_words = 20, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param long_offset_param_cases[] = { + { .offset_words =0 ,WMDR_PATCH_LONG }, + { .offset_words =1 ,WMDR_PATCH_LONG }, + { .offset_words =2 ,WMDR_PATCH_LONG }, + { .offset_words =3 ,WMDR_PATCH_LONG }, + { .offset_words =4 ,WMDR_PATCH_LONG }, + { .offset_words =23 ,WMDR_PATCH_LONG }, + { .offset_words =22 ,WMDR_PATCH_LONG }, + { .offset_words =21 ,WMDR_PATCH_LONG }, + { .offset_words =20 ,WMDR_PATCH_LONG }, +}; +static void offset_param_desc (const struct bin_test_param *param,char *desc) { -snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"@%u" , param->offset_words); +snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"@%u %s" , + param->offset_words, + (param->add_patch == cs_dsp_mock_bin_add_patch_off32) ?"offs32" :"" ); }KUNIT_ARRAY_PARAM (offset, offset_param_cases, offset_param_desc); +KUNIT_ARRAY_PARAM (long_offset, long_offset_param_cases, offset_param_desc);static const struct bin_test_param alg_param_cases[] = { { .alg_idx = 0, WMDR_PATCH_SHORT },
@@ -2410,15 +2477,24 @@ static const struct bin_test_param alg_param_cases[] = { { .alg_idx = 3, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param alg_long_param_cases[] = { + { .alg_idx =0 ,WMDR_PATCH_LONG }, + { .alg_idx =1 ,WMDR_PATCH_LONG }, + { .alg_idx =2 ,WMDR_PATCH_LONG }, + { .alg_idx =3 ,WMDR_PATCH_LONG }, +}; +static void alg_param_desc (const struct bin_test_param *param,char *desc) {WARN_ON (param->alg_idx >=ARRAY_SIZE (bin_test_mock_algs)); -snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"alg[%u] (%#x)" , - param->alg_idx, bin_test_mock_algs[param->alg_idx].id); +snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"alg[%u] (%#x) %s" , + param->alg_idx, bin_test_mock_algs[param->alg_idx].id, + (param->add_patch == cs_dsp_mock_bin_add_patch_off32) ?"offs32" :"" ); }KUNIT_ARRAY_PARAM (alg, alg_param_cases, alg_param_desc); +KUNIT_ARRAY_PARAM (alg_long, alg_long_param_cases, alg_param_desc);static const struct bin_test_param x_or_y_and_alg_param_cases[] = { { .mem_type = WMFW_ADSP2_XM, .alg_idx = 0, WMDR_PATCH_SHORT },
@@ -2432,16 +2508,31 @@ static const struct bin_test_param x_or_y_and_alg_param_cases[] = { { .mem_type = WMFW_ADSP2_YM, .alg_idx = 3, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param x_or_y_and_alg_long_param_cases[] = { + { .mem_type =WMFW_ADSP2_XM , .alg_idx =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_XM , .alg_idx =3 ,WMDR_PATCH_LONG }, + + { .mem_type =WMFW_ADSP2_YM , .alg_idx =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_ADSP2_YM , .alg_idx =3 ,WMDR_PATCH_LONG }, +}; +static void x_or_y_or_z_and_alg_param_desc (const struct bin_test_param *param,char *desc) {WARN_ON (param->alg_idx >=ARRAY_SIZE (bin_test_mock_algs)); -snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s alg[%u] (%#x)" , +snprintf (desc,KUNIT_PARAM_DESC_SIZE ,"%s alg[%u] (%#x) %s" ,cs_dsp_mem_region_name (param->mem_type), - param->alg_idx, bin_test_mock_algs[param->alg_idx].id); + param->alg_idx, bin_test_mock_algs[param->alg_idx].id, + (param->add_patch == cs_dsp_mock_bin_add_patch_off32) ?"offs32" :"" ); }KUNIT_ARRAY_PARAM (x_or_y_and_alg, x_or_y_and_alg_param_cases, x_or_y_or_z_and_alg_param_desc); +KUNIT_ARRAY_PARAM (x_or_y_and_alg_long, x_or_y_and_alg_long_param_cases, + x_or_y_or_z_and_alg_param_desc);static const struct bin_test_param z_and_alg_param_cases[] = { { .mem_type = WMFW_ADSP2_ZM, .alg_idx = 0, WMDR_PATCH_SHORT },
@@ -2464,9 +2555,24 @@ static const struct bin_test_param packed_x_or_y_and_alg_param_cases[] = { { .mem_type = WMFW_HALO_YM_PACKED, .alg_idx = 3, WMDR_PATCH_SHORT }, }; +static const struct bin_test_param packed_x_or_y_and_alg_long_param_cases[] = { + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .alg_idx =3 ,WMDR_PATCH_LONG }, + + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =0 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =1 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =2 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .alg_idx =3 ,WMDR_PATCH_LONG }, +}; +KUNIT_ARRAY_PARAM (packed_x_or_y_and_alg, packed_x_or_y_and_alg_param_cases, x_or_y_or_z_and_alg_param_desc); +KUNIT_ARRAY_PARAM (packed_x_or_y_and_alg_long, packed_x_or_y_and_alg_long_param_cases, + x_or_y_or_z_and_alg_param_desc); +static struct kunit_case cs_dsp_bin_test_cases_halo[] = {/* Unpacked memory */ KUNIT_CASE_PARAM(bin_patch_one_word, x_or_y_and_offset_gen_params),
@@ -2522,6 +2628,111 @@ static struct kunit_case cs_dsp_bin_test_cases_halo[] = { { }/* terminator */ }; +static struct kunit_case cs_dsp_bin_test_cases_halo_wmdr3[] = { +/* Unpacked memory */ +KUNIT_CASE_PARAM (bin_patch_one_word, x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_multiword, x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword, x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_mems, offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_mems, alg_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_algs_unordered, x_or_y_and_offset_gen_params), + +/* Packed memory tests */ +KUNIT_CASE_PARAM (bin_patch_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_1_single_trailing, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_2_single_trailing, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_3_single_trailing, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_2_trailing, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_3_trailing, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_single_leading_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_2_single_leading_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_2_leading_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_3_single_leading_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_3_leading_1_packed, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked_unordered, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_mems, offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_mems, alg_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked_sparse_unordered, + packed_x_or_y_and_alg_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_algs, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_algs_unordered, + packed_x_or_y_and_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_mixed_packed_unpacked_random, + packed_x_or_y_gen_params), + +/* Unpacked memory with long-offset blocks */ +KUNIT_CASE_PARAM (bin_patch_one_word, x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_multiword, x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword, x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword_unordered, x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_mems, long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_mems, alg_long_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_long_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_algs, x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_one_word_multiple_algs_unordered, + x_or_y_and_long_offset_gen_params), + +/* Packed memory tests with long offset blocks */ +KUNIT_CASE_PARAM (bin_patch_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_1_single_trailing, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_2_single_trailing, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_3_single_trailing, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_2_trailing, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_3_trailing, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_single_leading_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_2_single_leading_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_2_leading_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_3_single_leading_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_3_leading_1_packed, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked_unordered, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_mems, long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_mems, alg_long_gen_params), +KUNIT_CASE_PARAM (bin_patch_multi_onepacked_sparse_unordered, + packed_x_or_y_and_alg_long_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_algs, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_1_packed_multiple_algs_unordered, + packed_x_or_y_and_long_offset_gen_params), +KUNIT_CASE_PARAM (bin_patch_mixed_packed_unpacked_random, + packed_x_or_y_long_gen_params), + +KUNIT_CASE (bin_patch_name_and_info), + + { }/* terminator */ +}; +static struct kunit_case cs_dsp_bin_test_cases_adsp2[] = {/* XM and YM */ KUNIT_CASE_PARAM (bin_patch_one_word, x_or_y_and_offset_gen_params),
@@ -2559,7 +2770,7 @@ static struct kunit_suite cs_dsp_bin_test_halo = {static struct kunit_suite cs_dsp_bin_test_halo_wmdr3 = { .name ="cs_dsp_bin_halo_wmdr_v3" , .init = cs_dsp_bin_test_halo_wmdr3_init, - .test_cases = cs_dsp_bin_test_cases_halo, + .test_cases = cs_dsp_bin_test_cases_halo_wmdr3, };static struct kunit_suite cs_dsp_bin_test_adsp2_32bit = {
Signature · 1 line
2.43.0
Richard Fitzgerald
maintainerPATCH v2 8/8 firmware: cs_dsp: test_bin: Add tests for offsets > 0xffff
In reply to Richard FitzgeraldAdd test cases for using the new long-offset block types to patch memory that is >0xffff from the algorithm base.
This is just adding entries to the parameter data that have larger offset values.
---
Changes in V2:
- Fixed inconsistent commit title prefix
.../firmware/cirrus/test/cs_dsp_test_bin.c | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+)
drivers/firmware/cirrus/test/cs_dsp_test_bin.c +52 -0
@@ -2326,6 +2326,7 @@ static const struct bin_test_param x_or_y_and_offset_param_cases[] = { };static const struct bin_test_param x_or_y_and_long_offset_param_cases[] = { +/* Offset < 0xffff in long-offset block type */ { .mem_type =WMFW_ADSP2_XM , .offset_words =0 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_ADSP2_XM , .offset_words =1 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_ADSP2_XM , .offset_words =2 ,WMDR_PATCH_LONG },
@@ -2336,6 +2337,7 @@ static const struct bin_test_param x_or_y_and_long_offset_param_cases[] = { { .mem_type = WMFW_ADSP2_XM, .offset_words = 21, WMDR_PATCH_LONG }, { .mem_type = WMFW_ADSP2_XM, .offset_words = 20, WMDR_PATCH_LONG }, + /* Offset < 0xffff in long-offset block type */ { .mem_type = WMFW_ADSP2_YM, .offset_words = 0, WMDR_PATCH_LONG }, { .mem_type = WMFW_ADSP2_YM, .offset_words = 1, WMDR_PATCH_LONG }, { .mem_type = WMFW_ADSP2_YM, .offset_words = 2, WMDR_PATCH_LONG },
@@ -2345,6 +2347,28 @@ static const struct bin_test_param x_or_y_and_long_offset_param_cases[] = { { .mem_type = WMFW_ADSP2_YM, .offset_words = 22, WMDR_PATCH_LONG }, { .mem_type = WMFW_ADSP2_YM, .offset_words = 21, WMDR_PATCH_LONG }, { .mem_type = WMFW_ADSP2_YM, .offset_words = 20, WMDR_PATCH_LONG }, + + /* Offset > 0xffff in long-offset block type */ + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x10000, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x10001, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x10002, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x10003, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x10004, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x2f003, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x2f002, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x2f001, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_XM, .offset_words = 0x2f000, WMDR_PATCH_LONG }, + + /* Offset > 0xffff in long-offset block type */ + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x10000, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x10001, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x10002, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x10003, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x10004, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x2f003, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x2f002, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x2f001, WMDR_PATCH_LONG }, + { .mem_type = WMFW_ADSP2_YM, .offset_words = 0x2f000, WMDR_PATCH_LONG }, };/* Parameterize on ZM with a range of word offsets */
@@ -2374,15 +2398,31 @@ static const struct bin_test_param packed_x_or_y_and_offset_param_cases[] = { };static const struct bin_test_param packed_x_or_y_and_long_offset_param_cases[] = { +/* Offset < 0xffff in long-offset block type */ { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =4 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =8 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =12 ,WMDR_PATCH_LONG }, +/* Offset < 0xffff in long-offset block type */ { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =4 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =8 ,WMDR_PATCH_LONG }, { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =12 ,WMDR_PATCH_LONG }, + +/* Offset > 0xffff in long-offset block type */ + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0x10000 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0x10004 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0x10008 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0x2f000 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_XM_PACKED , .offset_words =0x2f004 ,WMDR_PATCH_LONG }, + +/* Offset > 0xffff in long-offset block type */ + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0x10000 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0x10004 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0x10008 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0x2f000 ,WMDR_PATCH_LONG }, + { .mem_type =WMFW_HALO_YM_PACKED , .offset_words =0x2f004 ,WMDR_PATCH_LONG }, }; static void x_or_y_or_z_and_offset_param_desc(const struct bin_test_param *param,
@@ -2449,6 +2489,7 @@ static const struct bin_test_param offset_param_cases[] = { };static const struct bin_test_param long_offset_param_cases[] = { +/* Offset < 0xffff in long-offset block type */ { .offset_words =0 ,WMDR_PATCH_LONG }, { .offset_words =1 ,WMDR_PATCH_LONG }, { .offset_words =2 ,WMDR_PATCH_LONG },
@@ -2458,6 +2499,17 @@ static const struct bin_test_param long_offset_param_cases[] = { { .offset_words = 22, WMDR_PATCH_LONG }, { .offset_words = 21, WMDR_PATCH_LONG }, { .offset_words = 20, WMDR_PATCH_LONG }, + + /* Offset > 0xffff in long-offset block type */ + { .offset_words = 0x10000, WMDR_PATCH_LONG }, + { .offset_words = 0x10001, WMDR_PATCH_LONG }, + { .offset_words = 0x10002, WMDR_PATCH_LONG }, + { .offset_words = 0x10003, WMDR_PATCH_LONG }, + { .offset_words = 0x10004, WMDR_PATCH_LONG }, + { .offset_words = 0x2f000, WMDR_PATCH_LONG }, + { .offset_words = 0x2f001, WMDR_PATCH_LONG }, + { .offset_words = 0x2f002, WMDR_PATCH_LONG }, + { .offset_words = 0x2f003, WMDR_PATCH_LONG }, };static void offset_param_desc (const struct bin_test_param *param,char *desc)
Signature · 1 line
2.43.0
Quoted 8 lines · Richard Fitzgerald
Version 3 of the WMDR file format introduces a new block type that has a 32-bit address offset.
The first patch of this series adds the support to the
cs_dspdriver.The rest of the series is adding KUnit tests for this.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] firmware: cs_dsp: Handle long-offset data blocks
commit: bc0305cb294c693b2762cf863324defb9e5175e5
[2/8] firmware: cs_dsp: test_bin: Run test cases with v3 file format
commit: afcbb0460e0a9f0e971512c66619fc649bdb86a6
[3/8] firmware: cs_dsp: test_bin: Make patch function a test parameter
commit: a01816edf11fc9e6c8216bc03870311ce2add5a2
[4/8] firmware: cs_dsp: mock_bin: Pass offset32 to cs_dsp_mock_bin_add_raw_block()
commit: 9e6f4c5b2d3af58390cf554ada9591935c5ac774
[5/8] firmware: cs_dsp: mock_bin: Add function to create long-offset patches
commit: 880f1eb5b95ccf250f567927462a7d3fa8f2a727
[6/8] firmware: cs_dsp: test: Increase size of XM and YM on Halo Core
commit: 6e60c6aa1e4b929f6fbb04dc9fa786aeaedf3693
[7/8] firmware: cs_dsp: test_bin: Run test cases on long-offset blocks
commit: 7fecf0bf1202599920d929704a3787291fc068db
[8/8] firmware: cs_dsp: test_bin: Add tests for offsets > 0xffff
commit: 211243b69533e968cc6f0259fb80ffee02fbe0caAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark