1
2
3
4
5
6
7#include <linux/module.h>
8#include <sound/sof/xtensa.h>
9#include "../ops.h"
10
11#include "imx-common.h"
12
13
14
15
16
17
18
19
20
21
22
23void imx8_get_registers(struct snd_sof_dev *sdev,
24 struct sof_ipc_dsp_oops_xtensa *xoops,
25 struct sof_ipc_panic_info *panic_info,
26 u32 *stack, size_t stack_words)
27{
28 u32 offset = sdev->dsp_oops_offset;
29
30
31 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops));
32
33
34 if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
35 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
36 xoops->arch_hdr.totalsize);
37 return;
38 }
39 offset += xoops->arch_hdr.totalsize;
40 sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
41
42
43 offset += sizeof(*panic_info);
44 sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32));
45}
46
47
48
49
50
51
52
53void imx8_dump(struct snd_sof_dev *sdev, u32 flags)
54{
55 struct sof_ipc_dsp_oops_xtensa xoops;
56 struct sof_ipc_panic_info panic_info;
57 u32 stack[IMX8_STACK_DUMP_SIZE];
58 u32 status;
59
60
61
62
63 sof_mailbox_read(sdev, sdev->debug_box.offset + 0x4, &status, 4);
64
65
66
67
68 imx8_get_registers(sdev, &xoops, &panic_info, stack,
69 IMX8_STACK_DUMP_SIZE);
70
71
72 snd_sof_get_status(sdev, status, status, &xoops, &panic_info, stack,
73 IMX8_STACK_DUMP_SIZE);
74}
75EXPORT_SYMBOL(imx8_dump);
76
77MODULE_LICENSE("Dual BSD/GPL");
78