summaryrefslogtreecommitdiffstats
path: root/src/usr/util/runtime/rt_cmds.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/util/runtime/rt_cmds.C')
-rw-r--r--src/usr/util/runtime/rt_cmds.C69
1 files changed, 68 insertions, 1 deletions
diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C
index bab3a85d4..c015215b5 100644
--- a/src/usr/util/runtime/rt_cmds.C
+++ b/src/usr/util/runtime/rt_cmds.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2018 */
+/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -46,6 +46,9 @@
#include <scom/runtime/rt_scomif.H> // sendScomOpToFsp,
// sendMultiScomReadToFsp,
// switchToFspScomAccess
+#ifdef CONFIG_NVDIMM
+#include <isteps/nvdimm/nvdimm.H> // notify NVDIMM protection change
+#endif
extern char hbi_ImageId;
@@ -1153,6 +1156,49 @@ void cmd_sendMultiScomReadToFSP( char* &o_output,
}
}
+#ifdef CONFIG_NVDIMM
+void cmd_nvdimm_protection_msg( char* &o_output, uint32_t i_huid,
+ uint32_t protection )
+{
+ errlHndl_t l_err = nullptr;
+ o_output = new char[500];
+ uint8_t l_notifyType = NVDIMM::NOT_PROTECTED;
+
+ TARGETING::Target* l_targ{};
+ l_targ = getTargetFromHUID(i_huid);
+ if (l_targ != NULL)
+ {
+ if (protection == 1)
+ {
+ l_notifyType = NVDIMM::PROTECTED;
+ l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::PROTECTED);
+ }
+ else if (protection == 2)
+ {
+ l_notifyType = NVDIMM::UNPROTECTED_BECAUSE_ERROR;
+ l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::UNPROTECTED_BECAUSE_ERROR);
+ }
+ else
+ {
+ l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NOT_PROTECTED);
+ }
+ 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
+ {
+ sprintf( o_output, "cmd_nvdimm_protection_msg: HUID 0x%.8X not found",
+ i_huid );
+ return;
+ }
+}
+#endif
/**
* @brief Execute an arbitrary command inside Hostboot Runtime
@@ -1473,6 +1519,22 @@ int hbrtCommand( int argc,
"ERROR: multiScomReadToFsp <huid> <scomAddrs>");
}
}
+#ifdef CONFIG_NVDIMM
+ else if( !strcmp( argv[0], "nvdimm_protection" ) )
+ {
+ if (argc >= 3)
+ {
+ uint32_t huid = strtou64(argv[1], NULL, 16);
+ uint32_t protection = strtou64( argv[2], NULL, 16);
+ cmd_nvdimm_protection_msg( *l_output, huid, protection );
+ }
+ else
+ {
+ *l_output = new char[100];
+ sprintf(*l_output, "ERROR: nvdimm_protection <huid> <0 or 1>");
+ }
+ }
+#endif
else
{
*l_output = new char[50+100*12];
@@ -1509,6 +1571,11 @@ int hbrtCommand( int argc,
strcat( *l_output, l_tmpstr );
sprintf( l_tmpstr, "multiScomReadToFsp <huid> <scomAddrs>\n");
strcat( *l_output, l_tmpstr );
+#ifdef CONFIG_NVDIMM
+ sprintf( l_tmpstr, "nvdimm_protection <huid> <0 or 1>\n");
+ strcat( *l_output, l_tmpstr );
+#endif
+
}
if( l_traceOut && (*l_output != NULL) )
OpenPOWER on IntegriCloud