diff options
| author | crgeddes <crgeddes@us.ibm.com> | 2016-06-28 13:15:54 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-07-28 10:33:08 -0400 |
| commit | c03003723f00e8d9200b4a03bf55495c48cb0d77 (patch) | |
| tree | 05b0e0b6f4f1ad00a7e3dd401e4e0c8bce0cbc18 /src/usr/fapi2 | |
| parent | 1cf86502a50785bed28c15f47d24f452e83b0892 (diff) | |
| download | blackbird-hostboot-c03003723f00e8d9200b4a03bf55495c48cb0d77.tar.gz blackbird-hostboot-c03003723f00e8d9200b4a03bf55495c48cb0d77.zip | |
Refactor fapi2 scom interface to use pib_err_mask
Up to this point we have been ignoring pib err mask. This commit
adds the pib_err_mask support to to platform
RTC: 144507
Change-Id: Ie810f0915d6ba8091ea4740e705ba550dbad6eae
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26382
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
| -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 |
4 files changed, 169 insertions, 3 deletions
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); + ///////////// // |

