Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ DECLARE_TR_CTX(basefw_comp_tr, SOF_UUID(basefw_uuid), LOG_LEVEL_INFO);
static struct ipc4_system_time_info global_system_time_info;
static uint64_t global_cycle_delta;

__cold static uint32_t get_host_buffer_size(void)
{
struct sof_dma *dma_host;
uint32_t periods;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can omit calling assert_can_be_cold() if this is a static function and all the callers have called it - as is the case here. But let's at least make a comment about it to make sure this isn't broken in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment would not stop misuse of this function, which is a helper to be used by basefw_config()
I will add the assert_can_be_cold() instead of a comment.


assert_can_be_cold();

dma_host = sof_dma_get(SOF_DMA_DIR_HMEM_TO_LMEM, 0, SOF_DMA_DEV_HOST,
SOF_DMA_ACCESS_SHARED);
if (!dma_host) {
LOG_WRN("Failed to get host DMA channel");
return 0;
}

periods = dma_host->plat_data.period_count;

sof_dma_put(dma_host);

return periods;
}

__cold static int basefw_config(uint32_t *data_offset, char *data)
{
uint16_t version[4] = {SOF_MAJOR, SOF_MINOR, SOF_MICRO, SOF_BUILD};
Expand Down Expand Up @@ -124,6 +145,11 @@ __cold static int basefw_config(uint32_t *data_offset, char *data)

tuple = tlv_next(tuple);

tlv_value_uint32_set(tuple, IPC4_FW_MIN_HOST_BUFFER_PERIODS,
get_host_buffer_size());

tuple = tlv_next(tuple);

/* add platform specific tuples */
basefw_vendor_fw_config(&plat_data_offset, (char *)tuple);

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipc4/base_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ enum ipc4_fw_config_params {
IPC4_DMI_FORCE_L1_EXIT = 28,
/* FW context save on D3 entry */
IPC4_FW_CONTEXT_SAVE = 29,
/* Minimum size of host buffer in ms */
IPC4_FW_MIN_HOST_BUFFER_PERIODS = 33,
Comment on lines +376 to +377
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is agreement to reserve this value, so there's no reason for me to keep my change request.

/* Total number of FW config parameters */
IPC4_FW_CFG_PARAMS_COUNT,
/* Max config parameter id */
Expand Down
Loading