Skip to content

Commit

Permalink
exp draminit & draminit_mc phase 3 update for PRD logging
Browse files Browse the repository at this point in the history
- Adding firChecklist as a template parameter for firmware
  fir_or_pll bit checks
- Creating helper functions for fir_or_pll fails to check
  specific masks
- Creating unit test for fir_with_mask_helper
- Updating NIMBUS code to accept firChecklist template param
- Adding CCS fir checklist; to be checked when row repair is
  implemented into exp_draminit_mc

Change-Id: I4fe7e146a3b4c6e2eefa542916b737d613c3ecc3
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/91915
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Dev-Ready: NICOLAS R FAJARDO <nicolas.fajardo@ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/92709
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
  • Loading branch information
NicoFajardo authored and RAJA DAS committed Mar 26, 2020
1 parent 81d3ad9 commit e6cfaae
Showing 1 changed file with 41 additions and 16 deletions.
57 changes: 41 additions & 16 deletions src/import/generic/memory/lib/utils/mss_generic_check.H
Expand Up @@ -59,6 +59,13 @@ namespace mss
namespace check
{
#ifndef __PPE__

///
/// @brief Making an enum for switch/case in bad_fir_bits. Both will need
/// to be updated if additional FIR checklists are needed
///
enum firChecklist {GENERIC, OMI, DRAMINIT, CCS};

///
/// @brief Helper function to log an error as related if needed
/// @tparam T the target type on which to log the error
Expand All @@ -82,14 +89,34 @@ inline void log_fir_helper( const fapi2::Target<T>& i_target,
///
/// @brief Checks whether any FIRs have lit up on a target
/// @tparam MC MC type for which to check FIR's
/// @tparam F the FIR reg checklist to be checked
/// @tparam T the fapi2::TargetType which hold the FIR bits
/// @param[in] i_target - the target on which to operate
/// @param[in,out] io_rc - the return code for the function
/// @param[out] o_fir_error - true iff a FIR was hit
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok
///
template< mss::mc_type MC, fapi2::TargetType T >
fapi2::ReturnCode bad_fir_bits( const fapi2::Target<T>& i_target, fapi2::ReturnCode& io_rc, bool& o_fir_error );
template< mss::mc_type MC, firChecklist F, fapi2::TargetType T >
fapi2::ReturnCode bad_fir_bits( const fapi2::Target<T>& i_target, fapi2::ReturnCode& io_rc, bool& o_fir_error);

///
/// @brief Checks whether the passed in FIRs have any un-masked errors set
/// @param[in] i_fir - the contents of the fir register to be checked
/// @param[in] i_mask - the contents of the fir mask to be checked
/// @return bool return true iff an unmasked fir bit is found
///
inline bool fir_with_mask_helper( const fapi2::buffer<uint64_t>& i_fir,
const fapi2::buffer<uint64_t>& i_mask)
{
fapi2::buffer<uint64_t> l_fir_mask(i_mask);

// The mask register will need to be inverted as a 0 in the mask register means the FIR is legit
// A bitwise and works the opposite way
l_fir_mask.invert();

// Return true if any fir is set and unmasked to indicate this is a "new" FIR
return ((i_fir & l_fir_mask) != 0);
}

///
/// @brief Checks whether the passed in FIRs have any un-masked errors set
Expand All @@ -116,14 +143,9 @@ inline fapi2::ReturnCode fir_with_mask( const fapi2::Target<T>& i_target,
FAPI_TRY(mss::getScom(i_target, FIR_REG, l_fir));
FAPI_TRY(mss::getScom(i_target, FIR_MASK, l_fir_mask));


// The mask register will need to be inverted as a 0 in the mask register means the FIR is legit
// A bitwise and works the opposite way
l_fir_mask.invert();

// If we have any unmasked bit, set that we have a FIR error and exit out with success
// Note: we want to set success here as PRD will find the FIR as "new" and retrigger the procedure this way
o_fir_error = ((l_fir & l_fir_mask) != 0);
// If we have any unmasked bit, set that we have a FIR error and exit out with TRUE
// Note: we want to set TRUE here as PRD will find the FIR as "new" and retrigger the procedure this way
o_fir_error = fir_with_mask_helper(l_fir, l_fir_mask);

// And print the information for debuggability
FAPI_INF("%s %s on reg 0x%016lx value 0x%016lx and mask 0x%016lx value 0x%016lx", mss::c_str(i_target),
Expand All @@ -136,14 +158,15 @@ fapi_try_exit:
///
/// @brief Checks whether a FIR or unlocked PLL could be the root cause of another failure
/// @tparam MC MC type for which to check FIR's
/// @tparam F the FIR reg checklist to be checked
/// @tparam T the fapi2::TargetType which hold the FIR bits
/// @param[in] i_target - the target on which to operate
/// @param[in,out] io_rc - the return code for the function
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok
/// @note This is a helper function to enable unit testing
///
template< mss::mc_type MC, fapi2::TargetType T >
fapi2::ReturnCode hostboot_fir_or_pll_fail( const fapi2::Target<T>& i_target, fapi2::ReturnCode& io_rc)
template< mss::mc_type MC, firChecklist F, fapi2::TargetType T >
fapi2::ReturnCode hostboot_fir_or_pll_fail( const fapi2::Target<T>& i_target, fapi2::ReturnCode& io_rc )
{
// We didn't have an error, so return success
if(io_rc == fapi2::FAPI2_RC_SUCCESS)
Expand All @@ -157,7 +180,8 @@ fapi2::ReturnCode hostboot_fir_or_pll_fail( const fapi2::Target<T>& i_target, fa

FAPI_ERR("%s has a bad return code, time to check some firs!", mss::c_str(i_target));

l_fircheck_scom_err = bad_fir_bits<MC>(i_target, io_rc, l_fir_error);
// Check the fir bits against the mask and return fir status thru fapi2 RC
l_fircheck_scom_err = bad_fir_bits<MC, F>(i_target, io_rc, l_fir_error);

FAPI_ERR("%s took a fail. FIR was %s", mss::c_str(i_target),
l_fir_error ? "set - returning FIR RC" : "unset - returning inputted RC");
Expand All @@ -179,16 +203,17 @@ fapi2::ReturnCode hostboot_fir_or_pll_fail( const fapi2::Target<T>& i_target, fa
///
/// @brief Checks whether a FIR or unlocked PLL could be the root cause of another failure, if a check fir boolean is passed in
/// @tparam MC MC type for which to check FIR's
/// @tparam F the FIR reg checklist to be checked
/// @tparam T the fapi2::TargetType which hold the FIR bits
/// @param[in] i_target - the target on which to operate
/// @param[in,out] io_rc - the return code for the function
/// @param[in] i_check_fir - true IFF the FIR needs to be checked - defaults to true
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok
///
template< mss::mc_type MC, fapi2::TargetType T >
template< mss::mc_type MC, firChecklist F, fapi2::TargetType T >
fapi2::ReturnCode fir_or_pll_fail( const fapi2::Target<T>& i_target,
fapi2::ReturnCode& io_rc,
const bool i_check_fir = true)
const bool i_check_fir = true )
{
#ifdef __HOSTBOOT_MODULE

Expand All @@ -198,7 +223,7 @@ fapi2::ReturnCode fir_or_pll_fail( const fapi2::Target<T>& i_target,
if(i_check_fir)
{
// Handle any issues according to PRD FIR scheme, as a FIR could have caused this issue
l_rc = hostboot_fir_or_pll_fail<MC>(i_target, l_rc);
l_rc = hostboot_fir_or_pll_fail<MC, F>(i_target, l_rc);
}

return l_rc;
Expand Down

0 comments on commit e6cfaae

Please sign in to comment.