diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2016-02-03 15:39:30 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-02-26 16:23:15 -0600 |
commit | 65bc26d54dcffb32bd1959f1447b8dba79627e0f (patch) | |
tree | 476dc4ea74b8342aa62bc7625185af2d190aa9df | |
parent | da0248159af1297255bd018180b1f8b3e220503c (diff) | |
download | talos-hostboot-65bc26d54dcffb32bd1959f1447b8dba79627e0f.tar.gz talos-hostboot-65bc26d54dcffb32bd1959f1447b8dba79627e0f.zip |
Need an option to allow a HWP to return an error log to platform code.
-Modify FFDC code to capture error log pointer in RC plat pointer
Change-Id: I02266468795ea345610f237b50b14d79cbaef202
RTC:132220
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/23663
Tested-by: Jenkins Server
Reviewed-by: Christian Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/include/usr/fapi2/plat_error_scope.H | 26 | ||||
-rw-r--r-- | src/include/usr/fapi2/plat_hw_access.H | 59 | ||||
-rw-r--r-- | src/usr/fapi2/plat_utils.C | 45 |
3 files changed, 76 insertions, 54 deletions
diff --git a/src/include/usr/fapi2/plat_error_scope.H b/src/include/usr/fapi2/plat_error_scope.H index 1b47aa40d..fea65c98a 100644 --- a/src/include/usr/fapi2/plat_error_scope.H +++ b/src/include/usr/fapi2/plat_error_scope.H @@ -47,11 +47,14 @@ /// /// @brief Assert a conditional is true. /// If it is not, the FFDC gathering function is called and the -/// trace is output as a FAPI error trace. +/// trace is output as a FAPI error trace. A platform error is +/// created and commited. /// @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 is stored in RC object +/// #define PLAT_FAPI_ASSERT( __conditional__, __ffdc__, ... ) \ if (! (__conditional__)) \ { \ @@ -60,6 +63,27 @@ goto fapi_try_exit; \ } +/// +/// @brief Assert a conditional is true. +/// If it is not, the FFDC gathering function is called and the +/// trace is output as a FAPI error trace. A platform error is +/// created but will not be committed. +/// @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. In +/// addition, this assert does not cause a branch to the +/// fapi_try_exit lable. +/// +#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/src/include/usr/fapi2/plat_hw_access.H b/src/include/usr/fapi2/plat_hw_access.H index febfb5c3e..8ed41a326 100644 --- a/src/include/usr/fapi2/plat_hw_access.H +++ b/src/include/usr/fapi2/plat_hw_access.H @@ -92,9 +92,8 @@ inline ReturnCode platGetScom(const Target<K>& i_target, FAPI_ERR("platGetScom: deviceRead returns error!"); FAPI_ERR("fapiGetScom failed - Target %s, Addr %.16llX", tmpScomStr, i_address); -// Add the error log pointer as data to the ReturnCode -//@TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + // Add the error log pointer as data to the ReturnCode + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); } if (l_traceit) @@ -148,9 +147,8 @@ inline ReturnCode platPutScom(const Target<K>& i_target, FAPI_ERR("platPutScom: deviceRead returns error!"); FAPI_ERR("platPutScom failed - Target %s, Addr %.16llX", tmpScomStr, i_address); -// Add the error log pointer as data to the ReturnCode -//@TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + // Add the error log pointer as data to the ReturnCode + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); } if (l_traceit) @@ -205,9 +203,8 @@ inline ReturnCode platPutScomUnderMask(const Target<K>& i_target, if (l_err) { FAPI_ERR("platPutScomUnderMask: deviceRead returns error!"); -// Add the error log pointer as data to the ReturnCode -//@TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + // Add the error log pointer as data to the ReturnCode + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -229,9 +226,8 @@ inline ReturnCode platPutScomUnderMask(const Target<K>& i_target, if (l_err) { FAPI_ERR("platPutScomUnderMask: deviceWrite returns error!"); -// Add the error log pointer as data to the ReturnCode -//@TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + // Add the error log pointer as data to the ReturnCode + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -279,12 +275,10 @@ inline ReturnCode platModifyScom(const Target<K>& i_target, FAPI_DBG(ENTER_MRK "platModifyScom"); ReturnCode l_rc; - + errlHndl_t l_err = NULL; FAPI_ERR("platModifyScom: Error: Hostboot not yet support modifyScom function!"); -// Add the error log pointer as data to the ReturnCode -//@TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + // Add the error log pointer as data and set the ReturnCode as needed FAPI_DBG(EXIT_MRK "platModifyScom"); return l_rc; @@ -400,8 +394,7 @@ inline ReturnCode platGetCfamRegister(const Target<K>& i_target, { FAPI_ERR("platGetCfamRegister: verifyCfamAccessTarget returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127 Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -418,8 +411,7 @@ inline ReturnCode platGetCfamRegister(const Target<K>& i_target, FAPI_ERR("fapiGetCfamRegister failed - Target %s, Addr %.8X", tmpScomStr, i_address); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -437,8 +429,7 @@ inline ReturnCode platGetCfamRegister(const Target<K>& i_target, { FAPI_ERR("platGetCfamRegister: deviceRead returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -493,8 +484,7 @@ inline ReturnCode platPutCfamRegister(const Target<K>& i_target, { FAPI_ERR("platPutCfamRegister: verifyCfamAccessTarget returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -509,8 +499,7 @@ inline ReturnCode platPutCfamRegister(const Target<K>& i_target, { FAPI_ERR("platPutCfamRegister: getCfamChipTarget returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -529,8 +518,7 @@ inline ReturnCode platPutCfamRegister(const Target<K>& i_target, { FAPI_ERR("platPutCfamRegister: deviceWrite returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -625,8 +613,7 @@ inline ReturnCode platModifyCfamRegister(const Target<K>& i_target, { FAPI_ERR("platModifyCfamRegister: verifyCfamAccessTarget returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -641,8 +628,7 @@ inline ReturnCode platModifyCfamRegister(const Target<K>& i_target, { FAPI_ERR("platModifyCfamRegister: getCfamChipTarget returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -661,8 +647,7 @@ inline ReturnCode platModifyCfamRegister(const Target<K>& i_target, { FAPI_ERR("platModifyCfamRegister: deviceRead returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -678,8 +663,7 @@ inline ReturnCode platModifyCfamRegister(const Target<K>& i_target, { FAPI_ERR("platModifyCfamRegister: deviceWrite returns error!"); // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); break; } @@ -764,8 +748,7 @@ inline ReturnCode platGetRing(const Target<K>& i_target, if (l_err) { // Add the error log pointer as data to the ReturnCode - //TODO RTC:143127: Need fapi2 support in ReturnCode class - //l_rc.setPlatError(reinterpret_cast<void *> (l_err)); + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_err)); } FAPI_DBG(EXIT_MRK "platGetRing"); diff --git a/src/usr/fapi2/plat_utils.C b/src/usr/fapi2/plat_utils.C index aa146e45b..6a3fd749d 100644 --- a/src/usr/fapi2/plat_utils.C +++ b/src/usr/fapi2/plat_utils.C @@ -816,10 +816,9 @@ errlHndl_t rcToErrl(ReturnCode & io_rc, ReturnCode::returnCodeCreator l_creator = io_rc.getCreator(); if (l_creator == ReturnCode::CREATOR_PLAT) { - // PLAT error. Release the errlHndl_t + // PLAT error, get the platform data from the return code FAPI_ERR("rcToErrl: PLAT error: 0x%08x", l_rcValue); - //@TODO RTC:143127 - //l_pError = reinterpret_cast<errlHndl_t> (io_rc.releaseData()); + l_pError = reinterpret_cast<errlHndl_t>(io_rc.getPlatDataPtr()); } else if (l_creator == ReturnCode::CREATOR_HWP) { @@ -836,7 +835,7 @@ errlHndl_t rcToErrl(ReturnCode & io_rc, * @custdesc Error initializing processor/memory subsystem * during boot. See FRU list for repair actions */ - l_pError = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + l_pError = new ERRORLOG::ErrlEntry(i_sev, MOD_FAPI2_RC_TO_ERRL, RC_HWP_GENERATED_ERROR, l_rcValue); @@ -901,20 +900,17 @@ errlHndl_t rcToErrl(ReturnCode & io_rc, return l_pError; } -/// -/// @brief Log an error. -/// -void logError( - fapi2::ReturnCode & io_rc, - fapi2::errlSeverity_t i_sev, - bool i_unitTestError ) +// Convert the RC passed in to a platform error log and +// assign it to the platform data pointer of the RC +void createPlatLog( + fapi2::ReturnCode & io_rc, + fapi2::errlSeverity_t i_sev + ) { - FAPI_DBG("Entering logError"); - // ENUM CONVERSION FAPI to PLATFORM - errlHndl_t l_pError = NULL; + FAPI_DBG("Entering createLog"); - FAPI_INF("logError"); + errlHndl_t l_pError = NULL; // Convert a FAPI severity to a ERRORLOG severity ERRORLOG::errlSeverity_t l_sev = ERRORLOG::ERRL_SEV_UNRECOVERABLE; @@ -939,6 +935,25 @@ void logError( // PLAT Data, HWP FFDC data, and Error Target associated with it. l_pError = rcToErrl(io_rc, l_sev); + io_rc.setPlatDataPtr(reinterpret_cast<void *>(l_pError)); + +} + +/// +/// @brief Log an error - Create a platform error from the passed +// RC passed in and commit it. +/// +void logError( + fapi2::ReturnCode & io_rc, + fapi2::errlSeverity_t i_sev, + bool i_unitTestError ) +{ + FAPI_DBG("Entering logError" ); + + createPlatLog( io_rc, i_sev ); + + errlHndl_t l_pError = reinterpret_cast<errlHndl_t>(io_rc.getPlatDataPtr()); + // Commit the error log. This will delete the error log and set the handle // to NULL. if (i_unitTestError) |