summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamVan Nguyen <ctnguyen@us.ibm.com>2011-11-02 10:25:41 -0500
committerAndrew J. Geissler <andrewg@us.ibm.com>2011-11-02 10:53:51 -0500
commitb72ee9b1f333be7847d694bfa2c5fbafa2e4c487 (patch)
tree14868c0c6d98653b6669961fba660f2238609969
parenta9546cd1f115920da46cc485762e643f93c1fffc (diff)
downloadtalos-hostboot-b72ee9b1f333be7847d694bfa2c5fbafa2e4c487.tar.gz
talos-hostboot-b72ee9b1f333be7847d694bfa2c5fbafa2e4c487.zip
Updated hwpExecInitFile test case in hwpInitialTest
Added unit test for hwpExecInitFile Trace initfile version Change-Id: I5ff2ba7d5977a157a47f5f59252b52e17bf69d2f Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/476 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
-rw-r--r--src/usr/hwpf/hwp/fapiHwpExecInitFile.C17
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwp.C198
-rw-r--r--src/usr/hwpf/test/hwpftest.H203
3 files changed, 217 insertions, 201 deletions
diff --git a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
index 2019c8ed2..418ab484f 100644
--- a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
+++ b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
@@ -248,8 +248,9 @@ fapi::ReturnCode hwpExecInitFile(const fapi::Target & i_Target,
if (IF_SYNTAX_VERSION != *(reinterpret_cast<const uint32_t *>(l_offset)))
{
- FAPI_ERR("hwpExecInitFile: Syntax version 0x%x Expected version 0x%x",
- *(const uint32_t *)l_offset, IF_SYNTAX_VERSION);
+ FAPI_ERR("hwpExecInitFile: %s Syntax version %u Expected version 0x%x",
+ i_file, *(reinterpret_cast<const uint32_t *>(l_offset)),
+ IF_SYNTAX_VERSION);
uint32_t l_ffdc = *(const uint32_t *)l_offset;
uint32_t & FFDC_IF_VER = l_ffdc; // GENERIC IDENTIFIER
@@ -265,6 +266,10 @@ fapi::ReturnCode hwpExecInitFile(const fapi::Target & i_Target,
}
else
{
+ FAPI_IMP("hwpExecInitFile: %s Syntax version %u CVS version %s",
+ i_file, *(reinterpret_cast<const uint32_t *>(l_offset)),
+ (l_offset + 4));
+
//Save the data
ifInfo_t l_ifInfo;
memset(&l_ifInfo, 0, sizeof(ifInfo_t));
@@ -1239,7 +1244,7 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum,
{
//Perform a PutScomUnderMask operation on the target
- #ifdef HOSTBOOT_DEBUG
+ #ifdef HWPEXECINITFILE_DEBUG
l_rc = fapiGetScom(l_target, l_addr, l_scomData);
FAPI_DBG("hwpExecInitFile: writeScom: Data read 0x%.16llX",
l_scomData.getDoubleWord(0));
@@ -1291,7 +1296,7 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum,
FAPI_ERR("hwpExecInitFile: Error from fapiPutScomUnderMask");
break;
}
- #ifdef HOSTBOOT_DEBUG
+ #ifdef HWPEXECINITFILE_DEBUG
else
{
l_rc = fapiGetScom(l_target, l_addr, l_scomData);
@@ -1304,7 +1309,7 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum,
{
//Perform a PutScom operation on the target
- #ifdef HOSTBOOT_DEBUG
+ #ifdef HWPEXECINITFILE_DEBUG
l_rc = fapiGetScom(l_target, l_addr, l_scomData);
FAPI_DBG("hwpExecInitFile: writeScom: Data read 0x%.16llX",
l_scomData.getDoubleWord(0));
@@ -1331,7 +1336,7 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum,
{
FAPI_ERR("hwpExecInitFile: Error from fapiPutScom");
}
- #ifdef HOSTBOOT_DEBUG
+ #ifdef HWPEXECINITFILE_DEBUG
else
{
l_rc = fapiGetScom(l_target, l_addr, l_scomData);
diff --git a/src/usr/hwpf/hwp/fapiTestHwp.C b/src/usr/hwpf/hwp/fapiTestHwp.C
index 3a340f9fa..bedec2702 100644
--- a/src/usr/hwpf/hwp/fapiTestHwp.C
+++ b/src/usr/hwpf/hwp/fapiTestHwp.C
@@ -274,208 +274,16 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
// 9. hwpExecInitFile test
// --------------------------------------------------------
- l_rc = testExecInitFile(i_chip);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: Error from testExecInitFile");
- break;
- }
- else
- {
- FAPI_INF("hwpInitialTest: Test testExecInitFile passed");
- }
-
- } while (0);
-
- return l_rc;
-}
-
-
-//******************************************************************************
-// testExecInitFile function - function to test sample initfile
-//******************************************************************************
-fapi::ReturnCode testExecInitFile(const fapi::Target & i_chip)
-{
- 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[] =
- {
- {0x000000000006002b, 0, 0x0000000000000183},
- {0x000000000006002c, 0, 0x0000000000000183},
- {0x000000000006800b, 0, 0},
- {0x000000000006800c, 0, 0x8000000000000000 >> 0x17},
- {0x0000000013010002, 0, 0x0000000000000181},
- {0x0000000013013283, 0, 0x3c90000000000000 |
- 0x8000000000000000 >> 0x0c |
- 0x8000000000000000 >> 0x0d |
- 0x0306400412000000 >> 0x0e},
- {0x0000000013013284, 0, 0x3c90000000000000},
- {0x0000000013013285, 0, 0x8000000000000000 >> 0x0f |
- 0x8000000000000000 >> 0x10 |
- 0x8000000000000000 >> 0x13 |
- 0x0306400412000000 >> 0x15 },
- {0x0000000013013286, 0, 0},
- {0x0000000013013287, 0, 0x0000000000000182},
- {0x0000000013013288, 0, 0x0000000000000192},
- {0x0000000013013289, 0, 0x8000000000000000 >> 0x17},
- {0x0000000013030007, 0, 0x0000000000000182}
- };
-
- fapi::ReturnCode l_rc = fapi::FAPI_RC_SUCCESS;
- uint32_t l_ecmdRc = ECMD_DBUF_SUCCESS;
- ecmdDataBufferBase l_ScomData(64);
-
- do {
- // Set up some attributes for testing
- uint8_t l_uint8 = 1;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: "
- "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)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: "
- "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)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: "
- "ATTR_SCRATCH_UINT32_1. 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)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: "
- "ATTR_SCRATCH_UINT64_1. Error from SET");
- break;
- }
-
- uint8_t l_uint8array1[32];
- l_uint8array1[2] = 1;
- l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: "
- "ATTR_SCRATCH_UINT8_ARRAY_1. Error from SET");
- 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(i_chip, l_ifScomData[i].addr, l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: 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(i_chip, l_ifScomData[i].addr, l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: Error from "
- "fapiPutScom");
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- //Call Hwp to execute the initfile
+ //Call Hwp to execute the sample initfile
FAPI_EXEC_HWP(l_rc, hwpExecInitFile, i_chip, "sample.if");
-
if (l_rc != fapi::FAPI_RC_SUCCESS)
{
FAPI_ERR("hwpInitialTest: Error from hwpExecInitFile");
break;
}
-
- //Verify the data written
- for (uint32_t i = 0; i < sizeof(l_ifScomData)/sizeof(ifScom_t); i++)
- {
- l_rc = fapiGetScom(i_chip, l_ifScomData[i].addr, l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: Error from "
- "fapiGetScom");
- break;
- }
-
- if (l_ScomData.getDoubleWord(0) != l_ifScomData[i].writtenData)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: GetScom addr "
- "0x%.16llX data read 0x%.16llX data expected 0x%.16llX",
- l_ifScomData[i].addr, l_ScomData.getDoubleWord(0),
- l_ifScomData[i].writtenData);
- l_rc = fapi::RC_HWP_EXEC_INITFILE_TEST_FAILED;
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- break;
- }
-
- // Restore the original Scom data
- 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)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: fapiPutScom to "
- "restore, error from ecmdDataBuffer setDoubleWord() - "
- "rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
- break;
- }
-
- l_rc = fapiPutScom(i_chip, l_ifScomData[i].addr, l_ScomData);
- if (l_rc != fapi::FAPI_RC_SUCCESS)
- {
- FAPI_ERR("hwpInitialTest: testExecInitFile: Error from "
- "fapiGetScom");
- break;
- }
- }
-
- if (l_rc != fapi::FAPI_RC_SUCCESS)
+ else
{
- break;
+ FAPI_INF("hwpInitialTest: hwpExecInitFile passed");
}
} while (0);
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
index cfc9abd27..fa503f3b5 100644
--- a/src/usr/hwpf/test/hwpftest.H
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -35,6 +35,7 @@
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <targeting/targetservice.H>
+#include <fapiHwpExecInitFile.H>
using namespace fapi;
using namespace TARGETING;
@@ -155,6 +156,208 @@ public:
}
}
+ /**
+ * @brief Test HWPF InitFile: call the procedure that exercises a sample initfile
+ */
+ void testHwpf5()
+ {
+ 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[] =
+ {
+ {0x000000000006002b, 0, 0x0000000000000183},
+ {0x000000000006002c, 0, 0x0000000000000183},
+ {0x000000000006800b, 0, 0},
+ {0x000000000006800c, 0, 0x8000000000000000 >> 0x17},
+ {0x0000000013010002, 0, 0x0000000000000181},
+ {0x0000000013013283, 0, 0x3c90000000000000 |
+ 0x8000000000000000 >> 0x0c |
+ 0x8000000000000000 >> 0x0d |
+ 0x0306400412000000 >> 0x0e},
+ {0x0000000013013284, 0, 0x3c90000000000000},
+ {0x0000000013013285, 0, 0x8000000000000000 >> 0x0f |
+ 0x8000000000000000 >> 0x10 |
+ 0x8000000000000000 >> 0x13 |
+ 0x0306400412000000 >> 0x15 },
+ {0x0000000013013286, 0, 0},
+ {0x0000000013013287, 0, 0x0000000000000182},
+ {0x0000000013013288, 0, 0x0000000000000192},
+ {0x0000000013013289, 0, 0x8000000000000000 >> 0x17},
+ {0x0000000013030007, 0, 0x0000000000000182}
+ };
+
+ fapi::ReturnCode l_rc = fapi::FAPI_RC_SUCCESS;
+ ecmdDataBufferBase l_ScomData(64);
+
+ do {
+ // Set up some attributes for testing
+ 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;
+ }
+
+ 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;
+ }
+
+ uint8_t l_uint8array1[32];
+ l_uint8array1[2] = 1;
+ 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;
+ }
+
+ // Get the master processor chip
+ TARGETING::Target* l_pTarget = NULL;
+ TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
+
+ // Create a FAPI Target and invoke the hwpInitialTest HWP
+ fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
+ reinterpret_cast<void *> (l_pTarget));
+
+ /*
+ // 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, hwpExecInitFile, l_fapiTarget, "sample.if");
+
+ if (l_rc != fapi::FAPI_RC_SUCCESS)
+ {
+ TS_FAIL("testHwpf5: Error from hwpExecInitFile");
+ 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);
+ l_rc = fapi::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 = 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. hwpExecInitFile passed.");
+ }
+ }
+
};
#endif
OpenPOWER on IntegriCloud