Skip to content

Commit

Permalink
PRD: add support to read memory NCE/TCE symbols from hardware
Browse files Browse the repository at this point in the history
Change-Id: I156229b4f40b73e1b36e2849ecdc6e37dd232abe
RTC: 165382
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36751
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37013
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
  • Loading branch information
zane131 committed Feb 27, 2017
1 parent 0de8391 commit ee946e0
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 0 deletions.
125 changes: 125 additions & 0 deletions src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C
Expand Up @@ -24,7 +24,12 @@
/* IBM_PROLOG_END_TAG */

#include <prdfMemSymbol.H>

// Framework includes
#include <prdfExtensibleChip.H>
#include <prdfTrace.H>

// Parser includes
#include <prdfParserUtils.H>

using namespace TARGETING;
Expand Down Expand Up @@ -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<TYPE_MCA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
MemSymbol & o_symbol, bool i_isTce )
{
#define PRDF_FUNC "[getMemReadSymbol<TYPE_MBA>] "

// 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<TYPE_MBA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
MemSymbol & o_symbol, bool i_isTce )
{
#define PRDF_FUNC "[getMemReadSymbol<TYPE_MBA>] "

// 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
19 changes: 19 additions & 0 deletions src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H
Expand Up @@ -41,6 +41,8 @@
namespace PRDF
{

class ExtensibleChip;

/**
* @brief Container for a memory symbol.
*/
Expand Down Expand Up @@ -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<TARGETING::TYPE T>
uint32_t getMemReadSymbol( ExtensibleChip * i_chip, const MemRank & i_rank,
MemSymbol & o_symbol, bool i_isTce = false );

} // end namespace PRDF

#endif // __prdfMemSymbol_H
Expand Down
18 changes: 18 additions & 0 deletions src/usr/diag/prdf/common/plat/p9/p9_mcbist_regs.rule
Expand Up @@ -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
###########################################################################
Expand Down

0 comments on commit ee946e0

Please sign in to comment.