From 99716699caa95c8cf256f6a873ca37ccd4627174 Mon Sep 17 00:00:00 2001 From: Amit Tendolkar Date: Fri, 9 Jun 2017 07:48:51 -0500 Subject: [PATCH] Callback for dropping Quad Atomic Lock HWP that can be called, either as a callback from an error XML file via the collectFfdc tag or, called directly, to check and clear an atomic lock on the cache chiplet to allow collection of CME FFDC register content (SCOM/RAM) Change-Id: I221bf4b8d36a40c38acd930dfb0827e365b69eca RTC: 172582 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41599 Tested-by: Jenkins Server Reviewed-by: Brian T. Vanderpool Tested-by: Hostboot CI Reviewed-by: Gregory S. Still Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41603 Reviewed-by: Hostboot Team Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- .../p9/procedures/hwp/ffdc/ffdc_includes.H | 1 + .../hwp/ffdc/p9_eq_clear_atomic_lock.C | 39 ++++++++++++------- .../hwp/ffdc/p9_eq_clear_atomic_lock.H | 18 ++++++++- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H b/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H index d5b4480f902..cb0779da72e 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H +++ b/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H @@ -33,4 +33,5 @@ #include #include #include +#include #endif diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.C b/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.C index c809a8ae44e..0dcb49d25ef 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.C +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.C @@ -32,54 +32,67 @@ /// *HWP Level : 2 /// *HWP Consumed by : SBE, HB -#include #include #include #include extern "C" { +#ifndef __PPE__ fapi2::ReturnCode p9_eq_clear_atomic_lock ( const fapi2::ffdc_t& i_eq_target, fapi2::ReturnCode& io_rc ) { FAPI_INF (">> p9_eq_clear_atomic_lock"); -#if 0 fapi2::ReturnCode l_rc; - fapi2::buffer l_value; - // Note: Not using FAPI_TRY in FFDC callback context, as it can - // potentially reset the fapi2::current_err - // Note: No FFDC to be added to io_rc in this particular callback + // Note: No FFDC to be appended to io_rc in this callback + // leaving it here for the callback synxtax fapi2::Target l_eq = *(reinterpret_cast *> (i_eq_target.ptr())); - l_rc = fapi2::getScom (l_eq, EQ_ATOMIC_LOCK_REG, l_value); + // Note: Not using FAPI_TRY in FFDC callback context, as it can + // potentially reset the fapi2::current_err + l_rc = p9_clear_atomic_lock (l_eq); + return l_rc; + } +#endif + + fapi2::ReturnCode + p9_clear_atomic_lock (const fapi2::Target& i_eq ) + { + FAPI_INF (">> p9_clear_atomic_lock"); + fapi2::ReturnCode l_rc; + fapi2::buffer l_value; + + // Note: Not using FAPI_TRY in FFDC callback context, as it can + // potentially reset the fapi2::current_err + + l_rc = fapi2::getScom (i_eq, EQ_ATOMIC_LOCK_REG, l_value); if ( (l_rc == fapi2::FAPI2_RC_SUCCESS) && (l_value.getBit() == 1)) { // Pick the atomic lock if it was already taken - l_rc = fapi2::putScom (l_eq, EQ_ATOMIC_LOCK_REG, l_value); + l_rc = fapi2::putScom (i_eq, EQ_ATOMIC_LOCK_REG, l_value); if (l_rc == fapi2::FAPI2_RC_SUCCESS) { l_value.flush<0>(); // Clear the atomic lock - l_rc = fapi2::putScom (l_eq, EQ_ATOMIC_LOCK_REG, l_value); + l_rc = fapi2::putScom (i_eq, EQ_ATOMIC_LOCK_REG, l_value); } } if (l_rc != fapi2::FAPI2_RC_SUCCESS) { - FAPI_ERR ("Could not clear eq atomic lock for FFDC"); + FAPI_ERR ("Could not clear atomic lock"); } -#endif - FAPI_INF ("<< p9_eq_clear_atomic_lock"); - return fapi2::FAPI2_RC_SUCCESS; // always return success + FAPI_INF ("<< p9_clear_atomic_lock"); + return l_rc; } } diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.H b/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.H index 9ecfd8f1ef8..27af9b565bf 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.H +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_eq_clear_atomic_lock.H @@ -43,19 +43,26 @@ #include #include +#ifndef __PPE__ /// @typedef p9_eq_clear_atomic_lock_FP_t /// function pointer typedef definition for HWP call support typedef fapi2::ReturnCode (*p9_eq_clear_atomic_lock_FP_t) ( const fapi2::ffdc_t&, fapi2::ReturnCode& ); +#endif + +/// typedef p9_clear_atomic_lock_FP_t +/// function pointer typdef definition for HWP call support +typedef fapi2::ReturnCode (*p9_clear_atomic_lock_FP_t) ( + const fapi2::Target& ); //------------------------------------------------------------------------------ // Function prototypes //------------------------------------------------------------------------------ extern "C" { - +#ifndef __PPE__ /// @brief HWP to pick up the atomic lock on a cache chiplet to allow the /// collection of CME FFDC register content (SCOM or RAM) /// @param [in] i_eq_target TARGET_TYPE_EQ @@ -64,7 +71,16 @@ extern "C" fapi2::ReturnCode p9_eq_clear_atomic_lock ( const fapi2::ffdc_t& i_eq_target, fapi2::ReturnCode& io_rc ); +#endif +/// @brief HWP to pick up the atomic lock on a cache chiplet to allow the +/// collection of CME FFDC register content (SCOM or RAM) +/// @param [in] i_eq EQ target on which the atomic lock should be released +/// @return FAPI2_RC_SUCCESS on success, else error code +/// @note Unlike the collectFfdc triggered callback, this is a direct HWP call +/// to support the SBE platform limitations + fapi2::ReturnCode + p9_clear_atomic_lock ( const fapi2::Target& i_eq ); } // extern C #endif // __P9_EQ_CLEAR_ATOMIC_LOCK_H__