trace: Add SOF_IPC_TRACE_DMA_FREE IPC command

This will be used to stop the trace DMA and free
its resources. This change is tagged for ABI 3.20.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2021-10-04 19:54:17 -07:00 committed by Liam Girdwood
parent b7a469e884
commit bd918ada7f
4 changed files with 30 additions and 0 deletions

View File

@ -268,6 +268,7 @@
#define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002)
#define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003)
#define SOF_IPC_TRACE_FILTER_UPDATE SOF_CMD_TYPE(0x004) /**< ABI3.17 */
#define SOF_IPC_TRACE_DMA_FREE SOF_CMD_TYPE(0x005) /**< ABI3.20 */
/** @} */

View File

@ -53,6 +53,7 @@ int dma_trace_host_buffer(struct dma_trace_data *d,
struct dma_sg_elem_array *elem_array,
uint32_t host_size);
int dma_trace_enable(struct dma_trace_data *d);
void dma_trace_disable(struct dma_trace_data *d);
void dma_trace_flush(void *destination);
void dma_trace_on(void);
void dma_trace_off(void);

View File

@ -746,7 +746,17 @@ static int ipc_dma_trace_config(uint32_t header)
{
return 0;
}
static void ipc_dma_trace_free(uint32_t header) {}
#else
static void ipc_dma_trace_free(uint32_t header)
{
struct dma_trace_data *dmat = dma_trace_data_get();
dma_trace_disable(dmat);
}
static int ipc_dma_trace_config(uint32_t header)
{
#if CONFIG_HOST_PTABLE
@ -872,6 +882,9 @@ static int ipc_glb_trace_message(uint32_t header)
case SOF_IPC_TRACE_DMA_PARAMS:
case SOF_IPC_TRACE_DMA_PARAMS_EXT:
return ipc_dma_trace_config(header);
case SOF_IPC_TRACE_DMA_FREE:
ipc_dma_trace_free(header);
return 0;
case SOF_IPC_TRACE_FILTER_UPDATE:
return ipc_trace_filter_update(header);
default:

View File

@ -454,6 +454,21 @@ out:
return err;
}
void dma_trace_disable(struct dma_trace_data *d)
{
/* cancel trace work */
schedule_task_cancel(&d->dmat_work);
if (d->dc.chan) {
dma_stop(d->dc.chan);
dma_channel_put(d->dc.chan);
d->dc.chan = NULL;
}
/* free trace buffer */
dma_trace_buffer_free(d);
}
/** Sends all pending DMA messages to mailbox (for emergencies) */
void dma_trace_flush(void *t)
{