summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Raybuck <matthew.raybuck@ibm.com>2019-06-28 08:55:53 -0500
committerDaniel M Crowell <dcrowell@us.ibm.com>2019-08-19 12:57:29 -0500
commit56a3ce9835d54e4733d15a751dfbabfdc76ce909 (patch)
treebd8560560279eacdd6dff62b9185a2bd2712c15b
parentd577988774d58c45fea951a6dded16d652f4fba3 (diff)
downloadtalos-hostboot-56a3ce9835d54e4733d15a751dfbabfdc76ce909.tar.gz
talos-hostboot-56a3ce9835d54e4733d15a751dfbabfdc76ce909.zip
Add code to run BPM update procedure from nvdimm_update.C
Adds the necessary code to hook the existing BPM update code into istep 21. The BPM update will be called in nvdimm_update.C after the nvdimm updates have occurred. Change-Id: If968313433bfdfbbbb929874de6eb0bf4d21b241 RTC: 212448 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/79640 Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Roland Veloz <rveloz@us.ibm.com> Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/usr/isteps/nvdimm/bpm_update.C130
-rw-r--r--src/usr/isteps/nvdimm/nvdimm_update.C78
2 files changed, 187 insertions, 21 deletions
diff --git a/src/usr/isteps/nvdimm/bpm_update.C b/src/usr/isteps/nvdimm/bpm_update.C
index b0d3f2d35..b630e59ef 100644
--- a/src/usr/isteps/nvdimm/bpm_update.C
+++ b/src/usr/isteps/nvdimm/bpm_update.C
@@ -255,6 +255,130 @@ void longSleep(uint8_t const i_sleepInSeconds)
} while (iterations > 0);
}
+void runBpmUpdates(bpmList_t * const i_16gb_BPMs,
+ bpmList_t * const i_32gb_BPMs,
+ BpmFirmwareLidImage * const i_16gb_fwImage,
+ BpmFirmwareLidImage * const i_32gb_fwImage,
+ BpmConfigLidImage * const i_16gb_configImage,
+ BpmConfigLidImage * const i_32gb_configImage)
+{
+
+ assert( (i_16gb_BPMs == nullptr)
+ || i_16gb_BPMs->empty()
+ || ((i_16gb_fwImage != nullptr) && (i_16gb_configImage != nullptr)),
+ "BPM::runBpmUpdates(): Update images for 16gb BPMs was nullptr and "
+ "there are 16gb BPMs in the system to may require updates.");
+ assert( (i_32gb_BPMs == nullptr)
+ || i_32gb_BPMs->empty()
+ || ((i_32gb_fwImage != nullptr) && (i_32gb_configImage != nullptr)),
+ "BPM::runBpmUpdates(): Update images for 32gb BPMs was nullptr and "
+ "there are 32gb BPMs in the system to may require updates.");
+
+ errlHndl_t errl = nullptr;
+
+ do {
+ // @TODO RTC 212448 Enable updates once everything works
+ break;
+
+ if ( (i_16gb_BPMs != nullptr)
+ && (i_16gb_fwImage != nullptr)
+ && (i_16gb_configImage != nullptr))
+ {
+ TRACFCOMP(g_trac_bpm,
+ "Check/update %d BPMs on 16GB_TYPE NVDIMMs",
+ i_16gb_BPMs->size());
+
+ for(auto& bpm : *i_16gb_BPMs)
+ {
+ errl = bpm.runUpdate(*i_16gb_fwImage, *i_16gb_configImage);
+ if (errl != nullptr)
+ {
+ uint32_t nvdimmHuid = TARGETING::get_huid(bpm.getNvdimm());
+ if (bpm.attemptAnotherUpdate())
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "An error occurred during a 16GB_TYPE BPM "
+ "update for NVDIMM 0x%.8X. "
+ "Commit and try again.",
+ nvdimmHuid);
+ ERRORLOG::errlCommit(errl, BPM_COMP_ID);
+
+ errl = bpm.runUpdate(*i_16gb_fwImage,
+ *i_16gb_configImage);
+ if (errl != nullptr)
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "Another error occurred while attempting "
+ "to update the same 16GB_TYPE BPM for "
+ "NVDIMM 0x%.8X. Commit and move onto the "
+ "next BPM",
+ nvdimmHuid);
+ }
+ }
+ else
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "An error occurred during a 16GB_TYPE BPM "
+ "update for NVDIMM 0x%.8X. "
+ "Commit and move onto the next BPM",
+ nvdimmHuid);
+ }
+ ERRORLOG::errlCommit(errl, BPM_COMP_ID);
+ }
+ }
+ }
+
+ if ( (i_32gb_BPMs != nullptr)
+ && (i_32gb_fwImage != nullptr)
+ && (i_32gb_configImage != nullptr))
+ {
+ TRACFCOMP(g_trac_bpm,
+ "Check/update %d BPMs on 32GB_TYPE NVDIMMs",
+ i_32gb_BPMs->size());
+
+ for(auto& bpm : *i_32gb_BPMs)
+ {
+ errl = bpm.runUpdate(*i_32gb_fwImage, *i_32gb_configImage);
+ if (errl != nullptr)
+ {
+ uint32_t nvdimmHuid = TARGETING::get_huid(bpm.getNvdimm());
+ if (bpm.attemptAnotherUpdate())
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "An error occurred during a 32GB_TYPE BPM "
+ "update for NVDIMM 0x%.8X. "
+ "Commit and try again.",
+ nvdimmHuid);
+ ERRORLOG::errlCommit(errl, BPM_COMP_ID);
+
+ errl = bpm.runUpdate(*i_32gb_fwImage,
+ *i_32gb_configImage);
+ if (errl != nullptr)
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "Another error occurred while attempting "
+ "to update the same 32GB_TYPE BPM for "
+ "NVDIMM 0x%.8X. Commit and move onto the "
+ "next BPM",
+ nvdimmHuid);
+ }
+ }
+ else
+ {
+ TRACFCOMP(g_trac_bpm, ERR_MRK
+ "An error occurred during a 32GB_TYPE BPM "
+ "update for NVDIMM 0x%.8X. "
+ "Commit and move onto the next BPM",
+ nvdimmHuid);
+ }
+ ERRORLOG::errlCommit(errl, BPM_COMP_ID);
+ }
+ }
+ }
+ } while(0);
+}
+
+
// =============================================================================
// BpmFirmwareLidImage Class Functions
// =============================================================================
@@ -263,6 +387,8 @@ BpmFirmwareLidImage::BpmFirmwareLidImage(void * const i_lidImageAddr,
size_t i_size)
: iv_lidImage(i_lidImageAddr), iv_lidImageSize(i_size)
{
+ assert(i_lidImageAddr != nullptr,
+ "BPM::BpmFirmwareLidImage(): Provided LID image must not be nullptr");
}
uint16_t BpmFirmwareLidImage::getVersion() const
@@ -701,8 +827,7 @@ errlHndl_t Bpm::runUpdate(BpmFirmwareLidImage i_fwImage,
"Firmware version on the BPM matches the version in the "
"image. Skipping update.");
- // @TODO RTC 212448: disable forced updates.
- //break;
+ break;
}
// Depending on the BSL version a CRC check may be necessary
@@ -790,7 +915,6 @@ errlHndl_t Bpm::runUpdate(BpmFirmwareLidImage i_fwImage,
errl = checkFirmwareCrc();
if (errl != nullptr)
{
- // @TODO RTC 212448: Add support for multiple update attempts.
TRACFCOMP(g_trac_bpm, "Bpm:: runUpdate(): "
"Final CRC check failed. Attempting update again...");
iv_attemptAnotherUpdate = !iv_attemptAnotherUpdate;
diff --git a/src/usr/isteps/nvdimm/nvdimm_update.C b/src/usr/isteps/nvdimm/nvdimm_update.C
index 1f42228ce..afaa03e04 100644
--- a/src/usr/isteps/nvdimm/nvdimm_update.C
+++ b/src/usr/isteps/nvdimm/nvdimm_update.C
@@ -26,6 +26,7 @@
#include "nvdimm.H"
#include <isteps/nvdimm/nvdimm.H>
#include <isteps/nvdimm/nvdimmreasoncodes.H>
+#include "bpm_update.H"
#include <initservice/istepdispatcherif.H> // sendProgressCode
#include <util/utilmclmgr.H> // secure LID manager
@@ -33,6 +34,7 @@
#include <devicefw/userif.H>
#include <vpd/spdenums.H>
#include <sys/time.h>
+#include <vector>
// Unique tracing for nvdimm update process
const char NVDIMM_UPD[] = "NVDIMM_UPD";
@@ -1894,12 +1896,15 @@ bool NvdimmsUpdate::runUpdate(void)
// List of each installed NVDIMM type
std::vector<NvdimmInstalledImage*> v_NVDIMM_16GB_list;
std::vector<NvdimmInstalledImage*> v_NVDIMM_32GB_list;
+ BPM::bpmList_t NVDIMM_BPM_16GB_list;
+ BPM::bpmList_t NVDIMM_BPM_32GB_list;
// Build up installed NVDIMM image lists
for (auto l_nvdimm : iv_nvdimmList)
{
NvdimmInstalledImage * l_installed_image =
new NvdimmInstalledImage(l_nvdimm);
+
l_err = l_installed_image->getType(l_installed_type);
if (l_err)
{
@@ -1924,6 +1929,10 @@ bool NvdimmsUpdate::runUpdate(void)
"0x%.8X NVDIMM is SMART_NVDIMM_16GB_TYPE",
get_huid(l_nvdimm));
v_NVDIMM_16GB_list.push_back(l_installed_image);
+
+ BPM::Bpm l_16gbBpm(l_nvdimm);
+ NVDIMM_BPM_16GB_list.push_back(l_16gbBpm);
+
}
else if (l_installed_type == SMART_NVDIMM_32GB_TYPE)
{
@@ -1931,6 +1940,9 @@ bool NvdimmsUpdate::runUpdate(void)
"0x%.8X NVDIMM is SMART_NVDIMM_32GB_TYPE",
get_huid(l_nvdimm));
v_NVDIMM_32GB_list.push_back(l_installed_image);
+
+ BPM::Bpm l_32gbBpm(l_nvdimm);
+ NVDIMM_BPM_32GB_list.push_back(l_32gbBpm);
}
else
{
@@ -1976,12 +1988,14 @@ bool NvdimmsUpdate::runUpdate(void)
}
do {
- // First check that updatable NVDIMMs exist on the system
- if ((v_NVDIMM_16GB_list.size() == 0) &&
- (v_NVDIMM_32GB_list.size() == 0))
+ // First check that updatable NVDIMMs or BPMs exist on the system
+ if ( (v_NVDIMM_16GB_list.size() == 0)
+ && (v_NVDIMM_32GB_list.size() == 0)
+ && (NVDIMM_BPM_16GB_list.size() == 0)
+ && (NVDIMM_BPM_32GB_list.size() == 0))
{
TRACFCOMP(g_trac_nvdimm_upd, "NvdimmsUpdate::runUpdate() - "
- "No updatable NVDIMMs present on the system");
+ "No updatable NVDIMMs or BPMs present on the system");
break;
}
@@ -2000,8 +2014,17 @@ bool NvdimmsUpdate::runUpdate(void)
break;
}
- for(const auto& lid : info.lidIds)
+ // Both the config and firmware images are needed to perform an
+ // update on a BPM. So, get pointers to each in the CompInfo
+ // struct's vector of LID IDs.
+ MCL::LidInfo * bpm_16gb_fw = nullptr;
+ MCL::LidInfo * bpm_16gb_config = nullptr;
+ MCL::LidInfo * bpm_32gb_fw = nullptr;
+ MCL::LidInfo * bpm_32gb_config = nullptr;
+
+ for(auto& lid : info.lidIds)
{
+
TRACFCOMP(g_trac_nvdimm,"LID ID=0x%08X, size=%d, vAddr=%p",
lid.id, lid.size, lid.vAddr);
@@ -2031,21 +2054,21 @@ bool NvdimmsUpdate::runUpdate(void)
v_NVDIMM_32GB_list);
}
}
- else if (( lid.id == NVDIMM_32GB_BPM_FW_LIDID)
- || (lid.id == NVDIMM_32GB_BPM_CONFIG_LIDID))
+ else if (lid.id == NVDIMM_32GB_BPM_FW_LIDID)
+ {
+ bpm_32gb_fw = &lid;
+ }
+ else if (lid.id == NVDIMM_32GB_BPM_CONFIG_LIDID)
{
- TRACFCOMP(g_trac_nvdimm,
- "Check/Update %d 32GB_TYPE NVDIMMs' BPM",
- v_NVDIMM_32GB_list.size());
- //@TODO RTC 212448 Add calls into bpm_update.C code.
+ bpm_32gb_config = &lid;
}
- else if (( lid.id == NVDIMM_16GB_BPM_FW_LIDID)
- || (lid.id == NVDIMM_16GB_BPM_CONFIG_LIDID))
+ else if (lid.id == NVDIMM_16GB_BPM_FW_LIDID)
{
- TRACFCOMP(g_trac_nvdimm,
- "Check/Update %d 16GB_TYPE NVDIMMs' BPM",
- v_NVDIMM_16GB_list.size());
- //@TODO RTC 212448 Add calls into bpm_update.C code.
+ bpm_16gb_fw = &lid;
+ }
+ else if (lid.id == NVDIMM_16GB_BPM_CONFIG_LIDID)
+ {
+ bpm_16gb_config = &lid;
}
else if (lid.id != NVDIMM_SIGNATURE_LIDID)
{
@@ -2056,7 +2079,26 @@ bool NvdimmsUpdate::runUpdate(void)
}
}
- // @TODO RTC 212448 Add call to perform BPM updates
+ // Run BPM updates on NVDIMMs
+ BPM::BpmFirmwareLidImage fwImage_16gb(bpm_16gb_fw->vAddr,
+ bpm_16gb_fw->size);
+
+ BPM::BpmFirmwareLidImage fwImage_32gb(bpm_32gb_fw->vAddr,
+ bpm_32gb_fw->size);
+
+ BPM::BpmConfigLidImage configImage_16gb(bpm_16gb_config->vAddr,
+ bpm_16gb_config->size);
+
+ BPM::BpmConfigLidImage configImage_32gb(bpm_32gb_config->vAddr,
+ bpm_32gb_config->size);
+
+ BPM::runBpmUpdates(&NVDIMM_BPM_16GB_list,
+ &NVDIMM_BPM_32GB_list,
+ &fwImage_16gb,
+ &fwImage_32gb,
+ &configImage_16gb,
+ &configImage_32gb);
+
// Destructor automatically unloads the NVDIMM flash binary
}
else
OpenPOWER on IntegriCloud