~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/mediatek/mtk-adsp-common.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/soc/sof/mediatek/mtk-adsp-common.c (Architecture i386) and /sound/soc/sof/mediatek/mtk-adsp-common.c (Architecture sparc64)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php