File Index
Files and directories
Sign in
FILE

debug.h

File preview with syntax highlighting.

linux-6.19.14/sound/soc/intel/avs/debug.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright(c) 2024-2025 Intel Corporation
 4 *
 5 * Authors: Cezary Rojewski <cezary.rojewski@intel.com>
 6 *          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
 7 */
 8
 9#ifndef __SOUND_SOC_INTEL_AVS_DEBUG_H
10#define __SOUND_SOC_INTEL_AVS_DEBUG_H
11
12#include "messages.h"
13#include "registers.h"
14
15struct avs_dev;
16
17#define avs_log_buffer_size(adev) \
18	((adev)->fw_cfg.trace_log_bytes / (adev)->hw_cfg.dsp_cores)
19
20#define avs_log_buffer_addr(adev, core) \
21({										\
22	s32 __offset = avs_dsp_op(adev, log_buffer_offset, core);		\
23	(__offset < 0) ? NULL :							\
24			 (avs_sram_addr(adev, AVS_DEBUG_WINDOW) + __offset);	\
25})
26
27static inline int avs_log_buffer_status_locked(struct avs_dev *adev, union avs_notify_msg *msg)
28{
29	unsigned long flags;
30	int ret;
31
32	spin_lock_irqsave(&adev->trace_lock, flags);
33	ret = avs_dsp_op(adev, log_buffer_status, msg);
34	spin_unlock_irqrestore(&adev->trace_lock, flags);
35
36	return ret;
37}
38
39struct avs_apl_log_buffer_layout {
40	u32 read_ptr;
41	u32 write_ptr;
42	u8 buffer[];
43} __packed;
44static_assert(sizeof(struct avs_apl_log_buffer_layout) == 8);
45
46#define avs_apl_log_payload_size(adev) \
47	(avs_log_buffer_size(adev) - sizeof(struct avs_apl_log_buffer_layout))
48
49#define avs_apl_log_payload_addr(addr) \
50	(addr + sizeof(struct avs_apl_log_buffer_layout))
51
52#ifdef CONFIG_DEBUG_FS
53int avs_register_probe_component(struct avs_dev *adev, const char *name);
54
55#define AVS_SET_ENABLE_LOGS_OP(name) \
56	.enable_logs = avs_##name##_enable_logs
57
58bool avs_logging_fw(struct avs_dev *adev);
59void avs_dump_fw_log(struct avs_dev *adev, const void __iomem *src, unsigned int len);
60void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsigned int len);
61
62void avs_debugfs_init(struct avs_dev *adev);
63void avs_debugfs_exit(struct avs_dev *adev);
64
65#else
66static inline int avs_register_probe_component(struct avs_dev *adev, const char *name)
67{
68	return -EOPNOTSUPP;
69}
70
71#define AVS_SET_ENABLE_LOGS_OP(name)
72
73static inline bool avs_logging_fw(struct avs_dev *adev)
74{
75	return false;
76}
77
78static inline void avs_dump_fw_log(struct avs_dev *adev, const void __iomem *src, unsigned int len)
79{
80}
81
82static inline void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src,
83					  unsigned int len)
84{
85}
86
87static inline void avs_debugfs_init(struct avs_dev *adev) { }
88static inline void avs_debugfs_exit(struct avs_dev *adev) { }
89#endif
90
91#endif
~/ Read-only file preview.