diff options
author | Bilicon Patil <bilpatil@in.ibm.com> | 2014-01-30 02:57:38 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-03-13 13:52:20 -0500 |
commit | 782b43d6d12ee4d16a3c371b5cb166752b303d41 (patch) | |
tree | 9dc86745c3a6d59fb046d486fcc98f879a56c4c0 /src/usr/diag/prdf/mnfgtools | |
parent | 00b7e8892bf19919373fc1322c5b598761dc1218 (diff) | |
download | talos-hostboot-782b43d6d12ee4d16a3c371b5cb166752b303d41.tar.gz talos-hostboot-782b43d6d12ee4d16a3c371b5cb166752b303d41.zip |
PRD: Enable MnfgTrace functionality in Hostboot
Change-Id: Ibfe0124a926aa4486d327cf38cbeb8c3b30f8b9d
RTC: 79440
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/8454
Tested-by: Jenkins Server
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Christopher T. Phan <cphan@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Squashed: I9b01fff6efaca96549506ce316407403cea89970
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/9442
Diffstat (limited to 'src/usr/diag/prdf/mnfgtools')
-rwxr-xr-x | src/usr/diag/prdf/mnfgtools/prdfMfgSync.C (renamed from src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.C) | 106 | ||||
-rwxr-xr-x | src/usr/diag/prdf/mnfgtools/prdfMfgSync.H (renamed from src/usr/diag/prdf/mnfgtools/prdfMfgThresholdSync.H) | 83 | ||||
-rwxr-xr-x | src/usr/diag/prdf/mnfgtools/prdfMfgThresholdFile.C | 8 |
3 files changed, 140 insertions, 57 deletions
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"); |