1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
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.
6 * Copyright(c) 2022 Intel Corporation. All rights reserved.
9 #ifndef __SOUND_SOC_SOF_IPC4_PRIV_H
10 #define __SOUND_SOC_SOF_IPC4_PRIV_H
12 #include <linux/idr.h>
13 #include <sound/sof/ext_manifest4.h>
16 /* The DSP window indices are fixed */
17 #define SOF_IPC4_INBOX_WINDOW_IDX 0
18 #define SOF_IPC4_OUTBOX_WINDOW_IDX 1
19 #define SOF_IPC4_DEBUG_WINDOW_IDX 2
21 enum sof_ipc4_mtrace_type {
22 SOF_IPC4_MTRACE_NOT_AVAILABLE = 0,
23 SOF_IPC4_MTRACE_INTEL_CAVS_1_5,
24 SOF_IPC4_MTRACE_INTEL_CAVS_1_8,
25 SOF_IPC4_MTRACE_INTEL_CAVS_2,
29 * struct sof_ipc4_fw_module - IPC4 module info
30 * @sof_man4_module: Module info
31 * @m_ida: Module instance identifier
32 * @bss_size: Module object size
33 * @private: Module private data
35 struct sof_ipc4_fw_module {
36 struct sof_man4_module man4_module_entry;
43 * struct sof_ipc4_fw_library - IPC4 library information
44 * @sof_fw: SOF Firmware of the library
45 * @id: Library ID. 0 is reserved for basefw, external libraries must have unique
46 * ID number between 1 and (sof_ipc4_fw_data.max_libs_count - 1)
47 * Note: sof_ipc4_fw_data.max_libs_count == 1 implies that external libraries
49 * @num_modules : Number of FW modules in the library
50 * @modules: Array of FW modules
52 struct sof_ipc4_fw_library {
53 struct sof_firmware sof_fw;
57 struct sof_ipc4_fw_module *modules;
61 * struct sof_ipc4_fw_data - IPC4-specific data
62 * @manifest_fw_hdr_offset: FW header offset in the manifest
63 * @fw_lib_xa: XArray for firmware libraries, including basefw (ID = 0)
64 * Used to store the FW libraries and to manage the unique IDs of the
66 * @nhlt: NHLT table either from the BIOS or the topology manifest
67 * @mtrace_type: mtrace type supported on the booted platform
68 * @mtrace_log_bytes: log bytes as reported by the firmware via fw_config reply
69 * @max_num_pipelines: max number of pipelines
70 * @max_libs_count: Maximum number of libraries support by the FW including the
73 * @load_library: Callback function for platform dependent library loading
74 * @pipeline_state_mutex: Mutex to protect pipeline triggers, ref counts, states and deletion
76 struct sof_ipc4_fw_data {
77 u32 manifest_fw_hdr_offset;
78 struct xarray fw_lib_xa;
80 enum sof_ipc4_mtrace_type mtrace_type;
82 int max_num_pipelines;
85 int (*load_library)(struct snd_sof_dev *sdev,
86 struct sof_ipc4_fw_library *fw_lib, bool reload);
87 struct mutex pipeline_state_mutex; /* protect pipeline triggers, ref counts and states */
91 * struct sof_ipc4_timestamp_info - IPC4 timestamp info
92 * @host_copier: the host copier of the pcm stream
93 * @dai_copier: the dai copier of the pcm stream
94 * @stream_start_offset: reported by fw in memory window
95 * @llp_offset: llp offset in memory window
97 struct sof_ipc4_timestamp_info {
98 struct sof_ipc4_copier *host_copier;
99 struct sof_ipc4_copier *dai_copier;
100 u64 stream_start_offset;
104 extern const struct sof_ipc_fw_loader_ops ipc4_loader_ops;
105 extern const struct sof_ipc_tplg_ops ipc4_tplg_ops;
106 extern const struct sof_ipc_tplg_control_ops tplg_ipc4_control_ops;
107 extern const struct sof_ipc_pcm_ops ipc4_pcm_ops;
108 extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops;
110 int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state);
111 int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core);
113 int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev);
114 int sof_ipc4_reload_fw_libraries(struct snd_sof_dev *sdev);
115 struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev,