summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2
diff options
context:
space:
mode:
authorMatt Derksen <v2cibmd@us.ibm.com>2016-09-29 16:24:09 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-11-04 17:05:52 -0400
commitb544343639825fd63f8b0a0eedce4fb4fb5558c3 (patch)
tree03243e088ad487bc54d0ddedc5f5236b5f1964b2 /src/usr/fapi2
parent8e662b21200243dbcd0caa1a0d89cdc5b0eead0a (diff)
downloadtalos-hostboot-b544343639825fd63f8b0a0eedce4fb4fb5558c3.tar.gz
talos-hostboot-b544343639825fd63f8b0a0eedce4fb4fb5558c3.zip
Test fapi2 returncode support
Change-Id: I4abe424e5a5d8b73e19e3cec9cf162b426a6e7b4 RTC:143127 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31477 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r--src/usr/fapi2/test/fapi2HwpTest.H16
-rw-r--r--src/usr/fapi2/test/fapi2Test.mk1
-rw-r--r--src/usr/fapi2/test/rcSupport.C96
-rw-r--r--src/usr/fapi2/test/rcSupport.H58
-rwxr-xr-xsrc/usr/fapi2/test/rcTest.C381
-rw-r--r--src/usr/fapi2/test/rcTest.H110
6 files changed, 434 insertions, 228 deletions
diff --git a/src/usr/fapi2/test/fapi2HwpTest.H b/src/usr/fapi2/test/fapi2HwpTest.H
index 7d74f27c2..620325b3b 100644
--- a/src/usr/fapi2/test/fapi2HwpTest.H
+++ b/src/usr/fapi2/test/fapi2HwpTest.H
@@ -151,6 +151,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_proc, fapi2_procTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_proc !!");
@@ -159,6 +160,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_eq, fapi2_eqTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_eq !!");
@@ -167,6 +169,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_ex, fapi2_exTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_ex !!");
@@ -175,6 +178,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_core, fapi2_coreTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_core !!");
@@ -183,6 +187,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcs, fapi2_mcsTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_mcs !!");
@@ -191,6 +196,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mca, fapi2_mcaTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_mca !!");
@@ -199,6 +205,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcbist, fapi2_mcbistTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_mcbist !!");
@@ -207,6 +214,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_pec, fapi2_pecTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_pec !!");
@@ -215,6 +223,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_phb, fapi2_phbTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_phb !!");
@@ -223,6 +232,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_xbus, fapi2_xbusTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_xbus !!");
@@ -231,6 +241,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_obus, fapi2_obusTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_obus !!");
@@ -239,6 +250,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_nv, fapi2_nvTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_nv !!");
@@ -247,6 +259,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_ppe, fapi2_ppeTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_ppe !!");
@@ -255,6 +268,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_perv, fapi2_pervTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_perv !!");
@@ -263,6 +277,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_sbe, fapi2_sbeTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_sbe !!");
@@ -271,6 +286,7 @@ void test_fapi2Hwp()
FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_capp, fapi2_cappTarget, scratchWriteValue);
if(l_errl != NULL)
{
+ delete l_errl;
l_errl = NULL;
numFails++;
TS_FAIL("Error occured in p9_sample_procedure_capp !!");
diff --git a/src/usr/fapi2/test/fapi2Test.mk b/src/usr/fapi2/test/fapi2Test.mk
index 189f64a8f..175284ec0 100644
--- a/src/usr/fapi2/test/fapi2Test.mk
+++ b/src/usr/fapi2/test/fapi2Test.mk
@@ -42,6 +42,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
# Procedures
OBJS += p9_sample_procedure.o
OBJS += p9_hwtests.o
+OBJS += rcSupport.o
OBJS += fapi2TestUtils.o
OBJS += getVpdTest.o
diff --git a/src/usr/fapi2/test/rcSupport.C b/src/usr/fapi2/test/rcSupport.C
new file mode 100644
index 000000000..77152fca5
--- /dev/null
+++ b/src/usr/fapi2/test/rcSupport.C
@@ -0,0 +1,96 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/rcSupport.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 */
+//------------------------------------------------------------------------------
+/// @file rcSupport.C
+///
+/// @brief These procedures provide fapi2 return codes with desired data to
+/// support testing from rcTest
+//-----------------------------------------------------------------------------
+
+#include <cxxtest/TestSuite.H>
+#include <fapi2.H>
+#include <rcSupport.H>
+#include <plat_hwp_invoker.H>
+
+
+//******************************************************************************
+// p9_ffdc_fail. Returns a fapi2::ReturnCode with an ffdc entry
+//******************************************************************************
+fapi2::ReturnCode p9_ffdc_fail(void)
+{
+ uint8_t thread_id = 4;
+ FAPI_INF("Enter p9_ffdc_fail...");
+ FAPI_ASSERT(false,
+ fapi2::P9_RAM_THREAD_NOT_STOP_ERR()
+ .set_THREAD(thread_id),
+ "p9_ffdc_fail worked");
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_ffdc_fail...");
+
+ return fapi2::current_err;
+}
+
+
+//******************************************************************************
+// p9_registerFfdc_fail.
+// Returns a fapi2::ReturnCode with registery reads of a target
+//******************************************************************************
+fapi2::ReturnCode p9_registerFfdc_fail(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target)
+{
+ FAPI_INF("Enter p9_registerFfdc_fail...");
+
+ FAPI_ASSERT(0, fapi2::TEST_ERROR_A().set_TARGET(i_proc_target));
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_registerFfdc_fail...");
+
+ return fapi2::current_err;
+}
+
+
+//******************************************************************************
+// p9_procedureFfdc_fail.
+// Cause a failure which calls a procedure that fills in some ffdc into the
+// fapi2::ReturnCode
+//******************************************************************************
+fapi2::ReturnCode p9_procedureFfdc_fail()
+{
+ FAPI_INF("Enter p9_procedureFfdc_fail...");
+
+ uint32_t pib = 0x0001;
+ fapi2::ReturnCode l_rc;
+
+ FAPI_ASSERT(0, fapi2::TEST_PROC_ERROR(fapi2::FAPI2_ERRL_SEV_RECOVERED,
+ l_rc).set_parm1(pib));
+
+ fapi_try_exit:
+
+ FAPI_INF("Exiting p9_procedureFfdc_fail...");
+
+ return l_rc;
+}
diff --git a/src/usr/fapi2/test/rcSupport.H b/src/usr/fapi2/test/rcSupport.H
new file mode 100644
index 000000000..2cf276669
--- /dev/null
+++ b/src/usr/fapi2/test/rcSupport.H
@@ -0,0 +1,58 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/rcSupport.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 */
+/// @file rcSupport.H
+///
+/// @brief These procedures provide fapi2 return codes with desired data to
+/// support testing from rcTest
+
+//------------------------------------------------------------------------------
+#ifndef _RC_SUPPORT_H_
+#define _RC_SUPPORT_H_
+
+#include <fapi2.H>
+
+//******************************************************************************
+// p9_ffdc_fail. Returns a fapi2::ReturnCode with an ffdc entry
+//******************************************************************************
+fapi2::ReturnCode p9_ffdc_fail(void);
+
+
+//******************************************************************************
+// p9_registerFfdc_fail.
+// Returns a fapi2::ReturnCode with registery reads of a target
+//******************************************************************************
+fapi2::ReturnCode p9_registerFfdc_fail(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target);
+
+
+//******************************************************************************
+// p9_procedureFfdc_fail.
+// Cause a failure which calls a procedure that fills in some ffdc into the
+// fapi2::ReturnCode
+//******************************************************************************
+fapi2::ReturnCode p9_procedureFfdc_fail(void);
+
+
+#endif
diff --git a/src/usr/fapi2/test/rcTest.C b/src/usr/fapi2/test/rcTest.C
index fd7a5da7f..4f266e0f6 100755
--- a/src/usr/fapi2/test/rcTest.C
+++ b/src/usr/fapi2/test/rcTest.C
@@ -35,12 +35,65 @@
#include <error_info.H>
#include <targeting/common/targetservice.H>
#include <targeting/common/utilFilter.H>
+#include <rcSupport.H>
+
+fapi2::ReturnCode get_fapi2_error(void)
+{
+ FAPI_INF("Enter 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 get_fapi2_error...");
+
+ // should return FAPI2_RC_INVALID_PARAMETER
+ return fapi2::current_err;
+}
+
+fapi2::ReturnCode get_plat_error(void)
+{
+ FAPI_INF("Entering get_plat_error...");
+
+ fapi2::buffer<uint64_t> l_scomdata = 0;
+
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the proc chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
+
+ TARGETING::Target * l_Proc = NULL;
+
+ if (l_chipList.size() > 0)
+ {
+ l_Proc = l_chipList[0];
+ }
+
+ if (l_Proc != NULL)
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(l_Proc);
+
+ FAPI_INF("Do an invalid address getscom on proc target");
+ FAPI_TRY(fapi2::getScom(fapi2_procTarget,
+ 0x11223344,
+ l_scomdata));
+ }
+ fapi_try_exit:
+
+ FAPI_INF("Exiting get_plat_error...");
+ return fapi2::current_err;
+}
+
namespace fapi2
{
//******************************************************************************
-// rcTestDefaultConstructor. Ensures that the ReturnCode default
+// rcTestDefaultConstructor. Ensures that the ReturnCode default
// constructor works
//******************************************************************************
uint32_t rcTestDefaultConstructor()
@@ -73,10 +126,9 @@ uint32_t rcTestDefaultConstructor()
return l_result;
}
-//TODO RTC 143127:fapi2 ReturnCode support in hostboot
-#if 0
+
//******************************************************************************
-// rcTestReturnCodeCreator. Ensures that the ReturnCode creator reflects
+// rcTestReturnCodeCreator. Ensures that the ReturnCode creator reflects
// the return code
//******************************************************************************
uint32_t rcTestReturnCodeCreator()
@@ -87,28 +139,28 @@ uint32_t rcTestReturnCodeCreator()
ReturnCode l_rc;
// Set the return code to a FAPI code
- l_rc.setFapiError(FAPI2_RC_INVALID_ATTR_GET);
+ l_rc = get_fapi2_error();
// Ensure that the creator is FAPI
ReturnCode::returnCodeCreator l_creator = l_rc.getCreator();
if (l_creator != ReturnCode::CREATOR_FAPI)
{
- FAPI_ERR("rcTestReturnCodeCreator. Creator is 0x%x, expected FAPI",
+ FAPI_ERR("rcTestReturnCodeCreator. Creator is 0x%x, expected FAPI",
l_creator);
l_result = 1;
}
else
{
// Set the return code to a PLAT code
- l_rc.setPlatError(NULL);
+ l_rc = get_plat_error(); //.setPlatError(NULL);
// Ensure that the creator is PLAT
l_creator = l_rc.getCreator();
if (l_creator != ReturnCode::CREATOR_PLAT)
{
- FAPI_ERR("rcTestReturnCodeCreator. Creator is 0x%x, expected PLAT",
+ FAPI_ERR("rcTestReturnCodeCreator. Creator is 0x%x, expected PLAT",
l_creator);
l_result = 2;
}
@@ -136,10 +188,10 @@ uint32_t rcTestReturnCodeCreator()
return l_result;
}
-#endif
+
//******************************************************************************
-// rcTestReturnCodeConstructor. Ensures that the ReturnCode constructor works
+// rcTestReturnCodeConstructor. Ensures that the ReturnCode constructor works
// when specifying a return code
//******************************************************************************
uint32_t rcTestReturnCodeConstructor()
@@ -175,10 +227,8 @@ uint32_t rcTestReturnCodeConstructor()
return l_result;
}
-//TODO RTC 143127:fapi2 ReturnCode support in hostboot
-#if 0
//******************************************************************************
-// rcTestComparisonOperator . Ensures that the comparison operators work
+// rcTestComparisonOperator . Ensures that the comparison operators work
// (comparing with another ReturnCode)
//******************************************************************************
uint32_t rcTestComparisonOperator()
@@ -206,7 +256,7 @@ uint32_t rcTestComparisonOperator()
else
{
// Change the code of l_rc2
- l_rc2.setFapiError(FAPI2_RC_PLAT_ERR_SEE_DATA);
+ l_rc2 = get_fapi2_error();
// Ensure that the equality comparison returns false
if (l_rc == l_rc2)
@@ -225,7 +275,7 @@ uint32_t rcTestComparisonOperator()
}
else
{
- FAPI_INF("rcTest4. Success!");
+ FAPI_INF("rcTestComparisonOperator() Success!");
}
}
}
@@ -233,10 +283,10 @@ uint32_t rcTestComparisonOperator()
return l_result;
}
-#endif
+
//******************************************************************************
-// rcTestComparisonOperatorWithRCValue. Ensures that the comparison operators
+// rcTestComparisonOperatorWithRCValue. Ensures that the comparison operators
// work (comparing with a return code value)
//******************************************************************************
uint32_t rcTestComparisonOperatorWithRCValue()
@@ -295,154 +345,9 @@ uint32_t rcTestComparisonOperatorWithRCValue()
return l_result;
}
-//TODO RTC 143127:fapi2 ReturnCode support in hostboot
-#if 0
-//******************************************************************************
-// rcTestGetAndReleasePlatData. Ensures that the getPlatData and releasePlatData
-// functions work when there is no attached data
-//******************************************************************************
-uint32_t rcTestGetAndReleasePlatData()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc(FAPI2_RC_INVALID_ATTR_GET);
-
- // Ensure that the getPlatData function returns NULL
- void * l_pData = reinterpret_cast<void *> (0x12345678);
-
- l_pData = l_rc.getPlatData();
-
- if (l_pData != NULL)
- {
- FAPI_ERR("rcTestGetAndReleasePlatData.getPlatData did not return NULL");
- l_result = 1;
- }
- else
- {
- // Ensure that the releasePlatData function returns NULL
- l_pData = reinterpret_cast<void *> (0x12345678);
-
- l_pData = l_rc.releasePlatData();
-
- if (l_pData != NULL)
- {
- FAPI_ERR("rcTestGetAndReleasePlatData. releasePlatData did "
- " not return NULL");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTestGetAndReleasePlatData. Success!");
- }
- }
-
- return l_result;
-}
//******************************************************************************
-// rcTestGetPlatData. Ensures that the getPlatData function works when there is
-// attached data
-//******************************************************************************
-uint32_t rcTestGetPlatData()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
-
- // Assign PlatData. Note that this should really be an errlHndl_t, because
- // the FSP deleteData function will attempt to delete an error log, but this
- // is just for test, the data will be released before the ReturnCode is
- // destructed.
- uint32_t l_myData = 6;
- void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatError(l_pMyData);
-
- // Ensure that getPlatData retrieves the PlatData
- void * l_pMyDataCheck = l_rc.getPlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTestGetPlatData. 1. getPlatData returned unexpected "
- "data ptr");
- l_result = 1;
- }
- else
- {
- // Ensure that getPlatData retrieves the PlatData again
- l_pMyDataCheck = NULL;
- l_pMyDataCheck = l_rc.getPlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTestGetPlatData. 2. getPlatData returned unexpected "
- " data ptr");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTestGetPlatData. Success!");
- }
- }
-
- // Release the data to avoid ReturnCode from deleting in on destruction
- l_pMyDataCheck = l_rc.releasePlatData();
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTestReleasePlatData. Ensures that the releasePlatData function works when
-// there is attached data
-//******************************************************************************
-uint32_t rcTestReleasePlatData()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
-
- // Assign PlatData. Note that this should really be an errlHndl_t, because
- // the FSP deleteData function will attempt to delete an error log, but this
- // is just for test, the data will be released before the ReturnCode is
- // destructed.
- uint32_t l_myData = 6;
- void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatError(l_pMyData);
-
- // Ensure that releasePlatData retrieves the PlatData
- void * l_pMyDataCheck = l_rc.releasePlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTestReleasePlatData. releasePlatDatareturned unexpected "
- " data ptr");
- l_result = 1;
- }
- else
- {
- // Ensure that releasePlatData now returns NULL
- l_pMyDataCheck = NULL;
- l_pMyDataCheck = l_rc.releasePlatData();
-
- if (l_pMyDataCheck != NULL)
- {
- FAPI_ERR("rcTestReleasePlatData. 2. releasePlatData returned non "
- " NULL ptr");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTestReleasePlatData. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTestCopyConstructor. Ensures that the copy constructor works when there is
+// rcTestCopyConstructor. Ensures that the copy constructor works when there is
// attached PlatData and that the getPlatData function works
//******************************************************************************
uint32_t rcTestCopyConstructor()
@@ -458,7 +363,7 @@ uint32_t rcTestCopyConstructor()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatError(l_pMyData);
+ (void) l_rc.setPlatDataPtr(l_pMyData);
// Create a ReturnCode using the copy constructor
ReturnCode l_rc2(l_rc);
@@ -472,7 +377,7 @@ uint32_t rcTestCopyConstructor()
else
{
// Ensure that getPlatData retrieves the PlatData from l_rc
- void * l_pMyDataCheck = l_rc.getPlatData();
+ void * l_pMyDataCheck = l_rc.getPlatDataPtr();
if (l_pMyDataCheck != l_pMyData)
{
@@ -484,7 +389,7 @@ uint32_t rcTestCopyConstructor()
{
// Ensure that getPlatData retrieves the PlatData from l_rc2
l_pMyDataCheck = NULL;
- l_pMyDataCheck = l_rc2.getPlatData();
+ l_pMyDataCheck = l_rc2.getPlatDataPtr();
if (l_pMyDataCheck != l_pMyData)
{
@@ -499,15 +404,11 @@ uint32_t rcTestCopyConstructor()
}
}
- // Release the data to avoid ReturnCode from deleting in on destruction.
- // This will release the data from both copies of the ReturnCode.
- (void) l_rc.releasePlatData();
-
return l_result;
}
//******************************************************************************
-// rcTestAssignmentOperator. Ensures that the assignment operator works when
+// rcTestAssignmentOperator. Ensures that the assignment operator works when
// there is attached PlatData and that the releasePlatData function works
//******************************************************************************
uint32_t rcTestAssignmentOperator()
@@ -523,7 +424,7 @@ uint32_t rcTestAssignmentOperator()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatError(l_pMyData);
+ (void) l_rc.setPlatDataPtr(l_pMyData);
// Create a ReturnCode using the assignment operator
ReturnCode l_rc2;
@@ -538,39 +439,25 @@ uint32_t rcTestAssignmentOperator()
else
{
// Ensure that releasePlatData retrieves the PlatData from l_rc
- void * l_pMyDataCheck = l_rc.releasePlatData();
+ void * l_pMyDataCheck = l_rc.getPlatDataPtr();
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTestAssignmentOperator. releasePlatData returned "
+ FAPI_ERR("rcTestAssignmentOperator. getPlatDataPtr returned "
"unexpected data ptr");
l_result = 2;
}
else
{
- // Ensure that releasePlatData retrieves NULL from l_rc2
- l_pMyDataCheck = NULL;
- l_pMyDataCheck = l_rc2.releasePlatData();
-
- if (l_pMyDataCheck != NULL)
- {
- FAPI_ERR("rcTestAssignmentOperator. releasePlatData returned "
- " non NULL ptr");
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTestAssignmentOperator. Success!");
- }
+ FAPI_INF("rcTestAssignmentOperator. Success!");
}
}
return l_result;
}
-#endif
//******************************************************************************
-// rcTestGetErrorInfo . Ensures that the getErrorInfo function works when there
+// rcTestGetErrorInfo . Ensures that the getErrorInfo function works when there
// is no ErrorInfo
//******************************************************************************
uint32_t rcTestGetErrorInfo()
@@ -623,7 +510,7 @@ uint32_t rcTestErrorInfo()
TARGETING::targetService().masterProcChipTargetHandle( l_masterProc );
fapi2::Target <fapi2::TARGET_TYPE_PROC_CHIP> l_target2(l_masterProc);
-
+
// Create some FFDC
uint8_t l_ffdc = 0x12;
@@ -920,7 +807,7 @@ uint32_t rcTestErrorInfo()
}
//******************************************************************************
-// rcTestCopyConstructorwithErrorInfo. Ensures that the copy constructor works
+// rcTestCopyConstructorwithErrorInfo. Ensures that the copy constructor works
// when there is ErrorInfo
//******************************************************************************
uint32_t rcTestCopyConstructorwithErrorInfo()
@@ -975,10 +862,10 @@ uint32_t rcTestCopyConstructorwithErrorInfo()
l_result = 2;
break;
}
-
+
if (l_pErrInfo->iv_CDGs.size() != 1)
{
- FAPI_ERR("rcTestCopyConstructorwithErrorInfo. %d CDGs",
+ FAPI_ERR("rcTestCopyConstructorwithErrorInfo. %d CDGs",
l_pErrInfo->iv_CDGs.size());
l_result = 3;
break;
@@ -1016,7 +903,7 @@ uint32_t rcTestCopyConstructorwithErrorInfo()
}
//******************************************************************************
-// rcTestAssignmentOperatorwithErrorInfo. Ensures that the assignment operator
+// rcTestAssignmentOperatorwithErrorInfo. Ensures that the assignment operator
// works when there ErrorInfo
//******************************************************************************
uint32_t rcTestAssignmentOperatorwithErrorInfo()
@@ -1076,7 +963,7 @@ uint32_t rcTestAssignmentOperatorwithErrorInfo()
if (l_pErrInfo->iv_CDGs.size() != 1)
{
- FAPI_ERR("rcTestAssignmentOperatorwithErrorInfo. %d CDGs",
+ FAPI_ERR("rcTestAssignmentOperatorwithErrorInfo. %d CDGs",
l_pErrInfo->iv_CDGs.size());
l_result = 3;
break;
@@ -1116,7 +1003,7 @@ uint32_t rcTestAssignmentOperatorwithErrorInfo()
}
//******************************************************************************
-// rcTestClearErrorInfo. Ensures that setting the ReturnCode to success clears
+// rcTestClearErrorInfo. Ensures that setting the ReturnCode to success clears
// ErrorInfo
//******************************************************************************
uint32_t rcTestClearErrorInfo()
@@ -1176,8 +1063,6 @@ uint32_t rcTestAddErrorInfo()
// Create a ReturnCode
ReturnCode l_rc;
- //TODO RTC 143127:fapi2 ReturnCode support in hostboot
- //l_rc.setPlatError(NULL, FAPI2_RC_PLAT_ERR_SEE_DATA);
l_rc._setHwpError(RC_FAPI2_SAMPLE);
TARGETING::Target * l_pTarget = NULL;
@@ -1190,7 +1075,6 @@ uint32_t rcTestAddErrorInfo()
fapi2::Target <fapi2::TARGET_TYPE_PROC_CHIP> l_target2(l_masterProc);
-
// Create 2 FFDCs
uint8_t l_ffdc = 0x12;
uint32_t l_ffdc2 = 0x12345678;
@@ -1220,16 +1104,16 @@ uint32_t rcTestAddErrorInfo()
l_entries[3].target_cdg.iv_callout = 0;
l_entries[3].target_cdg.iv_deconfigure = 0;
l_entries[3].target_cdg.iv_gard = 1;
- l_entries[3].target_cdg.iv_calloutPriority =
+ l_entries[3].target_cdg.iv_calloutPriority =
fapi2::CalloutPriorities::MEDIUM;
l_entries[4].iv_type = fapi2::EI_TYPE_PROCEDURE_CALLOUT;
- l_entries[4].proc_callout.iv_procedure = fapi2::ProcedureCallouts::CODE;
- l_entries[4].proc_callout.iv_calloutPriority =
+ l_entries[4].proc_callout.iv_procedure = fapi2::ProcedureCallouts::CODE;
+ l_entries[4].proc_callout.iv_calloutPriority =
fapi2::CalloutPriorities::MEDIUM;
l_entries[5].iv_type = fapi2::EI_TYPE_PROCEDURE_CALLOUT;
- l_entries[5].proc_callout.iv_procedure =
+ l_entries[5].proc_callout.iv_procedure =
fapi2::ProcedureCallouts::LVL_SUPPORT;
- l_entries[5].proc_callout.iv_calloutPriority =
+ l_entries[5].proc_callout.iv_calloutPriority =
fapi2::CalloutPriorities::LOW;
l_entries[6].iv_type = fapi2::EI_TYPE_BUS_CALLOUT;
l_entries[6].bus_callout.iv_endpoint1ObjIndex = 2;
@@ -1238,7 +1122,7 @@ uint32_t rcTestAddErrorInfo()
l_entries[7].iv_type = fapi2::EI_TYPE_BUS_CALLOUT;
l_entries[7].bus_callout.iv_endpoint1ObjIndex = 2;
l_entries[7].bus_callout.iv_endpoint2ObjIndex = 3;
- l_entries[7].bus_callout.iv_calloutPriority =
+ l_entries[7].bus_callout.iv_calloutPriority =
fapi2::CalloutPriorities::HIGH;
l_entries[8].iv_type = fapi2::EI_TYPE_CHILDREN_CDG;
l_entries[8].children_cdg.iv_parentObjIndex = 2;
@@ -1789,4 +1673,89 @@ uint32_t rcTestRcToErrl()
}
#endif //fips
+
+uint32_t rcTestReturnCodeAttrErrls()
+{
+ uint32_t numTests = 0;
+ uint32_t numFails = 0;
+ errlHndl_t l_errl = NULL;
+ FAPI_INF("rcTestReturnCodeAttrErrls() running");
+ do
+ {
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the proc chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
+
+ TARGETING::Target * l_Proc = NULL;
+
+ //Take the first proc and use it
+ if (l_chipList.size() > 0)
+ {
+ l_Proc = l_chipList[0];
+ }
+
+ numTests++;
+ if(l_Proc == NULL)
+ {
+ // Send an errorlog because we cannot find any procs.
+ TS_FAIL("getAllChips: could not find proc, skipping tests");
+ numFails++;
+ break;
+ }
+
+
+ numTests++;
+ FAPI_INVOKE_HWP(l_errl, p9_ffdc_fail);
+ if(l_errl != NULL)
+ {
+ FAPI_INF("p9_ffdc_fail returned errl");
+ errlCommit(l_errl,CXXTEST_COMP_ID);
+ l_errl = NULL;
+ }
+ else
+ {
+ TS_FAIL("No error from p9_ffdc_fail !!");
+ numFails++;
+ }
+
+ numTests++;
+ FAPI_INVOKE_HWP(l_errl, p9_procedureFfdc_fail);
+ if(l_errl != NULL)
+ {
+ FAPI_INF("p9_procedureFfdc_fail returned errl");
+ errlCommit(l_errl,CXXTEST_COMP_ID);
+ l_errl = NULL;
+ }
+ else
+ {
+ TS_FAIL("No error from p9_procedureFfdc_fail !!");
+ numFails++;
+ }
+
+ Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(
+ l_Proc);
+
+ numTests++;
+ FAPI_INVOKE_HWP(l_errl, p9_registerFfdc_fail, fapi2_procTarget);
+ if(l_errl != NULL)
+ {
+ FAPI_INF("p9_registerFfdc_fail returned errl");
+ errlCommit(l_errl,CXXTEST_COMP_ID);
+ l_errl = NULL;
+ }
+ else
+ {
+ TS_FAIL("No error from p9_registerFfdc_fail !!");
+ numFails++;
+ }
+ } while (0);
+
+ FAPI_INF("rcTestReturnCodeAttrErrls Test Complete. %d/%d fails",
+ numFails , numTests);
+
+ return numFails;
+}
+
}
diff --git a/src/usr/fapi2/test/rcTest.H b/src/usr/fapi2/test/rcTest.H
index 1e9e3d315..02bd32015 100644
--- a/src/usr/fapi2/test/rcTest.H
+++ b/src/usr/fapi2/test/rcTest.H
@@ -54,13 +54,54 @@ public:
}
}
+ /**
+ * @brief Test FAPI2 return codes #2
+ */
+ void testFapi2ReturnCode2(void)
+ {
+ uint32_t l_res = rcTestReturnCodeCreator();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("testFapi2ReturnCode2. Fail l_res=%d", l_res);
+ }
+ }
+
+
+ /**
+ * @brief Test FAPI2 return codes #3
+ */
+ void testFapi2ReturnCode3()
+ {
+ uint32_t l_res = rcTestComparisonOperatorWithRCValue();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("testFapi2ReturnCode3. Fail l_res=%d", l_res);
+ }
+ return;
+ }
+
+ /**
+ * @brief Test FAPI2 return codes #4
+ */
+ void testFapi2ReturnCode4()
+ {
+ uint32_t l_res = rcTestComparisonOperator();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("testFapi2ReturnCode4. Fail l_res=%d", l_res);
+ }
+ return;
+ }
/**
* @brief Test FAPI2 return codes #5
*/
void testFapi2ReturnCode5()
{
- uint32_t l_res = rcTestComparisonOperatorWithRCValue();
+ uint32_t l_res = rcTestCopyConstructor();
if (l_res != 0)
{
@@ -70,101 +111,126 @@ public:
}
/**
- * @brief Test FAPI2 return codes #11
+ * @brief Test FAPI2 return codes #6
*/
- void testFapi2ReturnCode11(void)
+ void testFapi2ReturnCode6()
+ {
+ uint32_t l_res = rcTestReturnCodeConstructor();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("testFapi2ReturnCode6. Fail l_res=%d", l_res);
+ }
+ return;
+ }
+
+ /**
+ * @brief Test FAPI2 return codes #7
+ */
+ void testFapi2ReturnCode7(void)
{
uint32_t l_res = rcTestGetErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode11. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode7. Fail l_res=%d", l_res);
}
}
/**
- * @brief Test FAPI2 return codes #12
+ * @brief Test FAPI2 return codes #8
*/
- void testFapi2ReturnCode12()
+ void testFapi2ReturnCode8()
{
uint32_t l_res = rcTestErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode12. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode8. Fail l_res=%d", l_res);
}
}
/**
- * @brief Test FAPI2 return codes #13
+ * @brief Test FAPI2 return codes #9
*/
- void testFapi2ReturnCode13()
+ void testFapi2ReturnCode9()
{
uint32_t l_res = rcTestCopyConstructorwithErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode13. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode9. Fail l_res=%d", l_res);
}
return;
}
/**
- * @brief Test FAPI2 return codes #14
+ * @brief Test FAPI2 return codes #10
*/
- void testFapi2ReturnCode14()
+ void testFapi2ReturnCode10()
{
uint32_t l_res = rcTestAssignmentOperatorwithErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode14. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode10. Fail l_res=%d", l_res);
}
return;
}
/**
- * @brief Test FAPI2 return codes #15
+ * @brief Test FAPI2 return codes #11
*/
- void testFapi2ReturnCode15()
+ void testFapi2ReturnCode11()
{
uint32_t l_res = rcTestClearErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode15. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode11. Fail l_res=%d", l_res);
}
return;
}
/**
- * @brief Test FAPI2 return codes #16
+ * @brief Test FAPI2 return codes #12
*/
- void testFapi2ReturnCode16()
+ void testFapi2ReturnCode12()
{
uint32_t l_res = rcTestAddErrorInfo();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode16. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode12. Fail l_res=%d", l_res);
}
return;
}
/**
- * @brief Test FAPI2 return codes #17
+ * @brief Test FAPI2 return codes #13
*/
- void testFapi2ReturnCode17()
+ void testFapi2ReturnCode13()
{
uint32_t l_res = rcTestStaticCast();
if (l_res != 0)
{
- TS_FAIL("testFapi2ReturnCode17. Fail l_res=%d", l_res);
+ TS_FAIL("testFapi2ReturnCode13. Fail l_res=%d", l_res);
}
return;
}
+
+
+ void testFapi2ReturnCodeAttrErrls(void)
+ {
+ uint32_t l_res = rcTestReturnCodeAttrErrls();
+
+ if (l_res != 0)
+ {
+ TS_FAIL("rcTestReturnCodeAttrErrls. Fail l_res=%d", l_res);
+ }
+ }
};
#endif
OpenPOWER on IntegriCloud