1 // SPDX-License-Identifier: (GPL-2.0-only OR B 1 2 // 3 // This file is provided under a dual BSD/GPLv 4 // redistributing this file, you may do so und 5 // 6 // Copyright(c) 2022 MediaTek Inc. All rights 7 // 8 // Author: YC Hung <yc.hung@mediatek.com> 9 10 /* 11 * Common helpers for the audio DSP on MediaTe 12 */ 13 14 #include <linux/module.h> 15 #include <sound/sof/xtensa.h> 16 #include "../ops.h" 17 #include "mtk-adsp-common.h" 18 19 /** 20 * mtk_adsp_get_registers() - This function is 21 * in order to gather information about the re 22 * linenumber and stack. 23 * @sdev: SOF device 24 * @xoops: Stores information about registers. 25 * @panic_info: Stores information about filen 26 * @stack: Stores the stack dump. 27 * @stack_words: Size of the stack dump. 28 */ 29 static void mtk_adsp_get_registers(struct snd_ 30 struct sof_ 31 struct sof_ 32 u32 *stack, 33 { 34 u32 offset = sdev->dsp_oops_offset; 35 36 /* first read registers */ 37 sof_mailbox_read(sdev, offset, xoops, 38 39 /* then get panic info */ 40 if (xoops->arch_hdr.totalsize > EXCEPT 41 dev_err(sdev->dev, "invalid he 42 xoops->arch_hdr.totals 43 return; 44 } 45 offset += xoops->arch_hdr.totalsize; 46 sof_mailbox_read(sdev, offset, panic_i 47 48 /* then get the stack */ 49 offset += sizeof(*panic_info); 50 sof_mailbox_read(sdev, offset, stack, 51 } 52 53 /** 54 * mtk_adsp_dump() - This function is called w 55 * received from the firmware. 56 * @sdev: SOF device 57 * @flags: parameter not used but required by 58 */ 59 void mtk_adsp_dump(struct snd_sof_dev *sdev, u 60 { 61 char *level = (flags & SOF_DBG_DUMP_OP 62 struct sof_ipc_dsp_oops_xtensa xoops; 63 struct sof_ipc_panic_info panic_info = 64 u32 stack[MTK_ADSP_STACK_DUMP_SIZE]; 65 u32 status; 66 67 /* Get information about the panic sta 68 * Compute the trace point based on th 69 */ 70 sof_mailbox_read(sdev, sdev->debug_box 71 72 /* Get information about the registers 73 * number and the stack. 74 */ 75 mtk_adsp_get_registers(sdev, &xoops, & 76 MTK_ADSP_STACK_ 77 78 /* Print the information to the consol 79 sof_print_oops_and_stack(sdev, level, 80 stack, MTK_AD 81 } 82 EXPORT_SYMBOL(mtk_adsp_dump); 83 84 MODULE_LICENSE("Dual BSD/GPL"); 85 MODULE_DESCRIPTION("SOF helpers for MTK ADSP p 86
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.