summaryrefslogtreecommitdiffstats
path: root/src/usr/diag
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/diag')
-rw-r--r--src/usr/diag/prdf/common/framework/service/prdfRasServices_common.C78
-rw-r--r--src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H16
-rwxr-xr-xsrc/usr/diag/prdf/common/prdfEnums.H3
-rw-r--r--src/usr/diag/prdf/framework/service/prdfRasServices.C22
-rwxr-xr-xsrc/usr/diag/prdf/mnfgtools/prdfMfgSync.C (renamed from src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.C)106
-rwxr-xr-xsrc/usr/diag/prdf/mnfgtools/prdfMfgSync.H (renamed from src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.H)83
-rwxr-xr-xsrc/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C8
-rw-r--r--src/usr/diag/prdf/prdf_hb_only.mk7
-rwxr-xr-xsrc/usr/diag/prdf/test/makefile6
-rw-r--r--src/usr/diag/prdf/test/prdfTest_Ex.H4
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfTest_MfgSync.H182
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfTest_MfgThresSync.H70
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimFspSyncSvc.C72
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimFspSyncSvc.H12
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimMfgSync.C (renamed from src/usr/diag/prdf/test/prdfsimMfgThresholdSync.C)70
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimMfgSync.H (renamed from src/usr/diag/prdf/test/prdfsimMfgThresholdSync.H)63
16 files changed, 551 insertions, 251 deletions
diff --git a/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.C b/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.C
index 74dc80713..2bcbb4c1b 100644
--- a/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.C
+++ b/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.C
@@ -1029,84 +1029,6 @@ void ErrDataService::initPfaData( ServiceDataCollector & i_sdc,
//------------------------------------------------------------------------------
-void ErrDataService::MnfgTrace( ErrorSignature * i_esig,
- const PfaData & i_pfaData )
-{
-#ifndef __HOSTBOOT_MODULE
- // TODO: RTC 79440 Need to add Hostboot support for this function.
-
- do
- {
- if ( !PlatServices::mfgMode() ) break; // Nothing to do
-
- char * MnfgFilename = NULL;
- uint32_t l_size = 0;
- const char * MnfgKey[] = {"fstp/P0_Root"};
-
- errlHndl_t errl = UtilReg::path( MnfgKey, 1, "prdfMfgErrors",
- MnfgFilename, l_size );
- if ( NULL != errl )
- {
- PRDF_ERR( "[ErrDataService::MnfgTrace] UtilReg::path() failed" );
- PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
- break;
- }
-
- UtilFile l_mfgFile;
- l_mfgFile.Open(MnfgFilename,"a+");
-
- char l_string[100];
- uint32_t signature = i_esig->getSigId();
- HUID sigChip = i_esig->getChipId();
-
- // Get Entity Path String
- TargetHandle_t l_ptempHandle = PlatServices::getTarget(sigChip);
- TARGETING::EntityPath path;
- PlatServices::getEntityPath(l_ptempHandle, path,
- EntityPath::PATH_PHYSICAL);
- char *epStr = path.toString();
- if (epStr)
- {
- snprintf(l_string, 100, "%s, ", path.toString());
- free(epStr);
- }
-
- l_mfgFile.write(l_string, strlen(l_string));
-
- // Write Signature
- snprintf(l_string, 100, "0x%08x, 0x%08x, ", sigChip, signature);
- l_mfgFile.write(l_string, strlen(l_string));
-
- // Write chip ECID data
- PlatServices::getECIDString(l_ptempHandle, l_string);
- l_mfgFile.write(l_string, strlen(l_string));
-
- // Write MRU list
- uint32_t n = 0;
- while ( (n < MruListLIMIT ) && (n < i_pfaData.mruListCount) )
- {
- snprintf( l_string, 100, " , %08x", i_pfaData.mruList[n].callout );
- l_mfgFile.write( l_string, strlen(l_string) );
- ++n;
- }
- snprintf(l_string, 100, "\n");
- l_mfgFile.write(l_string, 1);
-
- l_mfgFile.Close();
-
- if (MnfgFilename != NULL)
- { //need to free the pathname
- free(MnfgFilename);
- MnfgFilename = NULL;
- }
-
- } while (0);
-
-#endif // if not __HOSTBOOT_MODULE
-}
-
-//------------------------------------------------------------------------------
-
void ErrDataService::AddCapData( CaptureData & i_cd, errlHndl_t i_errHdl)
{
// As CaptureDataClass has large array inside, allocate it on heap
diff --git a/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H b/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H
index 90279ece0..a6e5f53a1 100644
--- a/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H
+++ b/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2002,2013 */
+/* COPYRIGHT International Business Machines Corp. 2002,2014 */
/* */
/* p1 */
/* */
@@ -133,6 +133,13 @@ class ErrDataService
terminateOnCheckstop = setting;
}
+ /**
+ * @brief Add trace data to file for Manufacturing.
+ * @param i_esig Error signature.
+ * @param i_pfaData The PFA data.
+ */
+ void MnfgTrace( ErrorSignature * i_esig, const PfaData & i_pfaData );
+
private:
/**
@@ -177,13 +184,6 @@ class ErrDataService
#endif // end if not __HOSTBOOT_MODULE
/**
- * @brief Add trace data to file for Manufacturing.
- * @param i_esig Error signature.
- * @param i_pfaData The PFA data.
- */
- void MnfgTrace( ErrorSignature * i_esig, const PfaData & i_pfaData );
-
- /**
* @brief Initializes the PFA data.
* @param i_sdc The service data collector.
* @param o_pfa The PFA data struct.
diff --git a/src/usr/diag/prdf/common/prdfEnums.H b/src/usr/diag/prdf/common/prdfEnums.H
index a7cf7ed71..c46f5b703 100755
--- a/src/usr/diag/prdf/common/prdfEnums.H
+++ b/src/usr/diag/prdf/common/prdfEnums.H
@@ -34,7 +34,8 @@ namespace PRDF
* */
enum MFG_THRES_SYNC_MSG_TYPE
{
- MFG_THRES_SYNC_FROM_FSP = 0x1
+ MFG_THRES_SYNC_FROM_FSP = 0x1,
+ MFG_TRACE_SYNC_TO_FSP = 0x2
};
}; // end namespace PRDF
diff --git a/src/usr/diag/prdf/framework/service/prdfRasServices.C b/src/usr/diag/prdf/framework/service/prdfRasServices.C
index d14732b9a..d74816006 100644
--- a/src/usr/diag/prdf/framework/service/prdfRasServices.C
+++ b/src/usr/diag/prdf/framework/service/prdfRasServices.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -26,9 +26,29 @@
*/
#include <prdfRasServices.H>
+#include <prdfMfgSync.H>
+#include <prdfErrlUtil.H>
namespace PRDF
{
+void ErrDataService::MnfgTrace( ErrorSignature * i_esig,
+ const PfaData & i_pfaData )
+{
+ #define PRDF_FUNC "[ErrDataService::MnfgTrace] "
+ do
+ {
+ errlHndl_t errl = NULL;
+ errl = getMfgSync().syncMfgTraceToFsp(i_esig, i_pfaData);
+ if (errl)
+ {
+ PRDF_ERR(PRDF_FUNC "failed to sync to the FSP");
+ PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT);
+ break;
+ }
+ }while(0);
+ #undef PRDF_FUNC
+}
+
} // end namespace PRDF
diff --git a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.C b/src/usr/diag/prdf/mnfgtools/prdfMfgSync.C
index e768b7dcd..b02064e50 100755
--- a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.C
+++ b/src/usr/diag/prdf/mnfgtools/prdfMfgSync.C
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.C $ */
+/* $Source: src/usr/diag/prdf/mnfgtools/prdfMfgSync.C $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -21,7 +21,7 @@
/* */
/* IBM_PROLOG_END_TAG */
-#include <prdfMfgThresholdSync.H>
+#include <prdfMfgSync.H>
#include <prdfMfgThresholdMgr.H>
#include <prdfEnums.H>
#include <initservice/initserviceif.H>
@@ -29,21 +29,14 @@
namespace PRDF
{
-MfgThresholdSync::MfgThresholdSync()
+MfgSync& getMfgSync()
{
- iv_MailboxEnabled = INITSERVICE::spBaseServicesEnabled();
+ return PRDF_GET_SINGLETON(theMfgSync);
}
-MfgThresholdSync::~MfgThresholdSync()
+errlHndl_t MfgSync::syncMfgThresholdFromFsp()
{
- #define FUNC "[MfgThresholdSync::~MfgThresholdSync]"
- PRDF_TRAC( FUNC );
- #undef FUNC
-}
-
-errlHndl_t MfgThresholdSync::syncMfgThresholdFromFsp()
-{
- #define FUNC "[MfgThresholdSync::syncMfgThresholdFromFsp]"
+ #define FUNC "[MfgSync::syncMfgThresholdFromFsp]"
PRDF_ENTER( FUNC );
errlHndl_t l_err = NULL;
@@ -53,9 +46,6 @@ errlHndl_t MfgThresholdSync::syncMfgThresholdFromFsp()
{
msg_t * msg = msg_allocate();
- // initialize msg buffer
- memset( msg, 0, sizeof(msg_t) );
-
msg->type = MFG_THRES_SYNC_FROM_FSP;
msg->data[0] = 0;
msg->data[1] = 0;
@@ -118,9 +108,71 @@ errlHndl_t MfgThresholdSync::syncMfgThresholdFromFsp()
#undef FUNC
}
-errlHndl_t MfgThresholdSync::sendMboxMsg( msg_t * i_msg )
+errlHndl_t MfgSync::syncMfgTraceToFsp( ErrorSignature *i_esig,
+ const PfaData &i_pfaData )
{
- #define FUNC "[MfgThresholdSync::sendMboxMsg]"
+ #define PRDF_FUNC "[MfgSync::syncMfgTraceToFsp]"
+ PRDF_ENTER( PRDF_FUNC );
+
+ errlHndl_t l_err = NULL;
+ msg_t *msg = NULL;
+
+ do
+ {
+ // Only send message to FSP when mailbox is enabled
+ if( false == isMailboxEnabled() )
+ {
+ // mailbox is not enabled, skipping MFG trace sync.
+ break;
+ }
+
+ uint32_t l_chipID = i_esig->getChipId();
+ uint32_t l_sigID = i_esig->getSigId();
+ uint64_t l_data0 = l_chipID;
+ l_data0 = ((l_data0 << 32) | l_sigID);
+
+ msg = msg_allocate();
+
+ msg->type = MFG_TRACE_SYNC_TO_FSP;
+ msg->data[0] = l_data0;
+ msg->data[1] = (i_pfaData.mruListCount * sizeof(PfaMruListStruct));
+ if(0 < i_pfaData.mruListCount)
+ {
+ msg->extra_data =
+ malloc(i_pfaData.mruListCount * sizeof(PfaMruListStruct));
+ memcpy(msg->extra_data,
+ i_pfaData.mruList,
+ (i_pfaData.mruListCount * sizeof(PfaMruListStruct)));
+ }
+
+ l_err = sendMboxMsg( msg, false );
+
+ if( NULL != l_err )
+ {
+ PRDF_ERR( PRDF_FUNC" failed to send mbox msg" );
+ break;
+ }
+ }while(0);
+
+ // After sending an asynchronous message, the memory allocated
+ // to msg and extra_data is automatically deleted.
+ // We need to free it explicity if the message send failed.
+ if(NULL != l_err)
+ {
+ free( msg->extra_data );
+ msg_free( msg );
+ msg = NULL;
+ }
+
+ PRDF_EXIT( PRDF_FUNC );
+
+ return l_err;
+ #undef PRDF_FUNC
+}
+
+errlHndl_t MfgSync::sendMboxMsg( msg_t * i_msg, bool i_expectResponse )
+{
+ #define FUNC "[MfgSync::sendMboxMsg]"
PRDF_ENTER( FUNC );
errlHndl_t l_errl = NULL;
@@ -129,8 +181,16 @@ errlHndl_t MfgThresholdSync::sendMboxMsg( msg_t * i_msg )
PRDF_TRAC( "data1: 0x%016llx", i_msg->data[1] );
PRDF_TRAC( "extra_data: %p", i_msg->extra_data );
- // send a sync message
- l_errl = MBOX::sendrecv( MBOX::FSP_PRD_SYNC_MSGQ_ID, i_msg );
+ if(true == i_expectResponse)
+ {
+ // send a sync message
+ l_errl = MBOX::sendrecv( MBOX::FSP_PRD_SYNC_MSGQ_ID, i_msg );
+ }
+ else
+ {
+ // send an async message
+ l_errl = MBOX::send( MBOX::FSP_PRD_SYNC_MSGQ_ID, i_msg );
+ }
if( NULL != l_errl )
{
@@ -144,6 +204,10 @@ errlHndl_t MfgThresholdSync::sendMboxMsg( msg_t * i_msg )
#undef FUNC
}
+bool MfgSync::isMailboxEnabled()
+{
+ return INITSERVICE::spBaseServicesEnabled();
+}
} // end namespace PRDF
diff --git a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.H b/src/usr/diag/prdf/mnfgtools/prdfMfgSync.H
index b9fcafc5d..9b2d44619 100755
--- a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.H
+++ b/src/usr/diag/prdf/mnfgtools/prdfMfgSync.H
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.H $ */
+/* $Source: src/usr/diag/prdf/mnfgtools/prdfMfgSync.H $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -21,10 +21,13 @@
/* */
/* IBM_PROLOG_END_TAG */
-#ifndef __PRDF_MFGTHRESHOLDSYNC_H
-#define __PRDF_MFGTHRESHOLDSYNC_H
+#ifndef __PRDF_MFGSYNC_H
+#define __PRDF_MFGSYNC_H
+#include <prdfGlobal.H>
#include <prdfMfgThresholdFile.H>
+#include <prdfErrorSignature.H>
+#include <prdfPfa5Data.h>
#include <mbox/mbox_queues.H>
#include <mbox/mboxif.H>
@@ -34,19 +37,32 @@
namespace PRDF
{
-class MfgThresholdSync
+/**
+ * @brief Singleton to access the MfgSync
+ */
+class MfgSync;
+PRDF_DECLARE_SINGLETON(MfgSync, theMfgSync);
+
+/**
+ * @brief Returns a reference to the MfgSync singleton
+ *
+ * @return Reference to the MfgSync
+ */
+MfgSync& getMfgSync();
+
+class MfgSync
{
public:
/**
* @brief ctor
*/
- MfgThresholdSync();
+ MfgSync(){};
/**
* @brief dtor
*/
- virtual ~MfgThresholdSync();
+ virtual ~MfgSync(){};
/**
* @brief sync from FSP mfg thresholds
@@ -56,46 +72,51 @@ class MfgThresholdSync
virtual errlHndl_t syncMfgThresholdFromFsp();
/**
- * @brief getter for mailbox enabled flag
+ * @brief sync to FSP mfg trace data
+ *
+ * @param i_esig Error Signature
+ * @param i_pfaData The PFA data struct
*
+ * @return errlHndl_t
*/
- inline bool isMailboxEnabled()
- {
- return iv_MailboxEnabled;
- }
+ virtual errlHndl_t syncMfgTraceToFsp( ErrorSignature *i_esig,
+ const PfaData &i_pfaData );
/**
- * @brief setter for mailbox enabled flag
+ * @brief getter for mailbox enabled flag
*
*/
- inline void setMailboxEnabled(bool i_flag)
- {
- iv_MailboxEnabled = i_flag;
- }
+ virtual bool isMailboxEnabled();
private:
/**
- * @brief send a sync mbox message to the FSP using the
- * FSP_MFG_THRESHOLD_SYNC_MSGQ message queue
+ * @brief send a sync mbox message to the FSP using the
+ * FSP_MFG_THRESHOLD_SYNC_MSGQ message queue
*
- * @param[in/out] i_msg
- * This parameter is used as both input and an
- * output parameter. If the message is
- * synchronus, the response will be populated
- * in an object pointed to by this pointer.
- * If the message is asynchronus, the object
- * pointed to by this parameter will be sent
- * to the fsp.
+ * @param[in/out] i_msg
+ * This parameter is used as both input and an
+ * output parameter. If the message is
+ * synchronus, the response will be populated
+ * in an object pointed to by this pointer.
+ * If the message is asynchronus, the object
+ * pointed to by this parameter will be sent
+ * to the fsp.
+ * @param i_expectResponse
+ * This is a default parameter.
+ * If true, this functions sends a synchronous message
+ * If false, this function sends an asynchronous message
*
- * @return errlHndl_t
+ * @return errlHndl_t
*/
- virtual errlHndl_t sendMboxMsg( msg_t * i_msg );
+ virtual errlHndl_t sendMboxMsg( msg_t * i_msg,
+ bool i_expectResponse = true );
private:
- bool iv_MailboxEnabled;
-
+ // Disabled copy constructor and assignment operator
+ MfgSync(const MfgSync & right);
+ MfgSync & operator=(const MfgSync & right);
};
diff --git a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C b/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C
index 6b77087eb..4262d3812 100755
--- a/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C
+++ b/src/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2009,2013 */
+/* COPYRIGHT International Business Machines Corp. 2009,2014 */
/* */
/* p1 */
/* */
@@ -24,7 +24,7 @@
#include <prdfMfgThresholdFile.H>
#include <prdfGlobal.H>
#include <prdfAssert.h>
-#include <prdfMfgThresholdSync.H>
+#include <prdfMfgSync.H>
#include <prdfErrlUtil.H>
#include <prdfPlatServices.H>
#include <prdfTrace.H>
@@ -50,9 +50,7 @@ void MfgThresholdFile::syncFromFsp()
break;
}
- MfgThresholdSync l_syncer;
-
- errlHndl_t l_err = l_syncer.syncMfgThresholdFromFsp();
+ errlHndl_t l_err = getMfgSync().syncMfgThresholdFromFsp();
if (l_err)
{
PRDF_ERR(FUNC" failed to sync from the FSP");
diff --git a/src/usr/diag/prdf/prdf_hb_only.mk b/src/usr/diag/prdf/prdf_hb_only.mk
index 199e8ca70..af7ef5221 100644
--- a/src/usr/diag/prdf/prdf_hb_only.mk
+++ b/src/usr/diag/prdf/prdf_hb_only.mk
@@ -1,11 +1,11 @@
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
-# $Source: ./prdf_hb_only.mk $
+# $Source: src/usr/diag/prdf/prdf_hb_only.mk $
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2013
+# COPYRIGHT International Business Machines Corp. 2013,2014
#
# p1
#
@@ -37,11 +37,12 @@ prd_config_HB = \
prd_mnfgtools_HB = \
prdfMfgThresholdFile.o \
- prdfMfgThresholdSync.o
+ prdfMfgSync.o
prd_plat_HB = \
prdfCenMbaIplCeStats.o \
prdfDramRepairs.o \
+ prdfRasServices.o \
prdfPlatCalloutUtil.o
prd_object_files_HB = \
diff --git a/src/usr/diag/prdf/test/makefile b/src/usr/diag/prdf/test/makefile
index 067b30426..03de64d58 100755
--- a/src/usr/diag/prdf/test/makefile
+++ b/src/usr/diag/prdf/test/makefile
@@ -5,7 +5,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2012,2013
+# COPYRIGHT International Business Machines Corp. 2012,2014
#
# p1
#
@@ -66,11 +66,11 @@ OBJS = prdfsimHomRegisterAccess.o \
prdfsimServices.o \
prdsimSignatureParser.o \
prdfsimUtil.o \
- prdfsimMfgThresholdSync.o \
+ prdfsimMfgSync.o \
prdfsimFspSyncSvc.o \
prdfsimFspMfgThresholdFile.o
-TESTS = prdfTest_MfgThresSync.H \
+TESTS = prdfTest_MfgSync.H \
prdfTest_ABus.H \
prdfTest_Ex.H \
prdfTest.H \
diff --git a/src/usr/diag/prdf/test/prdfTest_Ex.H b/src/usr/diag/prdf/test/prdfTest_Ex.H
index 42067ff2b..1e6cd0d22 100644
--- a/src/usr/diag/prdf/test/prdfTest_Ex.H
+++ b/src/usr/diag/prdf/test/prdfTest_Ex.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* COPYRIGHT International Business Machines Corp. 2012,2014 */
/* */
/* p1 */
/* */
@@ -36,7 +36,7 @@
#include <prdfTrace.H>
#include <prdfMain.H>
#include "prdfsimMacros.H"
-#include "prdfsimMfgThresholdSync.H"
+#include "prdfsimMfgSync.H"
#include <prdfGlobal.H>
#include <prdfErrlUtil.H>
diff --git a/src/usr/diag/prdf/test/prdfTest_MfgSync.H b/src/usr/diag/prdf/test/prdfTest_MfgSync.H
new file mode 100755
index 000000000..835c46cb1
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfTest_MfgSync.H
@@ -0,0 +1,182 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfTest_MfgSync.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#ifndef __TEST_PRDFTESTMFGSYNC_H
+#define __TEST_PRDFTESTMFGSYNC_H
+
+/**
+ * @file prdfTest_MfgSync.H
+ *
+ * @brief prdf unit test
+ */
+
+#ifdef __HOSTBOOT_MODULE
+ #include <cxxtest/TestSuite.H>
+ #include <errl/errlentry.H>
+ #include <errl/errlmanager.H>
+#else
+ #include <cxxtest/TestSuite.h>
+ #include <fsp/FipsGlobalFixture.H>
+ #include <errlentry.H>
+#endif
+
+#include <prdfTrace.H>
+#include <prdfMain.H>
+#include "prdfsimMacros.H"
+#include "prdfsimMfgSync.H"
+#include <prdfErrlUtil.H>
+#include <prdfMain_common.H>
+#include <prdfCalloutsData.H>
+
+using namespace PRDF;
+
+class PrdfTest_MfgSync: public CxxTest::TestSuite
+{
+ public:
+ void TestMfgThresSync(void)
+ {
+ #define PRDF_FUNC "PrdfTest_MfgThresSync"
+ PRDF_ENTER(PRDF_FUNC);
+
+ // Test 1: Test with mailbox status disabled
+ getSimMfgSync().setMailBoxStatus(false);
+ errlHndl_t l_err = getSimMfgSync().syncMfgThresholdFromFsp();
+ if (l_err)
+ {
+ PRDF_ERR(PRDF_FUNC" MfgThresSync test1 failed to sync from FSP");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgThresSync test1 failed to sync from FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgThresSync test1 is a success.");
+ }
+
+ // Test 2: Test with mailbox status enabled
+ getSimMfgSync().setMailBoxStatus(true);
+ l_err = getSimMfgSync().syncMfgThresholdFromFsp();
+ if (l_err)
+ {
+ PRDF_ERR(PRDF_FUNC" MfgThresSync test2 failed to sync from FSP");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgThresSync test2 failed to sync from FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgThresSync test2 is a success.");
+ }
+ PRDF_EXIT(PRDF_FUNC);
+ #undef PRDF_FUNC
+ }
+
+ void TestMfgTraceSync(void)
+ {
+ #define PRDF_FUNC "PrdfTest_MfgTraceSync"
+
+ PRDF_ENTER(PRDF_FUNC);
+ ErrorSignature l_errSig;
+ PfaData l_pfaData;
+ errlHndl_t l_err = NULL;
+
+ l_errSig.setChipId(0xffffffff);
+ l_errSig.setRegId(0xffff);
+ l_errSig.setErrCode((uint16_t)NO_PRD_ANALYSIS);
+
+ l_pfaData.mruListCount = 1;
+
+ l_pfaData.mruList[0].callout = 0;
+ l_pfaData.mruList[0].type = PRDcalloutData::TYPE_TARGET;
+ l_pfaData.mruList[0].priority = SRCI_PRIORITY_LOW;
+
+ // Test 1: Test with mailbox status disabled
+ getSimMfgSync().setMailBoxStatus(false);
+ l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
+ if (l_err)
+ {
+ PRDF_ERR(PRDF_FUNC" MfgTraceSync test1 failed to sync to FSP");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgTraceSync test1 failed to sync to FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test1 is a success.");
+ }
+
+ getSimMfgSync().setMailBoxStatus(true);
+
+ // Test 2: Test with mailbox status enabled
+ l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
+ if (l_err)
+ {
+ PRDF_ERR(PRDF_FUNC" MfgTraceSync test2 failed to sync to FSP");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgTraceSync test2 failed to sync to FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test2 is a success.");
+ }
+
+ // Test 3: Test with mailbox status enabled and max MRU List count
+ l_pfaData.mruListCount = 8;
+ for(uint8_t i = 0; i < l_pfaData.mruListCount; i++)
+ {
+ l_pfaData.mruList[i].callout = 0;
+ l_pfaData.mruList[i].type = PRDcalloutData::TYPE_TARGET;
+ l_pfaData.mruList[i].priority = SRCI_PRIORITY_LOW;
+ }
+
+ l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
+ if (l_err)
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test3 failed to sync to FSP.");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgTraceSync test3 failed to sync to FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test3 is a success.");
+ }
+
+ // Test 4: Test with mailbox status enabled and zero MRU List count
+ l_pfaData.mruListCount = 0;
+ l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
+ if (l_err)
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test4 failed to sync to FSP.");
+ PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
+ TS_FAIL(PRDF_FUNC" MfgTraceSync test4 failed to sync to FSP");
+ }
+ else
+ {
+ PRDF_TRAC(PRDF_FUNC" MfgTraceSync test4 is a success.");
+ }
+
+ getSimMfgSync().setMailBoxStatus(false);
+
+ PRDF_EXIT(PRDF_FUNC);
+ #undef PRDF_FUNC
+ }
+};
+#endif
+
diff --git a/src/usr/diag/prdf/test/prdfTest_MfgThresSync.H b/src/usr/diag/prdf/test/prdfTest_MfgThresSync.H
deleted file mode 100755
index 70c2cf4bf..000000000
--- a/src/usr/diag/prdf/test/prdfTest_MfgThresSync.H
+++ /dev/null
@@ -1,70 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/diag/prdf/test/prdfTest_MfgThresSync.H $ */
-/* */
-/* IBM CONFIDENTIAL */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2013 */
-/* */
-/* p1 */
-/* */
-/* Object Code Only (OCO) source materials */
-/* Licensed Internal Code Source Materials */
-/* IBM HostBoot Licensed Internal Code */
-/* */
-/* The source code for this program is not published or otherwise */
-/* divested of its trade secrets, irrespective of what has been */
-/* deposited with the U.S. Copyright Office. */
-/* */
-/* Origin: 30 */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-#ifndef __TEST_PRDFTESTMFGTHRESSYNC_H
-#define __TEST_PRDFTESTMFGTHRESSYNC_H
-
-/**
- * @file prdfTest_MfgThresSync.H
- *
- * @brief prdf unit test
- */
-
-#ifdef __HOSTBOOT_MODULE
- #include <cxxtest/TestSuite.H>
- #include <errl/errlentry.H>
- #include <errl/errlmanager.H>
-#else
- #include <cxxtest/TestSuite.h>
- #include <fsp/FipsGlobalFixture.H>
- #include <errlentry.H>
-#endif
-
-#include <prdfTrace.H>
-#include <prdfMain.H>
-#include "prdfsimMacros.H"
-#include "prdfsimMfgThresholdSync.H"
-#include <prdfErrlUtil.H>
-
-class PrdfTest_MfgThresSync: public CxxTest::TestSuite
-{
- #define FUNC "PrdfTest_MfgThresSync"
- PRDF_ENTER(FUNC);
- PRDF::SimMfgThresholdSync l_syncer;
-
- errlHndl_t l_err = l_syncer.syncMfgThresholdFromFsp();
- if (l_err)
- {
- PRDF_ERR(FUNC" MfgThresSync test failed to sync from FSP");
- PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
- TS_FAIL(FUNC" MfgThresSync test failed to sync from FSP");
- }
- else
- {
- PRDF_TRAC(FUNC" MfgThresSync test is a success.");
- }
- PRDF_EXIT(FUNC);
- #undef FUNC
-};
-#endif
-
diff --git a/src/usr/diag/prdf/test/prdfsimFspSyncSvc.C b/src/usr/diag/prdf/test/prdfsimFspSyncSvc.C
index 471b02a45..e543403c5 100755
--- a/src/usr/diag/prdf/test/prdfsimFspSyncSvc.C
+++ b/src/usr/diag/prdf/test/prdfsimFspSyncSvc.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2009,2013 */
+/* COPYRIGHT International Business Machines Corp. 2009,2014 */
/* */
/* p1 */
/* */
@@ -27,6 +27,7 @@
#include <prdfAssert.h>
#include <prdfEnums.H>
#include <prdfErrlUtil.H>
+#include <prdfPfa5Data.h>
namespace PRDF
{
@@ -59,6 +60,16 @@ void SimFspSyncSvc::processRequestMsg(msg_t * i_msg)
PRDF_COMMIT_ERRL(pError, ERRL_ACTION_REPORT);
}
break;
+
+ case MFG_TRACE_SYNC_TO_FSP:
+ pError = processMfgTrace(i_msg);
+ if(NULL != pError)
+ {
+ PRDF_ERR(FUNC" processMfgTrace returned error");
+ PRDF_COMMIT_ERRL(pError, ERRL_ACTION_REPORT);
+ }
+ break;
+
default:
PRDF_ERR(FUNC" Invalid Message Type received from HB :"
"[0x%08X]", i_msg->type);
@@ -115,6 +126,65 @@ errlHndl_t SimFspSyncSvc::sendMfgThresRespMsg(msg_t * i_msg) const
#undef FUNC
}
+errlHndl_t SimFspSyncSvc::processMfgTrace(msg_t *i_msg) const
+{
+ #define PRDF_FUNC "[SimFspSyncSvc::processMfgTrace]"
+ PRDF_ENTER(PRDF_FUNC);
+
+ errlHndl_t l_errLog = NULL;
+ uint8_t l_mruListCount = 0;
+ uint8_t *l_extraData = NULL;
+
+ do
+ {
+ l_extraData = reinterpret_cast <uint8_t *> (i_msg->extra_data);
+
+ l_mruListCount = (i_msg->data[1] / sizeof(PfaMruListStruct));
+
+ if(l_mruListCount > MruListLIMIT)
+ {
+ PRDF_ERR(PRDF_FUNC "Invalid MRU count: %d received from Hostboot"
+ " max expected count is: %d",
+ l_mruListCount, MruListLIMIT);
+
+ /*@
+ * @errortype
+ * @refcode LIC_REFCODE
+ * @subsys EPUB_FIRMWARE_SP
+ * @reasoncode PRDF_INVALID_CONFIG
+ *
+ * @moduleid PRDF_SYNC_SVC
+ * @userdata1 MRU List Count
+ * @userdata2 Max MRU Count
+ * @userdata3 Line number in file
+ * @devdesc Received invalid MRU count in
+ * MnfgTrace message from Hostboot
+ */
+ PRDF_CREATE_ERRL(l_errLog,
+ ERRL_SEV_INFORMATIONAL,
+ ERRL_ETYPE_NOT_APPLICABLE,
+ SRCI_ERR_INFO,
+ SRCI_NO_ATTR,
+ PRDF_SYNC_SVC,
+ LIC_REFCODE,
+ PRDF_INVALID_CONFIG,
+ l_mruListCount,
+ MruListLIMIT,
+ __LINE__, 0);
+ break;
+ }
+
+ if(NULL != l_extraData)
+ {
+ free(l_extraData);
+ }
+
+ }while(0);
+
+ return l_errLog;
+ #undef PRDF_FUNC
+}
+
/****************************/
// SimFspSyncSvc end
/****************************/
diff --git a/src/usr/diag/prdf/test/prdfsimFspSyncSvc.H b/src/usr/diag/prdf/test/prdfsimFspSyncSvc.H
index b0428de7f..08d171ddc 100755
--- a/src/usr/diag/prdf/test/prdfsimFspSyncSvc.H
+++ b/src/usr/diag/prdf/test/prdfsimFspSyncSvc.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2009,2013 */
+/* COPYRIGHT International Business Machines Corp. 2009,2014 */
/* */
/* p1 */
/* */
@@ -85,6 +85,16 @@ class SimFspSyncSvc
*/
errlHndl_t sendMfgThresRespMsg(msg_t * i_msg) const;
+ /*
+ * @brief Process the Mnfg Trace data sent by Hostboot
+ *
+ * @param[in] i_msg, the request msg that was sent by HB
+ *
+ * @return Error log handle that will indicate if the Mnfg trace file
+ * was updated, error otherwise.
+ *
+ */
+ errlHndl_t processMfgTrace(msg_t * i_msg) const;
// Disabled copy constructor and assignment operator
SimFspSyncSvc(const SimFspSyncSvc & right);
diff --git a/src/usr/diag/prdf/test/prdfsimMfgThresholdSync.C b/src/usr/diag/prdf/test/prdfsimMfgSync.C
index b755c285f..a54bdc8dc 100755
--- a/src/usr/diag/prdf/test/prdfsimMfgThresholdSync.C
+++ b/src/usr/diag/prdf/test/prdfsimMfgSync.C
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/diag/prdf/test/prdfsimMfgThresholdSync.C $ */
+/* $Source: src/usr/diag/prdf/test/prdfsimMfgSync.C $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -21,7 +21,7 @@
/* */
/* IBM_PROLOG_END_TAG */
-#include <prdfsimMfgThresholdSync.H>
+#include <prdfsimMfgSync.H>
#include <prdfsimFspSyncSvc.H>
#include <prdfMfgThresholdMgr.H>
#include <prdfEnums.H>
@@ -29,35 +29,36 @@
namespace PRDF
{
-SimMfgThresholdSync::SimMfgThresholdSync()
-: MfgThresholdSync()
+SimMfgSync& getSimMfgSync()
{
- #define FUNC "[SimMfgThresholdSync::SimMfgThresholdSync]"
- PRDF_TRAC( FUNC );
-
- // override the mailbox enabled flag for testing
- setMailboxEnabled( true );
+ return PRDF_GET_SINGLETON(theSimMfgSync);
+}
+SimMfgSync::SimMfgSync(): MfgSync()
+{
+ #define FUNC "[SimMfgSync::SimMfgSync]"
+ PRDF_TRAC( FUNC );
+ iv_mailBoxStatus = false;
#undef FUNC
}
-SimMfgThresholdSync::~SimMfgThresholdSync()
+SimMfgSync::~SimMfgSync()
{
- #define FUNC "[SimMfgThresholdSync::~SimMfgThresholdSync]"
+ #define FUNC "[SimMfgSync::~SimMfgSync]"
PRDF_TRAC( FUNC );
#undef FUNC
}
-errlHndl_t SimMfgThresholdSync::syncMfgThresholdFromFsp()
+errlHndl_t SimMfgSync::syncMfgThresholdFromFsp()
{
- #define FUNC "[SimMfgThresholdSync::SimsyncMfgThresholdFromFsp]"
+ #define FUNC "[SimMfgSync::syncMfgThresholdFromFsp]"
PRDF_ENTER( FUNC );
errlHndl_t l_err = NULL;
do
{
- l_err = MfgThresholdSync::syncMfgThresholdFromFsp();
+ l_err = MfgSync::syncMfgThresholdFromFsp();
if(NULL != l_err)
{
@@ -73,9 +74,35 @@ errlHndl_t SimMfgThresholdSync::syncMfgThresholdFromFsp()
#undef FUNC
}
-errlHndl_t SimMfgThresholdSync::sendMboxMsg( msg_t * i_msg )
+errlHndl_t SimMfgSync::syncMfgTraceToFsp(ErrorSignature *i_esig,
+ const PfaData &i_pfaData)
+{
+ #define PRDF_FUNC "[SimMfgSync::syncMfgTraceToFsp]"
+ PRDF_ENTER( PRDF_FUNC );
+
+ errlHndl_t l_err = NULL;
+
+ do
+ {
+ l_err = MfgSync::syncMfgTraceToFsp(i_esig, i_pfaData);
+
+ if(NULL != l_err)
+ {
+ PRDF_TRAC( PRDF_FUNC" syncMfgTraceToFsp failed" );
+ }
+
+ } while(0);
+
+
+ PRDF_EXIT( PRDF_FUNC );
+
+ return l_err;
+ #undef PRDF_FUNC
+}
+
+errlHndl_t SimMfgSync::sendMboxMsg( msg_t * i_msg, bool i_expectResponse )
{
- #define FUNC "[SimMfgThresholdSync::sendMboxMsg]"
+ #define FUNC "[SimMfgSync::sendMboxMsg]"
PRDF_ENTER( FUNC );
errlHndl_t l_errl = NULL;
@@ -96,6 +123,15 @@ errlHndl_t SimMfgThresholdSync::sendMboxMsg( msg_t * i_msg )
#undef FUNC
}
+void SimMfgSync::setMailBoxStatus(bool i_status)
+{
+ iv_mailBoxStatus = i_status;
+}
+
+bool SimMfgSync::isMailboxEnabled()
+{
+ return iv_mailBoxStatus;
+}
} // end namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimMfgThresholdSync.H b/src/usr/diag/prdf/test/prdfsimMfgSync.H
index e5f9f9e70..c4c40040d 100755
--- a/src/usr/diag/prdf/test/prdfsimMfgThresholdSync.H
+++ b/src/usr/diag/prdf/test/prdfsimMfgSync.H
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/diag/prdf/test/prdfsimMfgThresholdSync.H $ */
+/* $Source: src/usr/diag/prdf/test/prdfsimMfgSync.H $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -21,10 +21,10 @@
/* */
/* IBM_PROLOG_END_TAG */
-#ifndef __PRDF_SimMfgThresholdSync_H
-#define __PRDF_SimMfgThresholdSync_H
+#ifndef __PRDF_SimMfgSync_H
+#define __PRDF_SimMfgSync_H
-#include <prdfMfgThresholdSync.H>
+#include <prdfMfgSync.H>
#include <mbox/mbox_queues.H>
#include <mbox/mboxif.H>
@@ -34,19 +34,32 @@
namespace PRDF
{
-class SimMfgThresholdSync : public MfgThresholdSync
+/**
+ * @brief Singleton to access the SimMfgSync
+ */
+class SimMfgSync;
+PRDF_DECLARE_SINGLETON(SimMfgSync, theSimMfgSync);
+
+/**
+ * @brief Returns a reference to the SimMfgSync singleton
+ *
+ * @return Reference to the SimMfgSync
+ */
+SimMfgSync& getSimMfgSync();
+
+class SimMfgSync : public MfgSync
{
public:
/**
* @brief ctor
*/
- SimMfgThresholdSync();
+ SimMfgSync();
/**
* @brief dtor
*/
- virtual ~SimMfgThresholdSync();
+ virtual ~SimMfgSync();
/**
* @brief sync from FSP mfg thresholds
@@ -55,6 +68,28 @@ class SimMfgThresholdSync : public MfgThresholdSync
*/
virtual errlHndl_t syncMfgThresholdFromFsp();
+ /**
+ * @brief sync to FSP mfg trace data
+ *
+ * @param Error Signature
+ * @param The PFA data struct
+ *
+ * @return errlHndl_t
+ */
+ virtual errlHndl_t syncMfgTraceToFsp(ErrorSignature *i_esig,
+ const PfaData &i_pfaData);
+ /**
+ * @brief getter for mailbox status
+ * @return TRUE if mailbox is enabled. FALSE, otherwise.
+ */
+ virtual bool isMailboxEnabled();
+
+ /**
+ * @brief setter for mailbox status
+ * @return None
+ */
+ void setMailBoxStatus (bool i_status);
+
private:
/**
@@ -69,11 +104,21 @@ class SimMfgThresholdSync : public MfgThresholdSync
* If the message is asynchronus the object
* pointed to by this parameter will be sent
* to the fsp.
+ * @param[in] i_expectResponse
+ * This is a default parameter.
+ * If true, this function sends a synchronous message
+ * If false, this function sends an asynchronous message
*
* @return errlHndl_t
*/
- virtual errlHndl_t sendMboxMsg( msg_t * i_msg );
+ virtual errlHndl_t sendMboxMsg( msg_t * i_msg,
+ bool i_expectResponse = true );
+
+ // Disabled copy constructor and assignment operator
+ SimMfgSync(const SimMfgSync & right);
+ SimMfgSync & operator=(const SimMfgSync & right);
+ bool iv_mailBoxStatus;
};
OpenPOWER on IntegriCloud