summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/istep21/call_update_ucd_flash.C
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2019-03-13 15:22:30 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-03-20 09:44:13 -0500
commit810394f870786da606ef3179315e6cbdaa35627b (patch)
treef3727c8ea6bcbe91033e9f759dc44ce585a91ec1 /src/usr/isteps/istep21/call_update_ucd_flash.C
parentaf6712fe5c035e7e61ea67a6f86f585b8ee1d51b (diff)
downloadtalos-hostboot-810394f870786da606ef3179315e6cbdaa35627b.tar.gz
talos-hostboot-810394f870786da606ef3179315e6cbdaa35627b.zip
UCD flash update invoker
Implements the main algorithm for finding applicable UCDs to perform flash update on and walking the UCD flash image table of contents to find the image associated with a UCD. Also adds a check to skip the update if simics is running. RTC: 201991 Change-Id: Ib35abec2f0a2ed22ae8d41a2acecd146f699bc43 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/73484 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com> Reviewed-by: Matthew Raybuck <matthew.raybuck@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> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/isteps/istep21/call_update_ucd_flash.C')
-rw-r--r--src/usr/isteps/istep21/call_update_ucd_flash.C110
1 files changed, 83 insertions, 27 deletions
diff --git a/src/usr/isteps/istep21/call_update_ucd_flash.C b/src/usr/isteps/istep21/call_update_ucd_flash.C
index b2fb9e75d..31fe66d5f 100644
--- a/src/usr/isteps/istep21/call_update_ucd_flash.C
+++ b/src/usr/isteps/istep21/call_update_ucd_flash.C
@@ -26,6 +26,7 @@
#include <errl/errlentry.H>
#include <trace/interface.H>
#include <initservice/initserviceif.H>
+#include <util/utillidmgr.H>
#include <util/utilmclmgr.H>
#include <errl/errlmanager.H>
#include <hbotcompid.H>
@@ -35,6 +36,9 @@
#include <secureboot/trustedbootif.H>
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
+#include <util/utilmem.H>
+#include <util/misc.H>
+#include <isteps/istep_reasoncodes.H>
#include "call_update_ucd_flash.H"
namespace POWER_SEQUENCER
@@ -56,7 +60,8 @@ void call_update_ucd_flash(void)
do {
// Update UCD flash images, if needed
- if (INITSERVICE::spBaseServicesEnabled())
+ if (INITSERVICE::spBaseServicesEnabled() &&
+ !Util::isSimicsRunning())
{
TARGETING::TargetHandleList powerSequencers;
TARGETING::getAllAsics(powerSequencers,
@@ -66,6 +71,11 @@ void call_update_ucd_flash(void)
// Continue if no functional power sequencers. On MPIPL,
// previously bad power sequencers will be ignored, and
// Hostboot will not generate new errors.
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,INFO_MRK
+ "call_update_ucd_flash: No functional UCD9090 or UCD90120A "
+ "power sequencers found to update");
+
+ // Done with update flow, no error
break;
}
@@ -75,11 +85,28 @@ void call_update_ucd_flash(void)
pError = mclManager.processSingleComponent(MCL::g_UcdCompId,info);
if(pError)
{
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,ERR_MRK
+ "call_update_ucd_flash: Failed in call to "
+ "processSingleComponent() for UCD9090 "
+ "component ID");
+
+ // Failed update flow, commit at end of step
break;
}
- // Make sure TPM queue is flushed before doing any I2C operations
- TRUSTEDBOOT::flushTpmQueue();
+ // Make sure TPM queue is flushed before doing any I2C operations, since
+ // loading via MCL drives PCR extends into the TPM, and TPM can share
+ // the same I2C bus as UCD devices
+ pError = TRUSTEDBOOT::flushTpmQueue();
+ if(pError)
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,ERR_MRK
+ "call_update_ucd_flash: Failed in call to "
+ "TRUSTEDBOOT::flushTpmQueue()");
+
+ // Failed update flow, commit at end of step
+ break;
+ }
// Dump some LID info
for(const auto& lid : info.lidIds)
@@ -90,40 +117,69 @@ void call_update_ucd_flash(void)
TRACFBIN(ISTEPS_TRACE::g_trac_isteps_trace,"LID",lid.vAddr,64);
}
- // Update every power sequencer's data flash
- for(auto powerSequencer : powerSequencers)
+ // Locate the UCD flash image (ignore signature LID and any other LIDs
+ // in the container)
+ const auto lidItr =
+ std::find_if(
+ info.lidIds.begin(),info.lidIds.end(),
+ [](const MCL::LidInfo& i_lid)
+ {
+ return (i_lid.id == static_cast<decltype(i_lid.id)>(
+ Util::UCD_LIDID));
+ });
+ if(lidItr == info.lidIds.end())
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,ERR_MRK
+ "call_update_ucd_flash: Failed to locate UCD flash image LID "
+ "within UCD9090 component");
+
+ /*@
+ * @errortype
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @reasoncode ISTEP::RC_UCD_IMG_NOT_IN_CONTAINER
+ * @moduleid ISTEP::MOD_CALL_UPDATE_UCD_FLASH
+ * @userdata1 UCD LID ID
+ * @devdesc The UCD content LID was not found within the UCD
+ * container
+ * @custdesc Unexpected IPL firmware data load error
+ */
+ pError = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ ISTEP::MOD_CALL_UPDATE_UCD_FLASH,
+ ISTEP::RC_UCD_IMG_NOT_IN_CONTAINER,
+ Util::UCD_LIDID,
+ 0,
+ ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
+
+ // Failed update flow, commit at end of step
+ break;
+ }
+
+ // Use a UtilMem buffer to prevent sailing off end of the UCD flash
+ // data. Callee will seek back to beginning of content
+ UtilMem image(lidItr->vAddr,lidItr->size);
+
+ pError = updateAllUcdFlashImages(powerSequencers,image);
+ if(pError)
{
- do {
-
- const auto i2cInfo =
- powerSequencer->getAttr<TARGETING::ATTR_I2C_CONTROL_INFO>();
- const auto model = powerSequencer->getAttr<TARGETING::ATTR_MODEL>();
-
- TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, INFO_MRK
- "Found functional power sequencer: HUID = 0x%08X, "
- "Model = 0x%08X, e/p/a = %d/%d/0x%02X",
- TARGETING::get_huid(powerSequencer),
- model,
- i2cInfo.engine, i2cInfo.port, i2cInfo.devAddr);
-
- // @TODO RTC 201990 add flash update algorithm
- //
- // errlHndl_t updateUcdFlash(
- // TARGETING::Target* i_pUcd,
- // const void* i_pFlashImage);
-
- } while(0);
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,ERR_MRK
+ "call_update_ucd_flash: Failed in call to "
+ "updateAllUcdFlashImages");
+ break;
}
// Destructor automatically unloads the UCD flash binary
- }
+
+ } // End valid machine and not-simcis for UCD updates
} while(0);
if(pError)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK
- "call_update_ucd_flash failed");
+ "call_update_ucd_flash: step failed");
+ pError->collectTrace(UCD_COMP_NAME);
+ pError->collectTrace(ISTEP_COMP_NAME);
errlCommit(pError, ISTEP_COMP_ID);
}
OpenPOWER on IntegriCloud