diff options
author | Thi Tran <thi@us.ibm.com> | 2015-10-15 11:51:50 -0500 |
---|---|---|
committer | Patrick Williams <iawillia@us.ibm.com> | 2015-12-11 13:40:20 -0600 |
commit | a3d922ca2b3e3fc7dce7effdfa3e485449112cd2 (patch) | |
tree | 434203fcdca0188cf3f7e3af29be8999c435c391 /src/import/hwpf | |
parent | 08bcd4e9dcea5c0e60a1c31bbe099c14f504beaf (diff) | |
download | talos-hostboot-a3d922ca2b3e3fc7dce7effdfa3e485449112cd2.tar.gz talos-hostboot-a3d922ca2b3e3fc7dce7effdfa3e485449112cd2.zip |
Additional change for FAPI2 FFDC
Change-Id: I188922734424ff27d220ad72e81ba2fe3a5a84ba
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21256
Tested-by: Jenkins Server
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: Matt K. Light <mklight@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Diffstat (limited to 'src/import/hwpf')
-rw-r--r-- | src/import/hwpf/fapi2/include/ffdc.H | 107 | ||||
-rw-r--r-- | src/import/hwpf/fapi2/include/return_code.H | 34 |
2 files changed, 88 insertions, 53 deletions
diff --git a/src/import/hwpf/fapi2/include/ffdc.H b/src/import/hwpf/fapi2/include/ffdc.H index 6ebf87ff8..2134e018f 100644 --- a/src/import/hwpf/fapi2/include/ffdc.H +++ b/src/import/hwpf/fapi2/include/ffdc.H @@ -1,23 +1,19 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/fapi2/include/ffdc.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* 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 */ /** @@ -38,31 +34,31 @@ using fapi2::TARGET_TYPE_ALL; namespace fapi2 { - /// - /// @brief Check the type of a variable - /// - /// This function can be called to check that a variable type is as expected - /// @note This mechanism will allow for cast ctor's which other static type - /// checking might not. - /// - template<typename T> - inline - void checkType(const T &) {} - - class ReturnCode; - - /// - /// @class FirstFailureData - /// - /// This class provides storage and methods for creating and manipulating - /// FFDC. - /// It is not needed on all platforms - platforms which need this class have - /// specified this by forcing their fapi2::ReturnCode to be a subclass of - /// this class. - /// - template< class R = fapi2::ReturnCode > - class FirstFailureData - { +/// +/// @brief Check the type of a variable +/// +/// This function can be called to check that a variable type is as expected +/// @note This mechanism will allow for cast ctor's which other static type +/// checking might not. +/// +template<typename T> +inline +void checkType(const T&) {} + +class ReturnCode; + +/// +/// @class FirstFailureData +/// +/// This class provides storage and methods for creating and manipulating +/// FFDC. +/// It is not needed on all platforms - platforms which need this class have +/// specified this by forcing their fapi2::ReturnCode to be a subclass of +/// this class. +/// +template< class R = fapi2::ReturnCode > +class FirstFailureData +{ public: /// @@ -73,7 +69,7 @@ namespace fapi2 /// FirstFailureData(void): iv_info( nullptr ) - {} + {} /// /// @brief Copy Constructor @@ -82,7 +78,7 @@ namespace fapi2 /// @note Generates default copy constructor - no deep pointer /// copies necessary. /// - FirstFailureData(const FirstFailureData & i_right) = default; + FirstFailureData(const FirstFailureData& i_right) = default; /// /// @brief Destructor @@ -95,7 +91,7 @@ namespace fapi2 /// @param[in] i_right Reference to FirstFailureData to assign from. /// @return Reference to 'this' FirstFailureData /// - FirstFailureData & operator=(const FirstFailureData & i_right) = default; + FirstFailureData& operator=(const FirstFailureData& i_right) = default; /// /// @brief Sets a HWP error. Sets the rcValue to the supplied value (from @@ -110,13 +106,13 @@ namespace fapi2 /// @param[in] i_rcValue Error value to set /// inline void _setHwpError(const fapi2::HwpReturnCode i_rcValue) - { - FAPI_ERR("_setHwpError: Creating HWP error 0x%x", i_rcValue); - static_cast<R*>(this)->operator=(i_rcValue); + { + FAPI_ERR("_setHwpError: Creating HWP error 0x%x", i_rcValue); + static_cast<R*>(this)->operator=(i_rcValue); - // Forget about any associated data (this is a new error) - iv_info.reset(new ErrorInfo()); - } + // Forget about any associated data (this is a new error) + iv_info.reset(new ErrorInfo()); + } /// /// @brief Get a pointer to any PlatData. FirstFailureData is still @@ -140,7 +136,12 @@ namespace fapi2 /// /// @return void*. Pointer to any PlatData. If NULL then no data /// - void* releaseData(void); + inline void* releaseData(void) + { + void* l_pData = iv_info; + iv_info = NULL; + return l_pData; + } /// /// @brief Add ErrorInfo @@ -157,7 +158,7 @@ namespace fapi2 /// defining the ErrorInfo that needs to be added /// @param[in] i_count Number of ErrorInfoEntry entries /// - void addErrorInfo(const void* const * i_pObjects, + void addErrorInfo(const void* const* i_pObjects, const ErrorInfoEntry* i_pEntries, const uint8_t i_count); @@ -169,7 +170,9 @@ namespace fapi2 /// @return ErrorInfo *. Pointer to any ErrorInfo. If NULL then no info /// inline const fapi2::ErrorInfo* getErrorInfo(void) const - { return iv_info.get(); } + { + return iv_info.get(); + } /// /// @brief Forgets about any associated data (PlatData and ErrorInfo) @@ -178,13 +181,15 @@ namespace fapi2 /// data is deleted /// inline void forgetData(void) - { iv_info = nullptr; } + { + iv_info = nullptr; + } private: // Pointer to the data std::shared_ptr<ErrorInfo> iv_info; - }; +}; } #endif // FAPI2_FFDC_H_ diff --git a/src/import/hwpf/fapi2/include/return_code.H b/src/import/hwpf/fapi2/include/return_code.H index 2f8f3460c..ebb872bc8 100644 --- a/src/import/hwpf/fapi2/include/return_code.H +++ b/src/import/hwpf/fapi2/include/return_code.H @@ -74,10 +74,10 @@ class ReturnCode : public FirstFailureData<ReturnCode> /// /// @brief Assignement operator /// - #ifdef DOXYGEN +#ifdef DOXYGEN inline ReturnCode& operator=(const uint64_t& rhs) inline ReturnCode& operator=(const ReturnCodes& rhs) - #endif +#endif inline bool operator==(const uint64_t& rhs) const { @@ -99,6 +99,36 @@ class ReturnCode : public FirstFailureData<ReturnCode> return rhs != iv_rc; } + /// + /// @brief Enumeration of return code creators + /// + enum returnCodeCreator + { + CREATOR_FAPI = 1, + CREATOR_PLAT = 2, + CREATOR_HWP = 3, + }; + + /// + /// @brief Gets the creator of the return code + /// @return ReturnCodeCreator + /// + inline returnCodeCreator getCreator(void) const + { + returnCodeCreator l_creator = CREATOR_HWP; + + if (iv_rc & FAPI2_RC_FAPI2_MASK) + { + l_creator = CREATOR_FAPI; + } + else if (iv_rc & FAPI2_RC_PLAT_MASK) + { + l_creator = CREATOR_PLAT; + } + + return l_creator; + } + private: uint64_t iv_rc; }; |