summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Silver <bsilver@us.ibm.com>2015-04-20 11:55:59 -0500
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 13:40:20 -0600
commit690baedf74c3e569e0a066eaa8ead00d25f2e693 (patch)
tree8af1f9dbad1c6a682ac61f4e6a2bf142baabea64
parentf88e09a2507b77ffacbf15caeec866259afffd44 (diff)
downloadtalos-hostboot-690baedf74c3e569e0a066eaa8ead00d25f2e693.tar.gz
talos-hostboot-690baedf74c3e569e0a066eaa8ead00d25f2e693.zip
Update FFDC mechanism to better handle targets, buffers
Fix bug in --empty-ffdc-classes, exectue() Change-Id: I2a872efacbe68719495b7d40123db683c3a6db3e Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17340 Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: Brian Silver <bsilver@us.ibm.com> Tested-by: Brian Silver <bsilver@us.ibm.com>
-rw-r--r--src/import/hwpf/fapi2/include/error_info.H206
-rw-r--r--src/import/hwpf/fapi2/include/error_info_defs.H247
-rw-r--r--src/import/hwpf/fapi2/include/return_code.H76
-rw-r--r--src/import/hwpf/fapi2/include/return_code_defs.H114
-rw-r--r--src/import/hwpf/fapi2/include/utils.H2
-rw-r--r--src/import/hwpf/fapi2/include/variable_buffer.H42
-rw-r--r--src/import/hwpf/fapi2/src/error_info.C40
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/parseErrorInfo.pl58
8 files changed, 436 insertions, 349 deletions
diff --git a/src/import/hwpf/fapi2/include/error_info.H b/src/import/hwpf/fapi2/include/error_info.H
index 3f53503de..033e1bbdb 100644
--- a/src/import/hwpf/fapi2/include/error_info.H
+++ b/src/import/hwpf/fapi2/include/error_info.H
@@ -35,215 +35,11 @@
#include <memory>
#include <vector>
#include <target.H>
+#include <error_info_defs.H>
#include <assert.h>
namespace fapi2
{
- class ReturnCode;
-
- ///
- /// @brief Type to hold the ffdc element in the ffdc class
- /// Needed so that the size can be squirled away before the
- /// macro is called.
- ///
- class ffdc_t
- {
- public:
- ffdc_t(void)
- {}
-
- operator const void*() const { return iv_value.first; }
- operator uint8_t() const
- { return *(reinterpret_cast<const uint8_t*>(iv_value.first)); }
-
- int16_t size(void) const { return iv_value.second; }
- int16_t& size(void) { return iv_value.second; }
-
- const void* ptr(void) const { return iv_value.first; }
- const void*& ptr(void) { return iv_value.first; }
-
- private:
- std::pair<const void*, int16_t> iv_value;
- };
-
- ///
- /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a
- /// special type that cannot simply be memcopied
- enum ErrorInfoFfdcSize
- {
- EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target
- EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb
- };
-
- ///
- /// @brief Enumeration of error log severity.
- ///
- enum errlSeverity_t
- {
- FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism
- FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer
- FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see
- FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general
- };
-
- ///
- /// @brief Enumeration of ErrorInfo types
- ///
- enum ErrorInfoType
- {
- EI_TYPE_FFDC = 0,
- EI_TYPE_HW_CALLOUT = 1,
- EI_TYPE_PROCEDURE_CALLOUT = 2,
- EI_TYPE_BUS_CALLOUT = 3,
- EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD
- EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD
- EI_TYPE_COLLECT_TRACE = 6,
- EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1,
- };
-
- ///
- /// @enum HwCallout
- ///
- /// This enumeration defines the possible Hardware Callouts that are not
- /// represented by fapi2::Targets
- ///
- /// Note that platform code may depend on the enum values starting at 0 and
- /// incrementing in order to efficiently convert to a platform callout value
- /// so do not reorder without consulting all platforms
- ///
- namespace HwCallouts
- {
- enum HwCallout
- {
- // Where indicated, a HW Callout in FAPI Error XML must include a
- // reference target that is used to identify the HW. e.g. for
- // TOD_CLOCK, the proc chip that the clock is attached to must be
- // specified
- TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet)
- MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet)
- PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet)
- PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet)
- FLASH_CONTROLLER_PART = 4,
- PNOR_PART = 5,
- SBE_SEEPROM_PART = 6,
- VPD_PART = 7,
- LPC_SLAVE_PART = 8,
- GPIO_EXPANDER_PART = 9,
- SPIVID_SLAVE_PART = 10,
- };
- }
-
- ///
- /// @enum ProcedureCallout
- ///
- /// This enumeration defines the possible Procedure Callouts
- /// These instruct the customer/customer-engineer what to do
- ///
- /// Note that platform code may depend on the enum values starting at 0 and
- /// incrementing in order to efficiently convert to a platform callout value
- /// so do not reorder without consulting all platforms
- ///
- namespace ProcedureCallouts
- {
- enum ProcedureCallout
- {
- CODE = 0, // Code problem
- LVL_SUPPORT = 1, // Call next level of support
- MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error
- BUS_CALLOUT = 3, // Bus Called Out
- };
- }
-
- ///
- /// @enum CalloutPriority
- ///
- /// This enumeration defines the possible Procedure and Target callout priorities
- ///
- /// Note that platform code may depend on the enum values starting at 0 and
- /// incrementing in order to efficiently convert to a platform priority value
- /// so do not reorder without consulting all platforms
- ///
- namespace CalloutPriorities
- {
- enum CalloutPriority
- {
- LOW = 0,
- MEDIUM = 1,
- HIGH = 2,
- };
- }
-
- ///
- /// @enum Collect Trace
- ///
- /// This enumeration defines the possible firmware traces to collect
- ///
- namespace CollectTraces
- {
- const uint32_t TRACE_SIZE = 256; // limit collected trace size
- enum CollectTrace
- {
- FSI = 1,
- SCOM = 2,
- SCAN = 3,
- MBOX = 4,
- };
- }
-
- ///
- /// @brief Get FFDC Size
- ///
- /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of
- /// FFDC data. If the data is of a special type that is handled differently
- /// than types that are simply memcopied then it is handled by a template
- /// specialization.
- /// If this function template is instantiated with a pointer, the compile
- /// will fail.
- ///
- /// @return uint16_t. Size of the FFDC data
- ///
- template<typename T>
- inline uint16_t getErrorInfoFfdcSize(const T &)
- {
- static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE,
- "FFDC too large to capture");
- return sizeof(T);
- }
-
- ///
- /// @brief Compile error if caller tries to get the FFDC size of a pointer
- ///
- template<typename T>
- inline uint16_t getErrorInfoFfdcSize(const T*)
- {
- static_assert(std::is_pointer<T>::value,
- "pointer passed to getErrorInfoFfdcSize");
- return 0;
- }
-
- ///
- /// @brief Get FFDC Size specialization for fapi2::Target
- ///
- template<>
- inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<TARGET_TYPE_ALL>*)
- {
- return EI_FFDC_SIZE_TARGET;
- }
-
- ///
- /// @brief Get FFDC Size specialization for ffdc method arguments
- /// @note The ffdc class sets the std::pair when the method is
- /// called so the size has been calculated. All that needs to be
- /// done here is to grab it. We do it this way so the macro definitions
- /// can be the same whether the ffdc class is used or the old-school
- /// locals.
- ///
- template<>
- inline uint16_t getErrorInfoFfdcSize(const fapi2::ffdc_t& i_thing)
- {
- return i_thing.size();
- }
-
///
/// @class ErrorInfoFfdc
///
diff --git a/src/import/hwpf/fapi2/include/error_info_defs.H b/src/import/hwpf/fapi2/include/error_info_defs.H
new file mode 100644
index 000000000..ca899426b
--- /dev/null
+++ b/src/import/hwpf/fapi2/include/error_info_defs.H
@@ -0,0 +1,247 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] 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 error_info_defs.H
+/// @brief Defines to support the Error Information class
+///
+
+#ifndef FAPI2_ERRORINFO_DEFS_H_
+#define FAPI2_ERRORINFO_DEFS_H_
+
+#include <stdint.h>
+#include <target.H>
+#include <variable_buffer.H>
+#include <assert.h>
+
+#include <iostream>
+
+namespace fapi2
+{
+ ///
+ /// @brief Type to hold the ffdc element in the ffdc class
+ /// Needed so that the size can be squirled away before the
+ /// macro is called.
+ ///
+ class ffdc_t
+ {
+ public:
+ ffdc_t(void)
+ {}
+
+ operator const void*() const { return iv_value.first; }
+ operator uint8_t() const
+ { return *(reinterpret_cast<const uint8_t*>(iv_value.first)); }
+
+ int16_t size(void) const { return iv_value.second; }
+ int16_t& size(void) { return iv_value.second; }
+
+ const void* ptr(void) const { return iv_value.first; }
+ const void*& ptr(void) { return iv_value.first; }
+
+ private:
+ std::pair<const void*, int16_t> iv_value;
+ };
+
+ ///
+ /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a
+ /// special type that cannot simply be memcopied
+ enum ErrorInfoFfdcSize
+ {
+ EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer<T>
+ EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target
+ EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer
+ EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb
+ };
+
+ ///
+ /// @brief Enumeration of error log severity.
+ ///
+ enum errlSeverity_t
+ {
+ FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism
+ FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer
+ FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see
+ FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general
+ };
+
+ ///
+ /// @brief Enumeration of ErrorInfo types
+ ///
+ enum ErrorInfoType
+ {
+ EI_TYPE_FFDC = 0,
+ EI_TYPE_HW_CALLOUT = 1,
+ EI_TYPE_PROCEDURE_CALLOUT = 2,
+ EI_TYPE_BUS_CALLOUT = 3,
+ EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD
+ EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD
+ EI_TYPE_COLLECT_TRACE = 6,
+ EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1,
+ };
+
+ ///
+ /// @enum HwCallout
+ ///
+ /// This enumeration defines the possible Hardware Callouts that are not
+ /// represented by fapi2::Targets
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform callout value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace HwCallouts
+ {
+ enum HwCallout
+ {
+ // Where indicated, a HW Callout in FAPI Error XML must include a
+ // reference target that is used to identify the HW. e.g. for
+ // TOD_CLOCK, the proc chip that the clock is attached to must be
+ // specified
+ TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet)
+ MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet)
+ PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet)
+ PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet)
+ FLASH_CONTROLLER_PART = 4,
+ PNOR_PART = 5,
+ SBE_SEEPROM_PART = 6,
+ VPD_PART = 7,
+ LPC_SLAVE_PART = 8,
+ GPIO_EXPANDER_PART = 9,
+ SPIVID_SLAVE_PART = 10,
+ };
+ }
+
+ ///
+ /// @enum ProcedureCallout
+ ///
+ /// This enumeration defines the possible Procedure Callouts
+ /// These instruct the customer/customer-engineer what to do
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform callout value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace ProcedureCallouts
+ {
+ enum ProcedureCallout
+ {
+ CODE = 0, // Code problem
+ LVL_SUPPORT = 1, // Call next level of support
+ MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error
+ BUS_CALLOUT = 3, // Bus Called Out
+ };
+ }
+
+ ///
+ /// @enum CalloutPriority
+ ///
+ /// This enumeration defines the possible Procedure and Target callout priorities
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform priority value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace CalloutPriorities
+ {
+ enum CalloutPriority
+ {
+ LOW = 0,
+ MEDIUM = 1,
+ HIGH = 2,
+ };
+ }
+
+ ///
+ /// @enum Collect Trace
+ ///
+ /// This enumeration defines the possible firmware traces to collect
+ ///
+ namespace CollectTraces
+ {
+ const uint32_t TRACE_SIZE = 256; // limit collected trace size
+ enum CollectTrace
+ {
+ FSI = 1,
+ SCOM = 2,
+ SCAN = 3,
+ MBOX = 4,
+ };
+ }
+
+ ///
+ /// @brief Get FFDC Size
+ ///
+ /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of
+ /// FFDC data. If the data is of a special type that is handled differently
+ /// than types that are simply memcopied then it is handled by a template
+ /// specialization.
+ /// If this function template is instantiated with a pointer, the compile
+ /// will fail.
+ ///
+ /// @return uint16_t. Size of the FFDC data
+ ///
+ template<typename T>
+ inline uint16_t getErrorInfoFfdcSize(const T &)
+ {
+ static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE,
+ "FFDC too large to capture");
+ return sizeof(T);
+ }
+
+ ///
+ /// @brief Compile error if caller tries to get the FFDC size of a pointer
+ ///
+ template<typename T>
+ inline uint16_t getErrorInfoFfdcSize(const T*)
+ {
+ static_assert(std::is_pointer<T>::value,
+ "pointer passed to getErrorInfoFfdcSize");
+ return 0;
+ }
+
+ ///
+ /// @brief Get FFDC Size specialization for fapi2::Target
+ ///
+ template<fapi2::TargetType T>
+ inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<T>&)
+ {
+ return EI_FFDC_SIZE_TARGET;
+ }
+
+ ///
+ /// @brief Get FFDC Size specialization for variable buffers
+ ///
+ template<>
+ inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing)
+ {
+ // Limit a variable buffer to 4kb bytes, and we can memcpy the storage.
+ return std::min(static_cast<uint32_t>(EI_FFDC_MAX_SIZE),
+ i_thing.getLength<uint8_t>());
+ }
+
+}
+
+#endif // FAPI2_ERRORINFO_DEFS_H_
diff --git a/src/import/hwpf/fapi2/include/return_code.H b/src/import/hwpf/fapi2/include/return_code.H
index 32e4af193..2d84ba126 100644
--- a/src/import/hwpf/fapi2/include/return_code.H
+++ b/src/import/hwpf/fapi2/include/return_code.H
@@ -36,84 +36,9 @@
#include <ffdc.H>
#endif
-///
-/// @brief Set HWP Error macro
-///
-/// This macro should be used by a HWP to create an error. The ReturnCode's
-/// internal return code is set and any error information in the Error XML file
-/// is added to the ReturnCode
-///
-#define FAPI_SET_HWP_ERROR(RC, ERROR) \
- RC._setHwpError(fapi2::ERROR); \
- ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
- ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
- ERROR##_ADD_ERROR_INFO(RC)
-
-///
-/// @brief Add info to HWP Error macro
-///
-/// This macro should be used by an FFDC HWP to add error information from an
-/// Error XML file to an existing error.
-///
-#define FAPI_ADD_INFO_TO_HWP_ERROR(RC, ERROR) \
- ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
- ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
- ERROR##_ADD_ERROR_INFO(RC)
-
namespace fapi2
{
///
- /// @brief Enumeration of return codes
- ///
- enum ReturnCodes
- {
- ///< Success
- FAPI2_RC_SUCCESS = 0,
-
- // Flag bits indicating which code generated the error.
- FAPI2_RC_FAPI2_MASK = 0x04000000, ///< FAPI2 mask
- FAPI2_RC_PLAT_MASK = 0x02000000, ///< Platform mask
- FAPI2_RC_HWP_MASK = 0x00000000, ///< HWP mask
-
- //
- // FAPI generated return codes
- //
-
- FAPI2_RC_INVALID_ATTR_GET = FAPI2_RC_FAPI2_MASK | 0x01,
- ///< Initfile requested an attribute with an invalid attribute ID
-
- FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI2_RC_FAPI2_MASK | 0x02,
- ///< HWP requested a chip EC feature with an invalid attribute ID
-
- FAPI2_RC_INVALID_MULTISCOM_LENGTH = FAPI2_RC_FAPI2_MASK | 0x03,
- ///< Invalid multiscom parameters
-
- FAPI2_RC_INVALID_PARAMETER = FAPI2_RC_FAPI2_MASK | 0x04,
- ///< Invalid parameters to a FAPI2 function
-
- FAPI2_RC_OVERFLOW = FAPI2_RC_FAPI2_MASK | 0x05,
- ///< Overflow condition, typically a buffer operation
-
- FAPI2_RC_FALSE = FAPI2_RC_FAPI2_MASK | 0x06,
- ///< The logical opposite of SUCCESS. Needed where procedures want
- ///< a multi-bool type of operation (e.g., true, false, scom error)
-
- //
- // PLAT generated return codes. Additional details may be contained in
- // ReturnCode platData (this can only be looked at by PLAT code)
- //
-
- FAPI2_RC_PLAT_ERR_SEE_DATA = FAPI2_RC_PLAT_MASK | 0x01,
- ///< Generic platform error
-
- FAPI2_RC_PLAT_ERR_ADU_LOCKED = FAPI2_RC_PLAT_MASK | 0x02,
- ///< Operation to AlterDisplay unit failed because it is locked
-
- FAPI2_RC_PLAT_NOT_SUPPORTED_AT_RUNTIME = FAPI2_RC_PLAT_MASK | 0x03,
- ///< Operation not supported by HB runtime
- };
-
- ///
/// @brief Class representing a FAPI2 ReturnCode
///
// Remove the inheritance relationship with FirstFailureData if
@@ -176,7 +101,6 @@ namespace fapi2
extern thread_local ReturnCode current_err; /// the current error state
extern thread_local uint64_t pib_error_mask; /// the pib mask
extern thread_local uint64_t operational_state; /// the operational mode
-
}
#endif
diff --git a/src/import/hwpf/fapi2/include/return_code_defs.H b/src/import/hwpf/fapi2/include/return_code_defs.H
new file mode 100644
index 000000000..404bfafa5
--- /dev/null
+++ b/src/import/hwpf/fapi2/include/return_code_defs.H
@@ -0,0 +1,114 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 return_code.H
+ * @brief definitions for fapi2 return codes
+ */
+
+#ifndef __FAPI2_RETURN_CODE_DEFS_
+#define __FAPI2_RETURN_CODE_DEFS_
+
+#include <stdint.h>
+
+///
+/// @brief Set HWP Error macro
+///
+/// This macro should be used by a HWP to create an error. The ReturnCode's
+/// internal return code is set and any error information in the Error XML file
+/// is added to the ReturnCode
+///
+#define FAPI_SET_HWP_ERROR(RC, ERROR) \
+ RC._setHwpError(fapi2::ERROR); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+///
+/// @brief Add info to HWP Error macro
+///
+/// This macro should be used by an FFDC HWP to add error information from an
+/// Error XML file to an existing error.
+///
+#define FAPI_ADD_INFO_TO_HWP_ERROR(RC, ERROR) \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+namespace fapi2
+{
+ ///
+ /// @brief Enumeration of return codes
+ ///
+ enum ReturnCodes
+ {
+ ///< Success
+ FAPI2_RC_SUCCESS = 0,
+
+ // Flag bits indicating which code generated the error.
+ FAPI2_RC_FAPI2_MASK = 0x04000000, ///< FAPI2 mask
+ FAPI2_RC_PLAT_MASK = 0x02000000, ///< Platform mask
+ FAPI2_RC_HWP_MASK = 0x00000000, ///< HWP mask
+
+ //
+ // FAPI generated return codes
+ //
+
+ FAPI2_RC_INVALID_ATTR_GET = FAPI2_RC_FAPI2_MASK | 0x01,
+ ///< Initfile requested an attribute with an invalid attribute ID
+
+ FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI2_RC_FAPI2_MASK | 0x02,
+ ///< HWP requested a chip EC feature with an invalid attribute ID
+
+ FAPI2_RC_INVALID_MULTISCOM_LENGTH = FAPI2_RC_FAPI2_MASK | 0x03,
+ ///< Invalid multiscom parameters
+
+ FAPI2_RC_INVALID_PARAMETER = FAPI2_RC_FAPI2_MASK | 0x04,
+ ///< Invalid parameters to a FAPI2 function
+
+ FAPI2_RC_OVERFLOW = FAPI2_RC_FAPI2_MASK | 0x05,
+ ///< Overflow condition, typically a buffer operation
+
+ FAPI2_RC_FALSE = FAPI2_RC_FAPI2_MASK | 0x06,
+ ///< The logical opposite of SUCCESS. Needed where procedures want
+ ///< a multi-bool type of operation (e.g., true, false, scom error)
+
+ //
+ // PLAT generated return codes. Additional details may be contained in
+ // ReturnCode platData (this can only be looked at by PLAT code)
+ //
+
+ FAPI2_RC_PLAT_ERR_SEE_DATA = FAPI2_RC_PLAT_MASK | 0x01,
+ ///< Generic platform error
+
+ FAPI2_RC_PLAT_ERR_ADU_LOCKED = FAPI2_RC_PLAT_MASK | 0x02,
+ ///< Operation to AlterDisplay unit failed because it is locked
+
+ FAPI2_RC_PLAT_NOT_SUPPORTED_AT_RUNTIME = FAPI2_RC_PLAT_MASK | 0x03,
+ ///< Operation not supported by HB runtime
+ };
+
+}
+
+#endif
diff --git a/src/import/hwpf/fapi2/include/utils.H b/src/import/hwpf/fapi2/include/utils.H
index 67ad99b3f..85f334b9a 100644
--- a/src/import/hwpf/fapi2/include/utils.H
+++ b/src/import/hwpf/fapi2/include/utils.H
@@ -32,7 +32,7 @@
#include <stdint.h>
#include <return_code.H>
-#include <error_info.H>
+#include <error_info_defs.H>
namespace fapi2
{
diff --git a/src/import/hwpf/fapi2/include/variable_buffer.H b/src/import/hwpf/fapi2/include/variable_buffer.H
index b773a9242..20ba15d92 100644
--- a/src/import/hwpf/fapi2/include/variable_buffer.H
+++ b/src/import/hwpf/fapi2/include/variable_buffer.H
@@ -32,7 +32,7 @@
#include <buffer_parameters.H>
#include <buffer_traits.H>
-#include <return_code.H>
+#include <return_code_defs.H>
namespace fapi2
{
@@ -76,7 +76,7 @@ namespace fapi2
/// @param[in] i_length The length, in bits, the user wants copied.
///
template<typename unit_type, typename bits_type, typename output_type>
- inline fapi2::ReturnCode _insert(const unit_type* i_source,
+ inline fapi2::ReturnCodes _insert(const unit_type* i_source,
bits_type i_source_length,
output_type* i_target,
bits_type i_target_length,
@@ -287,7 +287,7 @@ namespace fapi2
/// variable_buffer into a variable_buffer, use insert()
///
template< typename OT>
- inline fapi2::ReturnCode set(OT i_value, const bits_type i_offset = 0)
+ inline fapi2::ReturnCodes set(OT i_value, const bits_type i_offset = 0)
{
// Compile time check to make sure OT is integral
static_assert( std::is_integral<OT>::value,
@@ -344,7 +344,7 @@ namespace fapi2
/// @note 0 is left-most
/// @return FAPI2_RC_SUCCESS if OK
///
- inline fapi2::ReturnCode setBit(const bits_type& i_bit)
+ inline fapi2::ReturnCodes setBit(const bits_type& i_bit)
{
const bits_type index = i_bit / bits_per_unit;
@@ -371,7 +371,7 @@ namespace fapi2
/// the case we can add a function parameter version.
///
template< bits_type SB, bits_type L >
- inline fapi2::ReturnCode clearBit(void);
+ inline fapi2::ReturnCodes clearBit(void);
///
/// @brief Invert bit
@@ -384,7 +384,7 @@ namespace fapi2
/// the case we can add a function parameter version.
///
template< bits_type SB, bits_type L = 1 >
- inline fapi2::ReturnCode flipBit(void);
+ inline fapi2::ReturnCodes flipBit(void);
///
/// @brief Get the value of a bit in the buffer
@@ -618,7 +618,7 @@ namespace fapi2
/// @return FAPI2_RC_SUCCESS on success, FAPi2_RC_OVERFLOW otherwise
///
template<typename OT>
- inline fapi2::ReturnCode insert(const OT& i_data,
+ inline fapi2::ReturnCodes insert(const OT& i_data,
bits_type i_targetStart = 0,
bits_type i_len = ~0,
bits_type i_sourceStart = 0)
@@ -645,7 +645,7 @@ namespace fapi2
/// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
///
template<typename OT>
- inline fapi2::ReturnCode insertFromRight(const OT& i_data,
+ inline fapi2::ReturnCodes insertFromRight(const OT& i_data,
bits_type i_targetStart = 0,
bits_type i_len = ~0)
{
@@ -663,7 +663,7 @@ namespace fapi2
///
// Generic extract. Extract is an insert with the arguments reversed.
template< typename OT >
- inline fapi2::ReturnCode extract(OT& o_out,
+ inline fapi2::ReturnCodes extract(OT& o_out,
bits_type i_start = 0,
bits_type i_len = ~0) const
{
@@ -678,7 +678,7 @@ namespace fapi2
// _insert likes 32-bit targets. So lets make our target 32 bits.
uint32_t l_data = static_cast<uint32_t>(o_out);
- ReturnCode rc;
+ ReturnCodes rc;
if ((rc = _insert((container_unit*)&iv_data[0], getBitLength(),
&l_data,
parameterTraits<uint32_t>::bit_length(),
@@ -703,7 +703,7 @@ namespace fapi2
///
// Extract is an insert with the arguments reversed.
template< typename OT >
- inline fapi2::ReturnCode extractToRight(OT& o_out,
+ inline fapi2::ReturnCodes extractToRight(OT& o_out,
bits_type i_start = 0,
bits_type i_len = ~0) const
{
@@ -719,7 +719,7 @@ namespace fapi2
// _insert likes 32-bit targets. So lets make our target 32 bits.
uint32_t l_data = static_cast<uint32_t>(o_out);
- ReturnCode rc;
+ ReturnCodes rc;
if ((rc = _insert(
reinterpret_cast<const container_unit*>(&iv_data[0]),
getBitLength(),
@@ -782,7 +782,7 @@ namespace fapi2
/// @param[in] i_length The length, in bits, the user wants copied.
///
template<typename OT>
- inline fapi2::ReturnCode _insertFromRight(const OT& i_data,
+ inline fapi2::ReturnCodes _insertFromRight(const OT& i_data,
bits_type i_data_length,
bits_type i_targetStart,
bits_type i_len)
@@ -805,7 +805,7 @@ namespace fapi2
// If the source is 64-bits, treat that as 2x32
template<>
- inline fapi2::ReturnCode variable_buffer::insert(const uint64_t& i_source,
+ inline fapi2::ReturnCodes variable_buffer::insert(const uint64_t& i_source,
bits_type i_targetStart,
bits_type i_len,
bits_type i_sourceStart)
@@ -824,7 +824,7 @@ namespace fapi2
// Insert another variable_bufer
template<>
- inline fapi2::ReturnCode variable_buffer::insert(
+ inline fapi2::ReturnCodes variable_buffer::insert(
const variable_buffer& i_data,
bits_type i_targetStart,
bits_type i_len,
@@ -838,7 +838,7 @@ namespace fapi2
// variable_buffer insert from right
template<>
- inline fapi2::ReturnCode variable_buffer::insertFromRight(
+ inline fapi2::ReturnCodes variable_buffer::insertFromRight(
const variable_buffer& i_data,
bits_type i_targetStart,
bits_type i_len)
@@ -849,7 +849,7 @@ namespace fapi2
}
template<>
- inline fapi2::ReturnCode variable_buffer::extract(
+ inline fapi2::ReturnCodes variable_buffer::extract(
uint64_t& i_data,
bits_type i_start,
bits_type i_len) const
@@ -870,7 +870,7 @@ namespace fapi2
{static_cast<uint32_t>((i_data & 0xFFFFFFFF00000000) >> 32),
static_cast<uint32_t>((i_data & 0x00000000FFFFFFFF))};
- ReturnCode rc;
+ ReturnCodes rc;
if ((rc = _insert((container_unit*)&iv_data[0], getBitLength(),
l_data, parameterTraits<uint64_t>::bit_length(),
i_start, 0U, i_len)) != FAPI2_RC_SUCCESS)
@@ -886,7 +886,7 @@ namespace fapi2
// Extract in to another variable_bufer
template<>
- inline fapi2::ReturnCode variable_buffer::extract(
+ inline fapi2::ReturnCodes variable_buffer::extract(
variable_buffer& i_data,
bits_type i_start,
bits_type i_len) const
@@ -905,7 +905,7 @@ namespace fapi2
}
template<>
- inline fapi2::ReturnCode variable_buffer::extractToRight(
+ inline fapi2::ReturnCodes variable_buffer::extractToRight(
uint64_t& i_data,
bits_type i_start,
bits_type i_len) const
@@ -925,7 +925,7 @@ namespace fapi2
{static_cast<uint32_t>((i_data & 0xFFFFFFFF00000000) >> 32),
static_cast<uint32_t>((i_data & 0x00000000FFFFFFFF))};
- ReturnCode rc;
+ ReturnCodes rc;
if ((rc = _insert(
reinterpret_cast<const container_unit*>(&iv_data[0]),
getBitLength(),
diff --git a/src/import/hwpf/fapi2/src/error_info.C b/src/import/hwpf/fapi2/src/error_info.C
index 7dfd2e8d2..e533b35e7 100644
--- a/src/import/hwpf/fapi2/src/error_info.C
+++ b/src/import/hwpf/fapi2/src/error_info.C
@@ -181,26 +181,26 @@ namespace fapi2
switch(iv_ffdcSize)
{
- case EI_FFDC_SIZE_TARGET:
- {
- Target<TARGET_TYPE_ALL> object =
- *(static_cast<const Target<TARGET_TYPE_ALL>*>
- (i_objects[iv_ffdcObjIndex]));
-
- // Allocate an ErrorInfoFfdc but don't copy anything in to it.
- // We can copy the target string once if we copy directly into
- // the error info
- ErrorInfoFfdc* e =
- new ErrorInfoFfdc(iv_ffdcId, nullptr, MAX_ECMD_STRING_LEN);
-
- toString(object, static_cast<char*>(e->getData()),
- MAX_ECMD_STRING_LEN);
- i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(e));
-
- FAPI_DBG("addErrorInfo: Adding target ffdc id: 0x%x %s",
- iv_ffdcId, static_cast<char*>(e->getData()));
- }
- break;
+ case EI_FFDC_SIZE_TARGET:
+ {
+ Target<TARGET_TYPE_ALL> object =
+ *(static_cast<const Target<TARGET_TYPE_ALL>*>
+ (i_objects[iv_ffdcObjIndex]));
+
+ // Allocate an ErrorInfoFfdc but don't copy anything in to it.
+ // We can copy the target string once if we copy directly into
+ // the error info
+ ErrorInfoFfdc* e =
+ new ErrorInfoFfdc(iv_ffdcId, nullptr, MAX_ECMD_STRING_LEN);
+
+ toString(object, static_cast<char*>(e->getData()),
+ MAX_ECMD_STRING_LEN);
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(e));
+
+ FAPI_DBG("addErrorInfo: Adding target ffdc id: 0x%x %s",
+ iv_ffdcId, static_cast<char*>(e->getData()));
+ }
+ break;
default:
i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(
diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
index e394a17ea..bbef07752 100755
--- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
+++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
@@ -53,7 +53,7 @@ my $xml = new XML::Simple (KeyAttr=>[]);
use Data::Dumper;
use Getopt::Long;
-my $target_ffdc_type = "fapi2::Target<fapi2::TARGET_TYPE_ALL>";
+my $target_ffdc_type = "fapi2::Target<T>";
my $buffer_ffdc_type = "fapi2::buffer";
my $variable_buffer_ffdc_type = "fapi2::variable_buffer";
my $ffdc_type = "fapi2::ffdc_t";
@@ -287,8 +287,8 @@ sub addFfdcMethod
if ($type eq $ffdc_type)
{
- $method = "\n template< typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr >\n";
- $method .= " $class_name& set_$ffdc_uc(const T& $param)\n";
+ $method = "\n template< typename T >\n";
+ $method .= " inline $class_name& set_$ffdc_uc(const T& $param)\n";
$method_body = " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
@@ -298,7 +298,7 @@ sub addFfdcMethod
{
# Two methods - one for integral buffers and one for variable_buffers
$method = "\n template< typename T >\n";
- $method .= " $class_name& set_$ffdc_uc(const fapi2::buffer<T>& $param)\n";
+ $method .= " inline $class_name& set_$ffdc_uc(const fapi2::buffer<T>& $param)\n";
$method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
@@ -306,19 +306,26 @@ sub addFfdcMethod
elsif ($type eq $variable_buffer_ffdc_type)
{
- $method = "\n $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
+ $method = "\n inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
$method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
# No need to add the member here, it was added with fapi2::buffer. And we can't have variable
# buffer support with out integral buffer support (can we?)
}
- else
+ elsif ($type eq $target_ffdc_type)
{
- $method = "\n $class_name& set_$ffdc_uc(const $type& $param)\n";
- $method_body .= " {$ffdc_uc = &i_value; return *this;}\n\n";
+ $method = "\n template< TargetType T >\n";
+ $method .= " inline $class_name& set_$ffdc_uc(const $type& $param)\n";
+ $method_body .= " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
- $methods->{$key}{member} = "const $type* $ffdc_uc;\n ";
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ }
+
+ else
+ {
+ print ("ffdc type $type is unknown");
+ exit(1);
}
$method .= ($arg_empty_ffdc eq undef) ? $method_body : " {return *this;}\n\n";
@@ -405,7 +412,7 @@ print CRFILE "#include <plat_trace.H>\n\n";
print CRFILE "namespace fapi2\n";
print CRFILE "{\n";
-print CRFILE "void collectRegFfdc(const fapi2::Target<TARGET_TYPE_ALL>* i_target,\n";
+print CRFILE "void collectRegFfdc(const fapi2::ffdc_t& i_target,\n";
print CRFILE " const fapi2::HwpFfdcId i_ffdcId,\n";
print CRFILE " fapi2::ReturnCode & o_rc,\n";
print CRFILE " const TargetType i_child,\n";
@@ -687,11 +694,13 @@ foreach my $argnum (0 .. $#ARGV)
# Add a method to the ffdc-gathering class
addFfdcMethod(\%methods, $ffdc, $err->{rc});
+ $ffdc = $mangle_names{$ffdc} if ($mangle_names{$ffdc} ne undef);
+
# Add an EI entry to eiEntryStr
$eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
$eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
$eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi2::getErrorInfoFfdcSize($ffdc); \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = $ffdc.size(); \\\n";
$eiEntryCount++;
}
@@ -792,10 +801,6 @@ foreach my $argnum (0 .. $#ARGV)
exit(1);
}
- # Check the type of the Targets
- print EIFILE "fapi2::checkType<const $target_ffdc_type *>($targets[0]); \\\n";
- print EIFILE "fapi2::checkType<const $target_ffdc_type *>($targets[1]); \\\n";
-
# Add the Targets to the objectlist if they don't already exist
my $objNum1 = addEntryToArray(\@eiObjects, $targets[0]);
@@ -995,9 +1000,6 @@ foreach my $argnum (0 .. $#ARGV)
# Process the callout, deconfigures and GARDs for each Target
foreach my $cdg (keys %cdgTargetHash)
{
- # Check the type
- print EIFILE "fapi2::checkType<const $target_ffdc_type *>($cdg); \\\n";
-
my $callout = 0;
my $priority = 'LOW';
my $deconf = 0;
@@ -1039,9 +1041,6 @@ foreach my $argnum (0 .. $#ARGV)
# Process the callout, deconfigures and GARDs for Child Targets
foreach my $parent (keys %cdgChildHash)
{
- # Check the type
- print EIFILE "fapi2::checkType<const $target_ffdc_type *>($parent); \\\n";
-
foreach my $childType (keys %{$cdgChildHash{$parent}})
{
my $callout = 0;
@@ -1175,7 +1174,7 @@ foreach my $argnum (0 .. $#ARGV)
{
# Void expression keeps the compiler from complaining about the unused arguments.
print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err)\n";
- print ECFILE " {static_cast<void>(i_sev); static_cast<void>(i_rc);}\n";
+ print ECFILE " {static_cast<void>(i_sev); static_cast<void>(i_rc);}\n\n";
}
# Methods
@@ -1188,10 +1187,17 @@ foreach my $argnum (0 .. $#ARGV)
# passing in of the severity so that macros which call execute() can over-ride
# the default severity.
print ECFILE " void execute(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNDEFINED)\n";
- print ECFILE " {\n";
- print ECFILE " FAPI_SET_HWP_ERROR(iv_rc, $err->{rc});\n" if ($arg_empty_ffdc eq undef);
- print ECFILE " fapi2::logError(iv_rc, (i_sev == fapi2::FAPI2_ERRL_SEV_UNDEFINED) ? iv_sev : i_sev);\n" if ($arg_empty_ffdc eq undef);
- print ECFILE " }\n\n";
+ if ($arg_empty_ffdc eq undef)
+ {
+ print ECFILE " {\n";
+ print ECFILE " FAPI_SET_HWP_ERROR(iv_rc, $err->{rc});\n" if ($arg_empty_ffdc eq undef);
+ print ECFILE " fapi2::logError(iv_rc, (i_sev == fapi2::FAPI2_ERRL_SEV_UNDEFINED) ? iv_sev : i_sev);\n" if ($arg_empty_ffdc eq undef);
+ print ECFILE " }\n\n";
+ }
+ else
+ {
+ print ECFILE " {static_cast<void>(i_sev);}\n\n";
+ }
# Instance variables
if ($arg_empty_ffdc eq undef)
OpenPOWER on IntegriCloud