xref: /openbmc/linux/include/sound/sof/ipc4/header.h (revision 6b486d7f)
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 __INCLUDE_SOUND_SOF_IPC4_HEADER_H__
10 #define __INCLUDE_SOUND_SOF_IPC4_HEADER_H__
11 
12 #include <linux/types.h>
13 #include <uapi/sound/sof/abi.h>
14 
15 /* maximum message size for mailbox Tx/Rx */
16 #define SOF_IPC4_MSG_MAX_SIZE			4096
17 
18 /** \addtogroup sof_uapi uAPI
19  *  SOF uAPI specification.
20  *  @{
21  */
22 
23 /**
24  * struct sof_ipc4_msg - Placeholder of an IPC4 message
25  * @header_u64:		IPC4 header as single u64 number
26  * @primary:		Primary, mandatory part of the header
27  * @extension:		Extended part of the header, if not used it should be
28  *			set to 0
29  * @data_size:		Size of data in bytes pointed by @data_ptr
30  * @data_ptr:		Pointer to the optional payload of a message
31  */
32 struct sof_ipc4_msg {
33 	union {
34 		u64 header_u64;
35 		struct {
36 			u32 primary;
37 			u32 extension;
38 		};
39 	};
40 
41 	size_t data_size;
42 	void *data_ptr;
43 };
44 
45 /**
46  * struct sof_ipc4_tuple - Generic type/ID and parameter tuple
47  * @type:		type/ID
48  * @size:		size of the @value array in bytes
49  * @value:		value for the given type
50  */
51 struct sof_ipc4_tuple {
52 	uint32_t type;
53 	uint32_t size;
54 	uint32_t value[];
55 } __packed;
56 
57 /*
58  * IPC4 messages have two 32 bit identifier made up as follows :-
59  *
60  * header - msg type, msg id, msg direction ...
61  * extension - extra params such as msg data size in mailbox
62  *
63  * These are sent at the start of the IPC message in the mailbox. Messages
64  * should not be sent in the doorbell (special exceptions for firmware).
65  */
66 
67 /*
68  * IPC4 primary header bit allocation for messages
69  * bit 0-23:	message type specific
70  * bit 24-28:	type:	enum sof_ipc4_global_msg if target is SOF_IPC4_FW_GEN_MSG
71  *			enum sof_ipc4_module_type if target is SOF_IPC4_MODULE_MSG
72  * bit 29:	response - sof_ipc4_msg_dir
73  * bit 30:	target - enum sof_ipc4_msg_target
74  * bit 31:	reserved, unused
75  */
76 
77 /* Value of target field - must fit into 1 bit */
78 enum sof_ipc4_msg_target {
79 	/* Global FW message */
80 	SOF_IPC4_FW_GEN_MSG,
81 
82 	/* Module message */
83 	SOF_IPC4_MODULE_MSG
84 };
85 
86 /* Value of type field - must fit into 5 bits */
87 enum sof_ipc4_global_msg {
88 	SOF_IPC4_GLB_BOOT_CONFIG,
89 	SOF_IPC4_GLB_ROM_CONTROL,
90 	SOF_IPC4_GLB_IPCGATEWAY_CMD,
91 
92 	/* 3 .. 12: RESERVED - do not use */
93 
94 	SOF_IPC4_GLB_PERF_MEASUREMENTS_CMD = 13,
95 	SOF_IPC4_GLB_CHAIN_DMA,
96 
97 	SOF_IPC4_GLB_LOAD_MULTIPLE_MODULES,
98 	SOF_IPC4_GLB_UNLOAD_MULTIPLE_MODULES,
99 
100 	/* pipeline settings */
101 	SOF_IPC4_GLB_CREATE_PIPELINE,
102 	SOF_IPC4_GLB_DELETE_PIPELINE,
103 	SOF_IPC4_GLB_SET_PIPELINE_STATE,
104 	SOF_IPC4_GLB_GET_PIPELINE_STATE,
105 	SOF_IPC4_GLB_GET_PIPELINE_CONTEXT_SIZE,
106 	SOF_IPC4_GLB_SAVE_PIPELINE,
107 	SOF_IPC4_GLB_RESTORE_PIPELINE,
108 
109 	/* Loads library (using Code Load or HD/A Host Output DMA) */
110 	SOF_IPC4_GLB_LOAD_LIBRARY,
111 
112 	/* 25: RESERVED - do not use */
113 
114 	SOF_IPC4_GLB_INTERNAL_MESSAGE = 26,
115 
116 	/* Notification (FW to SW driver) */
117 	SOF_IPC4_GLB_NOTIFICATION,
118 
119 	/* 28 .. 31: RESERVED - do not use */
120 
121 	SOF_IPC4_GLB_TYPE_LAST,
122 };
123 
124 /* Value of response field - must fit into 1 bit */
125 enum sof_ipc4_msg_dir {
126 	SOF_IPC4_MSG_REQUEST,
127 	SOF_IPC4_MSG_REPLY,
128 };
129 
130 enum sof_ipc4_pipeline_state {
131 	SOF_IPC4_PIPE_INVALID_STATE,
132 	SOF_IPC4_PIPE_UNINITIALIZED,
133 	SOF_IPC4_PIPE_RESET,
134 	SOF_IPC4_PIPE_PAUSED,
135 	SOF_IPC4_PIPE_RUNNING,
136 	SOF_IPC4_PIPE_EOS
137 };
138 
139 /* Generic message fields (bit 24-30) */
140 
141 /* encoded to header's msg_tgt field */
142 #define SOF_IPC4_MSG_TARGET_SHIFT		30
143 #define SOF_IPC4_MSG_TARGET_MASK		BIT(30)
144 #define SOF_IPC4_MSG_TARGET(x)			((x) << SOF_IPC4_MSG_TARGET_SHIFT)
145 #define SOF_IPC4_MSG_IS_MODULE_MSG(x)		((x) & SOF_IPC4_MSG_TARGET_MASK ? 1 : 0)
146 
147 /* encoded to header's rsp field */
148 #define SOF_IPC4_MSG_DIR_SHIFT			29
149 #define SOF_IPC4_MSG_DIR_MASK			BIT(29)
150 #define SOF_IPC4_MSG_DIR(x)			((x) << SOF_IPC4_MSG_DIR_SHIFT)
151 
152 /* encoded to header's type field */
153 #define SOF_IPC4_MSG_TYPE_SHIFT			24
154 #define SOF_IPC4_MSG_TYPE_MASK			GENMASK(28, 24)
155 #define SOF_IPC4_MSG_TYPE_SET(x)		(((x) << SOF_IPC4_MSG_TYPE_SHIFT) & \
156 						 SOF_IPC4_MSG_TYPE_MASK)
157 #define SOF_IPC4_MSG_TYPE_GET(x)		(((x) & SOF_IPC4_MSG_TYPE_MASK) >> \
158 						 SOF_IPC4_MSG_TYPE_SHIFT)
159 
160 /* Global message type specific field definitions */
161 
162 /* pipeline creation ipc msg */
163 #define SOF_IPC4_GLB_PIPE_INSTANCE_SHIFT	16
164 #define SOF_IPC4_GLB_PIPE_INSTANCE_MASK		GENMASK(23, 16)
165 #define SOF_IPC4_GLB_PIPE_INSTANCE_ID(x)	((x) << SOF_IPC4_GLB_PIPE_INSTANCE_SHIFT)
166 
167 #define SOF_IPC4_GLB_PIPE_PRIORITY_SHIFT	11
168 #define SOF_IPC4_GLB_PIPE_PRIORITY_MASK		GENMASK(15, 11)
169 #define SOF_IPC4_GLB_PIPE_PRIORITY(x)		((x) << SOF_IPC4_GLB_PIPE_PRIORITY_SHIFT)
170 
171 #define SOF_IPC4_GLB_PIPE_MEM_SIZE_SHIFT	0
172 #define SOF_IPC4_GLB_PIPE_MEM_SIZE_MASK		GENMASK(10, 0)
173 #define SOF_IPC4_GLB_PIPE_MEM_SIZE(x)		((x) << SOF_IPC4_GLB_PIPE_MEM_SIZE_SHIFT)
174 
175 #define SOF_IPC4_GLB_PIPE_EXT_LP_SHIFT		0
176 #define SOF_IPC4_GLB_PIPE_EXT_LP_MASK		BIT(0)
177 #define SOF_IPC4_GLB_PIPE_EXT_LP(x)		((x) << SOF_IPC4_GLB_PIPE_EXT_LP_SHIFT)
178 
179 /* pipeline set state ipc msg */
180 #define SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT		16
181 #define SOF_IPC4_GLB_PIPE_STATE_ID_MASK		GENMASK(23, 16)
182 #define SOF_IPC4_GLB_PIPE_STATE_ID(x)		((x) << SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT)
183 
184 #define SOF_IPC4_GLB_PIPE_STATE_SHIFT		0
185 #define SOF_IPC4_GLB_PIPE_STATE_MASK		GENMASK(15, 0)
186 #define SOF_IPC4_GLB_PIPE_STATE(x)		((x) << SOF_IPC4_GLB_PIPE_STATE_SHIFT)
187 
188 /* load library ipc msg */
189 #define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT	16
190 #define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID(x)	((x) << SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT)
191 
192 enum sof_ipc4_channel_config {
193 	/* one channel only. */
194 	SOF_IPC4_CHANNEL_CONFIG_MONO,
195 	/* L & R. */
196 	SOF_IPC4_CHANNEL_CONFIG_STEREO,
197 	/* L, R & LFE; PCM only. */
198 	SOF_IPC4_CHANNEL_CONFIG_2_POINT_1,
199 	/* L, C & R; MP3 & AAC only. */
200 	SOF_IPC4_CHANNEL_CONFIG_3_POINT_0,
201 	/* L, C, R & LFE; PCM only. */
202 	SOF_IPC4_CHANNEL_CONFIG_3_POINT_1,
203 	/* L, R, Ls & Rs; PCM only. */
204 	SOF_IPC4_CHANNEL_CONFIG_QUATRO,
205 	/* L, C, R & Cs; MP3 & AAC only. */
206 	SOF_IPC4_CHANNEL_CONFIG_4_POINT_0,
207 	/* L, C, R, Ls & Rs. */
208 	SOF_IPC4_CHANNEL_CONFIG_5_POINT_0,
209 	/* L, C, R, Ls, Rs & LFE. */
210 	SOF_IPC4_CHANNEL_CONFIG_5_POINT_1,
211 	/* one channel replicated in two. */
212 	SOF_IPC4_CHANNEL_CONFIG_DUAL_MONO,
213 	/* Stereo (L,R) in 4 slots, 1st stream: [ L, R, -, - ] */
214 	SOF_IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_0,
215 	/* Stereo (L,R) in 4 slots, 2nd stream: [ -, -, L, R ] */
216 	SOF_IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_1,
217 	/* L, C, R, Ls, Rs & LFE., LS, RS */
218 	SOF_IPC4_CHANNEL_CONFIG_7_POINT_1,
219 };
220 
221 enum sof_ipc4_interleaved_style {
222 	SOF_IPC4_CHANNELS_INTERLEAVED,
223 	SOF_IPC4_CHANNELS_NONINTERLEAVED,
224 };
225 
226 enum sof_ipc4_sample_type {
227 	SOF_IPC4_MSB_INTEGER, /* integer with Most Significant Byte first */
228 	SOF_IPC4_LSB_INTEGER, /* integer with Least Significant Byte first */
229 };
230 
231 struct sof_ipc4_audio_format {
232 	uint32_t sampling_frequency;
233 	uint32_t bit_depth;
234 	uint32_t ch_map;
235 	uint32_t ch_cfg; /* sof_ipc4_channel_config */
236 	uint32_t interleaving_style;
237 	uint32_t fmt_cfg; /* channels_count valid_bit_depth s_type */
238 } __packed __aligned(4);
239 
240 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_SHIFT	0
241 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_MASK	GENMASK(7, 0)
242 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(x)	\
243 	((x) & SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_MASK)
244 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_SHIFT	8
245 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_MASK	GENMASK(15, 8)
246 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(x)	\
247 	(((x) & SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_MASK) >> \
248 	 SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_SHIFT)
249 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_SHIFT	16
250 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_MASK	GENMASK(23, 16)
251 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE(x)	\
252 	(((x) & SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_MASK) >>  \
253 	 SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_SHIFT)
254 
255 /* Module message type specific field definitions */
256 
257 enum sof_ipc4_module_type {
258 	SOF_IPC4_MOD_INIT_INSTANCE,
259 	SOF_IPC4_MOD_CONFIG_GET,
260 	SOF_IPC4_MOD_CONFIG_SET,
261 	SOF_IPC4_MOD_LARGE_CONFIG_GET,
262 	SOF_IPC4_MOD_LARGE_CONFIG_SET,
263 	SOF_IPC4_MOD_BIND,
264 	SOF_IPC4_MOD_UNBIND,
265 	SOF_IPC4_MOD_SET_DX,
266 	SOF_IPC4_MOD_SET_D0IX,
267 	SOF_IPC4_MOD_ENTER_MODULE_RESTORE,
268 	SOF_IPC4_MOD_EXIT_MODULE_RESTORE,
269 	SOF_IPC4_MOD_DELETE_INSTANCE,
270 
271 	SOF_IPC4_MOD_TYPE_LAST,
272 };
273 
274 struct sof_ipc4_base_module_cfg {
275 	uint32_t cpc; /* the max count of Cycles Per Chunk processing */
276 	uint32_t ibs; /* input Buffer Size (in bytes)  */
277 	uint32_t obs; /* output Buffer Size (in bytes) */
278 	uint32_t is_pages; /* number of physical pages used */
279 	struct sof_ipc4_audio_format audio_fmt;
280 } __packed __aligned(4);
281 
282 /* common module ipc msg */
283 #define SOF_IPC4_MOD_INSTANCE_SHIFT		16
284 #define SOF_IPC4_MOD_INSTANCE_MASK		GENMASK(23, 16)
285 #define SOF_IPC4_MOD_INSTANCE(x)		((x) << SOF_IPC4_MOD_INSTANCE_SHIFT)
286 
287 #define SOF_IPC4_MOD_ID_SHIFT			0
288 #define SOF_IPC4_MOD_ID_MASK			GENMASK(15, 0)
289 #define SOF_IPC4_MOD_ID(x)			((x) << SOF_IPC4_MOD_ID_SHIFT)
290 
291 /* init module ipc msg */
292 #define SOF_IPC4_MOD_EXT_PARAM_SIZE_SHIFT	0
293 #define SOF_IPC4_MOD_EXT_PARAM_SIZE_MASK	GENMASK(15, 0)
294 #define SOF_IPC4_MOD_EXT_PARAM_SIZE(x)		((x) << SOF_IPC4_MOD_EXT_PARAM_SIZE_SHIFT)
295 
296 #define SOF_IPC4_MOD_EXT_PPL_ID_SHIFT		16
297 #define SOF_IPC4_MOD_EXT_PPL_ID_MASK		GENMASK(23, 16)
298 #define SOF_IPC4_MOD_EXT_PPL_ID(x)		((x) << SOF_IPC4_MOD_EXT_PPL_ID_SHIFT)
299 
300 #define SOF_IPC4_MOD_EXT_CORE_ID_SHIFT		24
301 #define SOF_IPC4_MOD_EXT_CORE_ID_MASK		GENMASK(27, 24)
302 #define SOF_IPC4_MOD_EXT_CORE_ID(x)		((x) << SOF_IPC4_MOD_EXT_CORE_ID_SHIFT)
303 
304 #define SOF_IPC4_MOD_EXT_DOMAIN_SHIFT		28
305 #define SOF_IPC4_MOD_EXT_DOMAIN_MASK		BIT(28)
306 #define SOF_IPC4_MOD_EXT_DOMAIN(x)		((x) << SOF_IPC4_MOD_EXT_DOMAIN_SHIFT)
307 
308 /*  bind/unbind module ipc msg */
309 #define SOF_IPC4_MOD_EXT_DST_MOD_ID_SHIFT	0
310 #define SOF_IPC4_MOD_EXT_DST_MOD_ID_MASK	GENMASK(15, 0)
311 #define SOF_IPC4_MOD_EXT_DST_MOD_ID(x)		((x) << SOF_IPC4_MOD_EXT_DST_MOD_ID_SHIFT)
312 
313 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_SHIFT	16
314 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_MASK	GENMASK(23, 16)
315 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE(x)	((x) << SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_SHIFT)
316 
317 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_SHIFT	24
318 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_MASK	GENMASK(26, 24)
319 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID(x)	((x) << SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_SHIFT)
320 
321 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_SHIFT	27
322 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_MASK	GENMASK(29, 27)
323 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID(x)	((x) << SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_SHIFT)
324 
325 #define MOD_ENABLE_LOG	6
326 #define MOD_SYSTEM_TIME	20
327 
328 /* set module large config */
329 #define SOF_IPC4_MOD_EXT_MSG_SIZE_SHIFT		0
330 #define SOF_IPC4_MOD_EXT_MSG_SIZE_MASK		GENMASK(19, 0)
331 #define SOF_IPC4_MOD_EXT_MSG_SIZE(x)		((x) << SOF_IPC4_MOD_EXT_MSG_SIZE_SHIFT)
332 
333 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID_SHIFT	20
334 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID_MASK	GENMASK(27, 20)
335 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID(x)	((x) << SOF_IPC4_MOD_EXT_MSG_PARAM_ID_SHIFT)
336 
337 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_SHIFT	28
338 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_MASK	BIT(28)
339 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK(x)	((x) << SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_SHIFT)
340 
341 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_SHIFT	29
342 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_MASK	BIT(29)
343 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK(x)	((x) << SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_SHIFT)
344 
345 /* Init instance messagees */
346 #define SOF_IPC4_MOD_INIT_BASEFW_MOD_ID		0
347 #define SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID	0
348 
349 enum sof_ipc4_base_fw_params {
350 	SOF_IPC4_FW_PARAM_ENABLE_LOGS = 6,
351 	SOF_IPC4_FW_PARAM_FW_CONFIG,
352 	SOF_IPC4_FW_PARAM_HW_CONFIG_GET,
353 	SOF_IPC4_FW_PARAM_MODULES_INFO_GET,
354 	SOF_IPC4_FW_PARAM_LIBRARIES_INFO_GET = 16,
355 	SOF_IPC4_FW_PARAM_SYSTEM_TIME = 20,
356 };
357 
358 enum sof_ipc4_fw_config_params {
359 	SOF_IPC4_FW_CFG_FW_VERSION,
360 	SOF_IPC4_FW_CFG_MEMORY_RECLAIMED,
361 	SOF_IPC4_FW_CFG_SLOW_CLOCK_FREQ_HZ,
362 	SOF_IPC4_FW_CFG_FAST_CLOCK_FREQ_HZ,
363 	SOF_IPC4_FW_CFG_DMA_BUFFER_CONFIG,
364 	SOF_IPC4_FW_CFG_ALH_SUPPORT_LEVEL,
365 	SOF_IPC4_FW_CFG_DL_MAILBOX_BYTES,
366 	SOF_IPC4_FW_CFG_UL_MAILBOX_BYTES,
367 	SOF_IPC4_FW_CFG_TRACE_LOG_BYTES,
368 	SOF_IPC4_FW_CFG_MAX_PPL_COUNT,
369 	SOF_IPC4_FW_CFG_MAX_ASTATE_COUNT,
370 	SOF_IPC4_FW_CFG_MAX_MODULE_PIN_COUNT,
371 	SOF_IPC4_FW_CFG_MODULES_COUNT,
372 	SOF_IPC4_FW_CFG_MAX_MOD_INST_COUNT,
373 	SOF_IPC4_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT,
374 	SOF_IPC4_FW_CFG_LL_PRI_COUNT,
375 	SOF_IPC4_FW_CFG_MAX_DP_TASKS_COUNT,
376 	SOF_IPC4_FW_CFG_MAX_LIBS_COUNT,
377 	SOF_IPC4_FW_CFG_SCHEDULER_CONFIG,
378 	SOF_IPC4_FW_CFG_XTAL_FREQ_HZ,
379 	SOF_IPC4_FW_CFG_CLOCKS_CONFIG,
380 	SOF_IPC4_FW_CFG_RESERVED,
381 	SOF_IPC4_FW_CFG_POWER_GATING_POLICY,
382 	SOF_IPC4_FW_CFG_ASSERT_MODE,
383 };
384 
385 struct sof_ipc4_fw_version {
386 	uint16_t major;
387 	uint16_t minor;
388 	uint16_t hotfix;
389 	uint16_t build;
390 } __packed;
391 
392 /* Payload data for SOF_IPC4_MOD_SET_DX */
393 struct sof_ipc4_dx_state_info {
394 	/* core(s) to apply the change */
395 	uint32_t core_mask;
396 	/* core state: 0: put core_id to D3; 1: put core_id to D0 */
397 	uint32_t dx_mask;
398 } __packed __aligned(4);
399 
400 /* Reply messages */
401 
402 /*
403  * IPC4 primary header bit allocation for replies
404  * bit 0-23:	status
405  * bit 24-28:	type:	enum sof_ipc4_global_msg if target is SOF_IPC4_FW_GEN_MSG
406  *			enum sof_ipc4_module_type if target is SOF_IPC4_MODULE_MSG
407  * bit 29:	response - sof_ipc4_msg_dir
408  * bit 30:	target - enum sof_ipc4_msg_target
409  * bit 31:	reserved, unused
410  */
411 
412 #define SOF_IPC4_REPLY_STATUS			GENMASK(23, 0)
413 
414 /* Notification messages */
415 
416 /*
417  * IPC4 primary header bit allocation for notifications
418  * bit 0-15:	notification type specific
419  * bit 16-23:	enum sof_ipc4_notification_type
420  * bit 24-28:	SOF_IPC4_GLB_NOTIFICATION
421  * bit 29:	response - sof_ipc4_msg_dir
422  * bit 30:	target - enum sof_ipc4_msg_target
423  * bit 31:	reserved, unused
424  */
425 
426 #define SOF_IPC4_MSG_IS_NOTIFICATION(x)		(SOF_IPC4_MSG_TYPE_GET(x) == \
427 						 SOF_IPC4_GLB_NOTIFICATION)
428 
429 #define SOF_IPC4_NOTIFICATION_TYPE_SHIFT	16
430 #define SOF_IPC4_NOTIFICATION_TYPE_MASK		GENMASK(23, 16)
431 #define SOF_IPC4_NOTIFICATION_TYPE_GET(x)	(((x) & SOF_IPC4_NOTIFICATION_TYPE_MASK) >> \
432 						 SOF_IPC4_NOTIFICATION_TYPE_SHIFT)
433 
434 #define SOF_IPC4_LOG_CORE_SHIFT			12
435 #define SOF_IPC4_LOG_CORE_MASK			GENMASK(15, 12)
436 #define SOF_IPC4_LOG_CORE_GET(x)		(((x) & SOF_IPC4_LOG_CORE_MASK) >> \
437 						 SOF_IPC4_LOG_CORE_SHIFT)
438 
439 /* Value of notification type field - must fit into 8 bits */
440 enum sof_ipc4_notification_type {
441 	/* Phrase detected (notification from WoV module) */
442 	SOF_IPC4_NOTIFY_PHRASE_DETECTED = 4,
443 	/* Event from a resource (pipeline or module instance) */
444 	SOF_IPC4_NOTIFY_RESOURCE_EVENT,
445 	/* Debug log buffer status changed */
446 	SOF_IPC4_NOTIFY_LOG_BUFFER_STATUS,
447 	/* Timestamp captured at the link */
448 	SOF_IPC4_NOTIFY_TIMESTAMP_CAPTURED,
449 	/* FW complete initialization */
450 	SOF_IPC4_NOTIFY_FW_READY,
451 	/* Audio classifier result (ACA) */
452 	SOF_IPC4_NOTIFY_FW_AUD_CLASS_RESULT,
453 	/* Exception caught by DSP FW */
454 	SOF_IPC4_NOTIFY_EXCEPTION_CAUGHT,
455 	/* 11 is skipped by the existing cavs firmware */
456 	/* Custom module notification */
457 	SOF_IPC4_NOTIFY_MODULE_NOTIFICATION = 12,
458 	/* 13 is reserved - do not use */
459 	/* Probe notify data available */
460 	SOF_IPC4_NOTIFY_PROBE_DATA_AVAILABLE = 14,
461 	/* AM module notifications */
462 	SOF_IPC4_NOTIFY_ASYNC_MSG_SRVC_MESSAGE,
463 
464 	SOF_IPC4_NOTIFY_TYPE_LAST,
465 };
466 
467 struct sof_ipc4_notify_resource_data {
468 	uint32_t resource_type;
469 	uint32_t resource_id;
470 	uint32_t event_type;
471 	uint32_t reserved;
472 	uint32_t data[6];
473 } __packed __aligned(4);
474 
475 /** @}*/
476 
477 #endif
478