Repository navigation
Expand file tree
/
Copy pathpanic.h
More file actions
68 lines (54 loc) · 1.88 KB
/
Copy pathpanic.h
File metadata and controls
68 lines (54 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2019 Intel Corporation. All rights reserved.
*
* Author: Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/
#ifdef __XTOS_RTOS_PANIC_H__
#ifndef __ARCH_DEBUG_PANIC_H__
#define __ARCH_DEBUG_PANIC_H__
#include <rtos/cache.h>
#include <ipc/trace.h>
#include <ipc/xtensa.h>
#include <xtensa/config/core-isa.h>
#include <stdint.h>
/* 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);
static inline void fill_core_dump(struct sof_ipc_dsp_oops_xtensa *oops,
uintptr_t stack_ptr, uintptr_t *epc1)
{
oops->arch_hdr.arch = ARCHITECTURE_ID;
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;
#else
oops->plat_hdr.configidhi = 0;
oops->plat_hdr.configidlo = 0;
#endif
oops->plat_hdr.numaregs = XCHAL_NUM_AREGS;
oops->plat_hdr.stackoffset = oops->arch_hdr.totalsize
+ sizeof(struct sof_ipc_panic_info);
oops->plat_hdr.stackptr = stack_ptr;
if (epc1)
oops->epc1 = *epc1;
/* With crosstool-ng gcc on some platforms this corrupts most of
* the other panic information, including the precious line
* number. See https://github.com/thesofproject/sof/issues/1346
* Commenting this out loses the registers but avoids the
* corruption of the rest.
*/
arch_dump_regs_a((void *)&oops->exccause);
}
static inline void arch_dump_regs(void *dump_buf, uintptr_t stack_ptr,
uintptr_t *epc1)
{
fill_core_dump(dump_buf, stack_ptr, epc1);
dcache_writeback_region((__sparse_force void __sparse_cache *)dump_buf, ARCH_OOPS_SIZE);
}
#endif /* __ARCH_DEBUG_PANIC_H__ */
#else
#error "This file shouldn't be included from outside of XTOS's rtos/panic.h"
#endif /* __XTOS_RTOS_PANIC_H__ */