Skip to content

Commit 491bc1c

Browse files
ujfalusilgirdwood
authored andcommitted
ipc4: handler: Add support for rx payload with LARGE_CONFIG_GET messages
Some LARGE_CONFIG_GET message includes payload to provide instructions to the handler modules on how to fulfill the request. The generic control messages are such examples (they are not related to VENDOR_CONFIG_PARAM messages): The payload from host includes the sof_ipc4_control_msg_payload struct to describe the ID of the control for example. Alone the type (enum, switch or bytes) is not enough to know _which_ control's information is requested. Similarly, the control's ID does not identify the control's type. When such generic control message is received, the payload is copied from hostbox to the comp_data and the handler module can inspect it before overwriting it with the requested data. Note: currently we don't have modules which would handle generic control get functionality, but they would not have worked, because the information was not available to them to decide which control's data needs to be returned. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 65b2764 commit 491bc1c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/ipc/ipc4/handler.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,36 @@ static int ipc4_set_get_config_module_instance(struct ipc4_message_request *ipc4
996996
return ret;
997997
}
998998

999+
__cold static void ipc4_prepare_for_kcontrol_get(struct comp_dev *dev, uint8_t param_id,
1000+
char *data_out, uint32_t data_size)
1001+
{
1002+
const char *hostbox;
1003+
1004+
#if CONFIG_LIBRARY
1005+
hostbox = (const char *)ipc_get()->comp_data + sizeof(struct ipc4_module_large_config);
1006+
#else
1007+
hostbox = (const char *)MAILBOX_HOSTBOX_BASE;
1008+
#endif
1009+
1010+
assert_can_be_cold();
1011+
1012+
switch (param_id) {
1013+
case SOF_IPC4_SWITCH_CONTROL_PARAM_ID:
1014+
case SOF_IPC4_ENUM_CONTROL_PARAM_ID:
1015+
case SOF_IPC4_BYTES_CONTROL_PARAM_ID:
1016+
/* We have payload in hostbox */
1017+
dcache_invalidate_region((__sparse_force void __sparse_cache *)MAILBOX_HOSTBOX_BASE,
1018+
data_size);
1019+
1020+
/* Copy the control payload header from inbox to outbox */
1021+
memcpy_s(data_out, data_size, hostbox,
1022+
sizeof(struct sof_ipc4_control_msg_payload));
1023+
break;
1024+
default:
1025+
break;
1026+
}
1027+
}
1028+
9991029
__cold static int ipc4_get_vendor_config_module_instance(struct comp_dev *dev,
10001030
const struct comp_driver *drv,
10011031
bool init_block,
@@ -1154,6 +1184,9 @@ __cold static int ipc4_get_large_config_module_instance(struct ipc4_message_requ
11541184
#if CONFIG_LIBRARY
11551185
data += sizeof(reply);
11561186
#endif
1187+
ipc4_prepare_for_kcontrol_get(dev, config.extension.r.large_param_id,
1188+
data, data_offset);
1189+
11571190
ret = drv->ops.get_large_config(dev, config.extension.r.large_param_id,
11581191
config.extension.r.init_block,
11591192
config.extension.r.final_block,

0 commit comments

Comments
 (0)