summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2
diff options
context:
space:
mode:
authorcrgeddes <crgeddes@us.ibm.com>2016-02-16 15:14:03 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2016-04-05 15:12:57 -0400
commite8fdc1c11a1ee3c9406b75ebb45b619371e60182 (patch)
treee4d6c6cc53cf2e122b92c790d7d9790aeed05700 /src/usr/fapi2
parent6e0d21f16e8153125f8dbd2a8feb4ce56ff54e39 (diff)
downloadtalos-hostboot-e8fdc1c11a1ee3c9406b75ebb45b619371e60182.tar.gz
talos-hostboot-e8fdc1c11a1ee3c9406b75ebb45b619371e60182.zip
Add getOtherEnd to fapi2::Target
RTC:129517 Change-Id: I7270b194b609daf8e547313cf73a640e4adc48aa Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21873 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r--src/usr/fapi2/test/fapi2GetOtherEnd.C215
-rw-r--r--src/usr/fapi2/test/fapi2Test.H18
2 files changed, 225 insertions, 8 deletions
diff --git a/src/usr/fapi2/test/fapi2GetOtherEnd.C b/src/usr/fapi2/test/fapi2GetOtherEnd.C
new file mode 100644
index 000000000..193e13b31
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2GetOtherEnd.C
@@ -0,0 +1,215 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2GetOtherEnd.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,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 */
+
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <fapi2.H>
+#include <hwpf_fapi2_reasoncodes.H>
+#include <fapi2TestUtils.H>
+#include <cxxtest/TestSuite.H>
+#include <targeting/common/target.H>
+#include <targeting/common/util.H>
+
+
+namespace fapi2
+{
+
+
+//******************************************************************************
+// fapi2GetOtherEnd
+//******************************************************************************
+errlHndl_t fapi2GetOtherEnd()
+{
+ int numTests = 0;
+ int numFails = 0;
+ errlHndl_t l_errl = NULL;
+
+ do
+ {
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList chipListNonFunct;
+
+ // Get a list of all of the xbus chips present
+ TARGETING::getAllChiplets(chipListNonFunct,
+ TARGETING::TYPE_XBUS, false);
+ TARGETING::Target * l_peerTarget;
+ fapi2::Target<fapi2::TARGET_TYPE_XBUS> fapi2_xbusTargetPeer;
+ for(uint32_t i = 0; i < chipListNonFunct.size(); i++)
+ {
+ chipListNonFunct[i]->
+ tryGetAttr<TARGETING::ATTR_PEER_TARGET>(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTargetPeerPlatform(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTarget(chipListNonFunct[i]);
+ if(l_peerTarget != NULL)
+ {
+ numTests++;
+ if(fapi2_xbusTarget.getOtherEnd<TARGET_TYPE_XBUS>(fapi2_xbusTargetPeer,TARGET_STATE_PRESENT) == FAPI2_RC_SUCCESS)
+ {
+ if(fapi2_xbusTargetPeerPlatform != fapi2_xbusTargetPeer)
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned the incorrect target! expected %x, instead got %x ", TARGETING::get_huid(l_peerTarget), TARGETING::get_huid(static_cast<TARGETING::Target*>(fapi2_xbusTargetPeer)));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned failed to return a target although it should have returned %x", TARGETING::get_huid(l_peerTarget));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ FAPI_ERR("fapiGetOtherEnd:: WARNING ! Target with HUID: %x has an unreachable peer target", chipListNonFunct[i]);
+ }
+ }
+
+
+ for(uint32_t i = 0; i < chipListNonFunct.size(); i++)
+ {
+ chipListNonFunct[i]->
+ tryGetAttr<TARGETING::ATTR_PEER_TARGET>(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTargetPeerPlatform(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTarget(chipListNonFunct[i]);
+ if(l_peerTarget != NULL)
+ {
+ numTests++;
+ fapi2_xbusTargetPeer = fapi2_xbusTarget.getOtherEnd<TARGET_TYPE_XBUS>(TARGET_STATE_PRESENT);
+ if(fapi2_xbusTargetPeer)
+ {
+ if(fapi2_xbusTargetPeerPlatform != fapi2_xbusTargetPeer)
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned the incorrect target! expected %x, instead got %x ", TARGETING::get_huid(l_peerTarget), TARGETING::get_huid(static_cast<TARGETING::Target*>(fapi2_xbusTargetPeer)));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned failed to return a target although it should have returned %x", TARGETING::get_huid(l_peerTarget));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ FAPI_ERR("fapiGetOtherEnd:: WARNING ! Target with HUID: %x has an unreachable peer target", chipListNonFunct[i]);
+ }
+ }
+
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList chipListFunct;
+
+ // Get a list of all of the xbus chips that are functional
+ TARGETING::getAllChiplets(chipListFunct, TARGETING::TYPE_XBUS, true);
+
+ //NOTE: This Part of the test will fail if a certain target A's
+ // PEER_TARGET attr doesn't point to target B that
+ // has a PEER_TARGET that points back to target A
+ // So basically:
+ // A.PEER_TARGET MUST EQUAL B
+ // B.PEER_TARGET MUST EQUAL A
+
+ FAPI_ERR("list of functional targets is size %d " , chipListFunct.size());
+ for(uint32_t i = 0; i < chipListFunct.size(); i++)
+ {
+ chipListFunct[i]->tryGetAttr<TARGETING::ATTR_PEER_TARGET>(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTargetPeerPlatform(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTarget(chipListFunct[i]);
+
+ if(l_peerTarget != NULL)
+ {
+ numTests++;
+ if(fapi2_xbusTarget.getOtherEnd<TARGET_TYPE_XBUS>(fapi2_xbusTargetPeer,TARGET_STATE_FUNCTIONAL) == FAPI2_RC_SUCCESS)
+ {
+ if(fapi2_xbusTargetPeerPlatform != fapi2_xbusTargetPeer)
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned the incorrect target! expected %x, instead got %x ", TARGETING::get_huid(l_peerTarget), TARGETING::get_huid(static_cast<TARGETING::Target*>(fapi2_xbusTargetPeer)));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned failed to return a target although it should have returned %x", TARGETING::get_huid(l_peerTarget));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ FAPI_ERR("fapiGetOtherEnd:: WARNING ! Target with HUID: %x has an unreachable peer target", TARGETING::get_huid(chipListFunct[i]));
+ }
+ }
+
+ for(uint32_t i = 0; i < chipListFunct.size(); i++)
+ {
+ chipListFunct[i]->tryGetAttr<TARGETING::ATTR_PEER_TARGET>(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTargetPeerPlatform(l_peerTarget);
+ const fapi2::Target<fapi2::TARGET_TYPE_XBUS>
+ fapi2_xbusTarget(chipListFunct[i]);
+
+ if(l_peerTarget != NULL)
+ {
+ numTests++;
+ fapi2_xbusTargetPeer = fapi2_xbusTarget.getOtherEnd<TARGET_TYPE_XBUS>(TARGET_STATE_FUNCTIONAL);
+ if(fapi2_xbusTargetPeer)
+ {
+ if(fapi2_xbusTargetPeerPlatform != fapi2_xbusTargetPeer)
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned the incorrect target! expected %x, instead got %x ", TARGETING::get_huid(l_peerTarget), TARGETING::get_huid(static_cast<TARGETING::Target*>(fapi2_xbusTargetPeer)));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ TS_FAIL("fapiGetOtherEnd:: getOtherEnd returned failed to return a target although it should have returned %x", TARGETING::get_huid(l_peerTarget));
+ numFails++;
+ break;
+ }
+ }
+ else
+ {
+ FAPI_ERR("fapiGetOtherEnd:: WARNING ! Target with HUID: %x has an unreachable peer target", TARGETING::get_huid(chipListFunct[i]));
+ }
+ }
+
+ FAPI_INF("fapi2TargetTest:: Test Complete. %d/%d fails", numFails, numTests);
+
+ }while(0);
+
+ return l_errl;
+}
+
+} \ No newline at end of file
diff --git a/src/usr/fapi2/test/fapi2Test.H b/src/usr/fapi2/test/fapi2Test.H
index 366921dbb..00a9bac46 100644
--- a/src/usr/fapi2/test/fapi2Test.H
+++ b/src/usr/fapi2/test/fapi2Test.H
@@ -47,6 +47,7 @@
#include "fapi2GetParentTest.C"
#include "fapi2HwpTest.C"
#include "fapi2GetChildrenTest.C"
+#include "fapi2GetOtherEnd.C"
using namespace fapi2;
@@ -63,21 +64,22 @@ void test_fapi2Test(void)
{
FAPI_INF(">>>>>>test_fapi2Test starting...");
- FAPI_INF(">>test_fapi2HwpTest starting...");
+ FAPI_INF(">>fapi2HwpTest starting...");
fapi2HwpTest();
- FAPI_INF("<<test_fapi2HwpTest exiting...");
+ FAPI_INF("<<fapi2HwpTest exiting...");
- FAPI_INF(">>test_fapi2GetChildrenTest starting...");
+ FAPI_INF(">>fapi2GetChildren starting...");
fapi2GetChildrenTest();
- FAPI_INF("<<test_fapi2ChildTest exiting...");
+ FAPI_INF("<<fapi2GetChildren exiting...");
- FAPI_INF(">>fapi2TargetTest::testFapi2GetParent starting...");
+ FAPI_INF(">>fapi2GetParent starting...");
fapi2GetParentTest();
- FAPI_INF("<<FAPI2: testFapi2GetParent exiting...");
+ FAPI_INF("<<fapi2GetParent exiting...");
- FAPI_INF("<<<<<<test_fapi2Test exiting...");
+ FAPI_INF(">>fapi2GetOtherEnd starting...");
+ fapi2GetOtherEnd();
+ FAPI_INF(">>fapi2GetOtherEnd exiting...");
}
-
};
#endif \ No newline at end of file
OpenPOWER on IntegriCloud