This patch modifies the _trace_error function names to a more generic name _trace_event_mbox() and updates users.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- Tested with Minnowboard Turbot with RT5651 Kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 SOF: https://github.com/ranj063/sof.git branch: debug/trace_test SOFT: 1.1-stable --- --- src/include/reef/trace.h | 16 +++++------ src/lib/trace.c | 72 ++++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 45 deletions(-)
diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 44824b9..d6a68a6 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -102,10 +102,9 @@ #define TRACEE 1
void _trace_event(uint32_t event); -void _trace_error(uint32_t event); -void _trace_error_value(uint32_t event); +void _trace_event_mbox(uint32_t event); void _trace_event_atomic(uint32_t event); -void _trace_error_atomic(uint32_t event); +void _trace_event_mbox_atomic(uint32_t event); void trace_flush(void); void trace_off(void); void trace_init(struct reef * reef); @@ -116,7 +115,6 @@ void trace_init(struct reef * reef); _trace_event(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) #define trace_event_atomic(__c, __e) \ _trace_event_atomic(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) - #define trace_value(x) _trace_event(x) #define trace_value_atomic(x) _trace_event_atomic(x)
@@ -138,12 +136,12 @@ void trace_init(struct reef * reef); /* error tracing */ #if TRACEE #define trace_error(__c, __e) \ - _trace_error_atomic(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) + _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) #define trace_error_atomic(__c, __e) \ - _trace_error_atomic(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) -/* write back error value to mbox*/ -#define trace_error_value(x) _trace_error_atomic(x) -#define trace_error_value_atomic(x) _trace_error_atomic(x) + _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +/* write back error value to mbox */ +#define trace_error_value(x) _trace_event_mbox_atomic(x) +#define trace_error_value_atomic(x) _trace_event_mbox_atomic(x) #else #define trace_error(__c, __e) #define trace_error_atomic(__c, __e) diff --git a/src/lib/trace.c b/src/lib/trace.c index 8d53b97..5f3ba8a 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -45,28 +45,54 @@ struct trace {
static struct trace trace;
-void _trace_error(uint32_t event) +/* send trace events only to the local trace buffer */ +void _trace_event(uint32_t event) +{ + uint64_t dt[2]; + + if (!trace.enable) + return; + + dt[0] = platform_timer_get(platform_timer); + dt[1] = event; + dtrace_event((const char *)dt, sizeof(uint64_t) * 2); +} + +void _trace_event_atomic(uint32_t event) +{ + uint64_t dt[2]; + + if (!trace.enable) + return; + + dt[0] = platform_timer_get(platform_timer); + dt[1] = event; + dtrace_event_atomic((const char *)dt, sizeof(uint64_t) * 2); +} + +/* send trace events to the local trace buffer and the mailbox */ +void _trace_event_mbox(uint32_t event) { unsigned long flags; - volatile uint64_t *t; uint64_t dt[2]; uint64_t time;
+ volatile uint64_t *t; + if (!trace.enable) return;
time = platform_timer_get(platform_timer);
- /* save event to DMA tracing buffer */ dt[0] = time; dt[1] = event; - dtrace_event((const char*)dt, sizeof(uint64_t) * 2); + dtrace_event((const char *)dt, sizeof(uint64_t) * 2);
/* send event by mail box too. */ spin_lock_irq(&trace.lock, flags);
/* write timestamp and event to trace buffer */ - t = (volatile uint64_t*)(MAILBOX_TRACE_BASE + trace.pos); + t = (volatile uint64_t *)(MAILBOX_TRACE_BASE + trace.pos); trace.pos += (sizeof(uint64_t) << 1);
if (trace.pos > MAILBOX_TRACE_SIZE - sizeof(uint64_t) * 2) @@ -78,14 +104,13 @@ void _trace_error(uint32_t event) t[1] = event;
/* writeback trace data */ - dcache_writeback_region((void*)t, sizeof(uint64_t) * 2); + dcache_writeback_region((void *)t, sizeof(uint64_t) * 2); }
-void _trace_error_atomic(uint32_t event) +void _trace_event_mbox_atomic(uint32_t event) { volatile uint64_t *t; uint64_t dt[2]; - uint64_t time;
if (!trace.enable) @@ -93,13 +118,12 @@ void _trace_error_atomic(uint32_t event)
time = platform_timer_get(platform_timer);
- /* save event to DMA tracing buffer */ dt[0] = time; dt[1] = event; - dtrace_event_atomic((const char*)dt, sizeof(uint64_t) * 2); + dtrace_event_atomic((const char *)dt, sizeof(uint64_t) * 2);
/* write timestamp and event to trace buffer */ - t = (volatile uint64_t*)(MAILBOX_TRACE_BASE + trace.pos); + t = (volatile uint64_t *)(MAILBOX_TRACE_BASE + trace.pos); trace.pos += (sizeof(uint64_t) << 1);
if (trace.pos > MAILBOX_TRACE_SIZE - sizeof(uint64_t) * 2) @@ -109,31 +133,7 @@ void _trace_error_atomic(uint32_t event) t[1] = event;
/* writeback trace data */ - dcache_writeback_region((void*)t, sizeof(uint64_t) * 2); -} - -void _trace_event(uint32_t event) -{ - uint64_t dt[2]; - - if (!trace.enable) - return; - - dt[0] = platform_timer_get(platform_timer); - dt[1] = event; - dtrace_event((const char*)dt, sizeof(uint64_t) * 2); -} - -void _trace_event_atomic(uint32_t event) -{ - uint64_t dt[2]; - - if (!trace.enable) - return; - - dt[0] = platform_timer_get(platform_timer); - dt[1] = event; - dtrace_event_atomic((const char*)dt, sizeof(uint64_t) * 2); + dcache_writeback_region((void *)t, sizeof(uint64_t) * 2); }
void trace_flush(void)