summaryrefslogtreecommitdiffstats
path: root/src/usr/htmgt/htmgt_occcmd.C
diff options
context:
space:
mode:
authorChris Cain <cjcain@us.ibm.com>2015-01-14 09:23:57 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-01-22 17:40:08 -0600
commitd84c27a1ba1c915e0fdcb2b638d729fe1bdff4fe (patch)
tree2135aa332fc89e1275934d8e2948cb2168a35dff /src/usr/htmgt/htmgt_occcmd.C
parent38cfbf78f1b0393131bb6d7772d7e9948b03096e (diff)
downloadtalos-hostboot-d84c27a1ba1c915e0fdcb2b638d729fe1bdff4fe.tar.gz
talos-hostboot-d84c27a1ba1c915e0fdcb2b638d729fe1bdff4fe.zip
Add support for linux command to set OCC state.
Change-Id: I1ac4d810e0f4509dc89c645bef183f5cb2179b1c RTC: 115213 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15154 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Matt Spinler <spinler@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/htmgt/htmgt_occcmd.C')
-rw-r--r--src/usr/htmgt/htmgt_occcmd.C50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/usr/htmgt/htmgt_occcmd.C b/src/usr/htmgt/htmgt_occcmd.C
index 749efbdc9..0da7630bf 100644
--- a/src/usr/htmgt/htmgt_occcmd.C
+++ b/src/usr/htmgt/htmgt_occcmd.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014 */
+/* Contributors Listed Below - COPYRIGHT 2014,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -42,7 +42,7 @@
#include <trace/interface.H>
#include <errl/errlmanager.H>
#include <stdio.h>
-
+#include <console/consoleif.H>
namespace HTMGT
@@ -86,6 +86,36 @@ namespace HTMGT
};
+#ifdef CONFIG_CONSOLE_OUTPUT_OCC_COMM
+ // Dump header information and set of binary data to the console.
+ // NOTE: Data is dumped in groups of 16 bytes. If i_len is not a
+ // multiple of 16, additional data data will be dumped.
+ void dumpToConsole(const char * i_header,
+ const uint8_t * i_data,
+ uint16_t i_len)
+ {
+#ifndef __HOSTBOOT_RUNTIME
+ if (i_header[0] != '\0')
+ {
+ CONSOLE::displayf(HTMGT_COMP_NAME, "%s", i_header);
+ }
+ uint16_t index = 0;
+ while (index < i_len)
+ {
+ CONSOLE::displayf(HTMGT_COMP_NAME, "%04X: %08X %08X %08X %08X",
+ index,
+ UINT32_GET(&i_data[index]),
+ UINT32_GET(&i_data[index+4]),
+ UINT32_GET(&i_data[index+8]),
+ UINT32_GET(&i_data[index+12]));
+ index += 16;
+ }
+ CONSOLE::flush();
+#endif
+ }
+#endif
+
+
/**
* @brief Get the index of the specified command in the command table
*
@@ -950,14 +980,20 @@ namespace HTMGT
cmdBuffer[l_send_length++] = (iv_OccCmd.checksum >> 8) & 0xFF;
cmdBuffer[l_send_length++] = iv_OccCmd.checksum & 0xFF;
- //@fixme-RTC:119833-this hangs HB if traces are sent out to the console
-#ifndef CONFIG_CONSOLE_OUTPUT_TRACE
if (G_debug_trace & DEBUG_TRACE_OCCCMD)
{
// Trace the command
TMGT_BIN("buildOccCmdBuffer: OCC command (up to 256 bytes)",
cmdBuffer, std::min(l_send_length, (uint16_t)256));
}
+
+#ifdef CONFIG_CONSOLE_OUTPUT_OCC_COMM
+ // Trace full OCC command
+ char header[64];
+ sprintf(header, "OCC Command: %s (%d bytes)",
+ command_string(iv_OccCmd.cmdType), l_send_length);
+ dumpToConsole(header, cmdBuffer,
+ std::min(l_send_length,(uint16_t)256));
#endif
#ifdef SIMICS_TESTING
@@ -990,6 +1026,12 @@ namespace HTMGT
if ((NULL != rspBuffer) && (rspLen >= OCC_RSP_HDR_LENGTH))
{
+#ifdef CONFIG_CONSOLE_OUTPUT_OCC_COMM
+ // Trace raw OCC response
+ char header[64];
+ sprintf(header, "OCC Response: (%d bytes)", rspLen);
+ dumpToConsole(header, rspBuffer, std::min(rspLen,(uint16_t)256));
+#endif
iv_OccRsp.sequenceNumber = rspBuffer[l_index++];
iv_OccRsp.cmdType = (enum occCommandType)rspBuffer[l_index++];
iv_OccRsp.returnStatus = (occReturnCodes)rspBuffer[l_index++];
OpenPOWER on IntegriCloud