Skip to content

Commit a1a5633

Browse files
committed
dram: add debugging to all cold functions
Add cold code path checks to all __cold functions. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 82af434 commit a1a5633

File tree

8 files changed

+58
-0
lines changed

8 files changed

+58
-0
lines changed

src/audio/drc/drc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ __cold static int drc_init(struct processing_module *mod)
151151
size_t bs = cfg->size;
152152
int ret;
153153

154+
assert_can_be_cold();
155+
154156
comp_info(dev, "drc_init()");
155157

156158
/* Check first before proceeding with dev and cd that coefficients
@@ -203,6 +205,8 @@ __cold static int drc_free(struct processing_module *mod)
203205
{
204206
struct drc_comp_data *cd = module_get_private_data(mod);
205207

208+
assert_can_be_cold();
209+
206210
comp_data_blob_handler_free(cd->model_handler);
207211
rfree(cd);
208212
return 0;
@@ -216,6 +220,8 @@ __cold static int drc_set_config(struct processing_module *mod, uint32_t param_i
216220
struct drc_comp_data *cd = module_get_private_data(mod);
217221
struct comp_dev *dev = mod->dev;
218222

223+
assert_can_be_cold();
224+
219225
comp_dbg(dev, "drc_set_config()");
220226

221227
#if CONFIG_IPC_MAJOR_4
@@ -253,6 +259,8 @@ __cold static int drc_get_config(struct processing_module *mod,
253259
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
254260
struct drc_comp_data *cd = module_get_private_data(mod);
255261

262+
assert_can_be_cold();
263+
256264
comp_info(mod->dev, "drc_get_config()");
257265

258266
return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size);

src/audio/multiband_drc/multiband_drc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ __cold static int multiband_drc_free(struct processing_module *mod)
285285
{
286286
struct multiband_drc_comp_data *cd = module_get_private_data(mod);
287287

288+
assert_can_be_cold();
289+
288290
comp_info(mod->dev, "multiband_drc_free()");
289291

290292
comp_data_blob_handler_free(cd->model_handler);
@@ -301,6 +303,8 @@ __cold static int multiband_drc_set_config(struct processing_module *mod, uint32
301303
{
302304
struct comp_dev *dev = mod->dev;
303305

306+
assert_can_be_cold();
307+
304308
comp_dbg(dev, "multiband_drc_set_config()");
305309

306310
return multiband_drc_set_ipc_config(mod, param_id,
@@ -313,6 +317,8 @@ __cold static int multiband_drc_get_config(struct processing_module *mod,
313317
{
314318
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
315319

320+
assert_can_be_cold();
321+
316322
comp_dbg(mod->dev, "multiband_drc_get_config()");
317323

318324
return multiband_drc_get_ipc_config(mod, cdata, fragment_size);
@@ -364,6 +370,8 @@ __cold static int multiband_drc_prepare(struct processing_module *mod,
364370
int rate;
365371
int ret = 0;
366372

373+
assert_can_be_cold();
374+
367375
comp_info(dev, "multiband_drc_prepare()");
368376

369377
ret = multiband_drc_params(mod);
@@ -403,6 +411,8 @@ __cold static int multiband_drc_reset(struct processing_module *mod)
403411
{
404412
struct multiband_drc_comp_data *cd = module_get_private_data(mod);
405413

414+
assert_can_be_cold();
415+
406416
comp_info(mod->dev, "multiband_drc_reset()");
407417

408418
multiband_drc_reset_state(&cd->state);

src/audio/src/src.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ __cold static int src_prepare(struct processing_module *mod,
4242
struct src_param *a = &cd->param;
4343
int ret;
4444

45+
assert_can_be_cold();
46+
4547
comp_info(mod->dev, "src_prepare()");
4648

4749
if (num_of_sources != 1 || num_of_sinks != 1)

src/audio/src/src_common.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ __cold static int src_buffer_lengths(struct comp_dev *dev, struct comp_data *cd,
5454
int source_frames;
5555
int r1, n;
5656

57+
assert_can_be_cold();
58+
5759
a = &cd->param;
5860
fs_in = cd->source_rate;
5961
fs_out = cd->sink_rate;
@@ -192,6 +194,8 @@ __cold static int src_polyphase_init(struct polyphase_src *src, struct src_param
192194
int n_stages;
193195
int ret;
194196

197+
assert_can_be_cold();
198+
195199
if (p->idx_in < 0 || p->idx_out < 0)
196200
return -EINVAL;
197201

@@ -400,6 +404,8 @@ __cold static int src_verify_params(struct processing_module *mod)
400404
struct comp_dev *dev = mod->dev;
401405
int ret;
402406

407+
assert_can_be_cold();
408+
403409
comp_dbg(dev, "src_verify_params()");
404410

405411
/* check whether params->rate (received from driver) are equal
@@ -485,6 +491,8 @@ __cold int src_params_general(struct processing_module *mod,
485491
int n;
486492
int err;
487493

494+
assert_can_be_cold();
495+
488496
comp_info(dev, "src_params()");
489497

490498
err = src_set_params(mod, sink);
@@ -581,6 +589,8 @@ __cold int src_param_set(struct comp_dev *dev, struct comp_data *cd)
581589
int fs_in = cd->source_rate;
582590
int fs_out = cd->sink_rate;
583591

592+
assert_can_be_cold();
593+
584594
a->idx_in = src_find_fs(a->in_fs, a->num_in_fs, fs_in);
585595
a->idx_out = src_find_fs(a->out_fs, a->num_out_fs, fs_out);
586596

@@ -607,6 +617,8 @@ __cold int src_allocate_copy_stages(struct comp_dev *dev, struct src_param *prm,
607617
size_t tap_size = sizeof(int32_t);
608618
#endif
609619

620+
assert_can_be_cold();
621+
610622
stage_dst = rmalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
611623
2 * sizeof(*stage_dst));
612624
if (!stage_dst) {
@@ -672,19 +684,25 @@ __cold int src_set_config(struct processing_module *mod, uint32_t config_id,
672684
const uint8_t *fragment, size_t fragment_size, uint8_t *response,
673685
size_t response_size)
674686
{
687+
assert_can_be_cold();
688+
675689
return -EINVAL;
676690
}
677691

678692
__cold int src_get_config(struct processing_module *mod, uint32_t config_id,
679693
uint32_t *data_offset_size, uint8_t *fragment, size_t fragment_size)
680694
{
695+
assert_can_be_cold();
696+
681697
return -EINVAL;
682698
}
683699

684700
__cold int src_reset(struct processing_module *mod)
685701
{
686702
struct comp_data *cd = module_get_private_data(mod);
687703

704+
assert_can_be_cold();
705+
688706
comp_info(mod->dev, "src_reset()");
689707

690708
cd->src_func = src_fallback;
@@ -697,6 +715,8 @@ __cold int src_free(struct processing_module *mod)
697715
{
698716
struct comp_data *cd = module_get_private_data(mod);
699717

718+
assert_can_be_cold();
719+
700720
comp_info(mod->dev, "src_free()");
701721

702722
/* Free dynamically reserved buffers for SRC algorithm */

src/audio/src/src_ipc4.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ __cold int src_set_params(struct processing_module *mod, struct sof_sink *sink)
8686
struct comp_dev *dev = mod->dev;
8787
int ret;
8888

89+
assert_can_be_cold();
90+
8991
src_params = *params;
9092
src_params.channels = mod->priv.cfg.base_cfg.audio_fmt.channels_count;
9193
src_params.buffer_fmt = mod->priv.cfg.base_cfg.audio_fmt.interleaving_style;
@@ -124,6 +126,8 @@ __cold void src_get_source_sink_params(struct comp_dev *dev, struct sof_source *
124126
struct comp_data *cd = module_get_private_data(mod);
125127
enum sof_ipc_frame frame_fmt, valid_fmt;
126128

129+
assert_can_be_cold();
130+
127131
/* convert IPC4 config to format used by the module */
128132
audio_stream_fmt_conversion(cd->ipc_config.base.audio_fmt.depth,
129133
cd->ipc_config.base.audio_fmt.valid_bit_depth,
@@ -144,6 +148,8 @@ __cold int src_prepare_general(struct processing_module *mod,
144148
struct comp_dev *dev = mod->dev;
145149
int ret = 0;
146150

151+
assert_can_be_cold();
152+
147153
/* set align requirements */
148154
src_set_alignment(source, sink);
149155

@@ -187,6 +193,8 @@ __cold int src_init(struct processing_module *mod)
187193
struct comp_dev *dev = mod->dev;
188194
struct comp_data *cd = NULL;
189195

196+
assert_can_be_cold();
197+
190198
comp_dbg(dev, "src_init()");
191199

192200
if (!cfg->init_data || cfg->size != sizeof(cd->ipc_config)) {

src/debug/tester/tester_simple_dram_test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ __cold static int simple_dram_test_case_init(struct processing_module *mod, void
3636
struct tester_module_simple_dram_test_data *data =
3737
rzalloc(0, 0, SOF_MEM_CAPS_L3, sizeof(*data));
3838

39+
assert_can_be_cold();
40+
3941
if (!data)
4042
return -ENOMEM;
4143

@@ -63,6 +65,8 @@ __cold static int simple_dram_test_case_process(void *ctx, struct processing_mod
6365
{
6466
struct tester_module_simple_dram_test_data *data = ctx;
6567

68+
assert_can_be_cold();
69+
6670
/* copy every second cycle */
6771
*do_copy = data->do_copy_data;
6872
data->do_copy_data = !data->do_copy_data;
@@ -72,6 +76,8 @@ __cold static int simple_dram_test_case_process(void *ctx, struct processing_mod
7276

7377
__cold static int simple_dram_test_free(void *ctx, struct processing_module *mod)
7478
{
79+
assert_can_be_cold();
80+
7581
rfree(ctx);
7682
return 0;
7783
}

src/ipc/ipc4/handler.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ __cold static int ipc4_init_module_instance(struct ipc4_message_request *ipc4)
886886
if (ret < 0)
887887
return IPC4_FAILURE;
888888

889+
assert_can_be_cold();
890+
889891
tr_dbg(&ipc_tr,
890892
"ipc4_init_module_instance %x : %x",
891893
(uint32_t)module_init.primary.r.module_id,

src/ipc/ipc4/helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ __cold struct comp_dev *comp_new_ipc4(struct ipc4_module_init_instance *module_i
110110
uint32_t comp_id;
111111
char *data;
112112

113+
assert_can_be_cold();
114+
113115
comp_id = IPC4_COMP_ID(module_init->primary.r.module_id,
114116
module_init->primary.r.instance_id);
115117

0 commit comments

Comments
 (0)