Commit | Line | Data |
---|---|---|
0af82904 RS |
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) 2022 Intel Corporation. All rights reserved. | |
7 | */ | |
8 | ||
9 | #ifndef __SOUND_SOC_SOF_IPC4_PRIV_H | |
10 | #define __SOUND_SOC_SOF_IPC4_PRIV_H | |
11 | ||
12 | #include <linux/idr.h> | |
c62ff366 | 13 | #include <sound/sof/ext_manifest4.h> |
0af82904 | 14 | #include "sof-priv.h" |
b59f1532 PU |
15 | |
16 | /* The DSP window indices are fixed */ | |
17 | #define SOF_IPC4_OUTBOX_WINDOW_IDX 1 | |
a5d0147a | 18 | #define SOF_IPC4_DEBUG_WINDOW_IDX 2 |
0af82904 | 19 | |
f4ea22f7 PU |
20 | enum sof_ipc4_mtrace_type { |
21 | SOF_IPC4_MTRACE_NOT_AVAILABLE = 0, | |
22 | SOF_IPC4_MTRACE_INTEL_CAVS_1_5, | |
23 | SOF_IPC4_MTRACE_INTEL_CAVS_1_8, | |
24 | SOF_IPC4_MTRACE_INTEL_CAVS_2, | |
25 | }; | |
26 | ||
5a932cfc PU |
27 | /** |
28 | * struct sof_ipc4_fw_module - IPC4 module info | |
29 | * @sof_man4_module: Module info | |
30 | * @m_ida: Module instance identifier | |
31 | * @bss_size: Module object size | |
32 | * @private: Module private data | |
33 | */ | |
34 | struct sof_ipc4_fw_module { | |
35 | struct sof_man4_module man4_module_entry; | |
36 | struct ida m_ida; | |
37 | u32 bss_size; | |
38 | void *private; | |
39 | }; | |
40 | ||
41 | /** | |
42 | * struct sof_ipc4_fw_library - IPC4 library information | |
43 | * @sof_fw: SOF Firmware of the library | |
44 | * @id: Library ID. 0 is reserved for basefw, external libraries must have unique | |
45 | * ID number between 1 and (sof_ipc4_fw_data.max_libs_count - 1) | |
46 | * Note: sof_ipc4_fw_data.max_libs_count == 1 implies that external libraries | |
47 | * are not supported | |
48 | * @num_modules : Number of FW modules in the library | |
49 | * @modules: Array of FW modules | |
50 | */ | |
51 | struct sof_ipc4_fw_library { | |
52 | struct sof_firmware sof_fw; | |
73c091a2 | 53 | const char *name; |
5a932cfc PU |
54 | u32 id; |
55 | int num_modules; | |
56 | struct sof_ipc4_fw_module *modules; | |
57 | }; | |
58 | ||
0af82904 RS |
59 | /** |
60 | * struct sof_ipc4_fw_data - IPC4-specific data | |
61 | * @manifest_fw_hdr_offset: FW header offset in the manifest | |
5a932cfc PU |
62 | * @fw_lib_xa: XArray for firmware libraries, including basefw (ID = 0) |
63 | * Used to store the FW libraries and to manage the unique IDs of the | |
64 | * libraries. | |
1da51943 | 65 | * @nhlt: NHLT table either from the BIOS or the topology manifest |
f4ea22f7 PU |
66 | * @mtrace_type: mtrace type supported on the booted platform |
67 | * @mtrace_log_bytes: log bytes as reported by the firmware via fw_config reply | |
eb2eaf50 | 68 | * @max_num_pipelines: max number of pipelines |
b0a12fa9 PU |
69 | * @max_libs_count: Maximum number of libraries support by the FW including the |
70 | * base firmware | |
a5ab431e PU |
71 | * |
72 | * @load_library: Callback function for platform dependent library loading | |
32c4b698 | 73 | * @trigger_mutex: Mutex to protect pipeline triggers, ref counts and states |
0af82904 RS |
74 | */ |
75 | struct sof_ipc4_fw_data { | |
76 | u32 manifest_fw_hdr_offset; | |
5a932cfc | 77 | struct xarray fw_lib_xa; |
1da51943 | 78 | void *nhlt; |
f4ea22f7 PU |
79 | enum sof_ipc4_mtrace_type mtrace_type; |
80 | u32 mtrace_log_bytes; | |
eb2eaf50 | 81 | int max_num_pipelines; |
b0a12fa9 | 82 | u32 max_libs_count; |
a5ab431e PU |
83 | |
84 | int (*load_library)(struct snd_sof_dev *sdev, | |
85 | struct sof_ipc4_fw_library *fw_lib, bool reload); | |
32c4b698 | 86 | struct mutex trigger_mutex; /* protect pipeline triggers, ref counts and states */ |
0af82904 RS |
87 | }; |
88 | ||
c62ff366 | 89 | extern const struct sof_ipc_fw_loader_ops ipc4_loader_ops; |
90e89155 | 90 | extern const struct sof_ipc_tplg_ops ipc4_tplg_ops; |
955e84fc | 91 | extern const struct sof_ipc_tplg_control_ops tplg_ipc4_control_ops; |
e75e5db8 | 92 | extern const struct sof_ipc_pcm_ops ipc4_pcm_ops; |
f4ea22f7 | 93 | extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops; |
c62ff366 | 94 | |
d0c0d5bf | 95 | int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state); |
f4ea22f7 | 96 | int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core); |
c73f8b47 | 97 | |
e6851310 | 98 | int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev); |
73c091a2 | 99 | int sof_ipc4_reload_fw_libraries(struct snd_sof_dev *sdev); |
c73f8b47 PU |
100 | struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev, |
101 | const guid_t *uuid); | |
0af82904 | 102 | #endif |