summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usr/fapi2/test/fapi2VerifyCalloutTest.C336
-rw-r--r--src/usr/fapi2/test/fapi2VerifyCalloutTest.H90
-rw-r--r--src/usr/fapi2/test/rcSupport.C73
-rw-r--r--src/usr/fapi2/test/rcSupport.H28
4 files changed, 526 insertions, 1 deletions
diff --git a/src/usr/fapi2/test/fapi2VerifyCalloutTest.C b/src/usr/fapi2/test/fapi2VerifyCalloutTest.C
new file mode 100644
index 000000000..ca7238a6d
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2VerifyCalloutTest.C
@@ -0,0 +1,336 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2VerifyCalloutTest.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#include <fapi2.H>
+#include <error_info.H>
+#include <plat_hwp_invoker.H>
+#include <errl/errlreasoncodes.H>
+#include <targeting/common/targetservice.H>
+#include <rcSupport.H>
+
+uint32_t rcTestCalloutDeconfigGard()
+{
+ uint32_t l_result = 0;
+ errlHndl_t l_errl = NULL;
+ bool l_hw_callout_found = false;
+
+ FAPI_INF("rcTestCalloutDeconfigGard running");
+
+ TARGETING::TargetHandleList l_chipList;
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
+ TARGETING::Target * l_Proc = NULL;
+
+ //Grab the first chip if there are multiple
+ if (l_chipList.size() > 0)
+ {
+ l_Proc = l_chipList[0];
+ }
+ else
+ {
+ TS_FAIL("No proc chips found");
+ }
+
+ //Convert to fapi2 target for the HWP below
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(l_Proc);
+
+ FAPI_INVOKE_HWP(l_errl, p9_gardAndDeconfig, fapi2_procTarget);
+
+ if(l_errl != NULL)
+ {
+ FAPI_INF("rcTestCalloutDeconfigGard: p9_gardAndDeconfig "
+ "returned errl (expected)");
+
+ //Get the User Data fields of the errl. They are returned as
+ //vector<void*>, so iterate over them.
+ for( auto l_callout_raw : l_errl->
+ getUDSections( ERRL_COMP_ID, ERRORLOG::ERRL_UDT_CALLOUT ) )
+ {
+ HWAS::callout_ud_t* l_callout_entry =
+ reinterpret_cast<HWAS::callout_ud_t*>(l_callout_raw);
+
+ if(l_callout_entry->type == HWAS::HW_CALLOUT)
+ {
+ l_hw_callout_found = true;
+ FAPI_INF("rcTestCalloutDeconfigGard: found hw callout");
+
+ if(l_callout_entry->gardErrorType == HWAS::GARD_Unrecoverable)
+ {
+ FAPI_INF("rcTestCalloutDeconfigGard: "
+ "Gard Error Type matches");
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutDeconfigGard: "
+ "Gard Error Type does NOT match. Expected: %x Actual: %x",
+ HWAS::GARD_Unrecoverable, l_callout_entry->gardErrorType);
+ l_result = 1;
+ break;
+ }
+
+ if(l_callout_entry->deconfigState == HWAS::DELAYED_DECONFIG)
+ {
+ FAPI_INF("rcTestCalloutDeconfigGard: Target deconfigured");
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutDeconfigGard: "
+ "Target is NOT deconfigured");
+ l_result = 2;
+ break;
+ }
+ }
+ }
+ if(!l_hw_callout_found)
+ {
+ TS_FAIL("rcTestCalloutDeconfigGard: hw callout not found");
+ l_result = 3;
+ }
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutDeconfigGard: No error was returned "
+ "from p9_gardAndDeconfig !!");
+ l_result = 4;
+ }
+
+ delete l_errl;
+ l_errl = NULL;
+
+ FAPI_INF("rcTestCalloutDeconfigGard finished");
+ return l_result;
+}
+
+uint32_t rcTestCalloutProcedure()
+{
+ uint32_t l_result = 0;
+ errlHndl_t l_errl = NULL;
+ bool l_procedure_found = false;
+
+ FAPI_INF("rcTestCalloutProcedure running");
+
+ FAPI_INVOKE_HWP(l_errl, p9_procedureCallout);
+
+ if(l_errl != NULL)
+ {
+ FAPI_INF("rcTestCalloutProcedure: "
+ "p9_procedureCallout returned errl (expected)");
+
+ //Get the User Data fields of the errl. They are returned as
+ //vector<void*>, so iterate over them.
+ for( auto l_callout_raw : l_errl->
+ getUDSections( ERRL_COMP_ID, ERRORLOG::ERRL_UDT_CALLOUT ) )
+ {
+ HWAS::callout_ud_t* l_callout_entry =
+ reinterpret_cast<HWAS::callout_ud_t*>(l_callout_raw);
+ if(l_callout_entry->type == HWAS::PROCEDURE_CALLOUT)
+ {
+ l_procedure_found = true;
+ FAPI_INF("rcTestCalloutProcedure: procedure callout found");
+ if(l_callout_entry->priority == HWAS::SRCI_PRIORITY_HIGH)
+ {
+ FAPI_INF("rcTestCalloutProcedure: "
+ "high priority procedure callout found");
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutProcedure: "
+ "incorrect procedure callout priority. Expected: %x"
+ " Actual: %x",
+ HWAS::SRCI_PRIORITY_HIGH,
+ l_callout_entry->priority);
+ l_result = 1;
+ break;
+ }
+ }
+ }
+ if(!l_procedure_found)
+ {
+ TS_FAIL("rcTestCalloutProcedure: procedure callout NOT found");
+ l_result = 2;
+ }
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutProcedure: No error was returned "
+ "from p9_procedureCallout !!");
+ l_result = 3;
+ }
+
+ delete l_errl;
+ l_errl = NULL;
+
+ FAPI_INF("rcTestCalloutProcedure finished");
+ return l_result;
+}
+
+uint32_t rcTestCalloutHw()
+{
+ uint32_t l_result = 0;
+ errlHndl_t l_errl = NULL;
+ bool l_hw_callout_found = false;
+
+ FAPI_INF("rcTestCalloutHw running");
+
+ TARGETING::TargetHandleList l_coreList;
+ TARGETING::getAllChiplets(l_coreList, TARGETING::TYPE_CORE, false);
+ TARGETING::Target * l_Core = NULL;
+
+ //Get the first core
+ if(l_coreList.size() > 0)
+ {
+ l_Core = l_coreList[0];
+ }
+ else
+ {
+ TS_FAIL("No cores found");
+ }
+
+ //Convert to fapi2 target for HWP
+ fapi2::Target<fapi2::TARGET_TYPE_CORE> fapi2_coreTarget(l_Core);
+
+ FAPI_INVOKE_HWP(l_errl, p9_hwCallout, fapi2_coreTarget);
+
+ if(l_errl != NULL)
+ {
+ FAPI_INF("rcTestCalloutHw: p9_hwCallout returned errl (expected)");
+
+ //Get the User Data fields of the errl. They are returned as
+ //vector<void*>, so iterate over them.
+ for( auto l_callout_raw : l_errl->
+ getUDSections( ERRL_COMP_ID, ERRORLOG::ERRL_UDT_CALLOUT ) )
+ {
+ HWAS::callout_ud_t* l_callout_entry =
+ reinterpret_cast<HWAS::callout_ud_t*>(l_callout_raw);
+ if(l_callout_entry->type == HWAS::HW_CALLOUT)
+ {
+ l_hw_callout_found = true;
+ FAPI_INF("rcTestCalloutHw: hw callout found");
+ if(l_callout_entry->priority == HWAS::SRCI_PRIORITY_LOW)
+ {
+ FAPI_INF("rcTestCalloutHw: low priority hw callout found");
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutHw: incorrect hw callout priority."
+ " Expected: %x Actual: %x",
+ HWAS::SRCI_PRIORITY_LOW, l_callout_entry->priority);
+ l_result = 1;
+ break;
+ }
+ }
+ }
+ if(!l_hw_callout_found)
+ {
+ TS_FAIL("rcTestCalloutHw: hw callout NOT found");
+ l_result = 2;
+ }
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutHw: No error was returned from p9_hwCallout !!");
+ l_result = 3;
+ }
+
+ delete l_errl;
+ l_errl = NULL;
+
+ FAPI_INF("rcTestCalloutHw finished");
+ return l_result;
+}
+
+uint32_t rcTestCalloutDeconfig()
+{
+ uint32_t l_result = 0;
+ errlHndl_t l_errl = NULL;
+ bool l_hw_callout_found = false;
+
+ FAPI_INF("rcTestCalloutDeconfig running");
+
+ TARGETING::TargetHandleList l_dimmList;
+ TARGETING::getAllLogicalCards(l_dimmList, TARGETING::TYPE_DIMM, false);
+ TARGETING::Target * l_Dimm = NULL;
+
+ //Take the first dimm
+ if (l_dimmList.size() > 0)
+ {
+ l_Dimm = l_dimmList[0];
+ }
+ else
+ {
+ TS_FAIL("No dimms found");
+ }
+
+ //Convert to fapi2 target for the HWP below
+ fapi2::Target<fapi2::TARGET_TYPE_DIMM> fapi2_dimmTarget(l_Dimm);
+
+ FAPI_INVOKE_HWP(l_errl, p9_deconfigCallout, fapi2_dimmTarget);
+
+ if(l_errl != NULL)
+ {
+ FAPI_INF("rcTestCalloutDeconfig: p9_deconfigCallout returned errl "
+ "(expected)");
+
+ //Get the User Data fields of the errl. They are returned as
+ //vector<void*>, so iterate over them.
+ for( auto l_callout_raw : l_errl->
+ getUDSections( ERRL_COMP_ID, ERRORLOG::ERRL_UDT_CALLOUT ) )
+ {
+ HWAS::callout_ud_t* l_callout_entry =
+ reinterpret_cast<HWAS::callout_ud_t*>(l_callout_raw);
+
+ if(l_callout_entry->type == HWAS::HW_CALLOUT)
+ {
+ l_hw_callout_found = true;
+ FAPI_INF("rcTestCalloutDeconfig: hw callout found");
+ if(l_callout_entry->deconfigState == HWAS::DELAYED_DECONFIG)
+ {
+ FAPI_INF("rcTestCalloutDeconfig: Target is deconfigured");
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutDeconfig: Target is NOT deconfigured");
+ l_result = 1;
+ break;
+ }
+ }
+ }
+ if(!l_hw_callout_found)
+ {
+ TS_FAIL("rcTestCalloutDeconfig: hw callout NOT found");
+ l_result = 2;
+ }
+ }
+ else
+ {
+ TS_FAIL("rcTestCalloutDeconfig: No error was returned from"
+ " p9_deconfigCallout !!");
+ l_result = 3;
+ }
+
+ delete l_errl;
+ l_errl = NULL;
+
+ FAPI_INF("rcTestCalloutDeconfig finished");
+ return l_result;
+}
diff --git a/src/usr/fapi2/test/fapi2VerifyCalloutTest.H b/src/usr/fapi2/test/fapi2VerifyCalloutTest.H
new file mode 100644
index 000000000..eb52e7350
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2VerifyCalloutTest.H
@@ -0,0 +1,90 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2VerifyCalloutTest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __fapi2VerifyCalloutTest_H
+#define __fapi2VerifyCalloutTest_H
+
+#include <cxxtest/TestSuite.H>
+#include <fapi2.H>
+
+#include "fapi2VerifyCalloutTest.C"
+
+class test_verifyCallout: public CxxTest::TestSuite
+{
+public:
+
+
+ /*
+ * @brief Test hw callout with gard and deconfig
+ */
+ void testCalloutDeconfigGard(void)
+ {
+ uint32_t l_res = rcTestCalloutDeconfigGard();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("rcTestCalloutDeconfigGard. Fail l_res=%d", l_res);
+ }
+ }
+
+ /*
+ * @brief Test procedure callout
+ */
+ void testCalloutProcedure(void)
+ {
+ uint32_t l_res = rcTestCalloutProcedure();
+
+ if(l_res != 0)
+ {
+ TS_FAIL("rcTestCalloutProcedure. Fail l_res=%d", l_res);
+ }
+ }
+
+ /*
+ * @brief Test hw callout
+ */
+ void testCalloutHw(void)
+ {
+ uint32_t l_res = rcTestCalloutHw();
+
+ if(l_res != 0)
+ {
+ TS_FAIL("rcTestCalloutHw. Fail l_res=%d", l_res);
+ }
+ }
+
+ /*
+ * @brief Test hw callout with deconfig
+ */
+ void testCalloutDeconfig(void)
+ {
+ uint32_t l_res = rcTestCalloutDeconfig();
+
+ if(l_res != 0)
+ {
+ TS_FAIL("rcTestCalloutDeconfig. Fail l_res=%d", l_res);
+ }
+ }
+};
+#endif
diff --git a/src/usr/fapi2/test/rcSupport.C b/src/usr/fapi2/test/rcSupport.C
index 784fd0f3f..f0ebed58d 100644
--- a/src/usr/fapi2/test/rcSupport.C
+++ b/src/usr/fapi2/test/rcSupport.C
@@ -94,3 +94,76 @@ fapi2::ReturnCode p9_procedureFfdc_fail()
return l_rc;
}
+
+
+//******************************************************************************
+// p9_gardAndDeconfig
+// Force a test return code that deconfigures the target and gards it
+//******************************************************************************
+fapi2::ReturnCode p9_gardAndDeconfig(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target)
+{
+ FAPI_INF("Enter p9_gardAndDeconfig...");
+
+ FAPI_ASSERT(0, fapi2::TEST_ERROR_GARD_DECONFIG().set_TARGET(i_proc_target));
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_gardAndDeconfig...");
+
+ return fapi2::current_err;
+}
+
+//******************************************************************************
+// p9_deconfig
+// Force a test return code that deconfigures the target
+//******************************************************************************
+fapi2::ReturnCode p9_deconfigCallout(
+ fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_dimm_target)
+{
+ FAPI_INF("Enter p9_deconfigCallout...");
+
+ FAPI_ASSERT(0, fapi2::TEST_ERROR_DECONFIG().set_TARGET(i_dimm_target));
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_deconfigCallout...");
+
+ return fapi2::current_err;
+}
+
+//******************************************************************************
+// p9_procedureCallout
+// Force a test return code that creates a procedure callout
+//******************************************************************************
+fapi2::ReturnCode p9_procedureCallout()
+{
+ FAPI_INF("Enter p9_procedureCallout...");
+
+ FAPI_ASSERT(0, fapi2::TEST_ERROR_PROCEDURE_CALLOUT());
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_procedureCallout...");
+
+ return fapi2::current_err;
+}
+
+//******************************************************************************
+// p9_hwCallout
+// Force a test return code that creates a hw callout
+//******************************************************************************
+fapi2::ReturnCode p9_hwCallout(
+ fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_core_target)
+{
+ FAPI_INF("Enter p9_hwCallout...");
+
+ FAPI_ASSERT(0, fapi2::TEST_ERROR_HW_CALLOUT().set_TARGET(i_core_target));
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_hwCallout...");
+
+ return fapi2::current_err;
+}
+
diff --git a/src/usr/fapi2/test/rcSupport.H b/src/usr/fapi2/test/rcSupport.H
index 2cf276669..74867623c 100644
--- a/src/usr/fapi2/test/rcSupport.H
+++ b/src/usr/fapi2/test/rcSupport.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -54,5 +54,31 @@ fapi2::ReturnCode p9_registerFfdc_fail(
//******************************************************************************
fapi2::ReturnCode p9_procedureFfdc_fail(void);
+//******************************************************************************
+// p9_gardAndDeconfig
+// Force a test return code that deconfigures the target and gards it
+//******************************************************************************
+fapi2::ReturnCode p9_gardAndDeconfig(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target);
+
+//******************************************************************************
+// p9_deconfigCallout
+// Force a test return code that deconfigures the target
+//******************************************************************************
+fapi2::ReturnCode p9_deconfigCallout(
+ fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_dimm_target);
+
+//******************************************************************************
+// p9_procedureCallout
+// Force a test return code that creates a procedure callout
+//******************************************************************************
+fapi2::ReturnCode p9_procedureCallout();
+
+//******************************************************************************
+// p9_hwCallout
+// Force a test return code that creates a hw callout
+//******************************************************************************
+fapi2::ReturnCode p9_hwCallout(
+ fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_core_target);
#endif
OpenPOWER on IntegriCloud