diff options
| author | Thi Tran <thi@us.ibm.com> | 2015-07-23 16:12:18 -0500 |
|---|---|---|
| committer | Patrick Williams <iawillia@us.ibm.com> | 2015-12-11 13:40:20 -0600 |
| commit | 81d0aff11bdb017120fb6f34daaea2b136935730 (patch) | |
| tree | cd0b42e3ba82e839be74d18df85cd596ddd06a8e /src/import/hwpf/fapi2 | |
| parent | f7371ae857086cb3c37126819eb0b61c577821cc (diff) | |
| download | blackbird-hostboot-81d0aff11bdb017120fb6f34daaea2b136935730.tar.gz blackbird-hostboot-81d0aff11bdb017120fb6f34daaea2b136935730.zip | |
FAPI2 - Error/FFDC work related updates
Change-Id: I2c153d4362791d885b85fee0f4891a9239c6aec7
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19308
Tested-by: Jenkins Server
Reviewed-by: Matt K. Light <mklight@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Diffstat (limited to 'src/import/hwpf/fapi2')
| -rwxr-xr-x | src/import/hwpf/fapi2/docs/topics/Ffdc.md | 2 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/buffer.H | 30 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/error_info_defs.H | 426 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/fapi2_attribute_service.H | 25 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/fapi2_error_scope.H | 27 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/fapi2_target.H | 67 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/target_types.H | 24 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/src/fapi2.mk | 2 | ||||
| -rwxr-xr-x | src/import/hwpf/fapi2/tools/createIfAttrService.pl | 1 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/tools/parseErrorInfo.mk | 2 | ||||
| -rwxr-xr-x | src/import/hwpf/fapi2/tools/parseErrorInfo.pl | 88 |
11 files changed, 382 insertions, 312 deletions
diff --git a/src/import/hwpf/fapi2/docs/topics/Ffdc.md b/src/import/hwpf/fapi2/docs/topics/Ffdc.md index 9cd724f6f..a79c79705 100755 --- a/src/import/hwpf/fapi2/docs/topics/Ffdc.md +++ b/src/import/hwpf/fapi2/docs/topics/Ffdc.md @@ -12,7 +12,7 @@ parseErrorInfo.pl [--empty-ffdc-classes] [--use-variable-buffers] --output-dir=< - This perl script will parse HWP Error XML files and creates the following files: - hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors) - hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR when a HWP generates an error) -- collect_reg_ffdc.C. Function to collect register FFDC +- collect_reg_ffdc.H. Function to collect register FFDC - set_sbe_error.H. Macro to create an SBE error The --empty-ffdc-classes option is for platforms which don't collect FFDC. It will generate stub classes which diff --git a/src/import/hwpf/fapi2/include/buffer.H b/src/import/hwpf/fapi2/include/buffer.H index 154ed4b2c..7e604d208 100644 --- a/src/import/hwpf/fapi2/include/buffer.H +++ b/src/import/hwpf/fapi2/include/buffer.H @@ -26,7 +26,7 @@ #include <buffer_parameters.H> #include <buffer_traits.H> -#include <return_code.H> +#include <return_code_defs.H> namespace fapi2 { @@ -108,7 +108,7 @@ class buffer /// 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, @@ -192,8 +192,8 @@ class buffer /// @note 0 is left-most /// @return FAPI2_RC_SUCCESS if OK /// - inline fapi2::ReturnCode setBit(const bits_type& i_bit, - const bits_type& i_count = 1) + inline fapi2::ReturnCodes setBit(const bits_type& i_bit, + const bits_type& i_count = 1) { if ((i_count + i_bit - 1) >= TT::bits_per_unit()) { @@ -232,8 +232,8 @@ class buffer /// @note 0 is left-most /// @return FAPI2_RC_SUCCESS if OK /// - inline fapi2::ReturnCode clearBit(const bits_type& i_bit, - const bits_type& i_count = 1) + inline fapi2::ReturnCodes clearBit(const bits_type& i_bit, + const bits_type& i_count = 1) { if ((i_count + i_bit - 1) >= TT::bits_per_unit()) { @@ -509,8 +509,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if successful /// template<typename OT> - fapi2::ReturnCode insert(const OT i_datain, const bits_type i_targetStart, - const bits_type i_len, const bits_type i_sourceStart = 0) + fapi2::ReturnCodes insert(const OT i_datain, const bits_type i_targetStart, + const bits_type i_len, const bits_type i_sourceStart = 0) { const bits_type target_length = parameterTraits<T>::bit_length(); const bits_type source_length = parameterTraits<OT>::bit_length(); @@ -607,9 +607,9 @@ class buffer /// @note Data is assumed to be aligned on the word boundary of L /// template<typename OT> - fapi2::ReturnCode insertFromRight(const OT i_datain, - const bits_type i_targetStart, - const bits_type i_len) + fapi2::ReturnCodes insertFromRight(const OT i_datain, + const bits_type i_targetStart, + const bits_type i_len) { // Error if input data don't make sense if ((i_targetStart + i_len) > parameterTraits<T>::bit_length()) @@ -684,8 +684,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if ok /// template<typename OT> - fapi2::ReturnCode extract(OT& o_out, const bits_type i_sourceStart, - const bits_type i_len, const bits_type i_targetStart = 0) const + fapi2::ReturnCodes extract(OT& o_out, const bits_type i_sourceStart, + const bits_type i_len, const bits_type i_targetStart = 0) const { // Extraction is just an insert into o_out @@ -740,8 +740,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if ok /// template<typename OT> - fapi2::ReturnCode extractToRight(OT& o_out, const bits_type i_sourceStart, - const bits_type i_len) const + fapi2::ReturnCodes extractToRight(OT& o_out, const bits_type i_sourceStart, + const bits_type i_len) const { return extract(o_out, i_sourceStart, i_len, parameterTraits<OT>::bit_length() - i_len); diff --git a/src/import/hwpf/fapi2/include/error_info_defs.H b/src/import/hwpf/fapi2/include/error_info_defs.H index 31fc3429c..443f64b92 100644 --- a/src/import/hwpf/fapi2/include/error_info_defs.H +++ b/src/import/hwpf/fapi2/include/error_info_defs.H @@ -1,25 +1,19 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/fapi2/include/error_info_defs.H $ */ /* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ -/* [+] International Business Machines Corp. */ +/* IBM CONFIDENTIAL */ /* */ +/* EKB Project */ /* */ -/* 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 */ +/* COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ /* */ -/* 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. */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ @@ -34,212 +28,228 @@ #include <stdint.h> #include <target.H> #include <variable_buffer.H> - -#include <iostream> +#include <utility> 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 - { +/// +/// @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 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; } + { + return *(reinterpret_cast<const uint8_t*>(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 + int16_t size(void) const { - // 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 + return iv_value.second; + } + int16_t& size(void) { - 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 + return iv_value.second; + } + + const void* ptr(void) const { - 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 + return iv_value.first; + } + const void*& ptr(void) { - 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>()); - } + 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>()); +} }; diff --git a/src/import/hwpf/fapi2/include/fapi2_attribute_service.H b/src/import/hwpf/fapi2/include/fapi2_attribute_service.H index b031f6e80..768af2f4b 100644 --- a/src/import/hwpf/fapi2/include/fapi2_attribute_service.H +++ b/src/import/hwpf/fapi2/include/fapi2_attribute_service.H @@ -1,3 +1,21 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/fapi2/include/fapi2_attribute_service.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ /// /// @file src/include/usr/hwpf/fapi2/fapi2_attribute_service.H /// @@ -10,6 +28,7 @@ #define FAPI2ATTRIBUTESERVICE_H_ #include <stdint.h> #include <attribute_ids.H> +#include <return_code.H> #include <target.H> #include <target_types.H> #include <plat_attribute_service.H> @@ -95,7 +114,7 @@ namespace fapi2 template< TargetType K > ReturnCode getInitFileAttr(const AttributeId i_id, const Target<K>& i_target, - uint64_t & o_val, + uint64_t& o_val, const uint32_t i_arrayIndex1 = 0, const uint32_t i_arrayIndex2 = 0, const uint32_t i_arrayIndex3 = 0, @@ -107,7 +126,7 @@ ReturnCode getInitFileAttr(const AttributeId i_id, * This is called by FAPI code to check at compile time that a FAPI attribute * access is using the correct data type and a valid AttributeId */ -template<typename T> inline void checkIdType(AttributeId, T &) {} +template<typename T> inline void checkIdType(AttributeId, T&) {} /** * @brief Fail if attribute privileged @@ -118,7 +137,7 @@ template<typename T> inline void checkIdType(AttributeId, T &) {} class ErrorAccessingPrivilegedAttribute; template<const bool PRIVILEGED> void failIfPrivileged() { - ErrorAccessingPrivilegedAttribute(); + ErrorAccessingPrivilegedAttribute(); } template <> inline void failIfPrivileged<false>() {} diff --git a/src/import/hwpf/fapi2/include/fapi2_error_scope.H b/src/import/hwpf/fapi2/include/fapi2_error_scope.H index 43278c537..71f8c5a47 100644 --- a/src/import/hwpf/fapi2/include/fapi2_error_scope.H +++ b/src/import/hwpf/fapi2/include/fapi2_error_scope.H @@ -1,25 +1,19 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/fapi2/include/fapi2_error_scope.H $ */ /* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ +/* IBM CONFIDENTIAL */ /* */ +/* EKB Project */ /* */ -/* 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 */ +/* COPYRIGHT 2012,2015 */ +/* [+] International Business Machines Corp. */ /* */ -/* 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. */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ /** @@ -32,7 +26,6 @@ #include <stdint.h> #include <plat_error_scope.H> -#include <return_code.H> #include <hwp_ffdc_classes.H> /// @cond @@ -61,9 +54,9 @@ /// FSP operational states. /// #ifdef DOXYGEN -#define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL + #define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL #else -#define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__) + #define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__) #endif /// diff --git a/src/import/hwpf/fapi2/include/fapi2_target.H b/src/import/hwpf/fapi2/include/fapi2_target.H index ad22fe7d1..86568b4ba 100644 --- a/src/import/hwpf/fapi2/include/fapi2_target.H +++ b/src/import/hwpf/fapi2/include/fapi2_target.H @@ -184,8 +184,29 @@ class Target /// inline constexpr bool isChip(void) const { - return ( (K == TARGET_TYPE_PROC_CHIP) || - (K == TARGET_TYPE_MEMBUF_CHIP) ); + return (isChip(K)); + } + + /// + /// @brief Static function check if a Target type value is that of + /// a chip. It will return false for compound types that + /// include non-chip Target type bits + /// + /// @param[in] i_type The value of the Target type. + /// @return Return true if this type is of a chip, false otherwise + /// + static inline bool isChip(const TargetType i_type) + { + bool l_retVal = false; + + // Target type must have only chip type bits set + if ( ((i_type & TARGET_TYPE_CHIPS) != 0) && + ((i_type & ~TARGET_TYPE_CHIPS) == 0) ) + { + l_retVal = true; + } + + return l_retVal; } /// @@ -194,25 +215,29 @@ class Target /// inline constexpr bool isChiplet(void) const { - return ( (K == TARGET_TYPE_EX) || - (K == TARGET_TYPE_MBA) || - (K == TARGET_TYPE_MCS) || - (K == TARGET_TYPE_XBUS) || - (K == TARGET_TYPE_ABUS) || - (K == TARGET_TYPE_L4) || - (K == TARGET_TYPE_CORE) || - (K == TARGET_TYPE_EQ) || - (K == TARGET_TYPE_MCA) || - (K == TARGET_TYPE_MCBIST) || - (K == TARGET_TYPE_MI) || - (K == TARGET_TYPE_DMI) || - (K == TARGET_TYPE_OBUS) || - (K == TARGET_TYPE_NV) || - (K == TARGET_TYPE_SBE) || - (K == TARGET_TYPE_PPE) || - (K == TARGET_TYPE_PERV) || - (K == TARGET_TYPE_PEC) || - (K == TARGET_TYPE_PHB) ); + return (isChiplet(K)); + } + + /// + /// @brief Static function check if a Target type value is that of + /// a chiplet. It will return false for compound types that + /// include non-chiplet Target type bits + /// + /// @param[in] i_type The value of the Target type. + /// @return Return true if this type is of a chiplet, false otherwise + /// + static inline bool isChiplet(const TargetType i_type) + { + bool l_retVal = false; + + // Target type must have only chiplet type bits set + if ( ((i_type & TARGET_TYPE_CHIPLETS) != 0) && + ((i_type & ~TARGET_TYPE_CHIPLETS) == 0) ) + { + l_retVal = true; + } + + return l_retVal; } /// diff --git a/src/import/hwpf/fapi2/include/target_types.H b/src/import/hwpf/fapi2/include/target_types.H index d75d5e45d..9f22a6913 100644 --- a/src/import/hwpf/fapi2/include/target_types.H +++ b/src/import/hwpf/fapi2/include/target_types.H @@ -66,6 +66,30 @@ enum TargetType TARGET_TYPE_ALL = 0xFFFFFFFF, ///< Any/All types + // Compound target types + TARGET_TYPE_CHIPS = TARGET_TYPE_PROC_CHIP | + TARGET_TYPE_MEMBUF_CHIP, + + TARGET_TYPE_CHIPLETS = TARGET_TYPE_EX | + TARGET_TYPE_MBA | + TARGET_TYPE_MCS | + TARGET_TYPE_XBUS | + TARGET_TYPE_ABUS | + TARGET_TYPE_L4 | + TARGET_TYPE_CORE | + TARGET_TYPE_EQ | + TARGET_TYPE_MCA | + TARGET_TYPE_MCBIST | + TARGET_TYPE_MI | + TARGET_TYPE_DMI | + TARGET_TYPE_OBUS | + TARGET_TYPE_NV | + TARGET_TYPE_SBE | + TARGET_TYPE_PPE | + TARGET_TYPE_PERV | + TARGET_TYPE_PEC | + TARGET_TYPE_PHB, + // Mappings to target types found in the error xml files TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX, TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, diff --git a/src/import/hwpf/fapi2/src/fapi2.mk b/src/import/hwpf/fapi2/src/fapi2.mk index 0cb91dfb7..5bbf7d151 100644 --- a/src/import/hwpf/fapi2/src/fapi2.mk +++ b/src/import/hwpf/fapi2/src/fapi2.mk @@ -30,7 +30,7 @@ FAPI2_MODULE_OBJS += fapi2_attribute_service.o #TODO RTC 134733: Can't find the basic XML for attributes, so # fapi2_chip_ec_feature.C doesn't compile. #FAPI2_MODULE_OBJS += fapi2_chip_ec_feature.o -FAPI2_MODULE_OBJS += collect_reg_ffdc.o +#FAPI2_MODULE_OBJS += collect_reg_ffdc.o # Define common source and include paths. define FAPI2_MODULE_INCLUDES diff --git a/src/import/hwpf/fapi2/tools/createIfAttrService.pl b/src/import/hwpf/fapi2/tools/createIfAttrService.pl index a4e321f80..075fe9d4a 100755 --- a/src/import/hwpf/fapi2/tools/createIfAttrService.pl +++ b/src/import/hwpf/fapi2/tools/createIfAttrService.pl @@ -273,7 +273,6 @@ if ($attCount > 0) } print ASFILE " {\n"; print ASFILE " FAPI_ERR(\"getInitFileAttr: Unrecognized attr ID: 0x%x\", i_id);\n"; -#print ASFILE " @thi TODO: - Resolve FFDC\n"; print ASFILE " }\n\n"; print ASFILE " if (l_rc)\n"; print ASFILE " {\n"; diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk index 31909605d..474043c75 100644 --- a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk +++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk @@ -28,7 +28,7 @@ SOURCES += $(GENPATH)/empty_error.xml TARGETS += hwp_return_codes.H TARGETS += hwp_error_info.H TARGETS += hwp_ffdc_classes.H -TARGETS += collect_reg_ffdc.C +TARGETS += collect_reg_ffdc.H TARGETS += set_sbe_error.H define parseErrorInfo_RUN diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl index 61b6c96db..e192f1802 100755 --- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl +++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl @@ -2,36 +2,34 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/usr/hwpf/fapi/fapiParseErrorInfo.pl $ +# $Source: hwpf/fapi2/tools/parseErrorInfo.pl $ # -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2011,2014 -# [+] International Business Machines Corp. +# IBM CONFIDENTIAL # +# EKB Project # -# 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 +# COPYRIGHT 2015 +# [+] International Business Machines Corp. # -# 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. +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. # # IBM_PROLOG_END_TAG -# $Id: fapiParseErrorInfo.pl,v 1.30 2014/07/25 00:36:41 jmcgill Exp $ -# Purpose: This perl script will parse HWP Error XML files and create required -# FAPI code. # -# Author: CamVan Nguyen and Mike Jones -# Reworked for fapi2/P9 +# @file parseErrorInfo.pl +# @brief This perl script will parse HWP Error XML files and generate required +# FAPI code to create and error log and add FFDC to the error. +# +# *HWP HWP Owner: N/A +# *HWP FW Owner: Thi Tran <thi@us.ibm.com> +# *HWP Team: N/A +# *HWP Level: 1 +# *HWP Consumed by: HB # # Usage: -# fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ... +# parseErrorInfo.pl <output dir> <filename1> <filename2> ... use strict; @@ -102,7 +100,7 @@ if (($numArgs < 1) || ($arg_output_dir eq undef)) print (" - hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)\n"); print (" - hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR\n"); print (" when a HWP generates an error)\n"); - print (" - collect_reg_ffdc.C. Function to collect register FFDC\n"); + print (" - collect_reg_ffdc.H. Function to collect register FFDC\n"); print (" - set_sbe_error.H. Macro to create an SBE error\n"); print (" The --empty-ffdc-classes option is for platforms which don't collect ffdc.\n"); exit(1); @@ -352,7 +350,7 @@ open(ECFILE, ">", $ecFile); my $crFile = $arg_output_dir; $crFile .= "/"; -$crFile .= "collect_reg_ffdc.C"; +$crFile .= "collect_reg_ffdc.H"; open(CRFILE, ">", $crFile); my $sbFile = $arg_output_dir; @@ -396,28 +394,29 @@ print ECFILE " *\/\n"; print ECFILE "namespace fapi2\n{\n"; #------------------------------------------------------------------------------ -# Print start of file information to collectRegFfdc.C +# Print start of file information to collectRegFfdc.H #------------------------------------------------------------------------------ -print CRFILE "// collect_reg_ffdc.C\n"; +print CRFILE "// collect_reg_ffdc.H\n"; print CRFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n"; +print CRFILE "#ifndef FAPI2_COLLECT_REG_FFDC_H_\n"; +print CRFILE "#define FAPI2_COLLECT_REG_FFDC_H_\n"; print CRFILE "#include <stdint.h>\n"; print CRFILE "#include <vector>\n"; - +print CRFILE "#include <ffdc.H>\n"; +print CRFILE "#include <hwp_error_info.H>\n"; +print CRFILE "#include <error_info_defs.H>\n"; print CRFILE "#include <buffer.H>\n"; -print CRFILE "#include <collect_reg_ffdc.H>\n"; print CRFILE "#include <target.H>\n"; print CRFILE "#include <return_code.H>\n"; print CRFILE "#include <hw_access.H>\n"; -print CRFILE "#include <plat_trace.H>\n\n"; - +print CRFILE "#include <plat_trace.H>\n"; print CRFILE "namespace fapi2\n"; print CRFILE "{\n"; +print CRFILE "template< TargetType C, TargetType P >\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"; -print CRFILE " const TargetType i_presChild,\n"; -print CRFILE " uint32_t i_childOffsetMult)\n"; +print CRFILE " uint32_t i_childOffsetMult = 0)\n"; print CRFILE "{\n"; print CRFILE " FAPI_INF(\"collectRegFfdc. FFDC ID: 0x%x\", i_ffdcId);\n"; print CRFILE " fapi2::ReturnCode l_rc;\n"; @@ -435,8 +434,6 @@ print CRFILE " static_cast<void>(l_scomData);\n"; print CRFILE " static_cast<void>(l_ffdcSize);\n"; print CRFILE " static_cast<const void>(i_target);\n"; print CRFILE " static_cast<void>(o_rc);\n"; -print CRFILE " static_cast<void>(i_child);\n"; -print CRFILE " static_cast<void>(i_presChild);\n"; print CRFILE " static_cast<void>(i_childOffsetMult);\n"; #------------------------------------------------------------------------------ # Print start of file information to setSbeError.H @@ -550,7 +547,6 @@ foreach my $argnum (0 .. $#ARGV) # right now. When we get further along, we can enable this code. =begin NO_FFDC_COLLECT_HWP $count = 0; - foreach my $collectFfdc (@{$err->{collectFfdc}}) { if ($count == 0) @@ -602,8 +598,8 @@ foreach my $argnum (0 .. $#ARGV) #--------------------------------------------------------------------------------- if (exists $collectRegisterFfdc->{target}) { - print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{target}, "; - print EIFILE "fapi2::$id, RC, fapi2::TARGET_TYPE_NONE, fapi2::TARGET_TYPE_NONE); "; + print EIFILE "fapi2::collectRegFfdc<fapi2::TARGET_TYPE_NONE, fapi2::TARGET_TYPE_NONE>($collectRegisterFfdc->{target}, "; + print EIFILE "fapi2::$id, RC); "; addFfdcMethod(\%methods, $collectRegisterFfdc->{target}, $err->{rc}, $target_ffdc_type); } @@ -619,8 +615,8 @@ foreach my $argnum (0 .. $#ARGV) print ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n"); exit(1); } - print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{childTargets}->{parent}, fapi2::$id, "; - print EIFILE "RC, fapi2::$collectRegisterFfdc->{childTargets}->{childType}, fapi2::TARGET_TYPE_NONE); "; + print EIFILE "fapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{childTargets}->{childType}, fapi2::TARGET_TYPE_NONE>"; + print EIFILE "($collectRegisterFfdc->{childTargets}->{parent}, fapi2::$id, RC); "; addFfdcMethod(\%methods, $collectRegisterFfdc->{childTargets}->{parent}, $err->{rc}, $target_ffdc_type); } @@ -641,8 +637,8 @@ foreach my $argnum (0 .. $#ARGV) print ("parseErrorInfo.pl ERROR: childPosOffsetMultiplier missing from collectRegisterFfdc\n"); exit(1); } - print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{basedOnPresentChildren}->{target}, fapi2::$id, RC, "; - print EIFILE "fapi2::TARGET_TYPE_NONE, fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, "; + print EIFILE "fapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, fapi2::TARGET_TYPE_NONE>"; + print EIFILE "($collectRegisterFfdc->{basedOnPresentChildren}->{target}, fapi2::$id, RC, "; print EIFILE "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier}); "; addFfdcMethod(\%methods, $collectRegisterFfdc->{basedOnPresentChildren}->{target}, $err->{rc}, $target_ffdc_type); @@ -1251,6 +1247,7 @@ foreach my $argnum (0 .. $#ARGV) #---------------------------------------------------------------------- print CRFILE " case $registerFfdc->{id}[0]:\n"; +# TODO: RTC 132226 =begin NEED_P9_REGISTERS # Look for CFAM Register addresses foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}}) @@ -1281,16 +1278,17 @@ print CRFILE "i_ffdcId);\n"; print CRFILE " return;\n"; print CRFILE " }\n\n"; +# TODO: RTC 132226 =begin NEED_P9_REGISTERS - print CRFILE " uint8_t * l_pBuf = NULL;\n"; print CRFILE " uint8_t * l_pData = NULL;\n"; print CRFILE " std::vector<fapi::Target> l_targets;\n"; print CRFILE " uint32_t l_chipletPos32 = 0;\n"; + #--------------------------------------------------------------------------------------------------------- # Populate chiplet vectors (if required by register collection method) and adjust buffer sizes accordingly #--------------------------------------------------------------------------------------------------------- -print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_child)\n"; +print CRFILE " if (C != TARGET_TYPE_NONE)\n"; print CRFILE " {\n"; print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_child, l_targets, TARGET_STATE_FUNCTIONAL);\n"; print CRFILE " if (l_rc)\n"; @@ -1308,7 +1306,7 @@ print CRFILE " l_ffdcSize *= l_targets.size();\n"; print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n"; print CRFILE " l_pData = l_pBuf;\n"; print CRFILE " }\n"; -print CRFILE " else if (fapi2::TARGET_TYPE_NONE != i_presChild)\n"; +print CRFILE " else if (P != TARGET_TYPE_NONE)\n"; print CRFILE " {\n"; print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_presChild, l_targets, TARGET_STATE_PRESENT);\n"; print CRFILE " if (l_rc)\n"; @@ -1333,6 +1331,7 @@ print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n"; print CRFILE " l_pData = l_pBuf;\n"; print CRFILE " l_targets.push_back(i_target);\n"; print CRFILE " }\n\n"; + #--------------------------------------------------------------------------------------------------------- # Obtain target position and insert as the first word in the buffer #--------------------------------------------------------------------------------------------------------- @@ -1428,11 +1427,12 @@ print CRFILE " }\n"; print CRFILE " }\n\n"; print CRFILE " o_rc.addEIFfdc(i_ffdcId, l_pBuf, l_ffdcSize);\n"; print CRFILE " delete [] l_pBuf;\n"; + =cut NEED_P9_REGISTERS print CRFILE "}\n"; print CRFILE "}\n"; - +print CRFILE "#endif\n"; #------------------------------------------------------------------------------ # Print the fapiHwpReturnCodes.H file |

