From 7e66117da698293875508fae46de8a8bb5cd9a27 Mon Sep 17 00:00:00 2001 From: Corey Swenson Date: Fri, 8 Nov 2019 16:29:49 -0600 Subject: Add NVDIMM opertions to rt_cmds Change-Id: I7b7fbe5c0248d749e80bfc3b8eaa7daa7dbf7a65 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86759 Tested-by: Jenkins Server Reviewed-by: Matt Derksen Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Roland Veloz Reviewed-by: Daniel M Crowell --- src/usr/util/runtime/rt_cmds.C | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C index bf0c51749..aa23ae7c0 100644 --- a/src/usr/util/runtime/rt_cmds.C +++ b/src/usr/util/runtime/rt_cmds.C @@ -48,6 +48,7 @@ // switchToFspScomAccess #ifdef CONFIG_NVDIMM #include // notify NVDIMM protection change +#include #endif extern char hbi_ImageId; @@ -1233,6 +1234,30 @@ void cmd_nvdDmmNvmCheckHealthStatus( char* &o_output) } // end cmd_nvdDmmNvmCheckHealthStatus +/** + * @brief Execute nvdimm operation, see interface.h for operation format + * @param[out] o_output Output display buffer, memory allocated here. + * Will inform caller if nvdimm op passes or fails. + * @param[in] i_op nvdimm operation to perform, see interface.h + */ +void cmd_nvdimm_op( char* &o_output, uint16_t i_op ) +{ + o_output = new char[500]; + + hostInterfaces::nvdimm_operation_t l_operation; + l_operation.procId = HBRT_NVDIMM_OPERATION_APPLY_TO_ALL_NVDIMMS; + l_operation.rsvd1 = 0x0; + l_operation.rsvd2 = 0x0; + l_operation.opType = (hostInterfaces::NVDIMM_Op_t)i_op; + + int rc = doNvDimmOperation(l_operation); + if (rc == -1) + { + sprintf( o_output, "Error on call doNvDimmOperation() op 0x%X",i_op); + } +} + + #endif /** @@ -1555,7 +1580,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) { @@ -1593,6 +1618,19 @@ int hbrtCommand( int argc, sprintf(*l_output, "Usage: nvdimm_nvm_check_status"); } } + else if( !strcmp( argv[0], "nvdimm_op" ) ) + { + if (argc == 2) + { + uint16_t op = strtou64(argv[1], NULL, 16); + cmd_nvdimm_op( *l_output, op ); + } + else + { + *l_output = new char[100]; + sprintf(*l_output, "ERROR: nvdimm_op "); + } + } #endif else @@ -1638,6 +1676,11 @@ int hbrtCommand( int argc, strcat( *l_output, l_tmpstr ); sprintf( l_tmpstr, "nvdimm_nvm_check_status\n"); strcat( *l_output, l_tmpstr ); + sprintf( l_tmpstr, "nvdimm_op \n" + " 0x1=disarm 0x2=disable_encryption 0x4=remove_keys\n" + " 0x8=enable_encryption 0x10=arm 0x20=es_healthcheck\n" + " 0x40=nvm_healthcheck\n"); + strcat( *l_output, l_tmpstr ); #endif -- cgit v1.2.1