diff options
author | Pierre Peiffer <pierre.peiffer@stericsson.com> | 2011-08-26 13:03:09 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-19 09:02:20 +0100 |
commit | 73e060c0210fd176dcdecfa5198b2aba74d27de2 (patch) | |
tree | 511cf9ac4c1c21db5d7967ae5def0bbb7a204e31 /drivers/staging | |
parent | 148c1aac70d59a4d6531cc18905dfd640a762ba5 (diff) |
U8500 CM: Fix issue in component-preload mechanism
An address must not been assigned to preloaded component,
but only with template
ST-Ericsson ID: 358497
ST-Ericsson Linux next: -
ST-Ericsson FOSS-OUT ID: Trivial
Signed-off-by: Pierre Peiffer <pierre.peiffer@stericsson.com>
Change-Id: I13a30973c27d757b48e35bf3f7f78b880ee3027a
Diffstat (limited to 'drivers/staging')
7 files changed, 91 insertions, 20 deletions
diff --git a/drivers/staging/nmf-cm/cm/engine/component/inc/description.h b/drivers/staging/nmf-cm/cm/engine/component/inc/description.h index 9a03ac5d2f7..882dc1ea873 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/inc/description.h +++ b/drivers/staging/nmf-cm/cm/engine/component/inc/description.h @@ -65,7 +65,6 @@ typedef struct { * \ingroup COMPONENT_INTERNAL */ typedef struct { - t_uint32 methodAddresses; //!< Address of each method ; Available only when template loaded t_memory_reference memory; //!< Memory of the method } t_interface_provide_index; diff --git a/drivers/staging/nmf-cm/cm/engine/component/inc/template.h b/drivers/staging/nmf-cm/cm/engine/component/inc/template.h index 3e1a2c001e4..2718d8ae9fb 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/inc/template.h +++ b/drivers/staging/nmf-cm/cm/engine/component/inc/template.h @@ -45,6 +45,25 @@ struct t_component_instance; /*! * \internal + * \brief Description of a provided interface method on a collection index ; Available only when template loaded + * \ingroup COMPONENT_INTERNAL + */ +typedef struct { + t_uint32 methodAddresses; //!< Address of each method +} t_interface_provide_index_loaded; + +/*! + * \internal + * \brief Description of a provided interface ; Available only when template loaded + * \ingroup COMPONENT_INTERNAL + */ +typedef struct { + t_interface_provide_index_loaded **indexesLoaded; //!< Provide information for each collection index +} t_interface_provide_loaded; + + +/*! + * \internal * \brief Description of a component template * \ingroup COMPONENT_INTERNAL */ @@ -80,6 +99,8 @@ typedef struct _t_component_template { t_interface_provide *provides; //!< Array of interface provided by this template t_interface_require *requires; //!< Array of interface required by this template + t_interface_provide_loaded *providesLoaded; //!< Array of interface provided by this template ; Available when loaded + t_bool descriptionAssociatedWithTemplate; struct _t_component_template *prev, *next; diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/binder.c b/drivers/staging/nmf-cm/cm/engine/component/src/binder.c index e82828f012b..5f08713833b 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/binder.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/binder.c @@ -78,6 +78,7 @@ static void cm_bindLowLevelInterface( t_component_instance* server = (t_component_instance*)itfLocalBC->server; t_interface_require *require = &client->Template->requires[itfRequire->requireIndex]; t_interface_provide* provide = &server->Template->provides[itfLocalBC->provideIndex]; + t_interface_provide_loaded* provideLoaded = &server->Template->providesLoaded[itfLocalBC->provideIndex]; int k, j; if(require->indexes != NULL) @@ -113,7 +114,7 @@ static void cm_bindLowLevelInterface( // We are 64word byte aligned, combine this write with first method *(volatile t_uint64*)hostAddr = ((t_uint64)server->thisAddress << 0) | - ((t_uint64)provide->indexes[itfLocalBC->collectionIndex][0].methodAddresses << 32); + ((t_uint64)provideLoaded->indexesLoaded[itfLocalBC->collectionIndex][0].methodAddresses << 32); hostAddr += 2; j = 1; } @@ -127,14 +128,14 @@ static void cm_bindLowLevelInterface( // Word align copy for(; j < require->interface->methodNumber - 1; j+=2) { *(volatile t_uint64*)hostAddr = - ((t_uint64)provide->indexes[itfLocalBC->collectionIndex][j].methodAddresses << 0) | - ((t_uint64)provide->indexes[itfLocalBC->collectionIndex][j+1].methodAddresses << 32); + ((t_uint64)provideLoaded->indexesLoaded[itfLocalBC->collectionIndex][j].methodAddresses << 0) | + ((t_uint64)provideLoaded->indexesLoaded[itfLocalBC->collectionIndex][j+1].methodAddresses << 32); hostAddr += 2; } // Last word align if required if(j < require->interface->methodNumber) - *hostAddr = provide->indexes[itfLocalBC->collectionIndex][j].methodAddresses; + *hostAddr = provideLoaded->indexesLoaded[itfLocalBC->collectionIndex][j].methodAddresses; } } else @@ -147,7 +148,7 @@ static void cm_bindLowLevelInterface( cm_ELF_performRelocation( reloc->type, reloc->symbol_name, - provide->indexes[itfLocalBC->collectionIndex][j].methodAddresses, + provideLoaded->indexesLoaded[itfLocalBC->collectionIndex][j].methodAddresses, reloc->reloc_addr); break; } @@ -773,7 +774,7 @@ t_cm_error cm_bindComponentFromCMCore( fifo_params_setSharedField( (*bfInfo)->fifo, 1+i, - skel->Template->provides[0].indexes[0][i].methodAddresses + skel->Template->providesLoaded[0].indexesLoaded[0][i].methodAddresses ); } } @@ -1043,7 +1044,7 @@ t_cm_error cm_bindInterfaceDistributed( fifo_params_setSharedField( bfInfo->fifo, 1+i, - skel->Template->provides[0].indexes[0][i].methodAddresses + skel->Template->providesLoaded[0].indexesLoaded[0][i].methodAddresses ); } } diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c index 625d0a06796..6950efb76b6 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c @@ -43,6 +43,7 @@ PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId) t_dsp_offset sharedVarOffset; t_interface_provide_description itfProvide; t_interface_provide* provide; + t_interface_provide_loaded* provideLoaded; ee = cm_EEM_getExecutiveEngine(coreId)->instance; @@ -50,6 +51,7 @@ PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId) if((error = cm_getProvidedInterface(ee, "service", &itfProvide)) != CM_OK) return error; provide = &ee->Template->provides[itfProvide.provideIndex]; + provideLoaded = &ee->Template->providesLoaded[itfProvide.provideIndex]; if ((error = dspevent_createDspEventFifo( @@ -114,7 +116,7 @@ PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId) fifo_params_setSharedField( initializerDesc[coreId].downlinkFifo, i + 1, - provide->indexes[itfProvide.collectionIndex][i].methodAddresses); + provideLoaded->indexesLoaded[itfProvide.collectionIndex][i].methodAddresses); } /* DSP->HOST ParamsFifo extended fields initialisation */ diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c b/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c index 3855f97ded8..4aaf8dff889 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/introspection.c @@ -166,6 +166,7 @@ t_dsp_address cm_getFunction( { t_interface_provide_description itfProvide; t_interface_provide* provide; + t_interface_provide_loaded* provideLoaded; t_cm_error error; int i; @@ -174,12 +175,13 @@ t_dsp_address cm_getFunction( return error; provide = &component->Template->provides[itfProvide.provideIndex]; + provideLoaded = &component->Template->providesLoaded[itfProvide.provideIndex]; for(i = 0; i < provide->interface->methodNumber; i++) { if(cm_StringCompare(provide->interface->methodNames[i], methodName, MAX_INTERFACE_METHOD_NAME_LENGTH) == 0) { - return provide->indexes[itfProvide.collectionIndex][i].methodAddresses; + return provideLoaded->indexesLoaded[itfProvide.collectionIndex][i].methodAddresses; } } diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/loader.c b/drivers/staging/nmf-cm/cm/engine/component/src/loader.c index a128b7aa8c7..3d81e8308f9 100644 --- a/drivers/staging/nmf-cm/cm/engine/component/src/loader.c +++ b/drivers/staging/nmf-cm/cm/engine/component/src/loader.c @@ -111,12 +111,13 @@ t_uint32 cm_resolvSymbol( for(i = 0; i < ee->Template->provideNumber; i++) { t_interface_provide* provide = &ee->Template->provides[i]; + t_interface_provide_loaded* provideLoaded = &ee->Template->providesLoaded[i]; for(j = 0; j < provide->interface->methodNumber; j++) { if(provide->interface->methodNames[j] == symbolName) { - return provide->indexes[0][j].methodAddresses; // Here we assume no collection provided !! + return provideLoaded->indexesLoaded[0][j].methodAddresses; // Here we assume no collection provided !! } } } @@ -244,17 +245,40 @@ t_cm_error cm_loadComponent( template->LCCConstructAddress = cm_EEM_getExecutiveEngine(coreId)->voidAddr; // Compute provide methodIndex - for(i = 0; i < template->provideNumber; i++) + if(template->provideNumber != 0) { - for(j = 0; j < template->provides[i].collectionSize; j++) + template->providesLoaded = + (t_interface_provide_loaded*)OSAL_Alloc_Zero(sizeof(t_interface_provide_loaded) * template->provideNumber); + if(template->providesLoaded == NULL) + goto oom; + + for(i = 0; i < template->provideNumber; i++) { - for(k = 0; k < template->provides[i].interface->methodNumber; k++) - { - template->provides[i].indexes[j][k].methodAddresses = - MemoryToDspAdress(template, &template->provides[i].indexes[j][k].memory); + template->providesLoaded[i].indexesLoaded = (t_interface_provide_index_loaded**)OSAL_Alloc_Zero( + sizeof(t_interface_provide_index_loaded*) * template->provides[i].collectionSize); + if(template->providesLoaded[i].indexesLoaded == NULL) + goto oom; - LOG_INTERNAL(2, " [%d, %d] method '%s' @ %x\n", - j, k, template->provides[i].interface->methodNames[k], template->provides[i].indexes[j][k].methodAddresses, 0, 0); + if(template->provides[i].interface->methodNumber != 0) + { + for(j = 0; j < template->provides[i].collectionSize; j++) + { + template->providesLoaded[i].indexesLoaded[j] = (t_interface_provide_index_loaded*)OSAL_Alloc( + sizeof(t_interface_provide_index_loaded) * template->provides[i].interface->methodNumber); + if(template->providesLoaded[i].indexesLoaded[j] == NULL) + goto oom; + + for(k = 0; k < template->provides[i].interface->methodNumber; k++) + { + template->providesLoaded[i].indexesLoaded[j][k].methodAddresses = + MemoryToDspAdress(template, &template->provides[i].indexes[j][k].memory); + + LOG_INTERNAL(2, " [%d, %d] method '%s' @ %x\n", + j, k, template->provides[i].interface->methodNames[k], + template->providesLoaded[i].indexesLoaded[j][k].methodAddresses, 0, 0); + } + + } } } } @@ -282,6 +306,8 @@ t_cm_error cm_loadComponent( templateAdd(template); return CM_OK; + oom: + error = CM_NO_MORE_MEMORY; out: cm_unloadComponent(template); return error; @@ -317,6 +343,25 @@ PUBLIC t_cm_error cm_unloadComponent( OSAL_Free(tofree); } + if(template->providesLoaded != NULL) + { + int i, j; + + for(i = 0; i < template->provideNumber; i++) + { + if(template->providesLoaded[i].indexesLoaded != NULL) + { + for(j = 0; j < template->provides[i].collectionSize; j++) + { + OSAL_Free(template->providesLoaded[i].indexesLoaded[j]); + } + OSAL_Free(template->providesLoaded[i].indexesLoaded); + } + } + + OSAL_Free(template->providesLoaded); + } + if(template->descriptionAssociatedWithTemplate) { cm_ELF_ReleaseDescription( diff --git a/drivers/staging/nmf-cm/cm/engine/trace/src/trace.c b/drivers/staging/nmf-cm/cm/engine/trace/src/trace.c index 4620bc0fd07..e27d3284ed2 100644 --- a/drivers/staging/nmf-cm/cm/engine/trace/src/trace.c +++ b/drivers/staging/nmf-cm/cm/engine/trace/src/trace.c @@ -96,12 +96,13 @@ void cm_TRC_traceLoadMap( for(i = 0; i < component->Template->provideNumber; i++) { t_interface_provide* provide = &component->Template->provides[i]; + t_interface_provide_loaded* provideLoaded = &component->Template->providesLoaded[i]; for(j = 0; j < provide->collectionSize; j++) { for(k = 0; k < provide->interface->methodNumber; k++) { - tracemethod.methodId = provide->indexes[j][k].methodAddresses; + tracemethod.methodId = provideLoaded->indexesLoaded[j][k].methodAddresses; cm_StringCopy((char*)tracemethod.methodName, provide->interface->methodNames[k], MAX_INTERFACE_METHOD_NAME_LENGTH); |