From b780605eaf22472e2f0230a9f1173a7d92193cf2 Mon Sep 17 00:00:00 2001 From: Janusz Jankowski Date: Wed, 15 May 2019 14:33:29 +0200 Subject: [PATCH] uapi: xtensa: change ar to variable array Signed-off-by: Janusz Jankowski --- src/arch/xtensa/include/arch/sof.h | 9 +++++++-- src/include/uapi/ipc/xtensa.h | 2 +- src/lib/panic.c | 3 +-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/arch/xtensa/include/arch/sof.h b/src/arch/xtensa/include/arch/sof.h index 4b10ebd18..2248b4730 100644 --- a/src/arch/xtensa/include/arch/sof.h +++ b/src/arch/xtensa/include/arch/sof.h @@ -26,6 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * Author: Liam Girdwood + * Janusz Jankowski * */ @@ -41,6 +42,10 @@ /* architecture specific stack frames to dump */ #define ARCH_STACK_DUMP_FRAMES 32 +/* xtensa core specific oops size */ +#define ARCH_OOPS_SIZE (sizeof(struct sof_ipc_dsp_oops_xtensa) \ + + (XCHAL_NUM_AREGS * sizeof(uint32_t))) + void arch_dump_regs_a(void *dump_buf, uint32_t ps); static inline void *arch_get_stack_ptr(void) @@ -60,7 +65,7 @@ static inline void fill_core_dump(struct sof_ipc_dsp_oops_xtensa *oops, uintptr_t *epc1) { oops->arch_hdr.arch = ARCHITECTURE_ID; - oops->arch_hdr.totalsize = sizeof(*oops); + oops->arch_hdr.totalsize = ARCH_OOPS_SIZE; #if XCHAL_HW_CONFIGID_RELIABLE oops->plat_hdr.configidhi = XCHAL_HW_CONFIGID0; oops->plat_hdr.configidlo = XCHAL_HW_CONFIGID1; @@ -85,7 +90,7 @@ static inline void arch_dump_regs(uint32_t ps, uintptr_t stack_ptr, fill_core_dump(buf, ps, stack_ptr, epc1); - dcache_writeback_region(buf, sizeof(struct sof_ipc_dsp_oops_xtensa)); + dcache_writeback_region(buf, ARCH_OOPS_SIZE); } #endif diff --git a/src/include/uapi/ipc/xtensa.h b/src/include/uapi/ipc/xtensa.h index 11b0c9c56..38e2dbad5 100644 --- a/src/include/uapi/ipc/xtensa.h +++ b/src/include/uapi/ipc/xtensa.h @@ -76,7 +76,7 @@ struct sof_ipc_dsp_oops_xtensa { uint32_t widnowbase; uint32_t windowstart; uint32_t excsave1; - uint32_t ar[XCHAL_NUM_AREGS]; + uint32_t ar[]; } __attribute__((packed)); #endif diff --git a/src/lib/panic.c b/src/lib/panic.c index 69a3a9702..3f28add0c 100644 --- a/src/lib/panic.c +++ b/src/lib/panic.c @@ -62,8 +62,7 @@ void panic_rewind(uint32_t p, uint32_t stack_rewind_frames, /* disable all IRQs */ oldps = interrupt_global_disable(); - ext_offset = (void *)mailbox_get_exception_base() + - sizeof(struct sof_ipc_dsp_oops_xtensa); + ext_offset = (void *)mailbox_get_exception_base() + ARCH_OOPS_SIZE; /* dump panic info, filename ane linenum */ dump_panicinfo(ext_offset, panic_info);