diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index 3940672396bb..e0d8800f7bb1 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -129,6 +129,7 @@ static int basefw_config(uint32_t *data_offset, char *data) static int basefw_hw_config(uint32_t *data_offset, char *data) { struct sof_tlv *tuple = (struct sof_tlv *)data; + uint32_t plat_data_offset = 0; uint32_t value; tlv_value_uint32_set(tuple, IPC4_CAVS_VER_HW_CFG, HW_CFG_VERSION); @@ -147,19 +148,11 @@ static int basefw_hw_config(uint32_t *data_offset, char *data) tlv_value_uint32_set(tuple, IPC4_TOTAL_PHYS_MEM_PAGES_HW_CFG, value); tuple = tlv_next(tuple); - tlv_value_uint32_set(tuple, IPC4_HP_EBB_COUNT_HW_CFG, PLATFORM_HPSRAM_EBB_COUNT); - tuple = tlv_next(tuple); - /* 2 DMIC dais */ - value = DAI_NUM_SSP_BASE + DAI_NUM_HDA_IN + DAI_NUM_HDA_OUT + - DAI_NUM_ALH_BI_DIR_LINKS + 2; - tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value); - - tuple = tlv_next(tuple); - tlv_value_uint32_set(tuple, IPC4_LP_EBB_COUNT_HW_CFG, PLATFORM_LPSRAM_EBB_COUNT); + /* add platform specific tuples */ + platform_basefw_hw_config(&plat_data_offset, (char *)tuple); - tuple = tlv_next(tuple); - *data_offset = (int)((char *)tuple - data); + *data_offset = (int)((char *)tuple - data) + plat_data_offset; return 0; } diff --git a/src/include/sof/platform.h b/src/include/sof/platform.h index 80fdff077500..644275e171c2 100644 --- a/src/include/sof/platform.h +++ b/src/include/sof/platform.h @@ -52,6 +52,15 @@ int platform_init(struct sof *sof); */ int platform_context_save(struct sof *sof); +/** + * \brief Platform specific routine to add data tuples to HW_CONFIG + * structure sent to host via IPC. + * \param[out] data_offset data offset after tuples added + * \parma[in] data pointer where to add new entries + * \return 0 if successful, error code otherwise. + */ +int platform_basefw_hw_config(uint32_t *data_offset, char *data); + /** @}*/ #endif diff --git a/src/platform/intel/ace/platform.c b/src/platform/intel/ace/platform.c index 765bc7580236..e3ecd8669bd6 100644 --- a/src/platform/intel/ace/platform.c +++ b/src/platform/intel/ace/platform.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,8 @@ #include #include +#include + #include #include @@ -140,3 +143,25 @@ int platform_context_save(struct sof *sof) { return 0; } + +int platform_basefw_hw_config(uint32_t *data_offset, char *data) +{ + struct sof_tlv *tuple = (struct sof_tlv *)data; + uint32_t value; + + tlv_value_uint32_set(tuple, IPC4_HP_EBB_COUNT_HW_CFG, PLATFORM_HPSRAM_EBB_COUNT); + + tuple = tlv_next(tuple); + /* 2 DMIC dais */ + value = DAI_NUM_SSP_BASE + DAI_NUM_HDA_IN + DAI_NUM_HDA_OUT + + DAI_NUM_ALH_BI_DIR_LINKS + 2; + tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value); + + tuple = tlv_next(tuple); + tlv_value_uint32_set(tuple, IPC4_LP_EBB_COUNT_HW_CFG, PLATFORM_LPSRAM_EBB_COUNT); + + tuple = tlv_next(tuple); + *data_offset = (int)((char *)tuple - data); + + return 0; +} diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 2f4602b4c222..ca440061cb74 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -33,11 +33,14 @@ #include #include #include +#include #include #include #include #include +#include + #include #include #include @@ -239,3 +242,25 @@ int platform_context_save(struct sof *sof) #endif return 0; } + +int platform_basefw_hw_config(uint32_t *data_offset, char *data) +{ + struct sof_tlv *tuple = (struct sof_tlv *)data; + uint32_t value; + + tlv_value_uint32_set(tuple, IPC4_HP_EBB_COUNT_HW_CFG, PLATFORM_HPSRAM_EBB_COUNT); + + tuple = tlv_next(tuple); + /* 2 DMIC dais */ + value = DAI_NUM_SSP_BASE + DAI_NUM_HDA_IN + DAI_NUM_HDA_OUT + + DAI_NUM_ALH_BI_DIR_LINKS + 2; + tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value); + + tuple = tlv_next(tuple); + tlv_value_uint32_set(tuple, IPC4_LP_EBB_COUNT_HW_CFG, PLATFORM_LPSRAM_EBB_COUNT); + + tuple = tlv_next(tuple); + *data_offset = (int)((char *)tuple - data); + + return 0; +} diff --git a/src/platform/posix/posix.c b/src/platform/posix/posix.c index f8024cb0dcca..df5732786b3d 100644 --- a/src/platform/posix/posix.c +++ b/src/platform/posix/posix.c @@ -88,3 +88,10 @@ int platform_boot_complete(uint32_t boot_message) { return 0; } + +int platform_basefw_hw_config(uint32_t *data_offset, char *data) +{ + *data_offset = 0; + + return 0; +}