summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Phan <cphan@us.ibm.com>2014-04-09 15:17:21 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-05-08 14:38:48 -0500
commit5257e66e8bba33b3f408d922606ef6bd78e6dd6e (patch)
tree12b346e4810d00ad2bfca61d2f2667b496ccda1e
parentcee5e582b7793aa8624a5d99a0dbd0e1f1e9a264 (diff)
downloadtalos-hostboot-5257e66e8bba33b3f408d922606ef6bd78e6dd6e.tar.gz
talos-hostboot-5257e66e8bba33b3f408d922606ef6bd78e6dd6e.zip
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 <bilpatil@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Zane Shelley <zshelle@us.ibm.com> Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/10967
-rwxr-xr-xsrc/usr/diag/prdf/common/prdfMain_common.C64
-rw-r--r--src/usr/diag/prdf/plat/pegasus/prdfDramRepairs.C3
-rw-r--r--src/usr/diag/prdf/prdfGlobal.H8
-rwxr-xr-xsrc/usr/diag/prdf/prdfMain.C19
4 files changed, 63 insertions, 31 deletions
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;
diff --git a/src/usr/diag/prdf/plat/pegasus/prdfDramRepairs.C b/src/usr/diag/prdf/plat/pegasus/prdfDramRepairs.C
index d909a725d..4b6f588e0 100644
--- a/src/usr/diag/prdf/plat/pegasus/prdfDramRepairs.C
+++ b/src/usr/diag/prdf/plat/pegasus/prdfDramRepairs.C
@@ -330,7 +330,8 @@ int32_t restoreDramRepairs( TargetHandle_t i_mba )
PRDF_ENTER( PRDF_FUNC"(0x%08x)", getHuid(i_mba) );
- PRDF_SYSTEM_SCOPE_MUTEX;
+ // will unlock when going out of scope
+ PRDF_SYSTEM_SCOPELOCK;
bool calloutMade = false;
diff --git a/src/usr/diag/prdf/prdfGlobal.H b/src/usr/diag/prdf/prdfGlobal.H
index 6f3a16548..5ebd03f03 100644
--- a/src/usr/diag/prdf/prdfGlobal.H
+++ b/src/usr/diag/prdf/prdfGlobal.H
@@ -79,12 +79,6 @@
SUCCESS
/**
- * @brief macro to acquire scope lock on system target
- * This macro is currently not used in hostboot.
- */
-#define PRDF_SYSTEM_SCOPELOCK
-
-/**
* @brief defined dump content to get through hostboot compilation.
* hwTableContent is a FSP specific enum originally defined in dump.
*/
@@ -201,7 +195,7 @@ static prdfMutex g_mutex;
/**
* @brief macro to acquire global scope mutex
*/
-#define PRDF_SYSTEM_SCOPE_MUTEX \
+#define PRDF_SYSTEM_SCOPELOCK \
prdfScopeMutex dataLock(g_mutex);
#endif // PRDF_GLOBAL_HB_H
diff --git a/src/usr/diag/prdf/prdfMain.C b/src/usr/diag/prdf/prdfMain.C
index c75044970..f70b4af5b 100755
--- a/src/usr/diag/prdf/prdfMain.C
+++ b/src/usr/diag/prdf/prdfMain.C
@@ -45,6 +45,12 @@ namespace PRDF
using namespace PlatServices;
//------------------------------------------------------------------------------
+// Forward references
+//------------------------------------------------------------------------------
+
+extern errlHndl_t noLock_refresh();
+
+//------------------------------------------------------------------------------
// Platform specific helper function for PRDF::initialize()
//------------------------------------------------------------------------------
@@ -63,7 +69,8 @@ int32_t analyzeIplCEStats( TargetHandle_t i_mba, bool &o_calloutMade )
PRDF_ENTER( PRDF_FUNC"(0x%08x)", getHuid(i_mba) );
- PRDF_SYSTEM_SCOPE_MUTEX;
+ // will unlock when going out of scope
+ PRDF_SYSTEM_SCOPELOCK;
int32_t o_rc = SUCCESS;
o_calloutMade = false;
@@ -111,22 +118,26 @@ int32_t analyzeIplCEStats( TargetHandle_t i_mba, bool &o_calloutMade )
errlHndl_t startScrub()
{
#define PRDF_FUNC "[PRDF::startScrub] "
+ PRDF_ENTER( PRDF_FUNC );
errlHndl_t o_errl = NULL;
int32_t l_rc = SUCCESS;
HUID nodeId = INVALID_HUID;
+ // will unlock when going out of scope
+ PRDF_SYSTEM_SCOPELOCK;
+
do
{
// Since the last refresh is in istep10 host_prd_hwreconfig,
// it may be good to call it again here at istep16 mss_scrub
// to remove any non-functional MBAs from PRD system model.
- o_errl = refresh();
+ o_errl = noLock_refresh();
// This shouldn't return any error but if it does, break out
if(NULL != o_errl)
{
- PRDF_ERR( PRDF_FUNC"refresh() failed" );
+ PRDF_ERR( PRDF_FUNC"noLock_refresh() failed" );
break;
}
@@ -174,6 +185,8 @@ errlHndl_t startScrub()
o_errl->collectTrace( PRDF_COMP_NAME, 512 );
}
+ PRDF_EXIT( PRDF_FUNC );
+
return o_errl;
#undef PRDF_FUNC
OpenPOWER on IntegriCloud