ASoC: SOF: Intel: clarify Copyright information
[linux-2.6-block.git] / sound / soc / sof / ipc4-priv.h
CommitLineData
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 *
293ad281 6 * Copyright(c) 2022 Intel Corporation
0af82904
RS
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 */
4700bfb2 17#define SOF_IPC4_INBOX_WINDOW_IDX 0
b59f1532 18#define SOF_IPC4_OUTBOX_WINDOW_IDX 1
a5d0147a 19#define SOF_IPC4_DEBUG_WINDOW_IDX 2
0af82904 20
f4ea22f7
PU
21enum 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,
26};
27
5a932cfc
PU
28/**
29 * struct sof_ipc4_fw_module - IPC4 module info
30 * @sof_man4_module: Module info
fe04f300 31 * @fw_mod_cfg: Pointer to the module config start of the module
5a932cfc 32 * @m_ida: Module instance identifier
5a932cfc
PU
33 * @private: Module private data
34 */
35struct sof_ipc4_fw_module {
36 struct sof_man4_module man4_module_entry;
fe04f300 37 const struct sof_man4_module_config *fw_mod_cfg;
5a932cfc 38 struct ida m_ida;
5a932cfc
PU
39 void *private;
40};
41
42/**
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
48 * are not supported
49 * @num_modules : Number of FW modules in the library
50 * @modules: Array of FW modules
51 */
52struct sof_ipc4_fw_library {
53 struct sof_firmware sof_fw;
73c091a2 54 const char *name;
5a932cfc
PU
55 u32 id;
56 int num_modules;
57 struct sof_ipc4_fw_module *modules;
58};
59
0af82904
RS
60/**
61 * struct sof_ipc4_fw_data - IPC4-specific data
62 * @manifest_fw_hdr_offset: FW header offset in the manifest
5a932cfc
PU
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
65 * libraries.
1da51943 66 * @nhlt: NHLT table either from the BIOS or the topology manifest
f4ea22f7
PU
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
42647634
PLB
69 * @num_playback_streams: max number of playback DMAs, needed for CHAIN_DMA offset
70 * @num_capture_streams: max number of capture DMAs
eb2eaf50 71 * @max_num_pipelines: max number of pipelines
b0a12fa9
PU
72 * @max_libs_count: Maximum number of libraries support by the FW including the
73 * base firmware
a5ab431e
PU
74 *
75 * @load_library: Callback function for platform dependent library loading
6bc4d1b7 76 * @pipeline_state_mutex: Mutex to protect pipeline triggers, ref counts, states and deletion
0af82904
RS
77 */
78struct sof_ipc4_fw_data {
79 u32 manifest_fw_hdr_offset;
5a932cfc 80 struct xarray fw_lib_xa;
1da51943 81 void *nhlt;
f4ea22f7
PU
82 enum sof_ipc4_mtrace_type mtrace_type;
83 u32 mtrace_log_bytes;
42647634
PLB
84 int num_playback_streams;
85 int num_capture_streams;
eb2eaf50 86 int max_num_pipelines;
b0a12fa9 87 u32 max_libs_count;
855a4772 88 bool fw_context_save;
a5ab431e
PU
89
90 int (*load_library)(struct snd_sof_dev *sdev,
91 struct sof_ipc4_fw_library *fw_lib, bool reload);
6bc4d1b7 92 struct mutex pipeline_state_mutex; /* protect pipeline triggers, ref counts and states */
0af82904
RS
93};
94
c62ff366 95extern const struct sof_ipc_fw_loader_ops ipc4_loader_ops;
90e89155 96extern const struct sof_ipc_tplg_ops ipc4_tplg_ops;
955e84fc 97extern const struct sof_ipc_tplg_control_ops tplg_ipc4_control_ops;
e75e5db8 98extern const struct sof_ipc_pcm_ops ipc4_pcm_ops;
f4ea22f7 99extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops;
c62ff366 100
458e3870 101int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 instance_id, u32 state);
f4ea22f7 102int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core);
c73f8b47 103
e6851310 104int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev);
73c091a2 105int sof_ipc4_reload_fw_libraries(struct snd_sof_dev *sdev);
c73f8b47
PU
106struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev,
107 const guid_t *uuid);
d8a2c987 108
5980bda0
PU
109struct snd_sof_widget *sof_ipc4_find_swidget_by_ids(struct snd_sof_dev *sdev,
110 u32 module_id, int instance_id);
111
d8a2c987
PU
112struct sof_ipc4_base_module_cfg;
113void sof_ipc4_update_cpc_from_manifest(struct snd_sof_dev *sdev,
114 struct sof_ipc4_fw_module *fw_module,
115 struct sof_ipc4_base_module_cfg *basecfg);
116
a397899f
RW
117size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
118 u32 slot_type);
119
0af82904 120#endif