diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/errl/errlentry.H | 13 | ||||
-rw-r--r-- | src/include/usr/errl/errlsctn.H | 52 | ||||
-rw-r--r-- | src/include/usr/fapi2/hw_access.H | 16 | ||||
-rw-r--r-- | src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H | 2 | ||||
-rw-r--r-- | src/include/usr/fapi2/plat_hw_access.H | 23 | ||||
-rw-r--r-- | src/include/usr/fapi2/plat_hwp_invoker.H | 2 | ||||
-rw-r--r-- | src/include/usr/scom/errlud_pib.H | 2 | ||||
-rw-r--r-- | src/usr/errl/errlentry.C | 17 | ||||
-rw-r--r-- | src/usr/fapi2/plat_hw_access.C | 68 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2HwAccessTest.H | 17 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_hwtests.C | 82 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_hwtests.H | 5 | ||||
-rw-r--r-- | src/usr/scom/errlud_pib.C | 2 | ||||
-rw-r--r-- | src/usr/scom/scom.C | 2 | ||||
-rw-r--r-- | src/usr/xscom/piberror.C | 3 |
15 files changed, 293 insertions, 13 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 891300b23..f8e0a32e8 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -582,6 +582,17 @@ public: */ uint64_t unflatten( const void * i_buffer, uint64_t i_len); + /** + * @brief Return the list of User Detail sections + * + * @param[in] i_compId Component id associated with the sections to return + * + * NOTE: You can pass COMP_ID 0 into this function for wildcard + * + * @return vector of user details sections of specific component id + */ + std::vector<ErrlUD*> getUDSections(compId_t i_compId); + private: /** diff --git a/src/include/usr/errl/errlsctn.H b/src/include/usr/errl/errlsctn.H index 19cc1b7a6..bb532e6b8 100644 --- a/src/include/usr/errl/errlsctn.H +++ b/src/include/usr/errl/errlsctn.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -62,6 +62,31 @@ class ErrlSctn friend class ERRORLOGDISPLAY::ErrLogDisplay; friend class ErrlTest; +public: + /** + * @brief Get section's version + * + * @return Section version (uint8_t) + * + */ + uint8_t sctnVer() const; + + /** + * @brief Get section's subsection type + * + * @return Subsection type (uint8_t) + * + */ + uint8_t subSect() const; + + /** + * @brief Get section's component Id + * + * @return Component Id of the section creator + * + */ + compId_t compId() const; + protected: /** @@ -105,6 +130,31 @@ protected: }; +//----------------------------------------------------------------------- +// In-line functions +//----------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +inline uint8_t ErrlSctn::sctnVer() const +{ + return iv_header.iv_ver; +} + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +inline uint8_t ErrlSctn::subSect() const +{ + return iv_header.iv_sst; +} + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +inline compId_t ErrlSctn::compId() const +{ + return iv_header.iv_compId; +} + } // End namespace diff --git a/src/include/usr/fapi2/hw_access.H b/src/include/usr/fapi2/hw_access.H index 93413dd7b..2d4444eb3 100644 --- a/src/include/usr/fapi2/hw_access.H +++ b/src/include/usr/fapi2/hw_access.H @@ -39,17 +39,20 @@ namespace fapi2 //-------------------------------------------------------------------------- // PIB Error Functions +// +// The pib err mask can be set in order +// to ignore specific pib errors returned by a scom. The mask +// is a thread local variable and will be reset to 0 during every +// FAPI_INVOKE call before the function is executed, therefore +// it will reset on HWP calls. //-------------------------------------------------------------------------- /// @brief Sets the PIB error mask - platform dependant /// @param[in] i_mask The new error mask // note: this can be moved to a C file if desired -inline void setPIBErrorMask(uint8_t i_mask) +inline void setPIBErrorMask(const uint8_t i_mask) { - // Keeps the compiler from complaining about the unused i_mask - static_cast<void>(i_mask); - //TODO: RTC 124195 FAPI2 - PIB error mask and Operation mode supports - return; + return platSetPIBErrorMask(i_mask); } /// @brief Gets the PIB error mask - platform dependant @@ -57,8 +60,7 @@ inline void setPIBErrorMask(uint8_t i_mask) // note: this can be moved to a C file if desired inline uint8_t getPIBErrorMask(void) { - //TODO: RTC 124195 FAPI2 - PIB error mask and Operation mode supports - return 0; + return platGetPIBErrorMask(); } //-------------------------------------------------------------------------- diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H index a6ffce5ba..e095e126b 100644 --- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H +++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H @@ -55,6 +55,7 @@ namespace fapi2 MOD_FAPI2_GET_TARGETING_ATTR = 0x0C, MOD_FAPI2_SET_TARGETING_ATTR = 0x0D, MOD_FAPI2_PLAT_GET_VPD = 0x0E, + MOD_FAPI2_PIB_ERR_MASK = 0x0F, }; /** @@ -71,6 +72,7 @@ namespace fapi2 RC_NULL_FAPI_TARGET = HWPF_COMP_ID | 0x0A, RC_LOOKING_FOR_TYPE_NA = HWPF_COMP_ID | 0x0B, RC_INCORRECT_TARGET = HWPF_COMP_ID | 0x0C, + RC_FAILED_MASKING_ERROR = HWPF_COMP_ID | 0x12, // MVPD generated errors RC_INVALID_RECORD = HWPF_COMP_ID | 0x0D, diff --git a/src/include/usr/fapi2/plat_hw_access.H b/src/include/usr/fapi2/plat_hw_access.H index 7d8e36e3b..5a8d20fea 100644 --- a/src/include/usr/fapi2/plat_hw_access.H +++ b/src/include/usr/fapi2/plat_hw_access.H @@ -192,6 +192,29 @@ OpModes platGetOpMode(void); extern OpModes opMode; +//-------------------------------------------------------------------------- +// PIB Error Mask Functions +//-------------------------------------------------------------------------- +// +// See hw_access.H for more detail on pib error mask + +/// @brief Sets the pib error mask +/// @param[in] i_mask The new mask +void platSetPIBErrorMask(const uint8_t i_mask); + +/// @brief Gets the pib error mask +/// @return the pib error mask +uint8_t platGetPIBErrorMask(void); + +/// @brief takes in an error log and looks for user details sections +/// with a compId of COMP_SCOM_ID. If one of those is found and +/// the pib err attatched to it matches the pib_err_mask, then +/// we delete the err. +/// @param[in/out] io_errLog Error log that we would like the check the piberr +/// mask against +/// @return void +void checkPibMask(errlHndl_t& io_errLog ); + // -------------------------------------------------------------------------- // NOTE: // No spy access interface as HB doesn't allow spy access. diff --git a/src/include/usr/fapi2/plat_hwp_invoker.H b/src/include/usr/fapi2/plat_hwp_invoker.H index 92d8d7990..37fc49d16 100644 --- a/src/include/usr/fapi2/plat_hwp_invoker.H +++ b/src/include/usr/fapi2/plat_hwp_invoker.H @@ -44,6 +44,7 @@ #include <return_code.H> #include <hw_access_def.H> #include <plat_utils.H> +#include <xscom/piberror.H> /** * @brief HWP Invoker macro @@ -63,6 +64,7 @@ fapi2::ReturnCode l_rc; \ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;\ fapi2::opMode = fapi2::NORMAL;\ + fapi2::setPIBErrorMask(0);\ FAPI_EXEC_HWP(l_rc, FUNC, ##_args_); \ ERRHNDL = fapi2::rcToErrl(l_rc);\ if( ERRHNDL ) {\ diff --git a/src/include/usr/scom/errlud_pib.H b/src/include/usr/scom/errlud_pib.H index 1f18fe76f..d56cd2fbf 100644 --- a/src/include/usr/scom/errlud_pib.H +++ b/src/include/usr/scom/errlud_pib.H @@ -56,6 +56,8 @@ class UdPibInfo : public ERRORLOG::ErrlUserDetails */ virtual ~UdPibInfo(); + uint8_t iv_pib_err; + UdPibInfo(UdPibInfo &) = delete; UdPibInfo & operator=(UdPibInfo &) = delete; }; diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index b010cc438..2cc64faf1 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -1657,5 +1657,22 @@ uint64_t ErrlEntry::unflatten( const void * i_buffer, uint64_t i_len ) return rc; } +//@brief Return the list of User Detail sections +//NOTE: You can pass COMP_ID 0 into this function for wildcard +std::vector<ErrlUD*> ErrlEntry::getUDSections(compId_t i_compId) +{ + std::vector<ErrlUD*> copy_vector; + + for(auto const & section : iv_SectionVector) + { + if((section->compId() == i_compId) || (i_compId == 0)) + { + copy_vector.push_back(section); + } + } + + return copy_vector; +} + } // End namespace diff --git a/src/usr/fapi2/plat_hw_access.C b/src/usr/fapi2/plat_hw_access.C index d9a7c0f0e..d59d07446 100644 --- a/src/usr/fapi2/plat_hw_access.C +++ b/src/usr/fapi2/plat_hw_access.C @@ -37,7 +37,9 @@ #include <hw_access_def.H> #include <plat_utils.H> #include <hwpf_fapi2_reasoncodes.H> +#include <scom/scomreasoncodes.H> #include <fapi2/plat_hw_access.H> +#include <scom/errlud_pib.H> #include <scan/scanif.H> #include <hw_access_def.H> @@ -58,6 +60,9 @@ uint64_t platGetDDScanMode(const uint32_t i_ringMode); //TODO RTC:147599 Make this thread_local OpModes opMode = NORMAL; +//TODO RTC:147599 Make pib_err_mask thread local +uint8_t pib_err_mask = 0x00; + //------------------------------------------------------------------------------ // HW Communication Functions to be implemented at the platform layer. //------------------------------------------------------------------------------ @@ -90,11 +95,17 @@ ReturnCode platGetScom(const Target<TARGET_TYPE_ALL>& i_target, l_size, DEVICE_SCOM_ADDRESS(i_address, opMode)); - //Todo RTC: 156704 Possible room for improvement detecting opMode - // err skips at lower level + //If an error occured durring the device read and a pib_err_mask is set, + // then we will check if the err matches the mask, if it does we + // ignore the error + if(l_err && (pib_err_mask != 0x00)) + { + checkPibMask(l_err); + } + if (l_err) { - if(opMode & static_cast<uint8_t>(fapi2::IGNORE_HW_ERROR)) + if(opMode & fapi2::IGNORE_HW_ERROR) { delete l_err; l_err = nullptr; @@ -149,6 +160,15 @@ ReturnCode platPutScom(const Target<TARGET_TYPE_ALL>& i_target, &l_data, l_size, DEVICE_SCOM_ADDRESS(i_address, opMode)); + + //If an error occured durring the device write and a pib_err_mask is set, + // then we will check if the err matches the mask, if it does we + // ignore the error + if(l_err && (pib_err_mask != 0x00)) + { + checkPibMask(l_err); + } + if (l_err) { if(opMode & fapi2::IGNORE_HW_ERROR) @@ -252,6 +272,11 @@ ReturnCode platPutScomUnderMask(const Target<TARGET_TYPE_ALL>& i_target, } while (0); + if(l_err && (pib_err_mask != 0x00)) + { + checkPibMask(l_err); + } + if (l_rc != fapi2::FAPI2_RC_SUCCESS) { FAPI_ERR("platPutScomUnderMask failed - Target %s, Addr %.16llX", @@ -310,6 +335,27 @@ errlHndl_t verifyCfamAccessTarget(const TARGETING::Target* i_target, return l_err; } +/// @brief takes in an error log and looks for user details sections +/// with a compId of SCOM_COMP_ID. If one of those is found and +/// the pib err attatched to it matches the pib_err_mask, then +/// we delete the err. +void checkPibMask(errlHndl_t& io_errLog ) +{ + //Delete the error if the mask matches the pib err + for(auto section : io_errLog->getUDSections(SCOM_COMP_ID)) + { + if((section->subSect() == SCOM::SCOM_UDT_PIB) && + (reinterpret_cast<SCOM::UdPibInfo *>(section)->iv_pib_err == pib_err_mask)) + { + FAPI_ERR( "Ignoring error %.8X due to pib_err_mask=%.1X", io_errLog->plid(), pib_err_mask ); + delete io_errLog; + io_errLog = NULL; + break; + } + } + return; +} + /// @brief Internal function that gets the chip target for cfam access errlHndl_t getCfamChipTarget(const TARGETING::Target* i_target, TARGETING::Target*& o_chipTarget) @@ -925,6 +971,22 @@ OpModes platGetOpMode(void) return opMode; } +//-------------------------------------------------------------------------- +// PIB Error Mask Functions +//-------------------------------------------------------------------------- + +void platSetPIBErrorMask(const uint8_t i_mask) +{ + assert(i_mask <= 7, "PIB Err Mask must be between 0 and 7"); + pib_err_mask = i_mask; + return; +} + +uint8_t platGetPIBErrorMask(void) +{ + return pib_err_mask; +} + // -------------------------------------------------------------------------- // NOTE: diff --git a/src/usr/fapi2/test/fapi2HwAccessTest.H b/src/usr/fapi2/test/fapi2HwAccessTest.H index 8fc3e7499..0773ced18 100644 --- a/src/usr/fapi2/test/fapi2HwAccessTest.H +++ b/src/usr/fapi2/test/fapi2HwAccessTest.H @@ -199,6 +199,23 @@ void test_fapi2HwAccess() } } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_piberrmask_getsettest); + if(l_errl) + { + TS_FAIL("p9_piberrmask_getsettest returned an error!"); + numFails++; + errlCommit(l_errl,FAPI2_COMP_ID); + } + + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_piberrmask_masktest, fapi2_procTarget); + if(l_errl) + { + TS_FAIL("p9_piberrmask_masktest returned an error!"); + numFails++; + errlCommit(l_errl,FAPI2_COMP_ID); + } #if 0 // TODO-RTC:151428 - need simics support for these to pass numTests++; diff --git a/src/usr/fapi2/test/p9_hwtests.C b/src/usr/fapi2/test/p9_hwtests.C index 7222667c6..e157092ea 100644 --- a/src/usr/fapi2/test/p9_hwtests.C +++ b/src/usr/fapi2/test/p9_hwtests.C @@ -32,6 +32,7 @@ #include <fapi2.H> #include <fapi2_hw_access.H> #include <errl/errlentry.H> +#include <xscom/piberror.H> #include <plat_hwp_invoker.H> //This function does nothing, it is used to call FAPI_INVOKE on @@ -336,6 +337,48 @@ fapi2::ReturnCode p9_opmodetest_getsetopmode() } }while(0); + return fapi2::current_err; +} + +fapi2::ReturnCode p9_piberrmask_getsettest() +{ + FAPI_INF("Entering p9_piberrmask_getsettest..."); + + FAPI_INF("Ensure that getPIBErrorMask return 0 initially"); + + uint8_t mask = fapi2::getPIBErrorMask(); + do + { + if(mask != 0) + { + TS_FAIL("p9_piberrmask_getsettest>> Expected fapi2::getPIBErrorMask to return (0x0) but instead returned 0x%x", mask); + break; + } + + FAPI_INF("Setting pib_err_mask to PIB_CHIPLET_OFFLINE (0x2) and checking that we get it back with getPIBErrorMask"); + + fapi2::setPIBErrorMask((uint8_t)PIB::PIB_CHIPLET_OFFLINE); + mask = fapi2::getPIBErrorMask(); + if(mask != PIB::PIB_CHIPLET_OFFLINE) + { + TS_FAIL("p9_piberrmask_getsettest>> Expected fapi2::getPIBErrorMask to return 0x2 but instead returned 0x%x", mask); + break; + } + + //Call FAPI_INVOKE on an empty function to test if + //it resets the pib err mask + errlHndl_t l_errl = NULL; + FAPI_INVOKE_HWP(l_errl,empty_function); + + mask = fapi2::getPIBErrorMask(); + if(mask != 0) + { + TS_FAIL("p9_piberrmask_getsettest>> Expected fapi2::getPIBErrorMask to return PIB_NO_ERROR (0x0) but instead returned %x , FAPI_INVOKE failed to reset pib_err_mask", mask); + break; + } + + FAPI_INF("Exiting p9_piberrmask_getsettest..."); + }while(0); return fapi2::current_err; } @@ -398,3 +441,42 @@ fapi_try_exit: return fapi2::current_err; } +fapi2::ReturnCode p9_piberrmask_masktest( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + + FAPI_INF("Entering p9_piberrmask_masktest..."); + + uint8_t completionCheck = 0; + + //Ideally we would like this test case to test errors 1-7 but + // I am not sure if we can simulate some of the errors + + fapi2::buffer<uint64_t> l_scomdata = 0xFF00FF00; + + //Set the mask to ignore invalid address errors () + fapi2::setPIBErrorMask(static_cast<uint8_t>(PIB::PIB_INVALID_ADDRESS)); + + //Attempt writing to a bad address + FAPI_TRY(fapi2::putScom(i_target, + 0xDEADBEEF, + l_scomdata)); + + //try another scom, this time a get to make sure that + // FAPI_TRY does not reset the mask + FAPI_TRY(fapi2::getScom(i_target, + 0xDEADBEEF, + l_scomdata)); + + completionCheck = 1; + + + fapi_try_exit: + + if(completionCheck != 1) + { + FAPI_ERR("Pib Err Mask is not removing errors and is causing FAPI_TRY to fail"); + } + FAPI_INF("Exiting p9_piberrmask_masktest..."); + return fapi2::current_err; +} diff --git a/src/usr/fapi2/test/p9_hwtests.H b/src/usr/fapi2/test/p9_hwtests.H index 6f184d9bc..06727b9d2 100644 --- a/src/usr/fapi2/test/p9_hwtests.H +++ b/src/usr/fapi2/test/p9_hwtests.H @@ -77,6 +77,11 @@ fapi2::ReturnCode p9_opmodetest_getsetopmode(); fapi2::ReturnCode p9_opmodetest_ignorehwerr( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, uint8_t fail); +fapi2::ReturnCode p9_piberrmask_getsettest(); + +fapi2::ReturnCode p9_piberrmask_masktest( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + ///////////// // diff --git a/src/usr/scom/errlud_pib.C b/src/usr/scom/errlud_pib.C index 000b59a21..8a8892811 100644 --- a/src/usr/scom/errlud_pib.C +++ b/src/usr/scom/errlud_pib.C @@ -45,7 +45,7 @@ UdPibInfo::UdPibInfo( uint8_t i_pibErr ) iv_Version = 1; iv_SubSection = SCOM_UDT_PIB; - + iv_pib_err = i_pibErr; //***** Memory Layout ***** // 1 byte : PIB auto l_pBuf = reallocUsrBuf(sizeof(uint8_t)); diff --git a/src/usr/scom/scom.C b/src/usr/scom/scom.C index 5aa88976b..81e272d9e 100644 --- a/src/usr/scom/scom.C +++ b/src/usr/scom/scom.C @@ -38,6 +38,7 @@ #include <errl/errlmanager.H> #include "scom.H" #include <scom/scomreasoncodes.H> +#include <scom/errlud_pib.H> #include <ibscom/ibscomreasoncodes.H> #include <sys/time.h> #include <xscom/piberror.H> @@ -405,6 +406,7 @@ errlHndl_t doForm0IndirectScom(DeviceFW::OperationType i_opType, // to blame hardware if( scomout.piberr == PIB::PIB_RESOURCE_OCCUPIED ) { + SCOM::UdPibInfo(scomout.piberr).addToLog(l_err); l_err->addHwCallout( i_target, HWAS::SRCI_PRIORITY_HIGH, HWAS::NO_DECONFIG, diff --git a/src/usr/xscom/piberror.C b/src/usr/xscom/piberror.C index eaa26092a..221c950d9 100644 --- a/src/usr/xscom/piberror.C +++ b/src/usr/xscom/piberror.C @@ -35,6 +35,7 @@ #include <errl/errlmanager.H> #include <hwas/common/hwasCallout.H> #include <targeting/common/targetservice.H> +#include <scom/errlud_pib.H> namespace PIB { @@ -48,6 +49,8 @@ void addFruCallouts(TARGETING::Target* i_target, uint64_t i_scomAddr, errlHndl_t& io_errl) { + // add user details section to error log that describes the pib err + SCOM::UdPibInfo(i_pibErrStatus).addToLog(io_errl); switch (i_pibErrStatus) { |