trace.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2. /*
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * Copyright(c) 2018 Intel Corporation
  7. */
  8. #ifndef __INCLUDE_SOUND_SOF_TRACE_H__
  9. #define __INCLUDE_SOUND_SOF_TRACE_H__
  10. #include <sound/sof/header.h>
  11. #include <sound/sof/stream.h>
  12. /*
  13. * DMA for Trace
  14. */
  15. #define SOF_TRACE_FILENAME_SIZE 32
  16. /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */
  17. /* Deprecated - use sof_ipc_dma_trace_params_ext */
  18. struct sof_ipc_dma_trace_params {
  19. struct sof_ipc_cmd_hdr hdr;
  20. struct sof_ipc_host_buffer buffer;
  21. uint32_t stream_tag;
  22. } __packed;
  23. /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS_EXT */
  24. struct sof_ipc_dma_trace_params_ext {
  25. struct sof_ipc_cmd_hdr hdr;
  26. struct sof_ipc_host_buffer buffer;
  27. uint32_t stream_tag;
  28. uint64_t timestamp_ns; /* in nanosecond */
  29. uint32_t reserved[8];
  30. } __packed;
  31. /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */
  32. struct sof_ipc_dma_trace_posn {
  33. struct sof_ipc_reply rhdr;
  34. uint32_t host_offset; /* Offset of DMA host buffer */
  35. uint32_t overflow; /* overflow bytes if any */
  36. uint32_t messages; /* total trace messages */
  37. } __packed;
  38. /* Values used in sof_ipc_trace_filter_elem: */
  39. /* bits 6..0 */
  40. #define SOF_IPC_TRACE_FILTER_ELEM_SET_LEVEL 0x01 /**< trace level for selected components */
  41. #define SOF_IPC_TRACE_FILTER_ELEM_BY_UUID 0x02 /**< filter by uuid key */
  42. #define SOF_IPC_TRACE_FILTER_ELEM_BY_PIPE 0x03 /**< filter by pipeline */
  43. #define SOF_IPC_TRACE_FILTER_ELEM_BY_COMP 0x04 /**< filter by component id */
  44. /* bit 7 */
  45. #define SOF_IPC_TRACE_FILTER_ELEM_FIN 0x80 /**< mark last filter in set */
  46. /* bits 31..8: Unused */
  47. /** part of sof_ipc_trace_filter, ABI3.17 */
  48. struct sof_ipc_trace_filter_elem {
  49. uint32_t key; /**< SOF_IPC_TRACE_FILTER_ELEM_ {LEVEL, UUID, COMP, PIPE} */
  50. uint32_t value; /**< element value */
  51. } __packed;
  52. /** Runtime tracing filtration data - SOF_IPC_TRACE_FILTER_UPDATE, ABI3.17 */
  53. struct sof_ipc_trace_filter {
  54. struct sof_ipc_cmd_hdr hdr; /**< IPC command header */
  55. uint32_t elem_cnt; /**< number of entries in elems[] array */
  56. uint32_t reserved[8]; /**< reserved for future usage */
  57. /** variable size array with new filtering settings */
  58. struct sof_ipc_trace_filter_elem elems[];
  59. } __packed;
  60. /*
  61. * Commom debug
  62. */
  63. /*
  64. * SOF panic codes
  65. */
  66. #define SOF_IPC_PANIC_MAGIC 0x0dead000
  67. #define SOF_IPC_PANIC_MAGIC_MASK 0x0ffff000
  68. #define SOF_IPC_PANIC_CODE_MASK 0x00000fff
  69. #define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0x0)
  70. #define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 0x1)
  71. #define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 0x2)
  72. #define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 0x3)
  73. #define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 0x4)
  74. #define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 0x5)
  75. #define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 0x6)
  76. #define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 0x7)
  77. #define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 0x8)
  78. #define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 0x9)
  79. #define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa)
  80. #define SOF_IPC_PANIC_ASSERT (SOF_IPC_PANIC_MAGIC | 0xb)
  81. /* panic info include filename and line number
  82. * filename array will not include null terminator if fully filled
  83. */
  84. struct sof_ipc_panic_info {
  85. struct sof_ipc_hdr hdr;
  86. uint32_t code; /* SOF_IPC_PANIC_ */
  87. uint8_t filename[SOF_TRACE_FILENAME_SIZE];
  88. uint32_t linenum;
  89. } __packed;
  90. #endif