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 #define SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT 20 180 #define SOF_IPC4_GLB_PIPE_EXT_CORE_ID_MASK GENMASK(23, 20) 181 #define SOF_IPC4_GLB_PIPE_EXT_CORE_ID(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT) 182 183 /* pipeline set state ipc msg */ 184 #define SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT 16 185 #define SOF_IPC4_GLB_PIPE_STATE_ID_MASK GENMASK(23, 16) 186 #define SOF_IPC4_GLB_PIPE_STATE_ID(x) ((x) << SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT) 187 188 #define SOF_IPC4_GLB_PIPE_STATE_SHIFT 0 189 #define SOF_IPC4_GLB_PIPE_STATE_MASK GENMASK(15, 0) 190 #define SOF_IPC4_GLB_PIPE_STATE(x) ((x) << SOF_IPC4_GLB_PIPE_STATE_SHIFT) 191 192 /* pipeline set state IPC msg extension */ 193 #define SOF_IPC4_GLB_PIPE_STATE_EXT_MULTI BIT(0) 194 195 /* load library ipc msg */ 196 #define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT 16 197 #define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID(x) ((x) << SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT) 198 199 enum sof_ipc4_channel_config { 200 /* one channel only. */ 201 SOF_IPC4_CHANNEL_CONFIG_MONO, 202 /* L & R. */ 203 SOF_IPC4_CHANNEL_CONFIG_STEREO, 204 /* L, R & LFE; PCM only. */ 205 SOF_IPC4_CHANNEL_CONFIG_2_POINT_1, 206 /* L, C & R; MP3 & AAC only. */ 207 SOF_IPC4_CHANNEL_CONFIG_3_POINT_0, 208 /* L, C, R & LFE; PCM only. */ 209 SOF_IPC4_CHANNEL_CONFIG_3_POINT_1, 210 /* L, R, Ls & Rs; PCM only. */ 211 SOF_IPC4_CHANNEL_CONFIG_QUATRO, 212 /* L, C, R & Cs; MP3 & AAC only. */ 213 SOF_IPC4_CHANNEL_CONFIG_4_POINT_0, 214 /* L, C, R, Ls & Rs. */ 215 SOF_IPC4_CHANNEL_CONFIG_5_POINT_0, 216 /* L, C, R, Ls, Rs & LFE. */ 217 SOF_IPC4_CHANNEL_CONFIG_5_POINT_1, 218 /* one channel replicated in two. */ 219 SOF_IPC4_CHANNEL_CONFIG_DUAL_MONO, 220 /* Stereo (L,R) in 4 slots, 1st stream: [ L, R, -, - ] */ 221 SOF_IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_0, 222 /* Stereo (L,R) in 4 slots, 2nd stream: [ -, -, L, R ] */ 223 SOF_IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_1, 224 /* L, C, R, Ls, Rs & LFE., LS, RS */ 225 SOF_IPC4_CHANNEL_CONFIG_7_POINT_1, 226 }; 227 228 enum sof_ipc4_interleaved_style { 229 SOF_IPC4_CHANNELS_INTERLEAVED, 230 SOF_IPC4_CHANNELS_NONINTERLEAVED, 231 }; 232 233 enum sof_ipc4_sample_type { 234 SOF_IPC4_MSB_INTEGER, /* integer with Most Significant Byte first */ 235 SOF_IPC4_LSB_INTEGER, /* integer with Least Significant Byte first */ 236 }; 237 238 struct sof_ipc4_audio_format { 239 uint32_t sampling_frequency; 240 uint32_t bit_depth; 241 uint32_t ch_map; 242 uint32_t ch_cfg; /* sof_ipc4_channel_config */ 243 uint32_t interleaving_style; 244 uint32_t fmt_cfg; /* channels_count valid_bit_depth s_type */ 245 } __packed __aligned(4); 246 247 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_SHIFT 0 248 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_MASK GENMASK(7, 0) 249 #define SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(x) \ 250 ((x) & SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT_MASK) 251 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_SHIFT 8 252 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_MASK GENMASK(15, 8) 253 #define SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(x) \ 254 (((x) & SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_MASK) >> \ 255 SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH_SHIFT) 256 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_SHIFT 16 257 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_MASK GENMASK(23, 16) 258 #define SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE(x) \ 259 (((x) & SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_MASK) >> \ 260 SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE_SHIFT) 261 262 /* Module message type specific field definitions */ 263 264 enum sof_ipc4_module_type { 265 SOF_IPC4_MOD_INIT_INSTANCE, 266 SOF_IPC4_MOD_CONFIG_GET, 267 SOF_IPC4_MOD_CONFIG_SET, 268 SOF_IPC4_MOD_LARGE_CONFIG_GET, 269 SOF_IPC4_MOD_LARGE_CONFIG_SET, 270 SOF_IPC4_MOD_BIND, 271 SOF_IPC4_MOD_UNBIND, 272 SOF_IPC4_MOD_SET_DX, 273 SOF_IPC4_MOD_SET_D0IX, 274 SOF_IPC4_MOD_ENTER_MODULE_RESTORE, 275 SOF_IPC4_MOD_EXIT_MODULE_RESTORE, 276 SOF_IPC4_MOD_DELETE_INSTANCE, 277 278 SOF_IPC4_MOD_TYPE_LAST, 279 }; 280 281 struct sof_ipc4_base_module_cfg { 282 uint32_t cpc; /* the max count of Cycles Per Chunk processing */ 283 uint32_t ibs; /* input Buffer Size (in bytes) */ 284 uint32_t obs; /* output Buffer Size (in bytes) */ 285 uint32_t is_pages; /* number of physical pages used */ 286 struct sof_ipc4_audio_format audio_fmt; 287 } __packed __aligned(4); 288 289 /* common module ipc msg */ 290 #define SOF_IPC4_MOD_INSTANCE_SHIFT 16 291 #define SOF_IPC4_MOD_INSTANCE_MASK GENMASK(23, 16) 292 #define SOF_IPC4_MOD_INSTANCE(x) ((x) << SOF_IPC4_MOD_INSTANCE_SHIFT) 293 294 #define SOF_IPC4_MOD_ID_SHIFT 0 295 #define SOF_IPC4_MOD_ID_MASK GENMASK(15, 0) 296 #define SOF_IPC4_MOD_ID(x) ((x) << SOF_IPC4_MOD_ID_SHIFT) 297 298 /* init module ipc msg */ 299 #define SOF_IPC4_MOD_EXT_PARAM_SIZE_SHIFT 0 300 #define SOF_IPC4_MOD_EXT_PARAM_SIZE_MASK GENMASK(15, 0) 301 #define SOF_IPC4_MOD_EXT_PARAM_SIZE(x) ((x) << SOF_IPC4_MOD_EXT_PARAM_SIZE_SHIFT) 302 303 #define SOF_IPC4_MOD_EXT_PPL_ID_SHIFT 16 304 #define SOF_IPC4_MOD_EXT_PPL_ID_MASK GENMASK(23, 16) 305 #define SOF_IPC4_MOD_EXT_PPL_ID(x) ((x) << SOF_IPC4_MOD_EXT_PPL_ID_SHIFT) 306 307 #define SOF_IPC4_MOD_EXT_CORE_ID_SHIFT 24 308 #define SOF_IPC4_MOD_EXT_CORE_ID_MASK GENMASK(27, 24) 309 #define SOF_IPC4_MOD_EXT_CORE_ID(x) ((x) << SOF_IPC4_MOD_EXT_CORE_ID_SHIFT) 310 311 #define SOF_IPC4_MOD_EXT_DOMAIN_SHIFT 28 312 #define SOF_IPC4_MOD_EXT_DOMAIN_MASK BIT(28) 313 #define SOF_IPC4_MOD_EXT_DOMAIN(x) ((x) << SOF_IPC4_MOD_EXT_DOMAIN_SHIFT) 314 315 /* bind/unbind module ipc msg */ 316 #define SOF_IPC4_MOD_EXT_DST_MOD_ID_SHIFT 0 317 #define SOF_IPC4_MOD_EXT_DST_MOD_ID_MASK GENMASK(15, 0) 318 #define SOF_IPC4_MOD_EXT_DST_MOD_ID(x) ((x) << SOF_IPC4_MOD_EXT_DST_MOD_ID_SHIFT) 319 320 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_SHIFT 16 321 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_MASK GENMASK(23, 16) 322 #define SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE(x) ((x) << SOF_IPC4_MOD_EXT_DST_MOD_INSTANCE_SHIFT) 323 324 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_SHIFT 24 325 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_MASK GENMASK(26, 24) 326 #define SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID(x) ((x) << SOF_IPC4_MOD_EXT_DST_MOD_QUEUE_ID_SHIFT) 327 328 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_SHIFT 27 329 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_MASK GENMASK(29, 27) 330 #define SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID(x) ((x) << SOF_IPC4_MOD_EXT_SRC_MOD_QUEUE_ID_SHIFT) 331 332 #define MOD_ENABLE_LOG 6 333 #define MOD_SYSTEM_TIME 20 334 335 /* set module large config */ 336 #define SOF_IPC4_MOD_EXT_MSG_SIZE_SHIFT 0 337 #define SOF_IPC4_MOD_EXT_MSG_SIZE_MASK GENMASK(19, 0) 338 #define SOF_IPC4_MOD_EXT_MSG_SIZE(x) ((x) << SOF_IPC4_MOD_EXT_MSG_SIZE_SHIFT) 339 340 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID_SHIFT 20 341 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID_MASK GENMASK(27, 20) 342 #define SOF_IPC4_MOD_EXT_MSG_PARAM_ID(x) ((x) << SOF_IPC4_MOD_EXT_MSG_PARAM_ID_SHIFT) 343 344 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_SHIFT 28 345 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_MASK BIT(28) 346 #define SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK(x) ((x) << SOF_IPC4_MOD_EXT_MSG_LAST_BLOCK_SHIFT) 347 348 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_SHIFT 29 349 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_MASK BIT(29) 350 #define SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK(x) ((x) << SOF_IPC4_MOD_EXT_MSG_FIRST_BLOCK_SHIFT) 351 352 /* Init instance messagees */ 353 #define SOF_IPC4_MOD_INIT_BASEFW_MOD_ID 0 354 #define SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID 0 355 356 enum sof_ipc4_base_fw_params { 357 SOF_IPC4_FW_PARAM_ENABLE_LOGS = 6, 358 SOF_IPC4_FW_PARAM_FW_CONFIG, 359 SOF_IPC4_FW_PARAM_HW_CONFIG_GET, 360 SOF_IPC4_FW_PARAM_MODULES_INFO_GET, 361 SOF_IPC4_FW_PARAM_LIBRARIES_INFO_GET = 16, 362 SOF_IPC4_FW_PARAM_SYSTEM_TIME = 20, 363 }; 364 365 enum sof_ipc4_fw_config_params { 366 SOF_IPC4_FW_CFG_FW_VERSION, 367 SOF_IPC4_FW_CFG_MEMORY_RECLAIMED, 368 SOF_IPC4_FW_CFG_SLOW_CLOCK_FREQ_HZ, 369 SOF_IPC4_FW_CFG_FAST_CLOCK_FREQ_HZ, 370 SOF_IPC4_FW_CFG_DMA_BUFFER_CONFIG, 371 SOF_IPC4_FW_CFG_ALH_SUPPORT_LEVEL, 372 SOF_IPC4_FW_CFG_DL_MAILBOX_BYTES, 373 SOF_IPC4_FW_CFG_UL_MAILBOX_BYTES, 374 SOF_IPC4_FW_CFG_TRACE_LOG_BYTES, 375 SOF_IPC4_FW_CFG_MAX_PPL_COUNT, 376 SOF_IPC4_FW_CFG_MAX_ASTATE_COUNT, 377 SOF_IPC4_FW_CFG_MAX_MODULE_PIN_COUNT, 378 SOF_IPC4_FW_CFG_MODULES_COUNT, 379 SOF_IPC4_FW_CFG_MAX_MOD_INST_COUNT, 380 SOF_IPC4_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT, 381 SOF_IPC4_FW_CFG_LL_PRI_COUNT, 382 SOF_IPC4_FW_CFG_MAX_DP_TASKS_COUNT, 383 SOF_IPC4_FW_CFG_MAX_LIBS_COUNT, 384 SOF_IPC4_FW_CFG_SCHEDULER_CONFIG, 385 SOF_IPC4_FW_CFG_XTAL_FREQ_HZ, 386 SOF_IPC4_FW_CFG_CLOCKS_CONFIG, 387 SOF_IPC4_FW_CFG_RESERVED, 388 SOF_IPC4_FW_CFG_POWER_GATING_POLICY, 389 SOF_IPC4_FW_CFG_ASSERT_MODE, 390 }; 391 392 struct sof_ipc4_fw_version { 393 uint16_t major; 394 uint16_t minor; 395 uint16_t hotfix; 396 uint16_t build; 397 } __packed; 398 399 /* Payload data for SOF_IPC4_MOD_SET_DX */ 400 struct sof_ipc4_dx_state_info { 401 /* core(s) to apply the change */ 402 uint32_t core_mask; 403 /* core state: 0: put core_id to D3; 1: put core_id to D0 */ 404 uint32_t dx_mask; 405 } __packed __aligned(4); 406 407 /* Reply messages */ 408 409 /* 410 * IPC4 primary header bit allocation for replies 411 * bit 0-23: status 412 * bit 24-28: type: enum sof_ipc4_global_msg if target is SOF_IPC4_FW_GEN_MSG 413 * enum sof_ipc4_module_type if target is SOF_IPC4_MODULE_MSG 414 * bit 29: response - sof_ipc4_msg_dir 415 * bit 30: target - enum sof_ipc4_msg_target 416 * bit 31: reserved, unused 417 */ 418 419 #define SOF_IPC4_REPLY_STATUS GENMASK(23, 0) 420 421 /* Notification messages */ 422 423 /* 424 * IPC4 primary header bit allocation for notifications 425 * bit 0-15: notification type specific 426 * bit 16-23: enum sof_ipc4_notification_type 427 * bit 24-28: SOF_IPC4_GLB_NOTIFICATION 428 * bit 29: response - sof_ipc4_msg_dir 429 * bit 30: target - enum sof_ipc4_msg_target 430 * bit 31: reserved, unused 431 */ 432 433 #define SOF_IPC4_MSG_IS_NOTIFICATION(x) (SOF_IPC4_MSG_TYPE_GET(x) == \ 434 SOF_IPC4_GLB_NOTIFICATION) 435 436 #define SOF_IPC4_NOTIFICATION_TYPE_SHIFT 16 437 #define SOF_IPC4_NOTIFICATION_TYPE_MASK GENMASK(23, 16) 438 #define SOF_IPC4_NOTIFICATION_TYPE_GET(x) (((x) & SOF_IPC4_NOTIFICATION_TYPE_MASK) >> \ 439 SOF_IPC4_NOTIFICATION_TYPE_SHIFT) 440 441 #define SOF_IPC4_LOG_CORE_SHIFT 12 442 #define SOF_IPC4_LOG_CORE_MASK GENMASK(15, 12) 443 #define SOF_IPC4_LOG_CORE_GET(x) (((x) & SOF_IPC4_LOG_CORE_MASK) >> \ 444 SOF_IPC4_LOG_CORE_SHIFT) 445 446 /* Value of notification type field - must fit into 8 bits */ 447 enum sof_ipc4_notification_type { 448 /* Phrase detected (notification from WoV module) */ 449 SOF_IPC4_NOTIFY_PHRASE_DETECTED = 4, 450 /* Event from a resource (pipeline or module instance) */ 451 SOF_IPC4_NOTIFY_RESOURCE_EVENT, 452 /* Debug log buffer status changed */ 453 SOF_IPC4_NOTIFY_LOG_BUFFER_STATUS, 454 /* Timestamp captured at the link */ 455 SOF_IPC4_NOTIFY_TIMESTAMP_CAPTURED, 456 /* FW complete initialization */ 457 SOF_IPC4_NOTIFY_FW_READY, 458 /* Audio classifier result (ACA) */ 459 SOF_IPC4_NOTIFY_FW_AUD_CLASS_RESULT, 460 /* Exception caught by DSP FW */ 461 SOF_IPC4_NOTIFY_EXCEPTION_CAUGHT, 462 /* 11 is skipped by the existing cavs firmware */ 463 /* Custom module notification */ 464 SOF_IPC4_NOTIFY_MODULE_NOTIFICATION = 12, 465 /* 13 is reserved - do not use */ 466 /* Probe notify data available */ 467 SOF_IPC4_NOTIFY_PROBE_DATA_AVAILABLE = 14, 468 /* AM module notifications */ 469 SOF_IPC4_NOTIFY_ASYNC_MSG_SRVC_MESSAGE, 470 471 SOF_IPC4_NOTIFY_TYPE_LAST, 472 }; 473 474 struct sof_ipc4_notify_resource_data { 475 uint32_t resource_type; 476 uint32_t resource_id; 477 uint32_t event_type; 478 uint32_t reserved; 479 uint32_t data[6]; 480 } __packed __aligned(4); 481 482 /** @}*/ 483 484 #endif 485