From d329c59bc1cfa04669b828af30be473011fa1ec4 Mon Sep 17 00:00:00 2001 From: Matthew Raybuck Date: Fri, 30 Aug 2019 16:47:34 -0500 Subject: [PATCH] BPM Updates: Move NVDIMM controller reset and final fw check to end of update Change-Id: I54832f6197e620885b1506b47af248132173eba4 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83480 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/bpm_update.C | 158 +++++++++++++++-------------- 1 file changed, 83 insertions(+), 75 deletions(-) diff --git a/src/usr/isteps/nvdimm/bpm_update.C b/src/usr/isteps/nvdimm/bpm_update.C index 0395991b656..b817efb6e37 100644 --- a/src/usr/isteps/nvdimm/bpm_update.C +++ b/src/usr/isteps/nvdimm/bpm_update.C @@ -1016,9 +1016,91 @@ errlHndl_t Bpm::runUpdate(BpmFirmwareLidImage i_fwImage, } } - } while(0); + // Reset controller and unlock encryption if necessary + errlHndl_t exitErrl = nvdimmResetController(iv_nvdimm); + if (exitErrl != nullptr) + { + TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runUpdate() " + "Couldn't reset NVDIMM controller."); + handleMultipleErrors(errl, exitErrl); + } + + // If the update was successful then we must wait for 15 seconds before + // polling the status of the BPM since it has to finish updating its + // firmware and resetting. + TRACFCOMP(g_trac_bpm, "Bpm::runUpdate(): " + "Wait for the BPM to finish update and reset procedure, " + "sleep for 15 seconds"); + longSleep(15); + + // Poll SCAP_STATUS register for BPM state before we check final + // firmware version. + exitErrl = verifyGoodBpmState(); + if (exitErrl != nullptr) + { + TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runUpdate(): " + "Could not verify that BPM was present and enabled!"); + handleMultipleErrors(errl, exitErrl); + } + + uint16_t bpmFwVersion = INVALID_VERSION; + exitErrl = getFwVersion(bpmFwVersion); + if (exitErrl != nullptr) + { + TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runUpdate(): " + "Could not determine firmware version on the BPM"); + handleMultipleErrors(errl, exitErrl); + } + + TRACFCOMP(g_trac_bpm, INFO_MRK"Bpm::runUpdate(): " + "Firmware version on the BPM 0x%.4X, " + "Firmware version of image 0x%.4X.", + bpmFwVersion, i_fwImage.getVersion()); + + if (i_fwImage.getVersion() == bpmFwVersion) + { + TRACFCOMP(g_trac_bpm, INFO_MRK"Bpm::runUpdate(): " + "Firmware version on the BPM matches the version in the " + "image. Firmware Update Successful."); + iv_attemptAnotherUpdate = false; + } + else + { + // Attempt another update if one hasn't already been attempted. + setAttemptAnotherUpdate(); + TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runUpdate(): " + "Version on BPM didn't match image. %s ", + iv_attemptAnotherUpdate ? + "Attempt another update..." + : "Attempts to update the BPM have failed."); + if (iv_attemptAnotherUpdate == false) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid BPM_RC::BPM_RUN_FW_UPDATES + * @reasoncode BPM_RC::BPM_VERSION_MISMATCH + * @userdata1[00:31] Version on the BPM + * @userdata1[32:63] Version of the flash image + * @userdata2 NVDIMM Target HUID associated with this BPM + * @devdesc The version on the BPM didn't match the + * version in the flash image. + * @custdesc A problem occurred during IPL of the system. + */ + exitErrl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + BPM_RC::BPM_RUN_FW_UPDATES, + BPM_RC::BPM_VERSION_MISMATCH, + TWO_UINT32_TO_UINT64(bpmFwVersion, + i_fwImage.getVersion()), + TARGETING::get_huid(iv_nvdimm)); + exitErrl->collectTrace(BPM_COMP_NAME); + handleMultipleErrors(errl, exitErrl); + } + } + TRACFCOMP(g_trac_bpm, EXIT_MRK"Bpm::runUpdate(): " "Concluding BPM Update for NVDIMM 0x%.8X %s", TARGETING::get_huid(iv_nvdimm), @@ -3771,80 +3853,6 @@ errlHndl_t Bpm::runFirmwareUpdates(BpmFirmwareLidImage i_image) handleMultipleErrors(errl, exitErrl); } - // If the update was successful then we must wait for 15 seconds before - // polling the status of the BPM since it has to finish updating its - // firmware and resetting. - TRACFCOMP(g_trac_bpm, "Bpm::runFirmwareUpdates(): " - "Wait for the BPM to finish update and reset procedure, " - "sleep for 15 seconds"); - longSleep(15); - - // Poll SCAP_STATUS register for BPM state before we check final - // firmware version. - exitErrl = verifyGoodBpmState(); - if (exitErrl != nullptr) - { - TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runFirmwareUpdates(): " - "Could not verify that BPM was present and enabled!"); - handleMultipleErrors(errl, exitErrl); - } - - uint16_t bpmFwVersion = INVALID_VERSION; - exitErrl = getFwVersion(bpmFwVersion); - if (exitErrl != nullptr) - { - TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm::runFirmwareUpdates(): " - "Could not determine firmware version on the BPM"); - handleMultipleErrors(errl, exitErrl); - } - - TRACFCOMP(g_trac_bpm, INFO_MRK"Bpm::runFirmwareUpdates(): " - "Firmware version on the BPM 0x%.4X, " - "Firmware version of image 0x%.4X.", - bpmFwVersion, i_image.getVersion()); - - if (i_image.getVersion() == bpmFwVersion) - { - TRACFCOMP(g_trac_bpm, INFO_MRK"Bpm::runFirmwareUpdates(): " - "Firmware version on the BPM matches the version in the " - "image. Firmware Update Successful."); - iv_attemptAnotherUpdate = false; - } - else - { - // Attempt another update if one hasn't already been attempted. - setAttemptAnotherUpdate(); - TRACFCOMP(g_trac_bpm, ERR_MRK"Bpm:: runFirmwareUpdates(): " - "Version on BPM didn't match image. %s ", - iv_attemptAnotherUpdate ? - "Attempt another update..." - : "Attempts to update the BPM have failed."); - if (iv_attemptAnotherUpdate == false) - { - /*@ - * @errortype - * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid BPM_RC::BPM_RUN_FW_UPDATES - * @reasoncode BPM_RC::BPM_VERSION_MISMATCH - * @userdata1[00:31] Version on the BPM - * @userdata1[32:63] Version of the flash image - * @userdata2 NVDIMM Target HUID associated with this BPM - * @devdesc The version on the BPM didn't match the - * version in the flash image. - * @custdesc A problem occurred during IPL of the system. - */ - exitErrl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - BPM_RC::BPM_RUN_FW_UPDATES, - BPM_RC::BPM_VERSION_MISMATCH, - TWO_UINT32_TO_UINT64(bpmFwVersion, - i_image.getVersion()), - TARGETING::get_huid(iv_nvdimm)); - exitErrl->collectTrace(BPM_COMP_NAME); - handleMultipleErrors(errl, exitErrl); - } - } - return errl; }