summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2016-10-20 09:30:23 -0500
committerZane C. Shelley <zshelle@us.ibm.com>2016-10-21 13:18:28 -0400
commitd5246e22c2c3d4e5656821bc12ede15ac2b46b9d (patch)
tree537a7748be576f467df218120edd762bcf41f853 /src/usr
parent2e9a4e30d0f87247c425ef0ce01d678407fa2578 (diff)
downloadtalos-hostboot-d5246e22c2c3d4e5656821bc12ede15ac2b46b9d.tar.gz
talos-hostboot-d5246e22c2c3d4e5656821bc12ede15ac2b46b9d.zip
PRD: removed templates from MemSymbol class
Needed to do this to avoid templates in MemoryMru class. Change-Id: I2e82748be515dc0f7adb473312f32d91cfc20427 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31547 Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31624 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C64
-rwxr-xr-xsrc/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H34
2 files changed, 46 insertions, 52 deletions
diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C
index 91553ad9c..86316ca02 100755
--- a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C
+++ b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.C
@@ -25,6 +25,7 @@
#include <prdfMemSymbol.H>
#include <prdfTrace.H>
+#include <prdfParserUtils.H>
using namespace TARGETING;
@@ -53,38 +54,22 @@ static const uint8_t symbol2Galois[] =
// class MemSymbol
//##############################################################################
-template <>
-MemSymbol<TYPE_MBA> MemSymbol<TYPE_MBA>::fromGalois( TargetHandle_t i_trgt,
- const MemRank & i_rank,
- uint8_t i_galois,
- uint8_t i_mask )
+MemSymbol::MemSymbol( TARGETING::TargetHandle_t i_trgt, const MemRank & i_rank,
+ uint8_t i_symbol, uint8_t i_pins ) :
+ iv_trgt(i_trgt), iv_rank(i_rank), iv_symbol(i_symbol),
+ iv_pins(i_pins), iv_isDramSpared(false), iv_isEccSpared(false)
{
- // Get symbol from Galois field.
- uint8_t symbol = SYMBOLS_PER_RANK;
- for ( uint32_t i = 0; i < SYMBOLS_PER_RANK; i++ )
- {
- if ( symbol2Galois[i] == i_galois )
- {
- symbol = i;
- break;
- }
- }
-
- // Get pins from mask (2 pins for MBA).
- uint8_t pins = NO_SYMBOL_DQS;
- if ( 0 != (i_mask & 0xaa) ) pins |= EVEN_SYMBOL_DQ;
- if ( 0 != (i_mask & 0x55) ) pins |= ODD_SYMBOL_DQ;
-
- return MemSymbol<TYPE_MBA>( i_trgt, i_rank, symbol, pins );
+ PRDF_ASSERT( NULL != i_trgt );
+ PRDF_ASSERT( TYPE_MBA == getTargetType(i_trgt) ||
+ TYPE_MCA == getTargetType(i_trgt) );
+ PRDF_ASSERT( i_symbol < SYMBOLS_PER_RANK );
+ PRDF_ASSERT( i_pins <= CEN_SYMBOL::BOTH_SYMBOL_DQS );
}
//------------------------------------------------------------------------------
-template <>
-MemSymbol<TYPE_MCA> MemSymbol<TYPE_MCA>::fromGalois( TargetHandle_t i_trgt,
- const MemRank & i_rank,
- uint8_t i_galois,
- uint8_t i_mask )
+MemSymbol MemSymbol::fromGalois( TargetHandle_t i_trgt, const MemRank & i_rank,
+ uint8_t i_galois, uint8_t i_mask )
{
// Get symbol from Galois field.
uint8_t symbol = SYMBOLS_PER_RANK;
@@ -97,11 +82,30 @@ MemSymbol<TYPE_MCA> MemSymbol<TYPE_MCA>::fromGalois( TargetHandle_t i_trgt,
}
}
- // Get pins from mask (1 pin for MCA).
+ // Get pins from mask.
uint8_t pins = NO_SYMBOL_DQS;
- if ( 0 != (i_mask & 0xff) ) pins |= ODD_SYMBOL_DQ;
+ if ( TYPE_MBA == getTargetType(i_trgt) )
+ {
+ // 2 pins for MBA.
+ if ( 0 != (i_mask & 0xaa) ) pins |= EVEN_SYMBOL_DQ;
+ if ( 0 != (i_mask & 0x55) ) pins |= ODD_SYMBOL_DQ;
+ }
+ else
+ {
+ // 1 pin for MCA.
+ if ( 0 != (i_mask & 0xff) ) pins |= ODD_SYMBOL_DQ;
+ }
- return MemSymbol<TYPE_MCA>( i_trgt, i_rank, symbol, pins );
+ return MemSymbol( i_trgt, i_rank, symbol, pins );
}
+//------------------------------------------------------------------------------
+
+uint8_t MemSymbol::getDq() const
+{
+ return TYPE_MBA == getTargetType(iv_trgt) ? symbol2Dq<TYPE_MBA>(iv_symbol)
+ : symbol2Dq<TYPE_MCA>(iv_symbol);
+}
+
+
} // 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 3261cef8a..682b87bb3 100755
--- a/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H
+++ b/src/usr/diag/prdf/common/plat/mem/prdfMemSymbol.H
@@ -32,7 +32,6 @@
#include <prdfMemAddress.H>
#include <prdfMemConst.H>
-#include <prdfParserUtils.H>
#include <prdfPlatServices.H>
//##############################################################################
@@ -45,7 +44,6 @@ namespace PRDF
/**
* @brief Container for a memory symbol.
*/
-template <TARGETING::TYPE T>
class MemSymbol
{
@@ -63,46 +61,38 @@ class MemSymbol
/** @brief Constructor from components. Used only by the static initializer
* functions below. Guarantees the symbol is valid or asserts. */
MemSymbol( TARGETING::TargetHandle_t i_trgt, const MemRank & i_rank,
- uint8_t i_symbol, uint8_t i_pins ) :
- iv_trgt(i_trgt), iv_rank(i_rank), iv_symbol(i_symbol),
- iv_pins(i_pins), iv_isDramSpared(false), iv_isEccSpared(false)
- {
- PRDF_ASSERT( NULL != i_trgt );
- PRDF_ASSERT( T == PlatServices::getTargetType(i_trgt) );
- PRDF_ASSERT( i_symbol < SYMBOLS_PER_RANK );
- PRDF_ASSERT( i_pins <= CEN_SYMBOL::BOTH_SYMBOL_DQS );
- }
+ uint8_t i_symbol, uint8_t i_pins );
public: // functions
/**
* @brief Creates a MemSymbol from a symbol.
- * @param i_trgt The target.
+ * @param i_trgt MBA or MCA target.
* @param i_rank The rank this symbol is on.
* @param i_symbol The input symbol.
* @param i_pins See enum DqMask.
* @return A MemSymbol. Must call isValid() to determine if the function was
* successful in creating a valid object.
*/
- static MemSymbol<T> fromSymbol( TARGETING::TargetHandle_t i_trgt,
- const MemRank & i_rank, uint8_t i_symbol,
- uint8_t i_pins = CEN_SYMBOL::NO_SYMBOL_DQS )
+ static MemSymbol fromSymbol( TARGETING::TargetHandle_t i_trgt,
+ const MemRank & i_rank, uint8_t i_symbol,
+ uint8_t i_pins = CEN_SYMBOL::NO_SYMBOL_DQS )
{
return MemSymbol ( i_trgt, i_rank, i_symbol, i_pins );
}
/**
* @brief Creates a MemSymbol from a Galois field.
- * @param i_trgt The target.
+ * @param i_trgt MBA or MCA target.
* @param i_rank The rank this symbol is on.
* @param i_galois The Galois field.
* @param i_mask The bit mask.
* @return A MemSymbol. Must call isValid() to determine if the function was
* successful in creating a valid object.
*/
- static MemSymbol<T> fromGalois( TARGETING::TargetHandle_t i_trgt,
- const MemRank & i_rank, uint8_t i_galois,
- uint8_t i_mask = 0 );
+ static MemSymbol fromGalois( TARGETING::TargetHandle_t i_trgt,
+ const MemRank & i_rank, uint8_t i_galois,
+ uint8_t i_mask = 0 );
/** @return true if symbol is within the valid range, false otherwise. */
bool isValid() const { return iv_symbol < SYMBOLS_PER_RANK; }
@@ -114,7 +104,7 @@ class MemSymbol
uint8_t getPins() const { return iv_pins; }
/** @return The the first DQ of this symbol. */
- uint8_t getDq() const { return PARSERUTILS::symbol2Dq<T>(iv_symbol); }
+ uint8_t getDq() const;
/** @return rank associated with this symbol. */
MemRank getRank() const { return iv_rank; };
@@ -138,7 +128,7 @@ class MemSymbol
* @note Compares against iv_symbol and iv_rank. There is currently no
* need to compare against iv_trgt.
*/
- bool operator < ( const MemSymbol<T> & i_symbol ) const
+ bool operator < ( const MemSymbol & i_symbol ) const
{
return ( (iv_symbol < i_symbol.iv_symbol) ||
( (iv_symbol == i_symbol.iv_symbol) &&
@@ -152,7 +142,7 @@ class MemSymbol
* @note Compares against iv_symbol and iv_rank. There is currently no
* need to compare against iv_trgt.
*/
- bool operator == ( const MemSymbol<T> & i_symbol ) const
+ bool operator == ( const MemSymbol & i_symbol ) const
{
return ( (iv_symbol == i_symbol.iv_symbol) &&
(iv_rank == i_symbol.iv_rank ) );
OpenPOWER on IntegriCloud