summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usr/util/runtime/rt_cmds.C38
-rw-r--r--src/usr/util/runtime/test/testruncommand.H28
2 files changed, 66 insertions, 0 deletions
diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C
index 8ccb60852..b9c0e4324 100644
--- a/src/usr/util/runtime/rt_cmds.C
+++ b/src/usr/util/runtime/rt_cmds.C
@@ -44,6 +44,8 @@
#include <p9_hcd_memmap_base.H> // for reload_pm_complex
#include <p9_stop_data_struct.H> // for reload_pm_complex
+extern char hbi_ImageId;
+
// need this here so compile works, linker will later find this
namespace RTPM
{
@@ -931,6 +933,26 @@ int cmd_reload_pm_complex( char*& o_output, uint64_t stopAt )
return rc;
}
+
+/**
+ * @brief Read version of HBRT
+ * @param[out] o_output Output display buffer, memory allocated here
+ */
+void cmd_readHBRTversion( char*& o_output )
+{
+ UTIL_FT( "cmd_readHBRTversion");
+
+ const char * const l_title = "Hostboot Build ID: ";
+ o_output = new char[strlen(l_title) + strlen(&hbi_ImageId) + 1];
+ // Set beginning of output string
+ strcpy(o_output, l_title);
+ // Concatenate the Hostboot Image ID
+ strcat(o_output, &hbi_ImageId);
+
+ UTIL_FT( "%s", o_output);
+}
+
+
/**
* @brief Execute an arbitrary command inside Hostboot Runtime
* @param[in] Number of arguments (standard C args)
@@ -1149,6 +1171,20 @@ int hbrtCommand( int argc,
}
rc = cmd_reload_pm_complex(*l_output, breakPoint);
}
+ else if( !strcmp( argv[0], "readHBRTversion" ) )
+ {
+ // readHBRTversion
+ if( argc == 1 )
+ {
+ cmd_readHBRTversion( *l_output );
+ }
+ else
+ {
+ *l_output = new char[100];
+ sprintf( *l_output,
+ "ERROR: readHBRTversion\n" );
+ }
+ }
else
{
*l_output = new char[50+100*10];
@@ -1174,6 +1210,8 @@ int hbrtCommand( int argc,
strcat( *l_output, l_tmpstr );
sprintf( l_tmpstr, "reload_pm_complex [<breakPoint>]\n");
strcat( *l_output, l_tmpstr );
+ sprintf( l_tmpstr, "readHBRTversion\n");
+ strcat( *l_output, l_tmpstr );
}
if( l_traceOut && (*l_output != NULL) )
diff --git a/src/usr/util/runtime/test/testruncommand.H b/src/usr/util/runtime/test/testruncommand.H
index 9bdb15981..9dbb6b5c0 100644
--- a/src/usr/util/runtime/test/testruncommand.H
+++ b/src/usr/util/runtime/test/testruncommand.H
@@ -129,4 +129,32 @@ class RunCommandTest : public CxxTest::TestSuite
if( outstr ) delete[] outstr;
}
+
+
+ /**
+ * @brief Test read HBRT version operation
+ */
+ void testRunCommandReadHbrtVersion(void)
+ {
+ int rc = 0;
+ char* outstr = NULL;
+
+ char arg0[20]; memcpy( arg0, "readHBRTversion", 16 );
+ const char* argv[] = { arg0 };
+
+ // do a read
+ rc = (getRuntimeInterfaces()->run_command)( 1, argv, &outstr );
+ if( rc )
+ {
+ TS_FAIL( "testRunCommandReadHbrtVersion> rc=%d", rc );
+ }
+ if( outstr == NULL )
+ {
+ TS_FAIL( "testRunCommandReadHbrtVersion> outstr is NULL" );
+ }
+ TRACFCOMP( Util::g_util_trace,
+ "testRunCommandReadHbrtVersion> rc=%d :: %s",
+ rc, outstr == NULL ? "null" : outstr );
+ if( outstr ) delete[] outstr;
+ }
};
OpenPOWER on IntegriCloud