diff options
author | prem <premjha2@in.ibm.com> | 2013-01-24 12:21:51 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-03-15 14:23:14 -0500 |
commit | 8ce226221c3f8218bf1e9dadfaa7db8e4a7f529d (patch) | |
tree | 6798d9e5992dc336ff4a2d97fd5184fdf2f4f21f /src/usr/diag/prdf | |
parent | be0ef872bbab435acb9206ea8408da948b7f7d9a (diff) | |
download | talos-hostboot-8ce226221c3f8218bf1e9dadfaa7db8e4a7f529d.tar.gz talos-hostboot-8ce226221c3f8218bf1e9dadfaa7db8e4a7f529d.zip |
Design Change for RuleChip
Change-Id: Ib2da58e060f9c7055445582d01c7ce2370746138
RTC: 47516
Squashed: If130e6b2dc6c3545033069dc98e8ee98d35f3c97
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3019
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3571
Diffstat (limited to 'src/usr/diag/prdf')
19 files changed, 1967 insertions, 1163 deletions
diff --git a/src/usr/diag/prdf/common/framework/config/iipConfigurator.h b/src/usr/diag/prdf/common/framework/config/iipConfigurator.h index 368fe74d3..ce3dc4717 100755 --- a/src/usr/diag/prdf/common/framework/config/iipConfigurator.h +++ b/src/usr/diag/prdf/common/framework/config/iipConfigurator.h @@ -68,11 +68,6 @@ // defintions in another translation unit. //---------------------------------------------------------------------- -// Includes -#if (!defined(_CPU_H) && !defined(CPU_H)) -//#include <cpu.h> -#endif - #include <prdfMain.H> #include <vector> @@ -85,7 +80,6 @@ namespace PRDF /*--------------------------------------------------------------------*/ class CHIP_CLASS; class Domain; -class System; class Configurator { @@ -109,7 +103,12 @@ public: //## Destructor (generated) virtual ~Configurator(); - virtual System * build()=0; + /** + * @brief Creates the PRD system object, all chip instances, and all domain + * instances. + * @return error log handle + */ + virtual errlHndl_t build() = 0; // Function Specification ******************************************** // // Purpose: Builds chipList and domainList and system diff --git a/src/usr/diag/prdf/common/framework/config/iipSystem.C b/src/usr/diag/prdf/common/framework/config/iipSystem.C index 52b3e46bc..558096612 100755 --- a/src/usr/diag/prdf/common/framework/config/iipSystem.C +++ b/src/usr/diag/prdf/common/framework/config/iipSystem.C @@ -49,6 +49,7 @@ #include <iipResolutionFactory.h> #include <prdfPlatServices.H> #include <prdfGlobal.H> +#include <prdfRuleMetaData.H> #ifndef __HOSTBOOT_MODULE #include <prdfMfgThresholdMgr.H> @@ -112,6 +113,14 @@ System::~System(void) // clear the threshold policies ThresholdResolution::reset(); + //clears list of all the RuleMetaData instances + for( RuleMetaDataList::iterator l_itMetaData = iv_listRuleData.begin(); + l_itMetaData != iv_listRuleData.end(); l_itMetaData++ ) + { + delete( l_itMetaData->second ); + } + iv_listRuleData.clear(); + } CHIP_CLASS * System::GetChip(TARGETING::TargetHandle_t i_pchipHandle ) @@ -336,5 +345,21 @@ int System::Analyze(STEP_CODE_DATA_STRUCT & serviceData, return(rc); } +RuleMetaData* System::getChipMetaData( TARGETING::TYPE i_type, + const char *i_fileName, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + errlHndl_t & o_errl ) +{ + if( NULL == iv_listRuleData[i_type] ) + { + iv_listRuleData[i_type] = new RuleMetaData( i_fileName,i_scanFactory, + i_reslFactory,i_type, + o_errl ); + } + return iv_listRuleData[i_type]; + +} + } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/config/iipSystem.h b/src/usr/diag/prdf/common/framework/config/iipSystem.h index d6d3d60c9..728f0a8c6 100755 --- a/src/usr/diag/prdf/common/framework/config/iipSystem.h +++ b/src/usr/diag/prdf/common/framework/config/iipSystem.h @@ -83,6 +83,7 @@ // End Class Specification ********************************************* #include <vector> +#include <map> #ifndef IIPCONST_H #include <iipconst.h> //TARGETING::TargetHandle_t, DOMAIN_ID_TYPE @@ -97,7 +98,12 @@ namespace PRDF class CHIP_CLASS; class Domain; class Resolution; +class RuleMetaData ; +class ScanFacility; +class ResolutionFactory; + struct STEP_CODE_DATA_STRUCT; +typedef std::map< TARGETING::TYPE ,RuleMetaData *> RuleMetaDataList ; class System { @@ -296,6 +302,25 @@ class System // Domains at attention, then the error code // NO_DOMAINS_AT_ATTENTION(0xDD21) is returned. // + + /** + * @brief Get instance of RuleMetaData associated with given target + * type. + * @param[in] i_type target type associated with RuleMetaData. + * @param[in] i_fileName name of RuleFile associated + * @param[in] i_scanFactory reference to factory class which + * creates register instance. + * @param[in] i_reslFactory reference to factory which creates + * resolution instance. + * @param[o] o_errl error log handle + */ + + RuleMetaData* getChipMetaData( TARGETING::TYPE i_type, + const char *i_fileName, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + errlHndl_t & o_errl ); + // End Function Specification **************************************** private: @@ -309,6 +334,7 @@ class System DomainContainerType prioritizedDomains; Resolution & noAttnResolution; + RuleMetaDataList iv_listRuleData ; }; } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H b/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H index 545ebe85a..e42fc2461 100755 --- a/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H +++ b/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H @@ -40,7 +40,6 @@ class ExtensibleChip : public CHIP_CLASS ExtensibleChip( TARGETING::TargetHandle_t i_target ) : CHIP_CLASS(i_target) {} - virtual ExtensibleChipFunction * getExtensibleFunction( const char * i_func, bool i_expectNull = false ) = 0; @@ -50,15 +49,15 @@ class ExtensibleChip : public CHIP_CLASS bool i_expectNull = false ) = 0; virtual DataBundle *& getDataBundle() = 0; - /** - * Add Capture data to the Capture Data object - * @param Capture data object (I/O) - * @param Capture group + * @brief Add Capture data to the Capture Data object + * @param[in] i_cap Capture data object (I/O) + * @param[in] i_group Capture group + * @return SUCCESS|FAIL */ - virtual int32_t CaptureErrorData( CaptureData &, int i_group = 1 ) = 0; + virtual int32_t CaptureErrorData( CaptureData & i_cap, + int i_group = 1 ) = 0; - virtual uint32_t getSignatureOffset() const = 0; }; class DataBundle diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.h b/src/usr/diag/prdf/common/framework/register/iipscr.h index b7be72ab3..d92ca6134 100755 --- a/src/usr/diag/prdf/common/framework/register/iipscr.h +++ b/src/usr/diag/prdf/common/framework/register/iipscr.h @@ -362,7 +362,7 @@ public: bool BitStringIsZero() { return GetBitString()->IsZero(); } /** - *@brief Returns TYPE_NA as type of Target associated with register.Acutal + *@brief Returns TYPE_NA as type of Target associated with register.Actual * implementation is expected in derived class *@return TYPE_NA */ diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C index f1a3e26b7..74046483b 100755 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C @@ -31,302 +31,58 @@ #include <prdfErrlUtil.H> #include <prdfRuleChip.H> -#include <prdrLoadChip.H> -#include <prdrLoadChipCache.H> -#include <prdfOperatorRegister.H> -#include <prdfGroup.H> #include <prdfPluginMap.H> #include <prdrCommon.H> // for enums. - #include <prdfScanFacility.H> // for ScanFacility #include <iipResolutionFactory.h> // for ResolutionFactory #include <iipCaptureData.h> // for CaptureData #include <iipServiceDataCollector.h> // for ServiceDataCollector #include <prdfErrorSignature.H> // for ErrorSignature -#include <iipResolution.h> // for Resolutions -#include <iipEregResolution.h> // for EregResolution -#include <xspprdDumpResolution.h> // for DumpResolution -#include <xspprdTryResolution.h> // for TryResolution -#include <prdfPluginCallResolution.H> // for PluginCallResolution -#include <prdfAnalyzeConnected.H> // for prdfAnalyzeConnected -#include <iipSystem.h> // for System -#include <xspprdFlagResolution.h> #include <prdfPfa5Data.h> // for errl user data flags. - -#include <prdfPlatServices.H> // for getConnected - -#include <errlentry.H> // for errl. -#include <utilfile.H> // for UtilFile -#include <UtilHash.H> // for Util::hashString - -#include <prdfResetOperators.H> -#include <algorithm> +#include <iipSystem.h> // for System #include <prdf_ras_services.H> namespace PRDF { -template <bool Type> -struct ResetAndMaskTransformer - : public std::unary_function<Prdr::Register::ResetOrMaskStruct, - ResetAndMaskErrorRegister::ResetRegisterStruct> -{ - ResetAndMaskTransformer( ScanFacility & i_scanFactory, - size_t i_scomlen , - TARGETING::TYPE i_type ): - cv_scanFactory( i_scanFactory ), - cv_scomlen( i_scomlen ), - iv_chipType( i_type ) - {}; - - virtual ~ResetAndMaskTransformer() {}; // zs01 - - virtual ResetAndMaskErrorRegister::ResetRegisterStruct - operator()(const Prdr::Register::ResetOrMaskStruct & i) - { - ResetAndMaskErrorRegister::ResetRegisterStruct o; - o.read = & cv_scanFactory.GetScanCommRegister( i.addr_r , - cv_scomlen,iv_chipType ); - o.write = & cv_scanFactory.GetScanCommRegister( i.addr_w , - cv_scomlen ,iv_chipType ); - - - switch (i.op) - { - case Prdr::OR: - o.op = getStaticResetOperator<OrOperator<Type> >(); - break; - case Prdr::AND: - o.op = getStaticResetOperator<AndOperator<Type> >(); - break; - - case Prdr::XOR: - o.op = getStaticResetOperator<XorOperator<Type> >(); - break; - - case Prdr::NOT: - o.op = getStaticResetOperator<NotOperator<Type> >(); - break; - - default: - o.op = NULL; // TODO: ERROR! Assert... - break; - } - - return o; - }; - - private: - ScanFacility & cv_scanFactory; - size_t cv_scomlen; - TARGETING::TYPE iv_chipType; -}; - - -void RuleChip::loadRuleFile(ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory) +RuleChip::RuleChip( const char * i_fileName , + TARGETING::TargetHandle_t i_pTargetHandle, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + errlHndl_t & o_errl ) + : ExtensibleChip( i_pTargetHandle ),cv_dataBundle( NULL ) { - RegMap_t l_regMap; - Reset_t l_resetMap; - ResetAndMaskPair l_currentResets; - uint32_t l_regMax = 0; - uint32_t l_vregMax = 0; - GroupMap_t l_groupMap; - uint32_t l_groupMax = 0; - ActionMap_t l_actionMap; - uint32_t l_actionMax = 0; - uint32_t l_id = 1; - - SharedThreshold_t l_sharedThresholds; - - Prdr::Chip * l_chip; - - /* Initialize local data struct to pass to sub-functions */ - RuleFileData l_localData = { l_regMap, l_groupMap, l_actionMap, - i_scanFactory, i_reslFactory, - this->GetChipHandle(), l_chip, - l_resetMap, l_currentResets, - l_sharedThresholds - }; - - // Parse chip file. - cv_errl = Prdr::LoadChipCache::loadChip(cv_fileName, &l_chip); - if (NULL == l_chip) + iv_pRuleData = NULL; + if( NULL != systemPtr ) { - // TODO: Do we need to percAbend? We were unable to succesfully - // load our chip objects. - return; - } - - // Get default dump type. - cv_dumpType = l_chip->cv_dumpType; - - //getting target type before creating hardware register - TARGETING::TYPE l_type = PlatServices::getTargetType( GetChipHandle() ) ; - // Set signature offset for capture data output. - iv_sigOff = l_chip->cv_signatureOffset; - - // create hardware regs. - for (int i = 0; i < l_chip->cv_regCount; i++) - { - uint16_t hashId = l_chip->cv_registers[i].cv_name; - - l_regMap[l_id] = cv_hwRegs[hashId] - = &i_scanFactory.GetScanCommRegister( - l_chip->cv_registers[i].cv_scomAddr, - l_chip->cv_registers[i].cv_scomLen, - l_type ); - l_regMap[l_id]->SetId(hashId); - - // Copy reset registers. - std::transform - (l_chip->cv_registers[i].cv_resets.begin(), - l_chip->cv_registers[i].cv_resets.end(), - std::back_inserter(l_resetMap[l_id].first), - ResetAndMaskTransformer<RESETOPERATOR_RESET>( - i_scanFactory, - l_chip->cv_registers[i].cv_scomLen, - l_type ) - ); - - // Copy mask registers. - std::transform - (l_chip->cv_registers[i].cv_masks.begin(), - l_chip->cv_registers[i].cv_masks.end(), - std::back_inserter(l_resetMap[l_id].second), - ResetAndMaskTransformer<RESETOPERATOR_MASK>( - i_scanFactory, - l_chip->cv_registers[i].cv_scomLen, - l_type ) - ); - - //This flag signifies that a mapping IS or ISN'T created between a - //uint32_t mapping and a vector of SCAN_COMM_REGISTER_CLASS pointers. - //If there is no mapping outside of the for loop then it is because - //there is a capture type or requirement without a group statement in - //the rule file. - bool l_group_is_created = false; - // Copy into capture groups. - std::vector<Prdr::Register::CaptureInfoStruct>::const_iterator - l_capturesEnd = l_chip->cv_registers[i].cv_captures.end(); - //For each capture in this register save a Group Type or Requirement. - for(std::vector<Prdr::Register::CaptureInfoStruct>::const_iterator - j = l_chip->cv_registers[i].cv_captures.begin(); - j != l_capturesEnd; - ++j) - { - if ('G' == (*j).op) - { - cv_hwCaptureGroups[(*j).data[0]].push_back(l_regMap[l_id]); - l_group_is_created = true; //@jl06 Added this to indicate group was created. - } - // @jl04 a Start. - // This else if was added for a new capture "type" for registers - // primary/secondary. - // Cannot put the "type" in with the G group otherwise it will show - // up as a i_group of 2 which is not called. - else if('T' == (*j).op) - { - //@jl06. d Deleted temporary declaration of CaptureType in - // favor of an anonymous declaration. Calls ctor twice. - cv_hwCaptureType[l_regMap[l_id]] = - CaptureType((RegType)(*j).data[0]); //@jl06 c. - } - // @jl04 a Stop. - else if ('f' == (*j).op) - { - CaptureRequirement req; - req.cv_func = this->getExtensibleFunction(j->func); - - cv_hwCaptureReq[l_regMap[l_id]] = req; - } - else // 'C' - { - CaptureRequirement req; - req.cv_TargetType = (*j).data[0]; - req.cv_TargetIndex = (*j).data[1]; - req.cv_func = NULL; - - cv_hwCaptureReq[l_regMap[l_id]] = req; - } - } - if (!l_group_is_created) // @jl06 c Add to default group if none there. - { - // Add to default if no group specified. - cv_hwCaptureGroups[1].push_back(l_regMap[l_id]); - } - - l_regMax = l_id++; + TARGETING::TYPE l_type = + PlatServices::getTargetType( i_pTargetHandle ); + iv_pRuleData = systemPtr->getChipMetaData( l_type,i_fileName, + i_scanFactory,i_reslFactory,o_errl ); } - for (int i = 0; i < l_chip->cv_ruleCount; i++) - { - if (l_regMap[l_id]) // check if it already exists. - { - l_vregMax = l_id++; - continue; - } - - l_currentResets = ResetAndMaskPair(); - - SCAN_COMM_REGISTER_CLASS * l_tmp = - this->createVirtualRegister(&l_chip->cv_rules[i], l_localData); - - l_regMap[l_id] = l_tmp; - l_resetMap[l_id] = l_currentResets; - l_vregMax = l_id++; - }; - - // initialize all the pointers for the groups, but don't construct their - // data yet. - Resolution & l_defaultResolution = - i_reslFactory.GetCalloutResolution( this->GetChipHandle(), - MRU_MED ); - for (int i = 0; i < l_chip->cv_groupCount; i++) - { - Group * l_tmp = new Group(l_defaultResolution); - l_groupMap[l_id] = l_tmp; - l_groupMax = l_id++; - }; + init(); - for (int i = 0; i < l_chip->cv_actionCount; i++) - { - if (l_actionMap[i]) - { - l_actionMax = l_id++; - continue; - } +} - // createActionClass will add to the actionMap. - this->createActionClass(i, l_localData); - //l_actionMap[l_id] = l_tmp; - l_actionMax = l_id++; - } - - for (int i = 0; i < l_chip->cv_groupCount; i++) - { - this->createGroup((Group *) l_groupMap[i+l_vregMax+1], - i, - l_localData); - } - for (int i = 0; i < Prdr::NUM_GROUP_ATTN; i++) - cv_groupAttn[i] = l_groupMap[l_chip->cv_groupAttn[i]]; +//------------------------------------------------------------------------------ +void RuleChip::init( ) +{ + PRDF_DEFINE_CHIP_SCOPE( this ); // Call initialize plugin. ExtensibleChipFunction * l_init = getExtensibleFunction("Initialize", true); if (NULL != l_init) { - (*l_init) - (this, - PluginDef::bindParm<void*>(NULL) - ); + (*l_init)( this,PluginDef::bindParm<void*>(NULL) ); } - return; }; +//------------------------------------------------------------------------------ + RuleChip::~RuleChip() { if (NULL != cv_dataBundle) @@ -335,707 +91,60 @@ RuleChip::~RuleChip() } }; +//------------------------------------------------------------------------------ -int32_t RuleChip::Analyze(STEP_CODE_DATA_STRUCT & i_serviceData, - ATTENTION_TYPE i_attnType) +int32_t RuleChip::Analyze( STEP_CODE_DATA_STRUCT & i_serviceData, + ATTENTION_TYPE i_attnType ) { //this pointer is retained in stack just for the scope of this function PRDF_DEFINE_CHIP_SCOPE( this ); - + int32_t l_rc = SUCCESS; ServiceDataCollector & i_sdc = *(i_serviceData.service_data); ErrorSignature & l_errSig = *(i_sdc.GetErrorSignature()); - CaptureData & capture = i_serviceData.service_data->GetCaptureData(); // @jl04 a Add this for Drop call. // Set current ATTN type to input value. // If we don't do this, then the AttnRegisters don't work. - i_sdc.SetCauseAttentionType(i_attnType); // @pw02 @pw04 - - int32_t l_rc = SUCCESS; - + i_sdc.SetCauseAttentionType(i_attnType); // Set Signature Chip Id. l_errSig.setChipId( GetId() ); - - // Set default dump flags. //@ecdf - //FIXME: take out hwTableContent for now for Hostboot - #ifdef __HOSTBOOT_MODULE - i_sdc.SetDump(/*(hwTableContent)cv_dumpType,*/ GetChipHandle()); - #else - i_sdc.SetDump((hwTableContent)cv_dumpType, GetChipHandle()); - #endif - - // Get capture data for this chip. Allow override. - ExtensibleChipFunction * l_ignoreCapture = - getExtensibleFunction("PreventDefaultCapture", true); - bool l_shouldPreventDefaultCapture = false; - - (*l_ignoreCapture) - (this, PluginDef::bindParm<STEP_CODE_DATA_STRUCT&, bool&> - (i_serviceData, l_shouldPreventDefaultCapture)); - - if (!l_shouldPreventDefaultCapture) - { - // Drop secondary capture from earlier chips. - capture.Drop(SECONDARY); - - // Read capture data. - this->CaptureErrorData(i_sdc.GetCaptureData()); - } - - // Analyze group. - ErrorRegisterType * l_errReg = NULL; - switch (i_attnType) - { - case CHECK_STOP: - l_errReg = cv_groupAttn[0]; - break; - - case RECOVERABLE: - l_errReg = cv_groupAttn[1]; - break; - - case SPECIAL: - l_errReg = cv_groupAttn[2]; - break; - - case UNIT_CS: // @jl02 JL Added this code to support the new Unit Check Stop. - l_errReg = cv_groupAttn[3]; // @jl02 JL I don't know if this is the correct cv_groupAttn to add here or if it's needed. - break; - - } - if (NULL != l_errReg) - { //mp02 a Start - //Call any pre analysis functions - ExtensibleChipFunction * l_preAnalysis = - getExtensibleFunction("PreAnalysis", true); - bool analyzed = false; - (*l_preAnalysis)(this, - PluginDef::bindParm<STEP_CODE_DATA_STRUCT&,bool&> - (i_serviceData,analyzed)); - if ( !analyzed) - l_rc = l_errReg->Analyze(i_serviceData); - } //mp02 a Stop - // mp02d l_rc = l_errReg->Analyze(i_serviceData); - else //@jl07 - l_rc = PRD_SCAN_COMM_REGISTER_ZERO; //@jl07 - - // Don't do reset or mask on CS. @pw03 - if (CHECK_STOP != i_serviceData.service_data->GetAttentionType()) //@pw04 - { - #ifndef __HOSTBOOT_MODULE - SyncAnalysis (i_sdc); //mp01 Add call to Sync SDC - #endif - // Call mask plugin. - if (i_serviceData.service_data->IsAtThreshold()) - { - ExtensibleChipFunction * l_mask = - getExtensibleFunction("MaskError", true); - (*l_mask)(this, - PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) - ); //@pw01 - } - - // Call reset plugin. - ExtensibleChipFunction * l_reset = - getExtensibleFunction("ResetError", true); - (*l_reset)(this, - PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) - ); //@pw01 - } - - // Call postanalysis plugin. - // @jl02 JL Adding PostAnalysis plugin call. - ExtensibleChipFunction * l_postanalysis = - getExtensibleFunction("PostAnalysis", true); - // @jl02 the true above means that a plugin may not exist for this call. - // @jl02 JL Adding call for post analysis. - (*l_postanalysis)(this, - PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData)); - - return l_rc; -}; - -int32_t RuleChip::CaptureErrorData(CaptureData & i_cap, int i_group) -{ - using namespace TARGETING; - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - - std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator l_hwCaptureEnd = - cv_hwCaptureGroups[i_group].end(); - for (std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator i = - cv_hwCaptureGroups[i_group].begin(); - i != l_hwCaptureEnd; - ++i) - { - // Check that requirements are satisfied. - if (CaptureRequirement() != cv_hwCaptureReq[*i]) - { - CaptureRequirement req = cv_hwCaptureReq[*i]; - if (NULL != req.cv_func) - { - bool l_cap = true; - (*req.cv_func)(this, PluginDef::bindParm<bool &>(l_cap)); - if (!l_cap) - continue; - } - else - { - bool l_indexValid =false; - TargetHandleList l_ptargetHandleList = - PlatServices::getConnected(this->GetChipHandle(), - (TARGETING::TYPE) req.cv_TargetType); - TargetHandleList ::iterator itrTarget =l_ptargetHandleList.begin(); - for( ; itrTarget != l_ptargetHandleList.end();itrTarget++ ) - { - if (req.cv_TargetIndex == PlatServices::getTargetPosition(*itrTarget)) - { - l_indexValid = true; - break; - } - } - if(false == l_indexValid) - { - continue; - } - } - } - - i_cap.Add(this->GetChipHandle(), - (*i)->GetId() ^ this->getSignatureOffset(), - *(*i), - CaptureData::BACK, //@jl04 c change this because of proto. - cv_hwCaptureType[*i].cv_regType); //@jl04 c Changed this function call to add a param. - } - - // Call "PostCapture" plugin - ExtensibleChipFunction * l_postCapture = - getExtensibleFunction("PostCapture", true); - - (*l_postCapture) - (this, - PluginDef::bindParm<CaptureData &, int>(i_cap, i_group) - ); - - return SUCCESS; -} - -SCAN_COMM_REGISTER_CLASS * -RuleChip::createVirtualRegister( - Prdr::Expr * i_vReg, - RuleFileData & i_data - ) -{ - SCAN_COMM_REGISTER_CLASS * l_arg[4] = { NULL }; - uint32_t l_tmp32 = 0; - SCAN_COMM_REGISTER_CLASS * l_rc = NULL; - - switch(i_vReg->cv_op) - { - case Prdr::NOT: - l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); - l_rc = &i_data.cv_scanFactory.GetNotRegister(*l_arg[0]); - break; - - case Prdr::LSHIFT: - case Prdr::RSHIFT: - l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); - l_tmp32 = i_vReg->cv_value[1].p->cv_value[0].i; - l_rc = (Prdr::LSHIFT == i_vReg->cv_op - ? - &i_data.cv_scanFactory.GetLeftShiftRegister(*l_arg[0], - l_tmp32) - : - &i_data.cv_scanFactory.GetRightShiftRegister(*l_arg[0], - l_tmp32) - ); - break; - - case Prdr::OR: - case Prdr::AND: - l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); - l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); - l_rc = (Prdr::OR == i_vReg->cv_op - ? - &i_data.cv_scanFactory.GetOrRegister(*l_arg[0], - *l_arg[1]) - : - &i_data.cv_scanFactory.GetAndRegister(*l_arg[0], - *l_arg[1]) - ); - break; - - - case Prdr::REF_REG: - std::copy(i_data.cv_resets[i_vReg->cv_value[0].i].first.begin(), - i_data.cv_resets[i_vReg->cv_value[0].i].first.end(), - std::back_inserter(i_data.cv_currentResets.first)); - std::copy(i_data.cv_resets[i_vReg->cv_value[0].i].second.begin(), - i_data.cv_resets[i_vReg->cv_value[0].i].second.end(), - std::back_inserter(i_data.cv_currentResets.second)); - l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; - break; - - case Prdr::REF_RULE: - if (NULL == i_data.cv_regMap[i_vReg->cv_value[0].i]) - i_data.cv_regMap[i_vReg->cv_value[0].i] = - createVirtualRegister( - &i_data.cv_loadChip-> - cv_rules[i_vReg->cv_value[0].i], - i_data); - l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; - break; - - case Prdr::ATTNLINK: - if (NULL != i_vReg->cv_value[0].p) - l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); - - if (NULL != i_vReg->cv_value[1].p) - l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); - - if (NULL != i_vReg->cv_value[2].p) - l_arg[2] = createVirtualRegister(i_vReg->cv_value[2].p, i_data); - - if (NULL != i_vReg->cv_value[3].p) - l_arg[3] = createVirtualRegister(i_vReg->cv_value[3].p, i_data); - - l_rc = &i_data.cv_scanFactory.GetAttnTypeRegister(*l_arg[0], /*passing null object*/ - *l_arg[1], /*passing null object*/ - *l_arg[2], /*passing null object*/ - *l_arg[3]); /*passing null object*/ - break; - - case Prdr::BIT_STR: - { - uint32_t l_size = i_vReg->cv_bitStrVect.size(); - BIT_STRING_BUFFER_CLASS l_bs(l_size * 64); - - for (uint32_t i = 0; i < l_size; i++) - { - l_bs.SetFieldJustify(32*(2*i) , 32, - (i_vReg->cv_bitStrVect[i] >> 32) & 0xFFFFFFFF); - l_bs.SetFieldJustify(32*((2*i)+1), 32, - (i_vReg->cv_bitStrVect[i] & 0xFFFFFFFF)); - } - - l_rc = &i_data.cv_scanFactory.GetConstantRegister(l_bs); - } - break; - - } + l_rc = iv_pRuleData->Analyze( i_serviceData, i_attnType ); return l_rc; }; -Resolution * RuleChip::createActionClass( uint32_t i_action, - RuleChip::RuleFileData & i_data ) -{ - if (NULL != i_data.cv_actionMap[i_action]) - return i_data.cv_actionMap[i_action]; - - Resolution * l_tmpRes = NULL, * l_retRes = NULL; - for (int i = 0; i < i_data.cv_loadChip->cv_actionSize[i_action]; i++) - { - l_tmpRes = this->createResolution( - &(i_data.cv_loadChip->cv_actions[i_action][i]), - i_data); - if (0 == i) - { - l_retRes = l_tmpRes; - } - else - { - l_retRes = &i_data.cv_reslFactory. - LinkResolutions(*l_retRes, *l_tmpRes); - } - } - - if (NULL == l_retRes) // @pw05 - { - class NullResolution : public Resolution - { - public: - int32_t Resolve(STEP_CODE_DATA_STRUCT & data) - { return SUCCESS; }; - }; - - static NullResolution l_nullRes; - l_retRes = &l_nullRes; - } - - i_data.cv_actionMap[i_action] = l_retRes; - return l_retRes; -}; - -Resolution * RuleChip::createResolution( Prdr::Expr * i_action, - RuleChip::RuleFileData & i_data ) -{ - Resolution * l_rc = NULL; - - switch (i_action->cv_op) - { - case Prdr::REF_ACT: - l_rc = this->createActionClass(i_action->cv_value[0].i - - (i_data.cv_loadChip->cv_regCount + - i_data.cv_loadChip->cv_ruleCount + - i_data.cv_loadChip->cv_groupCount + - 1), - i_data); - break; - - case Prdr::REF_GRP: - l_rc = &i_data.cv_reslFactory.GetEregResolution( - *i_data.cv_groupMap[i_action->cv_value[0].i]); - break; - - case Prdr::ACT_TRY: // TRY - l_rc = &i_data.cv_reslFactory.GetTryResolution( - *(this->createResolution(i_action->cv_value[0].p, - i_data)), - *(this->createResolution(i_action->cv_value[1].p, - i_data)) - ); - break; - - case Prdr::ACT_FUNC: // FUNCCALL - l_rc = &i_data.cv_reslFactory.GetPluginCallResolution( - this->getExtensibleFunction(i_action->cv_actFunc) - ); - break; - - case Prdr::ACT_FLAG: // FLAG - l_rc = &i_data.cv_reslFactory.GetFlagResolution( - (ServiceDataCollector::Flag) i_action->cv_value[0].i); - break; - - case Prdr::ACT_THRES: // Threshold - // The values which different parameter will have - // cv_value[0,1] error frequency and time in sec for field threshold - //cv_value[4] true if mnfg threshols needs to be picked up from mnfg file, false otherwise - // cv_value [2,3]: error frequency and time in sec for mnfg threshold if cv_value[4] is false - // otheiwse cv_value[3] tells which threshold needs to pick up from mnfg file - // cv_value[5] maski id if shared threshold - if (0 == i_action->cv_value[5].i) - { - if ( !PlatServices::mfgMode() ) - { - l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( - ThresholdResolution::ThresholdPolicy( - (uint16_t)i_action->cv_value[0].i, i_action->cv_value[1].i)); - } - else if(i_action->cv_value[4].i) - { - // FIXME : need to uncomment MfgThresholdMgr after we figure it out - #ifndef __HOSTBOOT_MODULE - l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( - *(MfgThresholdMgr::getInstance()-> - getThresholdP(i_action->cv_value[3].i))); - #endif - } - else - { - l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( - ThresholdResolution::ThresholdPolicy( - (uint16_t)i_action->cv_value[2].i, i_action->cv_value[3].i)); - } - } - else - if (NULL == i_data.cv_sharedThresholds[i_action->cv_value[5].i]) - { - if ( !PlatServices::mfgMode() ) - { - l_rc = &i_data.cv_reslFactory. - GetThresholdResolution(i_action->cv_value[5].i, - ThresholdResolution::ThresholdPolicy((uint16_t)i_action->cv_value[0].i, i_action->cv_value[1].i)); - } - else if(i_action->cv_value[4].i) - { - // FIXME : need to uncomment MfgThresholdMgr after we figure it out - #ifndef __HOSTBOOT_MODULE - l_rc = &i_data.cv_reslFactory. - GetThresholdResolution(i_action->cv_value[5].i, - *(MfgThresholdMgr::getInstance()-> - getThresholdP(i_action->cv_value[3].i))); - #endif - } - else - { - l_rc = &i_data.cv_reslFactory. - GetThresholdResolution(i_action->cv_value[5].i, - ThresholdResolution::ThresholdPolicy((uint16_t)i_action->cv_value[2].i, i_action->cv_value[3].i)); - } - i_data.cv_sharedThresholds[i_action->cv_value[5].i] = l_rc; - } - else - { - l_rc = i_data.cv_sharedThresholds[i_action->cv_value[5].i]; - } - break; - - - case Prdr::ACT_DUMP: // DUMP : TODO: Allow dump connected. - #ifdef __HOSTBOOT_MODULE - //FIXME: comment out hwtablecontent for hostboot - l_rc = &i_data.cv_reslFactory.GetDumpResolution( - /*(hwTableContent) i_action->cv_value[0].i,*/ - ); - #else - l_rc = &i_data.cv_reslFactory.GetDumpResolution( - (hwTableContent) i_action->cv_value[0].i ); - #endif - break; - - case Prdr::ACT_GARD: // GARD - l_rc = &i_data.cv_reslFactory.GetGardResolution( - (GardResolution::ErrorType) i_action->cv_value[0].i); - break; - - case Prdr::ACT_ANALY: // ANALYZE - l_rc = &i_data.cv_reslFactory.GetAnalyzeConnectedResolution( - (TARGETING::TYPE) i_action->cv_value[0].i, - i_action->cv_value[1].i ); - break; - - case Prdr::ACT_CALL: // CALLOUT - { - switch ((char)i_action->cv_value[0].i) - { - case 'c': // connected chip. - l_rc = &i_data.cv_reslFactory.GetConnectedCalloutResolution( - ( TARGETING::TYPE ) i_action->cv_value[2].i, - i_action->cv_value[3].i, - ( CalloutPriorityEnum ) i_action->cv_value[1].i, - ( NULL == i_action->cv_value[4].p ? NULL : - ( this->createResolution( - i_action->cv_value[4].p, i_data ) ) ) - - ); - break; - - case 'p': // Procedure. - l_rc = &i_data.cv_reslFactory.GetCalloutResolution( - (SymbolicFru) i_action->cv_value[2].i, - (CalloutPriorityEnum) i_action->cv_value[1].i); - break; - - case 's': // SELF - default: - /*Passing NULL as target in this function creates a dummy - * place holder object of PRDcallout for TARGET TYPE - * callout.Since resolution object is no longer tied to a - * specific target,any RulChip which needs target type - * callout with a given priority can use this resolution. - * .Since the same function shall be used for creating - * TYPE_MEMMRU and TYPE_SYMFRU callout ,it is not possible - * to remove this input parameter.So,by passing NULL as - * target other two callout remain unaffected and we are - * still able to create place holder resolution object for - * target type callout. - */ - l_rc = &i_data.cv_reslFactory.GetCalloutResolution( - NULL , - (CalloutPriorityEnum) i_action->cv_value[1].i ); - break; - - }; - } - break; - - case Prdr::ACT_CAPT: // Capture resolution. - l_rc = &i_data.cv_reslFactory.GetCaptureResolution( - i_action->cv_value[0].i); - break; - }; - - return l_rc; -}; - -void RuleChip::createGroup(Group * i_group, - uint32_t i_groupId, - RuleChip::RuleFileData & i_data) -{ - // Internal class to collapse the bit string. - class CreateBitString - { - public: - static void execute(std::vector<uint8_t> & i_bits, - Prdr::Expr * i_expr) - { - if (NULL == i_expr) - return; - if (i_expr->cv_op == Prdr::INT_SHORT) - { - i_bits.push_back(i_expr->cv_value[0].i); - } - else // must be an | or & operator. - { - // Expand bit string from left side. - CreateBitString::execute(i_bits, i_expr->cv_value[0].p); - // Expand bit string from right side. - CreateBitString::execute(i_bits, i_expr->cv_value[1].p); - } - }; - }; - - for (int i = 0; i < i_data.cv_loadChip->cv_groupSize[i_groupId]; i++) - { - std::vector<uint8_t> l_bits; // Vector to hold bit string. - - // TODO : handle & transformations. - - // Get expression for group's line. - Prdr::Expr * l_expr = &i_data.cv_loadChip->cv_groups[i_groupId][i]; - - // Execute internal (recursive) class to generate bit string. - CreateBitString::execute(l_bits, l_expr->cv_value[1].p); - - // Add expression to group. - i_group->Add(i_data.cv_regMap[l_expr->cv_value[0].i], - &(*l_bits.begin()), - l_bits.size(), - *(this->createResolution(l_expr->cv_value[2].p, i_data)), - i_data.cv_resets[l_expr->cv_value[0].i], - (i_data.cv_regMap[l_expr->cv_value[0].i]->GetId() - + i_data.cv_loadChip->cv_signatureOffset) & 0xffff, - Prdr::AND == l_expr->cv_value[1].p->cv_op - ); - - } // end for. - - // Do flags. --- - - // Do Priority filter flag. - if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & - Prdr::PRDR_GROUP_FILTER_PRIORITY) - { - std::vector<uint8_t> l_bits; - CreateBitString::execute(l_bits, - i_data.cv_loadChip->cv_groupPriorityBits[i_groupId]); - - FilterClass * l_filter = new PrioritySingleBitFilter(l_bits); - i_group->AddFilter(l_filter); - } - - // Do single bit filter flag. - if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & - Prdr::PRDR_GROUP_FILTER_SINGLE_BIT) - { - FilterClass * l_filter = new SingleBitFilter(); - i_group->AddFilter(l_filter); - } -} - +//------------------------------------------------------------------------------ ExtensibleChipFunction * - RuleChip::getExtensibleFunction(const char * i_func, bool i_expectNull) + RuleChip::getExtensibleFunction( const char * i_func, bool i_expectNull ) { //this pointer is retained in stack just for the scope of this function PRDF_DEFINE_CHIP_SCOPE( this ); - - ExtensibleFunctionType * plugin = - getPluginGlobalMap().getPlugins(cv_fileName)[i_func]; - if (NULL == plugin) - { - static Plugin<ExtensibleChip> l_nullPlugin(NULL); - plugin = &l_nullPlugin; - - if (!i_expectNull) - { - errlHndl_t l_errl = NULL; - - PRDF_CREATE_ERRL(l_errl, - ERRL_SEV_UNRECOVERABLE, - ERRL_ETYPE_NOT_APPLICABLE, - SRCI_ERR_INFO, - SRCI_NO_ATTR, - PRDF_RULECHIP, - LIC_REFCODE, - PRDF_CODE_FAIL, - __LINE__, - 0, 0, 0); - - PRDF_ADD_FFDC(l_errl, - cv_fileName, - strlen(cv_fileName), - ErrlVer1, - ErrlString); - - PRDF_ADD_FFDC(l_errl, - i_func, - strlen(i_func), - ErrlVer1, - ErrlString); - - PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); - } - - } - return (ExtensibleChipFunction *) plugin; - + ExtensibleChipFunction * l_ptr = NULL ; + l_ptr = iv_pRuleData->getExtensibleFunction( i_func , i_expectNull ); + return l_ptr ; } +//------------------------------------------------------------------------------ + SCAN_COMM_REGISTER_CLASS * RuleChip::getRegister(const char * i_reg, bool i_expectNull) { //this pointer is retained in stack just for the scope of this function PRDF_DEFINE_CHIP_SCOPE( this ); - uint16_t hashId = Util::hashString( i_reg ); - - SCAN_COMM_REGISTER_CLASS * l_register = cv_hwRegs[hashId]; - - if (NULL == l_register) - { - static NullRegister l_nullRegister(1024); - l_register = &l_nullRegister; - - if (!i_expectNull) - { - errlHndl_t l_errl = NULL; - PRDF_CREATE_ERRL(l_errl, - ERRL_SEV_UNRECOVERABLE, - ERRL_ETYPE_NOT_APPLICABLE, - SRCI_ERR_INFO, - SRCI_NO_ATTR, - PRDF_RULECHIP, - LIC_REFCODE, - PRDF_CODE_FAIL, - __LINE__, - 1, 0, 0); - - PRDF_ADD_FFDC(l_errl, - cv_fileName, - strlen(cv_fileName), - ErrlVer1, - ErrlString); - - - PRDF_ADD_FFDC(l_errl, - i_reg, - strlen(i_reg), - ErrlVer1, - ErrlString); + SCAN_COMM_REGISTER_CLASS * l_ptr = iv_pRuleData->getRegister( i_reg, + i_expectNull,this ); + return l_ptr ; +} - PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); - } - } - else - { /* l_register obtained from cv_hwRegs is a ScomRegister which does not - have rule chip info built in.Analyze leg of code uses this register. - Inorder to use this register for scom, target info is obtained from - service data collector.This register does not suit us for read and - write operation in plugin function.It is because in plugin function - register read should not be concerend with finding the associated - rule chip or target.Inorder to address this situation,we create a - wrapper register.This register has rule chip info in addition to all - the data of scomRegister.This object is created through factory and - and destroyed at the end of analysis. - */ - SCAN_COMM_REGISTER_CLASS * l_pReg = l_register; - ScanFacility & l_scanFac = ScanFacility::Access(); - l_register = & l_scanFac.GetPluginRegister(*l_pReg,*this); - - } - return l_register; +//------------------------------------------------------------------------------ +int32_t RuleChip::CaptureErrorData( CaptureData & io_cap,int i_group ) +{ + //this pointer is retained in stack just for the scope of this function + PRDF_DEFINE_CHIP_SCOPE( this ); + return iv_pRuleData->CaptureErrorData( io_cap ,i_group ); } +//------------------------------------------------------------------------------ + } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H index b7dd194f3..496199e1f 100755 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H @@ -21,112 +21,43 @@ /* */ /* IBM_PROLOG_END_TAG */ +/** + * @file prdfRuleChip.H + * @brief Models a physical target say a Proc or Ex + * + * Each instance of RuleChip is associated with a particular target.As + * an example, all the procs in the system are modeled by PRD with a + * unique instance of RuleChip object.Design of class is based on + * following two facts about all the RuleChips modelling target of same + * type + * - contain an identical set of registers and resolutions + * - share a common mechansim to analyze attention + * Based on above two facts, all RuleChips modelling target of same + * type, share a common instance of RuleMetaData. RuleMetaData models + * all the regisers and resolutions associated with a RuleChip of + * particular type. + * Sharing of RuleMetaData instance reduces the memory usage + * and is key to address the scaling issue. + */ #ifndef __PRDFRULECHIP_H #define __PRDFRULECHIP_H #include <iipchip.h> -#include <prdfErrlSmartPtr.H> - -#include <iipsdbug.h> // for ATTENTION_TYPE #include <prdfExtensibleChip.H> #include <prdfPluginDef.H> - #include <string.h> #include <vector> #include <map> #include <iipResetErrorRegister.h> -#include "prdrCommon.H" //@jl02 Added this to get the constant value from the enum. -#include <iipCaptureData.h> // @jl04 Added this for the RegType used for register = "PRIMARY" or "SECONDARY" -//--------------------------------------- -// Forward decls. - -namespace Prdr -{ - -class Chip; -class Expr; - -} // end namespace PRDR +#include "prdrCommon.H" +#include <iipCaptureData.h> +#include <prdfRuleMetaData.H> namespace PRDF { -class SCAN_COMM_REGISTER_CLASS; -class ScanFacility; -class ResolutionFactory; -class STEP_CODE_DATA_STRUCT; -class CaptureData; -class ErrorRegisterType; -class Resolution; -class Group; - - -typedef std::pair<ResetAndMaskErrorRegister::ResetRegisterVector, - ResetAndMaskErrorRegister::ResetRegisterVector> - ResetAndMaskPair; - -// x86 compile wants this here - not forward declaired dgilbert -class CaptureRequirement -{ - public: - CaptureRequirement() : - cv_TargetType(TARGETING::TYPE_NA), cv_TargetIndex(0), cv_func(NULL) { }; - - uint32_t cv_TargetType; - uint32_t cv_TargetIndex; - ExtensibleChipFunction * cv_func; - - inline bool operator!=(const CaptureRequirement & r) - { - return ( (cv_TargetType != r.cv_TargetType) || - (cv_TargetIndex != r.cv_TargetIndex) || - (cv_func != r.cv_func) ); - }; -}; - -//-------------------------------------- -// @jl04 a Start. -// Adding capture requirement type for transporting data. -class CaptureType -{ - public: - RegType cv_regType; - // if (reg == 1) reg = PRIMARY; - // if (reg == 2) reg = SECONDARY; - CaptureType(RegType reg = PRIMARY):cv_regType(reg){}; -}; -// @jl04 a Stop. -//-------------------------------------- - - class RuleChip : public ExtensibleChip { - public: - - typedef std::map<uint32_t, SCAN_COMM_REGISTER_CLASS *> RegMap_t; - typedef std::map<uint32_t, ErrorRegisterType *> GroupMap_t; - typedef std::map<uint32_t, Resolution *> ActionMap_t; - typedef std::map<uint32_t, ResetAndMaskPair> Reset_t; - typedef std::map<uint32_t, Resolution *> SharedThreshold_t; - - struct RuleFileData - { - RegMap_t & cv_regMap; - GroupMap_t & cv_groupMap; - ActionMap_t & cv_actionMap; - - ScanFacility & cv_scanFactory; - ResolutionFactory & cv_reslFactory; - - TARGETING::TargetHandle_t cv_chipHandle; - Prdr::Chip *& cv_loadChip; // pw01 - - Reset_t & cv_resets; - ResetAndMaskPair & cv_currentResets; - - SharedThreshold_t & cv_sharedThresholds; - - }; public: @@ -138,81 +69,81 @@ class RuleChip : public ExtensibleChip encapsulated by PRDF_LOCK_CHIP_SCOPE */ // TODO : add parameter for parent domains, connected chip classes. - RuleChip(const char * i_fileName, - TARGETING::TargetHandle_t i_pTargetHandle, - ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory - ) - : ExtensibleChip(i_pTargetHandle), - cv_fileName(i_fileName), - cv_dumpType(0), //@ecdf - cv_dataBundle(NULL) - { - this->loadRuleFile(i_scanFactory, i_reslFactory); - }; + /** + * @brief constructor + * @param[in] i_fileName name of Rule file + * @param[in] i_pTargetHandle Target associated with RuleChip + * @param[in] i_scanFactory instance of register factory + * @param[in] i_reslFactory instance of resolution factory + * @param[o] o_errl error log handle + */ + RuleChip( const char * i_fileName , + TARGETING::TargetHandle_t i_pTargetHandle, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + errlHndl_t & o_errl ); + /** + * @brief Destructor + */ ~RuleChip(); - - int32_t Analyze(STEP_CODE_DATA_STRUCT &, ATTENTION_TYPE); - int32_t CaptureErrorData(CaptureData &, int i_group = 1); - /*Note - functions like MaskError(),getDataBundle(),getSignatureOffset() - just return a constant or a member variable. These function don't need - to call any other functions of RuleChip.Hence,despite the fact that - these functions are public,we are not using macro PRDF_LOCK_CHIP_SCOPE - in these function. - */ + /** + * @brief Analyzes attention in a RuleChip + * @param[io] io_serviceData Reference to STEP_CODE_DATA_STRUCT + * @param[in] i_attn attention reported by RuleChip + * @return returns SUCCESS or FAIL + */ + + int32_t Analyze( STEP_CODE_DATA_STRUCT & io_serviceData, + ATTENTION_TYPE i_attn ); + + /** + * @brief Masks error + * @return returns SUCCESS or FAIL + */ int32_t MaskError(uint32_t i) { return SUCCESS; }; - - ExtensibleChipFunction * - getExtensibleFunction(const char *, bool = false); - SCAN_COMM_REGISTER_CLASS * getRegister(const char *, bool = false); - + /** + * @brief Returns plugin function pointer + * @param[in] i_func name of plugin function + * @param[in] i_expectNull availability status of plugin function + * @return returns pointer to plugin function + */ + + ExtensibleChipFunction *getExtensibleFunction( + const char * i_func, bool i_expectNull = false ); + /** + * @brief Returns register instance + * @param[in] i_func name of plugin function + * @param[in] i_expectNull availability status of plugin function + * @return returns pointer to plugin function + */ + SCAN_COMM_REGISTER_CLASS * getRegister( + const char * i_func, bool i_expectNull = false ); + + /** + * @brief Returns data bundle instance + * @return returns DataBundle& + */ DataBundle *& getDataBundle() { return cv_dataBundle; }; - uint32_t getSignatureOffset() const { return iv_sigOff; }; - - private: - const char * cv_fileName; - ErrlSmartPtr cv_errl; - - uint32_t cv_dumpType; //@ecdf - - uint32_t iv_sigOff; - - std::map<uint16_t, SCAN_COMM_REGISTER_CLASS *> cv_hwRegs; - - typedef std::map<uint32_t, std::vector<SCAN_COMM_REGISTER_CLASS *> > HwCaptureGroup_t; - HwCaptureGroup_t cv_hwCaptureGroups; - - typedef std::map<SCAN_COMM_REGISTER_CLASS *, CaptureRequirement> HwCaptureReq_t; - HwCaptureReq_t cv_hwCaptureReq; - + /** + * @brief Captures register data + * @param[io] io_cap reference to instance of CaptureData + * @param[in] i_group group id for register capture group + * @return returns capture status ( SUCCESS|FAIL) + */ + virtual int32_t CaptureErrorData( + CaptureData& io_cap , int i_group = 1 ) ; + /** + * @brief Initializes the RuleChip instance + */ + void init( ); + + private: //data + RuleMetaData * iv_pRuleData ; //Adding another std::map for passing some data to capture stuff. - typedef std::map<SCAN_COMM_REGISTER_CLASS *, CaptureType> HwCaptureType_t; - HwCaptureType_t cv_hwCaptureType; DataBundle * cv_dataBundle; - ErrorRegisterType * cv_groupAttn[Prdr::NUM_GROUP_ATTN]; - - void loadRuleFile(ScanFacility &, - ResolutionFactory &); - - SCAN_COMM_REGISTER_CLASS * - createVirtualRegister(Prdr::Expr *, - RuleFileData &); - - Resolution * - createActionClass(uint32_t, - RuleFileData &); - - Resolution * - createResolution(Prdr::Expr *, - RuleFileData &); - - void createGroup(Group *, - uint32_t, - RuleFileData &); }; } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C new file mode 100644 index 000000000..df840f91f --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C @@ -0,0 +1,1076 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 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 __HOSTBOOT_MODULE + #include <utilreg.H> // for UtilReg + #include <prdfMfgThresholdMgr.H> + #include <prdfSdcFileControl.H> //for SyncAnalysis +#endif +#include <prdfRuleMetaData.H> +#include <iipEregResolution.h> // for EregResolution +#include <iipServiceDataCollector.h> // for ServiceDataCollector +#include <prdfGroup.H> +#include <prdf_ras_services.H> +#include <prdrLoadChip.H> +#include <prdrLoadChipCache.H> +#include <prdfScanFacility.H> // for ScanFacility +#include <iipResolutionFactory.h> // for ResolutionFactory +#include <prdfErrorSignature.H> // for ErrorSignature +#include <utilfile.H> // for UtilFile +#include <UtilHash.H> // for Util::hashString +#include <prdfPfa5Data.h> + +namespace PRDF +{ + +template <bool Type> +struct ResetAndMaskTransformer + : public std::unary_function<Prdr::Register::ResetOrMaskStruct, + ResetAndMaskErrorRegister::ResetRegisterStruct> +{ + ResetAndMaskTransformer( ScanFacility & i_scanFactory,size_t i_scomlen , + TARGETING::TYPE i_type ) + :cv_scanFactory( i_scanFactory ), + cv_scomlen( i_scomlen ), + iv_chipType( i_type ) + { }; + + virtual ~ResetAndMaskTransformer() {}; + + virtual ResetAndMaskErrorRegister::ResetRegisterStruct + operator()( const Prdr::Register::ResetOrMaskStruct & i ) + { + ResetAndMaskErrorRegister::ResetRegisterStruct o; + o.read = & cv_scanFactory.GetScanCommRegister( i.addr_r ,cv_scomlen, + iv_chipType ); + + o.write = & cv_scanFactory.GetScanCommRegister( i.addr_w ,cv_scomlen , + iv_chipType ); + + + switch ( i.op ) + { + case Prdr::OR: + o.op = getStaticResetOperator<OrOperator<Type> >(); + break; + + case Prdr::AND: + o.op = getStaticResetOperator<AndOperator<Type> >(); + break; + + case Prdr::XOR: + o.op = getStaticResetOperator<XorOperator<Type> >(); + break; + + case Prdr::NOT: + o.op = getStaticResetOperator<NotOperator<Type> >(); + break; + + default: + o.op = NULL; // TODO: ERROR! Assert... + break; + } + + return o; + }; + + private: + ScanFacility & cv_scanFactory; + size_t cv_scomlen; + TARGETING::TYPE iv_chipType; +}; + + +//------------------------------------------------------------------------------ + + RuleMetaData::RuleMetaData( const char * i_fileName, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + TARGETING::TYPE i_type, + errlHndl_t & o_errl ) + : cv_fileName( i_fileName ),cv_dumpType( 0 ),iv_sigOff(0) +{ + o_errl = this->loadRuleFile( i_scanFactory, i_reslFactory,i_type ) ; +} + + +//------------------------------------------------------------------------------ +RuleMetaData::~RuleMetaData() +{ + uint32_t l_size = iv_groupList.size(); + for( uint32_t i = 0; i < l_size; i++ ) + { + delete iv_groupList[i]; + } + iv_groupList.clear(); + cv_hwCaptureGroups.clear(); + cv_hwCaptureReq.clear(); + cv_hwCaptureType.clear(); +} +//------------------------------------------------------------------------------ + + +errlHndl_t RuleMetaData::loadRuleFile( ScanFacility & i_scanFactory , + ResolutionFactory &i_reslFactory , + TARGETING::TYPE i_type ) +{ + RegMap_t l_regMap; + Reset_t l_resetMap; + ResetAndMaskPair l_currentResets; + uint32_t l_regMax = 0; + uint32_t l_vregMax = 0; + uint32_t l_groupMax = 0; + ActionMap_t l_actionMap; + GroupMap_t l_groupMap; + uint32_t l_actionMax = 0; + uint32_t l_id = 1; + errlHndl_t l_errl = NULL ; + SharedThreshold_t l_sharedThresholds; + + Prdr::Chip * l_chip; + + /* Initialize local data struct to pass to sub-functions */ + RuleFileData l_localData = { l_regMap, l_groupMap, l_actionMap, + i_scanFactory, i_reslFactory, + l_chip, + l_resetMap, l_currentResets, + l_sharedThresholds + }; + // Parse chip file. + l_errl = Prdr::LoadChipCache::loadChip(cv_fileName, &l_chip); + if( NULL == l_errl ) + { + + // Get default dump type. + cv_dumpType = l_chip->cv_dumpType; + + // Set signature offset for capture data output. + iv_sigOff = l_chip->cv_signatureOffset; + + // create hardware regs. + for (int i = 0; i < l_chip->cv_regCount; i++) + { + uint16_t hashId = l_chip->cv_registers[i].cv_name; + + l_regMap[l_id] = cv_hwRegs[hashId] + = &i_scanFactory.GetScanCommRegister( + l_chip->cv_registers[i].cv_scomAddr, + l_chip->cv_registers[i].cv_scomLen, + i_type ); + l_regMap[l_id]->SetId(hashId); + + // Copy reset registers. + std::transform( l_chip->cv_registers[i].cv_resets.begin(), + l_chip->cv_registers[i].cv_resets.end(), + std::back_inserter(l_resetMap[l_id].first), + ResetAndMaskTransformer<RESETOPERATOR_RESET>( + i_scanFactory, + l_chip->cv_registers[i].cv_scomLen, + i_type ) + ); + + // Copy mask registers. + std::transform( l_chip->cv_registers[i].cv_masks.begin(), + l_chip->cv_registers[i].cv_masks.end(), + std::back_inserter(l_resetMap[l_id].second), + ResetAndMaskTransformer<RESETOPERATOR_MASK>( + i_scanFactory, + l_chip->cv_registers[i].cv_scomLen, + i_type ) ); + + //This flag signifies that a mapping IS or ISN'T created between a + //uint32_t mapping and a vector of SCAN_COMM_REGISTER_CLASS pointers + //. If there is no mapping outside of the for loop then it is + //because there is a capture type or requirement without a group + //in the rule file. + bool l_group_is_created = false; + // Copy into capture groups. + std::vector<Prdr::Register::CaptureInfoStruct>::const_iterator + l_capturesEnd = l_chip->cv_registers[i].cv_captures.end(); + //For each capture in this register save a Group Type or Requirement. + for(std::vector<Prdr::Register::CaptureInfoStruct>::const_iterator + j = l_chip->cv_registers[i].cv_captures.begin(); + j != l_capturesEnd; + ++j) + { + if ('G' == (*j).op) + { + cv_hwCaptureGroups[(*j).data[0]].push_back(l_regMap[l_id]); + //Added statement below this to indicate group was created. + l_group_is_created = true; + } + // @jl04 a Start. + // This else if was added for a new capture "type" for registers + // primary/secondary. + // Cannot put the "type" in with the G group otherwise it will + // show up as a i_group of 2 which is not called. + else if('T' == (*j).op) + { + //@jl06. d Deleted temporary declaration of CaptureType in + // favor of an anonymous declaration. Calls ctor twice. + cv_hwCaptureType[l_regMap[l_id]] = + CaptureType((RegType)(*j).data[0]); //@jl06 c. + } + // @jl04 a Stop. + else if ('f' == (*j).op) + { + CaptureRequirement req; + req.cv_func = this->getExtensibleFunction(j->func); + + cv_hwCaptureReq[l_regMap[l_id]] = req; + } + else // 'C' + { + CaptureRequirement req; + req.cv_TargetType = (*j).data[0]; + req.cv_TargetIndex = (*j).data[1]; + req.cv_func = NULL; + + cv_hwCaptureReq[l_regMap[l_id]] = req; + } + } + if (!l_group_is_created) // @jl06 c Add to default group if none there. + { + // Add to default if no group specified. + cv_hwCaptureGroups[1].push_back(l_regMap[l_id]); + } + + l_regMax = l_id++; + + } + + for (int i = 0; i < l_chip->cv_ruleCount; i++) + { + if (l_regMap[l_id]) // check if it already exists. + { + l_vregMax = l_id++; + continue; + } + + l_currentResets = ResetAndMaskPair(); + + SCAN_COMM_REGISTER_CLASS * l_tmp = + this->createVirtualRegister(&l_chip->cv_rules[i], l_localData); + + l_regMap[l_id] = l_tmp; + l_resetMap[l_id] = l_currentResets; + l_vregMax = l_id++; + }; + + // initialize all the pointers for the groups, but don't construct their + // data yet. + Resolution & l_defaultResolution = + i_reslFactory.GetCalloutResolution( NULL, + MRU_MED ); + for (int i = 0; i < l_chip->cv_groupCount; i++) + { + iv_groupList.push_back( new Group( l_defaultResolution ) ); + l_groupMap[l_id] = iv_groupList.back(); + l_groupMax = l_id++; + }; + + for (int i = 0; i < l_chip->cv_actionCount; i++) + { + if (l_actionMap[i]) + { + l_actionMax = l_id++; + continue; + } + + // createActionClass will add to the actionMap. + this->createActionClass(i, l_localData); + //l_actionMap[l_id] = l_tmp; + l_actionMax = l_id++; + } + + for (int i = 0; i < l_chip->cv_groupCount; i++) + { + this->createGroup( (Group *) l_groupMap[i+l_vregMax+1], + i,l_localData ); + } + for ( int i = 0; i < Prdr::NUM_GROUP_ATTN; i++ ) + cv_groupAttn[i] = l_groupMap[l_chip->cv_groupAttn[i]]; + + } + else + { + PRDF_ERR(" LoadChipCache::loadChip( ) failed "); + } + + return l_errl; + +} + +//------------------------------------------------------------------------------ + +int32_t RuleMetaData::Analyze( STEP_CODE_DATA_STRUCT & i_serviceData, + ATTENTION_TYPE i_attnType ) +{ + int32_t l_rc = SUCCESS; + ExtensibleChip * l_chipAnalyzed = ServiceDataCollector::getChipAnalyzed( ); + ServiceDataCollector & i_sdc = *(i_serviceData.service_data); + // Set default dump flags. //@ecdf + //FIXME:RTC 51618 Take out hwTableContent for now for Hostboot + #ifdef __HOSTBOOT_MODULE + i_sdc.SetDump(/*(hwTableContent)cv_dumpType,*/ + l_chipAnalyzed->GetChipHandle() ); + #else + i_sdc.SetDump( (hwTableContent)cv_dumpType, + l_chipAnalyzed->GetChipHandle() ); + #endif + + // Add statement below for Drop call. + CaptureData & capture = i_serviceData.service_data->GetCaptureData(); + // Get capture data for this chip. Allow override. + ExtensibleChipFunction * l_ignoreCapture = + getExtensibleFunction("PreventDefaultCapture", true); + bool l_shouldPreventDefaultCapture = false; + + (*l_ignoreCapture) + ( l_chipAnalyzed, PluginDef::bindParm<STEP_CODE_DATA_STRUCT&, bool&> + (i_serviceData, l_shouldPreventDefaultCapture)); + + if (!l_shouldPreventDefaultCapture) + { + // Drop secondary capture from earlier chips. + capture.Drop(SECONDARY); + + // Read capture data. + this->CaptureErrorData( i_sdc.GetCaptureData() ); + } + + // Analyze group. + ErrorRegisterType * l_errReg = NULL; + switch (i_attnType) + { + case CHECK_STOP: + l_errReg = cv_groupAttn[0]; + break; + + case RECOVERABLE: + l_errReg = cv_groupAttn[1]; + break; + + case SPECIAL: + l_errReg = cv_groupAttn[2]; + break; + + // @jl02 JL Added this code to support the new Unit Check Stop. + case UNIT_CS: + // @jl02 JL I don't know if this is the correct cv_groupAttn to add + // here or if it's needed. + l_errReg = cv_groupAttn[3]; + break; + + } + if (NULL != l_errReg) + { //mp02 a Start + //Call any pre analysis functions + ExtensibleChipFunction * l_preAnalysis = + getExtensibleFunction("PreAnalysis", true); + bool analyzed = false; + (*l_preAnalysis)( l_chipAnalyzed , + PluginDef::bindParm<STEP_CODE_DATA_STRUCT&,bool&> + (i_serviceData,analyzed)); + if ( !analyzed) + l_rc = l_errReg->Analyze(i_serviceData); + } //mp02 a Stop + // mp02d l_rc = l_errReg->Analyze(i_serviceData); + else //@jl07 + l_rc = PRD_SCAN_COMM_REGISTER_ZERO; //@jl07 + + // Don't do reset or mask on CS. @pw03 + if (CHECK_STOP != i_serviceData.service_data->GetAttentionType()) //@pw04 + { + #ifndef __HOSTBOOT_MODULE + SyncAnalysis (i_sdc); //mp01 Add call to Sync SDC + #endif + // Call mask plugin. + if (i_serviceData.service_data->IsAtThreshold()) + { + ExtensibleChipFunction * l_mask = + getExtensibleFunction("MaskError", true); + (*l_mask)( l_chipAnalyzed , + PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) + ); //@pw01 + } + + // Call reset plugin. + ExtensibleChipFunction * l_reset = + getExtensibleFunction("ResetError", true); + (*l_reset)( l_chipAnalyzed, + PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) + ); //@pw01 + } + + // Call postanalysis plugin. + // @jl02 JL Adding PostAnalysis plugin call. + ExtensibleChipFunction * l_postanalysis = + getExtensibleFunction("PostAnalysis", true); + // @jl02 the true above means that a plugin may not exist for this call. + // @jl02 JL Adding call for post analysis. + (*l_postanalysis)( l_chipAnalyzed, + PluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData)); + + + return l_rc; +}; + + +//------------------------------------------------------------------------------ + +int32_t RuleMetaData::CaptureErrorData( CaptureData & io_cap, + int i_group ) +{ + using namespace TARGETING; + ExtensibleChip * l_pChipAnalyzed = ServiceDataCollector::getChipAnalyzed( ); + TargetHandle_t l_pTargetAnalyzed = l_pChipAnalyzed->GetChipHandle( ); + + std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator l_hwCaptureEnd = + cv_hwCaptureGroups[i_group].end(); + + for ( std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator i = + cv_hwCaptureGroups[i_group].begin(); + i != l_hwCaptureEnd; + ++i ) + { + // Check that requirements are satisfied. + if ( CaptureRequirement() != cv_hwCaptureReq[*i]) + { + CaptureRequirement req = cv_hwCaptureReq[*i]; + if (NULL != req.cv_func) + { + bool l_cap = true; + (*req.cv_func) + ( l_pChipAnalyzed , PluginDef::bindParm<bool &>(l_cap)); + + if (!l_cap) + continue; + } + else + { + bool l_indexValid =false; + TargetHandleList l_ptargetHandleList = + PlatServices::getConnected( + l_pTargetAnalyzed, + (TARGETING::TYPE) req.cv_TargetType ); + + TargetHandleList::iterator itrTarget = + l_ptargetHandleList.begin(); + + for( ; itrTarget != l_ptargetHandleList.end();itrTarget++ ) + { + if ( req.cv_TargetIndex == + PlatServices::getTargetPosition( *itrTarget) ) + { + l_indexValid = true; + break; + } + } + if( false == l_indexValid ) + { + continue; + } + } + } + + io_cap.Add( l_pTargetAnalyzed, + (*i)->GetId() ^ this->getSignatureOffset(), + *(*i), + CaptureData::BACK, + cv_hwCaptureType[*i].cv_regType ); + } + + // Call "PostCapture" plugin + ExtensibleChipFunction * l_postCapture = + getExtensibleFunction("PostCapture", true); + + (*l_postCapture) + ( l_pChipAnalyzed, + PluginDef::bindParm<CaptureData &, int>(io_cap, i_group) + ); + + return SUCCESS; +} + + +//------------------------------------------------------------------------------ + +SCAN_COMM_REGISTER_CLASS * RuleMetaData::createVirtualRegister( + Prdr::Expr * i_vReg, + RuleFileData & i_data ) +{ + SCAN_COMM_REGISTER_CLASS * l_arg[4] = { NULL }; + uint32_t l_tmp32 = 0; + SCAN_COMM_REGISTER_CLASS * l_rc = NULL; + + switch(i_vReg->cv_op) + { + case Prdr::NOT: + + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_rc = &i_data.cv_scanFactory.GetNotRegister(*l_arg[0]); + + break; + + case Prdr::LSHIFT: + case Prdr::RSHIFT: + + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_tmp32 = i_vReg->cv_value[1].p->cv_value[0].i; + l_rc = (Prdr::LSHIFT == i_vReg->cv_op + ? + &i_data.cv_scanFactory.GetLeftShiftRegister(*l_arg[0], + l_tmp32) + : + &i_data.cv_scanFactory.GetRightShiftRegister(*l_arg[0], + l_tmp32) + ); + break; + + case Prdr::OR: + case Prdr::AND: + + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); + l_rc = (Prdr::OR == i_vReg->cv_op + ? + &i_data.cv_scanFactory.GetOrRegister(*l_arg[0], + *l_arg[1]) + : + &i_data.cv_scanFactory.GetAndRegister(*l_arg[0], + *l_arg[1]) + ); + break; + + + case Prdr::REF_REG: + + std::copy( i_data.cv_resets[i_vReg->cv_value[0].i].first.begin(), + i_data.cv_resets[i_vReg->cv_value[0].i].first.end(), + std::back_inserter(i_data.cv_currentResets.first) ); + + std::copy( i_data.cv_resets[i_vReg->cv_value[0].i].second.begin(), + i_data.cv_resets[i_vReg->cv_value[0].i].second.end(), + std::back_inserter(i_data.cv_currentResets.second) ); + + l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; + + break; + + case Prdr::REF_RULE: + + if (NULL == i_data.cv_regMap[i_vReg->cv_value[0].i]) + { + i_data.cv_regMap[i_vReg->cv_value[0].i] = + createVirtualRegister( + &i_data.cv_loadChip->cv_rules[i_vReg->cv_value[0].i], + i_data ); + } + l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; + + break; + + case Prdr::ATTNLINK: + + if ( NULL != i_vReg->cv_value[0].p ) + { + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + } + + if ( NULL != i_vReg->cv_value[1].p ) + { + l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); + + } + if ( NULL != i_vReg->cv_value[2].p ) + { + l_arg[2] = createVirtualRegister(i_vReg->cv_value[2].p, i_data); + } + + if ( NULL != i_vReg->cv_value[3].p ) + { + l_arg[3] = createVirtualRegister(i_vReg->cv_value[3].p, i_data); + } + + // passing NULL objects in l_arg[x] + l_rc = &i_data.cv_scanFactory.GetAttnTypeRegister(*l_arg[0], + *l_arg[1], + *l_arg[2], + *l_arg[3]); + break; + + case Prdr::BIT_STR: + { + uint32_t l_size = i_vReg->cv_bitStrVect.size(); + BIT_STRING_BUFFER_CLASS l_bs(l_size * 64); + + for (uint32_t i = 0; i < l_size; i++) + { + l_bs.SetFieldJustify(32*(2*i) , 32, + (i_vReg->cv_bitStrVect[i] >> 32) & 0xFFFFFFFF); + l_bs.SetFieldJustify(32*((2*i)+1), 32, + (i_vReg->cv_bitStrVect[i] & 0xFFFFFFFF)); + } + + l_rc = &i_data.cv_scanFactory.GetConstantRegister(l_bs); + } + break; + + } + + return l_rc; +}; + +//------------------------------------------------------------------------------ + +Resolution * RuleMetaData::createActionClass( uint32_t i_action, + RuleMetaData::RuleFileData & i_data ) +{ + if ( NULL != i_data.cv_actionMap[i_action] ) + return i_data.cv_actionMap[i_action]; + + Resolution * l_tmpRes = NULL, * l_retRes = NULL; + + for (int i = 0; i < i_data.cv_loadChip->cv_actionSize[i_action]; i++) + { + l_tmpRes = this->createResolution( + &(i_data.cv_loadChip->cv_actions[i_action][i]), + i_data); + if (0 == i) + { + l_retRes = l_tmpRes; + } + else + { + l_retRes = &i_data.cv_reslFactory. + LinkResolutions(*l_retRes, *l_tmpRes); + } + } + + if (NULL == l_retRes) // @pw05 + { + class NullResolution : public Resolution + { + public: + int32_t Resolve( STEP_CODE_DATA_STRUCT & io_data ) + { return SUCCESS; }; + }; + + static NullResolution l_nullRes; + l_retRes = &l_nullRes; + } + + i_data.cv_actionMap[i_action] = l_retRes; + return l_retRes; +}; + +//------------------------------------------------------------------------------ + +Resolution * RuleMetaData::createResolution( Prdr::Expr * i_action, + RuleMetaData::RuleFileData & i_data ) +{ + Resolution * l_rc = NULL; + + switch (i_action->cv_op) + { + case Prdr::REF_ACT: + l_rc = this->createActionClass(i_action->cv_value[0].i - + (i_data.cv_loadChip->cv_regCount + + i_data.cv_loadChip->cv_ruleCount + + i_data.cv_loadChip->cv_groupCount + + 1), + i_data); + break; + + case Prdr::REF_GRP: + l_rc = &i_data.cv_reslFactory.GetEregResolution( + *i_data.cv_groupMap[i_action->cv_value[0].i]); + break; + + case Prdr::ACT_TRY: // TRY + l_rc = &i_data.cv_reslFactory.GetTryResolution( + *(this->createResolution(i_action->cv_value[0].p, + i_data)), + *(this->createResolution(i_action->cv_value[1].p, + i_data)) + ); + break; + + case Prdr::ACT_FUNC: // FUNCCALL + l_rc = &i_data.cv_reslFactory.GetPluginCallResolution( + this->getExtensibleFunction(i_action->cv_actFunc) + ); + break; + + case Prdr::ACT_FLAG: // FLAG + l_rc = &i_data.cv_reslFactory.GetFlagResolution( + (ServiceDataCollector::Flag) i_action->cv_value[0].i); + break; + + case Prdr::ACT_THRES: // Threshold + // The values which different parameter will have + // cv_value[0,1] error frequency and time in sec for field + // threshold + // cv_value[4] true if mnfg threshols needs to be picked up + // from mnfg file, false otherwise + // cv_value [2,3]: error frequency and time in sec for mnfg + // threshold if cv_value[4] is false otheriwse + // cv_value[3] tells which threshold needs to pick + // up from mnfg file + // cv_value[5] maskid id if shared threshold + if (0 == i_action->cv_value[5].i) + { + if ( !PlatServices::mfgMode() ) + { + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[0].i, + i_action->cv_value[1].i ) ); + } + else if(i_action->cv_value[4].i) + { + // FIXME : need to uncomment MfgThresholdMgr after we figure it out + #ifndef __HOSTBOOT_MODULE + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + *(MfgThresholdMgr::getInstance()-> + getThresholdP(i_action->cv_value[3].i) ) ); + #endif + } + else + { + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[2].i, + i_action->cv_value[3].i ) ); + } + } + else + { + if (NULL == i_data.cv_sharedThresholds[i_action->cv_value[5].i]) + { + if ( !PlatServices::mfgMode() ) + { + l_rc = &i_data.cv_reslFactory.GetThresholdResolution( + i_action->cv_value[5].i, + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[0].i, + i_action->cv_value[1].i ) ); + } + else if(i_action->cv_value[4].i) + { + // FIXME : need to uncomment MfgThresholdMgr after we figure it out + #ifndef __HOSTBOOT_MODULE + l_rc = &i_data.cv_reslFactory. + GetThresholdResolution(i_action->cv_value[5].i, + *(MfgThresholdMgr::getInstance()-> + getThresholdP(i_action->cv_value[3].i))); + #endif + } + else + { + l_rc = &i_data.cv_reslFactory. + GetThresholdResolution( i_action->cv_value[5].i, + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[2].i, + i_action->cv_value[3].i ) ); + } + i_data.cv_sharedThresholds[i_action->cv_value[5].i] = l_rc; + } + else + { + l_rc = i_data.cv_sharedThresholds[i_action->cv_value[5].i]; + } + } + break; + + + case Prdr::ACT_DUMP: // DUMP : TODO: Allow dump connected. + #ifdef __HOSTBOOT_MODULE + //FIXME: comment out hwtablecontent for hostboot + l_rc = &i_data.cv_reslFactory.GetDumpResolution( + /*(hwTableContent) i_action->cv_value[0].i,*/ + ); + #else + l_rc = &i_data.cv_reslFactory.GetDumpResolution( + (hwTableContent) i_action->cv_value[0].i ); + #endif + break; + + case Prdr::ACT_GARD: // GARD + l_rc = &i_data.cv_reslFactory.GetGardResolution( + (GardResolution::ErrorType) i_action->cv_value[0].i); + break; + + case Prdr::ACT_ANALY: // ANALYZE + l_rc = &i_data.cv_reslFactory.GetAnalyzeConnectedResolution( + (TARGETING::TYPE) i_action->cv_value[0].i, + i_action->cv_value[1].i); + break; + + case Prdr::ACT_CALL: // CALLOUT + + switch ((char)i_action->cv_value[0].i) + { + case 'c': // connected chip. + l_rc = &i_data.cv_reslFactory.GetConnectedCalloutResolution( + (TARGETING::TYPE) i_action->cv_value[2].i, + i_action->cv_value[3].i, + (CalloutPriorityEnum) i_action->cv_value[1].i, + ( NULL == i_action->cv_value[4].p ? NULL : + ( this->createResolution( + i_action->cv_value[4].p, i_data ) ) ) ); + break; + + case 'p': // Procedure. + l_rc = &i_data.cv_reslFactory.GetCalloutResolution( + (SymbolicFru) i_action->cv_value[2].i, + (CalloutPriorityEnum) i_action->cv_value[1].i ); + break; + + case 's': // SELF + default: + l_rc = &i_data.cv_reslFactory.GetCalloutResolution( + NULL , + (CalloutPriorityEnum) i_action->cv_value[1].i ); + break; + + }; + + break; + + case Prdr::ACT_CAPT: // Capture resolution. + l_rc = &i_data.cv_reslFactory.GetCaptureResolution( + i_action->cv_value[0].i); + break; + }; + + return l_rc; +}; + +//------------------------------------------------------------------------------ + +void RuleMetaData::createGroup(Group * i_group, + uint32_t i_groupId, + RuleMetaData::RuleFileData & i_data) +{ + // Internal class to collapse the bit string. + class CreateBitString + { + public: + static void execute(std::vector<uint8_t> & i_bits, + Prdr::Expr * i_expr) + { + if (NULL == i_expr) + return; + if (i_expr->cv_op == Prdr::INT_SHORT) + { + i_bits.push_back(i_expr->cv_value[0].i); + } + else // must be an | or & operator. + { + // Expand bit string from left side. + CreateBitString::execute(i_bits, i_expr->cv_value[0].p); + // Expand bit string from right side. + CreateBitString::execute(i_bits, i_expr->cv_value[1].p); + } + }; + }; + + for (int i = 0; i < i_data.cv_loadChip->cv_groupSize[i_groupId]; i++) + { + std::vector<uint8_t> l_bits; // Vector to hold bit string. + + // TODO : handle & transformations. + + // Get expression for group's line. + Prdr::Expr * l_expr = &i_data.cv_loadChip->cv_groups[i_groupId][i]; + + // Execute internal (recursive) class to generate bit string. + CreateBitString::execute(l_bits, l_expr->cv_value[1].p); + + // Add expression to group. + i_group->Add(i_data.cv_regMap[l_expr->cv_value[0].i], + &(*l_bits.begin()), + l_bits.size(), + *(this->createResolution(l_expr->cv_value[2].p, i_data)), + i_data.cv_resets[l_expr->cv_value[0].i], + (i_data.cv_regMap[l_expr->cv_value[0].i]->GetId() + + i_data.cv_loadChip->cv_signatureOffset) & 0xffff, + Prdr::AND == l_expr->cv_value[1].p->cv_op + ); + + } // end for. + + // Do flags. --- + + // Do Priority filter flag. + if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & + Prdr::PRDR_GROUP_FILTER_PRIORITY) + { + std::vector<uint8_t> l_bits; + CreateBitString::execute(l_bits, + i_data.cv_loadChip->cv_groupPriorityBits[i_groupId]); + + FilterClass * l_filter = new PrioritySingleBitFilter(l_bits); + i_group->AddFilter(l_filter); + } + + // Do single bit filter flag. + if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & + Prdr::PRDR_GROUP_FILTER_SINGLE_BIT) + { + FilterClass * l_filter = new SingleBitFilter(); + i_group->AddFilter(l_filter); + } +} + +//------------------------------------------------------------------------------ + +ExtensibleChipFunction *RuleMetaData::getExtensibleFunction( + const char * i_func, + bool i_expectNull ) +{ + ExtensibleFunctionType * plugin = + getPluginGlobalMap().getPlugins(cv_fileName)[i_func]; + + if (NULL == plugin) + { + static Plugin<ExtensibleChip> l_nullPlugin(NULL); + plugin = &l_nullPlugin; + + if (!i_expectNull) + { + errlHndl_t l_errl = NULL; + + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_RULECHIP, + LIC_REFCODE, + PRDF_CODE_FAIL, + __LINE__, + 0, 0, 0); + + PRDF_ADD_FFDC(l_errl, + cv_fileName, + strlen(cv_fileName), + ErrlVer1, + ErrlString); + + PRDF_ADD_FFDC(l_errl, + i_func, + strlen(i_func), + ErrlVer1, + ErrlString ); + + PRDF_COMMIT_ERRL( l_errl, ERRL_ACTION_REPORT ); + } + + } + return ( ExtensibleChipFunction * ) plugin; + +} + +//------------------------------------------------------------------------------ + +SCAN_COMM_REGISTER_CLASS * RuleMetaData::getRegister( const char * i_reg, + bool i_expectNull, + ExtensibleChip* i_chip ) +{ + uint16_t hashId = Util::hashString( i_reg ); + SCAN_COMM_REGISTER_CLASS * l_pRegister = cv_hwRegs[hashId]; + if ( NULL == l_pRegister ) + { + l_pRegister = getNullRegister( i_reg,i_expectNull ); + } + else + { + /* l_register obtained from cv_hwRegs is a ScomRegister which does not + have rule chip info built in.Analyze leg of code uses this register. + Inorder to use this register for scom, target info is obtained from + service data collector.This register does not suit us for read and + write operation in plugin function.It is because in plugin function + register read should not be concerned with finding the associated + rule chip or target.Inorder to address this situation,we create a + wrapper register.This register has rule chip info in addition to all + the data of scomRegister.This object is created through factory and + and destroyed at the end of analysis. + */ + + SCAN_COMM_REGISTER_CLASS * l_pReg = l_pRegister; + ScanFacility & l_scanFac = ScanFacility::Access(); + l_pRegister = & l_scanFac.GetPluginRegister( *l_pReg,*i_chip ); + + } + + return l_pRegister; +} + +//------------------------------------------------------------------------------ + +SCAN_COMM_REGISTER_CLASS * RuleMetaData::getNullRegister( const char * i_reg, + bool i_expectNull ) +{ + static NullRegister l_nullRegister(1024); + SCAN_COMM_REGISTER_CLASS * l_register = &l_nullRegister; + + if (!i_expectNull) + { + errlHndl_t l_errl = NULL; + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_RULECHIP, + LIC_REFCODE, + PRDF_CODE_FAIL, + __LINE__, + 1, 0, 0); + + PRDF_ADD_FFDC(l_errl, + cv_fileName, + strlen(cv_fileName), + ErrlVer1, + ErrlString); + + + PRDF_ADD_FFDC(l_errl, + i_reg, + strlen(i_reg), + ErrlVer1, + ErrlString); + + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + } + return l_register; + +} + +//------------------------------------------------------------------------------ + + +}//namespace PRDF ends diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H new file mode 100644 index 000000000..d651df6a2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H @@ -0,0 +1,299 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2004,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 */ + +/** + * @file prdfRuleMetaData.H + * @brief Models the register, groups and action and analyzes the attention. + * + * Each Rule file maps to one instance of RuleMetaData. This class uses + * the services of rule file parser classes. Once Rule file is parsed, + * it models all the physical registers and resolutions. It also models + * the logical operation needed to analyze the registers. It furthur + * goes to the extent of modelling the entire mechansim of attention + * analysis using an entity called Group.All RuleChips modelling target + * of type share same instance of RuleMetaData class. It is created + * while building PRD object model. Similar to RuleChips, instance of + * this class too are contained in System class. + * + */ + + +#ifndef __PRDFRULECHIPDATA_H +#define __PRDFRULECHIPDATA_H + + +#include <iipchip.h> +#include <prdfErrlSmartPtr.H> +#include <string.h> +#include <vector> +#include <map> +#include "prdrCommon.H" +#include <iipCaptureData.h> +#include <prdfExtensibleChip.H> +#include <iipResetErrorRegister.h> + +namespace Prdr +{ + +class Chip; +class Expr; + +} // end namespace PRDR + +namespace PRDF +{ + +class ScanFacility; +class ResolutionFactory; +class Resolution; +class Group; +class SCAN_COMM_REGISTER_CLASS; + +typedef std::pair<ResetAndMaskErrorRegister::ResetRegisterVector, + ResetAndMaskErrorRegister::ResetRegisterVector> + ResetAndMaskPair; + +// x86 compile wants this here - not forward declaired dgilbert +class CaptureRequirement +{ + public: + + CaptureRequirement() :cv_TargetType(TARGETING::TYPE_NA), + cv_TargetIndex(0), cv_func(NULL) + { }; + + uint32_t cv_TargetType; + uint32_t cv_TargetIndex; + ExtensibleChipFunction * cv_func; + /** + * @brief defines != operator for register capture requirement + */ + + inline bool operator != ( const CaptureRequirement & r ) + { + return ( ( cv_TargetType != r.cv_TargetType ) || + ( cv_TargetIndex != r.cv_TargetIndex ) || + ( cv_func != r.cv_func ) ); + }; +}; + + +//-------------------------------------- + +class CaptureType +{ + public: + RegType cv_regType; + /** + * @brief constructor + */ + CaptureType( RegType reg = PRIMARY ):cv_regType( reg ) + { }; +}; + +//-------------------------------------- + +class RuleMetaData +{ + public: + typedef std::map<uint32_t, SCAN_COMM_REGISTER_CLASS *> RegMap_t; + typedef std::map<uint32_t, ErrorRegisterType *> GroupMap_t; + typedef std::map<uint32_t, Resolution *> ActionMap_t; + typedef std::map<uint32_t, ResetAndMaskPair> Reset_t; + typedef std::map<uint32_t, Resolution *> SharedThreshold_t; + + struct RuleFileData + { + RegMap_t & cv_regMap; + GroupMap_t & cv_groupMap; + ActionMap_t & cv_actionMap; + + ScanFacility & cv_scanFactory; + ResolutionFactory & cv_reslFactory; + + Prdr::Chip *& cv_loadChip; + + Reset_t & cv_resets; + ResetAndMaskPair & cv_currentResets; + + SharedThreshold_t & cv_sharedThresholds; + + }; + + /** + * @brief constructor + * @param[in] i_fileName name of Rule file + * @param[in] i_scanFactory reference to factory class which + * creates register instances + * @param[in] i_targetType target type associated with Rulechip + * @param[o] o_errl reference to error log handle + */ + RuleMetaData( const char * i_fileName, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory, + TARGETING::TYPE i_targetType, + errlHndl_t & o_errl ); + + + /** + * @brief destructor + */ + + virtual ~RuleMetaData(); + + /** + * @brief Analyzes the attention by reading and analyzing group of + * registers. + * @param[io] io_serviceData reference to STEP_CODE_DATA_STRUCT + * @param[in] i_attn attention reported by RuleChip + * @return SUCCESS|FAIL + */ + + int32_t Analyze( STEP_CODE_DATA_STRUCT & io_serviceData, + ATTENTION_TYPE i_attn ); + /** + * @brief Captures group of register associated with RuleChip + * @param[io] io_capture reference to CaptureData instance. + * @param[in] i_group capture group number + * @return SUCCESS + */ + + int32_t CaptureErrorData( CaptureData & io_capture , int i_group = 1 ); + /** + * @brief Masks error + * @param[in] i + * @return SUCCESS + */ + int32_t MaskError( uint32_t i ) { return SUCCESS; }; + /** + * @brief Returns signature offset associated with registes of a + * RuleChip. + * @return Error signature offset + */ + uint32_t getSignatureOffset() const { return iv_sigOff; }; + /** + * @brief returns pointer to plugin function + * @param[in] i_func name of the plugin function + * @param[in] i_expectNull plugin function availability status + * @return pointer to ExtensibleChipFunction + */ + + ExtensibleChipFunction * getExtensibleFunction( const char * i_func, + bool i_expectNull = false ); + /** + * @brief Returns pointer to physical register. + * @param[in] i_reg name of the register + * @param[in] i_expectNull register non availability expectation + * @param[in] i_chip pointer to RuleChip associated + * @return pointer to SCAN_COMM_REGISTER_CLASS + */ + SCAN_COMM_REGISTER_CLASS * getRegister( const char * i_reg, + bool i_expectNull, + ExtensibleChip* i_chip ); + /** + * @brief Returns Null register instance + * @param[in] i_reg name of the register + * @param[in] i_expectNull register non availability expectation + * @return pointer to SCAN_COMM_REGISTER_CLASS + */ + + SCAN_COMM_REGISTER_CLASS * getNullRegister( const char * i_reg, + bool i_expectNull ); + + ErrorRegisterType * cv_groupAttn[Prdr::NUM_GROUP_ATTN]; + + private: // Data + + const char * cv_fileName; //name of rule file associated with the class + uint32_t cv_dumpType; // dump type + uint32_t iv_sigOff; // signature offset for registers + std::map<uint16_t, SCAN_COMM_REGISTER_CLASS *> cv_hwRegs; + typedef std::vector<SCAN_COMM_REGISTER_CLASS *> scomRegisterList_t ; + typedef std::map< uint32_t,scomRegisterList_t > HwCaptureGroup_t; + HwCaptureGroup_t cv_hwCaptureGroups; //capture group associated + typedef std::map<SCAN_COMM_REGISTER_CLASS *, + CaptureRequirement> HwCaptureReq_t; + HwCaptureReq_t cv_hwCaptureReq; + //Adding another std::map for passing some data to capture stuff. + typedef std::map<SCAN_COMM_REGISTER_CLASS *, + CaptureType> HwCaptureType_t; + HwCaptureType_t cv_hwCaptureType; // capture type + std::vector <ErrorRegisterType *> iv_groupList; + + private: //operations + + /** + * @brief Returns Null register instance + * @param[in] i_scanFacility reference to register factory + * @param[in] i_resolutionFactory refence to resolution factory + * @param[in] i_type target type associated with + * RuleChip + * @return error log handle + */ + + errlHndl_t loadRuleFile( ScanFacility & i_scanFacility, + ResolutionFactory & i_resolutionFactory , + TARGETING::TYPE i_type ); + /** + * @brief Models register operation described in rule file. + * @param[in] i_expr expression for logical operation + * @param[in] i_data Reference to RuleFileData instance. + * @return pointer to SCAN_COMM_REGISTER_CLASS + */ + + SCAN_COMM_REGISTER_CLASS * createVirtualRegister( Prdr::Expr * i_expr, + RuleFileData & i_data ); + /** + * @brief Models actions described in rule file. + * @param[in] i_action number corresponding to action in rule file. + * @param[in] i_data Reference to RuleFileData instance. + * @return pointer to Resolution + */ + Resolution * createActionClass( uint32_t i_action , + RuleFileData& i_data ); + + /** + * @brief Models action described in rule file. + * @param[in] i_expr expression for logical operation. + * @param[in] i_data Reference to RuleFileData instance. + * @return pointer to Resolution + */ + + Resolution * createResolution( Prdr::Expr * i_expr, + RuleFileData & i_data ); + + /** + * @brief Models group described in rule file. + * @param[in] i_group register capture group id + * @param[in] i_data Reference to RuleFileData instance. + */ + + void createGroup( Group * i_group , uint32_t , RuleFileData & i_data ); + +}; + + + +}//namespace PRDF ends + +#endif diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C index 0ac815f03..1d8dcef5a 100644 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C @@ -93,14 +93,16 @@ uint32_t _getNodePosition( TARGETING::TargetHandle_t i_pTarget ) //------------------------------------------------------------------------------ -System * PegasusConfigurator::build() +errlHndl_t PegasusConfigurator::build() { using namespace TARGETING; PRDF_ENTER( "PegasusConfigurator::build()" ); + errlHndl_t errl = NULL; + // Create System object to populate with domains. - System * l_system = new System(noAttnResolution); + systemPtr = new System(noAttnResolution); // Create domains. FabricDomain * l_procDomain = new FabricDomain( FABRIC_DOMAIN ); @@ -115,56 +117,84 @@ System * PegasusConfigurator::build() PllDomainList l_fabricPllDomains(l_maxNodeCount, NULL); PllDomainList l_membPllDomains( l_maxNodeCount, NULL); - // Add chips to domains. - addDomainChips( TYPE_PROC, l_procDomain, &l_fabricPllDomains ); - addDomainChips( TYPE_EX, l_exDomain ); - addDomainChips( TYPE_MCS, l_mcsDomain ); - addDomainChips( TYPE_MEMBUF, l_membufDomain, &l_membPllDomains ); - addDomainChips( TYPE_MBA, l_mbaDomain ); + do + { + // Add chips to domains. + errl = addDomainChips( TYPE_PROC, l_procDomain, &l_fabricPllDomains ); + if ( NULL != errl ) break; - // Add Pll domains to domain list. - addPllDomainsToSystem( l_fabricPllDomains, l_membPllDomains ); + errl = addDomainChips( TYPE_EX, l_exDomain ); + if ( NULL != errl ) break; - // Add domains to domain list. NOTE: Order is important because this is the - // order the domains will be analyzed. - sysDmnLst.push_back( l_procDomain ); - sysDmnLst.push_back( l_exDomain ); - sysDmnLst.push_back( l_mcsDomain ); - sysDmnLst.push_back( l_membufDomain ); - sysDmnLst.push_back( l_mbaDomain ); + errl = addDomainChips( TYPE_MCS, l_mcsDomain ); + if ( NULL != errl ) break; - // Add chips to the system. - Configurator::chipList & chips = getChipList(); - l_system->AddChips( chips.begin(), chips.end() ); + errl = addDomainChips( TYPE_MEMBUF, l_membufDomain, &l_membPllDomains ); + if ( NULL != errl ) break; - // Add domains to the system. - Configurator::domainList & domains = getDomainList(); - l_system->AddDomains( domains.begin(), domains.end() ); + errl = addDomainChips( TYPE_MBA, l_mbaDomain ); + if ( NULL != errl ) break; -#ifdef FLYWEIGHT_PROFILING + // Add Pll domains to domain list. + addPllDomainsToSystem( l_fabricPllDomains, l_membPllDomains ); - ScanFacility & scanFac = ScanFacility::Access(); - PRDF_TRAC( "printing flyweight register and resolution objects "); - scanFac.printStats(); - PRDF_TRAC("total chips in the system %d ",chips.size()); - ResolutionFactory & resol = ResolutionFactory::Access( ); - resol.printStats(); -#endif + // Add domains to domain list. NOTE: Order is important because this is + // the order the domains will be analyzed. + sysDmnLst.push_back( l_procDomain ); + sysDmnLst.push_back( l_exDomain ); + sysDmnLst.push_back( l_mcsDomain ); + sysDmnLst.push_back( l_membufDomain ); + sysDmnLst.push_back( l_mbaDomain ); + + // Add chips to the system. + Configurator::chipList & chips = getChipList(); + systemPtr->AddChips( chips.begin(), chips.end() ); + + // Add domains to the system. + Configurator::domainList & domains = getDomainList(); + systemPtr->AddDomains( domains.begin(), domains.end() ); + + #ifdef FLYWEIGHT_PROFILING + + ScanFacility & scanFac = ScanFacility::Access(); + PRDF_TRAC( "printing flyweight register and resolution objects "); + scanFac.printStats(); + PRDF_TRAC("total chips in the system %d ",chips.size()); + ResolutionFactory & resol = ResolutionFactory::Access( ); + resol.printStats(); + + #endif // FLYWEIGHT_PROFILING + + // The underlying list of chips and domains will not be cleaned up until + // the configurator goes out of scope at the end of PRDF::initialize(). + // It was observed that clearing these lists here will greatly reduced + // the peak memory usage for the duration of the PRDF::initialize() + // function. + chips.clear(); + domains.clear(); + + } while (0); + + if ( NULL != errl ) + { + PRDF_ERR( "PegasusConfigurator::build() failed to build" + " object model" ); + } PRDF_EXIT( "PegasusConfigurator::build()" ); - return l_system; + return errl; } //------------------------------------------------------------------------------ -void PegasusConfigurator::addDomainChips( TARGETING::TYPE i_type, +errlHndl_t PegasusConfigurator::addDomainChips( TARGETING::TYPE i_type, RuleChipDomain * io_domain, PllDomainList * io_pllDomains ) { using namespace TARGETING; - int32_t l_rc = SUCCESS; + errlHndl_t l_errl = NULL ; // Get references to factory objects. ScanFacility & scanFac = ScanFacility::Access(); @@ -196,7 +226,11 @@ void PegasusConfigurator::addDomainChips( TARGETING::TYPE i_type, if ( NULL == *itr ) continue; RuleChip * chip = new RuleChip( fileName, *itr, - scanFac, resFac ); + scanFac, resFac,l_errl ); + if( NULL != l_errl ) + { + break; + } sysChipLst.push_back( chip ); io_domain->AddChip( chip ); @@ -228,6 +262,8 @@ void PegasusConfigurator::addDomainChips( TARGETING::TYPE i_type, Prdr::LoadChipCache::flushCache(); } + + return l_errl; } void PegasusConfigurator::addChipsToPllDomain( diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H index 830d3ea08..c95b18960 100644 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H @@ -36,10 +36,8 @@ namespace PRDF { class RuleChipDomain; - -typedef std::vector< PRDF::PllDomain *> PllDomainList; +typedef std::vector< PllDomain *> PllDomainList; typedef std::vector< CHIP_CLASS *> PllChipList; - /** @brief PRD configurator for Pegasus (P8 systems) */ class PegasusConfigurator : public Configurator { @@ -63,11 +61,11 @@ class PegasusConfigurator : public Configurator /** * @brief Create the PRD system object, all chip instances, and all domain * instances. - * @return Pointer to configured system. + * @return error log handle * @note The caller of this function owns the responsiblity of deleting * the system object created. */ - virtual System * build(); + virtual errlHndl_t build(); private: // functions @@ -79,13 +77,14 @@ class PegasusConfigurator : public Configurator /** * @brief Will add all chips of a given type to a domain. - * @parm i_type The specified target type. - * @parm io_domain The associated domain. - * @parm io_pllDomains The associated PLL domain (optional for some) + * @parm i_type The specified target type. + * @parm io_domain The associated domain. + * @parm io_pllDomains The associated PLL domain (optional for some) + * @return error log handle */ - void addDomainChips( TARGETING::TYPE i_type, - RuleChipDomain * io_domain, - PllDomainList * io_pllDomains = NULL ); + errlHndl_t addDomainChips( TARGETING::TYPE i_type, + RuleChipDomain * io_domain, + PllDomainList * io_pllDomains = NULL ); /** * @brief Add chip to its Pll Domain. @@ -116,7 +115,6 @@ class PegasusConfigurator : public Configurator private: // data static CallAttnResolution noAttnResolution; - }; } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/prd_ruletable.mk b/src/usr/diag/prdf/common/prd_ruletable.mk index 2bba888c1..d0b73f539 100755 --- a/src/usr/diag/prdf/common/prd_ruletable.mk +++ b/src/usr/diag/prdf/common/prd_ruletable.mk @@ -33,6 +33,7 @@ PRDR_RULE_TABLE_TARGETS = ${PRDR_RULE_TABLE_FILES:.rule=.prf} prd_ruletable = \ prdrLoadChip.o \ prdrLoadChipCache.o \ + prdfRuleMetaData.o \ prdfRuleChip.o \ prdfGroup.o \ prdfPluginMap.o \ diff --git a/src/usr/diag/prdf/common/prdfMain_common.C b/src/usr/diag/prdf/common/prdfMain_common.C index 652577274..9b293415c 100755 --- a/src/usr/diag/prdf/common/prdfMain_common.C +++ b/src/usr/diag/prdf/common/prdfMain_common.C @@ -116,7 +116,6 @@ errlHndl_t initialize() //saved SDC and sdc errl commit, if found??? bool isSavedSdc = false; ServiceDataCollector thisSavedSdc; - RestoreAnalysis(thisSavedSdc, isSavedSdc); if (isSavedSdc) { @@ -149,11 +148,16 @@ errlHndl_t initialize() // -- finished clearing out old chip persistency (for CCM). #endif - CcAutoDeletePointer<Configurator> configuratorPtr (SystemSpecific::getConfiguratorPtr()); - systemPtr = configuratorPtr->build(); // build PRD system model + errlHndl_t l_errBuild = configuratorPtr->build();//build object model + if( NULL != l_errBuild ) + { + //there is some problem in building RuleMetaData object + g_prd_errlHndl = l_errBuild; + } + //systemPtr is populated in configurator if(systemPtr != NULL) { systemPtr->Initialize(); // Hardware initialization & start scrub @@ -161,6 +165,7 @@ errlHndl_t initialize() } else // something bad happend. { + PRDF_ERR("PRDF::initialize() failed to buid object model"); g_initialized = false; } diff --git a/src/usr/diag/prdf/test/makefile b/src/usr/diag/prdf/test/makefile index 53e894b1b..493b25718 100755 --- a/src/usr/diag/prdf/test/makefile +++ b/src/usr/diag/prdf/test/makefile @@ -64,8 +64,10 @@ TESTS = prdfTest_ABus.H \ prdfTest_Mba.H \ prdfTest_Mcs.H \ prdfTest_Proc.H \ - prdfTest_XBus.H - - + prdfTest_XBus.H \ + prdfTest_McsMciFir.H \ + prdfTest_ProcCentFir.H \ + prdfTest_ProcMbsFir.H \ + prdfTest_ProcTpLFir.H include ${ROOTPATH}/config.mk diff --git a/src/usr/diag/prdf/test/prdfTest_McsMciFir.H b/src/usr/diag/prdf/test/prdfTest_McsMciFir.H new file mode 100644 index 000000000..b5d99ca49 --- /dev/null +++ b/src/usr/diag/prdf/test/prdfTest_McsMciFir.H @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/test/prdfTest_McsMciFir.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_PRDFMCSMCIFIR_H +#define __TEST_PRDFMCSMCIFIR_H + +#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" + +class MCSMCIFIR:public CxxTest::TestSuite +{ + public: + + void TestRecoverable(void) + { + PRDS_BEGIN("MCSMCIFIR recoverable attention"); + + PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", PRDF::RECOVERABLE); + + PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}:MCS{4}",0xde310007 ); + + //GLOBAL_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001B, 0x4000000000000000); + + //TP_CHIPLET_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01040001, 0x0100000000000000); + + //MCIFIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}:MCS{4}", + 0x02011840, 0x0100000000000000); + + //MCIFIR_ACT1 + PRDS_SCR_WRITE("NODE{0}:PROC{0}:MCS{4}", + 0x02011847, 0xFFFFFFFFFFFFFFFF); + + PRDS_START_SIM(); + + PRDS_END(); + + } + +}; +#endif diff --git a/src/usr/diag/prdf/test/prdfTest_ProcCentFir.H b/src/usr/diag/prdf/test/prdfTest_ProcCentFir.H new file mode 100755 index 000000000..df4e4bd90 --- /dev/null +++ b/src/usr/diag/prdf/test/prdfTest_ProcCentFir.H @@ -0,0 +1,72 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/test/prdfTest_ProcCentFir.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_PRDFPCENTFIR_H +#define __TEST_PRDFPCENTFIR_H + +#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" + +class PCENTFIR:public CxxTest::TestSuite +{ + public: + + void TestRecoverable(void) + { + PRDS_BEGIN("PCENTFIR Recoverable attention"); + + PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", PRDF::RECOVERABLE); + + PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}",0x42410004 ); + + //GLOBAL_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001B, 0x2000000000000000); + + //PB_CHIPLET_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02040001, 0x0200000000000000); + + //PBCENTFIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02010C40, 0x0800000000000000); + + //PBCENTFIR_ACT1 + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02010C47, 0xFFFFFFFFFFFFFFFF); + + PRDS_START_SIM(); + + PRDS_END(); + + } + +}; +#endif diff --git a/src/usr/diag/prdf/test/prdfTest_ProcMbsFir.H b/src/usr/diag/prdf/test/prdfTest_ProcMbsFir.H new file mode 100755 index 000000000..061106e58 --- /dev/null +++ b/src/usr/diag/prdf/test/prdfTest_ProcMbsFir.H @@ -0,0 +1,78 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/test/prdfTest_ProcMbsFir.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_PRDFMBSFIR_H +#define __TEST_PRDFMBSFIR_H + +#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" + +class MBSFIR:public CxxTest::TestSuite +{ + public: + + void TestRecoverable(void) + { + PRDS_BEGIN("Centaur Nest MBS Recoverable attention"); + + PRDS_ERROR_ENTRY("NODE{0}:MEMBUF{4}", PRDF::RECOVERABLE); + + PRDS_EXPECTED_SIGNATURE("NODE{0}:MEMBUF{4}", 0xa5a10000); + + //GLOBAL_RE_FIR + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x570F001B, 0x2000000000000000); + + //NEST_CHIPLET_RE_FIR + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x02040001, 0x0400000000000000); + + //MBSFIR + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x02011400, 0x8000000000000000); + + //MBSFIR_ACT1 + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x02011407, 0xFFFFFFFFFFFFFFFF); + + //MBSFIR_mask + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x02011405, 0x8000000000000000); + + //MBSFIR_reset + PRDS_SCR_WRITE("NODE{0}:MEMBUF{4}", 0x02011401, 0x7FFFFFFFFFFFFFFF); + + PRDS_START_SIM(); + + PRDS_END(); + + } + +}; +#endif diff --git a/src/usr/diag/prdf/test/prdfTest_ProcTpLFir.H b/src/usr/diag/prdf/test/prdfTest_ProcTpLFir.H new file mode 100755 index 000000000..90ea08385 --- /dev/null +++ b/src/usr/diag/prdf/test/prdfTest_ProcTpLFir.H @@ -0,0 +1,72 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/test/prdfTest_ProcTpLFir.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_PRDFPTPLFIR_H +#define __TEST_PRDFPTPLFIR_H + +#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" + +class PTPLFIR:public CxxTest::TestSuite +{ + public: + + void TestRecoverable(void) + { + PRDS_BEGIN("PLL in MNFG mode"); + + PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", PRDF::RECOVERABLE); + + PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}",0x00ed0000 ); + + //GLOBAL_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001B, 0x4000000000000000); + + //TP_CHIPLET_RE_FIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01040001, 0x4000000000000000); + + //TP_LFIR + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x0104000a, 0x0002000000000000); + + //TP_LFIR_ACT1 + PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01040011, 0xFFFFFFFFFFFFFFFF); + + PRDS_START_SIM(); + + PRDS_END(); + + } + +}; +#endif diff --git a/src/usr/diag/prdf/test/prdfTest_XBus.H b/src/usr/diag/prdf/test/prdfTest_XBus.H index 50738a0b9..3a6790b04 100644 --- a/src/usr/diag/prdf/test/prdfTest_XBus.H +++ b/src/usr/diag/prdf/test/prdfTest_XBus.H @@ -59,6 +59,7 @@ class XBUSFIR:public CxxTest::TestSuite { TS_FAIL("Expected Signature Failed XBUSFIR Recoverable attention"); } + } |