summaryrefslogtreecommitdiffstats
path: root/src/usr/util/runtime/rt_cmds.C
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2019-07-24 13:05:54 -0500
committerDaniel M Crowell <dcrowell@us.ibm.com>2019-07-31 16:04:54 -0500
commitf088a0dc26ed66496d593af1c0c291ac44f4cb4f (patch)
treedc13b4fa2ef07ed14eb9999a11702264618a771a /src/usr/util/runtime/rt_cmds.C
parent44c6d599b85ac7a9c0a4dea70ea49a7a7916f128 (diff)
downloadtalos-hostboot-f088a0dc26ed66496d593af1c0c291ac44f4cb4f.tar.gz
talos-hostboot-f088a0dc26ed66496d593af1c0c291ac44f4cb4f.zip
Miscellaneous NVDIMM cleanup
- Move constants to .C file - Use constants for NVDIMM states - Clean up rt_cmds NVDIMM protection function Change-Id: I3ff81c76971e962eb99e2f3b6ea1f109355d337a Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81261 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: Matt Derksen <mderkse1@us.ibm.com> Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/util/runtime/rt_cmds.C')
-rw-r--r--src/usr/util/runtime/rt_cmds.C65
1 files changed, 11 insertions, 54 deletions
diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C
index fa50b0684..032559644 100644
--- a/src/usr/util/runtime/rt_cmds.C
+++ b/src/usr/util/runtime/rt_cmds.C
@@ -1162,63 +1162,20 @@ void cmd_nvdimm_protection_msg( char* &o_output, uint32_t i_huid,
{
errlHndl_t l_err = nullptr;
o_output = new char[500];
- uint8_t l_notifyType = 0;
TARGETING::Target* l_targ{};
l_targ = getTargetFromHUID(i_huid);
- if (l_targ != NULL)
- {
- if (protection == NVDIMM::NVDIMM_ARMED)
- {
- l_notifyType = NVDIMM::NVDIMM_ARMED;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NVDIMM_ARMED);
- }
- else if (protection == NVDIMM::NVDIMM_DISARMED)
- {
- l_notifyType = NVDIMM::NVDIMM_DISARMED;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NVDIMM_DISARMED);
- }
- else if (protection == NVDIMM::OCC_ACTIVE)
- {
- l_notifyType = NVDIMM::OCC_ACTIVE;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::OCC_ACTIVE);
- }
- else if (protection == NVDIMM::OCC_INACTIVE)
- {
- l_notifyType = NVDIMM::OCC_INACTIVE;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::OCC_INACTIVE);
- }
- else if (protection == NVDIMM::NVDIMM_FATAL_HW_ERROR)
- {
- l_notifyType = NVDIMM::NVDIMM_FATAL_HW_ERROR;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NVDIMM_FATAL_HW_ERROR);
- }
- else if (protection == NVDIMM::NVDIMM_RISKY_HW_ERROR)
- {
- l_notifyType = NVDIMM::NVDIMM_RISKY_HW_ERROR;
- l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NVDIMM_RISKY_HW_ERROR);
- }
- else
- {
- sprintf( o_output,
- "cmd_nvdimm_protection_msg: HUID 0x%.8X "
- "unknown protection type 0x%.2X",
- i_huid, protection );
- }
- if (l_err)
- {
- sprintf( o_output, "Error on call to notifyNvdimmProtectionChange"
- "(0x%.8X, %d), rc=0x%.8X, plid=0x%.8X",
- i_huid, l_notifyType, ERRL_GETRC_SAFE(l_err), l_err->plid() );
- errlCommit(l_err, UTIL_COMP_ID);
- return;
- }
- }
- else
+
+ // protection should match enum from nvdimm_protection_t
+ // No match will just return, no error generated
+ l_err = notifyNvdimmProtectionChange( l_targ,
+ (NVDIMM::nvdimm_protection_t)protection);
+ if (l_err)
{
- sprintf( o_output, "cmd_nvdimm_protection_msg: HUID 0x%.8X not found",
- i_huid );
- return;
+ sprintf( o_output, "Error on call to notifyNvdimmProtectionChange"
+ "(0x%.8X, %d), rc=0x%.8X, plid=0x%.8X",
+ i_huid, protection, ERRL_GETRC_SAFE(l_err), l_err->plid() );
+ errlCommit(l_err, UTIL_COMP_ID);
}
}
#endif
@@ -1543,7 +1500,7 @@ int hbrtCommand( int argc,
}
}
#ifdef CONFIG_NVDIMM
- else if( !strcmp( argv[0], "nvdimm_protection" ) )
+ else if( !strcmp( argv[0], "nvdimm_protection" ) )
{
if (argc >= 3)
{
OpenPOWER on IntegriCloud