summaryrefslogtreecommitdiffstats
path: root/sbe/sbefw
diff options
context:
space:
mode:
authorShakeeb <shakeebbk@in.ibm.com>2016-04-28 05:57:28 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-07-25 02:21:32 -0400
commit8e7ea62025f3208957d53cf1735fbe2019d80a73 (patch)
tree6b7fe45905fe50af0ccae909cafa03adb614209e /sbe/sbefw
parent97eb4869d5e2f91d9ec154741f686677f3642e1f (diff)
downloadtalos-sbe-8e7ea62025f3208957d53cf1735fbe2019d80a73.tar.gz
talos-sbe-8e7ea62025f3208957d53cf1735fbe2019d80a73.zip
SBE internal FFDC package generation
Support to generate SBE internal FFDC package over both FIFO and MBOX interface RTC:151555 Change-Id: I6f07dc017312063a0ed9a1794fecafb2fb62041c Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24362 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'sbe/sbefw')
-rw-r--r--sbe/sbefw/sbeFFDC.C141
-rw-r--r--sbe/sbefw/sbeFFDC.H148
-rw-r--r--sbe/sbefw/sbeFFDCType.H84
-rw-r--r--sbe/sbefw/sbeFifoMsgUtils.C41
-rw-r--r--sbe/sbefw/sbefwfiles.mk26
5 files changed, 437 insertions, 3 deletions
diff --git a/sbe/sbefw/sbeFFDC.C b/sbe/sbefw/sbeFFDC.C
new file mode 100644
index 00000000..2d9eb845
--- /dev/null
+++ b/sbe/sbefw/sbeFFDC.C
@@ -0,0 +1,141 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbeFFDC.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 */
+#include "sbefifo.H"
+#include "sbetrace.H"
+#include "sbe_sp_intf.H"
+#include "sbeFifoMsgUtils.H"
+#include "sberegaccess.H"
+#include "sbeFFDC.H"
+
+/*
+ * @brief sendOverFIFO - method to pack and send SBE internal FFDC
+ * only if isSendInternalFFDCSet() is true
+ * over FIFO interface
+ * @param[in] i_primStatus - Primary status of Chip op
+ * @param[in] i_secStatus - Secondary status of Chip op
+ * @param[in] i_fieldsConfig - bitmap indicating the field
+ * to be sent in FFDC
+ *
+ * @param[out] o_bytesSent -number of bytes sent
+ *
+ * @return - SBE secondary RC
+ */
+uint32_t SbeFFDCPackage::sendOverFIFO(uint32_t i_primStatus,
+ uint32_t i_secStatus,
+ uint32_t i_fieldsConfig,
+ uint32_t &o_bytesSent)
+{
+ #define SBE_FUNC "sbeSendFFDCPackageFIFO "
+ SBE_ENTER(SBE_FUNC);
+ uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL;
+ uint32_t length = 0;
+
+ do
+ {
+ //check if SBE internal FFDC should be generated
+ if(SbeRegAccess::theSbeRegAccess().isSendInternalFFDCSet() == false)
+ {
+ SBE_DEBUG(SBE_FUNC" isSendInternalFFDCSet()=false, "
+ "not generating SBE InternalFFDC");
+ rc = SBE_SEC_OPERATION_SUCCESSFUL;
+ break;
+ }
+
+ //reset sent bytes
+ o_bytesSent = 0;
+ //Update the user data header with dump fields configuration
+ iv_sbeFFDCDataHeader.dumpFields.set(i_fieldsConfig);
+ iv_sbeFFDCHeader.lenInWords = (sizeof(sbeResponseFfdc_t) +
+ sizeof(sbeFFDCUserDataIdentifier_t))
+ /sizeof(uint32_t);
+ //Update the length in ffdc package header base on required fields
+ for(auto &sbeFFDCUserData:sbeFFDCUserDataArray)
+ {
+ if(sbeFFDCUserData.userDataId.fieldId & i_fieldsConfig)
+ {
+ iv_sbeFFDCHeader.lenInWords +=
+ sbeFFDCUserData.userDataId.fieldLen
+ /sizeof(uint32_t);
+ }
+ }
+
+ SBE_DEBUG(SBE_FUNC "length of FFDC package in words [%d]",
+ (uint32_t)(iv_sbeFFDCHeader.lenInWords));
+
+ //Send FFDC package header
+ length = sizeof(iv_sbeFFDCHeader) / sizeof(uint32_t);
+ rc = sbeDownFifoEnq_mult(length,
+ (uint32_t *)(&(iv_sbeFFDCHeader)));
+ if( rc!= SBE_SEC_OPERATION_SUCCESSFUL)
+ {
+ break;
+ }
+ o_bytesSent += length;
+
+ //Send FFDC user data header
+ length = sizeof(iv_sbeFFDCDataHeader) / sizeof(uint32_t);
+ rc = sbeDownFifoEnq_mult(length,
+ (uint32_t *)(&(iv_sbeFFDCDataHeader)));
+ if( rc!= SBE_SEC_OPERATION_SUCCESSFUL)
+ {
+ break;
+ }
+ o_bytesSent += length;
+
+ //Send FFDC user data blobs
+ for(auto &sbeFFDCUserData:sbeFFDCUserDataArray)
+ {
+ if(sbeFFDCUserData.userDataId.fieldId & i_fieldsConfig)
+ {
+ //Send User data identifer and length
+ length = sizeof(sbeFFDCUserDataIdentifier_t) / sizeof(uint32_t);
+ rc = sbeDownFifoEnq_mult(length,
+ (uint32_t*)&(sbeFFDCUserData.userDataId));
+ if( rc!= SBE_SEC_OPERATION_SUCCESSFUL)
+ {
+ break;
+ }
+ o_bytesSent += length;
+
+ //Send User data
+ length = sbeFFDCUserData.userDataId.fieldLen / sizeof(uint32_t);
+ rc = sbeDownFifoEnq_mult(length,
+ (uint32_t*)sbeFFDCUserData.userDataPtr);
+ if( rc!= SBE_SEC_OPERATION_SUCCESSFUL)
+ {
+ break;
+ }
+ o_bytesSent += length;
+ }
+ }
+
+ SBE_DEBUG(SBE_FUNC "Number of words sent [%d]", o_bytesSent);
+ break;
+ } while(false);
+
+ SBE_EXIT(SBE_FUNC);
+ return rc;
+ #undef SBE_FUNC
+}
diff --git a/sbe/sbefw/sbeFFDC.H b/sbe/sbefw/sbeFFDC.H
new file mode 100644
index 00000000..885337dd
--- /dev/null
+++ b/sbe/sbefw/sbeFFDC.H
@@ -0,0 +1,148 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbeFFDC.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 __SBE_FFDC_H
+#define __SBE_FFDC_H
+
+#include "fapi2.H"
+#include "plat_attributes.H"
+#include "pk_trace.h"
+#include "sbeFFDCType.H"
+#include "sbeSpMsg.H"
+
+
+//Since maximum error log supported in HB is 4KB
+#define SBE_FFDC_MAX_LENGTH 0x1000
+
+//PIBMEM attribute dump
+extern G_sbe_attrs_t G_sbe_attrs;
+
+//Configuration of user data blobs present in SBE FFDC
+//Data is sent in the order defined here
+//Definition - Identifier
+// length of the blob
+// pointer to the data
+constexpr sbeFFDCUserData_t sbeFFDCUserDataArray[] =
+ {{{SBE_FFDC_TRACE_DUMP,
+ sizeof(PkTraceBuffer)},
+ (const void *)&g_pk_trace_buf,
+ },
+ {{SBE_FFDC_ATTR_DUMP,
+ sizeof(G_sbe_attrs_t)},
+ (const void *)&G_sbe_attrs,
+ },
+ };
+#define SBE_FFDC_NUM_USER_DATA (sizeof(sbeFFDCUserDataArray)/\
+ sizeof(sbeFFDCUserData_t))
+
+//Compile time usage - to derive the sum of all user data
+//as defined in sbeFFDCUserDataArray
+constexpr uint16_t getMaxFFDCUserDataLength(int8_t index)
+{
+ return index<0 ? 0 : sbeFFDCUserDataArray[index].userDataId.fieldLen +\
+ getMaxFFDCUserDataLength(index-1);
+}
+
+
+//SBE internal FFDC package singleton class
+class SbeFFDCPackage
+{
+private:
+ //Disable copy constructor
+ SbeFFDCPackage(SbeFFDCPackage const &) = delete;
+ //Disable assignment operator
+ SbeFFDCPackage& operator=(SbeFFDCPackage const &) = delete;
+
+ sbeResponseFfdc_t iv_sbeFFDCHeader;
+ //FFDC user data header
+ sbeFFDCDataHeader_t iv_sbeFFDCDataHeader;
+
+public:
+ /*ctor
+ *
+ */
+ SbeFFDCPackage()
+ {
+ //Making sure data is indeed aligned
+ static_assert((sizeof(G_sbe_attrs_t) % 4) == 0,
+ "G_sbe_attrs not 4byte aligned");
+ static_assert((sizeof(PkTraceBuffer) % 4) == 0,
+ "g_pk_trace_buf not 4byte aligned");
+
+ iv_sbeFFDCHeader.magicBytes = 0xFFDC;
+ iv_sbeFFDCHeader.fapiRc = fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
+
+ iv_sbeFFDCDataHeader.primaryStatus = SBE_PRI_OPERATION_SUCCESSFUL;
+ iv_sbeFFDCDataHeader.secondaryStatus = SBE_SEC_OPERATION_SUCCESSFUL;
+
+ //Making sure that the maximum length of FFDC package
+ //can be accomodated
+ static_assert((sizeof(sbeResponseFfdc_t) + sizeof(sbeFFDCDataHeader_t) +
+ getMaxFFDCUserDataLength(SBE_FFDC_NUM_USER_DATA-1)) \
+ <= SBE_FFDC_MAX_LENGTH,
+ "length of FFDC package must never exceed"
+ "SBE_FFDC_MAX_LENGTH ");
+ //length and dumpFields will be filled up depending on the fields
+ //to be sent in send APIs
+ iv_sbeFFDCDataHeader.dumpFields = {0};
+ }
+ /*
+ * @brief sendOverFIFO - method to pack and send SBE internal FFDC
+ * only if isSendInternalFFDCSet() is true
+ * over FIFO interface
+ * @param[in] i_primStatus - Primary status of Chip op
+ * @param[in] i_secStatus - Secondary status of Chip op
+ * @param[in] i_fieldsConfig - bitmap indicating the field
+ * to be sent in FFDC
+ *
+ * @param[out] o_bytesSent -number of bytes sent
+ *
+ * @return - SBE secondary RC
+ */
+ uint32_t sendOverFIFO(uint32_t i_primStatus,
+ uint32_t i_secStatus,
+ uint32_t i_fieldsConfig,
+ uint32_t &o_bytesSent);
+
+ /*
+ * @brief sendOverHOST - method to pack and send SBE internal FFDC
+ * only if isSendInternalFFDCSet() is true
+ * over HOST interface
+ *
+ * @param[in] i_primStatus - Primary status of Chip op
+ * @param[in] i_secStatus - Secondary status of Chip op
+ * @param[in] i_fieldsConfig - bitmap indicating the field
+ * to be sent in FFDC
+ *
+ * @param[out] o_bytesSent - number of bytes sent
+ *
+ * @return - SBE secondary RC
+ */
+ //uint32_t sendOverHOST(uint32_t i_primStatus,
+ // uint32_t i_secStatus,
+ // uint32_t i_fieldsConfig,
+ // uint32_t &o_bytesSent) {};
+};
+
+#endif //__SBE_FFDC_H
diff --git a/sbe/sbefw/sbeFFDCType.H b/sbe/sbefw/sbeFFDCType.H
new file mode 100644
index 00000000..71a5c9ae
--- /dev/null
+++ b/sbe/sbefw/sbeFFDCType.H
@@ -0,0 +1,84 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbeFFDCType.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 __SBE_FFDC_TYPE_H
+#define __SBE_FFDC_TYPE_H
+
+//Bit mapped identifiers
+#define SBE_FFDC_ATTR_DUMP 0x0001
+#define SBE_FFDC_TRACE_DUMP 0x0002
+#define SBE_FFDC_ALL_DUMP 0xFFFF
+
+/* Structure indicating the contents of FFDC package
+ * value 'true' - field present;value 'false' - field not present
+ * bit_0 - attribute dump
+ * bit_1 - trace buffer dump
+ * bit 2-31 - reserved
+ */
+typedef struct
+{
+ uint32_t attrField:1;
+ uint32_t traceField:1;
+ uint32_t reserved:30;
+ /* @breif - set dump fields
+ *
+ * @param[in] - uint32_t value to be updated
+ */
+ void set(uint32_t val)
+ {
+ if(val & SBE_FFDC_ATTR_DUMP)
+ {
+ attrField = true;
+ }
+ if(val & SBE_FFDC_TRACE_DUMP)
+ {
+ traceField = true;
+ }
+ }
+} sbeFFDCDumpFields_t;
+
+//Sturcture indicating the type of ffdc user data blob
+//and its length in bytes
+typedef struct
+{
+ uint32_t fieldId:16;
+ uint32_t fieldLen:16;
+} sbeFFDCUserDataIdentifier_t;
+
+//Structure of ffdc user data blob
+typedef struct
+{
+ sbeFFDCUserDataIdentifier_t userDataId;
+ const void *userDataPtr;
+} sbeFFDCUserData_t;
+
+//keep it packed to 4byte boundary to avoid packing bytes
+typedef struct
+{
+ uint32_t primaryStatus:16;//Chip Op Primary status
+ uint32_t secondaryStatus:16;//Chip Op Secondary status
+ sbeFFDCDumpFields_t dumpFields;//bitmapped dumpFields
+} sbeFFDCDataHeader_t;
+
+#endif //__SBE_FFDC_TYPE_H
diff --git a/sbe/sbefw/sbeFifoMsgUtils.C b/sbe/sbefw/sbeFifoMsgUtils.C
index a86f1363..15e36516 100644
--- a/sbe/sbefw/sbeFifoMsgUtils.C
+++ b/sbe/sbefw/sbeFifoMsgUtils.C
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbeFifoMsgUtils.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* [+] 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: ppe/sbe/sbefw/sbeFifoMsgUtils.C
*
@@ -11,6 +35,7 @@
#include "sbeFifoMsgUtils.H"
#include "sbeerrorcodes.H"
#include "assert.h"
+#include "sbeFFDC.H"
// If we can not perform FIFO operation ( FIFO FULL while writing
// or EMPTY while reading ) we will sleep for FIFO_WAIT_SLEEP_TIME
@@ -321,10 +346,22 @@ uint32_t sbeDsSendRespHdr(const sbeRespGenHdr_t &i_hdr,
break;
}
distance += len;
+
+ //Add FFDC data as well.
+ //Generate all the fields of FFDC package
+ SbeFFDCPackage sbeFfdc;
+ rc = sbeFfdc.sendOverFIFO(i_hdr.primaryStatus,
+ i_hdr.secondaryStatus,
+ SBE_FFDC_ALL_DUMP,
+ len);
+ if (rc)
+ {
+ break;
+ }
+ distance += len;
}
+
len = sizeof(distance)/sizeof(uint32_t);
- //@TODO via RTC 129076.
- //Need to add FFDC data as well.
rc = sbeDownFifoEnq_mult ( len, &distance);
if (rc)
{
diff --git a/sbe/sbefw/sbefwfiles.mk b/sbe/sbefw/sbefwfiles.mk
index d38df07d..b7fef999 100644
--- a/sbe/sbefw/sbefwfiles.mk
+++ b/sbe/sbefw/sbefwfiles.mk
@@ -1,3 +1,27 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: sbe/sbefw/sbefwfiles.mk $
+#
+# OpenPOWER sbe Project
+#
+# Contributors Listed Below - COPYRIGHT 2015,2016
+# [+] 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
SBEFW-CPP-SOURCES = sbemain.C
SBEFW-CPP-SOURCES += sbeirq.C
SBEFW-CPP-SOURCES += sbecmdreceiver.C
@@ -15,7 +39,7 @@ SBEFW-CPP-SOURCES += sbecmdsram.C
SBEFW-CPP-SOURCES += sberegaccess.C
SBEFW-CPP-SOURCES += sbecmdcntlinst.C
SBEFW-CPP-SOURCES += sbecmdregaccess.C
-
+SBEFW-CPP-SOURCES += sbeFFDC.C
SBEFW-C-SOURCES =
SBEFW-S-SOURCES =
OpenPOWER on IntegriCloud