diff options
Diffstat (limited to 'src/usr/diag/prdf/common/plugins')
-rw-r--r-- | src/usr/diag/prdf/common/plugins/plugins.mk | 5 | ||||
-rw-r--r-- | src/usr/diag/prdf/common/plugins/prdfCenLogParse.C | 53 | ||||
-rw-r--r-- | src/usr/diag/prdf/common/plugins/prdfParserUtils.C | 128 | ||||
-rw-r--r-- | src/usr/diag/prdf/common/plugins/prdfParserUtils.H | 99 |
4 files changed, 232 insertions, 53 deletions
diff --git a/src/usr/diag/prdf/common/plugins/plugins.mk b/src/usr/diag/prdf/common/plugins/plugins.mk index a3be46892..28d91752a 100644 --- a/src/usr/diag/prdf/common/plugins/plugins.mk +++ b/src/usr/diag/prdf/common/plugins/plugins.mk @@ -5,7 +5,7 @@ # # IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2004,2013 +# COPYRIGHT International Business Machines Corp. 2004,2014 # # p1 # @@ -33,7 +33,8 @@ LIBRARY_OFILES += \ prdfLogParse.o \ prdfLogParse_common.o \ prdfCenLogParse.o \ - prdrErrlPluginsSupt.o + prdrErrlPluginsSupt.o \ + prdfParserUtils.o LIBFLAGS = -Efips/lib diff --git a/src/usr/diag/prdf/common/plugins/prdfCenLogParse.C b/src/usr/diag/prdf/common/plugins/prdfCenLogParse.C index e6c7c220d..1413b1ef8 100644 --- a/src/usr/diag/prdf/common/plugins/prdfCenLogParse.C +++ b/src/usr/diag/prdf/common/plugins/prdfCenLogParse.C @@ -34,6 +34,7 @@ #include <prdfDramRepairUsrData.H> #include <prdfMemoryMruData.H> #include <prdfParserEnums.H> +#include <prdfParserUtils.H> namespace PRDF { @@ -46,6 +47,7 @@ namespace FSP { using namespace PARSER; +using namespace PARSERUTILS; using namespace MemoryMruData; using namespace CEN_SYMBOL; @@ -1325,57 +1327,6 @@ int32_t getDramSiteInfo( uint8_t i_cardType, uint8_t i_mbaPos, return o_rc; } -//############################################################################## -// Support functions for translating between symbol, DQ, and DRAM index. -// TODO: RTC 99972 - These functions are copies of functions in the CenSymbol -// class. Need to create common util functions that are available for both -// the functional code and the error log plugin code. -//############################################################################## - -uint8_t symbol2CenDq( uint8_t i_symbol ) -{ - uint8_t cenDq = DQS_PER_DIMM; - - if ( SYMBOLS_PER_RANK > i_symbol ) - { - if ( 8 > i_symbol ) - cenDq = ( ((3 - (i_symbol % 4)) * 2) + 64 ); - else - cenDq = ( (31 - (((i_symbol - 8) % 32))) * 2 ); - } - - return cenDq; -} - -//------------------------------------------------------------------------------ - -uint8_t symbol2PortSlct( uint8_t i_symbol ) -{ - uint8_t portSlct = PORT_SLCT_PER_MBA; - - if ( SYMBOLS_PER_RANK > i_symbol ) - { - portSlct = ( ((i_symbol <= 3) || ((8 <= i_symbol) && (i_symbol <= 39))) - ? 1 : 0 ); - } - - return portSlct; -} - -//------------------------------------------------------------------------------ - -uint8_t dram2Symbol( uint8_t i_dram, bool i_isX4Dram ) -{ - const uint8_t dramsPerRank = i_isX4Dram ? X4DRAMS_PER_RANK - : X8DRAMS_PER_RANK; - - const uint8_t symbolsPerDram = i_isX4Dram ? SYMBOLS_PER_X4DRAM - : SYMBOLS_PER_X8DRAM; - - return (dramsPerRank > i_dram) ? (i_dram * symbolsPerDram) - : SYMBOLS_PER_RANK; -} - //------------------------------------------------------------------------------ // Returns the symbol 0-71, or 0-1 if ECC spared. diff --git a/src/usr/diag/prdf/common/plugins/prdfParserUtils.C b/src/usr/diag/prdf/common/plugins/prdfParserUtils.C new file mode 100644 index 000000000..d504b190c --- /dev/null +++ b/src/usr/diag/prdf/common/plugins/prdfParserUtils.C @@ -0,0 +1,128 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plugins/prdfParserUtils.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ + +#include <prdfParserUtils.H> +#include <prdfCenConst.H> + +namespace PRDF +{ + +#ifdef PRDF_HOSTBOOT_ERRL_PLUGIN +namespace HOSTBOOT +{ +#endif + +#ifdef PRDF_FSP_ERRL_PLUGIN +namespace FSP +{ +#endif + +namespace PARSERUTILS +{ + +uint8_t symbol2CenDq( uint8_t i_symbol ) +{ + uint8_t cenDq = DQS_PER_DIMM; + + if ( SYMBOLS_PER_RANK > i_symbol ) + { + if ( 8 > i_symbol ) + cenDq = ( ((3 - (i_symbol % 4)) * 2) + 64 ); + else + cenDq = ( (31 - (((i_symbol - 8) % 32))) * 2 ); + } + + return cenDq; +} + +//------------------------------------------------------------------------------ + +uint8_t symbol2PortSlct( uint8_t i_symbol ) +{ + uint8_t portSlct = PORT_SLCT_PER_MBA; + + if ( SYMBOLS_PER_RANK > i_symbol ) + { + portSlct = ( ((i_symbol <= 3) || ((8 <= i_symbol) && (i_symbol <= 39))) + ? 1 : 0 ); + } + + return portSlct; +} + +//------------------------------------------------------------------------------ + +uint8_t dram2Symbol( uint8_t i_dram, bool i_isX4Dram ) +{ + const uint8_t dramsPerRank = i_isX4Dram ? X4DRAMS_PER_RANK + : X8DRAMS_PER_RANK; + + const uint8_t symbolsPerDram = i_isX4Dram ? SYMBOLS_PER_X4DRAM + : SYMBOLS_PER_X8DRAM; + + return (dramsPerRank > i_dram) ? (i_dram * symbolsPerDram) + : SYMBOLS_PER_RANK; +} + +//------------------------------------------------------------------------------ + +uint8_t cenDq2Symbol( uint8_t i_cenDq, uint8_t i_ps ) +{ + uint8_t sym = SYMBOLS_PER_RANK; + + if ( DQS_PER_DIMM > i_cenDq && PORT_SLCT_PER_MBA > i_ps ) + { + if ( i_cenDq >= 64 ) + sym = ( (3 - ((i_cenDq - 64) / 2)) + ((0 == i_ps) ? 4 : 0) ); + else + sym = ( ((63 - i_cenDq) / 2) + ((0 == i_ps) ? 32 : 0) + 8 ); + } + + return sym; +} + +//------------------------------------------------------------------------------ + +uint8_t symbol2Dram( uint8_t i_symbol, bool i_isX4Dram ) +{ + const uint8_t dramsPerRank = i_isX4Dram ? X4DRAMS_PER_RANK + : X8DRAMS_PER_RANK; + + const uint8_t symbolsPerDram = i_isX4Dram ? SYMBOLS_PER_X4DRAM + : SYMBOLS_PER_X8DRAM; + + return (SYMBOLS_PER_RANK > i_symbol) ? (i_symbol / symbolsPerDram) + : dramsPerRank; +} + +} // namespace PARSERUTILS + +#ifdef PRDF_HOSTBOOT_ERRL_PLUGIN +} // end namespace HOSTBOOT +#endif + +#ifdef PRDF_FSP_ERRL_PLUGIN +} // end namespace FSP +#endif + +} // End of namespace PRDF diff --git a/src/usr/diag/prdf/common/plugins/prdfParserUtils.H b/src/usr/diag/prdf/common/plugins/prdfParserUtils.H new file mode 100644 index 000000000..cf7b4f358 --- /dev/null +++ b/src/usr/diag/prdf/common/plugins/prdfParserUtils.H @@ -0,0 +1,99 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plugins/prdfParserUtils.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 PRDFPARSERUTILS_H +#define PRDFPARSERUTILS_H + +/** + * @file prdfParserUtils.H + * @brief Utility functions common across Log Parser and plat code. + */ + +#include <stdint.h> + +namespace PRDF +{ + +#ifdef PRDF_HOSTBOOT_ERRL_PLUGIN +namespace HOSTBOOT +{ +#endif + +#ifdef PRDF_FSP_ERRL_PLUGIN +namespace FSP +{ +#endif + +namespace PARSERUTILS +{ + +/** + * @brief Find the even Centaur DQ of the given symbol + * @param i_symbol The symbol + * @return The Centaur DQ + */ +uint8_t symbol2CenDq( uint8_t i_symbol ); + +/** + * @brief Find the port select for given symbol + * @param i_symbol The Symbol + * @return The Port Select + */ +uint8_t symbol2PortSlct( uint8_t i_symbol ); + +/** + * @brief Find the first symbol of the given DRAM index + * @param i_dram The Dram + * @param i_isX4Dram TRUE if DRAM is x4 + * @return The Symbol + */ +uint8_t dram2Symbol( uint8_t i_dram, bool i_isX4Dram ); + +/** + * @brief Find the symbol of the given Centaur DQ and port select + * @param i_CenDq The Centaur DQ + * @param i_ps The Port Select + * @return The Symbol + */ +uint8_t cenDq2Symbol( uint8_t i_CenDq, uint8_t i_ps ); + +/** + * @brief Find the DRAM index for the given symbol + * @param i_symbol The symbol + * @param i_isX4Dram TRUE if DRAM is x4 + * @return The Symbol + */ +uint8_t symbol2Dram( uint8_t i_symbol, bool i_isX4Dram ); + +} // namespace PARSERUTILS + +#ifdef PRDF_HOSTBOOT_ERRL_PLUGIN +} // end namespace HOSTBOOT +#endif + +#ifdef PRDF_FSP_ERRL_PLUGIN +} // end namespace FSP +#endif + +} // End of namespace PRDF +#endif |