From fa1e0b1361abb4c6e48c24d58e5caed29288e4ed Mon Sep 17 00:00:00 2001 From: Roland Veloz Date: Wed, 11 Sep 2019 00:24:10 -0500 Subject: [PATCH] Changed the callout in the call NVM Health Status to be an NVDIMM In the call nvDimmNvmCheckHealthStatus, the call is incorrectly using HB when it should be associated with NVDIMM. Switched out the addPartCallout with HWAS::BPM_PART_TYPE to a addHwCallout with the given NVDIMM. Also added more trace info to print out the registers that are being retrieved. Corrected the logic such that a good state passes. Apparently, the way the code was written, a good or bad state, both would fail. Now the good state passes and the bad state fails. Change-Id: I46b62ce3fe5c5ac86efb501e2a91fdea8160b9b5 CQ: SW475265 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83673 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Daniel M Crowell --- src/usr/isteps/nvdimm/runtime/nvdimm_rt.C | 65 +++++++++++++++++------ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C b/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C index a9f630c7498..76b38ce99a2 100644 --- a/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C +++ b/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C @@ -1096,8 +1096,16 @@ bool nvDimmCheckBadFlashBlockPercentage(TargetHandle_t i_nvDimm, const uint8_t i_maxPercentageAllowed, uint8_t &o_badFlashBlockPercentage) { + // Cache the HUID of the NVDIMM + uint32_t l_nvDimmHuid = get_huid( i_nvDimm ); + + TRACFCOMP(g_trac_nvdimm, ENTER_MRK"nvDimmCheckBadFlashBlockPercentage(): " + "NVDIMM(0x%.4X), max bad flash blocks allowed(%d)", + l_nvDimmHuid, + i_maxPercentageAllowed); + // The status of the check on the bad block percentage - bool l_didBadFlashBlockPercentageCheckPass(false); + bool l_didBadFlashBlockPercentageCheckPass(true); // The retrieved flash block percentage from register, initialize to zero o_badFlashBlockPercentage = 0; @@ -1105,9 +1113,6 @@ bool nvDimmCheckBadFlashBlockPercentage(TargetHandle_t i_nvDimm, // Handle to catch any errors errlHndl_t l_err(nullptr); - // Cache the HUID of the NVDIMM - uint32_t l_nvDimmHuid = get_huid( i_nvDimm ); - // Retrieve the percentage of bad blocks and validate TRACDCOMP(g_trac_nvdimm, INFO_MRK"nvDimmCheckBadFlashBlockPercentage(): " "Reading NVDIMM(0x%.8X) percentage of bad blocks from " @@ -1152,11 +1157,13 @@ bool nvDimmCheckBadFlashBlockPercentage(TargetHandle_t i_nvDimm, { TRACFCOMP(g_trac_nvdimm, ERR_MRK"nvDimmCheckBadFlashBlockPercentage(): " "FAIL: For NVDIMM (0x%.8X), the percentage of bad " - "flash blocks (%d) exceeds the maximum percentage " - "of bad flash blocks allowed (%d), marking this " - "as a fail", + "flash blocks (%d), read from register " + "FLASH_BAD_BLK_PCT(0x%.4X), exceeds the maximum " + "percentage of bad flash blocks allowed (%d), marking " + "this as a fail", l_nvDimmHuid, o_badFlashBlockPercentage, + FLASH_BAD_BLK_PCT, i_maxPercentageAllowed); // Set up the fail state, so caller can determine that the fail was @@ -1183,6 +1190,10 @@ bool nvDimmCheckBadFlashBlockPercentage(TargetHandle_t i_nvDimm, } // end if (l_badFlashBlockPercentage > i_maxPercentageAllowed) } // end if (l_err) ... else + TRACFCOMP(g_trac_nvdimm, EXIT_MRK"nvDimmCheckBadFlashBlockPercentage(): " + "Returning %s", + l_didBadFlashBlockPercentageCheckPass == true ? "true" : "false" ); + return l_didBadFlashBlockPercentageCheckPass; } @@ -1212,8 +1223,16 @@ bool nvDimmCheckFlashErrorCount(TargetHandle_t i_nvDimm, const uint32_t i_maxFlashErrorsAllowed, uint32_t &o_readFlashErrorCount) { + // Cache the HUID of the NVDIMM + uint32_t l_nvDimmHuid = get_huid( i_nvDimm ); + + TRACFCOMP(g_trac_nvdimm, ENTER_MRK"nvDimmCheckFlashErrorCount(): " + "NVDIMM(0x%.4X), max flash errors allowed(%d)", + l_nvDimmHuid, + i_maxFlashErrorsAllowed); + // The status of the check on the flash error count - bool l_didFlashErrorCountCheckPass(false); + bool l_didFlashErrorCountCheckPass(true); // The retrieved flash error count from register, initialize to zero o_readFlashErrorCount = 0; @@ -1221,9 +1240,6 @@ bool nvDimmCheckFlashErrorCount(TargetHandle_t i_nvDimm, // Handle to catch any errors errlHndl_t l_err(nullptr); - // Cache the HUID of the NVDIMM - uint32_t l_nvDimmHuid = get_huid( i_nvDimm ); - // The retrieved flash error count from a register uint8_t l_readFlashErrorCountByte(0); @@ -1291,12 +1307,17 @@ bool nvDimmCheckFlashErrorCount(TargetHandle_t i_nvDimm, if (o_readFlashErrorCount > i_maxFlashErrorsAllowed) { TRACFCOMP(g_trac_nvdimm, ERR_MRK"nvDimmCheckFlashErrorCount(): " - "FAIL: For NVDIMM (0x%.8X), the flash error " - "count (%d) exceeds the maximum number of flash " - "errors allowed (%d), marking this as a fail", - l_nvDimmHuid, - o_readFlashErrorCount, - i_maxFlashErrorsAllowed); + "FAIL: For NVDIMM (0x%.8X), the flash error count (%d), " + "read from registers FLASH_ERROR_COUNT0(0x%.4X), " + "FLASH_ERROR_COUNT1(0x%.4X) and FLASH_ERROR_COUNT2(0x%.4X), " + "exceeds the maximum number of flash " + "errors allowed (%d), marking this as a fail", + l_nvDimmHuid, + o_readFlashErrorCount, + FLASH_ERROR_COUNT0, + FLASH_ERROR_COUNT1, + FLASH_ERROR_COUNT2, + i_maxFlashErrorsAllowed); // Set up the fail state, so caller can determine that the fail was // due to error count exceeding the max errors allowed. @@ -1321,6 +1342,10 @@ bool nvDimmCheckFlashErrorCount(TargetHandle_t i_nvDimm, } } // end if (o_readFlashErrorCount) + TRACFCOMP(g_trac_nvdimm, EXIT_MRK"nvDimmCheckFlashErrorCount(): " + "Returning %s", + l_didFlashErrorCountCheckPass == true ? "true" : "false" ); + return l_didFlashErrorCountCheckPass; } @@ -1488,6 +1513,12 @@ bool nvDimmNvmCheckHealthStatus(const TargetHandleList &i_nvDimmTargetList) l_err->collectTrace(NVDIMM_COMP_NAME); nvdimmAddVendorLog(l_nvDimm, l_err); + // Add a DIMM callout + l_err->addHwCallout( l_nvDimm, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + // Collect the error errlCommit(l_err, NVDIMM_COMP_ID);