summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2/test
diff options
context:
space:
mode:
authorBrian Stegmiller <bjs@us.ibm.com>2017-08-24 13:51:25 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-09-05 16:58:45 -0400
commit9f091d4af169e02205b9d934ebdb1f39ee818f06 (patch)
tree6be9287e2233a9f28647d47009e025b5061041e5 /src/usr/fapi2/test
parentc749a8867ef8cc29551ce2d316aa12553b5ac3a5 (diff)
downloadtalos-hostboot-9f091d4af169e02205b9d934ebdb1f39ee818f06.tar.gz
talos-hostboot-9f091d4af169e02205b9d934ebdb1f39ee818f06.zip
HWP Fail Isolation Fapi Hooks
Change-Id: I5ce1002e9a07382e209b23574fdf8905bdbebf2c RTC: 178331 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45130 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2/test')
-rw-r--r--src/usr/fapi2/test/fapi2VerifyPrdAttrTest.C119
-rw-r--r--src/usr/fapi2/test/fapi2VerifyPrdAttrTest.H59
2 files changed, 178 insertions, 0 deletions
diff --git a/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.C b/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.C
new file mode 100644
index 000000000..1a0ccac50
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.C
@@ -0,0 +1,119 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2VerifyPrdAttrTest.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>
+#include <attributeenums.H>
+#include "fapi2TestUtils.H"
+#include <utils.H>
+
+// NOTE: This testcase does run successfully
+// when enabling fapi test library.
+//
+// However, log_related_error(..) has to have
+// a prototype defined for this to compile..
+// That will eventually be true when
+// the EKB changes show up in utils.H
+#if 1
+namespace fapi2
+{
+void log_related_error(
+ const Target<TARGET_TYPE_ALL>& i_target,
+ fapi2::ReturnCode& io_rc,
+ const fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,
+ const bool i_unitTestError = false );
+}
+#else
+#include <utils.H>
+#endif
+
+
+
+// Used to generate a FAPI RC -- don't care how or why
+fapi2::ReturnCode verifyPrd_get_fapi2_error(void)
+{
+ FAPI_INF("Enter verifyPrd_get_fapi2_error...");
+ // You can assign directly to the buffer:
+ const uint32_t buf[] = {0x01, 0x02, 0x03, 0xDEADBEEF};
+ fapi2::variable_buffer other_bits(buf, 4, 128);
+ uint32_t val;
+
+ FAPI_TRY( other_bits.extract(val, 0, 130) );
+
+fapi_try_exit:
+ FAPI_INF("Exiting verifyPrd_get_fapi2_error...");
+
+ // should return FAPI2_RC_INVALID_PARAMETER
+ return fapi2::current_err;
+}
+
+
+namespace fapi2
+{
+uint32_t verifyHwpPrdAssociaton()
+{
+ uint32_t l_rc = 0;
+ uint32_t l_plid = 0;
+ ReturnCode l_fapiRc;
+
+ FAPI_INF("verifyHwpPrdAssociation running");
+ // get a target for this test
+ TARGETING::Target * l_masterProc;
+ TARGETING::targetService().masterProcChipTargetHandle(l_masterProc);
+
+ // Using masterProc target as FAPI core target for test
+ Target<fapi2::TARGET_TYPE_CORE> fapi2_coreTarget(l_masterProc);
+ // We have to pass a FAPI RC so make one up
+ l_fapiRc = verifyPrd_get_fapi2_error();
+
+ // Init the attribute so we know if it changes
+ l_masterProc->setAttr<TARGETING::ATTR_PRD_HWP_PLID>( 0x12345678 );
+
+ // Create/commit elog associated with PRD PLID attribute
+ fapi2::log_related_error( fapi2_coreTarget, l_fapiRc );
+
+ // Verify that PLID attribute changed
+ l_plid = l_masterProc->getAttr<TARGETING::ATTR_PRD_HWP_PLID>();
+
+ if (0x12345678 == l_plid)
+ { // PLID did not change so routine failed somehow
+ TS_FAIL(" verifyHwpPrdAssociation No PLID change:%08X", l_plid);
+ l_rc = 1;
+ }
+ else
+ { // PLID was altered, so that is good
+ TS_TRACE(" verifyHwpPrdAssociation GOOD on CORE");
+ }
+
+ FAPI_INF("...verifyHwpPrdAssociation completed: PLID:%08X", l_plid);
+
+ return l_rc;
+}
+
+
+} // end namespace fapi2
diff --git a/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.H b/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.H
new file mode 100644
index 000000000..3670b7773
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2VerifyPrdAttrTest.H
@@ -0,0 +1,59 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2VerifyPrdAttrTest.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 __fapi2VerifyPrdAttrTest_H
+#define __fapi2VerifyPrdAttrTest_H
+
+#include <cxxtest/TestSuite.H>
+#include <fapi2.H>
+
+#include "fapi2VerifyPrdAttrTest.C"
+
+namespace fapi2
+{
+
+
+class test_verifyPrdAttr: public CxxTest::TestSuite
+{
+public:
+ /*
+ * @brief Test hw callout with gard and deconfig
+ */
+ void testPlidAssociation(void)
+ {
+ uint32_t l_res = verifyHwpPrdAssociaton();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("verifyHwpPrdAssociaton. Fail l_res=%d", l_res);
+ }
+
+ } // end runAssociationTest
+
+}; // end class
+
+
+}// end namespace fapi2
+
+#endif
OpenPOWER on IntegriCloud