summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2/test/p9_hwtests.C
diff options
context:
space:
mode:
authorcrgeddes <crgeddes@us.ibm.com>2016-06-17 14:59:41 -0500
committerBill Hoffa <wghoffa@us.ibm.com>2016-06-30 13:14:03 -0500
commit9350dc03d0801592f4e988f24474eb9109223829 (patch)
tree193b17ee80765b662e265d84b5b7602fd59a15ec /src/usr/fapi2/test/p9_hwtests.C
parent1ab0fb9ee0d02aba250b7fbfe38ca64ce1a63d3f (diff)
downloadtalos-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/test/p9_hwtests.C')
-rw-r--r--src/usr/fapi2/test/p9_hwtests.C47
1 files changed, 47 insertions, 0 deletions
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;
+}
+
OpenPOWER on IntegriCloud