diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/usr/fapi2/hw_access.H | 16 | ||||
| -rw-r--r-- | src/include/usr/fapi2/plat_hw_access.H | 14 | ||||
| -rw-r--r-- | src/include/usr/fapi2/plat_hwp_invoker.H | 1 | ||||
| -rw-r--r-- | src/usr/fapi2/plat_hw_access.C | 19 | ||||
| -rw-r--r-- | src/usr/fapi2/test/fapi2HwAccessTest.H | 12 | ||||
| -rw-r--r-- | src/usr/fapi2/test/p9_hwtests.C | 47 | ||||
| -rw-r--r-- | src/usr/fapi2/test/p9_hwtests.H | 1 |
7 files changed, 102 insertions, 8 deletions
diff --git a/src/include/usr/fapi2/hw_access.H b/src/include/usr/fapi2/hw_access.H index 867379e95..a3bc8c92d 100644 --- a/src/include/usr/fapi2/hw_access.H +++ b/src/include/usr/fapi2/hw_access.H @@ -65,16 +65,18 @@ inline uint8_t getPIBErrorMask(void) // Operational Mode Error Functions //-------------------------------------------------------------------------- +//The operational mode, or opMode is a thread local variable that allows the +//fapi2 interface to call getScom or putScom with special settings. Examples +//of their use cases are disabling the abiility for a scom to wakeup or core +//or ignore hardware errors. The opMode is reset on every FAPI_INVOKE call +//and is therefore reset each HWP. + /// @brief Sets the operational mode /// @param[in] i_mode The new mode // note: this can be moved to a C file if desired inline void setOpMode(const OpModes i_mode) { - // Keeps the compiler from complaining about the unused i_mode - static_cast<void>(i_mode); - //TODO: RTC 124195 FAPI2 - PIB error mask and Operation mode supports - // No-op for now. Should set thread-local operational mode - return; + return platSetOpMode(i_mode); } /// @brief Gets the operational mode @@ -82,9 +84,7 @@ inline void setOpMode(const OpModes i_mode) // note: this can be moved to a C file if desired inline OpModes getOpMode(void) { - //TODO: RTC 124195 FAPI2 - PIB error mask and Operation mode supports - // No-op for now. Should read thread-local operational mode - return NORMAL; + return platGetOpMode(); } //------------------------------------------------------------------------------ diff --git a/src/include/usr/fapi2/plat_hw_access.H b/src/include/usr/fapi2/plat_hw_access.H index f4c669fa8..7d8e36e3b 100644 --- a/src/include/usr/fapi2/plat_hw_access.H +++ b/src/include/usr/fapi2/plat_hw_access.H @@ -178,6 +178,20 @@ ReturnCode platPutRing(const Target<TARGET_TYPE_ALL>& i_target, const RingID i_ringID, const RingMode i_ringMode); +//-------------------------------------------------------------------------- +// Operational Mode Error Functions +//-------------------------------------------------------------------------- + +/// @brief Sets the operational mode +/// @param[in] i_mode The new mode +void platSetOpMode(const OpModes i_mode); + +/// @brief Gets the operational mode +/// @return the operational mode +OpModes platGetOpMode(void); + +extern OpModes opMode; + // -------------------------------------------------------------------------- // 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 200493a51..967ce45fd 100644 --- a/src/include/usr/fapi2/plat_hwp_invoker.H +++ b/src/include/usr/fapi2/plat_hwp_invoker.H @@ -61,6 +61,7 @@ {\ fapi2::ReturnCode l_rc; \ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;\ + fapi2::opMode = fapi2::NORMAL;\ FAPI_EXEC_HWP(l_rc, FUNC, ##_args_); \ ERRHNDL = fapi2::rcToErrl(l_rc);\ if( ERRHNDL ) {\ diff --git a/src/usr/fapi2/plat_hw_access.C b/src/usr/fapi2/plat_hw_access.C index 25aacba25..1f3192011 100644 --- a/src/usr/fapi2/plat_hw_access.C +++ b/src/usr/fapi2/plat_hw_access.C @@ -55,6 +55,9 @@ const uint32_t CFAM_ENGINE_OFFSET = 0xFE00; // Function prototypes uint64_t platGetDDScanMode(const uint32_t i_ringMode); +//TODO RTC:147599 Make this thread_local +OpModes opMode = NORMAL; + //------------------------------------------------------------------------------ // HW Communication Functions to be implemented at the platform layer. //------------------------------------------------------------------------------ @@ -872,6 +875,22 @@ uint64_t platGetDDScanMode(const uint32_t i_ringMode) return l_scanMode; } +//-------------------------------------------------------------------------- +// Operational Mode Error Functions +//-------------------------------------------------------------------------- + +void platSetOpMode(const OpModes i_mode) +{ + opMode = i_mode; + return; +} + +OpModes platGetOpMode(void) +{ + return opMode; +} + + // -------------------------------------------------------------------------- // NOTE: // No spy access interface as HB doesn't allow spy access. diff --git a/src/usr/fapi2/test/fapi2HwAccessTest.H b/src/usr/fapi2/test/fapi2HwAccessTest.H index 55c90d66e..dc1d4ff08 100644 --- a/src/usr/fapi2/test/fapi2HwAccessTest.H +++ b/src/usr/fapi2/test/fapi2HwAccessTest.H @@ -171,6 +171,18 @@ void test_fapi2HwAccess() numFails++; } + + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_opmodetest_getsetopmode); + if(l_errl) + { + TS_FAIL("p9_opmodetest_getsetopmode !!"); + numFails++; + delete l_errl; // delete unexpected error log so we dont get + // a false negative on the next case + } + + #if 0 // TODO-RTC:151428 - need simics support for these to pass numTests++; FAPI_INVOKE_HWP(l_errl, p9_ringtest_modring_fail, fapi2_procTarget); diff --git a/src/usr/fapi2/test/p9_hwtests.C b/src/usr/fapi2/test/p9_hwtests.C index c5e0322db..531bccdef 100644 --- a/src/usr/fapi2/test/p9_hwtests.C +++ b/src/usr/fapi2/test/p9_hwtests.C @@ -28,9 +28,17 @@ /// @brief These procedures test the fapi2 hw_access interfaces. //----------------------------------------------------------------------------- +#include <cxxtest/TestSuite.H> #include <fapi2.H> #include <fapi2_hw_access.H> +#include <errl/errlentry.H> +#include <plat_hwp_invoker.H> +//This function does nothing, it is used to call FAPI_INVOKE on +fapi2::ReturnCode empty_function(void) +{ + return fapi2::current_err; +} fapi2::ReturnCode p9_scomtest_getscom_fail( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) @@ -293,3 +301,42 @@ fapi2::ReturnCode p9_ringtest_modring_pass( return fapi2::current_err; } + +fapi2::ReturnCode p9_opmodetest_getsetopmode() +{ + FAPI_INF("Ensure that getOpMode return NORMAL initially"); + do + { + fapi2::OpModes mode = fapi2::getOpMode(); + if(mode != fapi2::NORMAL) + { + TS_FAIL("p9_opmodetest_getsetopmode>> Expected fapi2::getOpMode to return fapi2::NORMAL (0x0) but instead returned %x", mode); + break; + } + + FAPI_INF("Setting opMode to IGNORE_HW_ERROR (0x1) and checking that we get it back with getOpMode"); + + fapi2::setOpMode(fapi2::IGNORE_HW_ERROR); + mode = fapi2::getOpMode(); + if(mode != fapi2::IGNORE_HW_ERROR) + { + TS_FAIL("p9_opmodetest_getsetopmode>> Expected fapi2::getOpMode to return fapi2::IGNORE_HW_ERROR (0x1) but instead returned %x", mode); + break; + } + + //Call FAPI_INVOKE on an empty function to test if it resets the opMode + errlHndl_t l_errl = NULL; + FAPI_INVOKE_HWP(l_errl,empty_function); + + mode = fapi2::getOpMode(); + if(mode != fapi2::NORMAL) + { + TS_FAIL("p9_opmodetest_getsetopmode>> Expected fapi2::getOpMode to return fapi2::NORMAL (0x0) but instead returned %x , FAPI_INVOKE failed to reset opmode", mode); + break; + } + + }while(0); + + return fapi2::current_err; +} + diff --git a/src/usr/fapi2/test/p9_hwtests.H b/src/usr/fapi2/test/p9_hwtests.H index 40ba3d06b..634c823fe 100644 --- a/src/usr/fapi2/test/p9_hwtests.H +++ b/src/usr/fapi2/test/p9_hwtests.H @@ -72,6 +72,7 @@ fapi2::ReturnCode p9_cfamtest_getcfam_pass( fapi2::ReturnCode p9_cfamtest_putcfam_pass( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); +fapi2::ReturnCode p9_opmodetest_getsetopmode(); ///////////// // |

