From 8f6cf7d7310dd8980dd1abca6692ed1c59111f62 Mon Sep 17 00:00:00 2001 From: Mike Baiocchi Date: Fri, 10 Nov 2017 09:57:21 -0600 Subject: Add TCE Support to utillidmgr This commit looks to see if the system is using TCEs and then uses them in the utillidmgr. There were also some updates to the TCE interfaces to allow for this support. Change-Id: Iccaf0137c2924d3f3806fee1a8068ba2e23cb7d2 RTC:68295 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/49530 Tested-by: Jenkins Server Reviewed-by: Marshall J. Wilks Reviewed-by: Nicholas E. Bofferding Reviewed-by: Stephen M. Cprek Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/util/utillidmgr.C | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'src/usr/util/utillidmgr.C') diff --git a/src/usr/util/utillidmgr.C b/src/usr/util/utillidmgr.C index 6ab0751f8..7f94c50ed 100644 --- a/src/usr/util/utillidmgr.C +++ b/src/usr/util/utillidmgr.C @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -352,6 +353,8 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) uint8_t* dataPtr = nullptr; void* copyOffset = nullptr; bool img_in_pnor = false; + bool tces_allocated = false; + uint32_t tceToken = 0; do{ ////////////////////////////////////////////////// @@ -368,6 +371,21 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) //Image not in PNOR, request from FSP. if(iv_spBaseServicesEnabled) { + // If using TCEs, setup TCE Table for FSP to use + if (TCE::utilUseTcesForDmas()) + { + // Use Preverification Location and Size + errl = TCE::utilAllocateTces(MCL_TMP_ADDR, + MCL_TMP_SIZE, + tceToken); + if(errl) + { + UTIL_FT(ERR_MRK"getLid: Error while allocating TCEs."); + break; + } + tces_allocated = true; + } + errl = createMsgQueue(); if(errl) { @@ -384,8 +402,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) UTILLID_ADD_LID_ID( iv_lidId, l_pMsg->data[0] ); UTILLID_ADD_HEADER_FLAG( 0 , l_pMsg->data[0] ); - //change to use TCE Window for improved performance. RTC: 68295 - UTILLID_ADD_TCE_TOKEN( 0 , l_pMsg->data[1] ); + UTILLID_ADD_TCE_TOKEN( tceToken , l_pMsg->data[1] ); errl = sendMboxMessage( SYNCHRONOUS, l_pMsg ); if(errl) @@ -546,6 +563,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) } }while(transferred_data < iv_lidSize); + } if(errl) { @@ -553,6 +571,31 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) } }while(0); + // If TCEs were allocated previously, deallocate them here + if (tces_allocated) + { + // Use Preverification Location and Size + auto tce_errl = TCE::utilDeallocateTces(tceToken, + MCL_TMP_SIZE); + + if(tce_errl) + { + UTIL_FT(ERR_MRK"getLid: Error while deallocating TCEs."); + + if (errl) + { + // Commit tce_errl here and original error will be passed back + tce_errl->collectTrace(UTIL_COMP_NAME); + errlCommit( tce_errl, UTIL_COMP_ID ); + } + else + { + // Set errl to tce_errl + errl = tce_errl; + } + } + } + if (iv_spBaseServicesEnabled) { unregisterMsgQueue(); -- cgit v1.2.1