[Sound-open-firmware] [PATCH] baytrail: panic: fix panic on baytrail.
Simplify and fix panic output on baytrail.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/baytrail/include/platform/platform.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 72174f3..dca0c47 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -93,13 +93,11 @@ struct reef;
/* Platform defined panic code */ #define platform_panic(__x) \ - shim_write(SHIM_IPCXL, ((shim_read(SHIM_IPCXL) & 0xc0000000) |\ - ((0xdead000 | __x) & 0x3fffffff))) + shim_write(SHIM_IPCDH, (0xdead000 | (__x & 0xfff)))
/* Platform defined trace code */ #define platform_trace_point(__x) \ - shim_write(SHIM_IPCDH, ((shim_read(SHIM_IPCDH) & 0xc0000000) |\ - ((__x) & 0x3fffffff))) + shim_write(SHIM_IPCDH, (__x & 0x3fffffff)) /* * APIs declared here are defined for every platform and IPC mechanism. */
Add this macro at platform level so it can be used by others.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/baytrail/include/platform/platform.h | 3 +++ src/platform/baytrail/platform.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index dca0c47..bc90564 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -76,6 +76,9 @@ struct reef; /* WorkQ window size in microseconds */ #define PLATFORM_WORKQ_WINDOW 2000
+/* platform WorkQ clock */ +#define PLATFORM_WORKQ_CLOCK CLK_SSP + /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE
diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index cd884a8..5cda2da 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -78,7 +78,7 @@ static struct work_queue_timesource platform_generic_queue = { .id = TIMER3, /* external timer */ .irq = IRQ_NUM_EXT_TIMER, }, - .clk = CLK_SSP, + .clk = PLATFORM_WORKQ_CLOCK, .notifier = NOTIFIER_ID_SSP_FREQ, .timer_set = platform_timer_set, .timer_clear = platform_timer_clear,
Return the current stack pointer.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/include/arch/reef.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/src/arch/xtensa/include/arch/reef.h b/src/arch/xtensa/include/arch/reef.h index ef2f395..149de5d 100644 --- a/src/arch/xtensa/include/arch/reef.h +++ b/src/arch/xtensa/include/arch/reef.h @@ -40,4 +40,16 @@ void *xthal_memcpy(void *dst, const void *src, size_t len); #define arch_memcpy(dest, src, size) \ xthal_memcpy(dest, src, size)
+static inline size_t arch_get_stack_ptr(void) +{ + size_t ptr; + + /* stack pointer is in a1 */ + __asm__ __volatile__ ("mov %0, a1" + : "=a" (ptr) + : + : "memory"); + return ptr; +} + #endif
Fix so that dump stack does not overwrite any debug data and does not read past the end of the stack.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/debug.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/include/reef/debug.h b/src/include/reef/debug.h index 7551fc5..85f91d4 100644 --- a/src/include/reef/debug.h +++ b/src/include/reef/debug.h @@ -46,6 +46,7 @@ #define PANIC_TASK 5 #define PANIC_EXCEPTION 6 #define PANIC_DEADLOCK 7 +#define PANIC_STACK 8
#define DEBUG
@@ -144,26 +145,26 @@ } while (0);
/* dump stack as part of panic */ -/* TODO: rework to make this generic - the stack top can be moved to arch code */ #define panic_dump_stack(_p) \ do { \ extern uint32_t __stack; \ extern uint32_t _stack_sentry; \ uint32_t _stack_bottom = (uint32_t)&__stack; \ uint32_t _stack_limit = (uint32_t)&_stack_sentry; \ - uint32_t _stack_top; \ - \ - __asm__ __volatile__ ("mov %0, a1" : "=a" (_stack_top) : : "memory"); \ + uint32_t _stack_top = arch_get_stack_ptr(); \ + uint32_t _size = _stack_bottom - _stack_top; \ + uint32_t _panic = _p; \ dbg_val(0xdead0000 | _p) \ - platform_panic(_p); \ - dbg_val(_stack_top) \ - dbg_val(_stack_bottom) \ - \ + dbg_val_at(_stack_top, 1) \ + dbg_val_at(_stack_bottom, 2) \ + /* is stack smashed ? */\ if (_stack_bottom <= _stack_limit) { \ - dbg_val(0x51ac0000 | _p) \ + dbg_val_at(0x51ac0000 | _p, 3); \ _stack_bottom = _stack_limit; \ + _panic = PANIC_STACK; \ } \ - dump(_stack_top, _stack_bottom - _stack_top) \ + platform_panic(_panic); \ + dump_at(_stack_top, (_size - sizeof(uint32_t)) >> 2, 4) \ \ while(1) {}; \ } while (0);
participants (1)
-
Liam Girdwood