From 4b7ee363259204d07076d93a89d49abb19d4f166 Mon Sep 17 00:00:00 2001 From: Zane Shelley Date: Thu, 17 May 2018 21:57:07 -0500 Subject: PRD: Update MemTdCtlr::initialize() for Centaur Change-Id: I8d80af3f401af0728fa41585c33b8ff900cfae39 RTC: 192638 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59060 Reviewed-by: Zane C. Shelley Tested-by: Jenkins Server Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59230 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins --- .../common/plat/pegasus/prdfCenMbaTdCtlr_common.C | 47 --- .../prdf/common/plat/pegasus/prdfCenMbaTdCtlr_rt.C | 131 -------- src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C | 329 ++++++++++++--------- 3 files changed, 187 insertions(+), 320 deletions(-) (limited to 'src/usr') diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_common.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_common.C index 0a30244e0..aa27c6797 100644 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_common.C +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_common.C @@ -43,53 +43,6 @@ using namespace PlatServices; //------------------------------------------------------------------------------ -int32_t CenMbaTdCtlrCommon::initialize() -{ - #define PRDF_FUNC "[CenMbaTdCtlrCommon::initialize] " - - int32_t o_rc = SUCCESS; - - do - { - // Set iv_mbaTrgt - iv_mbaTrgt = iv_mbaChip->GetChipHandle(); - - // Validate iv_mbaChip. - if ( TYPE_MBA != getTargetType(iv_mbaTrgt) ) - { - PRDF_ERR( PRDF_FUNC "iv_mbaChip is not TYPE_MBA" ); - o_rc = FAIL; break; - } - - // Set iv_membChip. - CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip ); - iv_membChip = mbadb->getMembChip(); - if ( NULL == iv_membChip ) - { - PRDF_ERR( PRDF_FUNC "getMembChip() failed" ); - o_rc = FAIL; break; - } - - // Set iv_mbaPos. - iv_mbaPos = getTargetPosition( iv_mbaTrgt ); - if ( MAX_MBA_PER_MEMBUF <= iv_mbaPos ) - { - PRDF_ERR( PRDF_FUNC "iv_mbaPos=%d is invalid", iv_mbaPos ); - o_rc = FAIL; break; - } - - // Set iv_x4Dimm. - iv_x4Dimm = isDramWidthX4(iv_mbaTrgt); - - } while (0); - - return o_rc; - - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - bool CenMbaTdCtlrCommon::isInTdMode() { return ( (NO_OP != iv_tdState) && (MAX_TD_STATE > iv_tdState) ); diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_rt.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_rt.C index 6e69f8ac5..a5d3382eb 100755 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_rt.C +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaTdCtlr_rt.C @@ -337,137 +337,6 @@ int32_t CenMbaTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc, // Private Functions //------------------------------------------------------------------------------ -int32_t CenMbaTdCtlr::initialize() -{ - #define PRDF_FUNC "[CenMbaTdCtlr::initialize] " - - int32_t o_rc = SUCCESS; - - do - { - if ( iv_initialized ) break; // nothing to do - - // Initialize common instance variables - o_rc = CenMbaTdCtlrCommon::initialize(); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "CenMbaTdCtlrCommon::initialize() failed" ); - break; - } - - // Initialize the list of master ranks. - o_rc = iv_masterRanks.initialize( iv_mbaTrgt ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "TdRankList::initialize() failed" ); - break; - } - - // Unmask the fetch attentions just in case there were masked during a - // TD procedure prior to a reset/reload. - o_rc = unmaskFetchAttns(); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "unmaskFetchAttns() failed" ); - break; - } - - //---------------------------------------------------------------------- - // Add any unverified chip marks to the TD queue - //---------------------------------------------------------------------- - - // Will want to clear the MPE attention for any unverified chip marks. - // This is so we don't get redundant attentions for chip marks that are - // already in the queue. This is reset/reload safe because initialize() - // will be called again and we can redetect the unverified chip marks. - - const char * reg_str = (0 == iv_mbaPos) ? "MBSECCFIR_0_AND" - : "MBSECCFIR_1_AND"; - SCAN_COMM_REGISTER_CLASS * firand = iv_membChip->getRegister( reg_str ); - firand->setAllBits(); - - // Search all configured ranks for unverfied chip marks. - TdRankList::List rankList = iv_masterRanks.getList(); - for ( TdRankList::ListItr it = rankList.begin(); - it != rankList.end(); it++ ) - { - CenMark markData; - CenRank rank ( it->rank ); - - // Get mark store from hardware. - o_rc = mssGetMarkStore( iv_mbaTrgt, rank, markData ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "mssGetMarkStore() failed." ); - o_rc = FAIL; break; - } - - // Move on to the next rank if there is no chip mark in hardware. - if ( !markData.getCM().isValid() ) continue; - - // Check if chip mark also present in VPD. - CenDqBitmap bitmap; - o_rc = getBadDqBitmap( iv_mbaTrgt, rank, bitmap ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "getBadDqBitmap() failed" ); - break; - } - - bool vpdCM; - o_rc = bitmap.isChipMark( markData.getCM(), vpdCM ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "isChipMark() failed" ); - break; - } - - if ( !vpdCM ) - { - PRDF_INF( PRDF_FUNC "Adding CM to queue: huid=0x%08x rank=%d", - iv_mbaChip->GetId(), rank.getMaster() ); - - // Chip mark is not present in VPD. Add it to queue. - o_rc = addTdQueueEntryVCM( rank ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "addTdQueueEntryVCM() failed" ); - break; - } - - // Clear MPE bits for this rank. - firand->ClearBit( 0 + rank.getMaster() ); // fetch - firand->ClearBit( 20 + rank.getMaster() ); // scrub - } - } - if ( SUCCESS != o_rc ) break; - - if ( !iv_queue.empty() ) - { - // Unverified chip marks found so clear the FIR bits. - o_rc = firand->Write(); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "Write() failed on %s", reg_str ); - break; - } - } - - //---------------------------------------------------------------------- - // At this point, the TD controller is initialized. - //---------------------------------------------------------------------- - - iv_initialized = true; - - } while (0); - - return o_rc; - - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - int32_t CenMbaTdCtlr::analyzeVcmPhase1( STEP_CODE_DATA_STRUCT & io_sc, const CenAddr & i_stopAddr, const CenAddr & i_endAddr ) diff --git a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C index 052d6e0da..0937a5bf8 100644 --- a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C +++ b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C @@ -35,6 +35,8 @@ // Platform includes #include +#include +#include #include #include #include @@ -241,152 +243,22 @@ uint32_t MemTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc ) } while (0); - return o_rc; - - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - -template <> -uint32_t MemTdCtlr::initialize() -{ - #define PRDF_FUNC "[MemTdCtlr::initialize] " - - uint32_t o_rc = SUCCESS; - - do - { - if ( iv_initialized ) break; // nothing to do + // Gather capture data even if something failed above. + collectStateCaptureData( io_sc, TD_CTLR_DATA::END ); + MemCaptureData::addEccData( iv_chip, io_sc ); - // Add any unverified chip marks to the TD queue. - - std::vector vectorList = iv_rankList.getList(); - - for ( auto & entry : vectorList ) - { - ExtensibleChip * mbaChip = entry.getChip(); - MemRank rank = entry.getRank(); - - // Call readChipMark to get MemMark. - MemMark chipMark; - o_rc = MarkStore::readChipMark( mbaChip, rank, chipMark ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "readChipMark(0x%08x,%d) " - "failed", mbaChip->getHuid(), rank.getMaster() ); - break; - } - - if ( !chipMark.isValid() ) continue; // no chip mark present - - // Get the DQ Bitmap data. - TargetHandle_t mbaTrgt = mbaChip->GetChipHandle(); - MemDqBitmap dqBitmap; - - o_rc = getBadDqBitmap(mbaTrgt, rank, dqBitmap); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "getBadDqBitmap" - "(0x%08x, %d)", getHuid(mbaTrgt), rank.getMaster() ); - break; - } - - // Check if the chip mark is verified or not. - bool cmVerified = false; - o_rc = dqBitmap.isChipMark( chipMark.getSymbol(), cmVerified ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "dqBitmap.isChipMark() failed." ); - break; - } - - // If the chip mark is unverified, add a VcmEvent to the TD queue - if ( !cmVerified ) - { - TdEntry * vcmEntry = new VcmEvent( mbaChip, rank, - chipMark ); - iv_queue.push( vcmEntry ); - } - } - - // At this point, the TD controller is initialized. - iv_initialized = true; - }while(0); - - return o_rc; - - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - -template <> -uint32_t MemTdCtlr::initialize() -{ - #define PRDF_FUNC "[MemTdCtlr::initialize] " - - uint32_t o_rc = SUCCESS; - - do + if ( SUCCESS != o_rc ) { - if ( iv_initialized ) break; // nothing to do - - // Add any unverified chip marks to the TD queue. - - std::vector vectorList = iv_rankList.getList(); - - for ( auto & entry : vectorList ) - { - ExtensibleChip * mcaChip = entry.getChip(); - MemRank rank = entry.getRank(); - - // Call readChipMark to get MemMark. - MemMark chipMark; - o_rc = MarkStore::readChipMark( mcaChip, rank, chipMark ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "readChipMark(0x%08x,%d) " - "failed", mcaChip->getHuid(), rank.getMaster() ); - break; - } - - if ( !chipMark.isValid() ) continue; // no chip mark present - - // Get the DQ Bitmap data. - TargetHandle_t mcaTrgt = mcaChip->GetChipHandle(); - MemDqBitmap dqBitmap; - - o_rc = getBadDqBitmap(mcaTrgt, rank, dqBitmap); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "getBadDqBitmap" - "(0x%08x, %d)", getHuid(mcaTrgt), rank.getMaster() ); - break; - } - - // Check if the chip mark is verified or not. - bool cmVerified = false; - o_rc = dqBitmap.isChipMark( chipMark.getSymbol(), cmVerified ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "dqBitmap.isChipMark() failed." ); - break; - } - - // If the chip mark is unverified, add a VcmEvent to the TD queue - if ( !cmVerified ) - { - TdEntry * vcmEntry = new VcmEvent( mcaChip, rank, - chipMark ); - iv_queue.push( vcmEntry ); - } - } + PRDF_ERR( PRDF_FUNC "Failed on 0x%08x", iv_chip->getHuid() ); - // At this point, the TD controller is initialized. - iv_initialized = true; - }while(0); + // Change signature indicating there was an error in analysis. + io_sc.service_data->setSignature( iv_chip->getHuid(), + PRDFSIG_CmdComplete_ERROR ); + // Something definitely failed, so callout 2nd level support. + io_sc.service_data->SetCallout( LEVEL2_SUPPORT, MRU_HIGH ); + io_sc.service_data->setServiceCall(); + } return o_rc; @@ -1000,6 +872,179 @@ uint32_t MemTdCtlr::unmaskEccAttns() //------------------------------------------------------------------------------ +template +SCAN_COMM_REGISTER_CLASS * __getEccFirAnd( ExtensibleChip * i_chip ); + +template<> +SCAN_COMM_REGISTER_CLASS * __getEccFirAnd( ExtensibleChip * i_chip ) +{ + return i_chip->getRegister( "MCAECCFIR_AND" ); +} + +template<> +SCAN_COMM_REGISTER_CLASS * __getEccFirAnd( ExtensibleChip * i_chip ) +{ + ExtensibleChip * membChip = getConnectedParent( i_chip, TYPE_MEMBUF ); + return membChip->getRegister( (0 == i_chip->getPos()) ? "MBSECCFIR_0_AND" + : "MBSECCFIR_1_AND" ); +} + +template +uint32_t __findChipMarks( TdQueue & o_queue, TdRankList & i_rankList ) +{ + #define PRDF_FUNC "[__findChipMarks] " + + uint32_t o_rc = SUCCESS; + + for ( auto & entry : i_rankList.getList() ) + { + ExtensibleChip * chip = entry.getChip(); + MemRank rank = entry.getRank(); + + // Call readChipMark to get MemMark. + MemMark chipMark; + o_rc = MarkStore::readChipMark( chip, rank, chipMark ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "readChipMark(0x%08x,0x%02x) failed", + chip->getHuid(), rank.getKey() ); + break; + } + + if ( !chipMark.isValid() ) continue; // no chip mark present + + // Get the DQ Bitmap data. + MemDqBitmap dqBitmap; + o_rc = getBadDqBitmap( chip->getTrgt(), rank, dqBitmap ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "getBadDqBitmap(0x%08x,0x%02x)", + chip->getHuid(), rank.getKey() ); + break; + } + + // Check if the chip mark is verified or not. + bool cmVerified = false; + o_rc = dqBitmap.isChipMark( chipMark.getSymbol(), cmVerified ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "dqBitmap.isChipMark() failed on 0x%08x " + "0x%02x", chip->getHuid(), rank.getKey() ); + break; + } + + // If the chip mark is unverified, add a VcmEvent to the TD queue. + if ( !cmVerified ) + { + // Chip mark is not present in VPD. Add it to queue. + o_queue.push( new VcmEvent(chip, rank, chipMark) ); + + // We will want to clear the MPE attention for the unverified chip + // mark so we don't get any redundant attentions for chip marks that + // are already in the queue. This is reset/reload safe because + // initialize() will be called again and we can redetect the + // unverified chip marks. + SCAN_COMM_REGISTER_CLASS * reg = __getEccFirAnd( chip ); + reg->setAllBits(); + reg->ClearBit( 0 + rank.getMaster() ); // fetch + reg->ClearBit( 20 + rank.getMaster() ); // scrub + o_rc = reg->Write(); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "Write() failed on ECC FIR AND: 0x%08x", + chip->getHuid() ); + break; + } + } + } + + return o_rc; + + #undef PRDF_FUNC +} + +template<> +uint32_t MemTdCtlr::initialize() +{ + #define PRDF_FUNC "[MemTdCtlr::initialize] " + + uint32_t o_rc = SUCCESS; + + do + { + if ( iv_initialized ) break; // nothing to do + + // Unmask the fetch attentions just in case there were masked during a + // TD procedure prior to a reset/reload. + o_rc = unmaskEccAttns(); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "unmaskEccAttns() failed" ); + break; + } + + // Find all unverified chip marks. + o_rc = __findChipMarks( iv_queue, + iv_rankList ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "__findChipMarks() failed on 0x%08x", + iv_chip->getHuid() ); + break; + } + + // At this point, the TD controller is initialized. + iv_initialized = true; + + } while (0); + + return o_rc; + + #undef PRDF_FUNC +} + +template<> +uint32_t MemTdCtlr::initialize() +{ + #define PRDF_FUNC "[MemTdCtlr::initialize] " + + uint32_t o_rc = SUCCESS; + + do + { + if ( iv_initialized ) break; // nothing to do + + // Unmask the fetch attentions just in case there were masked during a + // TD procedure prior to a reset/reload. + o_rc = unmaskEccAttns(); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "unmaskEccAttns() failed" ); + break; + } + + // Find all unverified chip marks. + o_rc = __findChipMarks( iv_queue, + iv_rankList ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "__findChipMarks() failed on 0x%08x", + iv_chip->getHuid() ); + break; + } + + // At this point, the TD controller is initialized. + iv_initialized = true; + + } while (0); + + return o_rc; + + #undef PRDF_FUNC +} + +//------------------------------------------------------------------------------ + template<> uint32_t MemTdCtlr::handleRrFo() { -- cgit v1.2.1