From 12d756eb87b38ffa8950855429bd22f65da795cb Mon Sep 17 00:00:00 2001 From: "Richard J. Knight" Date: Mon, 7 Dec 2015 16:02:33 -0600 Subject: Need an option to allow HWP to return an error log to platform code. -Update ReturnCode object to include plat err pointer. -Modify FFDC code to capture error log pointer -Add FAPI_ASSERT_NO_EXIT macro Change-Id: I9d69535416be9d09434766cc15f7db447a72aa60 RTC:13220 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22572 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell Reviewed-by: Brian Silver Reviewed-by: Jennifer A. Stofer Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/23712 Reviewed-by: Sachin Gupta --- import/hwpf/fapi2/include/fapi2_error_scope.H | 15 +++++++- import/hwpf/fapi2/include/ffdc.H | 45 +++++++++++++++-------- import/hwpf/fapi2/include/plat/plat_error_scope.H | 28 +++++++++++++- import/hwpf/fapi2/include/utils.H | 21 ++++++++++- 4 files changed, 89 insertions(+), 20 deletions(-) (limited to 'import') diff --git a/import/hwpf/fapi2/include/fapi2_error_scope.H b/import/hwpf/fapi2/include/fapi2_error_scope.H index c78bb051..af1c4a84 100644 --- a/import/hwpf/fapi2/include/fapi2_error_scope.H +++ b/import/hwpf/fapi2/include/fapi2_error_scope.H @@ -7,7 +7,7 @@ /* */ /* EKB Project */ /* */ -/* COPYRIGHT 2012,2015 */ +/* COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -67,6 +67,17 @@ /// @param[in] \__ffdc__ the FFDC gathering function /// @param[in] ... varargs, as input to FAPI_ERR /// -#define FAPI_ASSERT( __conditional__, __ffdc__, ... ) PLAT_FAPI_ASSERT( __conditional__, __ffdc__, __VA_ARGS__ ) +#define FAPI_ASSERT( __conditional__, __ffdc__, ... ) \ + PLAT_FAPI_ASSERT( __conditional__, __ffdc__, __VA_ARGS__ ) + +/// +/// @brief Create an eror log, commit it, but do not exit the hwp because of +/// the error condition. +/// @param[in] \__conditional__ the condition to assert +/// @param[in] \__ffdc__ the FFDC gathering function +/// @param[in] ... varargs, as input to FAPI_ERR +/// +#define FAPI_ASSERT_NOEXIT( __conditional__, __ffdc__, ... ) \ + PLAT_FAPI_ASSERT_NOEXIT( __conditional__, __ffdc__, __VA_ARGS__ ) #endif diff --git a/import/hwpf/fapi2/include/ffdc.H b/import/hwpf/fapi2/include/ffdc.H index 2134e018..167e6f87 100644 --- a/import/hwpf/fapi2/include/ffdc.H +++ b/import/hwpf/fapi2/include/ffdc.H @@ -7,7 +7,7 @@ /* */ /* EKB Project */ /* */ -/* COPYRIGHT 2011,2015 */ +/* COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -63,12 +63,13 @@ class FirstFailureData /// /// @brief Default constructor. - /// @note We don't create our error info be default. It will be created + /// @note We don't create our error info by default. It will be created /// when its needed in the setHwpError() method. Note that dereferencing - /// the error info without will create a problem. + /// the error info without first calling setHwpError() will create a + // problem. /// FirstFailureData(void): - iv_info( nullptr ) + iv_info( nullptr ), iv_platDataPtr(nullptr) {} /// @@ -115,26 +116,18 @@ class FirstFailureData } /// - /// @brief Get a pointer to any PlatData. FirstFailureData is still - /// responsible for deletion of the data. The caller must not - /// delete - /// - /// This is called by PLAT. The expected use-case is to get a pointer to - /// a platform error log. The data pointer should be used immediately in - /// the same thread. - /// - /// @return void *. Pointer to any PlatData. If NULL then no data + /// @return void *. Pointer to error info data. If NULL then no data /// void* getData(void) const; /// - /// @brief Get a pointer to any PlatData and release ownership from + /// @brief Get a pointer to any error info and release ownership from /// FirstFailureData. The caller is responsible for deletion. /// /// This is called by PLAT. The expected use-case is to retrieve a /// platform error log. /// - /// @return void*. Pointer to any PlatData. If NULL then no data + /// @return void*. Pointer to any Error data. If NULL then no data /// inline void* releaseData(void) { @@ -185,10 +178,30 @@ class FirstFailureData iv_info = nullptr; } + /// + /// @brief Returns the platform data pointer value to the caller. + /// + inline void* getPlatDataPtr() + { + return iv_platDataPtr; + }; + + /// + /// @brief Sets objects platform data pointer to the passed in value. + /// + /// + inline void setPlatDataPtr( void* i_ptr ) + { + iv_platDataPtr = i_ptr; + }; + private: - // Pointer to the data + // Pointer to the error info std::shared_ptr iv_info; + + // free format data, to be used by the platform + void* iv_platDataPtr; }; } diff --git a/import/hwpf/fapi2/include/plat/plat_error_scope.H b/import/hwpf/fapi2/include/plat/plat_error_scope.H index d2b22fbc..90d102cc 100644 --- a/import/hwpf/fapi2/include/plat/plat_error_scope.H +++ b/import/hwpf/fapi2/include/plat/plat_error_scope.H @@ -7,7 +7,7 @@ /* */ /* EKB Project */ /* */ -/* COPYRIGHT 2012,2015 */ +/* COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -55,4 +55,30 @@ } /// @endcond +/// +/// @brief Create an error log based on __conditional__, +/// the FFDC gathering function is called and the +/// trace is output as a FAPI error trace. An error log +/// is created and returned to the caller via the platform +/// log pointer of the fapi2::current_err return code object +/// The caller is responsible for handling the error object. +/// +/// @param[in] __conditional__ the condition to assert +/// @param[in] __ffdc__ the FFDC gathering function +/// @param[in] ... varargs, as input to FAPI_ERR +/// +/// @note: Plat error, if supported, is stored in RC object. Failing +/// the __conditional__ test does not cause a branch to fapi_try_exit +/// +/// +#define PLAT_FAPI_ASSERT_NOEXIT( __conditional__, __ffdc__, ... ) \ + if (! (__conditional__)) \ + { \ + __ffdc__.execute( \ + fapi2::FAPI2_ERRL_SEV_UNDEFINED, false); \ + FAPI_ERR(__VA_ARGS__); \ + } +/// @endcond + + #endif diff --git a/import/hwpf/fapi2/include/utils.H b/import/hwpf/fapi2/include/utils.H index ee15b50d..95a4e5f1 100644 --- a/import/hwpf/fapi2/include/utils.H +++ b/import/hwpf/fapi2/include/utils.H @@ -7,7 +7,7 @@ /* */ /* EKB Project */ /* */ -/* COPYRIGHT 2011,2015 */ +/* COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -49,6 +49,25 @@ void logError( fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, bool i_unitTestError = false ); +/// +/// @brief Create a platform error log +/// +/// This function will create a platform error log from the passed in +/// return code value and will populate the iv_platDataPtr of the return code +/// with a pointer to the newly created log. +/// +/// @param[in,out] io_rc - Reference to ReturnCode +/// +/// @param[in] i_sev Fapi error log severity defaulted to unrecoverable +// +// +/// @note Implemented by platform code +/// +void createPlatLog( + fapi2::ReturnCode& io_rc, + fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE +); + /// /// @brief Delay this thread. Hostboot will use the nanoseconds parameter /// and make a syscall to nanosleep. While in the syscall, the hostboot -- cgit v1.2.1