From 5257e66e8bba33b3f408d922606ef6bd78e6dd6e Mon Sep 17 00:00:00 2001 From: Chris Phan Date: Wed, 9 Apr 2014 15:17:21 -0500 Subject: PRD: consolidate PRDF_SYSTEM_SCOPE_MUTEX into PRDF_SYSTEM_SCOPELOCK Change-Id: Ia31fff7e43303cf8b68bc529994342153c2f055a RTC: 103728 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/10347 Tested-by: Jenkins Server Reviewed-by: Bilicon Patil Reviewed-by: Sachin Gupta Reviewed-by: Prem Shanker Jha Reviewed-by: A. Patrick Williams III Reviewed-by: Zane Shelley Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/10967 --- src/usr/diag/prdf/common/prdfMain_common.C | 64 ++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 20 deletions(-) (limited to 'src/usr/diag/prdf/common') diff --git a/src/usr/diag/prdf/common/prdfMain_common.C b/src/usr/diag/prdf/common/prdfMain_common.C index d36e14b84..c25a57d13 100755 --- a/src/usr/diag/prdf/common/prdfMain_common.C +++ b/src/usr/diag/prdf/common/prdfMain_common.C @@ -84,14 +84,11 @@ void unInitialize() //------------------------------------------------------------------------------ -errlHndl_t initialize() +errlHndl_t noLock_initialize() { - PRDF_ENTER( "PRDF::initialize()" ); + #define PRDF_FUNC "PRDF::noLock_initialize() " - // will unlock when going out of scope - // this lock is recursive so it's ok to lock again - // as long as calling from the same thread - PRDF_SYSTEM_SCOPELOCK; + PRDF_ENTER( PRDF_FUNC ); g_prd_errlHndl = NULL; // This forces any previous errls to be committed @@ -131,7 +128,7 @@ errlHndl_t initialize() delete systemPtr; systemPtr = NULL; g_initialized = false; - PRDF_ERR("PRDF::initialize() failed to buid object model"); + PRDF_ERR(PRDF_FUNC"failed to buid object model"); } //systemPtr is populated in configurator else if( systemPtr != NULL ) @@ -144,9 +141,28 @@ errlHndl_t initialize() Prdr::LoadChipCache::flushCache(); } - PRDF_EXIT( "PRDF::initialize()" ); + PRDF_EXIT( PRDF_FUNC ); return (g_prd_errlHndl.release()); + + #undef PRDF_FUNC +} + +errlHndl_t initialize() +{ + PRDF_ENTER( "PRDF::initialize()" ); + + errlHndl_t err = NULL; + + // will unlock when going out of scope + PRDF_SYSTEM_SCOPELOCK; + + err = noLock_initialize(); + + PRDF_EXIT( "PRDF::initialize()" ); + + return err; + } //------------------------------------------------------------------------------ @@ -156,11 +172,6 @@ errlHndl_t main( ATTENTION_VALUE_TYPE i_attentionType, { PRDF_ENTER( "PRDF::main() Global attnType=%04X", i_attentionType ); - // TODO RTC 103728: This is only needed for Hostboot code at this time, - // however, this issue is intented to address code changes needed to - // make PRD thread safe, either part or as a whole. - PRDF_SYSTEM_SCOPE_MUTEX; - // will unlock when going out of scope PRDF_SYSTEM_SCOPELOCK; @@ -172,7 +183,7 @@ errlHndl_t main( ATTENTION_VALUE_TYPE i_attentionType, if(( g_initialized == false)&&(NULL ==systemPtr)) { - g_prd_errlHndl = initialize(); + g_prd_errlHndl = noLock_initialize(); if(g_prd_errlHndl != NULL) rc = PRD_NOT_INITIALIZED; } @@ -283,18 +294,15 @@ errlHndl_t main( ATTENTION_VALUE_TYPE i_attentionType, //------------------------------------------------------------------------------ -errlHndl_t refresh() +errlHndl_t noLock_refresh() { - PRDF_ENTER("PRDF::refresh()"); + PRDF_ENTER("PRDF::noLock_refresh()"); errlHndl_t l_errl = NULL; - // will unlock when going out of scope - PRDF_SYSTEM_SCOPELOCK; - if((false == g_initialized) || (NULL == systemPtr)) { - l_errl = initialize(); + l_errl = noLock_initialize(); } else { @@ -303,6 +311,22 @@ errlHndl_t refresh() systemPtr->RemoveNonFunctionalChips(); } + PRDF_EXIT("PRDF::noLock_refresh()"); + + return l_errl; +} + +errlHndl_t refresh() +{ + PRDF_ENTER("PRDF::refresh()"); + + errlHndl_t l_errl = NULL; + + // will unlock when going out of scope + PRDF_SYSTEM_SCOPELOCK; + + l_errl = noLock_refresh(); + PRDF_EXIT("PRDF::refresh()"); return l_errl; -- cgit v1.2.1