Skip to content

Commit

Permalink
Add NVDIMM opertions to rt_cmds
Browse files Browse the repository at this point in the history
Change-Id: I7b7fbe5c0248d749e80bfc3b8eaa7daa7dbf7a65
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86759
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@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: Daniel M Crowell <dcrowell@us.ibm.com>
  • Loading branch information
cvswen authored and dcrowell77 committed Nov 18, 2019
1 parent d8decc6 commit 7e66117
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/usr/util/runtime/rt_cmds.C
Expand Up @@ -48,6 +48,7 @@
// switchToFspScomAccess
#ifdef CONFIG_NVDIMM
#include <isteps/nvdimm/nvdimm.H> // notify NVDIMM protection change
#include <util/runtime/rt_fwnotify.H>
#endif

extern char hbi_ImageId;
Expand Down Expand Up @@ -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

/**
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 <op>");
}
}

#endif
else
Expand Down Expand Up @@ -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 <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

Expand Down

0 comments on commit 7e66117

Please sign in to comment.