From ee946e0c40f8274fab76da7db28a5807c1c99239 Mon Sep 17 00:00:00 2001 From: Zane Shelley Date: Wed, 15 Feb 2017 09:23:20 -0600 Subject: PRD: add support to read memory NCE/TCE symbols from hardware Change-Id: I156229b4f40b73e1b36e2849ecdc6e37dd232abe RTC: 165382 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36751 Tested-by: Jenkins Server Reviewed-by: Caleb N. Palmer Reviewed-by: Benjamin J. Weisenbeck Reviewed-by: Zane C. Shelley Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37013 Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins --- src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C | 125 +++++++++++++++++++++ src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H | 19 ++++ .../diag/prdf/common/plat/p9/p9_mcbist_regs.rule | 18 +++ 3 files changed, 162 insertions(+) (limited to 'src/usr/diag/prdf/common') diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C index 6c8226af3..43e797b5b 100755 --- a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C +++ b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C @@ -24,7 +24,12 @@ /* IBM_PROLOG_END_TAG */ #include + +// Framework includes +#include #include + +// Parser includes #include using namespace TARGETING; @@ -146,6 +151,126 @@ uint8_t MemSymbol::getDramPins() const return iv_pins << (((spd - 1) - (iv_symbol % spd)) * dps); } +//------------------------------------------------------------------------------ +// Symbol Accessor Functions +//------------------------------------------------------------------------------ + +template<> +uint32_t getMemReadSymbol( ExtensibleChip * i_chip, + const MemRank & i_rank, + MemSymbol & o_symbol, bool i_isTce ) +{ + #define PRDF_FUNC "[getMemReadSymbol] " + + // Check parameters + PRDF_ASSERT( nullptr != i_chip ); + PRDF_ASSERT( TYPE_MCA == i_chip->getType() ); + + uint32_t o_rc = SUCCESS; + + do + { + // Get the NCE/TCE galois and mask from hardware. + ExtensibleChip * mcbChip = getConnectedParent( i_chip, TYPE_MCBIST ); + + uint8_t port = i_chip->getPos() % MAX_MCA_PER_MCBIST; // 0,1,2,3 + uint8_t mcsRelMcb = port / MAX_MCA_PER_MCS; // 0,1 + uint8_t mcaRelMcs = port % MAX_MCA_PER_MCS; // 0,1 + + const char * reg_str = (0 == mcsRelMcb) ? "MBSEVR0" : "MBSEVR1"; + + SCAN_COMM_REGISTER_CLASS * reg = mcbChip->getRegister(reg_str); + o_rc = reg->Read(); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "Read() failed on %s: mcbChip=0x%08x", reg_str, + mcbChip->getHuid() ); + break; + } + + uint32_t bitPos = (mcaRelMcs * 32) + (i_isTce ? 16 : 0); + + uint8_t galois = reg->GetBitFieldJustified( bitPos, 8 ); + uint8_t mask = reg->GetBitFieldJustified( bitPos + 8, 8 ); + + // Get the NCE/TCE symbol. + o_symbol = MemSymbol::fromGalois( i_chip->getTrgt(), i_rank, galois, + mask ); + if ( !o_symbol.isValid() ) + { + PRDF_ERR( PRDF_FUNC "fromGalois(0x%08x,m%ds%d,0x%02x,0x%02x) " + "failed", i_chip->getHuid(), i_rank.getMaster(), + i_rank.getSlave(), galois, mask ); + o_rc = FAIL; + break; + } + + // TODO: RTC 157888 Check if the symbol is on a spare DRAM. + + } while (0); + + return o_rc; + + #undef PRDF_FUNC +} + +//------------------------------------------------------------------------------ + +template<> +uint32_t getMemReadSymbol( ExtensibleChip * i_chip, + const MemRank & i_rank, + MemSymbol & o_symbol, bool i_isTce ) +{ + #define PRDF_FUNC "[getMemReadSymbol] " + + // Check parameters + PRDF_ASSERT( nullptr != i_chip ); + PRDF_ASSERT( TYPE_MBA == i_chip->getType() ); + PRDF_ASSERT( !i_isTce ); // TCEs do not exist on Centaur + + uint32_t o_rc = SUCCESS; + + do + { + // Get the NCE galois and mask from hardware. + ExtensibleChip * membChip = getConnectedParent( i_chip, TYPE_MEMBUF ); + + const char * reg_str = (0 == i_chip->getPos()) ? "MBA0_MBSEVR" + : "MBA1_MBSEVR"; + + SCAN_COMM_REGISTER_CLASS * reg = membChip->getRegister(reg_str); + o_rc = reg->Read(); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "Read() failed on %s: membChip=0x%08x", reg_str, + membChip->getHuid() ); + break; + } + + uint8_t galois = reg->GetBitFieldJustified( 40, 8 ); + uint8_t mask = reg->GetBitFieldJustified( 32, 8 ); + + // Get the NCE symbol. + o_symbol = MemSymbol::fromGalois( i_chip->getTrgt(), i_rank, galois, + mask ); + if ( !o_symbol.isValid() ) + { + PRDF_ERR( PRDF_FUNC "fromGalois(0x%08x,m%ds%d,0x%02x,0x%02x) " + "failed", i_chip->getHuid(), i_rank.getMaster(), + i_rank.getSlave(), galois, mask ); + o_rc = FAIL; + break; + } + + // TODO: RTC 157888 Check if the symbol is on a spare DRAM. + + } while (0); + + return o_rc; + + #undef PRDF_FUNC +} + //------------------------------------------------------------------------------ } // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H index 97ef1e80a..4b03f4cd2 100755 --- a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H +++ b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H @@ -41,6 +41,8 @@ namespace PRDF { +class ExtensibleChip; + /** * @brief Container for a memory symbol. */ @@ -172,6 +174,23 @@ class MemSymbol bool iv_isEccSpared = false; ///< TRUE if symbol resides on ECC spare. }; +//------------------------------------------------------------------------------ +// Symbol Accessor Functions +//------------------------------------------------------------------------------ + +/** + * @brief Reads the memory NCE/TCE vector trap register from hardware. + * @param i_chip MCA or MBA. + * @param i_rank The rank this symbol is on. + * @param o_symbol The returned symbol. + * @param i_isTce Only applies to MCA. True if the TCE symbol is wanted. False + * if the NCE symbol is wanted (default). + * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. + */ +template +uint32_t getMemReadSymbol( ExtensibleChip * i_chip, const MemRank & i_rank, + MemSymbol & o_symbol, bool i_isTce = false ); + } // end namespace PRDF #endif // __prdfMemSymbol_H diff --git a/src/usr/diag/prdf/common/plat/p9/p9_mcbist_regs.rule b/src/usr/diag/prdf/common/plat/p9/p9_mcbist_regs.rule index 60973d342..e93196f95 100644 --- a/src/usr/diag/prdf/common/plat/p9/p9_mcbist_regs.rule +++ b/src/usr/diag/prdf/common/plat/p9/p9_mcbist_regs.rule @@ -181,6 +181,24 @@ capture group default; }; + ########################################################################### + # P9 MCBIST Error Vector Trap registers + ########################################################################### + + register MBSEVR0 + { + name "P9 MBS Error Vector Trap reg 0 (port 0 and 1)"; + scomaddr 0x0701237E; + capture group default; + }; + + register MBSEVR1 + { + name "P9 MBS Error Vector Trap reg 1 (port 2 and 3)"; + scomaddr 0x0701237F; + capture group default; + }; + ########################################################################### # P9 MCBIST command registers ########################################################################### -- cgit v1.2.1