Skip to content

Commit

Permalink
Trace: remove trace context dependency
Browse files Browse the repository at this point in the history
Remove context dependency from current logging system.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
  • Loading branch information
btian1 committed Jan 31, 2024
1 parent e578ff7 commit 49fc466
Show file tree
Hide file tree
Showing 105 changed files with 1,025 additions and 1,096 deletions.
14 changes: 7 additions & 7 deletions posix/include/rtos/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ extern struct tr_ctx sl_tr;
break; /* lock acquired */ \
} \
if (__tries == 0) { \
tr_err_atomic(&sl_tr, "DED"); \
tr_err_atomic(&sl_tr, "line: %d", line); \
tr_err_atomic(&sl_tr, "user: %d", (lock)->user); \
tr_err_atomic("DED"); \
tr_err_atomic("line: %d", line); \
tr_err_atomic("user: %d", (lock)->user); \
panic(SOF_IPC_PANIC_DEADLOCK); /* lock not acquired */ \
} \
} while (0)
Expand All @@ -102,11 +102,11 @@ extern struct tr_ctx sl_tr;
int __i = 0; \
int __count = lock_dbg_atomic >= DBG_LOCK_USERS \
? DBG_LOCK_USERS : lock_dbg_atomic; \
tr_err_atomic(&sl_tr, "eal"); \
tr_err_atomic(&sl_tr, "line: %d", line); \
tr_err_atomic(&sl_tr, "dbg_atomic: %d", lock_dbg_atomic); \
tr_err_atomic("eal"); \
tr_err_atomic("line: %d", line); \
tr_err_atomic("dbg_atomic: %d", lock_dbg_atomic); \
for (__i = 0; __i < __count; __i++) { \
tr_err_atomic(&sl_tr, "value: %d", \
tr_err_atomic("value: %d", \
(lock_dbg_atomic << 24) | \
lock_dbg_user[__i]); \
} \
Expand Down
2 changes: 1 addition & 1 deletion posix/include/rtos/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static inline void wait_for_interrupt(int level)
tr_dbg(&wait_tr, "WFE");
#if CONFIG_DEBUG_LOCKS
if (lock_dbg_atomic)
tr_err_atomic(&wait_tr, "atm");
tr_err_atomic("atm");
#endif
platform_wait_for_interrupt(level);
tr_dbg(&wait_tr, "WFX");
Expand Down
8 changes: 4 additions & 4 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@ static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv)
const uint32_t force = tlv->value[0];

if (force) {
tr_info(&basefw_comp_tr, "FW config set force dmi l0 state");
tr_info("FW config set force dmi l0 state");
intel_adsp_force_dmi_l0_state();
} else {
tr_info(&basefw_comp_tr, "FW config set allow dmi l1 state");
tr_info("FW config set allow dmi l1 state");
intel_adsp_allow_dmi_l1_state();
}

Expand All @@ -451,7 +451,7 @@ static int basefw_set_fw_config(bool first_block,
default:
break;
}
tr_warn(&basefw_comp_tr, "returning success for Set FW_CONFIG without handling it");
tr_warn("returning success for Set FW_CONFIG without handling it");
return 0;
}

Expand Down Expand Up @@ -485,7 +485,7 @@ static int basefw_get_large_config(struct comp_dev *dev,
case IPC4_EXTENDED_SYSTEM_TIME:
ret = basefw_get_ext_system_time(data_offset, data);
if (ret == IPC4_UNAVAILABLE) {
tr_warn(&basefw_comp_tr, "returning success for get host EXTENDED_SYSTEM_TIME without handling it");
tr_warn("returning success for get host EXTENDED_SYSTEM_TIME without handling it");
return 0;
} else {
return ret;
Expand Down
8 changes: 4 additions & 4 deletions src/audio/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t flags, u
struct comp_buffer *buffer;
void *stream_addr;

tr_dbg(&buffer_tr, "buffer_alloc()");
tr_dbg("buffer_alloc()");

/* validate request */
if (size == 0) {
tr_err(&buffer_tr, "buffer_alloc(): new size = %u is invalid",
tr_err("buffer_alloc(): new size = %u is invalid",
size);
return NULL;
}
Expand All @@ -48,7 +48,7 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t flags, u
buffer = rzalloc(zone, 0, SOF_MEM_CAPS_RAM, sizeof(*buffer));

if (!buffer) {
tr_err(&buffer_tr, "buffer_alloc(): could not alloc structure");
tr_err("buffer_alloc(): could not alloc structure");
return NULL;
}

Expand All @@ -58,7 +58,7 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t flags, u
stream_addr = rballoc_align(0, caps, size, align);
if (!stream_addr) {
rfree(buffer);
tr_err(&buffer_tr, "buffer_alloc(): could not alloc size = %u bytes of type = %u",
tr_err("buffer_alloc(): could not alloc size = %u bytes of type = %u",
size, caps);
return NULL;
}
Expand Down
26 changes: 11 additions & 15 deletions src/audio/chain_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ static void handle_xrun(struct chain_dma_data *cd)

if (cd->link_connector_node_id.f.dma_type == ipc4_hda_link_output_class &&
!cd->xrun_notification_sent) {
tr_warn(&chain_dma_tr, "handle_xrun(): underrun detected");
tr_warn("handle_xrun(): underrun detected");
xrun_notif_msg_init(cd->msg_xrun, cd->link_connector_node_id.dw,
SOF_IPC4_GATEWAY_UNDERRUN_DETECTED);
ipc_msg_send(cd->msg_xrun, NULL, true);
cd->xrun_notification_sent = true;
} else if (cd->link_connector_node_id.f.dma_type == ipc4_hda_link_input_class &&
!cd->xrun_notification_sent) {
tr_warn(&chain_dma_tr, "handle_xrun(): overrun detected");
tr_warn("handle_xrun(): overrun detected");
xrun_notif_msg_init(cd->msg_xrun, cd->link_connector_node_id.dw,
SOF_IPC4_GATEWAY_OVERRUN_DETECTED);
ipc_msg_send(cd->msg_xrun, NULL, true);
Expand Down Expand Up @@ -185,14 +185,14 @@ static enum task_state chain_task_run(void *data)
case 0:
break;
case -EPIPE:
tr_warn(&chain_dma_tr, "chain_task_run(): dma_get_status() link xrun occurred,"
tr_warn("chain_task_run(): dma_get_status() link xrun occurred,"
" ret = %u", ret);
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
handle_xrun(cd);
#endif
break;
default:
tr_err(&chain_dma_tr, "chain_task_run(): dma_get_status() error, ret = %u", ret);
tr_err("chain_task_run(): dma_get_status() error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}

Expand All @@ -203,7 +203,7 @@ static enum task_state chain_task_run(void *data)
/* Host DMA does not report xruns. All error values will be treated as critical. */
ret = dma_get_status(cd->chan_host->dma->z_dev, cd->chan_host->index, &stat);
if (ret < 0) {
tr_err(&chain_dma_tr, "chain_task_run(): dma_get_status() error, ret = %u", ret);
tr_err("chain_task_run(): dma_get_status() error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}

Expand All @@ -221,15 +221,13 @@ static enum task_state chain_task_run(void *data)

ret = dma_reload(cd->chan_host->dma->z_dev, cd->chan_host->index, 0, 0, increment);
if (ret < 0) {
tr_err(&chain_dma_tr,
"chain_task_run(): dma_reload() host error, ret = %u", ret);
tr_err("chain_task_run(): dma_reload() host error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}

ret = dma_reload(cd->chan_link->dma->z_dev, cd->chan_link->index, 0, 0, increment);
if (ret < 0) {
tr_err(&chain_dma_tr,
"chain_task_run(): dma_reload() link error, ret = %u", ret);
tr_err("chain_task_run(): dma_reload() link error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}
} else {
Expand All @@ -246,9 +244,8 @@ static enum task_state chain_task_run(void *data)
cd->chan_link->index, 0, 0,
half_buff_size);
if (ret < 0) {
tr_err(&chain_dma_tr,
"chain_task_run(): dma_reload() link error, ret = %u",
ret);
tr_err("chain_task_run(): dma_reload() link error, ret = %u",
ret);
return SOF_TASK_STATE_COMPLETED;
}
cd->first_data_received = true;
Expand All @@ -262,8 +259,7 @@ static enum task_state chain_task_run(void *data)
ret = dma_reload(cd->chan_host->dma->z_dev, cd->chan_host->index,
0, 0, transferred);
if (ret < 0) {
tr_err(&chain_dma_tr,
"chain_task_run(): dma_reload() host error, ret = %u", ret);
tr_err("chain_task_run(): dma_reload() host error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}

Expand All @@ -272,7 +268,7 @@ static enum task_state chain_task_run(void *data)
ret = dma_reload(cd->chan_link->dma->z_dev, cd->chan_link->index,
0, 0, half_buff_size);
if (ret < 0) {
tr_err(&chain_dma_tr, "chain_task_run(): dma_reload() "
tr_err("chain_task_run(): dma_reload() "
"link error, ret = %u", ret);
return SOF_TASK_STATE_COMPLETED;
}
Expand Down
2 changes: 1 addition & 1 deletion src/audio/channel_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct sof_ipc_channel_map *chmap_get(struct sof_ipc_stream_map *smap,
uint32_t byte = 0;

if (index >= smap->num_ch_map) {
tr_err(&chmap_tr, "chmap_get(): index %d out of bounds %d",
tr_err("chmap_get(): index %d out of bounds %d",
index, smap->num_ch_map);

return NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/audio/dp_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ struct dp_queue *dp_queue_create(size_t min_available, size_t min_free_space, ui
goto err;

dp_queue->audio_stream_params.id = id;
tr_info(&dp_queue_tr, "DpQueue created, id: %u shared: %u min_available: %u min_free_space %u, size %u",
tr_info("DpQueue created, id: %u shared: %u min_available: %u min_free_space %u, size %u",
id, dp_queue_is_shared(dp_queue), min_available, min_free_space,
dp_queue->data_buffer_size);

/* return a pointer to allocated structure */
return dp_queue;
err:
tr_err(&dp_queue_tr, "DpQueue creation failure");
tr_err("DpQueue creation failure");
rfree(dp_queue);
return NULL;
}
12 changes: 5 additions & 7 deletions src/audio/rtnr/rtnr.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
/* ID for RTNR data */
#define RTNR_DATA_ID_PRESET 12345678

static const struct comp_driver comp_rtnr;

/** \brief RTNR processing functions map item. */
struct rtnr_func_map {
enum sof_ipc_frame fmt; /**< source frame format */
Expand All @@ -78,27 +76,27 @@ void rtnr_printf(int a, int b, int c, int d, int e)
{
switch (a) {
case 0xa:
comp_cl_info(&comp_rtnr, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
comp_cl_info(NULL, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
b, c, d, e);
break;

case 0xb:
comp_cl_info(&comp_rtnr, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
comp_cl_info(NULL, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
b, c, d, e);
break;

case 0xc:
comp_cl_warn(&comp_rtnr, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
comp_cl_warn(NULL, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
b, c, d, e);
break;

case 0xd:
comp_cl_dbg(&comp_rtnr, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
comp_cl_dbg(NULL, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
b, c, d, e);
break;

case 0xe:
comp_cl_err(&comp_rtnr, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
comp_cl_err(NULL, "rtnr_printf 1st=%08x, 2nd=%08x, 3rd=%08x, 4st=%08x",
b, c, d, e);
break;

Expand Down
20 changes: 10 additions & 10 deletions src/drivers/amd/common/acp_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ static struct dma_chan_data *acp_dma_channel_get(struct dma *dma,
key = k_spin_lock(&dma->lock);
if (req_chan >= dma->plat_data.channels) {
k_spin_unlock(&dma->lock, key);
tr_err(&acpdma_tr, "DMA: Channel %d not in range", req_chan);
tr_err("DMA: Channel %d not in range", req_chan);
return NULL;
}
channel = &dma->chan[req_chan];
if (channel->status != COMP_STATE_INIT) {
k_spin_unlock(&dma->lock, key);
tr_err(&acpdma_tr, "DMA: channel already in use %d", req_chan);
tr_err("DMA: channel already in use %d", req_chan);
return NULL;
}
atomic_add(&dma->num_channels_busy, 1);
Expand Down Expand Up @@ -199,14 +199,14 @@ static int acp_dma_start(struct dma_chan_data *channel)
return 0;
} while (platform_timer_get(timer) <= deadline);

tr_err(&acpdma_tr, "acp-dma: timed out for dma start");
tr_err("acp-dma: timed out for dma start");

return -ETIME;
}

static int acp_dma_release(struct dma_chan_data *channel)
{
tr_info(&acpdma_tr, "DMA: release(%d)", channel->index);
tr_info("DMA: release(%d)", channel->index);
if (channel->status != COMP_STATE_PAUSED)
return -EINVAL;
channel->status = COMP_STATE_ACTIVE;
Expand All @@ -215,7 +215,7 @@ static int acp_dma_release(struct dma_chan_data *channel)

static int acp_dma_pause(struct dma_chan_data *channel)
{
tr_info(&acpdma_tr, "h/w pause is not supported, changing the status of(%d) channel",
tr_info("h/w pause is not supported, changing the status of(%d) channel",
channel->index);
if (channel->status != COMP_STATE_ACTIVE)
return -EINVAL;
Expand Down Expand Up @@ -285,14 +285,14 @@ static int acp_dma_probe(struct dma *dma)
int channel;

if (dma->chan) {
tr_err(&acpdma_tr, "DMA: Already probe");
tr_err("DMA: Already probe");
return -EEXIST;
}
dma->chan = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
dma->plat_data.channels *
sizeof(struct dma_chan_data));
if (!dma->chan) {
tr_err(&acpdma_tr, "DMA: unable to allocate channel context");
tr_err("DMA: unable to allocate channel context");
return -ENOMEM;
}
for (channel = 0; channel < dma->plat_data.channels; channel++) {
Expand All @@ -304,7 +304,7 @@ static int acp_dma_probe(struct dma *dma)
sizeof(struct acp_dma_chan_data));
if (!acp_dma_chan) {
rfree(dma->chan);
tr_err(&acpdma_tr, "acp-dma: %d channel %d private data alloc failed",
tr_err("acp-dma: %d channel %d private data alloc failed",
dma->plat_data.id, channel);
return -ENOMEM;
}
Expand All @@ -318,7 +318,7 @@ static int acp_dma_remove(struct dma *dma)
int channel;

if (!dma->chan) {
tr_err(&acpdma_tr, "DMA: Invalid remove call");
tr_err("DMA: Invalid remove call");
return 0;
}
for (channel = 0; channel < dma->plat_data.channels; channel++)
Expand Down Expand Up @@ -379,7 +379,7 @@ static int acp_dma_get_data_size(struct dma_chan_data *channel,
*free = ABS(data_size) / 2;
break;
default:
tr_err(&acpdma_tr, "dma_get_data_size() Invalid direction %d",
tr_err("dma_get_data_size() Invalid direction %d",
channel->direction);
return -EINVAL;
}
Expand Down
Loading

0 comments on commit 49fc466

Please sign in to comment.