Skip to content

Commit

Permalink
Add attribute to explicitly force OCMB Firmware update behavior
Browse files Browse the repository at this point in the history
Allow us to override the default behavior (update when versions
don't match) via an attribute.  The options will be:
- Update if versions do not match
- Never update
- Always update
- Do the version check but don't actually update the code

Change-Id: I5fdaa3cd2adf4cfb96f7ad7568de5d2c083d276c
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/85180
Reviewed-by: Glenn Miles <milesg@ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-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>
Reviewed-by: William G Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Oct 21, 2019
1 parent 9546b72 commit a0207ea
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
35 changes: 32 additions & 3 deletions src/usr/isteps/expupd/expupd.C
Expand Up @@ -132,6 +132,10 @@ void updateAll(IStepError& o_stepError)
TARGETING::TargetHandleList l_ocmbTargetList;
getAllChips(l_ocmbTargetList, TYPE_OCMB_CHIP);

Target* l_pTopLevel = nullptr;
targetService().getTopLevelTarget( l_pTopLevel );
assert(l_pTopLevel, "expupd::updateAll: no TopLevelTarget");

TRACFCOMP(g_trac_expupd, ENTER_MRK
"updateAll: %d ocmb chips found",
l_ocmbTargetList.size());
Expand All @@ -144,6 +148,18 @@ void updateAll(IStepError& o_stepError)
break;
}

// Check if we have any overrides to force our behavior
auto l_forced_behavior =
l_pTopLevel->getAttr<TARGETING::ATTR_OCMB_FW_UPDATE_OVERRIDE>();

// Exit now if told to
if( TARGETING::OCMB_FW_UPDATE_BEHAVIOR_PREVENT_UPDATE
== l_forced_behavior )
{
TRACFCOMP(g_trac_expupd, INFO_MRK "Skipping update due to override (PREVENT_UPDATE)");
break;
}

// Read explorer fw image from pnor
PNOR::SectionInfo_t l_pnorSectionInfo;
rawImageInfo_t l_imageInfo;
Expand Down Expand Up @@ -269,13 +285,29 @@ void updateAll(IStepError& o_stepError)
"updateAll: SHA512 hash for ocmb[0x%08x]"
" matches SHA512 hash of PNOR image.",
TARGETING::get_huid(l_ocmbTarget));

// Add every OCMB to the update list if told to
if( TARGETING::OCMB_FW_UPDATE_BEHAVIOR_FORCE_UPDATE
== l_forced_behavior )
{
TRACFCOMP(g_trac_expupd, INFO_MRK "Forcing update due to override (FORCE_UPDATE)");
l_flashUpdateList.push_back(l_ocmbTarget);
}
}
}

TRACFCOMP(g_trac_expupd,
"updateAll: updating flash for %d OCMB chips",
l_flashUpdateList.size());

// Exit now if we were asked to only do the check portion
if( TARGETING::OCMB_FW_UPDATE_BEHAVIOR_CHECK_BUT_NO_UPDATE
== l_forced_behavior )
{
TRACFCOMP(g_trac_expupd, INFO_MRK "Skipping update due to override (CHECK_BUT_NO_UPDATE)");
break;
}

// update each explorer in the list of chips needing updates
for(const auto & l_ocmb : l_flashUpdateList)
{
Expand Down Expand Up @@ -344,9 +376,6 @@ void updateAll(IStepError& o_stepError)
{
TRACFCOMP(g_trac_expupd,
"updateAll: OCMB chip(s) was updated. Requesting reboot...");
Target* l_pTopLevel = nullptr;
targetService().getTopLevelTarget( l_pTopLevel );
assert(l_pTopLevel, "expupd::updateAll: no TopLevelTarget");
auto l_reconfigAttr =
l_pTopLevel->getAttr<TARGETING::ATTR_RECONFIGURE_LOOP>();
l_reconfigAttr |= RECONFIGURE_LOOP_OCMB_FW_UPDATE;
Expand Down
42 changes: 42 additions & 0 deletions src/usr/targeting/common/xmltohb/attribute_types.xml
Expand Up @@ -5446,6 +5446,48 @@
<no_export/>
</attribute>

<enumerationType>
<default>DEFAULT_ALL</default>
<description>Enumeration for the various OCMB Firmware update behaviors</description>
<enumerator>
<!-- Compare actual and desired versions, update if they do not match -->
<name>CHECK_VERSIONS</name>
<value>0</value>
</enumerator>
<enumerator>
<!-- Force an update regardless of the current version in the hardware -->
<name>FORCE_UPDATE</name>
<value>1</value>
</enumerator>
<enumerator>
<!-- Do not update the firwmare, do not even check the versions -->
<name>PREVENT_UPDATE</name>
<value>2</value>
</enumerator>
<enumerator>
<!-- Compare actual and desired versions, but do not do any updates -->
<name>CHECK_BUT_NO_UPDATE</name>
<value>3</value>
</enumerator>
<id>OCMB_FW_UPDATE_BEHAVIOR</id>
</enumerationType>

<attribute>
<description>
Force specific behavior for the OCMB Firmware update function.
</description>
<id>OCMB_FW_UPDATE_OVERRIDE</id>
<!-- @fixme-RTC:244420-Should be volatile-zero -->
<persistency>volatile</persistency>
<readable/>
<simpleType>
<uint8_t>
<!-- Cannot use enumeration directly due to override issue -->
<default>2</default>
</uint8_t>
</simpleType>
</attribute>

<attribute>
<description>
Physical entity path an OMI's associated OMIC parent target
Expand Down
3 changes: 3 additions & 0 deletions src/usr/targeting/common/xmltohb/target_types.xml
Expand Up @@ -2124,6 +2124,9 @@
<attribute>
<id>NVDIMM_ENCRYPTION_KEYS_FW</id>
</attribute>
<attribute>
<id>OCMB_FW_UPDATE_OVERRIDE</id>
</attribute>
<attribute>
<id>O_EREPAIR_THRESHOLD_FIELD</id>
</attribute>
Expand Down

0 comments on commit a0207ea

Please sign in to comment.