@@ -485,7 +485,6 @@ const struct sof_man_module *lib_manager_get_module_manifest(const uint32_t modu
485485 SOF_MAN_MODULE_OFFSET (entry_index ));
486486}
487487
488- #if CONFIG_INTEL_MODULES
489488/*
490489 * \brief Load module code, allocate its instance and create a module adapter component.
491490 * \param[in] drv - component driver pointer.
@@ -584,7 +583,18 @@ static void lib_manager_prepare_module_adapter(struct comp_driver *drv, const st
584583 drv -> ops .dai_ts_start = module_adapter_ts_start_op ;
585584 drv -> ops .dai_ts_stop = module_adapter_ts_stop_op ;
586585 drv -> ops .dai_ts_get = module_adapter_ts_get_op ;
586+ #if CONFIG_INTEL_MODULES
587587 drv -> adapter_ops = & processing_module_adapter_interface ;
588+ #endif
589+ }
590+
591+ static const struct sof_module_api_build_info * lib_manager_get_build_info (
592+ const struct sof_man_fw_desc * desc ,
593+ const struct sof_man_module * mod )
594+ {
595+ return (const struct sof_module_api_build_info * )((const uint8_t * )desc -
596+ SOF_MAN_ELF_TEXT_OFFSET +
597+ mod -> segment [SOF_MAN_SEGMENT_TEXT ].file_offset );
588598}
589599
590600int lib_manager_register_module (const uint32_t component_id )
@@ -638,9 +648,7 @@ int lib_manager_register_module(const uint32_t component_id)
638648 * llext modules store build info structure in separate section which is not accessible now.
639649 */
640650 if (!module_is_llext (mod )) {
641- build_info = (const struct sof_module_api_build_info * )((const char * )desc -
642- SOF_MAN_ELF_TEXT_OFFSET +
643- mod -> segment [SOF_MAN_SEGMENT_TEXT ].file_offset );
651+ build_info = lib_manager_get_build_info (desc , mod );
644652
645653 tr_info (& lib_manager_tr , "Module API version: %u.%u.%u, format: 0x%x" ,
646654 build_info -> api_version_number .fields .major ,
@@ -679,14 +687,6 @@ int lib_manager_register_module(const uint32_t component_id)
679687 return ret ;
680688}
681689
682- #else /* CONFIG_INTEL_MODULES */
683- int lib_manager_register_module (const uint32_t component_id )
684- {
685- tr_err (& lib_manager_tr , "Dynamic module loading is not supported" );
686- return - ENOTSUP ;
687- }
688- #endif /* CONFIG_INTEL_MODULES */
689-
690690static int lib_manager_dma_buffer_alloc (struct lib_manager_dma_ext * dma_ext ,
691691 uint32_t size )
692692{
@@ -831,6 +831,7 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext,
831831 void __sparse_cache * library_base_address ;
832832 const struct sof_man_fw_desc * man_desc = (struct sof_man_fw_desc * )
833833 ((__sparse_force uint8_t * )man_buffer + SOF_MAN_ELF_TEXT_OFFSET );
834+ const struct sof_man_module * mod = (const struct sof_man_module * )(man_desc + 1 );
834835 uint32_t preload_size = man_desc -> header .preload_page_count * PAGE_SZ ;
835836 int ret ;
836837
@@ -843,6 +844,17 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext,
843844 return - EINVAL ;
844845 }
845846
847+ if (!IS_ENABLED (CONFIG_INTEL_MODULES ) && !module_is_llext (mod )) {
848+ const struct sof_module_api_build_info * build_info =
849+ lib_manager_get_build_info (man_desc , mod );
850+
851+ if (build_info -> format == IADK_MODULE_API_BUILD_INFO_FORMAT &&
852+ build_info -> api_version_number .full == IADK_MODULE_API_CURRENT_VERSION ) {
853+ tr_err (& lib_manager_tr , "Unsupported module type %u" , mod -> type .load_type );
854+ return - ENOTSUP ;
855+ }
856+ }
857+
846858 /* Prepare storage memory, note: it is never freed, library unloading is unsupported */
847859 /*
848860 * Prepare storage memory, note: it is never freed, it is assumed, that this
0 commit comments