Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2018 Intel Corporation. All rights reserved.
0007  */
0008 
0009 #ifndef __INCLUDE_SOUND_SOF_TRACE_H__
0010 #define __INCLUDE_SOUND_SOF_TRACE_H__
0011 
0012 #include <sound/sof/header.h>
0013 #include <sound/sof/stream.h>
0014 
0015 /*
0016  * DMA for Trace
0017  */
0018 
0019 #define SOF_TRACE_FILENAME_SIZE     32
0020 
0021 /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */
0022 /* Deprecated - use sof_ipc_dma_trace_params_ext */
0023 struct sof_ipc_dma_trace_params {
0024     struct sof_ipc_cmd_hdr hdr;
0025     struct sof_ipc_host_buffer buffer;
0026     uint32_t stream_tag;
0027 }  __packed;
0028 
0029 /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS_EXT */
0030 struct sof_ipc_dma_trace_params_ext {
0031     struct sof_ipc_cmd_hdr hdr;
0032     struct sof_ipc_host_buffer buffer;
0033     uint32_t stream_tag;
0034     uint64_t timestamp_ns; /* in nanosecond */
0035     uint32_t reserved[8];
0036 }  __packed;
0037 
0038 /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */
0039 struct sof_ipc_dma_trace_posn {
0040     struct sof_ipc_reply rhdr;
0041     uint32_t host_offset;   /* Offset of DMA host buffer */
0042     uint32_t overflow;  /* overflow bytes if any */
0043     uint32_t messages;  /* total trace messages */
0044 }  __packed;
0045 
0046 /* Values used in sof_ipc_trace_filter_elem: */
0047 
0048 /* bits 6..0 */
0049 #define SOF_IPC_TRACE_FILTER_ELEM_SET_LEVEL 0x01    /**< trace level for selected components */
0050 #define SOF_IPC_TRACE_FILTER_ELEM_BY_UUID   0x02    /**< filter by uuid key */
0051 #define SOF_IPC_TRACE_FILTER_ELEM_BY_PIPE   0x03    /**< filter by pipeline */
0052 #define SOF_IPC_TRACE_FILTER_ELEM_BY_COMP   0x04    /**< filter by component id */
0053 
0054 /* bit 7 */
0055 #define SOF_IPC_TRACE_FILTER_ELEM_FIN       0x80    /**< mark last filter in set */
0056 
0057 /* bits 31..8: Unused */
0058 
0059 /** part of sof_ipc_trace_filter, ABI3.17 */
0060 struct sof_ipc_trace_filter_elem {
0061     uint32_t key;       /**< SOF_IPC_TRACE_FILTER_ELEM_ {LEVEL, UUID, COMP, PIPE} */
0062     uint32_t value;     /**< element value */
0063 } __packed;
0064 
0065 /** Runtime tracing filtration data - SOF_IPC_TRACE_FILTER_UPDATE, ABI3.17 */
0066 struct sof_ipc_trace_filter {
0067     struct sof_ipc_cmd_hdr hdr; /**< IPC command header */
0068     uint32_t elem_cnt;      /**< number of entries in elems[] array */
0069     uint32_t reserved[8];       /**< reserved for future usage */
0070     /** variable size array with new filtering settings */
0071     struct sof_ipc_trace_filter_elem elems[];
0072 } __packed;
0073 
0074 /*
0075  * Commom debug
0076  */
0077 
0078 /*
0079  * SOF panic codes
0080  */
0081 #define SOF_IPC_PANIC_MAGIC         0x0dead000
0082 #define SOF_IPC_PANIC_MAGIC_MASK        0x0ffff000
0083 #define SOF_IPC_PANIC_CODE_MASK         0x00000fff
0084 #define SOF_IPC_PANIC_MEM           (SOF_IPC_PANIC_MAGIC | 0x0)
0085 #define SOF_IPC_PANIC_WORK          (SOF_IPC_PANIC_MAGIC | 0x1)
0086 #define SOF_IPC_PANIC_IPC           (SOF_IPC_PANIC_MAGIC | 0x2)
0087 #define SOF_IPC_PANIC_ARCH          (SOF_IPC_PANIC_MAGIC | 0x3)
0088 #define SOF_IPC_PANIC_PLATFORM          (SOF_IPC_PANIC_MAGIC | 0x4)
0089 #define SOF_IPC_PANIC_TASK          (SOF_IPC_PANIC_MAGIC | 0x5)
0090 #define SOF_IPC_PANIC_EXCEPTION         (SOF_IPC_PANIC_MAGIC | 0x6)
0091 #define SOF_IPC_PANIC_DEADLOCK          (SOF_IPC_PANIC_MAGIC | 0x7)
0092 #define SOF_IPC_PANIC_STACK         (SOF_IPC_PANIC_MAGIC | 0x8)
0093 #define SOF_IPC_PANIC_IDLE          (SOF_IPC_PANIC_MAGIC | 0x9)
0094 #define SOF_IPC_PANIC_WFI           (SOF_IPC_PANIC_MAGIC | 0xa)
0095 #define SOF_IPC_PANIC_ASSERT            (SOF_IPC_PANIC_MAGIC | 0xb)
0096 
0097 /* panic info include filename and line number
0098  * filename array will not include null terminator if fully filled
0099  */
0100 struct sof_ipc_panic_info {
0101     struct sof_ipc_hdr hdr;
0102     uint32_t code;          /* SOF_IPC_PANIC_ */
0103     uint8_t filename[SOF_TRACE_FILENAME_SIZE];
0104     uint32_t linenum;
0105 }  __packed;
0106 
0107 #endif