summaryrefslogtreecommitdiffstats
path: root/src/usr/expaccess
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/expaccess')
-rw-r--r--src/usr/expaccess/errlud_expscom.C216
-rw-r--r--src/usr/expaccess/errlud_expscom.H160
-rw-r--r--src/usr/expaccess/expaccess.mk5
-rw-r--r--src/usr/expaccess/plugins/EXPSCOM_COMP_ID_Parse.C32
-rw-r--r--src/usr/expaccess/plugins/errludP_expscom.H168
-rw-r--r--src/usr/expaccess/plugins/expscomUdParserFactory.H58
-rw-r--r--src/usr/expaccess/test/expErrlTest.C158
-rw-r--r--src/usr/expaccess/test/expErrlTest.H129
-rw-r--r--src/usr/expaccess/test/rcExpLog.C55
-rw-r--r--src/usr/expaccess/test/rcExpLog.H49
-rw-r--r--src/usr/expaccess/test/test.mk18
11 files changed, 1039 insertions, 9 deletions
diff --git a/src/usr/expaccess/errlud_expscom.C b/src/usr/expaccess/errlud_expscom.C
new file mode 100644
index 000000000..7480b9887
--- /dev/null
+++ b/src/usr/expaccess/errlud_expscom.C
@@ -0,0 +1,216 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/errlud_expscom.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file errlud_expscom.C
+ * @brief Utility to add Explorer logs to your hostboot error
+ */
+#include "errlud_expscom.H"
+#include "expscom_trace.H"
+#include <errl/hberrltypes.H> // pelSectionHeader_t
+#include <exp_fw_log_data.H> // explorer log gathering tools
+#include <fapi2/plat_hwp_invoker.H> // FAPI_INVOKE_HWP
+#include <expscom/expscom_reasoncodes.H> // user-detail subsections
+#include <errl/errlmanager.H> // errlCommit
+
+using namespace EXPSCOM;
+
+// Main function to add Explorer logs to a HB error log
+bool EXPSCOM::expAddLog( const exp_log_type i_type,
+ TARGETING::Target * i_ocmb,
+ errlHndl_t & io_errl )
+{
+ bool l_logsAdded = false;
+ explog_section_header_t l_header; // use 0 defaults
+
+ // Meta data included with each section
+ const uint32_t META_SECTION_SIZE = sizeof(l_header) +
+ sizeof(ERRORLOG::pelSectionHeader_t);
+
+ // @todo RTC 214628
+ // Hopefully create a way to tell how much room is left in io_errl
+ uint32_t l_bytesAvailableInLog = 4 * KILOBYTE;
+
+ if (l_bytesAvailableInLog > META_SECTION_SIZE)
+ {
+ errlHndl_t l_errl = nullptr;
+ std::vector<uint8_t>l_error_log_data; // explorer error entry data
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_fapi_ocmb_target(i_ocmb);
+
+ // Make HWP call to grab explorer error log data
+ if (i_type == EXPSCOM::ACTIVE_LOG)
+ {
+ TRACFCOMP( g_trac_expscom, INFO_MRK "FAPI_INVOKE_HWP exp_active_error_log");
+ FAPI_INVOKE_HWP( l_errl, exp_active_log,
+ l_fapi_ocmb_target, l_error_log_data );
+ }
+ else
+ {
+ TRACFCOMP( g_trac_expscom, INFO_MRK "FAPI_INVOKE_HWP exp_saved_error_log");
+ FAPI_INVOKE_HWP( l_errl, exp_saved_log,
+ l_fapi_ocmb_target, l_error_log_data );
+ }
+
+ if (l_errl)
+ {
+ // Unable to grab explorer error log data
+ TRACFCOMP( g_trac_expscom, ERR_MRK "Unable to grab explorer error log data");
+ l_errl->collectTrace(EXPSCOM_COMP_NAME);
+
+ // This error is not a system critical failure, should be just noted
+ l_errl->setSev(ERRORLOG::ERRL_SEV_INFORMATIONAL);
+
+ // Associate this error with the original explorer failure log
+ l_errl->plid(io_errl->plid());
+ errlCommit(l_errl, EXPSCOM_COMP_ID);
+ }
+ else
+ {
+ // Cycle through data and add sections to io_errl
+ // Most recent error log entries are at the end of the data returned
+ // so need to work backwards from the end
+ l_header.error_data_size = FIRST_EXPLORER_DATA_SECTION_SIZE;
+ uint32_t l_explorer_bytes_left = l_error_log_data.size();
+ uint8_t * l_end_ptr = l_error_log_data.data() + l_explorer_bytes_left;
+
+ // while explorer data to append
+ while (l_explorer_bytes_left && l_bytesAvailableInLog)
+ {
+ // Can we add a full packet size of error data?
+ if (l_bytesAvailableInLog > (l_header.error_data_size + META_SECTION_SIZE))
+ {
+ // Check if we don't have full packet of explorer error data
+ if (l_explorer_bytes_left < l_header.error_data_size)
+ {
+ // Reduce the packet size to include the last of explorer error data
+ l_header.error_data_size = l_explorer_bytes_left;
+ }
+ }
+ else if ( l_bytesAvailableInLog > META_SECTION_SIZE ) // Any room left for another section?
+ {
+ // Is there enough explorer error data for room available?
+ if ( l_explorer_bytes_left >=
+ (l_bytesAvailableInLog - META_SECTION_SIZE) )
+ {
+ // Not enough room is available for all the remaining explorer error data
+ // Use up the rest of the space available
+ l_header.error_data_size = l_bytesAvailableInLog - META_SECTION_SIZE;
+ }
+ else
+ {
+ // Room is available but not enough explorer data for full packet size
+ // Reduce the packet size to include the last of explorer error data
+ l_header.error_data_size = l_explorer_bytes_left;
+ }
+ }
+ else
+ {
+ // No more space available in hostboot error log
+ break;
+ }
+
+ // Offset into explorer error log data returned
+ l_header.offset_exp_log = l_explorer_bytes_left -
+ l_header.error_data_size;
+
+ // Add the section entry to the HWP error log
+ if ( i_type == EXPSCOM::ACTIVE_LOG )
+ {
+ ExpscomActiveLogUD(l_header, (l_end_ptr - l_header.error_data_size)).
+ addToLog(io_errl);
+ }
+ else
+ {
+ ExpscomSavedLogUD(l_header, (l_end_ptr - l_header.error_data_size)).
+ addToLog(io_errl);
+ }
+ l_logsAdded = true;
+
+ // Update to next packet of Explorer error log data
+ l_end_ptr -= l_header.error_data_size; // update to always be the tail of data to add
+ l_header.packet_num++;
+ l_explorer_bytes_left -= l_header.error_data_size;
+ l_bytesAvailableInLog -= (META_SECTION_SIZE + l_header.error_data_size);
+ l_header.error_data_size = FOLLOWING_EXPLORER_DATA_SECTION_SIZE;
+ }
+ }
+ }
+ else
+ {
+ TRACFCOMP( g_trac_expscom, INFO_MRK
+ "expAddErrorLog: Unable to add any %d type error logs,"
+ " only have %d bytes available in log", i_type, l_bytesAvailableInLog );
+ }
+ return l_logsAdded;
+}
+
+//------------------------------------------------------------------------------
+// Expscom Active Log User Details
+//------------------------------------------------------------------------------
+ExpscomActiveLogUD::ExpscomActiveLogUD(
+ const explog_section_header_t & i_header_info,
+ const uint8_t * i_data_portion )
+{
+ // Set up Ud instance variables
+ iv_CompId = EXPSCOM_COMP_ID;
+ iv_Version = 1;
+ iv_SubSection = EXPSCOM_UDT_ACTIVE_LOG;
+
+ uint8_t * l_pBuf = reallocUsrBuf( sizeof(i_header_info) +
+ i_header_info.error_data_size );
+
+ memcpy(l_pBuf, &i_header_info, sizeof(i_header_info));
+ l_pBuf += sizeof(i_header_info);
+ memcpy(l_pBuf, i_data_portion, i_header_info.error_data_size);
+ l_pBuf += i_header_info.error_data_size;
+}
+
+ExpscomActiveLogUD::~ExpscomActiveLogUD()
+{
+}
+
+//------------------------------------------------------------------------------
+// Expscom Saved Log User Details
+//------------------------------------------------------------------------------
+ExpscomSavedLogUD::ExpscomSavedLogUD(
+ const explog_section_header_t & i_header_info,
+ const uint8_t * i_data_portion )
+{
+ // Set up Ud instance variables
+ iv_CompId = EXPSCOM_COMP_ID;
+ iv_Version = 1;
+ iv_SubSection = EXPSCOM_UDT_SAVED_LOG;
+
+ uint8_t * l_pBuf = reallocUsrBuf( sizeof(i_header_info) +
+ i_header_info.error_data_size );
+
+ memcpy(l_pBuf, &i_header_info, sizeof(i_header_info));
+ l_pBuf += sizeof(i_header_info);
+ memcpy(l_pBuf, i_data_portion, i_header_info.error_data_size);
+ l_pBuf += i_header_info.error_data_size;
+}
+
+ExpscomSavedLogUD::~ExpscomSavedLogUD()
+{
+}
diff --git a/src/usr/expaccess/errlud_expscom.H b/src/usr/expaccess/errlud_expscom.H
new file mode 100644
index 000000000..acb17bc2c
--- /dev/null
+++ b/src/usr/expaccess/errlud_expscom.H
@@ -0,0 +1,160 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/errlud_expscom.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#ifndef __ERRLUD_EXPSCOM_H
+#define __ERRLUD_EXPSCOM_H
+
+/**
+ * @file errlud_expscom.H
+ * @brief Utility functions to add Explorer logs to your hostboot error
+ */
+#include <stdint.h>
+
+#include <errl/errluserdetails.H>
+
+// targeting support
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/utilFilter.H>
+
+namespace EXPSCOM
+{
+/**
+ * @brief Enum for what kind of Explorer log
+ */
+enum exp_log_type : uint8_t
+{
+ ACTIVE_LOG = 1, // RAM error section
+ SAVED_LOG = 2 // SPI flash error section
+};
+
+/**
+ * @brief Adds Explorer log data to platform log
+ * Grabs explorer error log based on type and then breaks that data
+ * into smaller user-data sections adding them to the platform log.
+ * Note: First section will be the smallest and contain the most recent
+ * trace data. Probably contains most relevent traces, so try to make
+ * always fit in the error log.
+ * @param i_type - what kind of explorer error log to add
+ * @param i_ocmb - Explorer target
+ * @param io_errl - Platform error log to add logs into
+ * @return true if explorer error data added, else false
+ */
+bool expAddLog( const exp_log_type i_type,
+ TARGETING::Target * i_ocmb,
+ errlHndl_t & io_errl );
+
+
+
+/**
+ * @brief Header data of every explorer error log user-data section
+ */
+struct explog_section_header_t
+{
+ uint16_t packet_num; // ordering byte (0 = first packet)
+ uint32_t offset_exp_log; // offset where data portion started in full explorer log
+ uint16_t error_data_size; // size of data portion following header
+
+ explog_section_header_t()
+ : packet_num(0),
+ offset_exp_log(0),
+ error_data_size(0)
+ {}
+} __attribute__((__packed__));
+
+// Break large explorer log data into smaller error sections
+// to avoid dropping important debug data.
+// Make most important first section smaller so this won't get dropped
+const uint16_t FIRST_EXPLORER_DATA_SECTION_SIZE = 0x0100;
+const uint16_t FOLLOWING_EXPLORER_DATA_SECTION_SIZE = 0x0200;
+
+
+/**
+ * @class ExpscomActiveLogUD
+ *
+ * Adds Explorer Active log information to an error log as user detail
+ * Data is from Explorer RAM
+ *
+ */
+class ExpscomActiveLogUD : public ERRORLOG::ErrlUserDetails
+{
+ public:
+ /**
+ * @brief Constructor
+ *
+ * @param i_header_info Meta information added to beginning of section
+ * @param i_data_portion Pointer to portion of Active log data
+ *
+ */
+ ExpscomActiveLogUD( const explog_section_header_t & i_header_info,
+ const uint8_t * i_data_portion );
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ExpscomActiveLogUD();
+
+ // Disabled
+ ExpscomActiveLogUD() = delete;
+ ExpscomActiveLogUD(ExpscomActiveLogUD &) = delete;
+ ExpscomActiveLogUD & operator=(ExpscomActiveLogUD &) = delete;
+};
+
+
+
+
+/**
+ * @class ExpscomSavedLogUD
+ *
+ * Adds Explorer Saved log information to an error log as user detail
+ * Data is from Explorer SPI flash
+ *
+ */
+class ExpscomSavedLogUD : public ERRORLOG::ErrlUserDetails
+{
+ public:
+ /**
+ * @brief Constructor
+ *
+ * @param i_header_info Meta information added to beginning of section
+ * @param i_data_portion Pointer to portion of Saved error data
+ *
+ */
+ ExpscomSavedLogUD( const explog_section_header_t & i_header_info,
+ const uint8_t * i_data_portion );
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ExpscomSavedLogUD();
+
+ // Disabled
+ ExpscomSavedLogUD() = delete;
+ ExpscomSavedLogUD(ExpscomSavedLogUD &) = delete;
+ ExpscomSavedLogUD & operator=(ExpscomSavedLogUD &) = delete;
+};
+
+}
+
+#endif
diff --git a/src/usr/expaccess/expaccess.mk b/src/usr/expaccess/expaccess.mk
index d71b7e591..d4431e0cd 100644
--- a/src/usr/expaccess/expaccess.mk
+++ b/src/usr/expaccess/expaccess.mk
@@ -22,10 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-
EXTRAINCDIR += ${ROOTPATH}/src/import
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/inband/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
@@ -39,3 +39,6 @@ OBJS += expscom_trace.o
OBJS += expscom_utils.o
OBJS += i2cscomdd.o
OBJS += mmioscomdd.o
+OBJS += exp_fw_log.o
+OBJS += exp_fw_log_data.o
+OBJS += errlud_expscom.o
diff --git a/src/usr/expaccess/plugins/EXPSCOM_COMP_ID_Parse.C b/src/usr/expaccess/plugins/EXPSCOM_COMP_ID_Parse.C
new file mode 100644
index 000000000..54bf595b6
--- /dev/null
+++ b/src/usr/expaccess/plugins/EXPSCOM_COMP_ID_Parse.C
@@ -0,0 +1,32 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/plugins/EXPSCOM_COMP_ID_Parse.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file EXPSCOM_COMP_ID_Parse.C
+ * @brief Build the Explorer User Details parser factory
+ */
+#include "errludparser.H"
+#include "expscomUdParserFactory.H"
+
+ERRL_MAKE_UD_PARSER(EXPSCOM::UserDetailsParserFactory, hbfw::EXPSCOM_COMP_ID)
diff --git a/src/usr/expaccess/plugins/errludP_expscom.H b/src/usr/expaccess/plugins/errludP_expscom.H
new file mode 100644
index 000000000..73d449ba4
--- /dev/null
+++ b/src/usr/expaccess/plugins/errludP_expscom.H
@@ -0,0 +1,168 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/plugins/errludP_expscom.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef ERRL_UDP_EXPSCOM_H
+#define ERRL_UDP_EXPSCOM_H
+
+/**
+ * @file errludP_expscom.H
+ * Defines the ErrlUserDetailsParser classes that parse EXPSCOM FFDC
+ */
+
+#include "errluserdetails.H"
+#include <string.h>
+
+#define TO_UINT16(ptr) (ntohs(*(reinterpret_cast<uint16_t*>(ptr))))
+#define TO_UINT32(ptr) (ntohl(*(reinterpret_cast<uint32_t*>(ptr))))
+
+namespace EXPSCOM
+{
+
+/**
+ * @brief Header data of every explorer error log section
+ */
+typedef struct __attribute__((packed))
+{
+ uint16_t packet_num; // ordering byte (0 = first packet)
+ uint32_t offset_exp_log; // offset where data portion started in full explorer log
+ uint16_t error_data_size; // size of data portion following header
+} explog_section_header_t;
+
+/**
+ * @class UdParserExpActiveErrorLog
+ *
+ * Parses user-data sections for Explorer's Active logs
+ */
+class UdParserExpActiveLog : public ERRORLOG::ErrlUserDetailsParser
+{
+public:
+ /**
+ * @brief Constructor
+ */
+ UdParserExpActiveLog() {}
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~UdParserExpActiveLog() {}
+
+ /**
+ * @brief Parses string user detail data from an error log
+ *
+ * @param i_version Version of the data
+ * @param i_parse ErrlUsrParser object for outputting information
+ * @param i_pBuffer Pointer to buffer containing detail data
+ * @param i_buflen Length of the buffer
+ */
+ virtual void parse(errlver_t i_version,
+ ErrlUsrParser & i_parser,
+ void * i_pBuffer,
+ const uint32_t i_buflen) const
+ {
+ explog_section_header_t * pHeader = reinterpret_cast<explog_section_header_t *>(i_pBuffer);
+ i_parser.PrintHeading("Explorer Active (RAM) Log Data");
+ i_parser.PrintNumber("Order packet", "%d", TO_UINT16(&(pHeader->packet_num)));
+ i_parser.PrintNumber("Data starting offset", "0x%.8lX", TO_UINT32(&(pHeader->offset_exp_log)));
+ i_parser.PrintNumber("Size of data section", "0x%.4lX", TO_UINT16(&(pHeader->error_data_size)));
+ i_parser.PrintBlank();
+ uint16_t errorDataSize = TO_UINT16(&(pHeader->error_data_size));
+ if (errorDataSize <= (i_buflen - sizeof(explog_section_header_t)))
+ {
+ char * l_trace_error_data = static_cast<char*>(i_pBuffer) + sizeof(explog_section_header_t);
+ i_parser.PrintHexDump(l_trace_error_data, errorDataSize);
+ }
+ else
+ {
+ i_parser.PrintHeading("ERROR DATA MISSING -- printing entire section in hex");
+ i_parser.PrintNumber("Expected data size", "0x%.4lX", i_buflen - sizeof(explog_section_header_t));
+ i_parser.PrintHexDump(i_pBuffer, i_buflen);
+ }
+
+ }
+
+ // Disabled
+ UdParserExpActiveLog(const UdParserExpActiveLog&) = delete;
+ UdParserExpActiveLog & operator=(const UdParserExpActiveLog&) = delete;
+};
+
+/**
+ * @class UdParserExpSavedErrorLog
+ *
+ * Parses user-data sections for Explorer's Saved logs
+ */
+class UdParserExpSavedLog : public ERRORLOG::ErrlUserDetailsParser
+{
+public:
+ /**
+ * @brief Constructor
+ */
+ UdParserExpSavedLog() {}
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~UdParserExpSavedLog() {}
+
+ /**
+ * @brief Parses string user detail data from an error log
+ *
+ * @param i_version Version of the data
+ * @param i_parse ErrlUsrParser object for outputting information
+ * @param i_pBuffer Pointer to buffer containing detail data
+ * @param i_buflen Length of the buffer
+ */
+ virtual void parse(errlver_t i_version,
+ ErrlUsrParser & i_parser,
+ void * i_pBuffer,
+ const uint32_t i_buflen) const
+ {
+ explog_section_header_t * pHeader = reinterpret_cast<explog_section_header_t *>(i_pBuffer);
+ i_parser.PrintHeading("Explorer Saved (SPI flash) Log Data");
+ i_parser.PrintNumber("Order packet", "%d", TO_UINT16(&(pHeader->packet_num)));
+ i_parser.PrintNumber("Data starting offset", "0x%.8lX", TO_UINT32(&(pHeader->offset_exp_log)));
+ i_parser.PrintNumber("Size of data section", "0x%.4lX", TO_UINT16(&(pHeader->error_data_size)));
+ i_parser.PrintBlank();
+ uint16_t errorDataSize = TO_UINT16(&pHeader->error_data_size);
+ if (errorDataSize <= (i_buflen - sizeof(explog_section_header_t)))
+ {
+ char * l_trace_error_data = static_cast<char*>(i_pBuffer) + sizeof(explog_section_header_t);
+ i_parser.PrintHexDump(l_trace_error_data, errorDataSize);
+ }
+ else
+ {
+ i_parser.PrintHeading("ERROR DATA MISSING -- printing entire section in hex");
+ i_parser.PrintNumber("Expected data size", "0x%.4lX", i_buflen - sizeof(explog_section_header_t));
+ i_parser.PrintHexDump(i_pBuffer, i_buflen);
+ }
+
+ }
+
+ // Disabled
+ UdParserExpSavedLog(const UdParserExpSavedLog&) = delete;
+ UdParserExpSavedLog & operator=(const UdParserExpSavedLog&) = delete;
+};
+
+} // end EXPSCOM namespace
+
+#endif
diff --git a/src/usr/expaccess/plugins/expscomUdParserFactory.H b/src/usr/expaccess/plugins/expscomUdParserFactory.H
new file mode 100644
index 000000000..6a006e308
--- /dev/null
+++ b/src/usr/expaccess/plugins/expscomUdParserFactory.H
@@ -0,0 +1,58 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/plugins/expscomUdParserFactory.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file expscomUdParserFactory.H
+ * @brief Registers Explorer User Detail parsers
+ */
+#if !defined(_EXPSCOMUDPARSERFACTORY_H)
+#define _EXPSCOMUDPARSERFACTORY_H
+
+#include "errludparserfactory.H"
+#include "errludP_expscom.H"
+
+namespace EXPSCOM
+{
+ class UserDetailsParserFactory
+ : public ERRORLOG::ErrlUserDetailsParserFactory
+ {
+ public:
+ UserDetailsParserFactory()
+ {
+ registerParser<UdParserExpActiveLog>
+ (EXPSCOM_UDT_ACTIVE_LOG);
+
+ registerParser<UdParserExpSavedLog>
+ (EXPSCOM_UDT_SAVED_LOG);
+ }
+
+ private:
+
+ UserDetailsParserFactory(const UserDetailsParserFactory &);
+ UserDetailsParserFactory & operator=
+ (const UserDetailsParserFactory &);
+ };
+};
+
+#endif
diff --git a/src/usr/expaccess/test/expErrlTest.C b/src/usr/expaccess/test/expErrlTest.C
new file mode 100644
index 000000000..10f3b1189
--- /dev/null
+++ b/src/usr/expaccess/test/expErrlTest.C
@@ -0,0 +1,158 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/expErrlTest.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file expErrlTest.C
+ * @brief Tests the various ways to grab/add explorer error log data
+ */
+#include <rcExpLog.H> // RC error log side
+#include <fapi2.H>
+#include <fapi2/plat_hwp_invoker.H> // FAPI_INVOKE_HWP
+#include <errl/errlmanager.H>
+#include "../errlud_expscom.H" // HB error log side
+
+
+fapi2::ReturnCode get_scom(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ const uint64_t i_address,
+ fapi2::buffer<uint64_t>& o_data)
+{
+ return fapi2::getScom(i_target,i_address,o_data);
+}
+
+uint32_t expErrorLogHb()
+{
+ uint32_t numTests = 0;
+ uint32_t numFails = 0;
+ errlHndl_t l_err = nullptr;
+
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the functioning ocmb chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_OCMB_CHIP, true);
+
+ //Verify at least one ocmb found, some systems do not have ocmb chips
+ if(l_chipList.size() == 0 )
+ {
+ FAPI_INF("expErrorLogHb: No OCMB targets found, skipping test");
+ }
+
+ // create an error for each OCMB and grab the trace data
+ for ( auto & l_ocmb : l_chipList )
+ {
+ // Get a scom error with bad address
+ FAPI_INF("expErrorLogHb - Get a scom error with bad address for ocmb 0x%.8X",
+ TARGETING::get_huid(l_ocmb));
+ numTests++;
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> fapi2_ocmbTarget(l_ocmb);
+ fapi2::buffer<uint64_t> l_scom_buffer;
+ FAPI_INVOKE_HWP( l_err, get_scom, fapi2_ocmbTarget,
+ 0xFFFFFFFF, l_scom_buffer );
+ if (l_err)
+ {
+ FAPI_INF("expErrorLogHb - created error log 0x%04X, now adding explorer errors", l_err->plid());
+
+ // Add explorer error logs to this and commit
+ bool logAdded = false;
+ numTests++;
+ logAdded = EXPSCOM::expAddLog(EXPSCOM::ACTIVE_LOG, l_ocmb, l_err);
+ if (!logAdded)
+ {
+ TS_FAIL("expErrorLogHb: No ACTIVE explorer logs added to 0x%04X", l_err->plid());
+ numFails++;
+ }
+
+ numTests++;
+ logAdded = EXPSCOM::expAddLog(EXPSCOM::SAVED_LOG, l_ocmb, l_err);
+ if (!logAdded)
+ {
+ TS_FAIL("expErrorLogHb: No SAVED explorer logs added to 0x%04X", l_err->plid());
+ numFails++;
+ }
+ errlCommit(l_err, CXXTEST_COMP_ID);
+ }
+ else
+ {
+ TS_FAIL("expErrorLogHb: getScom(0xFFFFFFFF) worked on 0x%.8X",
+ TARGETING::get_huid(l_ocmb));
+ numFails++;
+ }
+ }
+
+ FAPI_INF("expErrorLogHb Test Complete. %d/%d fails", numFails, numTests);
+
+ return numFails;
+}
+
+uint32_t expErrorLogRc()
+{
+ uint32_t numTests = 0;
+ uint32_t numFails = 0;
+ errlHndl_t l_errl = nullptr;
+ FAPI_INF("expErrorLogRc() running");
+ do
+ {
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the functioning ocmb chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_OCMB_CHIP, true);
+ TARGETING::Target * l_ocmb = nullptr;
+
+ //Take the first ocmb and use it
+ if (l_chipList.size() > 0)
+ {
+ l_ocmb = l_chipList[0];
+ }
+ else
+ {
+ FAPI_INF("expErrorLogRc: No OCMB targets found, skipping test");
+ break;
+ }
+
+ numTests++;
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> fapi2_ocmbTarget(l_ocmb);
+ // This procedure creates an RC error and then adds Explorer log data
+ // to that error
+ // (0x500 bytes of ACTIVE log data, 0x450 bytes of SAVED log data)
+ FAPI_INVOKE_HWP(l_errl, exp_error_rc, fapi2_ocmbTarget, 0x500, 0x450);
+ if(l_errl != nullptr)
+ {
+ // Commit this error log so it can be examined for Explorer log data
+ FAPI_INF("exp_errorFfdc_fail returned expected errl");
+ errlCommit(l_errl,CXXTEST_COMP_ID);
+ l_errl = nullptr;
+ }
+ else
+ {
+ TS_FAIL("expErrorLogRc: No error from exp_errorFfdc_fail !!");
+ numFails++;
+ }
+ } while (0);
+
+ FAPI_INF("expErrorLogRc Test Complete. %d/%d fails",
+ numFails , numTests);
+
+ return numFails;
+}
diff --git a/src/usr/expaccess/test/expErrlTest.H b/src/usr/expaccess/test/expErrlTest.H
new file mode 100644
index 000000000..77b44452d
--- /dev/null
+++ b/src/usr/expaccess/test/expErrlTest.H
@@ -0,0 +1,129 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/expErrlTest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __expErrlTest_H
+#define __expErrlTest_H
+
+/**
+ * @file ExpErrorLogTest.H
+ *
+ * @brief Test case for explorer error log grabbing/adding
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <fapi2.H>
+#include "expErrlTest.C"
+#include <exptest_utils.H>
+
+using namespace fapi2;
+
+class test_expErrorLog: public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief Test adding Explorer error logs via RC
+ */
+ void testExpErrorLogRc(void)
+ {
+ // @todo RTC 214629 - disabled until simics implements exp_error_log
+ return;
+
+ if (!iv_serializeTestMutex)
+ {
+ TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
+ }
+ else
+ {
+ // Inband operations can't be run at the same time
+ // atomic section >>
+ mutex_lock(iv_serializeTestMutex);
+ uint32_t l_res = expErrorLogRc();
+ if (l_res != 0)
+ {
+ TS_FAIL("rcTestExpErrorLogRc. Fail l_res=%d", l_res);
+ }
+ // atomic section <<
+ mutex_unlock(iv_serializeTestMutex);
+ }
+ }
+
+ /**
+ * @brief Test hostboot side of adding Explorer error log to errl
+ */
+ void testExpErrorLogHb(void)
+ {
+ // @todo RTC 214629 - disabled until simics implements exp_error_log
+ return;
+
+ if (!iv_serializeTestMutex)
+ {
+ TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
+ }
+ else
+ {
+ // Inband operations can't be run at the same time
+ // atomic section >>
+ mutex_lock(iv_serializeTestMutex);
+ uint32_t l_res = expErrorLogHb();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("testExpErrorLogHb. Fail l_res=%d", l_res);
+ }
+ // atomic section <<
+ mutex_unlock(iv_serializeTestMutex);
+ }
+ }
+
+ /**
+ * @brief Constructor
+ */
+ test_expErrorLog() : CxxTest::TestSuite()
+ {
+ // All modules are loaded by runtime,
+ // so testcase loading of modules is not required
+#ifndef __HOSTBOOT_RUNTIME
+ errlHndl_t err = nullptr;
+
+ // For testing, just load the library needed and don't bother with
+ // unloading to avoid pulling the rug from under other tests that need
+ // the loaded library
+ err = exptest::loadModule(exptest::MSS_LIBRARY_NAME);
+ if(err)
+ {
+ TS_FAIL("OCMBCommTest() - Constuctor: failed to load MSS module");
+ errlCommit( err, TARG_COMP_ID );
+ }
+#endif
+ iv_serializeTestMutex = exptest::getTestMutex();
+ };
+
+ private:
+ // This is used for tests that need to not run operations at the same time
+ TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR iv_serializeTestMutex;
+
+};
+
+#endif
diff --git a/src/usr/expaccess/test/rcExpLog.C b/src/usr/expaccess/test/rcExpLog.C
new file mode 100644
index 000000000..53e61cd5d
--- /dev/null
+++ b/src/usr/expaccess/test/rcExpLog.C
@@ -0,0 +1,55 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/rcExpLog.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file rcExpLog.C
+ * @brief Call fapi2::ReturnCode functions for explorer logs
+ */
+#include <cxxtest/TestSuite.H>
+#include <fapi2.H>
+#include <plat_hwp_invoker.H>
+#include <hwp_error_info.H>
+#include <hwp_ffdc_classes.H>
+
+#include <rcExpLog.H>
+
+fapi2::ReturnCode exp_error_rc(
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_ocmb_target,
+ const uint32_t i_active_log_size,
+ const uint32_t i_saved_log_size)
+{
+ FAPI_INF("Enter exp_error_rc (active %d, saved %d)...",
+ i_active_log_size, i_saved_log_size);
+
+ FAPI_ASSERT(0, fapi2::COLLECT_EXPLORER_ERROR()
+ .set_OCMB_CHIP_TARGET(i_ocmb_target)
+ .set_EXP_ACTIVE_LOG_SIZE(i_active_log_size)
+ .set_EXP_SAVED_LOG_SIZE(i_saved_log_size),
+ "Testcase exp_error_rc assert");
+
+fapi_try_exit:
+
+ FAPI_INF("Exiting exp_error_rc...");
+ return fapi2::current_err;
+}
diff --git a/src/usr/expaccess/test/rcExpLog.H b/src/usr/expaccess/test/rcExpLog.H
new file mode 100644
index 000000000..c3193bef9
--- /dev/null
+++ b/src/usr/expaccess/test/rcExpLog.H
@@ -0,0 +1,49 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/rcExpLog.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2019 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file rcExpLog.H
+ *
+ * @brief These procedures provide fapi2 return codes with desired data to
+ * support testing from expErrlTest
+ */
+#ifndef _RC_EXPLOG_H_
+#define _RC_EXPLOG_H_
+
+#include <fapi2.H>
+
+
+/**
+ * @brief Creates a test RC with added Explorer log trace data
+ * @param i_ocmb_target - Explorer target
+ * @param i_active_log_size - maximum size of active (RAM) data to add
+ * @param i_saved_log_size - maximum size of saved (SPI flash) data to add
+ * @return ReturnCode with added error log data
+ */
+fapi2::ReturnCode exp_error_rc(
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_ocmb_target,
+ const uint32_t i_active_log_size,
+ const uint32_t i_saved_log_size );
+
+#endif
diff --git a/src/usr/expaccess/test/test.mk b/src/usr/expaccess/test/test.mk
index 5aaeeda66..9dd8237df 100644
--- a/src/usr/expaccess/test/test.mk
+++ b/src/usr/expaccess/test/test.mk
@@ -22,21 +22,23 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2
-EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
-EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs
-EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc
-EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2/
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
-EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include
-EXTRAINCDIR += ${ROOTPATH}/src/import
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include/
+EXTRAINCDIR += ${ROOTPATH}/src/import/
EXTRAINCDIR += ${ROOTPATH}/src/usr/expaccess/
EXTRAINCDIR += ${ROOTPATH}/src/usr/expaccess/test/
VPATH += ${ROOTPATH}/src/usr/expaccess/test/
VPATH += ${ROOTPATH}/src/usr/expaccess/
+VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
OBJS += exptest_utils.o
-
+OBJS += exp_collect_explorer_log.o
+OBJS += rcExpLog.o
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud