summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/test
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2016-04-08 21:03:51 -0500
committerStephen Cprek <smcprek@us.ibm.com>2016-04-21 13:51:32 -0500
commit76f1c48130a060fbe83c851fce2474c17b2df9b2 (patch)
treee258515dcbdab5817603c9d290befe2324df7d59 /src/usr/hwpf/test
parent3967f43b9478d7e6b58180dd0b331e61412997cd (diff)
downloadblackbird-hostboot-76f1c48130a060fbe83c851fce2474c17b2df9b2.tar.gz
blackbird-hostboot-76f1c48130a060fbe83c851fce2474c17b2df9b2.zip
Removing some more old fapi1 and hwp code
Deleted all of the old fapi1 code Moved potentially reuseable occ code to a new dir Deleted a variety of p8 hwp files Change-Id: I8b6ab72fef3f1413d919bdd21bc88f2c4f59c5c3 RTC: 146345 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23075 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/test')
-rw-r--r--src/usr/hwpf/test/fapiAttrTest.C585
-rwxr-xr-xsrc/usr/hwpf/test/fapiRcTest.C1753
-rw-r--r--src/usr/hwpf/test/fapiTargetTest.C422
-rw-r--r--src/usr/hwpf/test/fapiattrtest.H98
-rw-r--r--src/usr/hwpf/test/fapirctest.H280
-rw-r--r--src/usr/hwpf/test/fapitargettest.H147
-rw-r--r--src/usr/hwpf/test/hwpDQCompressionTest.H224
-rw-r--r--src/usr/hwpf/test/hwpMBvpdAccessorTest.H2078
-rw-r--r--src/usr/hwpf/test/hwpMvpdAccessorTest.H899
-rw-r--r--src/usr/hwpf/test/hwpftest.H861
-rw-r--r--src/usr/hwpf/test/hwpftest.mk33
-rw-r--r--src/usr/hwpf/test/hwpisteperrortest.H289
-rw-r--r--src/usr/hwpf/test/makefile42
-rw-r--r--src/usr/hwpf/test/occAccessTest.H325
-rw-r--r--src/usr/hwpf/test/runtime/makefile39
-rw-r--r--src/usr/hwpf/test/runtime/rt_occtest.H107
16 files changed, 0 insertions, 8182 deletions
diff --git a/src/usr/hwpf/test/fapiAttrTest.C b/src/usr/hwpf/test/fapiAttrTest.C
deleted file mode 100644
index fa1575812..000000000
--- a/src/usr/hwpf/test/fapiAttrTest.C
+++ /dev/null
@@ -1,585 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapiAttrTest.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
-/* */
-/* 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 fapiAttrTest.C
- *
- * @brief Implements FAPI Attribute unit test functions.
- *
- * This is provided by FAPI and can be pulled into any unit test framework.
- * Each unit test returns 0 for success, else error value.
- */
-
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 02/15/2013 Created. Ported from HWP.
- */
-
-#include <fapi.H>
-
-namespace fapi
-{
-
-//******************************************************************************
-// attrTest1. Test ATTR_SCRATCH_UINT8_1
-//******************************************************************************
-uint32_t attrTest1()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint8_t l_uint8 = 0x87;
-
- // Test set
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest1: ATTR_SCRATCH_UINT8_1. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- l_uint8 = 8;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest1: ATTR_SCRATCH_UINT8_1. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- if (l_uint8 != 0x87)
- {
- FAPI_ERR("attrTest1: ATTR_SCRATCH_UINT8_1. GET returned %d (3)",
- l_uint8);
- l_result = 3;
- break;
- }
-
- // Set to zero
- l_uint8 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest1: ATTR_SCRATCH_UINT8_1. Error from SET (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest1: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest2. Test ATTR_SCRATCH_UINT32_1
-//******************************************************************************
-uint32_t attrTest2()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint32_t l_uint32 = 0x80000001;
-
- // Test set
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest2: ATTR_SCRATCH_UINT32_1. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- l_uint32 = 8;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest2: ATTR_SCRATCH_UINT32_1. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- if (l_uint32 != 0x80000001)
- {
- FAPI_ERR("attrTest2: ATTR_SCRATCH_UINT32_1. GET returned %d (3)",
- l_uint32);
- l_result = 3;
- break;
- }
-
- // Set to zero
- l_uint32 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest2: ATTR_SCRATCH_UINT32_1. Error from SET (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest2: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest3. Test ATTR_SCRATCH_UINT64_1
-//******************************************************************************
-uint32_t attrTest3()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint64_t l_uint64 = 3;
-
- // Test set
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest3: ATTR_SCRATCH_UINT64_1. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- l_uint64 = 8;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest3: ATTR_SCRATCH_UINT64_1. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- if (l_uint64 != 3)
- {
- FAPI_ERR("attrTest3: ATTR_SCRATCH_UINT64_1. GET returned %d (3)",
- static_cast<uint32_t>(l_uint64));
- l_result = 3;
- break;
- }
-
- // Set to zero
- l_uint64 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest3: ATTR_SCRATCH_UINT64_1. Error from SET (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest3: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest4. Test ATTR_SCRATCH_UINT8_ARRAY_1
-//******************************************************************************
-uint32_t attrTest4()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint8_t l_uint8array1[32];
-
- // Test set
- for (uint32_t i = 0; i < 32; i++)
- {
- l_uint8array1[i] = i + 1;
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest4: ATTR_SCRATCH_UINT8_ARRAY_1. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- for (uint32_t i = 0; i < 32; i++)
- {
- l_uint8array1[i] = 0;
- }
-
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest4: ATTR_SCRATCH_UINT8_ARRAY_1. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- for (uint32_t i = 0; i < 32; i++)
- {
- if (l_uint8array1[i] != (i + 1))
- {
- FAPI_ERR("attrTest4: ATTR_SCRATCH_UINT8_ARRAY_1. GET [%d] returned %d (3)",
- i, l_uint8array1[i]);
- l_result = 3;
- break;
- }
- }
-
- if (l_result)
- {
- break;
- }
-
- // Set to zero
- for (uint32_t i = 0; i < 32; i++)
- {
- l_uint8array1[i] = 0;
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest4: ATTR_SCRATCH_UINT8_ARRAY_1. Error from SET (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest4: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest5. Test ATTR_SCRATCH_UINT32_ARRAY_2
-//******************************************************************************
-uint32_t attrTest5()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint32_t l_uint32 = 1;
- uint32_t l_uint32array2[2][3];
-
- // Test set
- l_uint32 = 1;
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 3; j++)
- {
- l_uint32array2[i][j] = l_uint32++;
- }
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest5: ATTR_SCRATCH_UINT32_ARRAY_2. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 3; j++)
- {
- l_uint32array2[i][j] = 0;
- }
- }
-
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest5: ATTR_SCRATCH_UINT32_ARRAY_2. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- l_uint32 = 1;
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 3; j++)
- {
- if (l_uint32array2[i][j] != l_uint32++)
- {
- FAPI_ERR("attrTest5: ATTR_SCRATCH_UINT32_ARRAY_2. GET [%d:%d] returned %d (3)",
- i, j, l_uint32array2[i][j]);
- l_result = 3;
- break;
- }
- }
- if (l_result)
- {
- break;
- }
- }
-
- if (l_result)
- {
- break;
- }
-
- // Set to zero
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 3; j++)
- {
- l_uint32array2[i][j]= 0;
- }
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest5: ATTR_SCRATCH_UINT32_ARRAY_2. Error from SET (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest5: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest6. Test ATTR_SCRATCH_UINT64_ARRAY_2
-//******************************************************************************
-uint32_t attrTest6()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint64_t l_uint64 = 1;
- uint64_t l_uint64array2[2][2];
-
- // Test set
- l_uint64 = 1;
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 2; j++)
- {
- l_uint64array2[i][j] = l_uint64++;
- }
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest6: ATTR_SCRATCH_UINT64_ARRAY_2. Error from SET (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 2; j++)
- {
- l_uint64array2[i][j] = 0;
- }
- }
-
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest6: ATTR_SCRATCH_UINT64_ARRAY_2. Error from GET (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- l_uint64 = 1;
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 2; j++)
- {
- if (l_uint64array2[i][j] != l_uint64++)
- {
- FAPI_ERR("attrTest6: ATTR_SCRATCH_UINT64_ARRAY_2. GET [%d:%d] returned %d (3)",
- i, j, static_cast<uint32_t>(l_uint64array2[i][j]));
- l_result = 3;
- break;
- }
- }
- if (l_result)
- {
- break;
- }
- }
-
- if (l_result)
- {
- break;
- }
-
- // Set to zero
- for (uint32_t i = 0; i < 2; i++)
- {
- for (uint32_t j = 0; j < 2; j++)
- {
- l_uint64array2[i][j]= 0;
- }
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest6: ATTR_SCRATCH_UINT64_ARRAY_2. Error from SET (4)");
- l_result = 4;
- break;
- }
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest6: unit test success");
- }
- return l_result;
-}
-
-//******************************************************************************
-// attrTest7. Test setting and getting an enum value from a scratch attribute
-//******************************************************************************
-uint32_t attrTest7()
-{
- uint32_t l_result = 0;
-
- do
- {
- fapi::ReturnCode l_rc;
-
- uint64_t l_uint64 = fapi::ENUM_ATTR_SCRATCH_UINT64_2_VAL_C;
-
- // Test set
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest7: ATTR_SCRATCH_UINT64_2. Error from SET (enum) (1)");
- l_result = 1;
- break;
- }
-
- // Test get
- l_uint64 = 0;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest7: ATTR_SCRATCH_UINT64_2. Error from GET (enum) (2)");
- l_result = 2;
- break;
- }
-
- // Check value
- if (l_uint64 != fapi::ENUM_ATTR_SCRATCH_UINT64_2_VAL_C)
- {
- FAPI_ERR("attrTest7: ATTR_SCRATCH_UINT64_2. GET returned %d (enum) (3)",
- static_cast<uint32_t>(l_uint64));
- l_result = 3;
- break;
- }
-
- // Set to zero
- l_uint64 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
- if (l_rc)
- {
- fapiLogError(l_rc);
- FAPI_ERR("attrTest7: ATTR_SCRATCH_UINT64_2. Error from SET (enum2) (4)");
- l_result = 4;
- break;
- }
-
- } while (0);
-
- if (!l_result)
- {
- FAPI_INF("attrTest7: unit test success");
- }
- return l_result;
-}
-
-}
diff --git a/src/usr/hwpf/test/fapiRcTest.C b/src/usr/hwpf/test/fapiRcTest.C
deleted file mode 100755
index f82de7c10..000000000
--- a/src/usr/hwpf/test/fapiRcTest.C
+++ /dev/null
@@ -1,1753 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapiRcTest.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
-/* [+] 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 */
-// $Id: fapiRcTest.C,v 1.16 2015/03/18 19:41:51 pragupta Exp $
-/**
- * @file fapiTargetTest.C
- *
- * @brief Implements Target class unit test functions.
- */
-
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 04/13/2011 Created.
- * mjjones 07/26/2011 Added more tests
- * mjjones 09/23/2011 Updated test for ErrorInfo
- * mjjones 01/13/2012 Use new ReturnCode interfaces
- * mjjones 08/14/2012 Use new ErrorInfo structures
- * mjjones 03/28/2013 Added proc-callout tests
- * mjjones 03/28/2013 Added children-cdg tests
- * sangeet2 29/01/2015 Added testcase rcTest18
- */
-
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
-#ifdef fips
-#include <srcisrc.H>
-#endif
-
-namespace fapi
-{
-
-//******************************************************************************
-// rcTest1. Ensures that the ReturnCode default constructor works
-//******************************************************************************
-uint32_t rcTest1()
-{
- uint32_t l_result = 0;
-
- // Create ReturnCode using default constructor
- ReturnCode l_rc;
-
- // Ensure that the embedded return code is success
- if (l_rc != FAPI_RC_SUCCESS)
- {
- FAPI_ERR("rcTest1. Code is 0x%x, expected success",
- static_cast<uint32_t>(l_rc));
- l_result = 1;
- }
- else
- {
- // Ensure that ok function works
- if (l_rc.ok() == false)
- {
- FAPI_ERR("rcTest1. ok returned false");
- l_result = 2;
- }
- else
- {
- // Ensure that testing l_rc works
- if (l_rc)
- {
- FAPI_ERR("rcTest1. testing rc returned true");
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTest1. Success!");
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest2. Ensures that the ReturnCode creator reflects the return code
-//******************************************************************************
-uint32_t rcTest2()
-{
- uint32_t l_result = 0;
-
- // Create ReturnCode using default constructor
- ReturnCode l_rc;
-
- // Set the return code to a FAPI code
- l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
-
- // Ensure that the creator is FAPI
- ReturnCode::returnCodeCreator l_creator = l_rc.getCreator();
-
- if (l_creator != ReturnCode::CREATOR_FAPI)
- {
- FAPI_ERR("rcTest2. Creator is 0x%x, expected FAPI", l_creator);
- l_result = 1;
- }
- else
- {
- // Set the return code to a PLAT code
- l_rc.setPlatError(NULL);
-
- // Ensure that the creator is PLAT
- l_creator = l_rc.getCreator();
-
- if (l_creator != ReturnCode::CREATOR_PLAT)
- {
- FAPI_ERR("rcTest2. Creator is 0x%x, expected PLAT", l_creator);
- l_result = 2;
- }
- else
- {
- // Set the return code to a HWP code (intentionally use function
- // that does not add error information).
- l_rc._setHwpError(RC_TEST_ERROR_A);
-
- // Ensure that the creator is HWP
- l_creator = l_rc.getCreator();
-
- if (l_creator != ReturnCode::CREATOR_HWP)
- {
- FAPI_ERR("rcTest2. Creator is 0x%x, expected HWP", l_creator);
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTest2. Success!");
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest3. Ensures that the ReturnCode constructor works when specifying a
-// return code
-//******************************************************************************
-uint32_t rcTest3()
-{
- uint32_t l_result = 0;
-
- // Create ReturnCode specifying a return code
- ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
-
- // Ensure that the embedded return code is as expected
- uint32_t l_codeCheck = l_rc;
-
- if (l_codeCheck != FAPI_RC_INVALID_ATTR_GET)
- {
- FAPI_ERR("rcTest3. Code is 0x%x, expected FAPI_RC_INVALID_ATTR_GET",
- l_codeCheck);
- l_result = 1;
- }
- else
- {
- // Ensure that ok function returns false
- if (l_rc.ok())
- {
- FAPI_ERR("rcTest3. ok returned true");
- l_result = 2;
- }
- else
- {
- // Ensure that testing l_rc works
- if (!l_rc)
- {
- FAPI_ERR("rcTest3. testing rc returned false");
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTest3. Success!");
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest4. Ensures that the comparison operators work (comparing with another
-// ReturnCode)
-//******************************************************************************
-uint32_t rcTest4()
-{
- uint32_t l_result = 0;
-
- // Create similar ReturnCodes
- ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
- ReturnCode l_rc2(FAPI_RC_INVALID_ATTR_GET);
-
- // Ensure that the equality comparison returns true
- if (!(l_rc == l_rc2))
- {
- FAPI_ERR("rcTest4. 1. Equality comparison false");
- l_result = 1;
- }
- else
- {
- // Ensure that the inequality comparison returns false
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest4. 2. Inequality comparison true");
- l_result = 2;
- }
- else
- {
- // Change the code of l_rc2
- l_rc2.setFapiError(FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Ensure that the equality comparison returns false
- if (l_rc == l_rc2)
- {
- FAPI_ERR("rcTest4. 3. Equality comparison true");
- l_result = 3;
- }
- else
- {
- // Ensure that the inequality comparison returns true
- if (!(l_rc != l_rc2))
- {
- FAPI_ERR("rcTest4. 4. Inequality comparison false");
- l_result = 4;
- }
- else
- {
- FAPI_INF("rcTest4. Success!");
- }
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest5. Ensures that the comparison operators work (comparing with a return
-// code value)
-//******************************************************************************
-uint32_t rcTest5()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
-
- // Ensure that the equality comparison returns true when comparing to the
- // same return code value
- if (!(l_rc == FAPI_RC_INVALID_ATTR_GET))
- {
- FAPI_ERR("rcTest5. 1. Equality comparison false");
- l_result = 1;
- }
- else
- {
- // Ensure that the inequality comparison returns false when comparing to
- // the same return code value
- if (l_rc != FAPI_RC_INVALID_ATTR_GET)
- {
- FAPI_ERR("rcTest5. 2. Inequality comparison true");
- l_result = 2;
- }
- else
- {
- // Ensure that the equality comparison returns false when comparing
- // to a different return code value
- if (l_rc == FAPI_RC_PLAT_ERR_SEE_DATA)
- {
- FAPI_ERR("rcTest5. 3. Equality comparison true");
- l_result = 3;
- }
- else
- {
- // Ensure that the inequality comparison returns true when
- // comparing to a different return code value
- if (!(l_rc != FAPI_RC_PLAT_ERR_SEE_DATA))
- {
- FAPI_ERR("rcTest5. 4. Inequality comparison false");
- l_result = 4;
- }
- else
- {
- FAPI_INF("rcTest5. Success!");
- }
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest6. Ensures that the getPlatData and releasePlatData functions work when
-// there is no attached data
-//******************************************************************************
-uint32_t rcTest6()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc(FAPI_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("rcTest6. 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("rcTest6. releasePlatData did not return NULL");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTest6. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest7. Ensures that the getPlatData function works when there is attached
-// data
-//******************************************************************************
-uint32_t rcTest7()
-{
- 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("rcTest7. 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("rcTest7. 2. getPlatData returned unexpected data ptr");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTest7. Success!");
- }
- }
-
- // Release the data to avoid ReturnCode from deleting in on destruction
- l_pMyDataCheck = l_rc.releasePlatData();
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest8. Ensures that the releasePlatData function works when there is
-// attached data
-//******************************************************************************
-uint32_t rcTest8()
-{
- 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("rcTest8. getPlatData returned 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("rcTest8. 2. getPlatData returned non NULL ptr");
- l_result = 2;
- }
- else
- {
- FAPI_INF("rcTest8. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest9. Ensures that the copy constructor works when there is attached
-// PlatData and that the getPlatData function works
-//******************************************************************************
-uint32_t rcTest9()
-{
- 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);
-
- // Create a ReturnCode using the copy constructor
- ReturnCode l_rc2(l_rc);
-
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest9. ReturnCodes differ");
- l_result = 1;
- }
- else
- {
- // Ensure that getPlatData retrieves the PlatData from l_rc
- void * l_pMyDataCheck = l_rc.getPlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTest9. 1. getPlatData returned unexpected data ptr");
- l_result = 2;
- }
- else
- {
- // Ensure that getPlatData retrieves the PlatData from l_rc2
- l_pMyDataCheck = NULL;
- l_pMyDataCheck = l_rc2.getPlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTest9. 2. getPlatData returned unexpected data ptr");
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTest9. Success!");
- }
- }
- }
-
- // 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;
-}
-
-//******************************************************************************
-// rcTest10. Ensures that the assignment operator works when there is attached
-// PlatData and that the releasePlatData function works
-//******************************************************************************
-uint32_t rcTest10()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
-
- // Assign PlatData. Note that this should really be an errlHndl_t, because
- // the PLAT 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);
-
- // Create a ReturnCode using the assignment operator
- ReturnCode l_rc2;
- l_rc2 = l_rc;
-
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest10. ReturnCodes differ");
- l_result = 1;
- }
- else
- {
- // Ensure that releasePlatData retrieves the PlatData from l_rc
- void * l_pMyDataCheck = l_rc.releasePlatData();
-
- if (l_pMyDataCheck != l_pMyData)
- {
- FAPI_ERR("rcTest10. releasePlatData 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("rcTest10. releasePlatData returned non NULL ptr");
- l_result = 3;
- }
- else
- {
- FAPI_INF("rcTest10. Success!");
- }
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest11. Ensures that the getErrorInfo function works when there is no
-// ErrorInfo
-//******************************************************************************
-uint32_t rcTest11()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
-
- // Ensure that the getErrorInfo function returns NULL
- const ErrorInfo * l_pErrInfo =
- reinterpret_cast<const ErrorInfo *> (0x12345678);
-
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo != NULL)
- {
- FAPI_ERR("rcTest11. getErrorInfo did not return NULL");
- l_result = 1;
- }
- else
- {
- FAPI_INF("rcTest11. Success!");
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest12. Ensures that the getErrorInfo function works when there is
-// ErrorInfo
-//******************************************************************************
-uint32_t rcTest12()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
- l_rc.setPlatError(NULL, FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Create fake targets
- uint32_t l_targetHandle = 3;
- Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
- uint32_t l_target2Handle = 4;
- Target l_target2(TARGET_TYPE_PROC_CHIP, &l_target2Handle);
-
- // Create some FFDC
- uint8_t l_ffdc = 0x12;
-
- // Add error information to the ReturnCode, the data is the same as that
- // produced by the fapiParseErrorInfo.pl script in fapiHwpErrorInfo.H
- const void * l_objects[] = {&l_ffdc, &l_target, &l_target2};
- fapi::ReturnCode::ErrorInfoEntry l_entries[7];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_FFDC;
- l_entries[0].ffdc.iv_ffdcObjIndex = 0;
- l_entries[0].ffdc.iv_ffdcId = 0x22334455;
- l_entries[0].ffdc.iv_ffdcSize =
- fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc);
- l_entries[1].iv_type = fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT;
- l_entries[1].proc_callout.iv_procedure = fapi::ProcedureCallouts::CODE;
- l_entries[1].proc_callout.iv_calloutPriority =
- fapi::CalloutPriorities::MEDIUM;
- l_entries[2].iv_type = fapi::ReturnCode::EI_TYPE_BUS_CALLOUT;
- l_entries[2].bus_callout.iv_endpoint1ObjIndex = 1;
- l_entries[2].bus_callout.iv_endpoint2ObjIndex = 2;
- l_entries[2].bus_callout.iv_calloutPriority =
- fapi::CalloutPriorities::MEDIUM;
- l_entries[3].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[3].target_cdg.iv_targetObjIndex = 1;
- l_entries[3].target_cdg.iv_callout = 1;
- l_entries[3].target_cdg.iv_deconfigure = 1;
- l_entries[3].target_cdg.iv_gard = 0;
- l_entries[3].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::HIGH;
- l_entries[4].iv_type = fapi::ReturnCode::EI_TYPE_CHILDREN_CDG;
- l_entries[4].children_cdg.iv_parentObjIndex = 1;
- l_entries[4].children_cdg.iv_callout = 0;
- l_entries[4].children_cdg.iv_deconfigure = 1;
- l_entries[4].children_cdg.iv_childType = fapi::TARGET_TYPE_ABUS_ENDPOINT;
- l_entries[4].children_cdg.iv_gard = 0;
- l_entries[4].children_cdg.iv_calloutPriority =
- fapi::CalloutPriorities::HIGH;
- l_entries[5].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT;
- l_entries[5].hw_callout.iv_hw = fapi::HwCallouts::MEM_REF_CLOCK;
- l_entries[5].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW;
- l_entries[5].hw_callout.iv_refObjIndex = 0xff;
- l_entries[5].hw_callout.iv_objPosIndex = 0;
- l_entries[6].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT;
- l_entries[6].hw_callout.iv_hw = fapi::HwCallouts::FLASH_CONTROLLER_PART;
- l_entries[6].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW;
- l_entries[6].hw_callout.iv_refObjIndex = 0xff;
- l_entries[6].hw_callout.iv_objPosIndex = 0;
-
- l_rc.addErrorInfo(l_objects, l_entries, 7);
-
- do
- {
- // Check that the Error Info can be retrieved
- const ErrorInfo * l_pErrInfo = NULL;
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo == NULL)
- {
- FAPI_ERR("rcTest12. getErrorInfo returned NULL");
- l_result = 1;
- break;
- }
-
- // Check the FFDC error information
- if (l_pErrInfo->iv_ffdcs.size() != 1)
- {
- FAPI_ERR("rcTest12. %d FFDCs", l_pErrInfo->iv_ffdcs.size());
- l_result = 2;
- break;
- }
-
- uint32_t l_size = 0;
- const void * l_pFfdc = NULL;
-
- l_pFfdc = l_pErrInfo->iv_ffdcs[0]->getData(l_size);
-
- if (l_size != sizeof(l_ffdc))
- {
- FAPI_ERR("rcTest12. FFDC size is %d", l_size);
- l_result = 3;
- break;
- }
-
- const uint8_t * l_pFfdcCheck = static_cast<const uint8_t *>(l_pFfdc);
- if (*l_pFfdcCheck != 0x12)
- {
- FAPI_ERR("rcTest12. FFDC is 0x%x", *l_pFfdcCheck);
- l_result = 4;
- break;
- }
-
- // Check the callout/deconfigure/gard error information
- if (l_pErrInfo->iv_CDGs.size() != 1)
- {
- FAPI_ERR("rcTest12. %d CDGs", l_pErrInfo->iv_CDGs.size());
- l_result = 5;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_target != l_target)
- {
- FAPI_ERR("rcTest12. CDG target mismatch");
- l_result = 6;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_callout != true)
- {
- FAPI_ERR("rcTest12. callout not set");
- l_result = 7;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_calloutPriority !=
- CalloutPriorities::HIGH)
- {
- FAPI_ERR("rcTest12. CDG callout priority mismatch (%d)",
- l_pErrInfo->iv_CDGs[0]->iv_calloutPriority);
- l_result = 8;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_deconfigure != true)
- {
- FAPI_ERR("rcTest12. deconfigure not set");
- l_result = 9;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_gard != false)
- {
- FAPI_ERR("rcTest12. GARD set");
- l_result = 10;
- break;
- }
-
- // Additional procedure called out due to Bus Callout
- if (l_pErrInfo->iv_procedureCallouts.size() != 2)
- {
- FAPI_ERR("rcTest12. %d proc-callouts",
- l_pErrInfo->iv_procedureCallouts.size());
- l_result = 11;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[0]->iv_procedure !=
- ProcedureCallouts::CODE)
- {
- FAPI_ERR("rcTest12. procedure callout[0] mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[0]->iv_procedure);
- l_result = 12;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[0]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest12. procedure callout[0] priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[0]->iv_calloutPriority);
- l_result = 13;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[1]->iv_procedure !=
- ProcedureCallouts::BUS_CALLOUT)
- {
- FAPI_ERR("rcTest12. procedure callout[1] mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[1]->iv_procedure);
- l_result = 14;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[1]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest12. procedure callout[1] priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[1]->iv_calloutPriority);
- l_result = 15;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts.size() != 1)
- {
- FAPI_ERR("rcTest12. %d bus-callouts",
- l_pErrInfo->iv_busCallouts.size());
- l_result = 16;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_target1 != l_target)
- {
- FAPI_ERR("rcTest12. bus target mismatch 1");
- l_result = 17;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_target2 != l_target2)
- {
- FAPI_ERR("rcTest12. bus target mismatch 2");
- l_result = 18;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_calloutPriority !=
- CalloutPriorities::LOW)
- {
- FAPI_ERR("rcTest12. bus callout priority mismatch (%d)",
- l_pErrInfo->iv_busCallouts[0]->iv_calloutPriority);
- l_result = 19;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs.size() != 1)
- {
- FAPI_ERR("rcTest12. %d children-cdgs",
- l_pErrInfo->iv_childrenCDGs.size());
- l_result = 20;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_parent != l_target)
- {
- FAPI_ERR("rcTest12. parent chip mismatch");
- l_result = 21;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_childType !=
- fapi::TARGET_TYPE_ABUS_ENDPOINT)
- {
- FAPI_ERR("rcTest12. child type mismatch (0x%08x)",
- l_pErrInfo->iv_childrenCDGs[0]->iv_childType);
- l_result = 22;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_calloutPriority !=
- CalloutPriorities::HIGH)
- {
- FAPI_ERR("rcTest12. child cdg priority mismatch (%d)",
- l_pErrInfo->iv_childrenCDGs[0]->iv_calloutPriority);
- l_result = 23;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_callout != false)
- {
- FAPI_ERR("rcTest12. child cdg callout set");
- l_result = 24;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_deconfigure != true)
- {
- FAPI_ERR("rcTest12. child cdg deconfigure not set");
- l_result = 25;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_gard != false)
- {
- FAPI_ERR("rcTest12. child cdg GARD set");
- l_result = 26;
- break;
- }
-
- if (l_pErrInfo->iv_hwCallouts.size() != 2)
- {
- FAPI_ERR("rcTest12. %d hw-callouts",
- l_pErrInfo->iv_hwCallouts.size());
- l_result = 27;
- break;
- }
-
- if (l_pErrInfo->iv_hwCallouts[0]->iv_hw !=
- HwCallouts::MEM_REF_CLOCK)
- {
- FAPI_ERR("rcTest12. hw callout mismatch (%d)",
- l_pErrInfo->iv_hwCallouts[0]->iv_hw);
- l_result = 28;
- break;
- }
-
- if (l_pErrInfo->iv_hwCallouts[0]->iv_calloutPriority !=
- CalloutPriorities::LOW)
- {
- FAPI_ERR("rcTest12. hw callout priority mismatch (%d)",
- l_pErrInfo->iv_hwCallouts[0]->iv_calloutPriority);
- l_result = 29;
- break;
- }
-
- FAPI_INF("rcTest12. Success!");
- }
- while(0);
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest13. Ensures that the copy constructor works when there is ErrorInfo
-//******************************************************************************
-uint32_t rcTest13()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
- l_rc.setPlatError(NULL, FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Create a DIMM target
- uint32_t l_targetHandle = 3;
- Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
-
- // Add error information to the ReturnCode
- const void * l_objects[] = {&l_target};
- fapi::ReturnCode::ErrorInfoEntry l_entries[1];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[0].target_cdg.iv_targetObjIndex = 0;
- l_entries[0].target_cdg.iv_callout = 0;
- l_entries[0].target_cdg.iv_deconfigure = 0;
- l_entries[0].target_cdg.iv_gard = 1;
- l_entries[0].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::LOW;
-
- l_rc.addErrorInfo(l_objects, l_entries, 1);
-
- // Create a ReturnCode using the copy constructor
- ReturnCode l_rc2(l_rc);
-
- do
- {
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest13. ReturnCodes differ");
- l_result = 1;
- break;
- }
-
- // Ensure that getErrorInfo returns correct information from l_rc
- const ErrorInfo * l_pErrInfo = NULL;
-
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo == NULL)
- {
- FAPI_ERR("rcTest13. getErrorInfo returned NULL");
- l_result = 2;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs.size() != 1)
- {
- FAPI_ERR("rcTest13. %d CDGs", l_pErrInfo->iv_CDGs.size());
- l_result = 3;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_target != l_target)
- {
- FAPI_ERR("rcTest13. CDG target mismatch");
- l_result = 4;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_gard != true)
- {
- FAPI_ERR("rcTest13. GARD not set");
- l_result = 5;
- break;
- }
-
- // Ensure that getErrorInfo from l_rc2 returns the same pointer
- const ErrorInfo * l_pErrInfo2 = l_rc2.getErrorInfo();
-
- if (l_pErrInfo != l_pErrInfo2)
- {
- FAPI_ERR("rcTest13. error info mismatch");
- l_result = 5;
- break;
- }
-
- FAPI_INF("rcTest13. Success!");
- }
- while(0);
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest14. Ensures that the assignment operator works when there ErrorInfo
-//******************************************************************************
-uint32_t rcTest14()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
- l_rc.setPlatError(NULL, FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Create a DIMM target
- uint32_t l_targetHandle = 3;
- Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
-
- // Add error information to the ReturnCode
- const void * l_objects[] = {&l_target};
- fapi::ReturnCode::ErrorInfoEntry l_entries[1];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[0].target_cdg.iv_targetObjIndex = 0;
- l_entries[0].target_cdg.iv_callout = 0;
- l_entries[0].target_cdg.iv_deconfigure = 0;
- l_entries[0].target_cdg.iv_gard = 1;
- l_entries[0].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::LOW;
-
- l_rc.addErrorInfo(l_objects, l_entries, 1);
-
- // Create a ReturnCode using the assignment operator
- ReturnCode l_rc2;
- l_rc2 = l_rc;
-
- do
- {
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest14. ReturnCodes differ");
- l_result = 1;
- break;
- }
-
- // Ensure that getErrorInfo returns correct information from l_rc
- const ErrorInfo * l_pErrInfo = NULL;
-
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo == NULL)
- {
- FAPI_ERR("rcTest14. getErrorInfo returned NULL");
- l_result = 2;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs.size() != 1)
- {
- FAPI_ERR("rcTest14. %d CDGs", l_pErrInfo->iv_CDGs.size());
- l_result = 3;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_target != l_target)
- {
- FAPI_ERR("rcTest14. CDG target mismatch");
- l_result = 4;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_gard != true)
- {
- FAPI_ERR("rcTest14. GARD not set");
- l_result = 5;
- break;
- }
-
- // Ensure that getErrorInfo from l_rc2 returns the same pointer
- const ErrorInfo * l_pErrInfo2 = l_rc2.getErrorInfo();
-
- if (l_pErrInfo != l_pErrInfo2)
- {
- FAPI_ERR("rcTest14. error info mismatch");
- l_result = 5;
- break;
- }
-
- FAPI_INF("rcTest14. Success!");
- }
- while(0);
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest15. Ensures that setting the ReturnCode to success clears ErrorInfo
-//******************************************************************************
-uint32_t rcTest15()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
- l_rc.setPlatError(NULL, FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Create a DIMM target
- uint32_t l_targetHandle = 3;
- Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
-
- // Add error information to the ReturnCode
- const void * l_objects[] = {&l_target};
- fapi::ReturnCode::ErrorInfoEntry l_entries[1];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[0].target_cdg.iv_targetObjIndex = 0;
- l_entries[0].target_cdg.iv_callout = 0;
- l_entries[0].target_cdg.iv_deconfigure = 0;
- l_entries[0].target_cdg.iv_gard = 1;
- l_entries[0].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::LOW;
-
- l_rc.addErrorInfo(l_objects, l_entries, 1);
-
- // Set the ReturnCode to success
- l_rc = FAPI_RC_SUCCESS;
-
- // Check that there is no ErrorInfo
- const ErrorInfo * l_pErrInfo = NULL;
-
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo != NULL)
- {
- FAPI_ERR("rcTest15. getErrorInfo returned NULL");
- l_result = 1;
- }
- else
- {
- FAPI_INF("rcTest15. Success!");
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest16. Ensures that multiple Error Info of each type can be added
-//******************************************************************************
-uint32_t rcTest16()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc;
- l_rc.setPlatError(NULL, FAPI_RC_PLAT_ERR_SEE_DATA);
-
- // Create 2 targets
- uint32_t l_targetHandle = 3;
- Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
-
- uint32_t l_targetHandle2 = 4;
- Target l_target2(TARGET_TYPE_MCS_CHIPLET, &l_targetHandle2);
-
- // Create 2 FFDCs
- uint8_t l_ffdc = 0x12;
- uint32_t l_ffdc2 = 0x12345678;
-
- // Add error information to the ReturnCode
- const void * l_objects[] = {&l_ffdc, &l_ffdc2, &l_target, &l_target2};
- fapi::ReturnCode::ErrorInfoEntry l_entries[10];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_FFDC;
- l_entries[0].ffdc.iv_ffdcObjIndex = 0;
- l_entries[0].ffdc.iv_ffdcId = 0x22334455;
- l_entries[0].ffdc.iv_ffdcSize =
- fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc);
- l_entries[1].iv_type = fapi::ReturnCode::EI_TYPE_FFDC;
- l_entries[1].ffdc.iv_ffdcObjIndex = 1;
- l_entries[1].ffdc.iv_ffdcId = 0x33445566;
- l_entries[1].ffdc.iv_ffdcSize =
- fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc2);
- l_entries[2].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[2].target_cdg.iv_targetObjIndex = 2;
- l_entries[2].target_cdg.iv_callout = 0;
- l_entries[2].target_cdg.iv_deconfigure = 1;
- l_entries[2].target_cdg.iv_gard = 0;
- l_entries[2].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::HIGH;
- l_entries[3].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[3].target_cdg.iv_targetObjIndex = 3;
- 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 = fapi::CalloutPriorities::MEDIUM;
- l_entries[4].iv_type = fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT;
- l_entries[4].proc_callout.iv_procedure = fapi::ProcedureCallouts::CODE;
- l_entries[4].proc_callout.iv_calloutPriority = fapi::CalloutPriorities::MEDIUM;
- l_entries[5].iv_type = fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT;
- l_entries[5].proc_callout.iv_procedure = fapi::ProcedureCallouts::LVL_SUPPORT;
- l_entries[5].proc_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW;
- l_entries[6].iv_type = fapi::ReturnCode::EI_TYPE_BUS_CALLOUT;
- l_entries[6].bus_callout.iv_endpoint1ObjIndex = 2;
- l_entries[6].bus_callout.iv_endpoint2ObjIndex = 3;
- l_entries[6].bus_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW;
- l_entries[7].iv_type = fapi::ReturnCode::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 = fapi::CalloutPriorities::HIGH;
- l_entries[8].iv_type = fapi::ReturnCode::EI_TYPE_CHILDREN_CDG;
- l_entries[8].children_cdg.iv_parentObjIndex = 2;
- l_entries[8].children_cdg.iv_callout = 1;
- l_entries[8].children_cdg.iv_deconfigure = 1;
- l_entries[8].children_cdg.iv_childType = fapi::TARGET_TYPE_ABUS_ENDPOINT;
- l_entries[8].children_cdg.iv_gard = 0;
- l_entries[8].children_cdg.iv_calloutPriority =
- fapi::CalloutPriorities::HIGH;
- l_entries[9].iv_type = fapi::ReturnCode::EI_TYPE_CHILDREN_CDG;
- l_entries[9].children_cdg.iv_parentObjIndex = 3;
- l_entries[9].children_cdg.iv_callout = 1;
- l_entries[9].children_cdg.iv_deconfigure = 0;
- l_entries[9].children_cdg.iv_childType = fapi::TARGET_TYPE_MBA_CHIPLET;
- l_entries[9].children_cdg.iv_gard = 1;
- l_entries[9].children_cdg.iv_calloutPriority =
- fapi::CalloutPriorities::MEDIUM;
-
- l_rc.addErrorInfo(l_objects, l_entries, 10);
-
- do
- {
- // Check that the Error Info can be retrieved
- const ErrorInfo * l_pErrInfo = NULL;
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo == NULL)
- {
- FAPI_ERR("rcTest16. getErrorInfo returned NULL");
- l_result = 1;
- break;
- }
-
- // Check the FFDC error information
- if (l_pErrInfo->iv_ffdcs.size() != 2)
- {
- FAPI_ERR("rcTest16. %d FFDCs", l_pErrInfo->iv_ffdcs.size());
- l_result = 2;
- break;
- }
-
- uint32_t l_size = 0;
- const void * l_pFfdc = NULL;
-
- l_pFfdc = l_pErrInfo->iv_ffdcs[0]->getData(l_size);
-
- if (l_size != sizeof(l_ffdc))
- {
- FAPI_ERR("rcTest16. FFDC[0] size is %d", l_size);
- l_result = 3;
- break;
- }
-
- const uint8_t * l_pFfdcCheck = static_cast<const uint8_t *>(l_pFfdc);
- if (*l_pFfdcCheck != 0x12)
- {
- FAPI_ERR("rcTest16. FFDC[0] is 0x%x", *l_pFfdcCheck);
- l_result = 4;
- break;
- }
-
- l_pFfdc = l_pErrInfo->iv_ffdcs[1]->getData(l_size);
-
- if (l_size != sizeof(l_ffdc2))
- {
- FAPI_ERR("rcTest16. FFDC[1] size is %d", l_size);
- l_result = 5;
- break;
- }
-
- const uint32_t * l_pFfdc2Check = static_cast<const uint32_t *>(l_pFfdc);
- if (*l_pFfdc2Check != 0x12345678)
- {
- FAPI_ERR("rcTest16. FFDC[1] is 0x%x", *l_pFfdc2Check);
- l_result = 6;
- break;
- }
-
- // Check the callout/deconfigure/GARD error information
- if (l_pErrInfo->iv_CDGs.size() != 2)
- {
- FAPI_ERR("rcTest16. %d CDGs", l_pErrInfo->iv_CDGs.size());
- l_result = 7;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_target != l_target)
- {
- FAPI_ERR("rcTest16. CDG[0] target mismatch");
- l_result = 8;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_callout != false)
- {
- FAPI_ERR("rcTest16. CDG[0] callout set");
- l_result = 9;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_calloutPriority !=
- CalloutPriorities::HIGH)
- {
- FAPI_ERR("rcTest16. CDG[0] callout priority mismatch");
- l_result = 10;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_deconfigure != true)
- {
- FAPI_ERR("rcTest16. CDG[0] deconfigure not set");
- l_result = 11;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_gard != false)
- {
- FAPI_ERR("rcTest16. CDG[0] gard set");
- l_result = 12;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[1]->iv_target != l_target2)
- {
- FAPI_ERR("rcTest16. CDG[1] target mismatch");
- l_result = 13;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[1]->iv_callout != false)
- {
- FAPI_ERR("rcTest16. CDG[0] callout set");
- l_result = 14;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[1]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest16. CDG[1] callout priority mismatch");
- l_result = 15;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[1]->iv_deconfigure != false)
- {
- FAPI_ERR("rcTest16. CDG[1] deconfigure set");
- l_result = 16;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[1]->iv_gard != true)
- {
- FAPI_ERR("rcTest16. CDG[1] gard not set");
- l_result = 17;
- break;
- }
-
- // Additional procedures called out due to Bus Callout
- if (l_pErrInfo->iv_procedureCallouts.size() != 4)
- {
- FAPI_ERR("rcTest16. %d proc-callouts",
- l_pErrInfo->iv_procedureCallouts.size());
- l_result = 18;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[0]->iv_procedure !=
- ProcedureCallouts::CODE)
- {
- FAPI_ERR("rcTest16. procedure[0] callout mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[0]->iv_procedure);
- l_result = 19;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[0]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest16. procedure[0] callout priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[0]->iv_calloutPriority);
- l_result = 20;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[1]->iv_procedure !=
- ProcedureCallouts::LVL_SUPPORT)
- {
- FAPI_ERR("rcTest16. procedure[1] callout mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[1]->iv_procedure);
- l_result = 21;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[1]->iv_calloutPriority !=
- CalloutPriorities::LOW)
- {
- FAPI_ERR("rcTest16. procedure[1] callout priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[1]->iv_calloutPriority);
- l_result = 22;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[2]->iv_procedure !=
- ProcedureCallouts::BUS_CALLOUT)
- {
- FAPI_ERR("rcTest16. procedure[2] callout mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[2]->iv_procedure);
- l_result = 23;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[2]->iv_calloutPriority !=
- CalloutPriorities::LOW)
- {
- FAPI_ERR("rcTest16. procedure[2] callout priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[2]->iv_calloutPriority);
- l_result = 24;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[3]->iv_procedure !=
- ProcedureCallouts::BUS_CALLOUT)
- {
- FAPI_ERR("rcTest16. procedure[3] callout mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[3]->iv_procedure);
- l_result = 25;
- break;
- }
-
- if (l_pErrInfo->iv_procedureCallouts[3]->iv_calloutPriority !=
- CalloutPriorities::HIGH)
- {
- FAPI_ERR("rcTest16. procedure[3] callout priority mismatch (%d)",
- l_pErrInfo->iv_procedureCallouts[3]->iv_calloutPriority);
- l_result = 26;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts.size() != 2)
- {
- FAPI_ERR("rcTest16. %d bus-callouts",
- l_pErrInfo->iv_busCallouts.size());
- l_result = 27;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_target1 != l_target)
- {
- FAPI_ERR("rcTest16. bus target mismatch 1");
- l_result = 28;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_target2 != l_target2)
- {
- FAPI_ERR("rcTest16. bus target mismatch 2");
- l_result = 29;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[0]->iv_calloutPriority !=
- CalloutPriorities::LOW)
- {
- FAPI_ERR("rcTest16. bus callout priority mismatch 1 (%d)",
- l_pErrInfo->iv_busCallouts[0]->iv_calloutPriority);
- l_result = 30;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[1]->iv_target1 != l_target)
- {
- FAPI_ERR("rcTest16. bus target mismatch 3");
- l_result = 31;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[1]->iv_target2 != l_target2)
- {
- FAPI_ERR("rcTest16. bus target mismatch 4");
- l_result = 32;
- break;
- }
-
- if (l_pErrInfo->iv_busCallouts[1]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest16. bus callout priority mismatch 2 (%d)",
- l_pErrInfo->iv_busCallouts[1]->iv_calloutPriority);
- l_result = 33;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs.size() != 2)
- {
- FAPI_ERR("rcTest16. %d children-cdgs",
- l_pErrInfo->iv_childrenCDGs.size());
- l_result = 34;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_parent != l_target)
- {
- FAPI_ERR("rcTest16. parent chip mismatch 1");
- l_result = 35;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_childType !=
- fapi::TARGET_TYPE_ABUS_ENDPOINT)
- {
- FAPI_ERR("rcTest16. child type mismatch 1 (0x%08x)",
- l_pErrInfo->iv_childrenCDGs[0]->iv_childType);
- l_result = 36;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_calloutPriority !=
- CalloutPriorities::HIGH)
- {
- FAPI_ERR("rcTest16. child cdg priority mismatch 1 (%d)",
- l_pErrInfo->iv_childrenCDGs[0]->iv_calloutPriority);
- l_result = 37;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_callout != true)
- {
- FAPI_ERR("rcTest16. child cdg callout not set 1");
- l_result = 38;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_deconfigure != true)
- {
- FAPI_ERR("rcTest16. child cdg deconfigure not set 1");
- l_result = 39;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[0]->iv_gard != false)
- {
- FAPI_ERR("rcTest16. child cdg GARD set 1");
- l_result = 40;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[1]->iv_childType !=
- fapi::TARGET_TYPE_MBA_CHIPLET)
- {
- FAPI_ERR("rcTest16. child type mismatch 2 (0x%08x)",
- l_pErrInfo->iv_childrenCDGs[1]->iv_childType);
- l_result = 41;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[1]->iv_calloutPriority !=
- CalloutPriorities::MEDIUM)
- {
- FAPI_ERR("rcTest16. child cdg priority mismatch 2 (%d)",
- l_pErrInfo->iv_childrenCDGs[1]->iv_calloutPriority);
- l_result = 42;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[1]->iv_callout != true)
- {
- FAPI_ERR("rcTest16. child cdg callout not set 2");
- l_result = 43;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[1]->iv_deconfigure != false)
- {
- FAPI_ERR("rcTest16. child cdg deconfigure set 2");
- l_result = 44;
- break;
- }
-
- if (l_pErrInfo->iv_childrenCDGs[1]->iv_gard != true)
- {
- FAPI_ERR("rcTest16. child cdg GARD not set 2");
- l_result = 45;
- break;
- }
-
- FAPI_INF("rcTest16. Success!");
- }
- while(0);
-
- return l_result;
-}
-
-//******************************************************************************
-// rcTest17. Ensures that static_cast can be applied to a ReturnCode
-//******************************************************************************
-uint32_t rcTest17()
-{
- uint32_t l_result = 0;
-
- // Create a ReturnCode
- ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
-
- uint32_t l_check = static_cast<uint32_t>(l_rc);
-
- if (l_check != FAPI_RC_INVALID_ATTR_GET)
- {
- FAPI_ERR("rcTest17. RC is not FAPI_RC_INVALID_ATTR_GET, it is 0x%x",
- l_check);
- l_result = 1;
- }
- else
- {
- FAPI_INF("rcTest17. Success!");
- }
-
- return l_result;
-}
-
-#ifdef fips
-uint32_t rcTest18()
-{
- uint32_t l_result = 0;
-
- // Create a FAPI ReturnCode
- ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
-
- // Create Target of functional processor chip
- TARGETING::Target *l_proc = NULL;
-
- // Use PredicateIsFunctional (formerly HwasPredicate) to filter
- // only functional chips
- TARGETING::PredicateIsFunctional l_isFunctional;
- do
- {
-
- // filter for functional Proc Chips
- TARGETING::PredicateCTM l_procChipFilter(TARGETING::CLASS_CHIP,
- TARGETING::TYPE_PROC );
-
- // declare a postfix expression
- TARGETING::PredicatePostfixExpr l_functionalAndProcChipFilter;
-
- // is-a-proc-chip is-functional AND
- l_functionalAndProcChipFilter.push(&l_procChipFilter).
- push(&l_isFunctional).And();
-
- // loop through all the targets, applying the filter,
- // and put the results in l_pFuncProc
- TARGETING::TargetRangeFilter l_pFuncProcFilter(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &l_functionalAndProcChipFilter);
-
- // Get a pointer to that first function proc
- if(!l_pFuncProcFilter)
- {
- l_result = 1;
- FAPI_ERR("rcTest18:No functional processors found");
- break;
- }
-
- l_proc = *l_pFuncProcFilter;
- TARGETING::Target* l_pConstTarget =
- const_cast<TARGETING::Target*>(l_proc);
-
- fapi::Target l_fapiTarget(fapi::TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void*>(l_pConstTarget));
-
- const void * l_objects[] = { &l_fapiTarget};
- fapi::ReturnCode::ErrorInfoEntry l_entries[1];
- l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_CDG;
- l_entries[0].target_cdg.iv_targetObjIndex = 0;
- l_entries[0].target_cdg.iv_callout = 0;
- l_entries[0].target_cdg.iv_deconfigure = 0;
- l_entries[0].target_cdg.iv_gard = 1;
- l_entries[0].target_cdg.iv_calloutPriority =
- fapi::CalloutPriorities::LOW;
-
-
- // Add the error info
- l_rc.addErrorInfo(l_objects, l_entries, 1);
-
- // Check that the Error Info can be retrieved
- const ErrorInfo * l_pErrInfo = NULL;
- l_pErrInfo = l_rc.getErrorInfo();
-
- if (l_pErrInfo == NULL)
- {
- FAPI_ERR("rcTest18:getErrorInfo returned NULL");
- l_result = 2;
- break;
- }
-
- // Check the callout/deconfigure/GARD error information
- if (l_pErrInfo->iv_CDGs[0]->iv_target != l_fapiTarget)
- {
- FAPI_ERR("rcTest18:CDG[0] target mismatch");
- l_result = 3;
- break;
- }
-
- if (l_pErrInfo->iv_CDGs[0]->iv_gard == false)
- {
- FAPI_ERR("rcTest18:CDG[0] gard not set");
- l_result = 4;
- break;
- }
-
- // fapiRcToErrl is implicitly calling processEICDGs
- errlHndl_t pError = fapiRcToErrl(l_rc);
- if(pError == NULL)
- {
- FAPI_ERR("rcTest18:fapiRcToErrl returnd No Errorlog handle");
- l_result = 5;
- break;
- }
-
- srciIdx_t l_calloutCnt = 0;
- const SrciSrc* pSRC = pError->getSRC();
- pSRC->Callouts(l_calloutCnt);
- if(l_calloutCnt < 1)
- {
- l_result = 6;
- FAPI_ERR("Error. No Callout from fapiRcToErrl");
- break;
- }
-
- // TODO RTC 79353
- // Garded Target must be UnGard here.
-
- FAPI_INF("rcTest18:Deconfig/Gard HWP callout TC success");
- if(pError != NULL)
- {
- delete pError;
- pError = NULL;
- }
-
- }while(0);
- return l_result;
-}
-#endif //fips
-
-}
diff --git a/src/usr/hwpf/test/fapiTargetTest.C b/src/usr/hwpf/test/fapiTargetTest.C
deleted file mode 100644
index b38ddb67a..000000000
--- a/src/usr/hwpf/test/fapiTargetTest.C
+++ /dev/null
@@ -1,422 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapiTargetTest.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
-/* */
-/* 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 fapitargetTest.C
- *
- * @brief Implements Target class unit test functions.
- */
-
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 04/13/2011 Created.
- * mjjones 09/23/2011 Added Success traces
- *
- */
-
-#include <fapi.H>
-
-namespace fapi
-{
-
-//******************************************************************************
-// targetTest1
-//******************************************************************************
-uint32_t targetTest1()
-{
- uint32_t l_result = 0;
-
- // Create Target using default constructor
- Target l_target;
-
- // Ensure that the handle pointer is NULL
- void * l_pHandle = l_target.get();
-
- if (l_pHandle != NULL)
- {
- FAPI_ERR("targetTest1. Handle is not NULL");
- l_result = 1;
- }
- else
- {
- // Ensure that the type is TARGET_TYPE_NONE
- TargetType l_type = l_target.getType();
-
- if (l_type != TARGET_TYPE_NONE)
- {
- FAPI_ERR("targetTest1. Type is 0x%x, expected NONE", l_type);
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest1. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// targetTest2
-//******************************************************************************
-uint32_t targetTest2()
-{
- uint32_t l_result = 0;
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
-
- // Create Target
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
-
- // Ensure that the handle pointer is as expected
- void * l_pHandleCheck = l_target.get();
-
- if (l_pHandleCheck != l_pHandle)
- {
- FAPI_ERR("targetTest2. Handle is not as expected");
- l_result = 1;
- }
- else
- {
- // Ensure that the type is TARGET_TYPE_DIMM
- TargetType l_type = l_target.getType();
-
- if (l_type != TARGET_TYPE_DIMM)
- {
- FAPI_ERR("targetTest2. Type is 0x%x, expected DIMM", l_type);
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest2. Success!");
- }
- }
-
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
-
- return l_result;
-}
-
-//******************************************************************************
-// targetTest3
-//******************************************************************************
-uint32_t targetTest3()
-{
- uint32_t l_result = 0;
-
- // Create Target using default constructor
- Target l_target;
-
- // Set the handle
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- l_target.set(l_pHandle);
-
- // Ensure that the handle pointer is as expected
- void * l_pHandleCheck = l_target.get();
-
- if (l_pHandleCheck != l_pHandle)
- {
- FAPI_ERR("targetTest3. Handle is not as expected");
- l_result = 1;
- }
- else
- {
- // Set the type
- l_target.setType(TARGET_TYPE_DIMM);
-
- // Ensure that the type is TARGET_TYPE_DIMM
- TargetType l_type = l_target.getType();
-
- if (l_type != TARGET_TYPE_DIMM)
- {
- FAPI_ERR("targetTest3. Type is 0x%x, expected DIMM", l_type);
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest3. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// targetTest4
-//******************************************************************************
-uint32_t targetTest4()
-{
- uint32_t l_result = 0;
-
- // Create Target
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
-
- // Create Target using copy constructor
- Target l_target2(l_target);
-
- // Ensure that the target types are the same
- TargetType l_type = l_target.getType();
- TargetType l_type2 = l_target2.getType();
-
- if (l_type != l_type2)
- {
- FAPI_ERR("targetTest4. Types are not the same (0x%x, 0x%x)", l_type,
- l_type2);
- l_result = 1;
- }
- else
- {
- // Ensure that the handles are the same
- void * l_han1 = l_target.get();
- void * l_han2 = l_target2.get();
-
- if (l_han1 != l_han2)
- {
- FAPI_ERR("targetTest4. Handles are not the same");
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest4. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// targetTest5
-//******************************************************************************
-uint32_t targetTest5()
-{
- uint32_t l_result = 0;
-
- // Create Target
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
-
- // Create Target using assignment operator
- Target l_target2;
- l_target2 = l_target;
-
- // Ensure that the target types are the same
- TargetType l_type = l_target.getType();
- TargetType l_type2 = l_target2.getType();
-
- if (l_type != l_type2)
- {
- FAPI_ERR("targetTest5. Types are not the same (0x%x, 0x%x)", l_type,
- l_type2);
- l_result = 1;
- }
- else
- {
- // Ensure that the handles are the same
- void * l_han1 = l_target.get();
- void * l_han2 = l_target2.get();
-
- if (l_han1 != l_han2)
- {
- FAPI_ERR("targetTest5. Handles are not the same");
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest5. Success!");
- }
- }
-
- return l_result;
-}
-
-//******************************************************************************
-// targetTest6
-//******************************************************************************
-uint32_t targetTest6()
-{
- uint32_t l_result = 0;
-
- // Create similar Targets
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
- Target l_target2(TARGET_TYPE_DIMM, l_pHandle);
-
- // Ensure that the equality comparison returns true
- if (!(l_target == l_target2))
- {
- FAPI_ERR("targetTest6. 1. Equality comparison false");
- l_result = 1;
- }
- else
- {
- // Ensure that the inequality comparison returns false
- if (l_target != l_target2)
- {
- FAPI_ERR("targetTest6. 2. Inequality comparison true");
- l_result = 2;
- }
- else
- {
- // Change the target type of l_target2
- (void)l_target2.setType(TARGET_TYPE_PROC_CHIP);
-
- // Ensure that the equality comparison returns false
- if (l_target == l_target2)
- {
- FAPI_ERR("targetTest6. 3. Equality comparison true");
- l_result = 3;
- }
- else
- {
- // Ensure that the inequality comparison returns true
- if (!(l_target != l_target2))
- {
- FAPI_ERR("targetTest6. 4. Inequality comparison false");
- l_result = 4;
- }
- else
- {
- // Reset the target type of l_target2
- (void)l_target2.setType(TARGET_TYPE_DIMM);
-
- // Change the handle of l_target
- uint8_t l_handle2 = 7;
- void * l_pHandle2 = reinterpret_cast<void *>(&l_handle2);
- (void)l_target.set(l_pHandle2);
-
- // Ensure that the equality comparison returns false
- if (l_target == l_target2)
- {
- FAPI_ERR("targetTest6. 5. Equality comparison true");
- l_result = 5;
- }
- else
- {
- // Ensure that the inequality comparison returns true
- if (!(l_target != l_target2))
- {
- FAPI_ERR("targetTest6. 6. Inequality comparison "
- "false");
- l_result = 6;
- }
- else
- {
- FAPI_INF("targetTest6. Success!");
- }
- }
- }
- }
- }
- }
-
- return l_result;
-}
-//******************************************************************************
-// targetTest7
-//******************************************************************************
-uint32_t targetTest7()
-{
- uint32_t l_result = 0;
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
-
- // Create Target
- Target l_target(TARGET_TYPE_L4, l_pHandle);
-
- // Ensure that the handle pointer is as expected
- void * l_pHandleCheck = l_target.get();
-
- if (l_pHandleCheck != l_pHandle)
- {
- FAPI_ERR("targetTest7. Handle is not as expected");
- l_result = 1;
- }
- else
- {
- // Ensure that the type is TARGET_TYPE_L4
- TargetType l_type = l_target.getType();
-
- if (l_type != TARGET_TYPE_L4)
- {
- FAPI_ERR("targetTest7. Type is 0x%x, expected L4", l_type);
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest7. Success!");
- }
- }
-
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
-
- return l_result;
-}
-//******************************************************************************
-// targetTest8
-//******************************************************************************
-uint32_t targetTest8()
-{
- uint32_t l_result = 0;
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
-
- // Create Target
- Target l_target(TARGET_TYPE_L4, l_pHandle);
-
- // an L4 Target is not a chip
- if ( l_target.isChip() )
- {
- FAPI_ERR("targetTest8. L4 target incorrectly"
- " identified itself as a chip");
- l_result = 1;
- }
- else
- {
-
- if ( !l_target.isChiplet() )
- {
- FAPI_ERR("targetTest8. L4 target failed to identify as a chiplett" );
- l_result = 2;
- }
- else
- {
- FAPI_INF("targetTest8. Success!");
- }
- }
-
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
-
- return l_result;
-}
-
-
-}
diff --git a/src/usr/hwpf/test/fapiattrtest.H b/src/usr/hwpf/test/fapiattrtest.H
deleted file mode 100644
index 1e3f69d3d..000000000
--- a/src/usr/hwpf/test/fapiattrtest.H
+++ /dev/null
@@ -1,98 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapiattrtest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
-/* */
-/* 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 FAPIATTRTEST_H
-#define FAPIATTRTEST_H
-
-/**
- * @file fapiattrtanktest.H
- *
- * @brief Test case for FAPI AttributeTank
-*/
-
-#include <cxxtest/TestSuite.H>
-#include "fapiAttrTest.C"
-
-using namespace fapi;
-
-class FapiAttrTest: public CxxTest::TestSuite
-{
-public:
-
- void test1(void)
- {
- if (attrTest1() != 0)
- {
- TS_FAIL("attrTest1. Fail");
- }
- }
-
- void test2(void)
- {
- if (attrTest2() != 0)
- {
- TS_FAIL("attrTest2. Fail");
- }
- }
-
- void test3(void)
- {
- if (attrTest3() != 0)
- {
- TS_FAIL("attrTest3. Fail");
- }
- }
-
- void test4(void)
- {
- if (attrTest4() != 0)
- {
- TS_FAIL("attrTest4. Fail");
- }
- }
-
- void test5(void)
- {
- if (attrTest5() != 0)
- {
- TS_FAIL("attrTest5. Fail");
- }
- }
-
- void test6(void)
- {
- if (attrTest6() != 0)
- {
- TS_FAIL("attrTest6. Fail");
- }
- }
-
- void test7(void)
- {
- if (attrTest7() != 0)
- {
- TS_FAIL("attrTest7. Fail");
- }
- }
-};
-
-#endif
diff --git a/src/usr/hwpf/test/fapirctest.H b/src/usr/hwpf/test/fapirctest.H
deleted file mode 100644
index cd4c95999..000000000
--- a/src/usr/hwpf/test/fapirctest.H
+++ /dev/null
@@ -1,280 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapirctest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2014 */
-/* [+] 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 __FAPItestRc_H
-#define __FAPItestRc_H
-
-/**
- * @file fapitestRc.H
- *
- * @brief Test case for FAPI return codes
-*/
-
-#include <cxxtest/TestSuite.H>
-#include <fapi.H>
-#include "fapiRcTest.C"
-
-using namespace fapi;
-
-class FapitestRc: public CxxTest::TestSuite
-{
-public:
-
- /**
- * @brief Test FAPI return codes #1
- */
- void testRc1(void)
- {
- uint32_t l_res = rcTest1();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc1. Fail l_res=%d", l_res);
- }
- }
-
-
- /**
- * @brief Test FAPI return codes #2
- */
- void testRc2()
- {
- uint32_t l_res = rcTest2();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc2. Fail l_res=%d", l_res);
- }
- }
-
- /**
- * @brief Test FAPI return codes #3
- */
- void testRc3()
- {
- uint32_t l_res = rcTest3();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc3. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #4
- */
- void testRc4()
- {
- uint32_t l_res = rcTest4();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc4. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #5
- */
- void testRc5()
- {
- uint32_t l_res = rcTest5();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc5. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #6
- */
- void testRc6()
- {
- uint32_t l_res = rcTest6();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc6. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #7
- */
- void testRc7()
- {
- uint32_t l_res = rcTest7();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc7. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #8
- */
- void testRc8()
- {
- uint32_t l_res = rcTest8();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc8. Fail l_res=%d", l_res);
- }
- }
-
- /**
- * @brief Test FAPI return codes #9
- */
- void testRc9()
- {
- uint32_t l_res = rcTest9();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc9. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #10
- */
- void testRc10()
- {
- uint32_t l_res = rcTest10();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc10. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #11
- */
- void testRc11(void)
- {
- uint32_t l_res = rcTest11();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc11. Fail l_res=%d", l_res);
- }
- }
-
-
- /**
- * @brief Test FAPI return codes #12
- */
- void testRc12()
- {
- uint32_t l_res = rcTest12();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc12. Fail l_res=%d", l_res);
- }
- }
-
- /**
- * @brief Test FAPI return codes #13
- */
- void testRc13()
- {
- uint32_t l_res = rcTest13();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc13. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #14
- */
- void testRc14()
- {
- uint32_t l_res = rcTest14();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc14. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #15
- */
- void testRc15()
- {
- uint32_t l_res = rcTest15();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc15. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #16
- */
- void testRc16()
- {
- uint32_t l_res = rcTest16();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc16. Fail l_res=%d", l_res);
- }
- return;
- }
-
- /**
- * @brief Test FAPI return codes #17
- */
- void testRc17()
- {
- uint32_t l_res = rcTest17();
-
- if (l_res != 0)
- {
- TS_FAIL("testRc17. Fail l_res=%d", l_res);
- }
- return;
- }
-};
-
-#endif
diff --git a/src/usr/hwpf/test/fapitargettest.H b/src/usr/hwpf/test/fapitargettest.H
deleted file mode 100644
index 4d468fd45..000000000
--- a/src/usr/hwpf/test/fapitargettest.H
+++ /dev/null
@@ -1,147 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/fapitargettest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
-/* */
-/* 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 __FAPITARGETTEST_H
-#define __FAPITARGETTEST_H
-
-/**
- * @file fapitargettest.H
- *
- * @brief Test case for FAPI targets
-*/
-
-#include <cxxtest/TestSuite.H>
-#include <fapi.H>
-#include "fapiTargetTest.C"
-
-using namespace fapi;
-
-class FapiTargetTest: public CxxTest::TestSuite
-{
-public:
-
- /**
- * @brief Test target #1
- */
- void testTarget1()
- {
- uint32_t l_res = targetTest1();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget1. Fail");
- }
- }
-
- /**
- * @brief Test target #2
- */
- void testTarget2()
- {
- uint32_t l_res = targetTest2();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget2. Fail");
- }
- }
-
- /**
- * @brief Test target #3
- */
- void testTarget3()
- {
- uint32_t l_res = targetTest3();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget3. Fail");
- }
- }
-
- /**
- * @brief Test target #4
- */
- void testTarget4()
- {
- uint32_t l_res = targetTest4();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget4. Fail");
- }
- }
-
- /**
- * @brief Test target #5
- */
- void testTarget5()
- {
- uint32_t l_res = targetTest5();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget5. Fail");
- }
- }
-
- /**
- * @brief Test target #6
- */
- void testTarget6()
- {
- uint32_t l_res = targetTest6();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget6. Fail");
- }
- }
-
- /**
- * @brief Test target #7
- */
- void testTarget7()
- {
- uint32_t l_res = targetTest7();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget7. Fail");
- }
- }
-
- /**
- * @brief Test target #8
- */
- void testTarget8()
- {
- uint32_t l_res = targetTest8();
-
- if (l_res != 0)
- {
- TS_FAIL("testTarget8. Fail");
- }
- }
-};
-
-#endif
diff --git a/src/usr/hwpf/test/hwpDQCompressionTest.H b/src/usr/hwpf/test/hwpDQCompressionTest.H
deleted file mode 100644
index 7da111eba..000000000
--- a/src/usr/hwpf/test/hwpDQCompressionTest.H
+++ /dev/null
@@ -1,224 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/hwpDQCompressionTest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014 */
-/* [+] 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 _HWPDQCOMPRESSIONTEST_H
-#define _HWPDQCOMPRESSIONTEST_H
-
-/**
- * @file hwpDQCompressionTest.H
- *
- * @brief Tests for DQ and DQS compression and decompression
- *
- */
-
-#include <cxxtest/TestSuite.H>
-#include <hwpf/hwp/mvpd_accessors/DQCompressionLib.H>
-#include "../hwp/mvpd_accessors/compressionTool/DQCompressionReasonCodes.H"
-#include "../hwp/mvpd_accessors/compressionTool/DQCompressionConsts.H"
-#include <hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.H>
-
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/utilFilter.H>
-#include <targeting/common/trace.H>
-
-using namespace TARGETING;
-using namespace DQCompression;
-
-class HwpDQCompressionTest: public CxxTest::TestSuite
-{
-public:
- void testDQCompression1()
- {
- int l_errl = NO_ERR;
- do
- {
- TRACFCOMP(g_trac_targeting, "Starting DQ Test 1");
- //Input DQ array
- uint8_t l_isdimmToC4DQ_P0 [DQarray_size]={8,9,10,11,12,13,14,15,
- 0,1,2,3,4,5,6,7,
- 16,17,18,19,20,21,22,23,
- 64,65,66,67,68,69,70,71,
- 32,33,34,35,36,37,38,39,
- 40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,
- 56,57,58,59,60,61,62,63,
- 24,25,26,27,28,29,30,31,
- 255,255,255,255,255,255,
- 255,255};
-
- //convert array to a vector
- std::vector<uint8_t> l_isdimmToC4DQ_0 (l_isdimmToC4DQ_P0,
- l_isdimmToC4DQ_P0+(sizeof(l_isdimmToC4DQ_P0)/
- sizeof(uint8_t)));
-
- //Pass the vector to the encode function
- ecmdDataBufferBase l_encodedDQData;
- l_errl = encodeDQ(l_isdimmToC4DQ_0, DQ, l_encodedDQData);
-
- if (l_errl)
- {
- TS_FAIL("Error Encoding DQ Data set1 %s",
- ReasonCodes[l_errl]);
- break;
- }
-
- //Input DQS Array
- uint8_t l_isdimmToC4DQS_P0 [DQSarray_size]= {2,3,0,1,
- 4,5,16,17,
- 8,9,10,11,
- 12,13,14,15,
- 6,7,255,255};
- //Convert DQS array to a vector
- std::vector<uint8_t> l_isdimmToC4DQS_0 (l_isdimmToC4DQS_P0,
- l_isdimmToC4DQS_P0+(sizeof(l_isdimmToC4DQS_P0)/
- sizeof(uint8_t)));
-
- //encode
- ecmdDataBufferBase l_encodedDQSData;
- l_errl = encodeDQ(l_isdimmToC4DQS_0, DQS, l_encodedDQSData);
- if (l_errl)
- {
- TS_FAIL("Error Encoding DQS Data1 %s",
- ReasonCodes[l_errl]);
- break;
- }
-
- //Pass the output to decode
- uint8_t l_decDQArray [DQarray_size];
- uint8_t l_decDQSArray[DQSarray_size];
- decodeISDIMMAttrs(l_encodedDQData, l_encodedDQSData,
- l_decDQArray, l_decDQSArray);
-
- //Check if the initial vector is obtained.
- //If not, throw an error
- //First, check DQ
- for (uint8_t i = 0; i < DQarray_size; i++)
- {
- if(l_decDQArray[i] != l_isdimmToC4DQ_P0[i])
- {
- TS_FAIL("Decoded Output differs from initial array DQ test1");
- break;
- }
- }
-
- //Check DQS
- for (uint8_t i = 0; i < DQSarray_size; i++)
- {
- if(l_decDQSArray[i] != l_isdimmToC4DQS_P0[i])
- {
- TS_FAIL("Decoded Output differs from initial array DQS test1");
- break;
- }
- }
-
- TRACFCOMP(g_trac_targeting, "DQ Test 1 ended successfully");
- } while (0);
-
- }
-
- void testDQCompression2 ()
- {
- int l_errl = NO_ERR;
- do
- {
- TRACFCOMP(g_trac_targeting, "Starting DQ Test 2");
- uint8_t l_isdimmToC4DQ_P1[DQarray_size]={24,25,26,27,28,29,30,31,
- 4,5,6,7,0,1,2,3,
- 20,21,22,23,16,17,18,19,
- 68,69,70,71,64,65,66,67,
- 36,37,38,39,32,33,34,35,
- 43,41,42,40,44,45,46,47,
- 48,49,50,51,52,53,54,55,
- 56,57,58,59,60,61,62,63,
- 15,13,14,12,10,9,11,8,
- 255,255,255,255,255,255,
- 255,255};
-
- //Convert to a vector
- std::vector<uint8_t> l_isdimmToC4DQ_1 (l_isdimmToC4DQ_P1,
- l_isdimmToC4DQ_P1+(sizeof(l_isdimmToC4DQ_P1)/
- sizeof(uint8_t)));
-
- //Pass the vector to encode function
- ecmdDataBufferBase l_encodedDQData;
- l_errl = encodeDQ(l_isdimmToC4DQ_1, DQ, l_encodedDQData);
-
- if (l_errl)
- {
- TS_FAIL("Error Encoding DQ Data2 %s",
- ReasonCodes[l_errl]);
- break;
- }
- uint8_t l_isdimmToC4DQS_P1 [DQSarray_size]= {7,6,1,0,
- 4,5,17,16,
- 9,8,10,11,
- 13,12,14,15,
- 2,3,255,255};
- std::vector<uint8_t> l_isdimmToC4DQS_1 (l_isdimmToC4DQS_P1,
- l_isdimmToC4DQS_P1+(sizeof(l_isdimmToC4DQS_P1)/sizeof
- (uint8_t)));
-
- //encode
- ecmdDataBufferBase l_encodedDQSData;
- l_errl = encodeDQ(l_isdimmToC4DQS_1, DQS, l_encodedDQSData);
- if (l_errl)
- {
- TS_FAIL("Error Encoding DQS Data2 %s",
- ReasonCodes[l_errl]);
- break;
- }
-
- //Pass the output to decode
- uint8_t l_decDQArray [DQarray_size];
- uint8_t l_decDQSArray[DQSarray_size];
- decodeISDIMMAttrs (l_encodedDQData, l_encodedDQSData,
- l_decDQArray, l_decDQSArray);
-
- //Check if the initial vector is obtained.
- //If not, throw an error
- //First, check DQ
- for (uint8_t i = 0; i < DQarray_size; i++)
- {
- if(l_decDQArray[i] != l_isdimmToC4DQ_P1[i])
- {
- TS_FAIL("Decoded Output differs initial array DQ test2");
- break;
- }
- }
-
- //Check DQS
- for (uint8_t i = 0; i < DQSarray_size; i++)
- {
- if(l_decDQSArray[i] != l_isdimmToC4DQS_P1[i])
- {
- TS_FAIL("Decoded Output differs initial array DQS test2");
- break;
- }
- }
-
- TRACFCOMP(g_trac_targeting, "DQ Test 2 ended successfully");
- } while (0);
- }
-};
-#endif
diff --git a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H b/src/usr/hwpf/test/hwpMBvpdAccessorTest.H
deleted file mode 100644
index 239a6ba25..000000000
--- a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H
+++ /dev/null
@@ -1,2078 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/hwpMBvpdAccessorTest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
-/* [+] 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 __HWPMBVPDACCESSORTEST_H
-#define __HWPMBVPDACCESSORTEST_H
-
-// set to 1 for doing unit tests, set to 0 for production
-#define HWPMBVPDACCESSORTEST_UT0 0 // 0 = just one chip, 1 = all
-#define HWPMBVPDACCESSORTEST_UT1 0 // 0 = the last keword added, 1 = all & dump
-#define HWPMBVPDACCESSORTEST_UT2 0 // 0 = min slope intercept tests
-#define HWPMBVPDACCESSORTEST_UT3 0 // 0 = min L4 Bank Delete tests
-#define HWPMBVPDACCESSORTEST_UT4 0 // 0 = min term data tests
-#define HWPMBVPDACCESSORTEST_UT5 0 // 0 = min phase rotator data tests
-#define HWPMBVPDACCESSORTEST_UT6 0 // 0 = include those moved in v5.3 redefine
-#define HWPMBVPDACCESSORTEST_UT7 0 // 0 = min sensor map tests
-
-/**
- * @file hwpmbvpdaccessortest.H
- *
- * @brief Test cases for MBvpd HWP accessors.
-*/
-
-#include <cxxtest/TestSuite.H>
-
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
-
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/utilFilter.H>
-
-#include <setMvpdRing.H>
-#include <mvpd_accessors/getMBvpdAddrMirrorData.H>
-#include <mvpd_accessors/getMBvpdSlopeInterceptData.H>
-#include <mvpd_accessors/getMBvpdVersion.H>
-#include <mvpd_accessors/getMBvpdDram2NModeEnabled.H>
-#include <mvpd_accessors/getMBvpdSensorMap.H>
-#include <mvpd_accessors/getControlCapableData.H>
-#include <mvpd_accessors/accessMBvpdL4BankDelete.H>
-#include <mvpd_accessors/getDecompressedISDIMMAttrs.H>
-#include <mvpd_accessors/getMBvpdAttr.H>
-
-#include <errl/errlmanager.H>
-#include <errl/errlentry.H>
-#include <devicefw/driverif.H>
-#include <trace/interface.H>
-#include <config.h>
-
-using namespace fapi;
-using namespace TARGETING;
-
-class hwpMBvpdAccessorTest : public CxxTest::TestSuite
-{
-public:
-
- /**
- * @brief call fapiGetMBvpdField to fetch memory buffer vpd records.
- *
- */
- void testGetMBvpd()
- {
- fapi::ReturnCode l_fapirc;
- uint8_t *l_pRecord = NULL;
- uint32_t l_len = 0;
-
- // list of MBVPD records to test
- struct _testMBvpdRecords {
- fapi::MBvpdRecord record;
- fapi::MBvpdKeyword keyword;
- } l_mbvpdRecords[] = {
-#if HWPMBVPDACCESSORTEST_UT1
- { MBVPD_RECORD_VEIR, MBVPD_KEYWORD_PDI},
-// { MBVPD_RECORD_VER0, MBVPD_KEYWORD_PDI},//in spec, not supported
- { MBVPD_RECORD_MER0, MBVPD_KEYWORD_PDI},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_PDI},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_MT},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_MR},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_PDA},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_EL},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_LM},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_MW},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_MV},
- { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_AM},
-#endif
- { MBVPD_RECORD_VINI, MBVPD_KEYWORD_VZ},
- };
-
- TS_TRACE( "testGetMBvpd entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetMBvpd l_memBufList.size()= 0x%x ",
- l_memBufList.size() );
-
- // loop thru all the memory buffers
- for (uint8_t l_mbNum=0; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)) );
-
- // loop through mvpd records of interest
- const uint32_t numRecords =
- sizeof(l_mbvpdRecords)/sizeof(l_mbvpdRecords[0]);
- for (uint8_t i=0;i<numRecords;i++) {
-
- TS_TRACE( "record = 0x%x keyword = 0x%x",
- l_mbvpdRecords[i].record,
- l_mbvpdRecords[i].keyword);
-
- TS_TRACE( "call fapiGetMBvpdField with NULL pointer" );
-
- // call fapiGetMvpdField once with a NULL pointer to get the
- // buffer size should return no error now.
- l_fapirc = fapiGetMBvpdField(l_mbvpdRecords[i].record,
- l_mbvpdRecords[i].keyword,
- l_fapi_mb_target,
- NULL,
- l_len );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "fapiGetMBvpdField: expected FAPI_RC_SUCCESS" );
- fapiLogError(l_fapirc);
- return;
- }
-
- TS_TRACE( "fapiGetMBvpdField: size of record = 0x%x",
- l_len );
-
- // do a malloc instead of a new just for variety
- l_pRecord = reinterpret_cast<uint8_t *>(malloc(l_len) );
-
- // call fapiGetMvpdField once with a valid pointer
- l_fapirc = fapiGetMBvpdField(l_mbvpdRecords[i].record,
- l_mbvpdRecords[i].keyword,
- l_fapi_mb_target,
- l_pRecord,
- l_len );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "fapiGetMBvpdField: expected FAPI_RC_SUCCESS" );
- fapiLogError(l_fapirc);
- free( l_pRecord );
- return;
- }
-#if HWPMBVPDACCESSORTEST_UT1
- TRACFCOMP(g_trac_test,"testMBvpd:Record=%d,Keyword=%d",
- l_mbvpdRecords[i].record,
- l_mbvpdRecords[i].keyword);
- TRACFBIN(g_trac_test,"testMBvpd:DumpRecord:",
- l_pRecord,
- l_len );
-#endif
- // call fapiSetMvpdField
- l_fapirc = fapiSetMBvpdField(l_mbvpdRecords[i].record,
- l_mbvpdRecords[i].keyword,
- l_fapi_mb_target,
- l_pRecord,
- l_len );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "fapiSetMBvpdField: expected FAPI_RC_SUCCESS" );
- fapiLogError(l_fapirc);
- free( l_pRecord );
- return;
- }
-
- // clean up memory
- free( l_pRecord );
- }
- }
-
- TS_TRACE( "testGetMBvpd exit" );
-
- }
-
- void testGetDQAttrISDIMM()
- {
- fapi::ReturnCode l_fapirc;
-
- TS_TRACE("DQ Attributes ISDIMM entry");
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- for(uint8_t l_mbNum = 0; l_mbNum < l_memBufList.size(); l_mbNum++)
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- for(uint8_t l_mbaNum = 0; l_mbaNum < l_mbaList.size(); l_mbaNum++)
- {
- //dump physical path to target
- EntityPath l_mbaPath;
- l_mbaPath = l_mbaList[l_mbaNum] ->getAttr<ATTR_PHYS_PATH>();
- l_mbaPath.dump();
-
- //cast out type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target(TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])));
-
- uint8_t l_customDimm = 0;
- l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,
- &l_fapi_mba_target,l_customDimm);
- if(l_fapirc)
- {
- FAPI_ERR("hwpMBvpdAccessorTest: Read of custom dimm failed");
- break;
- }
-
- //if custom_dimm = 0, use isdimm otherwise this test is useless
- if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm)
- {
-
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)));
- uint8_t l_valDQ[4][80];
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ISDIMMTOC4DQ,
- &l_fapi_mb_target,l_valDQ);
-
- if(l_fapirc) break;
- TS_TRACE("DQ Attributes ISDIMM Accessor"
- "first element=0x%08x",l_valDQ[0][0]);
- }
- }
- }
- if (l_fapirc)
- {
- TS_FAIL("getDQAttrISDIMM: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc));
- fapiLogError(l_fapirc);
- }
- TS_TRACE("testGetDQAttrISDIMM exit");
- }
-
- void testGetDQSAttrISDIMM()
- {
- fapi::ReturnCode l_fapirc;
-
- TS_TRACE("DQS Attributes ISDIMM entry");
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- for(uint8_t l_mbNum = 0; l_mbNum < l_memBufList.size(); l_mbNum++)
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- for(uint8_t l_mbaNum = 0; l_mbaNum < l_mbaList.size(); l_mbaNum++)
- {
- //dump physical path to target
- EntityPath l_mbaPath;
- l_mbaPath = l_mbaList[l_mbaNum]->getAttr<ATTR_PHYS_PATH>();
- l_mbaPath.dump();
-
- //cast our type of target to a FAPI type of target
- fapi::Target l_fapi_mba_target(TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])));
-
- uint8_t l_customDimm = 0;
- l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,
- &l_fapi_mba_target,l_customDimm);
- if(l_fapirc)
- {
- FAPI_ERR("hwpMBvpdAccessorTest: Read of custom dimm failed");
- break;
- }
-
- //if custom_dimm = 0, use isdimm otherwise this test is useless
- if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm)
- {
-
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)));
-
- uint8_t l_valDQS[4][20];
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ISDIMMTOC4DQS,
- &l_fapi_mb_target,l_valDQS);
-
- if(l_fapirc) break;
- TS_TRACE("DQS Attributes ISDIMM Accessor"
- "first element=0x%08x",l_valDQS[0][0]);
- }
- }
- }
- if (l_fapirc)
- {
- TS_FAIL("getDQSAttrISDIMM: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc));
- fapiLogError(l_fapirc);
- }
- TS_TRACE("testGetDQSAttrISDIMM exit");
-
- }
-
- void testDQandDQSISDIMMAttrs()
- {
-
- TS_TRACE("testDQandDQSISDIMMAttrs entry");
- //first testing the 0 test case;
- ecmdDataBufferBase l_data_buffer_DQ1(136); //17 bits, just one DQ
- ecmdDataBufferBase l_data_buffer_DQS1(16); //2 bits, just one DQS
- for(int l_index =0;l_index<136; l_index++)
- {
- l_data_buffer_DQ1.writeBit(l_index,0);
- if(l_index<16) l_data_buffer_DQS1.writeBit(l_index,0);
- }
- uint8_t l_finalDQArray[80];
- uint8_t l_finalDQSArray[20];
-
- decodeISDIMMAttrs(l_data_buffer_DQ1, l_data_buffer_DQS1,
- l_finalDQArray, l_finalDQSArray);
-
- uint8_t l_DQOutput1[80] = {0,1,2,3,4,5,6,7,
- 8,9,10,11,12,13,14,15,
- 16,17,18,19,20,21,22,23,
- 24,25,26,27,28,29,30,31,
- 32,33,34,35,36,37,38,39,
- 40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,
- 56,57,58,59,60,61,62,63,
- 64,65,66,67,68,69,70,71,
- 255,255,255,255,255,255,255,255};
- uint8_t l_DQSOutput1[20] = {0,1,2,3,4,5,6,7,
- 8,9,10,11,12,13,14,
- 15,16,17,255,255};
-
-
- for(int l_zeroFinalIndex = 0; l_zeroFinalIndex<80;l_zeroFinalIndex++)
- {
- if(l_finalDQArray[l_zeroFinalIndex] !=
- l_DQOutput1[l_zeroFinalIndex])
- {
- TS_TRACE("testDQandDQSISDIMMAttrs failed, DQ is wrong");
- break;
- }
- if(l_zeroFinalIndex<20 && (l_finalDQSArray[l_zeroFinalIndex] !=
- l_DQSOutput1[l_zeroFinalIndex]))
- {
- TS_TRACE("testDQandDQSISDIMMAttrs failed, DQS is wrong");
- break;
- }
- if(l_zeroFinalIndex == 79)
- {
- TS_TRACE("testDQandDQSISDIMMAttrs passed the all zero test");
- }
- }
- //and now for actual data
- uint32_t l_byteOrder = 0b000000001001111111111001;
- uint32_t l_nibSwap = 0b0000000111110000;
- uint32_t l_nibToNib1 = 0b00000010101011110000000000000000;
- uint32_t l_nibToNib2 = 0b00000000000000000000000010101000;
- uint32_t l_nibToNib3 = 0b00000000000000000000000000000000;
- uint32_t l_nibSwapDQS = 0b0000000100010000;
-
- l_data_buffer_DQ1.insertFromRight(l_byteOrder,0,24);
- l_data_buffer_DQ1.insertFromRight(l_nibSwap,24,16);
- l_data_buffer_DQ1.insertFromRight(l_nibToNib1,40,32);
- l_data_buffer_DQ1.insertFromRight(l_nibToNib2,72,32);
- l_data_buffer_DQ1.insertFromRight(l_nibToNib3,104,32);
-
- l_data_buffer_DQS1.insertFromRight(l_nibSwapDQS,0,16);
-
- decodeISDIMMAttrs(l_data_buffer_DQ1, l_data_buffer_DQS1,
- l_finalDQArray, l_finalDQSArray);
-
- uint8_t l_DQOutput2[80] = {15,13,14,12,10,9,11,8,
- 4,5,6,7,0,1,2,3,
- 20,21,22,23,16,17,18,19,
- 68,69,70,71,64,65,66,67,
- 36,37,38,39,32,33,34,35,
- 43,41,42,40,44,45,46,47,
- 48,49,50,51,52,53,54,55,
- 56,57,58,59,60,61,62,63,
- 24,25,26,27,28,29,30,31,
- 255,255,255,255,255,255,255,255};
- uint8_t l_DQSOutput2[20] = {3,2,0,1,4,5,16,17,
- 9,8,10,11,12,13,14,15,
- 6,7,255,255};
-
- for(int l_finalIndex = 0; l_finalIndex<80;l_finalIndex++)
- {
- if(l_finalDQArray[l_finalIndex] != l_DQOutput2[l_finalIndex])
- {
- TS_TRACE("testDQandDQSISDIMMAttrs failed, DQ is wrong");
- break;
- }
- if(l_finalIndex<20 && (l_finalDQSArray[l_finalIndex] !=
- l_DQSOutput2[l_finalIndex]))
- {
- TS_TRACE("testDQandDQSISDIMMAttrs failed, DQS is wrong");
- break;
- }
- if(l_finalIndex == 79)
- {
- TS_TRACE("testDQandDQSISDIMMAttrs passed the actual data test");
- }
- }
- TS_TRACE("testDQandDQSISDIMMAttrs exit");
-
- }
-
- /**
- * @brief call getControlCapableData to ensure that it's getting the MR
- * keyword correctly, and getting the right data
- *
- */
- void testGetControlCapableData()
- {
- fapi::ReturnCode l_fapirc;
-
- TS_TRACE( "getControlCapableData entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; //check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)) );
-
- }
- if (l_fapirc)
- {
- TS_FAIL( "getControlCapableData: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-
- TS_TRACE( "testGetControlCapableData exit" );
-
- }
-
- /**
- * @brief call getRCDCntlWord015 to ensure that it's getting the MR
- * keyword correctly, and getting the right data
- *
- */
- void testGetRCDCntlWord015()
- {
- FAPI_IMP( "testGetRCDCntlWord015 entry" );
- fapi::ReturnCode l_fapirc;
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; //check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for(; l_mbNum < l_memBufList.size(); l_mbNum++)
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- for ( uint8_t l_mbaNum=0; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- TARGETING::TargetHandleList l_dimmList;
- getChildAffinityTargets(l_dimmList,l_mbaList[l_mbaNum],
- CLASS_LOGICAL_CARD,TYPE_DIMM,false);
-
- for ( uint8_t l_dimmNum=0; l_dimmNum < l_dimmList.size(); l_dimmNum++ )
- {
- // make a local copy of the dimm target
- TARGETING::Target* l_dimm_target = l_dimmList[l_dimmNum];
-
- //cast our type of target to a fapi target
- fapi::Target l_fapi_dimm_target( TARGET_TYPE_DIMM,
- (const_cast<TARGETING::Target*>(l_dimm_target)));
-
- //Get FAPI ATTR
- uint64_t l_val = 0;
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DIMM_RCD_CNTL_WORD_0_15,
- (const_cast<fapi::Target*>(&l_fapi_dimm_target)),l_val);
-
- if (l_fapirc)
- {
- TS_FAIL( "testGetRCDCntlWord015: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- FAPI_IMP("testGetRCDCntlWord015: attr value: 0x%X", l_val);
- }
- }
- }
- FAPI_IMP( "testGetRCDCntlWord015 exit" );
- }
- /**
- * @brief call getMBvpdSlopeInterceptData to fetch power slope and intercept
- * attributes from the MW and MV keywords
- *
- */
- void testGetSlopeInterceptData()
- {
- fapi::ReturnCode l_fapirc;
- getMBvpdSlopeInterceptData_FP_t (l_getMBvpdSlopeInterceptData)
- = &getMBvpdSlopeInterceptData;
- uint32_t l_val = 0xFFFFFFFF;
-
- TS_TRACE( "testGetSlopeInterceptData entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetSlopeInterceptData l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)) );
-
- // MASTER_POWER_SLOPE
- l_fapirc = (*l_getMBvpdSlopeInterceptData)(l_fapi_mb_target,
- fapi::MASTER_POWER_SLOPE, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData accessor "
- "MASTER_POWER_SLOPE=0x%08x", l_val);
-#if HWPMBVPDACCESSORTEST_UT2
-
- // MASTER_POWER_INTERCEPT
- l_fapirc = (*l_getMBvpdSlopeInterceptData)(l_fapi_mb_target,
- fapi::MASTER_POWER_INTERCEPT, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData accessor "
- "MASTER_POWER_INTERCEPT=0x%08x", l_val);
-
- // SUPPLIER_POWER_SLOPE
- l_fapirc = (*l_getMBvpdSlopeInterceptData)(l_fapi_mb_target,
- fapi::SUPPLIER_POWER_SLOPE, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData accessor "
- "SUPPLIER_POWER_SLOPE=0x%08x", l_val);
-#endif
- // SUPPLIER_POWER_INTERCEPT
- l_fapirc = (*l_getMBvpdSlopeInterceptData)(l_fapi_mb_target,
- fapi::SUPPLIER_POWER_INTERCEPT, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData accessor "
- "SUPPLIER_POWER_INTERCEPT=0x%08x", l_val);
-
- // MASTER_POWER_SLOPE
- l_fapirc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_MASTER_POWER_SLOPE,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData attr "
- "MASTER_POWER_SLOPE=0x%08x", l_val);
-#if HWPMBVPDACCESSORTEST_UT2
- // MASTER_POWER_INTERCEPT
- l_fapirc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_MASTER_POWER_INTERCEPT,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData attr "
- "MASTER_POWER_INTERCEPT=0x%08x", l_val);
-
- // SUPPLIER_POWER_SLOPE
- l_fapirc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_SUPPLIER_POWER_SLOPE,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData attr "
- "SUPPLIER_POWER_SLOPE=0x%08x", l_val);
-
-#endif
- // SUPPLIER_POWER_INTERCEPT
- l_fapirc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_SUPPLIER_POWER_INTERCEPT,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSlopeInterceptData attr "
- "SUPPLIER_POWER_INTERCEPT=0x%08x", l_val);
- }
-
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetSlopeInterceptData: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-
- TS_TRACE( "testGetSlopeInterceptData exit" );
-
- }
-
- /**
- * @brief call accessMBvpdL4BankDelete to fetch VSPD keyword MX
- *
- */
- void testL4BankDelete()
- {
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
-#if HWPMBVPDACCESSORTEST_UT3
- accessMBvpdL4BankDelete_FP_t (l_accessMBvpdL4BankDelete)
- = &accessMBvpdL4BankDelete;
-#endif
-
- TS_TRACE( "testL4BankDelete entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testL4BankDelete l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target( TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)) );
-
- // verify HWP accessor
- uint32_t l_val = 0xffffffff;
-
-#if HWPMBVPDACCESSORTEST_UT3
- // Get
- l_fapirc=(*l_accessMBvpdL4BankDelete)(l_fapi_mb_target,
- l_val,
- GET_L4_BANK_DELETE_MODE);
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetVersion: HWP accessor get fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testL4BankDelete accessor get 0x%08x",l_val);
- }
- // Set (use same value)
- l_fapirc=(*l_accessMBvpdL4BankDelete)(l_fapi_mb_target,
- l_val,
- SET_L4_BANK_DELETE_MODE);
- if (l_fapirc)
- {
- TS_FAIL( "fapiL4BankDelete accessor set fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-#endif
- // verify attribute
- l_val = 0xffffffff;
- // Get
- l_fapirc = FAPI_ATTR_GET(ATTR_L4_BANK_DELETE_VPD,
- &l_fapi_mb_target,
- l_val);
- if (l_fapirc)
- {
- TS_FAIL( "fapiL4BankDelete: HWP attribute get fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testL4BankDelete attribute get 0x%08x",l_val);
- }
-#if HWPMBVPDACCESSORTEST_UT3
- // Set (use same value)
- l_fapirc = FAPI_ATTR_SET(ATTR_L4_BANK_DELETE_VPD,
- &l_fapi_mb_target,
- l_val);
- if (l_fapirc)
- {
- TS_FAIL( "fapiL4BankDelete: HWP attribute set fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-#endif
- }
-
- TS_TRACE( "testL4BankDelete exit" );
- }
-
-/**
- * @brief call getMBvpdSensorMap to fetch sensor map
- * attributes from the MW keyword
- *
- */
- void testGetSensorMap()
- {
- fapi::ReturnCode l_fapirc;
- uint8_t l_val = 0xFF;
-
- TS_TRACE( "testGetSensorMap entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetSensorMap l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- // make a local copy of the memory buffer target
- TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
-
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mb_target(
- TARGET_TYPE_MEMBUF_CHIP,
- (const_cast<TARGETING::Target*>(l_mb_target)) );
-
-#if HWPMBVPDACCESSORTEST_UT7
- // test accessor directly
- getMBvpdSensorMap_FP_t (l_getMBvpdSensorMap) = &getMBvpdSensorMap;
-
- // Primary Sensor Map
- l_fapirc = (*l_getMBvpdSensorMap)(l_fapi_mb_target,
- fapi::SENSOR_MAP_PRIMARY, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSensorMap accessor "
- "SENSOR_MAP_PRIMARY=0x%02x", l_val);
-
- // Secondary Sensor Map
- l_fapirc = (*l_getMBvpdSensorMap)(l_fapi_mb_target,
- fapi::SENSOR_MAP_SECONDARY, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSensorMap accessor "
- "SENSOR_MAP_SECONDARY=0x%02x", l_val);
-
- // test attribute
- // Primary Sensor Map
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CDIMM_SENSOR_MAP_PRIMARY,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSensorMap attr "
- "SENSOR_MAP_PRIMARY=0x%02x", l_val);
-#endif
-
- // Secondary Sensor Map
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CDIMM_SENSOR_MAP_SECONDARY,
- &l_fapi_mb_target, l_val);
- if (l_fapirc) break;
- TS_TRACE( "testSensorMap attr "
- "SENSOR_MAP_SECONDARY=0x%02x", l_val);
- }
-
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetSensorMap: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-
- TS_TRACE( "testGetSensorMap exit" );
-
- }
-
- /**
- * @brief call getMBvpdVersion to fetch vpd version
- *
- */
- void testGetVersion()
- {
- fapi::ReturnCode l_fapirc;
- getMBvpdVersion_FP_t (l_getMBvpdVersion)
- = &getMBvpdVersion;
-
- TS_TRACE( "testGetVersion entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetVersion l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- TS_TRACE( "testGetVersion l_mbaBufList.size()=%d",
- l_mbaList.size());
-
- // loop thru all the mbas (should be 2)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbaNum = 0; // check them all in unit test
-#else
- uint8_t l_mbaNum = (l_mbaList.size() > 0) ? l_mbaList.size()-1:0 ;
-#endif
- for (; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- TARGETING::TargetHandleList l_dimmList;
-
- getChildAffinityTargets(l_dimmList,l_mbaList[l_mbaNum],
- CLASS_LOGICAL_CARD,TYPE_DIMM,false);
- TS_TRACE( "testGetVersion l_dimmList.size()=%d",
- l_dimmList.size());
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])));
-
- // verify HWP accessor
- uint32_t l_val = 0xffffffff;
-
- l_fapirc = (*l_getMBvpdVersion)(l_fapi_mba_target,l_val);
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetVersion: HWP accessor fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testGetVersion accessor 0x%08x",l_val);
- }
-
- // loop thru all the DIMMs (should be 4)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_dimmNum = 0; // check them all in unit test
-#else
- uint8_t l_dimmNum =
- (l_dimmList.size() > 0) ? l_dimmList.size()-1:0 ;
-#endif
- for (; l_dimmNum < l_dimmList.size(); l_dimmNum++ )
- {
- // dump physical path to target
- EntityPath l_path;
- l_path = l_dimmList[l_dimmNum]->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_dimm_target(
- TARGET_TYPE_DIMM,
- (const_cast<TARGETING::Target*>(l_dimmList[l_dimmNum])));
-
- // verify getting all attributes
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_VERSION,
- &l_fapi_dimm_target,
- l_val);
- TS_TRACE( "testGetVersion attribute %d 0x%08x",
- l_dimmNum,l_val);
- }
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetVersion: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- }
- }
-
- TS_TRACE( "testGetVersion exit" );
-
- }
-
- /**
- * @brief call getMBvpdDram2NModeEnabled to retrieve 2N mode
- *
- */
- void testGetDram2NModeEnabled()
- {
- fapi::ReturnCode l_fapirc;
- getMBvpdDram2NModeEnabled_FP_t (l_getMBvpdDram2NModeEnabled)
- = &getMBvpdDram2NModeEnabled;
-
- TS_TRACE( "testGetDram2NModeEnabled entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetDram2NModeEnabled l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- TS_TRACE( "testGetDram2NModeEnabled l_mbaBufList.size()=%d",
- l_mbaList.size());
-
- // loop thru all the mbas (should be 2)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbaNum = 0; // check them all in unit test
-#else
- uint8_t l_mbaNum = (l_mbaList.size() > 0) ? l_mbaList.size()-1:0 ;
-#endif
- for (; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])));
-
- // verify HWP accessor
- uint8_t l_val = 0xFF;
-
- l_fapirc = (*l_getMBvpdDram2NModeEnabled)
- (l_fapi_mba_target,l_val);
- if (l_fapirc)
- {
- TS_FAIL("fapiGetDram2NModeEnabled:HWP accessor fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE("testGetDram2NModeEnabled accessor 0x%02x",
- l_val);
- }
- // verify attribute
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_2N_MODE_ENABLED,
- &l_fapi_mba_target,
- l_val);
- if (l_fapirc)
- {
- TS_FAIL("fapiGetDram2NModeEnabled:"
- " FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testGetDram2NModeEnabled attribute 0x%02x",
- l_val);
- }
- }
- }
-
- TS_TRACE( "testGetDram2NModeEnabled exit" );
-
- }
-
-
- /**
- * @brief call getMBvpdAddrMirrorData to fetch memory buffer AM attributes
- *
- */
- void testGetAddrMirrorData()
- {
- fapi::ReturnCode l_fapirc;
- getMBvpdAddrMirrorData_FP_t (l_getMBvpdAddrMirrorData)
- = &getMBvpdAddrMirrorData;
-
- TS_TRACE( "testGetAddrMirrorData entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetAddrMirrorData l_memBufList.size()=%d",
- l_memBufList.size() );
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- TS_TRACE( "testGetAddrMirrorData l_mbaBufList.size()=%d",
- l_mbaList.size());
-
- // loop thru all the mbas (should be 2)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbaNum = 0; // check them all in unit test
-#else
- uint8_t l_mbaNum = (l_mbaList.size() > 0) ? l_mbaList.size()-1:0 ;
-#endif
- for (; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])));
-
- // verify HWP accessor
- uint8_t l_val[2][2] = {{0xFF,0xFF},{0xFF,0xFF}};
-
- l_fapirc = (*l_getMBvpdAddrMirrorData)(l_fapi_mba_target,l_val);
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetAddrMirrorData: HWP accessor fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testGetAddrMirrorData accessor "
- "(0x%02x,0x%02x),(0x%02x,0x%02x)",
- l_val[0][0], l_val[0][1], l_val[1][0], l_val[1][1]);
- }
-
- // verify attribute
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_ADDRESS_MIRRORING,
- &l_fapi_mba_target,
- l_val);
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetAddrMirrorData: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- TS_TRACE( "testGetAddrMirrorData attribute "
- "(0x%02x,0x%02x),(0x%02x,0x%02x)",
- l_val[0][0], l_val[0][1], l_val[1][0], l_val[1][1]);
- }
- }
- }
-
- TS_TRACE( "testGetAddrMirrorData exit" );
-
- }
-
- /**
- * @brief call getMBvpdAttr to fetch memory buffer MT attributes
- *
- */
- void testGetTermData()
- {
- fapi::ReturnCode l_fapirc;
- uint8_t val1[2][2] = {{0xFF,0xFF},{0xFF,0xFF}};
- uint32_t val3[2] = {0xFFFFFFFF,0xFFFFFFFF};
- uint32_t val7[2][2] = {{0xFFFFFFFF,0xFFFFFFFF},
- {0xFFFFFFFF,0xFFFFFFFF}};
-#if HWPMBVPDACCESSORTEST_UT4
- uint8_t val2[2][2][4]={
- {{0xFF,0xFF,0xFF,0xFF},{0xFF,0xFF,0xFF,0xFF}},
- {{0xFF,0xFF,0xFF,0xFF},{0xFF,0xFF,0xFF,0xFF}}};
- uint8_t l_errorChk = 1; //do error checks just once
- uint8_t val4[2] = {0xFF,0xFF};
- uint8_t val5[2] = {0xFF,0xFF};
-#endif
- uint64_t val6 = 0xFFFFFFFFFFFFFFFF;
-
-#if HWPMBVPDACCESSORTEST_UT4
- getMBvpdAttr_FP_t (l_getMBvpdAttr)
- = &getMBvpdAttr;
-#endif
- TS_TRACE( "testGetTermData entry" );
-
- // ensure attributes are in proper version order
- for (uint32_t i=0;
- i < fapi::getAttrData::g_MBVPD_ATTR_DEF_array_size; i++)
- {
- fapi::AttributeId l_attrId =
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[i].iv_attrId;
- fapi::getAttrData::DimmType l_dimmType =
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[i].iv_dimmType;
- fapi::getAttrData::VpdVersion l_version =
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[i].iv_version;
- // from this piont to the end of the table, for this attribute
- // dimm type and version type (VZ or VD),
- // the version should be less in value.
- // Otherwise, an intended match will not be found
- fapi::getAttrData::VpdVersion l_verType =
- (fapi::getAttrData::VpdVersion)
- (l_version & fapi::getAttrData::ALL_VER);
- l_version = (fapi::getAttrData::VpdVersion)
- (l_version & fapi::getAttrData::VER_MASK);
-
- for (uint32_t j=i+1;
- j < fapi::getAttrData::g_MBVPD_ATTR_DEF_array_size; j++)
- {
- if ( (l_attrId ==
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_attrId) &&
- (l_verType &
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_version &
- fapi::getAttrData::ALL_VER) &&
- ((l_dimmType ==
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_dimmType) ||
- ( fapi::getAttrData::ALL_DIMM ==
- fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_dimmType)) &&
- (l_version <
- (fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_version &
- fapi::getAttrData::VER_MASK)))
- {
- TS_FAIL( "testGetTermData table error: "
- " attr 0x%08x dimm %d row %d version 0x%04x <"
- " row %d version 0x%04x",
- l_attrId,l_dimmType,i,l_version,
- j,
- (fapi::getAttrData::g_MBVPD_ATTR_DEF_array[j].iv_version &
- fapi::getAttrData::VER_MASK));
- }
- }
- }
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetTermData l_memBufList.size()=%ld",
- l_memBufList.size() );
-
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- TS_TRACE( "testGetTermData l_mbaBufList.size()=%ld",
- l_mbaList.size());
-
- // loop thru all the mbas (should be 2)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbaNum = 0; // check them all in unit test
-#else
- uint8_t l_mbaNum = (l_mbaList.size() > 0) ? l_mbaList.size()-1:0 ;
-#endif
- for (; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mbaList[l_mbaNum]->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target(
- TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])) );
-
-#if HWPMBVPDACCESSORTEST_UT4
- // check for interface errors being caught. Just once.
- if (l_errorChk) {
- // check size matches type for each of the 4 types
- l_fapirc = (*l_getMBvpdAttr)(l_fapi_mba_target,
- fapi::ATTR_VPD_DRAM_RON,
- &val1, sizeof(val1)+1); //invalid size
- if (l_fapirc != fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE)
- {
- TS_FAIL("testGetTermData: expect invalid size RC"
- " for output type UINT8_BY2_BY2_t:"
- " 0x%08x,0x%08x",
- fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE,
- static_cast<uint32_t>(l_fapirc));
- }
- l_fapirc = (*l_getMBvpdAttr)(l_fapi_mba_target,
- fapi::ATTR_VPD_DRAM_RTT_NOM,
- &val2, sizeof(val2)-1); //invalid size
- if (l_fapirc != fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE)
- {
- TS_FAIL("testGetTermData: expect invalid size RC"
- " for output type UINT8_BY2_BY2_BY4_t:"
- " 0x%08x,0x%08x",
- fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE,
- static_cast<uint32_t>(l_fapirc));
- }
- l_fapirc = (*l_getMBvpdAttr)(l_fapi_mba_target,
- fapi::ATTR_VPD_CEN_RD_VREF,
- &val3, sizeof(val3)+2); //invalid size
- if (l_fapirc != fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE)
- {
- TS_FAIL("testGetTermData: expect invalid size RC"
- " for output type UINT32_BY2_t:"
- " 0x%08x,0x%08x",
- fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE,
- static_cast<uint32_t>(l_fapirc));
- }
- l_fapirc = (*l_getMBvpdAttr)(l_fapi_mba_target,
- fapi::ATTR_VPD_DRAM_WRDDR4_VREF,
- &val4, 0); //invalid size
- if (l_fapirc != fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE)
- {
- TS_FAIL("testGetTermData: expect invalid size RC"
- " for output type UINT8_BY2_t:"
- " 0x%08x,0x%08x",
- fapi::RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE,
- static_cast<uint32_t>(l_fapirc));
- }
- // check for catching an invalid ID
- l_fapirc = (*l_getMBvpdAttr)(l_fapi_mba_target,
- (fapi::AttributeId)99, //invalid ID
- &val1, sizeof(val1));
- if (l_fapirc != fapi::RC_MBVPD_ATTRIBUTE_NOT_FOUND)
- {
- TS_FAIL("testGetTermData: expect invalid ID:"
- " 0x%08x,0x%08x",
- fapi::RC_MBVPD_ATTRIBUTE_NOT_FOUND,
- static_cast<uint32_t>(l_fapirc));
- }
- l_errorChk =0;
- }
-#endif
- // Verify fetching attributes using FAPI_ATTR_GET
- // TERM_DATA_DRAM_RON
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_RON,
- &l_fapi_mba_target, val1);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_DRAM_RON=(0x%02x,0x%02x),(0x%02x,0x%02x)",
- val1[0][0], val1[0][1], val1[1][0], val1[1][1]);
-
-#if HWPMBVPDACCESSORTEST_UT4
- // TERM_DATA_DRAM_RTT_NOM
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_RTT_NOM,
- &l_fapi_mba_target, val2);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_DRAM_RTT_NOM");
- TS_TRACE("testGetTermData[0][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][0][0], val2[0][0][1], val2[0][0][2], val2[0][0][3]);
- TS_TRACE("testGetTermData[0][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][1][0], val2[0][1][1], val2[0][1][2], val2[0][1][3]);
- TS_TRACE("testGetTermData[1][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][0][0], val2[1][0][1], val2[1][0][2], val2[1][0][3]);
- TS_TRACE("testGetTermData[1][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][1][0], val2[1][1][1], val2[1][1][2], val2[1][1][3]);
-
- // TERM_DATA_DRAM_RTT_WR
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_RTT_WR,
- &l_fapi_mba_target, val2);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_DRAM_RTT_WR");
- TS_TRACE("testGetTermData[0][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][0][0], val2[0][0][1], val2[0][0][2], val2[0][0][3]);
- TS_TRACE("testGetTermData[0][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][1][0], val2[0][1][1], val2[0][1][2], val2[0][1][3]);
- TS_TRACE("testGetTermData[1][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][0][0], val2[1][0][1], val2[1][0][2], val2[1][0][3]);
- TS_TRACE("testGetTermData[1][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][1][0], val2[1][1][1], val2[1][1][2], val2[1][1][3]);
-
- // TERM_DATA_ODT_RD
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ODT_RD,
- &l_fapi_mba_target, val2);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_ODT_RD");
- TS_TRACE("testGetTermData[0][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][0][0], val2[0][0][1], val2[0][0][2], val2[0][0][3]);
- TS_TRACE("testGetTermData[0][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][1][0], val2[0][1][1], val2[0][1][2], val2[0][1][3]);
- TS_TRACE("testGetTermData[1][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][0][0], val2[1][0][1], val2[1][0][2], val2[1][0][3]);
- TS_TRACE("testGetTermData[1][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][1][0], val2[1][1][1], val2[1][1][2], val2[1][1][3]);
-
- // TERM_DATA_ODT_WR
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ODT_WR,
- &l_fapi_mba_target, val2);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_ODT_WR");
- TS_TRACE("testGetTermData[0][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][0][0], val2[0][0][1], val2[0][0][2], val2[0][0][3]);
- TS_TRACE("testGetTermData[0][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[0][1][0], val2[0][1][1], val2[0][1][2], val2[0][1][3]);
- TS_TRACE("testGetTermData[1][0]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][0][0], val2[1][0][1], val2[1][0][2], val2[1][0][3]);
- TS_TRACE("testGetTermData[1][1]=0x%02x,0x%02x,0x%02x,0x%02x",
- val2[1][1][0], val2[1][1][1], val2[1][1][2], val2[1][1][3]);
-#endif
- // ATTR_VPD_DIMM_RCD_OUTPUT_TIMING
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,
- &l_fapi_mba_target, val1);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "ATTR_VPD_DIMM_RCD_OUTPUT_TIMING=(0x%02x,0x%02x),(0x%02x,0x%02x)",
- val1[0][0], val1[0][1], val1[1][0], val1[1][1]);
-
- // ATTR_VPD_DIMM_RCD_IBT
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DIMM_RCD_IBT,
- &l_fapi_mba_target, val7);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "ATTR_VPD_DIMM_RCD_IBT=(0x%08x,0x%08x),(0x%08x,0x%08x)",
- val7[0][0], val7[0][1], val7[1][0], val7[1][1]);
-
- // TERM_DATA_CEN_RD_VREF
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_RD_VREF,
- &l_fapi_mba_target, val3);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_RD_VREF=0x%08x,0x%08x",
- val3[0], val3[1]);
-
-#if HWPMBVPDACCESSORTEST_UT4
- // TERM_DATA_DRAM_WR_VREF
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_WR_VREF,
- &l_fapi_mba_target, val3);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_DRAM_WR_VREF=0x%08x,0x%08x",
- val3[0], val3[1]);
-
- // TERM_DATA_DRAM_WRDDR4_VREF
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_DRAM_WRDDR4_VREF,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_DRAM_WRDDR4_VREF=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_RCV_IMP_DQ_DQS
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_RCV_IMP_DQ_DQS,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_RCV_IMP_DQ_DQS=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_DRV_IMP_DQ_DQS
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_DRV_IMP_DQ_DQS,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_DRV_IMP_DQ_DQS=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_DRV_IMP_CNTL
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_DRV_IMP_CNTL,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_DRV_IMP_CNTL=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_DRV_IMP_ADDR
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_DRV_IMP_ADDR,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_DRV_IMP_ADDR=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_DRV_IMP_CLK
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_DRV_IMP_CLK,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_DRV_IMP_CLK=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_DRV_IMP_SPCKE
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_DRV_IMP_SPCKE,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_DRV_IMP_SPCKE=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_SLEW_RATE_DQ_DQS
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_SLEW_RATE_DQ_DQS,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_SLEW_RATE_DQ_DQS=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_SLEW_RATE_CNTL
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_SLEW_RATE_CNTL,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_SLEW_RATE_CNTL=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_SLEW_RATE_ADDR
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_SLEW_RATE_ADDR,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_SLEW_RATE_ADDR=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_SLEW_RATE_CLK
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_SLEW_RATE_CLK,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_SLEW_RATE_CLK=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CEN_SLEW_RATE_SPCKE
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_SLEW_RATE_SPCKE,
- &l_fapi_mba_target, val4);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CEN_SLEW_RATE_SPCKE=0x%02x,0x%02x",
- val4[0], val4[1]);
-
- // TERM_DATA_CKE_PRI_MAP
- val3[0] = 0xFFFFFFFF;
- val3[1] = 0xFFFFFFFF;
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CKE_PRI_MAP,
- &l_fapi_mba_target, val3);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CKE_PRI_MAP=0x%08x,0x%08x",
- val3[0], val3[1]);
-#endif
-
- // TERM_DATA_CKE_PWR_MAP
- val6 = 0xFFFFFFFFFFFFFFFF;
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CKE_PWR_MAP,
- &l_fapi_mba_target, val6);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_CKE_PWR_MAP=0x%016lx", val6);
-
-#if HWPMBVPDACCESSORTEST_UT4
- // TERM_DATA_RLO
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_RLO,
- &l_fapi_mba_target, val5);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_VPD_RLO=(0x%02x,0x%02x)",
- val5[0], val5[1]);
-
- // TERM_DATA_WLO
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_WLO,
- &l_fapi_mba_target, val5);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_VPD_WLO=(0x%02x,0x%02x)",
- val5[0], val5[1]);
-
- // TERM_DATA_GPO
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_GPO,
- &l_fapi_mba_target, val5);
- if (l_fapirc) break;
- TS_TRACE( "testGetTermData attr "
- "TERM_DATA_VPD_GPO=(0x%02x,0x%02x)",
- val5[0], val5[1]);
-#endif
- }
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetTermData: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- }
-
-
- TS_TRACE( "testGetTermData exit" );
-
- }
-
-
- /**
- * @brief call getMBvpdAttr to fetch memory buffer MR attributes
- *
- */
- void testGetPhaseRotatorData()
- {
- fapi::ReturnCode l_fapirc;
- const uint8_t PORT_SIZE = 2;
- uint8_t l_attr_eff_cen_phase_rot[PORT_SIZE];
-
- TS_TRACE( "testGetPhaseRotatorData entry" );
-
- TARGETING::TargetHandleList l_memBufList;
- getAllChips(l_memBufList, TYPE_MEMBUF);
-
- TS_TRACE( "testGetPhaseRotatorData l_memBufList.size()=%ld",
- l_memBufList.size() );
-
- // loop thru memory buffers
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbNum = 0; // check them all in unit test
-#else
- uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
-#endif
- for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
- {
- TARGETING::TargetHandleList l_mbaList;
- getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum],
- CLASS_UNIT,TYPE_MBA,false);
-
- TS_TRACE( "testGetPhaseRotatorData l_mbaBufList.size()=%ld",
- l_mbaList.size());
-
- // loop thru all the mbas (should be 2)
-#if HWPMBVPDACCESSORTEST_UT0
- uint8_t l_mbaNum = 0; // check them all in unit test
-#else
- uint8_t l_mbaNum = (l_mbaList.size() > 0) ? l_mbaList.size()-1:0 ;
-#endif
- for (; l_mbaNum < l_mbaList.size(); l_mbaNum++ )
- {
- // dump physical path to target
- EntityPath l_path;
- l_path = l_mbaList[l_mbaNum]->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_mba_target(
- TARGET_TYPE_MBA_CHIPLET,
- (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum])) );
-
- // verify getting all attributes
-
- // getting all the attributes is a bit of over kill.
- // cen_ddrphy.initfile accesses all the values
- // the exhaustive test is good for unit test
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-#if HWPMBVPDACCESSORTEST_UT5
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A3,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A3=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A4,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A4=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A5,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A5=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A6,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A6=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A7,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A7=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A8,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A8=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A9,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A9=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A10,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A10=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A11,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A11=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A12,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A12=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A13,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A13=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A14,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A14=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_A15,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_A15=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_CASN,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_CASN=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_RASN,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_RASN=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_CMD_WEN,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_CMD_WEN=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_PAR,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_PAR=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M_ACTN,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M_ACTN=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE3,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE3=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN3,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN3=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE3,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE3=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN2,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN2=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN3,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN3=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT0,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT0=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT1,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT1=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
-#endif
-#ifdef HWPMBVPDACCESSORTEST_UT6
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_TSYS_ADR,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_TSYS_ADR=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-
- l_fapirc = FAPI_ATTR_GET(ATTR_VPD_TSYS_DP18,
- &l_fapi_mba_target,
- l_attr_eff_cen_phase_rot);
- if (l_fapirc) break;
- TS_TRACE( "testGetPhaseRotatorData"
- " ATTR_VPD_TSYS_DP18=(0x%02x,0x%02x)",
- l_attr_eff_cen_phase_rot[0],
- l_attr_eff_cen_phase_rot[1]);
-#endif
- }
- if (l_fapirc)
- {
- TS_FAIL( "fapiGetPhaseRotatorData: FAPI_ATTR_GET fail rc=0x%x",
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- }
-
- TS_TRACE( "testGetPhaseRotatorData exit" );
-
- }
-
-}; // end class
-
-#endif
diff --git a/src/usr/hwpf/test/hwpMvpdAccessorTest.H b/src/usr/hwpf/test/hwpMvpdAccessorTest.H
deleted file mode 100644
index 111f80388..000000000
--- a/src/usr/hwpf/test/hwpMvpdAccessorTest.H
+++ /dev/null
@@ -1,899 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/hwpMvpdAccessorTest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
-/* */
-/* 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 __HWPMVPDACCESSORTEST_H
-#define __HWPMVPDACCESSORTEST_H
-
-// set to 1 for doing unit tests, set to 0 for production
-#define HWPMVPDACCESSORTEST_UT 0
-
-/**
- * @file hwpMvpdAccessorTest.H
- *
- * @brief Test cases for Mvpd HWP accessors.
-*/
-
-#include <cxxtest/TestSuite.H>
-
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
-
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/utilFilter.H>
-
-#include <getMvpdRing.H>
-#include <setMvpdRing.H>
-
-#include <errl/errlmanager.H>
-#include <errl/errlentry.H>
-#include <devicefw/driverif.H>
-#include <trace/interface.H>
-
-// pull in CompressedScanData def from proc_slw_build HWP
-#include <p8_scan_compression.H>
-
-using namespace fapi;
-using namespace TARGETING;
-
-class hwpMvpdAccessorTest: public CxxTest::TestSuite
-{
-public:
-
- /**
- * @brief call fapiGetMvpdField to fetch a mvpd records.
- *
- */
- void testGetMvpd()
- {
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
- uint8_t *l_pdRRecord = NULL;
- uint32_t l_pdRLen = 0;
-
- // list of MVPD records to test. Need to be in PNOR or procmvpd.dat
- // when g_usePNOR is false.
- struct _testMvpdRecords {
- fapi::MvpdRecord record;
- fapi::MvpdKeyword keyword;
- } l_mvpdRecords[] = {
-#if HWPMVPDACCESSORTEST_UT
- { MVPD_RECORD_CP00, MVPD_KEYWORD_PDG},
- { MVPD_RECORD_MER0, MVPD_KEYWORD_PDI},
-// { MVPD_RECORD_VER0, MVPD_KEYWORD_PDI}, //VER0 in spec,not supported
-#endif
- { MVPD_RECORD_VWML, MVPD_KEYWORD_PDI},
- };
-
- TS_TRACE( "testGetMvpd entry" );
-
- TARGETING::TargetHandleList l_cpuTargetList;
- getAllChips(l_cpuTargetList, TYPE_PROC);
-
- TS_TRACE( "testGetMvpd l_cpuTargetList.size()= 0x%x ",
- l_cpuTargetList.size() );
-
-
- // loop thru all the cpu's
- for (TargetHandleList::iterator l_cpu_iter = l_cpuTargetList.begin();
- l_cpu_iter != l_cpuTargetList.end();
- ++l_cpu_iter)
- {
- // make a local copy of the CPU target
- TARGETING::Target* l_cpu_target = *l_cpu_iter;
-
- TS_TRACE( "target HUID %.8X", TARGETING::get_huid(l_cpu_target));
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_cpu_target(
- TARGET_TYPE_PROC_CHIP,
- (const_cast<TARGETING::Target*>(l_cpu_target)) );
-
- // loop through mvpd records of interest
- const uint32_t numRecords =
- sizeof(l_mvpdRecords)/sizeof(l_mvpdRecords[0]);
- for (uint8_t i=0;i<numRecords;i++) {
-
- TS_TRACE( "record = 0x%x keyword = 0x%x",
- l_mvpdRecords[i].record,
- l_mvpdRecords[i].keyword);
-
- TS_TRACE( "call fapiGetMvpdField with NULL pointer" );
-
- // call fapiGetMvpdField once with a NULL pointer to get the
- // buffer size should return no error now.
- l_fapirc = fapiGetMvpdField(l_mvpdRecords[i].record,
- l_mvpdRecords[i].keyword,
- l_fapi_cpu_target,
- NULL,
- l_pdRLen );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "fapiGetMvpdField: expected FAPI_RC_SUCCESS" );
- fapiLogError(l_fapirc);
- return;
- }
-
- TS_TRACE( "fapiGetMvpdField: size of record = 0x%x",
- l_pdRLen );
-
- // do a malloc instead of a new just for variety
- l_pdRRecord = reinterpret_cast<uint8_t *>(malloc(l_pdRLen) );
-
- // call fapiGetMvpdField once with a valid pointer
- l_fapirc = fapiGetMvpdField(l_mvpdRecords[i].record,
- l_mvpdRecords[i].keyword,
- l_fapi_cpu_target,
- l_pdRRecord,
- l_pdRLen );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "fapiGetMvpdField: expected FAPI_RC_SUCCESS" );
- fapiLogError(l_fapirc);
- free( l_pdRRecord );
- return;
- }
-
- // clean up memory
- free( l_pdRRecord );
- }
- }
-
- TS_TRACE( "testGetMvpd exit" );
- }
-
-
- // Structure used to save/restore the VPD
- typedef struct saveRestoreData_t {
- TARGETING::Target* target;
- uint8_t* CP00_pdG;
- size_t CP00_pdG_size;
- uint8_t* CP00_pdR;
- size_t CP00_pdR_size;
- } saveRestoreData_t;
-
- /**
- * @brief Test get and set of Repair Rings
- */
- void testRepairRings()
- {
- fapi::ReturnCode l_fapirc = fapi::FAPI_RC_SUCCESS;
- uint8_t *l_pRingBuf = NULL;
- uint32_t l_ringBufsize = 0;
- uint32_t l_ringId = 0;
- uint32_t l_chipletId = 0;
- uint32_t l_bufsize = 0x200;
- errlHndl_t l_errhdl = NULL;
-
- // This data needs to be in sync with the procmvpd.dat file
- // the setMvpdFunc tests use the last row. The test
- // expects it to be a mid x20 byte ring in the #G keyword
- struct _testRRstr {
- fapi::MvpdKeyword keyword;
- uint32_t ringIdval;
- uint32_t chipletIdval;
- uint32_t size;
- uint32_t rc;
- } l_ringModifiers[] = {
- { MVPD_KEYWORD_PDG, 0xa4, 0xFF, 0x20, //last #G
- fapi::RC_REPAIR_RING_NOT_FOUND },
- { MVPD_KEYWORD_PDR, 0xe0, 0x08, 0x20, //first #R
- FAPI_RC_SUCCESS },
- { MVPD_KEYWORD_PDR, 0xe2, 0x16, 0x20, //big #R
- FAPI_RC_SUCCESS },
- { MVPD_KEYWORD_PDG, 0xa2, 0x08, 0x20, //mid #G
- FAPI_RC_SUCCESS },
- { MVPD_KEYWORD_PDR, 0xe1, 0x16, 0x20,//big #R
- FAPI_RC_SUCCESS },
- };
- const size_t VALID_INDEX = 2;
- const size_t TEST_INDEX = 4;
-
- TS_TRACE( "testRepairRings entry" );
-
- std::list<saveRestoreData_t> l_srData;
-
- TARGETING::TargetHandleList l_cpuTargetList;
- getAllChips(l_cpuTargetList, TYPE_PROC);
-
- // loop thru all the cpu's
- for (TargetHandleList::iterator l_cpu_iter = l_cpuTargetList.begin();
- l_cpu_iter != l_cpuTargetList.end();
- ++l_cpu_iter)
- {
- // make a local copy of the CPU target
- TARGETING::Target* l_cpu_target = *l_cpu_iter;
-
- TS_TRACE( "testRepairRings: "
- "target HUID %.8X",
- TARGETING::get_huid(l_cpu_target));
-
- //-- Save the entire VPD record to restore later
- saveRestoreData_t tmpsave;
- tmpsave.target = l_cpu_target;
-
- // do a read with NULL buffer to get the record size
- l_errhdl = deviceRead( l_cpu_target,
- NULL,
- tmpsave.CP00_pdG_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDG ) );
- if( l_errhdl )
- {
- TS_FAIL("Error finding size of CP00/#G for %.8X",
- TARGETING::get_huid(l_cpu_target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- continue;
- }
-
- // now go get the data
- tmpsave.CP00_pdG = new uint8_t[tmpsave.CP00_pdG_size];
- l_errhdl = deviceRead( l_cpu_target,
- tmpsave.CP00_pdG,
- tmpsave.CP00_pdG_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDG ) );
- if( l_errhdl )
- {
- TS_FAIL("Error reading CP00/#G from %.8X",
- TARGETING::get_huid(l_cpu_target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- delete[] tmpsave.CP00_pdG;
- continue;
- }
-
- // do a read with NULL buffer to get the record size
- l_errhdl = deviceRead( l_cpu_target,
- NULL,
- tmpsave.CP00_pdR_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR ) );
- if( l_errhdl )
- {
- TS_FAIL("Error finding size of CP00/#R for %.8X",
- TARGETING::get_huid(l_cpu_target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- continue;
- }
-
- // now go get the data
- tmpsave.CP00_pdR = new uint8_t[tmpsave.CP00_pdR_size];
- l_errhdl = deviceRead( l_cpu_target,
- tmpsave.CP00_pdR,
- tmpsave.CP00_pdR_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR ) );
- if( l_errhdl )
- {
- TS_FAIL("Error reading CP00/#R from %.8X",
- TARGETING::get_huid(l_cpu_target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- delete[] tmpsave.CP00_pdR;
- continue;
- }
-
- // add to the master list
- l_srData.push_back(tmpsave);
-
- // cast OUR type of target to a FAPI type of target.
- fapi::Target l_fapi_cpu_target(
- TARGET_TYPE_PROC_CHIP,
- (const_cast<TARGETING::Target*>(l_cpu_target)) );
-
- // allocate some space to put the record(s)
- if( l_pRingBuf != NULL )
- {
- delete[] l_pRingBuf;
- }
- l_pRingBuf = new uint8_t[l_bufsize];
-
- // ----------------------------------------------------------------
- // Pass in 0 for the ring modifier, should return with "not found"
- // error
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: pass in invalid ringId" );
- l_ringBufsize = l_bufsize;
- l_ringId = 0; // ringId
- l_chipletId = 0; // chipletId
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
- TS_TRACE("testRepairRings:ringId=0x%x chipletId=0x%x Bufsize=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- if ( l_fapirc != fapi::RC_REPAIR_RING_NOT_FOUND )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL("testRepairRings: expect not found rc FAIL: 0x%x, 0x%x",
- fapi::RC_REPAIR_RING_NOT_FOUND,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // Pass in a buffer size that is too small with a valid
- // ringId/chipletId, should return error with correct length
- // and invalid size return code..
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: pass buffer too small %d ",
- VALID_INDEX );
- l_ringBufsize = 0x0;
- l_ringId = l_ringModifiers[VALID_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[VALID_INDEX].chipletIdval;
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
- TS_TRACE("testRepairRings:ringId=0x%x chipletId=0x%x: Bufsize=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- if ( l_fapirc != fapi::RC_REPAIR_RING_INVALID_SIZE )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL("testRepairRings: expect invalid size FAIL: exp=0x%x,"
- " act=0x%x, ring=0x%X",
- fapi::RC_REPAIR_RING_INVALID_SIZE,
- static_cast<uint32_t>(l_fapirc),
- l_ringId);
-
- fapiLogError(l_fapirc);
- }
- else if ( l_ringBufsize != l_ringModifiers[VALID_INDEX].size )
- {
- TS_FAIL( "testRepairRings: size mismatch FAIL1 on ring 0x%X:"
- " exp=0x%x, act=0x%x",
- l_ringId,
- l_ringModifiers[VALID_INDEX].size,
- l_ringBufsize );
- }
-
- // ----------------------------------------------------------------
- // Pass in a NULL pointer with a valid ringId/chipletId, should
- // return with correct length and successful return code.
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: get size of ring %d ", VALID_INDEX );
- l_ringBufsize = 0x0;
- l_ringId = l_ringModifiers[VALID_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[VALID_INDEX].chipletIdval;
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- NULL,
- l_ringBufsize );
- TS_TRACE("testRepairRings:ringId=0x%x chipletId=0x%x: Bufsize=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- if ( l_fapirc )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: expect success rc FAIL: 0x%x, 0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc));
-
- fapiLogError(l_fapirc);
- }
- else if ( l_ringBufsize != l_ringModifiers[VALID_INDEX].size )
- {
- TS_FAIL( "testRepairRings: size mismatch FAIL2 on ring 0x%X:"
- " exp=0x%x, act=0x%x",
- l_ringId,
- l_ringModifiers[VALID_INDEX].size,
- l_ringBufsize );
- }
-
- // ----------------------------------------------------------------
- // Fetch rings
- // ----------------------------------------------------------------
- const uint32_t numRings =
- sizeof(l_ringModifiers)/sizeof(l_ringModifiers[0]);
- for (size_t i=0;i<numRings;i++)
- {
- TS_TRACE( "testRepairRings: get ring %d", i );
- l_ringBufsize = l_bufsize;
- l_ringId = l_ringModifiers[i].ringIdval;
- l_chipletId = l_ringModifiers[i].chipletIdval;
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[i].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
- TS_TRACE("testRepairRings ringId=0x%x chipletId=0x%x size=0x%x",
- l_ringId, l_chipletId, l_ringBufsize );
-
- if ( l_fapirc != l_ringModifiers[i].rc )
- {
- // note: uint32_t below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 1: rc=0x%x,"
- " ring=0x%X, chiplet=0x%X, i=%d",
- static_cast<uint32_t>(l_fapirc),
- l_ringId,
- l_chipletId,
- i );
- fapiLogError(l_fapirc);
- continue;
- }
- else if( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- // not an error, but the next check isn't valid
- continue;
- }
-
- if ( l_ringBufsize != l_ringModifiers[i].size )
- {
- TS_FAIL( "testRepairRings: size mismatch FAIL3 on ring %X:"
- " exp=0x%x, act=0x%x",
- l_ringId,
- l_ringModifiers[i].size,
- l_ringBufsize );
- }
-
- // Dump ring buffer here.
- TRACDBIN(g_trac_test,"testRepairRings:Dump Repair Ring Buffer:",
- l_pRingBuf,
- l_ringBufsize );
- }
-
- // ----------------------------------------------------------------
- // write different data, read it back to verify, then put the
- // original data back.
- // ----------------------------------------------------------------
- uint32_t l_offset =0;
- uint8_t l_data = 0;
- uint8_t *l_pData = NULL;
-
- // use data from last fetch test case.
- TS_TRACE( "testRepairRings: update in place ring %d", TEST_INDEX );
- l_ringId = l_ringModifiers[TEST_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval;
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size;
-
- // put in recognizable data for the debug data dump
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for (l_offset = 0,l_data=0x10; l_offset <
- l_ringBufsize-sizeof(CompressedScanData); l_offset++)
- {
- *l_pData++ = l_data++;
- }
- TRACDBIN( g_trac_test, "testRepairRings: updated ring data:",
- l_pRingBuf,
- l_ringBufsize );
- setMvpdRing_FP_t (l_setMvpdRing) = &setMvpdRing; //verify typedef
- l_fapirc = (*l_setMvpdRing)( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 1: exp=0x%x,"
- " rc=0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // write back a smaller ring to cause a shift left in the record
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: shrink a ring %d", TEST_INDEX );
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size-4;
- reinterpret_cast<CompressedScanData *>(l_pRingBuf)->
- iv_size = l_ringBufsize;
-
- // put in recognizable data for the debug data dump
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for (l_offset = 0,l_data=0x20; l_offset <
- l_ringBufsize-sizeof(CompressedScanData); l_offset++)
- {
- *l_pData++ = l_data++;
- }
- TRACDBIN( g_trac_test, "testRepairRings: updated ring data:",
- l_pRingBuf,
- l_ringBufsize );
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 2:"
- " exp=0x%x, rc=0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
-
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // write back a larger ring to cause a shift right in the record
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: grow a ring %d", TEST_INDEX );
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size+16;
- reinterpret_cast<CompressedScanData *>(l_pRingBuf)->
- iv_size = l_ringBufsize;
-
- // put in recognizable data for the debug data dump
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for (l_offset = 0,l_data=0x30; l_offset <
- l_ringBufsize-sizeof(CompressedScanData); l_offset++)
- {
- *l_pData++ = l_data++;
- }
- TRACDBIN( g_trac_test, "testRepairRings: updated ring data:",
- l_pRingBuf,
- l_ringBufsize );
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 3: exp=0x%x,"
- " rc=0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
-
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // append a ring that is not already there to the end
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: append a ring" );
- l_ringId = 0x77;
- l_chipletId = 0x88;
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size;
- reinterpret_cast<CompressedScanData *>(l_pRingBuf)->
- iv_size = l_ringBufsize;
- reinterpret_cast<CompressedScanData *>(l_pRingBuf)->
- iv_ringId = l_ringId;
- reinterpret_cast<CompressedScanData *>(l_pRingBuf)->
- iv_chipletId = l_chipletId;
-
- // put in recognizable data for the debug data dump
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for (l_offset = 0,l_data=0x50; l_offset <
- l_ringBufsize-sizeof(CompressedScanData); l_offset++)
- {
- *l_pData++ = l_data++;
- }
- TRACDBIN( g_trac_test, "testRepairRings: updated ring data:",
- l_pRingBuf,
- l_ringBufsize );
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 4: exp=0x%x,"
- " rc=0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
-
- fapiLogError(l_fapirc);
- }
-
- // read back data to prove the writes worked
- l_ringId = l_ringModifiers[TEST_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval;
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size+16;
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 2: 0x%x, 0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for( l_offset = 0,l_data=0x30;
- l_offset < l_ringBufsize-sizeof(CompressedScanData);
- l_offset++)
- {
- if( l_pData[l_offset] != l_data++ )
- {
- TS_FAIL("Mismatch after write on ring %X",
- l_ringId);
- TRACFBIN(g_trac_test,
- "ringdata=",
- l_pRingBuf,l_ringBufsize);
- }
- }
- }
-
- // read back data to prove the writes worked
- l_ringId = 0x77;
- l_chipletId = 0x88;
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size;
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- l_ringModifiers[TEST_INDEX].keyword,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
- {
- TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 3: 0x%x, 0x%x",
- fapi::FAPI_RC_SUCCESS,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- else
- {
- l_pData = l_pRingBuf+sizeof(CompressedScanData);
- for (l_offset = 0,l_data=0x50;
- l_offset < l_ringBufsize-sizeof(CompressedScanData);
- l_offset++)
- {
- if( l_pData[l_offset] != l_data++ )
- {
- TS_FAIL("Mismatch after write on ring %X",
- l_ringId);
- TRACFBIN(g_trac_test,
- "ringdata=",
- l_pRingBuf,l_ringBufsize);
- }
- }
- }
-
-
- // ----------------------------------------------------------------
- // Pass in a buffer size that does not match the exact size
- // of the ringId/chipletId, should return with correct length
- // and invalid size return code.
- // ----------------------------------------------------------------
- TS_TRACE("testRepairRing:bad size ring=0x%x chiplet=0x%x size=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- l_ringBufsize = l_bufsize;
- l_ringId = l_ringModifiers[TEST_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval;
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL("testRepairRings:invalid ring size rc FAIL:"
- " exp=0x%x, act=0x%x",
- fapi::RC_REPAIR_RING_INVALID_SIZE,
- static_cast<uint32_t>(l_fapirc));
-
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // Pass in 0 for the ring modifier, should return with "not found"
- // error
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: pass in invalid ringId" );
- l_ringBufsize = l_ringModifiers[TEST_INDEX].size;
- l_ringId = 0; // ringId
- l_chipletId = 0; // chipletId
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- TS_TRACE("testRepairRings:ringId=0x%x chipletId=0x%x size=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: rc FAIL: exp=0x%x, act=0x%x",
- fapi::RC_REPAIR_RING_NOT_FOUND,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- }
- // ----------------------------------------------------------------
- // Pass in a NULL pointer with a valid ringId/chipletId, should
- // return with correct length and successful return code.
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: get size of ring(from set) %d ",
- TEST_INDEX );
- l_ringBufsize = 0x0;
- l_ringId = l_ringModifiers[TEST_INDEX].ringIdval;
- l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval;
- l_fapirc = setMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- NULL,
- l_ringBufsize );
-
- TS_TRACE("testRepairRings:ringId=0x%x chipletId=0x%x size=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 5:"
- " exp=0x%x, act=0x%x",
- fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER,
- static_cast<uint32_t>(l_fapirc));
-
- fapiLogError(l_fapirc);
- }
-
- // ----------------------------------------------------------------
- // Pass in an invalid chiplet id with a valid ring, should fail
- // ----------------------------------------------------------------
- l_ringBufsize = l_bufsize;
- l_ringId = l_ringModifiers[TEST_INDEX].ringIdval;
- l_chipletId = 0x22;
- TS_TRACE("testRepairRing:invalid chiplet ring=0x%X chiplet=0x%X"
- " size=0x%x",
- l_ringId,
- l_chipletId,
- l_ringBufsize );
- l_fapirc = getMvpdRing( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR,
- l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- l_pRingBuf,
- l_ringBufsize );
-
- if ( l_fapirc != fapi::RC_REPAIR_RING_NOT_FOUND )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL("testRepairRings:invalid chipletid rc FAIL:"
- " exp=0x%x, act=0x%x",
- fapi::RC_REPAIR_RING_NOT_FOUND,
- static_cast<uint32_t>(l_fapirc));
-
- fapiLogError(l_fapirc);
- }
-
- }
-
- //-- Put the original data back into the vpd
- for( std::list<saveRestoreData_t>::iterator sv = l_srData.begin();
- sv != l_srData.end();
- ++sv )
- {
- if( sv->target == NULL )
- {
- continue;
- }
-
- if( sv->CP00_pdG != NULL )
- {
- l_errhdl = deviceWrite( sv->target,
- sv->CP00_pdG,
- sv->CP00_pdG_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDG ) );
- if( l_errhdl )
- {
- TS_FAIL("Error restoring CP00/#G to %.8X",
- TARGETING::get_huid(sv->target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- }
- delete[] sv->CP00_pdG;
- sv->CP00_pdG = NULL;
- }
-
- if( sv->CP00_pdR != NULL )
- {
- l_errhdl = deviceWrite( sv->target,
- sv->CP00_pdR,
- sv->CP00_pdR_size,
- DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00,
- MVPD_KEYWORD_PDR ) );
- if( l_errhdl )
- {
- TS_FAIL("Error restoring CP00/#R to %.8X",
- TARGETING::get_huid(sv->target));
- errlCommit( l_errhdl, VPD_COMP_ID );
- }
- delete[] sv->CP00_pdR;
- sv->CP00_pdR = NULL;
- }
- }
- //--
-
- // delete allocated space
- if( l_pRingBuf )
- {
- delete[] l_pRingBuf;
- }
- for( std::list<saveRestoreData_t>::iterator sv = l_srData.begin();
- sv != l_srData.end();
- ++sv )
- {
- if( sv->CP00_pdG != NULL )
- {
- delete[] sv->CP00_pdG;
- sv->CP00_pdG = NULL;
- }
- if( sv->CP00_pdR != NULL )
- {
- delete[] sv->CP00_pdR;
- sv->CP00_pdR = NULL;
- }
- }
-
-
- TS_TRACE( "testRepairRings exit" );
- }
-
-}; // end class
-
-#endif
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
deleted file mode 100644
index ad416db08..000000000
--- a/src/usr/hwpf/test/hwpftest.H
+++ /dev/null
@@ -1,861 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/hwpftest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
-/* [+] 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 __HWPFTEST_H
-#define __HWPFTEST_H
-
-/**
- * @file hwpftest.H
- *
- * @brief Test case for HWPF implementation
-*/
-
-#include <cxxtest/TestSuite.H>
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
-#include <errl/errlentry.H>
-#include <errl/errlmanager.H>
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/utilFilter.H>
-#include <fapiHwpExecInitFile.H>
-#include <vpd/spdenums.H>
-
-using namespace fapi;
-using namespace TARGETING;
-
-struct ifScom_t {
- uint64_t addr;
- uint64_t data;
-};
-
-struct hwpfTestArgs_t {
- ifScom_t ifScom;
- fapi::Target fapiTarget;
- uint32_t count;
- tid_t tid;
- struct {
- uint64_t Write:1; // 1 = Write
- uint64_t AttrTest:1; // 1 = run Attr access test
- uint64_t ScomTest:1; // 1 = run Scom register access test
- };
-};
-
-static const uint32_t ATTR_TEST_VALUE = 10;
-static const uint32_t MAX_TEST_TASKS = 30;
-static const uint32_t CREATE_TASK_PAIRS = 6;
-static const uint32_t MAX_TEST_COUNT = 0x000001FF;
-
-/**
- * @brief repeated Scom access and Attrubute access through Fapi until
- * MAX_TEST_COUNT accesses has been done or an error occurs.
- */
-void* testHwpScomAcc( void *i_phwpTestArgs )
-{
- fapi::ReturnCode l_rc = fapi::FAPI_RC_SUCCESS;
- ecmdDataBufferBase l_ScomData(64);
-
- hwpfTestArgs_t * l_args = static_cast<hwpfTestArgs_t *>(i_phwpTestArgs);
-
- // repeat as long as no error and in running mode until count reaches
- // at MAX_TEST_COUNT or an error occurs
- for (l_args->count = 0; l_args->count != MAX_TEST_COUNT; ++l_args->count)
- {
- if (l_args->Write)
- {
- if (l_args->ScomTest)
- {
- // set up ecmdDataBuffer with written data
- l_ScomData.setDoubleWord(0, (l_args->ifScom).data);
- l_rc = fapiPutScom( l_args->fapiTarget,
- (l_args->ifScom).addr, l_ScomData );
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_TRACE("testHwpScomAcc: Error from fapiPutScom");
- break;
- }
- }
-
- if (l_args->AttrTest)
- {
- uint8_t l_uint8_1 = ATTR_TEST_VALUE;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8_1);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_TRACE("testHwpScomAcc: ATTR_SCRATCH_UINT8_1. "
- "Error from SET");
- break;
- }
- }
- }
- else
- {
- if (l_args->ScomTest)
- {
- l_rc = fapiGetScom( l_args->fapiTarget,
- (l_args->ifScom).addr, l_ScomData );
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_TRACE("testHwpScomAcc: Error RC from fapiGetScom");
- break;
- }
- if ((l_args->ifScom).data != l_ScomData.getDoubleWord(0))
- {
- (l_args->ifScom).data = l_ScomData.getDoubleWord(0);
- TS_TRACE("testHwpScomAcc: Error Data from fapiGetScom");
- break;
- }
- }
-
- if (l_args->AttrTest)
- {
- uint8_t l_uint8_2 = 0xff;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8_2);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_TRACE("testHwpScomAcc: ATTR_SCRATCH_UINT8_1."
- " Error RC from GET");
- break;
- }
- if (l_uint8_2 != ATTR_TEST_VALUE)
- {
- TS_TRACE("testHwpScomAcc: ATTR_SCRATCH_UINT8_1."
- " Error data %d from GET", l_uint8_2);
- break;
- }
- }
- }
- }
- return NULL;
-}
-
-class HwpfTest: public CxxTest::TestSuite
-{
-public:
-
- /**
- * @brief Test HWPF trace
- */
- void testHwpf1()
- {
- // Trace into all the FAPI trace buffers
- uint32_t l_val = 4;
- const char * l_pStr = "test-str";
-
- FAPI_INF("Test INF Trace");
- FAPI_INF("Test INF Trace. hex: 0x%x", l_val);
- FAPI_INF("Test INF Trace. string: %s", l_pStr);
- FAPI_INF("Test INF Trace. 0x%x, %s", l_val, l_pStr);
-
- FAPI_IMP("Test IMP Trace");
- FAPI_IMP("Test IMP Trace. hex: 0x%x", l_val);
- FAPI_IMP("Test IMP Trace. string: %s", l_pStr);
- FAPI_IMP("Test IMP Trace. 0x%x, %s", l_val, l_pStr);
-
- FAPI_ERR("Test ERR Trace");
- FAPI_ERR("Test ERR Trace. hex: 0x%x", l_val);
- FAPI_ERR("Test ERR Trace. string: %s", l_pStr);
- FAPI_ERR("Test ERR Trace. 0x%x, %s", l_val, l_pStr);
-
- FAPI_DBG("Test DBG Trace");
- FAPI_DBG("Test DBG Trace. hex: 0x%x", l_val);
- FAPI_DBG("Test DBG Trace. string: %s", l_pStr);
- FAPI_DBG("Test DBG Trace. 0x%x, %s", l_val, l_pStr);
-
- FAPI_MFG("Test MFG Trace");
- FAPI_MFG("Test MFG Trace. hex: 0x%x", l_val);
- FAPI_MFG("Test MFG Trace. string: %s", l_pStr);
- FAPI_MFG("Test MFG Trace. 0x%x, %s", l_val, l_pStr);
- return;
- }
-
- /**
- * @brief Test HWPF: call a test procedure that generates an error
- */
- void testHwpf2()
- {
- errlHndl_t l_err = NULL;
-
- // Get the master processor chip
- TARGETING::Target* l_pTarget = NULL;
- TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
-
- // Create a FAPI Target and invoke the hwpTestError HWP. The HWP
- // returns an error to test out error handling
- fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *> (l_pTarget));
-
- TARGETING::TargetHandleList l_mbaTargetList;
- TARGETING::getAllChiplets(l_mbaTargetList, TARGETING::TYPE_MBA);
-
- // just grab the first one in the list.
- TARGETING::Target * l_mbaTarget = l_mbaTargetList[0];
- // Cast to a FAPI type of target.
- fapi::Target l_fapiMbaTarget( fapi::TARGET_TYPE_MBA_CHIPLET,
- (reinterpret_cast<void *>( l_mbaTarget)) );
-
- FAPI_INVOKE_HWP(l_err, hwpTestError, l_fapiTarget, l_fapiMbaTarget);
-
- if (l_err)
- {
- // Delete the error rather than committing it to avoid it getting
- // interpreted as a real problem
- TS_TRACE("testHwpf2: Unit Test passed. "
- "hwpTestError failed. Error deleted");
- delete l_err;
- l_err = NULL;
- }
- else
- {
- TS_FAIL("testHwpf2: Unit Test failed. "
- "hwpTestError passed. Error logged");
- }
- }
-
- /**
- * @brief Test HWPF Config: call a test procedure that exercises the FAPI
- * config query functions
- */
- void testHwpf3()
- {
- errlHndl_t l_err = NULL;
-
- // Get the master processor chip
- TARGETING::Target* l_pTarget = NULL;
- TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
-
- // Create a FAPI Target and invoke the hwpTestConfig HWP. The HWP
- // exercises the FAPI config query functions
- fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *> (l_pTarget));
-
- FAPI_INVOKE_HWP(l_err, hwpTestConfig, l_fapiTarget);
-
- if (l_err)
- {
- TS_FAIL("testHwpf3: Unit Test failed. "
- "hwpTestConfig failed. Error logged");
- errlCommit(l_err,HWPF_COMP_ID);
- }
- else
- {
- TS_TRACE("testHwpf3: Unit Test passed. "
- "hwpTestConfig passed. Error logged");
- }
- }
-
- /**
- * @brief Test HWPF InitFile: call the procedure that exercises a
- * sample initfile
- */
- void testHwpf5()
- {
-#ifndef __HOSTBOOT_RUNTIME
- typedef struct ifScom {
- uint64_t addr;
- uint64_t origData;
- uint64_t writtenData;
- }ifScom_t;
-
- //Note: this data is based on the sample.initfile.
- //If the initfile changes, this data will also need to be changed.
- ifScom_t l_ifScomData[] =
- {
- {/*PORE_GPE0_SCRATCH0_*/0x0006000A, 0, 0x0ABBC00000000000},
- {/*PORE_GPE0_SCRATCH1_*/0x0006000B, 0, 0x00000000C4000000},
- {/*PORE_GPE0_SCRATCH2_*/0x0006000C, 0, 0x0100000800000000},
- {/*PORE_GPE1_SCRATCH0_*/0x0006002A, 0, 0x0000000000000000},
- {/*PORE_GPE1_SCRATCH1_*/0x0006002B, 0, 0x0000016000003000},
- {/*PORE_GPE1_SCRATCH2_*/0x0006002C, 0, 0x0c9c0c190010480d},
- {/*PORE_SLW_SCRATCH0_*/0x0006800A, 0, 0x0c90000000000000},
- {/*PORE_SLW_SCRATCH1_*/0x0006800B, 0, 0x0001901832002090},
- {/*PORE_SLW_SCRATCH2_*/0x0006800C, 0, 0x0000000000000192},
- {/*PORE_SBE_SCRATCH1_*/0x000E000B, 0, 0x0000000000000192},
- {/*PORE_SBE_SCRATCH2_*/0x000E000C, 0, 0x0000014000000000}
- };
-
- fapi::ReturnCode l_rc;
- ecmdDataBufferBase l_ScomData(64);
-
- do {
- // Set up some attributes used by sample.initfile
- uint8_t l_uint8 = 1;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT8_1. Error from SET");
- break;
- }
-
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_2, NULL, l_uint8);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT8_2. Error from SET");
- break;
- }
-
- uint32_t l_uint32 = 3;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT32_1. Error from SET");
- break;
- }
-
- l_uint32 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_2, NULL, l_uint32);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT32_2. Error from SET");
- break;
- }
-
- uint64_t l_uint64 = 2;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT64_1. Error from SET");
- break;
- }
-
- l_uint64 = 0;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT64_2. Error from SET");
- break;
- }
-
- uint8_t l_uint8array1[32];
- l_uint8array1[0] = 1;
- l_uint8array1[1] = 4;
- l_uint8array1[2] = 1;
- l_uint8array1[3] = 2;
- l_uint8array1[7] = 1;
- l_uint8array1[17] = 6;
- l_uint8array1[18] = 6;
- l_uint8array1[31] = 8;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1,
- NULL, l_uint8array1);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT8_ARRAY_1. "
- " Error from SET");
- break;
- }
-
- uint8_t l_uint8array2[2][3][4];
- l_uint8array2[0][1][2] = 0xC4;
- l_uint8array2[1][2][3] = 0xBE;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_2,
- NULL, l_uint8array2);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: ATTR_SCRATCH_UINT8_ARRAY_2. "
- "Error from SET");
- break;
- }
-
- //Set the targets
-
- std::vector<fapi::Target> l_target;
-
- // Get the master processor chip & set it as the main target for Scom ops
- TARGETING::Target* l_pTarget = NULL;
- TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
-
- fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *> (l_pTarget));
- l_target.push_back(l_fapiTarget);
-
- // Get the target for the MBA chiplets of the first MEMBUF chip
- TARGETING::PredicateCTM l_membufChip(TARGETING::CLASS_CHIP,
- TARGETING::TYPE_MEMBUF);
-
- TARGETING::TargetRangeFilter l_filter(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &l_membufChip);
-
- PredicateCTM l_mba(CLASS_UNIT,TYPE_MBA);
-
- // Just look at the first MEMBUF chip
- if (l_filter)
- {
- TargetHandleList l_list;
- (void) targetService().getAssociated(
- l_list,
- *l_filter,
- TARGETING::TargetService::CHILD,
- TARGETING::TargetService::ALL,
- &l_mba);
-
- if (2 == l_list.size())
- {
- for (size_t i = 0; i < l_list.size(); i++)
- {
- //Set the associated targets
- fapi::Target l_fapiTargetAssoc(fapi::TARGET_TYPE_MBA_CHIPLET,
- reinterpret_cast<void *>(l_list.at(i)));
- l_target.push_back(l_fapiTargetAssoc);
- }
- }
- else
- {
- TS_FAIL("testHwpf5: Incorrect # of MBAs found: %u",
- l_list.size());
-
- size_t l_ffdc = l_list.size();
- size_t & FFDC_IF_TEST_NUM_MBAS_FOUND = l_ffdc;
- FAPI_SET_HWP_ERROR(l_rc,
- RC_HWP_EXEC_INITFILE_TEST_INCORRECT_NUM_MBAS_FOUND);
- break;
- }
- }
- else
- {
- TS_FAIL("testHwpf5: No MEMBUFs found");
- FAPI_SET_HWP_ERROR(l_rc, RC_HWP_EXEC_INITFILE_TEST_NO_MEMBUF_FOUND);
- break;
- }
-
- // Save original scom data to restore at end of test
- for (uint32_t i = 0; i < sizeof(l_ifScomData)/sizeof(ifScom_t); i++)
- {
- l_rc = fapiGetScom(l_fapiTarget, l_ifScomData[i].addr,
- l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: Error from fapiGetScom");
- break;
- }
-
- l_ifScomData[i].origData = l_ScomData.getDoubleWord(0);
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- // Set scom data to 0 to start from known state for bit ops
- l_ScomData.setDoubleWord(0, 0ll);
- for (uint32_t i = 0; i < sizeof(l_ifScomData)/sizeof(ifScom_t); i++)
- {
- l_rc = fapiPutScom(l_fapiTarget, l_ifScomData[i].addr,
- l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: Error from fapiPutScom");
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- //Call Hwp to execute the initfile
- FAPI_EXEC_HWP(l_rc, fapiHwpExecInitFile, l_target, "sample.if");
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: Error from fapiHwpExecInitFile");
- break;
- }
-
- //Verify the data written
- for (uint32_t i = 0; i < sizeof(l_ifScomData)/sizeof(ifScom_t); i++)
- {
- l_rc = fapiGetScom(l_fapiTarget, l_ifScomData[i].addr,
- l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: Error from fapiGetScom");
- break;
- }
-
- if (l_ScomData.getDoubleWord(0) != l_ifScomData[i].writtenData)
- {
- TS_FAIL("testHwpf5: GetScom addr 0x%.16llX "
- "data read 0x%.16llX data expected 0x%.16llX",
- l_ifScomData[i].addr, l_ScomData.getDoubleWord(0),
- l_ifScomData[i].writtenData);
- FAPI_SET_HWP_ERROR(l_rc, RC_HWP_EXEC_INITFILE_TEST_FAILED);
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- // Restore the original Scom data
- uint32_t l_ecmdRc = ECMD_DBUF_SUCCESS;
- for (uint32_t i = 0; i < sizeof(l_ifScomData)/sizeof(ifScom_t); i++)
- {
- l_ecmdRc = l_ScomData.setDoubleWord(0,l_ifScomData[i].origData);
- if (l_ecmdRc != ECMD_DBUF_SUCCESS)
- {
- TS_FAIL("testHwpf5: fapiPutScom to restore, error from "
- "ecmdDataBuffer setDoubleWord() - rc 0x%.8X",
- l_ecmdRc);
- l_rc.setEcmdError(l_ecmdRc);
- break;
- }
-
- l_rc = fapiPutScom(l_fapiTarget, l_ifScomData[i].addr,
- l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- TS_FAIL("testHwpf5: Error from fapiGetScom");
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- } while (0);
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- fapiLogError(l_rc);
- TS_FAIL("testHwpf5: Unit Test failed. Error logged");
- }
- else
- {
- TS_TRACE("testHwpf5: Unit Test passed. "
- "fapiHwpExecInitFile passed.");
- }
-#endif
- }
-
- /**
- * @brief Test case for stressing the taskmgr, memory usage, and HWPF API
- * It starts (CREATE_TASK_PAIRS * 2) tasks.
- */
- void testHwpf6()
- {
-#ifndef __HOSTBOOT_RUNTIME
- fapi::ReturnCode l_rc = fapi::FAPI_RC_SUCCESS;
-
- // Get the sys target handle
- TARGETING::Target* l_pTarget = NULL;
- TARGETING::targetService().getTopLevelTarget(l_pTarget);
-
- uint8_t l_vpoMode = 0;
-
- if (l_pTarget &&
- l_pTarget->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(l_vpoMode) &&
- l_vpoMode == 0)
- {
- static const uint32_t NUM_OF_SCOMREGS = 4;
- ifScom_t l_ifScom[NUM_OF_SCOMREGS] =
- {
- {0x000000000006002b, 0x0000000000000183},
- {0x000000000006002c, 0x0000000000000183},
- {0x000000000006800b, 0},
- {0x000000000006800c, 0x8000000000000000 >> 0x17},
- };
-
- // Get the master processor chip
- l_pTarget = NULL;
- TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
-
- // Create a FAPI Target of the master processor
- fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *> (l_pTarget));
-
- hwpfTestArgs_t l_args[MAX_TEST_TASKS] = {{{0},},};
-
- uint8_t l_index = 0;
- uint32_t i;
-
- for (i = 0; i < (CREATE_TASK_PAIRS * 2); i++)
- {
- // start one task
- l_args[i].ifScom = l_ifScom[l_index];
- l_args[i].fapiTarget = l_fapiTarget;
- l_args[i].Write = (i % 2) ? 0 : 1;
- l_args[i].AttrTest = 1;
- l_args[i].ScomTest = 1;
- l_args[i].tid = task_create(testHwpScomAcc,
- static_cast<void *>(&l_args[i]));
- // Change ifScom register after a pair of tasks started
- l_index = (i % 2) ? (l_index + 1) % NUM_OF_SCOMREGS : l_index;
- }
-
- int status;
-
- for (i = 0; i < MAX_TEST_TASKS; i++)
- {
- if (l_args[i].ifScom.addr != 0)
- {
- task_wait_tid( l_args[i].tid, &status, NULL );
- }
- }
-
- for (i = 0; i < NUM_OF_SCOMREGS; i++)
- {
- ecmdDataBufferBase l_ScomData(64);
- l_rc = fapiGetScom( l_fapiTarget, l_ifScom[i].addr,
- l_ScomData );
- if (l_rc != fapi::FAPI_RC_SUCCESS ||
- l_ScomData.getDoubleWord(0) != l_ifScom[i].data)
- {
- TS_FAIL("testHwpf6: Scom register has unexpected data");
- break;
- }
- }
-
- if (l_rc.ok() && i == NUM_OF_SCOMREGS)
- {
- uint8_t l_uint8 = 0;
- l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc != fapi::FAPI_RC_SUCCESS || l_uint8 != ATTR_TEST_VALUE)
- {
- TS_FAIL("testHwpf6: ATTR_SCRATCH_UINT8_1"
- " has unexpected data");
- }
- else
- {
- TS_TRACE("testHwpf6: Unit Test passed.");
- }
- }
- }
-#endif
- }
-
-// // unit test breakpoint
-// void testHwpf7()
-// {
-// fapi::Target fapiTarget;
-// FAPI_INF("AT breakpoint");
-// fapiBreakPoint(fapiTarget,__LINE__);
-//
-// // requires outside hb-istep resume command to continue
-//
-// FAPI_INF("RESUME from breakpoint");
-// }
-
- /**
- * @brief Test case Accessing DIMM SPD Attribute from FAPI
- *
- */
- void testHwpf8()
- {
- fapi::ReturnCode l_rc;
-
- do
- {
- // Get a DIMM Target
- TargetHandleList dimmList;
- getAllLogicalCards( dimmList,
- TARGETING::TYPE_DIMM );
-
- if (dimmList.size())
- {
- fapi::Target l_dTarget(TARGET_TYPE_DIMM,
- static_cast<void *> (dimmList[0]));
-
- uint8_t opt[18] = { 0, };
-
- l_rc = FAPI_ATTR_GET(ATTR_SPD_MODULE_PART_NUMBER,
- &l_dTarget, opt);
-
- if (l_rc.ok())
- {
- FAPI_INF("testHwpf8: PN = %s", opt);
- }
- else
- {
- TS_FAIL("testHwpf8: ATTR_SPD_MODULE_PART_NUMBER GET fails");
- }
- }
-
- } while(0);
-
- }
-
- /**
- * @brief Call a test procedure that exercises the Bad DQ data
- */
- void testHwpf9()
- {
-#ifndef __HOSTBOOT_RUNTIME
- errlHndl_t l_err = NULL;
-
- // Look for functional DIMMs
- TARGETING::PredicateIsFunctional l_functional;
- TARGETING::PredicateCTM l_dimmFilter(CLASS_LOGICAL_CARD, TYPE_DIMM);
- TARGETING::PredicatePostfixExpr l_functionalDimms;
- l_functionalDimms.push(&l_dimmFilter).push(&l_functional).And();
-
- TARGETING::TargetRangeFilter l_filter(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &l_functionalDimms);
-
- // Look for the first functional DIMM
- if (l_filter)
- {
- // Get the associated MBA
- TARGETING::PredicateCTM l_mbaFilter(CLASS_UNIT, TYPE_MBA);
- TARGETING::TargetHandleList l_MBAs;
-
- TARGETING::targetService().getAssociated(l_MBAs, (*l_filter),
- TARGETING::TargetService::PARENT_BY_AFFINITY,
- TARGETING::TargetService::ALL,
- &l_mbaFilter);
-
- if (l_MBAs.size() == 1)
- {
- fapi::Target l_fapiTarget(TARGET_TYPE_MBA_CHIPLET,
- static_cast<void *>(l_MBAs[0]));
-
- FAPI_INVOKE_HWP(l_err, fapiTestHwpDq, l_fapiTarget);
-
- if (l_err)
- {
- TS_FAIL("testHwpf9: fapiTestHwpDq failed. Error logged");
- errlCommit(l_err, HWPF_COMP_ID);
- }
- else
- {
- TS_TRACE("testHwpf9: Unit Test passed");
- }
- }
- else
- {
- TS_FAIL("testHwpf9: Parent MBA not found");
- }
- }
- else
- {
- TS_TRACE("testHwpf9: No functional DIMMs found, skipping test");
- }
-#endif
- }
-
- /**
- * @brief Access the test Chip EC Feature attributes
- */
- void testHwpf10()
- {
- do
- {
- fapi::ReturnCode l_rc;
- uint8_t l_chipHasFeature = 0xff;
-
- // Get the first procesor chip
- TARGETING::TargetHandleList l_chipList;
- TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
-
- if (l_chipList.size() == 0)
- {
- TS_FAIL("testHwpf10: Chip not found");
- break;
- }
-
- // Create a FAPI Chip Target
- fapi::Target l_fapiChipTarget(fapi::TARGET_TYPE_PROC_CHIP,
- static_cast<void *>(l_chipList[0]));
-
- // Get a test Chip EC Feature attribute
- l_rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_TEST1, &l_fapiChipTarget,
- l_chipHasFeature);
- if (l_rc)
- {
- TS_FAIL("testHwpf10: Chip ATTR_CHIP_EC_FEATURE_TEST1 get failed.");
- break;
- }
-
- FAPI_INF("testHwpf10: Chip ATTR_CHIP_EC_FEATURE_TEST1: %d",
- l_chipHasFeature);
-
- // Get another Chip EC Feature attribute
- l_chipHasFeature = 0xff;
- l_rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_TEST2, &l_fapiChipTarget,
- l_chipHasFeature);
- if (l_rc)
- {
- TS_FAIL("testHwpf10: Chip ATTR_CHIP_EC_FEATURE_TEST2 get failed.");
- break;
- }
-
- FAPI_INF("testHwpf10: Chip ATTR_CHIP_EC_FEATURE_TEST2: %d",
- l_chipHasFeature);
-
- // Get the first MCS child chiplet of the chip
- TARGETING::TargetHandleList l_mcsList;
- TARGETING::getChildChiplets(l_mcsList, l_chipList[0],
- TARGETING::TYPE_MCS, false);
-
- if (l_mcsList.size() == 0)
- {
- TS_FAIL("testHwpf10: MCS not found");
- break;
- }
-
- // Create a FAPI MCS Chiplet Target
- fapi::Target l_fapiMcsTarget(fapi::TARGET_TYPE_MCS_CHIPLET,
- static_cast<void *>(l_mcsList[0]));
-
- // Get a test Chip EC Feature attribute
- l_chipHasFeature = 0xff;
- l_rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_TEST1, &l_fapiMcsTarget,
- l_chipHasFeature);
- if (l_rc)
- {
- TS_FAIL("testHwpf10: MCS ATTR_CHIP_EC_FEATURE_TEST1 get failed.");
- break;
- }
-
- FAPI_INF("testHwpf10: MCS ATTR_CHIP_EC_FEATURE_TEST1: %d",
- l_chipHasFeature);
-
- // Get another Chip EC Feature attribute
- l_chipHasFeature = 0xff;
- l_rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_TEST2, &l_fapiMcsTarget,
- l_chipHasFeature);
- if (l_rc)
- {
- TS_FAIL("testHwpf10: MCS ATTR_CHIP_EC_FEATURE_TEST2 get failed.");
- break;
- }
-
- FAPI_INF("testHwpf10: MCS ATTR_CHIP_EC_FEATURE_TEST2: %d",
- l_chipHasFeature);
-
- } while(0);
- }
-
-};
-
-#endif
diff --git a/src/usr/hwpf/test/hwpftest.mk b/src/usr/hwpf/test/hwpftest.mk
deleted file mode 100644
index 6a06ceea7..000000000
--- a/src/usr/hwpf/test/hwpftest.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/hwpf/test/hwpftest.mk $
-#
-# OpenPOWER HostBoot Project
-#
-# COPYRIGHT International Business Machines Corp. 2011,2014
-#
-# 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
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
-EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors
-EXTRAINCDIR += ${ROOTPATH}/src/usr/initservice/istepdispatcher
-
-# CompressedScanData struct needed for getRepairRings()
-EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include
-EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build
-
diff --git a/src/usr/hwpf/test/hwpisteperrortest.H b/src/usr/hwpf/test/hwpisteperrortest.H
deleted file mode 100644
index f6337e393..000000000
--- a/src/usr/hwpf/test/hwpisteperrortest.H
+++ /dev/null
@@ -1,289 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/hwpisteperrortest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
-/* [+] 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 __HWPIstepErrorTest_H
-#define __HWPIstepErrorTest_H
-
-#include <cxxtest/TestSuite.H>
-#include <errl/errlentry.H>
-#include <isteps/hwpisteperror.H>
-#include <istepdispatcher.H>
-
-using namespace ISTEP;
-using namespace ISTEP_ERROR;
-
-class HwpIStepErrorTest: public CxxTest::TestSuite
-{
-public:
- /**
- * @brief Test IStepError class
- */
- void testIstepError1(void)
- {
- uint8_t l_iStep = 0;
- uint8_t l_subStep =0;
- const uint16_t MY_REASON_CODE = 0xC0DE;
- const uint8_t MY_MODULE_ID = 0xBB;
-
- TS_TRACE("testIStepError1: entry");
-
- // Get the expected iStep and subStep. Likely the last valid values
- // since the test case is running after the iSteps.
- INITSERVICE::IStepDispatcher::
- getTheInstance().getIstepInfo(l_iStep,l_subStep);
-
- // Create an error log
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_INFORMATIONAL,
- MY_MODULE_ID,
- MY_REASON_CODE,
- TWO_UINT32_TO_UINT64( 0xDE, 0xAD),
- TO_UINT64(0xBEEF) );
- do {
-
- IStepError l_stepError;
-
- l_stepError.addErrorDetails( l_errl );
-
- TS_TRACE("testIStepError1: original elog eid is %d",
- l_errl->eid() );
-
- TS_TRACE("testIStepError1: original elog reasoncode is %d",
- l_errl->reasonCode() );
-
- // grab the values from the original errorlog for use later
- uint64_t test_data0 = l_errl->eid();
- test_data0 <<= 32;
-
- test_data0 |= l_errl->reasonCode();
-
- // this call to get resets the error handle
- errlHndl_t new_errl = l_stepError.getErrorHandle();
-
- uint64_t l_data0 = new_errl->getUserData1();
-
- uint32_t eid = ( l_data0 & 0xFFFFFFFF00000000) >> 32;
- uint32_t reason = (uint32_t)(l_data0 & 0x00000000FFFFFFFF);
-
- // Verify the reference to the added error log.
- // Added log id is in bytes 0-3 of userdata 1.
- // Reason code is in bytes 4-6 of userdata 1.
- if( eid != l_errl->eid() )
- {
- TS_FAIL("testIstepError1: expected"
- "eid[0x%.8x] == l_errl->eid()[0x%.8x] "
- "eid rebuilt from user data of "
- "IStepError did not match original error eid",
- eid, l_errl->eid());
- }
- else
- {
- TS_TRACE("testIstepError1: passed: eid == l_errl->eid()");
- }
-
- if( reason != l_errl->reasonCode() )
- {
- TS_FAIL("testIstepError1: "
- "expected reasonCode == l_errl->reasonCode() \
- reasonCode rebuilt from user data of \
- IStepError did not match original reasoncode");
-
- }
- else
- {
- TS_TRACE("testIstepError1: passed: "
- "reason == l_errl->reasonCode()");
- }
-
- // Verify that we counted the error we added.
- // Count is in bytes 0-3 of userdata 2.
- // iStep and subStep in bytes 4-6 of userdata 2.
- uint64_t l_data1 = new_errl->getUserData2();
-
- uint32_t l_count = ( l_data1&0xFFFFFFFF00000000 ) >> 32;
- uint32_t l_errlStepSubStep =
- (uint32_t)(l_data1&0x00000000FFFFFFFF);
- uint32_t l_expectedStepSubStep =
- (uint32_t)(l_subStep | (l_iStep<<8));
-
- if( l_count != 1 )
- {
- TS_FAIL("error count in IStepError not correct,"
- " should be 1, is %d",l_count);
- }
- else
- {
- TS_TRACE("passed: error count = 1");
- }
-
- if( l_errlStepSubStep != l_expectedStepSubStep )
- {
- TS_FAIL("Step/SubStep in IStepError not correct,"
- " should be 0x%08x, is 0x%08x ",
- l_expectedStepSubStep,
- l_errlStepSubStep);
- }
- else
- {
- TS_TRACE("passed: step/subStep correct");
- }
-
- errlCommit( l_errl, CXXTEST_COMP_ID );
- errlCommit( new_errl, CXXTEST_COMP_ID );
-
- }while(0);
- }
-
- void testIstepError2(void)
- {
- uint8_t l_iStep = 0;
- uint8_t l_subStep =0;
- const uint16_t MY_REASON_CODE = 0xC0DE;
- const uint8_t MY_MODULE_ID = 0xBB;
-
- TS_TRACE("testIStepError2: entry");
-
- // Get the expected iStep and subStep. Likely the last valid values
- // since the test case is running after the iSteps.
- INITSERVICE::IStepDispatcher::
- getTheInstance().getIstepInfo(l_iStep,l_subStep);
-
- // Create an error log
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_INFORMATIONAL,
- MY_MODULE_ID,
- MY_REASON_CODE,
- TWO_UINT32_TO_UINT64( 0xDE, 0xAD),
- TO_UINT64(0xBEEF) );
- do {
-
- IStepError l_stepError;
-
- l_stepError.addErrorDetails( l_errl );
-
- TS_TRACE("testIStepError2: original elog eid is %d",
- l_errl->eid() );
-
- TS_TRACE("testIStepError2: original elog reasoncode is %d",
- l_errl->reasonCode() );
-
- // grab the values from the original errorlog for use later
- uint64_t test_data0 = l_errl->eid();
- test_data0 <<= 32;
-
- test_data0 |= l_errl->reasonCode();
-
- // add a new elog in three more times..
- // Create an error log -- junk data
- errlHndl_t l_errl2 = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_INFORMATIONAL,
- 0x05,
- 0xcafe,
- TWO_UINT32_TO_UINT64( 0xDE, 0xAD),
- TO_UINT64(0xBEEF) );
-
- l_stepError.addErrorDetails( l_errl2 );
- l_stepError.addErrorDetails( l_errl2 );
- l_stepError.addErrorDetails( l_errl2 );
-
- // count should be 4 and the data0 and data 1 values of the
- // istep error should be the same as before
-
- // this call to get resets the error handle
- errlHndl_t new_errl = l_stepError.getErrorHandle();
-
- uint64_t l_data0 = new_errl->getUserData1();
-
- uint32_t eid = ( l_data0 & 0xFFFFFFFF00000000) >> 32;
- uint32_t reason = (uint32_t)(l_data0 & 0x00000000FFFFFFFF);
-
- if( eid != l_errl->eid() )
- {
- TS_FAIL("testIStepError2: expected "
- "eid[0x%.8x] == l_errl->eid()[0x%.8x] "
- "eid rebuilt from user data of "
- "IStepError did not match original error eid",
- eid, l_errl->eid());
- }
- else
- {
- TS_TRACE("testIStepError2: passed: eid == l_errl->eid()");
- }
-
- if( reason != l_errl->reasonCode() )
- {
- TS_FAIL("testIStepError2: "
- "expected reasonCode == l_errl->reasonCode()"
- "reasonCode rebuilt from user data of"
- "IStepError did not match original reasoncode");
-
- }
- else
- {
- TS_TRACE("testIStepError2: passed: "
- "reason == l_errl->reasonCode()");
- }
-
- // Verify that 4 logs have been added.
- // Count is in bytes 0-3 of userdata 2.
- // iStep and subStep in bytes 4-6 of userdata 2.
- uint64_t l_data1 = new_errl->getUserData2();
-
- uint32_t l_count = ( l_data1&0xFFFFFFFF00000000 ) >> 32;
- uint32_t l_errlStepSubStep =
- (uint32_t)(l_data1&0x00000000FFFFFFFF);
- uint32_t l_expectedStepSubStep =
- (uint32_t)(l_subStep | (l_iStep<<8));
-
- if( l_count != 4 )
- {
- TS_FAIL("error count in IStepError not correct,"
- " should be 4, is %d",l_count);
- }
- else
- {
- TS_TRACE("passed: error count = 4");
- }
-
- if( l_errlStepSubStep != l_expectedStepSubStep )
- {
- TS_FAIL("Step/SubStep in IStepError not correct,"
- " should be 0x%08x, is 0x%08x ",
- l_expectedStepSubStep,
- l_errlStepSubStep);
- }
- else
- {
- TS_TRACE("passed: step/subStep correct");
- }
-
- errlCommit( l_errl, CXXTEST_COMP_ID );
- errlCommit( new_errl, CXXTEST_COMP_ID );
- errlCommit( l_errl2, CXXTEST_COMP_ID );
-
- }while(0);
- }
-
-};
-#endif
diff --git a/src/usr/hwpf/test/makefile b/src/usr/hwpf/test/makefile
deleted file mode 100644
index 05f04c657..000000000
--- a/src/usr/hwpf/test/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/hwpf/test/makefile $
-#
-# OpenPOWER HostBoot Project
-#
-# Contributors Listed Below - COPYRIGHT 2011,2014
-# [+] 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
-ROOTPATH = ../../../..
-MODULE = testhwpf
-
-include hwpftest.mk
-
-TESTS += fapiattrtest.H
-TESTS += fapirctest.H
-TESTS += fapitargettest.H
-TESTS += hwpftest.H
-TESTS += hwpisteperrortest.H
-TESTS += hwpMBvpdAccessorTest.H
-TESTS += hwpMvpdAccessorTest.H
-TESTS += hwpDQCompressionTest.H
-TESTS += $(if $(CONFIG_HTMGT),occAccessTest.H)
-SUBDIRS += runtime.d
-
-include ${ROOTPATH}/config.mk
-
diff --git a/src/usr/hwpf/test/occAccessTest.H b/src/usr/hwpf/test/occAccessTest.H
deleted file mode 100644
index 6c037ec61..000000000
--- a/src/usr/hwpf/test/occAccessTest.H
+++ /dev/null
@@ -1,325 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/occAccessTest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] 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 __OCCACCESSTEST_H
-#define __OCCACCESSTEST_H
-
-#include <stdint.h>
-
-#include <occ/occAccess.H>
-#include <errl/errlentry.H>
-#include <vfs/vfs.H>
-#include <isteps/hwpf_reasoncodes.H>
-
-// fapi support
-#include <fapi.H>
-
-// targeting support
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/utilFilter.H>
-#include <targeting/common/targetservice.H>
-#include <targeting/common/util.H>
-
-using namespace TARGETING;
-
-class occAccessTest : public CxxTest::TestSuite
-{
-public:
-
-void testAccessOCBIndirectChannel()
-{
- TS_TRACE ("testAccessOCBIndirectChannel: enter");
-
- errlHndl_t l_errl = NULL;
- bool occ_loaded = false;
- bool l_error = false;
-
- do
- {
- //*********************************************************************
- // load occ if needed
- //*********************************************************************
-
- if ( !VFS::module_is_loaded( "libocc.so" ) )
- {
- TS_TRACE("testAccessOCBIndirectChannel: load occ module");
- l_errl = VFS::module_load( "libocc.so" );
-
- if ( l_errl )
- {
- // load module returned with errl set
- TS_FAIL("testAccessOCBIndirectChannel:"
- " could not load occ module");
- l_error = true;
- break;
- }
- occ_loaded = true;
- }
-
- //*********************************************************************
- // Find a PROC target and its OCC target
- //*********************************************************************
-
- //Get a Proc target
- TARGETING::TargetHandleList l_procTargetList;
- getAllChips(l_procTargetList,
- TYPE_PROC,
- true);
-
- if (0==l_procTargetList.size()) //unexpected error
- {
- TS_FAIL("testAccessOCBIndirectChannel: No Proc targets");
- l_error = true;
- break;
- }
- const TARGETING::Target* l_procTarget = l_procTargetList[0];
-
- //Find an OCC target
- TARGETING::TargetHandleList l_occTargetList;
- getChildChiplets( l_occTargetList,
- l_procTarget,
- TYPE_OCC,
- true);
- // if there are no OCCs in this configuration, use the PROC target
- if (0==l_occTargetList.size())
- {
- TS_TRACE("testAccessOCBIndirectChannel: No OCC targets");
- l_occTargetList.push_back(l_procTargetList[0]);
- }
- const TARGETING::Target* l_occTarget = l_occTargetList[0];
-
- //*********************************************************************
- // Read and Write the OCC linear buffer
- // 1. Read current value
- // 2. Write test data
- // 3. Read back and verify
- // 4. Restore current value
- //*********************************************************************
- ecmdDataBufferBase l_currentData(64);
- ecmdDataBufferBase l_testData(64);
- ecmdDataBufferBase l_readBackData(64);
- uint32_t l_addr = 0xFFFF6000;//sample value from TMGT.
- const uint64_t l_testValue = 0x0123456789ABCDEF;
-
-
- // read current data (use proc target)
- TS_TRACE("testAccessOCBIndirectChannel:"
- " target=%.8x type=%d read current",
- get_huid(l_procTarget),
- (l_procTarget)->getAttr<TARGETING::ATTR_TYPE>());
-
- l_errl = HBOCC::readSRAM(l_procTarget,l_addr,l_currentData);
- if (l_errl)
- {
- TS_FAIL("testAccessOCBIndirectChannel: Read OCC SRAM failed");
- l_error = true;
- break;
- }
- TS_TRACE("testAccessOCBIndirectChannel: current data=%lx",
- l_currentData.getDoubleWord(0));
-
- // write test data (use occ target)
- TS_TRACE("testAccessOCBIndirectChannel:"
- " target=%.8x type=%d write test",
- get_huid(l_occTarget),
- (l_occTarget)->getAttr<TARGETING::ATTR_TYPE>());
-
- l_testData.setDoubleWord(0,l_testValue);
- l_errl = HBOCC::writeSRAM(l_occTarget,l_addr,l_testData);
- if (l_errl)
- {
- TS_FAIL("testAccessOCBIndirectChannel: write test data failed");
- l_error = true;
- break;
- }
- TS_TRACE("testAccessOCBIndirectChannel: test data=%lx",
- l_testData.getDoubleWord(0));
-
- // read test data back (use proc target)
- TS_TRACE("testAccessOCBIndirectChannel:"
- " target=%.8x type=%d read test data",
- get_huid(l_procTarget),
- (l_procTarget)->getAttr<TARGETING::ATTR_TYPE>());
-
- l_errl = HBOCC::readSRAM(l_procTarget,l_addr,l_readBackData);
- if (l_errl)
- {
- TS_FAIL("testAccessOCBIndirectChannel: read test data failed");
- l_error = true;
- break;
- }
- TS_TRACE("testAccessOCBIndirectChannel: read back data=%lx",
- l_readBackData.getDoubleWord(0));
-
- if(l_testValue != l_readBackData.getDoubleWord(0))
- {
- TS_FAIL("testAccessOCBIndirectChannel: read back compare failed");
- l_error = true;
- break;
- }
-
- // write original data back (use proc target)
- TS_TRACE("testAccessOCBIndirectChannel:"
- " target=%.8x type=%d write orginial back",
- get_huid(l_procTarget),
- (l_procTarget)->getAttr<TARGETING::ATTR_TYPE>());
-
- l_errl = HBOCC::writeSRAM(l_procTarget,l_addr,l_currentData);
- if (l_errl)
- {
- TS_FAIL("testAccessOCBIndirectChannel: restore data failed");
- l_error = true;
- break;
- }
-
- //*********************************************************************
- // Test write circular
- //*********************************************************************
- ecmdDataBufferBase l_data(64); // value 0
-
- // write circular (use proc target)
- TS_TRACE("testAccessOCBIndirectChannel:"
- " target=%.8x type=%d write circular",
- get_huid(l_procTarget),
- (l_procTarget)->getAttr<TARGETING::ATTR_TYPE>());
-
- l_errl = HBOCC::writeCircularBuffer(l_procTarget,l_data);
- if (l_errl)
- {
- TS_FAIL("testAccessOCBIndirectChannel: write circular failed");
- l_error = true;
- break;
- }
- TS_TRACE("testAccessOCBIndirectChannel: write circular data=%lx",
- l_data.getDoubleWord(0));
-
- //*********************************************************************
- // Error tests
- //*********************************************************************
-
- // null target
- const TARGETING::Target* l_nullTarget = NULL;
- l_errl = HBOCC::writeCircularBuffer(l_nullTarget,l_data);
- if (l_errl) {
- TS_TRACE("testAccessOCBIndirectChannel: null test rc=%x",
- static_cast<uint32_t>(l_errl->reasonCode()));
- }
- if (!l_errl || (RC_TARGET_UNSUPPORTED != l_errl->reasonCode()))
- {
- TS_FAIL("testAccessOCBIndirectChannel: null target test failed");
- l_error = true;
- break;
- }
- delete l_errl;
- l_errl = NULL;
-
- // wrong target type
- TARGETING::TargetHandleList l_wrongTargetList;
- getAllChips(l_wrongTargetList,
- TYPE_MEMBUF,
- true);
-
- if (0==l_wrongTargetList.size()) //unexpected error
- {
- TS_FAIL("testAccessOCBIndirectChannel: No wrong targets");
- l_error = true;
- break;
- }
- const TARGETING::Target* l_wrongTarget = l_wrongTargetList[0];
-
- l_errl = HBOCC::writeCircularBuffer(l_wrongTarget,l_data);
- if (l_errl) {
- TS_TRACE("testAccessOCBIndirectChannel: wrong target rc=%x",
- static_cast<uint32_t>(l_errl->reasonCode()));
- }
- if (!l_errl || (RC_TARGET_UNSUPPORTED != l_errl->reasonCode()))
- {
- TS_FAIL("testAccessOCBIndirectChannel: wrong target test failed");
- l_error = true;
- break;
- }
- delete l_errl;
- l_errl = NULL;
-
- // wrong data length
- ecmdDataBufferBase l_wrongData(65);
-
- l_errl = HBOCC::readSRAM(l_procTarget,l_addr,l_wrongData);
- if (l_errl) {
- TS_TRACE("testAccessOCBIndirectChannel: wrong data rc=%x",
- static_cast<uint32_t>(l_errl->reasonCode()));
- }
- if (!l_errl || (RC_INVALID_DATA_BUFFER_LENGTH != l_errl->reasonCode()))
- {
- TS_FAIL("testAccessOCBIndirectChannel: wrong data length failed");
- l_error = true;
- break;
- }
- delete l_errl;
- l_errl = NULL;
-
- }
- while (0);
-
- //*********************************************************************
- // unload occ if needed
- //*********************************************************************
- if (occ_loaded)
- {
- errlHndl_t l_tmpErrl = NULL;
- l_tmpErrl = VFS::module_unload( "libocc.so" );
- if ( l_tmpErrl )
- {
- TS_WARN("testAccessOCBIndirectChannel:"
- " Error unloading libocc module" );
- delete l_tmpErrl;
- l_tmpErrl = NULL;
- }
- else
- {
- TS_TRACE("testAccessOCBIndirectChannel: unload occ module");
- }
- }
-
-
- if (l_errl) //Test case failed, commit error
- {
- errlCommit(l_errl,HWPF_COMP_ID);
- TS_TRACE ("testAccessOCBIndirectChannel: exit FAILED log committed");
- }
- else if (l_error) //Failed without an error log created
- {
- TS_TRACE ("testAccessOCBIndirectChannel: exit FAILED");
- }
- else
- {
- TS_TRACE ("testAccessOCBIndirectChannel: exit PASSED");
- }
-
-}
-
-}; // end class
-
-#endif
diff --git a/src/usr/hwpf/test/runtime/makefile b/src/usr/hwpf/test/runtime/makefile
deleted file mode 100644
index 921e9c7ac..000000000
--- a/src/usr/hwpf/test/runtime/makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/hwpf/test/runtime/makefile $
-#
-# OpenPOWER HostBoot Project
-#
-# COPYRIGHT International Business Machines Corp. 2011,2014
-#
-# 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
-ROOTPATH = ../../../../..
-
-HOSTBOOT_RUNTIME = 1
-MODULE = testhwpf_rt
-
-include ../hwpftest.mk
-
-TESTS += ../fapiattrtest.H
-TESTS += ../fapitargettest.H
-TESTS += ../fapirctest.H
-TESTS += ../hwpftest.H
-TESTS += rt_occtest.H
-#TESTS += ../hwpMvpdAccessorTest.H
-#TESTS += ../hwpMBvpdAccessorTest.H
-
-include ${ROOTPATH}/config.mk
-
diff --git a/src/usr/hwpf/test/runtime/rt_occtest.H b/src/usr/hwpf/test/runtime/rt_occtest.H
deleted file mode 100644
index 2072182ed..000000000
--- a/src/usr/hwpf/test/runtime/rt_occtest.H
+++ /dev/null
@@ -1,107 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/hwpf/test/runtime/rt_occtest.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] 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 __RT_OCCTEST_H
-#define __RT_OCCTEST_H
-
-#include <cxxtest/TestSuite.H>
-#include <runtime/interface.h>
-#include <hwpf/hwp/occ/occ_common.H>
-#include <fapi.H>
-#include <targeting/common/commontargeting.H>
-#include <vmmconst.h>
-#include <sys/mm.h>
-#include <util/utillidmgr.H>
-
-class OccTest: public CxxTest::TestSuite
-{
- public:
-
- void testOccIntf()
- {
- FAPI_INF("testOccIntf");
-
- runtimeInterfaces_t* rt_intf = getRuntimeInterfaces();
- if(rt_intf == NULL)
- {
- TS_FAIL("runtimeIntfaces not set");
- return;
- }
-
- if( rt_intf->get_lid_list == NULL )
- {
- TS_FAIL("runtimeInterfaces->get_lid_list not set");
- }
-
- if( rt_intf->occ_load == NULL )
- {
- TS_FAIL("runtimeInterfaces->loadOCC not set");
- }
-
- if( rt_intf->occ_start == NULL )
- {
- TS_FAIL("runtimeInterfaces->startOCCs not set");
- }
-
- if( rt_intf->occ_stop == NULL )
- {
- TS_FAIL("runtimeInterfaces->stopOCCs not set");
- }
-
- /* Test case for stopAllOCCs
- int err = stopAllOCCs();
- if( err == -1 )
- {
- TS_FAIL("FAILURE!");
- }
- */
-
- }
-
- void testGetLidList()
- {
- FAPI_INF("testGetLidList");
- runtimeInterfaces_t* rt_intf = getRuntimeInterfaces();
- if(rt_intf && rt_intf->get_lid_list)
- {
- size_t size = 0;
- const uint32_t * list = rt_intf->get_lid_list(&size);
- if(size > 1)
- {
- TS_FAIL("runtimeInterfaces->get_lid_list empty list");
- }
- else if (list[0] != Util::OCC_LIDID)
- {
- TS_FAIL("runtimeInterface->get_lid_list missing OCCLID");
- }
- }
-
- }
-
-
- private:
-
-};
-
-#endif
OpenPOWER on IntegriCloud