mirror of https://github.com/thesofproject/sof.git
dma-trace: move to earlier initialisation point
Initialise DMA trace prior to platform initialisation so that more users may use trace as part of init. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> dma trace fix
This commit is contained in:
parent
a23e246286
commit
36e425e2e5
|
@ -66,7 +66,7 @@ struct dma_trace_data {
|
|||
spinlock_t lock;
|
||||
};
|
||||
|
||||
int dma_trace_init_early(struct dma_trace_data *d);
|
||||
int dma_trace_init_early(struct reef *reef);
|
||||
int dma_trace_init_complete(struct dma_trace_data *d);
|
||||
int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem,
|
||||
uint32_t host_size);
|
||||
|
|
|
@ -101,7 +101,7 @@ struct ipc {
|
|||
struct list_item comp_list; /* list of component devices */
|
||||
|
||||
/* DMA for Trace*/
|
||||
struct dma_trace_data dmat;
|
||||
struct dma_trace_data *dmat;
|
||||
|
||||
void *private;
|
||||
};
|
||||
|
|
|
@ -68,6 +68,9 @@ struct reef {
|
|||
/* system agent */
|
||||
struct sa *sa;
|
||||
|
||||
/* DMA for Trace*/
|
||||
struct dma_trace_data *dmat;
|
||||
|
||||
/* private data */
|
||||
void *arch_private;
|
||||
void *plat_private;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <reef/work.h>
|
||||
#include <reef/trace.h>
|
||||
#include <reef/schedule.h>
|
||||
#include <reef/dma-trace.h>
|
||||
#include <platform/platform.h>
|
||||
|
||||
/* main firmware context */
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include <reef/audio/pipeline.h>
|
||||
#include <uapi/ipc.h>
|
||||
#include <reef/intel-ipc.h>
|
||||
#include <reef/dma-trace.h>
|
||||
#include <config.h>
|
||||
|
||||
#define iGS(x) ((x >> SOF_GLB_TYPE_SHIFT) & 0xf)
|
||||
|
@ -626,7 +627,7 @@ static int ipc_dma_trace_config(uint32_t header)
|
|||
#endif
|
||||
trace_ipc("DAp");
|
||||
|
||||
err = dma_trace_enable(&_ipc->dmat);
|
||||
err = dma_trace_enable(_ipc->dmat);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -649,9 +650,9 @@ int ipc_dma_trace_send_position(void)
|
|||
struct sof_ipc_dma_trace_posn posn;
|
||||
|
||||
posn.rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_POSITION;
|
||||
posn.host_offset = _ipc->dmat.host_offset;
|
||||
posn.overflow = _ipc->dmat.overflow;
|
||||
posn.messages = _ipc->dmat.messages;
|
||||
posn.host_offset = _ipc->dmat->host_offset;
|
||||
posn.overflow = _ipc->dmat->overflow;
|
||||
posn.messages = _ipc->dmat->messages;
|
||||
posn.rhdr.hdr.size = sizeof(posn);
|
||||
|
||||
return ipc_queue_host_message(_ipc, posn.rhdr.hdr.cmd, &posn,
|
||||
|
|
|
@ -350,6 +350,7 @@ int ipc_init(struct reef *reef)
|
|||
/* init ipc data */
|
||||
reef->ipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*reef->ipc));
|
||||
reef->ipc->comp_data = rzalloc(RZONE_SYS, RFLAGS_NONE, SOF_IPC_MSG_MAX_SIZE);
|
||||
reef->ipc->dmat = reef->dmat;
|
||||
|
||||
list_init(&reef->ipc->comp_list);
|
||||
|
||||
|
|
|
@ -124,9 +124,12 @@ out:
|
|||
return DMA_TRACE_PERIOD;
|
||||
}
|
||||
|
||||
int dma_trace_init_early(struct dma_trace_data *d)
|
||||
int dma_trace_init_early(struct reef *reef)
|
||||
{
|
||||
struct dma_trace_buf *buffer = &d->dmatb;
|
||||
struct dma_trace_buf *buffer;
|
||||
|
||||
trace_data = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*trace_data));
|
||||
buffer = &trace_data->dmatb;
|
||||
|
||||
/* allocate new buffer */
|
||||
buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, DMA_TRACE_LOCAL_SIZE);
|
||||
|
@ -142,15 +145,10 @@ int dma_trace_init_early(struct dma_trace_data *d)
|
|||
buffer->w_ptr = buffer->r_ptr = buffer->addr;
|
||||
buffer->end_addr = buffer->addr + buffer->size;
|
||||
buffer->avail = 0;
|
||||
d->host_offset = 0;
|
||||
d->overflow = 0;
|
||||
d->messages = 0;
|
||||
d->enabled = 0;
|
||||
d->copy_in_progress = 0;
|
||||
|
||||
list_init(&d->config.elem_list);
|
||||
spinlock_init(&d->lock);
|
||||
trace_data = d;
|
||||
list_init(&trace_data->config.elem_list);
|
||||
spinlock_init(&trace_data->lock);
|
||||
reef->dmat = trace_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,10 @@ void trace_off(void)
|
|||
|
||||
void trace_init(struct reef *reef)
|
||||
{
|
||||
|
||||
#if defined(CONFIG_DMA_TRACE)
|
||||
dma_trace_init_early(reef);
|
||||
#endif
|
||||
trace.enable = 1;
|
||||
trace.pos = 0;
|
||||
spinlock_init(&trace.lock);
|
||||
|
|
|
@ -301,8 +301,6 @@ int platform_init(struct reef *reef)
|
|||
trace_point(TRACE_BOOT_PLATFORM_IPC);
|
||||
ipc_init(reef);
|
||||
|
||||
dma_trace_init_early(&reef->ipc->dmat);
|
||||
|
||||
/* init DMACs */
|
||||
trace_point(TRACE_BOOT_PLATFORM_DMA);
|
||||
dmac0 = dma_get(DMA_ID_DMAC0);
|
||||
|
@ -365,7 +363,7 @@ int platform_init(struct reef *reef)
|
|||
#endif
|
||||
|
||||
/* Initialize DMA for Trace*/
|
||||
dma_trace_init_complete(&reef->ipc->dmat);
|
||||
dma_trace_init_complete(reef->dmat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -207,8 +207,6 @@ int platform_init(struct reef *reef)
|
|||
trace_point(TRACE_BOOT_PLATFORM_IPC);
|
||||
ipc_init(reef);
|
||||
|
||||
dma_trace_init_early(&reef->ipc->dmat);
|
||||
|
||||
/* init DMACs */
|
||||
trace_point(TRACE_BOOT_PLATFORM_DMA);
|
||||
dmac0 = dma_get(DMA_ID_DMAC0);
|
||||
|
@ -242,7 +240,7 @@ int platform_init(struct reef *reef)
|
|||
dai_probe(ssp1);
|
||||
|
||||
/* Initialize DMA for Trace*/
|
||||
dma_trace_init_complete(&reef->ipc->dmat);
|
||||
dma_trace_init_complete(reef->dmat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue