diff options
author | crgeddes <crgeddes@us.ibm.com> | 2016-06-17 14:59:41 -0500 |
---|---|---|
committer | Bill Hoffa <wghoffa@us.ibm.com> | 2016-06-30 13:14:03 -0500 |
commit | 9350dc03d0801592f4e988f24474eb9109223829 (patch) | |
tree | 193b17ee80765b662e265d84b5b7602fd59a15ec /src/usr/fapi2 | |
parent | 1ab0fb9ee0d02aba250b7fbfe38ca64ce1a63d3f (diff) | |
download | talos-hostboot-9350dc03d0801592f4e988f24474eb9109223829.tar.gz talos-hostboot-9350dc03d0801592f4e988f24474eb9109223829.zip |
Add getOpMode and setOpMode functions to fapi2 namespace
This commit adds functions to get and set the opMode for the current
thread. Opmode is to have specific reaction to events triggered by
different operations such as scoms or attribute reads. These reactions
include things like ignoring all errors, or specific ones.
RTC:144505
Change-Id: Ieb5e6b9e1cce9ae548c6ac20314751e9b1ebcd05
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26011
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@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 | 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 |
4 files changed, 79 insertions, 0 deletions
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(); ///////////// // |