summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiCreateIfAttrService.pl3
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCode.C64
-rw-r--r--src/usr/hwpf/hwp/fapiHwpErrorInfo.xml10
-rw-r--r--src/usr/hwpf/hwp/fapiHwpExecInitFile.C3
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwp.C13
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwpConfig.C7
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C4
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwAccess.C37
-rw-r--r--src/usr/hwpf/plat/fapiPlatSystemConfig.C12
-rw-r--r--src/usr/hwpf/plat/fapiPlatUtil.C9
-rw-r--r--src/usr/hwpf/test/fapiRcTest.C81
-rw-r--r--src/usr/hwpf/test/hwpftest.H4
-rw-r--r--src/usr/targeting/test/targetingtest.H2
13 files changed, 132 insertions, 117 deletions
diff --git a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
index 56076c4f9..4789e8868 100755
--- a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
+++ b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
@@ -35,6 +35,7 @@
# mjjones 11/15/11 Copied from fapiParseAttributeInfo
# mjjones 12/12/11 Support all attributes if no if-attr
# files specified (for Cronus)
+# mjjones 01/13/12 Use new ReturnCode interfaces
#
# End Change Log ******************************************************
@@ -262,8 +263,8 @@ if ($attCount > 0)
}
print ASFILE " {\n";
print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n";
+print ASFILE " l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);\n";
print ASFILE " ReturnCodeFfdc::addEIFfdc(l_rc, static_cast<uint32_t>(i_id));\n";
-print ASFILE " l_rc = FAPI_RC_INVALID_ATTR_GET;\n";
print ASFILE " }\n\n";
print ASFILE " if (l_rc)\n";
print ASFILE " {\n";
diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C
index 411177264..2af4ec44c 100644
--- a/src/usr/hwpf/fapi/fapiReturnCode.C
+++ b/src/usr/hwpf/fapi/fapiReturnCode.C
@@ -39,6 +39,7 @@
* FAPI_RC_SUCCESS is assigned to
* ReturnCode
* mjjones 09/22/2011 Added ErrorInfo Support
+ * mjjones 01/12/2012 Enforce correct usage
*/
#include <fapiReturnCode.H>
@@ -60,7 +61,7 @@ ReturnCode::ReturnCode() :
//******************************************************************************
// Constructor
//******************************************************************************
-ReturnCode::ReturnCode(const uint32_t i_rcValue) :
+ReturnCode::ReturnCode(const ReturnCodes i_rcValue) :
iv_rcValue(i_rcValue), iv_pDataRef(NULL)
{
@@ -119,26 +120,13 @@ ReturnCode & ReturnCode::operator=(const ReturnCode & i_right)
//******************************************************************************
ReturnCode & ReturnCode::operator=(const uint32_t i_rcValue)
{
- iv_rcValue = i_rcValue;
-
- if (iv_rcValue == FAPI_RC_SUCCESS)
- {
- // Forget about any associated data
- forgetData();
- }
-
- return *this;
-}
-
-//******************************************************************************
-// resetError function
-//******************************************************************************
-void ReturnCode::resetError(const uint32_t i_rcValue)
-{
+ FAPI_ERR("Using deprecated ReturnCode function to assign integer");
iv_rcValue = i_rcValue;
// Forget about any associated data
forgetData();
+
+ return *this;
}
//******************************************************************************
@@ -158,15 +146,53 @@ ReturnCode::operator uint32_t() const
}
//******************************************************************************
-// setPlatData function
+// setFapiError function
+//******************************************************************************
+void ReturnCode::setFapiError(const ReturnCodes i_rcValue)
+{
+ iv_rcValue = i_rcValue;
+
+ // Forget about any associated data (this is a new error)
+ forgetData();
+}
+
+//******************************************************************************
+// setEcmdError function
//******************************************************************************
-void ReturnCode::setPlatData(void * i_pData)
+void ReturnCode::setEcmdError(const uint32_t i_rcValue)
{
+ iv_rcValue = i_rcValue;
+
+ // Forget about any associated data (this is a new error)
+ forgetData();
+}
+
+//******************************************************************************
+// setPlatError function
+//******************************************************************************
+void ReturnCode::setPlatError(void * i_pData)
+{
+ iv_rcValue = FAPI_RC_PLAT_ERR_SEE_DATA;
+
+ // Forget about any associated data (this is a new error)
+ forgetData();
+
ensureDataRefExists();
iv_pDataRef->setPlatData(i_pData);
}
//******************************************************************************
+// _setHwpError function
+//******************************************************************************
+void ReturnCode::_setHwpError(const HwpReturnCode i_rcValue)
+{
+ iv_rcValue = i_rcValue;
+
+ // Forget about any associated data (this is a new error)
+ forgetData();
+}
+
+//******************************************************************************
// getPlatData function
//******************************************************************************
void * ReturnCode::getPlatData() const
diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
index d77d85ed8..7374c965d 100644
--- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
+++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
@@ -57,6 +57,16 @@
</hwpError>
<!-- *********************************************************************** -->
<hwpError>
+ <rc>RC_TEST_CONFIG_NO_MCS_CHIPLETS</rc>
+ <description>HWP Config Unit Test found no MCS chiplets</description>
+ </hwpError>
+ <!-- *********************************************************************** -->
+ <hwpError>
+ <rc>RC_TEST_CONFIG_PARENT_CHIP_MISMATCH</rc>
+ <description>HWP Config Unit Test found a parent chip mismatch</description>
+ </hwpError>
+ <!-- *********************************************************************** -->
+ <hwpError>
<rc>RC_INITFILE_INCORRECT_VER</rc>
<description>InitFile has incorrect version</description>
<!-- Collect local FFDC FFDC_IF_VER -->
diff --git a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
index 37a3a30a9..67b91a24a 100644
--- a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
+++ b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C
@@ -39,6 +39,7 @@
* endianness at compile time
* camvanng 01/06/2012 Support for writing an
* attribute to a SCOM register
+ * mjjones 01/13/2012 Use new ReturnCode interfaces
*/
#include <fapiHwpExecInitFile.H>
@@ -1415,7 +1416,7 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum,
"ecmdDataBuffer setDoubleWord() - rc 0x%.8X",
l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
break;
}
diff --git a/src/usr/hwpf/hwp/fapiTestHwp.C b/src/usr/hwpf/hwp/fapiTestHwp.C
index cf3353187..cae558593 100644
--- a/src/usr/hwpf/hwp/fapiTestHwp.C
+++ b/src/usr/hwpf/hwp/fapiTestHwp.C
@@ -40,6 +40,7 @@
* camvanng 09/28/2011 Added test for initfile
* camvanng 11/16/2011 Change function name
* fapiHwpExecInitFile()
+ * mjjones 01/13/2012 Use new ReturnCode interfaces
*
*/
@@ -100,7 +101,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiPutScom test, error from ecmdDataBuffer setDoubleWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
break;
}
@@ -127,7 +128,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiPutScomUnderMask test, error from ecmdDataBuffer setDoubleWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);;
break;
}
@@ -151,7 +152,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiPutScom to restore, error from ecmdDataBuffer setDoubleWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
break;
}
@@ -205,7 +206,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiPutCfamRegister test, error from ecmdDataBuffer setWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);;
break;
}
@@ -230,7 +231,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiModifyCfamRegister test, error from ecmdDataBuffer setWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);;
break;
}
@@ -254,7 +255,7 @@ fapi::ReturnCode hwpInitialTest(const fapi::Target & i_chip)
if (l_ecmdRc != ECMD_DBUF_SUCCESS)
{
FAPI_ERR("hwpInitialTest: fapiPutCfamRegister to restore, error from ecmdDataBuffer setWord() - rc 0x%.8X", l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);;
break;
}
diff --git a/src/usr/hwpf/hwp/fapiTestHwpConfig.C b/src/usr/hwpf/hwp/fapiTestHwpConfig.C
index 5882b6549..17af655a4 100644
--- a/src/usr/hwpf/hwp/fapiTestHwpConfig.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpConfig.C
@@ -34,7 +34,7 @@
* mjjones 09/12/2011 Created.
* mjjones 10/06/2011 Updated traces.
* camvang 10/26/2011 Updated traces.
- *
+ * mjjones 01/13/2012 Use new ReturnCode interfaces
*/
#include <fapiTestHwpConfig.H>
@@ -72,7 +72,7 @@ fapi::ReturnCode hwpTestConfig(const fapi::Target & i_chip)
if (l_targets.size() == 0)
{
FAPI_ERR("hwpTestConfig: No MCS chiplets");
- l_rc = fapi::RC_TEST_ERROR_A;
+ FAPI_SET_HWP_ERROR(l_rc, RC_TEST_CONFIG_NO_MCS_CHIPLETS);
}
else
{
@@ -105,7 +105,8 @@ fapi::ReturnCode hwpTestConfig(const fapi::Target & i_chip)
if (i_chip != l_chip)
{
FAPI_ERR("hwpTestConfig: Chip mismatch");
- l_rc = fapi::RC_TEST_ERROR_B;
+ FAPI_SET_HWP_ERROR(l_rc,
+ RC_TEST_CONFIG_PARENT_CHIP_MISMATCH);
}
}
}
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index 41e1ada6b..e567a0c74 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -95,8 +95,8 @@ fapi::ReturnCode createAttrAccessError(
| (static_cast<uint64_t>(i_fapiAttrId)),
i_pFapiTarget ? i_pFapiTarget->getType(): NULL);
- fapi::ReturnCode l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *>(l_pError));
+ fapi::ReturnCode l_rc;
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
return l_rc;
}
diff --git a/src/usr/hwpf/plat/fapiPlatHwAccess.C b/src/usr/hwpf/plat/fapiPlatHwAccess.C
index 8687fd7d7..5539caefc 100644
--- a/src/usr/hwpf/plat/fapiPlatHwAccess.C
+++ b/src/usr/hwpf/plat/fapiPlatHwAccess.C
@@ -90,8 +90,7 @@ fapi::ReturnCode platGetScom(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platGetScom: deviceRead() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
}
else
{
@@ -106,7 +105,7 @@ fapi::ReturnCode platGetScom(const fapi::Target& i_target,
{
FAPI_ERR("platGetScom: ecmdDataBufferBase setBitLength() or setDoubleWord() returns error, ecmdRc 0x%.8X",
l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
}
}
@@ -140,8 +139,7 @@ fapi::ReturnCode platPutScom(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platPutScom: deviceWrite() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
}
FAPI_DBG(EXIT_MRK "platPutScom");
@@ -177,8 +175,7 @@ fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platPutScomUnderMask: deviceRead() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -203,8 +200,7 @@ fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platPutScomUnderMask: deviceWrite() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -274,8 +270,7 @@ fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platGetCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -297,8 +292,7 @@ fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platGetCfamRegister: deviceRead() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -312,7 +306,7 @@ fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
{
FAPI_ERR("platGetCfamRegister: ecmdDataBufferBase setBitLength() or setWord() returns error, ecmdRc 0x%.8X",
l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
}
} while(0);
@@ -340,8 +334,7 @@ fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platPutCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -363,8 +356,7 @@ fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platPutCfamRegister: deviceWrite() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -432,8 +424,7 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platModifyCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -455,8 +446,7 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platModifyCfamRegister: deviceRead() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -472,8 +462,7 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("platModifyCfamRegister: deviceWrite() returns error");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_err));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
diff --git a/src/usr/hwpf/plat/fapiPlatSystemConfig.C b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
index 31f10e05a..5aadd4b11 100644
--- a/src/usr/hwpf/plat/fapiPlatSystemConfig.C
+++ b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
@@ -78,8 +78,7 @@ fapi::ReturnCode fapiGetChildChiplets(
i_chip.getType());
// Attach the error log to the fapi::ReturnCode
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
@@ -120,8 +119,7 @@ fapi::ReturnCode fapiGetChildChiplets(
i_chipletType);
// Attach the error log to the fapi::ReturnCode
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
}
@@ -228,8 +226,7 @@ fapi::ReturnCode fapiGetParentChip(
i_chiplet.getType());
// Attach the error log to the fapi::ReturnCode
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
@@ -269,8 +266,7 @@ fapi::ReturnCode fapiGetParentChip(
l_chipList.size());
// Attach the error log to the fapi::ReturnCode
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
diff --git a/src/usr/hwpf/plat/fapiPlatUtil.C b/src/usr/hwpf/plat/fapiPlatUtil.C
index 829eb757d..2f155bccd 100644
--- a/src/usr/hwpf/plat/fapiPlatUtil.C
+++ b/src/usr/hwpf/plat/fapiPlatUtil.C
@@ -143,8 +143,7 @@ fapi::ReturnCode fapiLoadInitFile(const fapi::Target & i_Target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("fapiLoadInitFile: module_load failed");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
@@ -153,8 +152,7 @@ fapi::ReturnCode fapiLoadInitFile(const fapi::Target & i_Target,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("fapiLoadInitFile: module_address failed");
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
@@ -184,8 +182,7 @@ fapi::ReturnCode fapiUnloadInitFile(const char * i_file, const char *& io_addr,
{
// Add the error log pointer as data to the ReturnCode
FAPI_ERR("fapiUnloadInitFile: module_unload failed %s", i_file);
- l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
- l_rc.setPlatData(reinterpret_cast<void *> (l_pError));
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
diff --git a/src/usr/hwpf/test/fapiRcTest.C b/src/usr/hwpf/test/fapiRcTest.C
index 335266fb2..c9c1281d5 100644
--- a/src/usr/hwpf/test/fapiRcTest.C
+++ b/src/usr/hwpf/test/fapiRcTest.C
@@ -33,7 +33,7 @@
* 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
*/
#include <fapi.H>
@@ -95,7 +95,7 @@ uint32_t rcTest2()
ReturnCode l_rc;
// Set the return code to a FAPI code
- l_rc = FAPI_RC_FAPI_MASK | 0x05;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Ensure that the creator is FAPI
ReturnCode::returnCodeCreator l_creator = l_rc.getCreator();
@@ -108,7 +108,7 @@ uint32_t rcTest2()
else
{
// Set the return code to a PLAT code
- l_rc = FAPI_RC_PLAT_ERR_SEE_DATA;
+ l_rc.setPlatError(NULL);
// Ensure that the creator is PLAT
l_creator = l_rc.getCreator();
@@ -120,8 +120,9 @@ uint32_t rcTest2()
}
else
{
- // Set the return code to a HWP code
- l_rc = 5;
+ // 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();
@@ -150,15 +151,15 @@ uint32_t rcTest3()
uint32_t l_result = 0;
// Create ReturnCode specifying a return code
- uint32_t l_code = 4;
- ReturnCode l_rc(l_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 != l_code)
+ if (l_codeCheck != FAPI_RC_INVALID_ATTR_GET)
{
- FAPI_ERR("rcTest3. Code is 0x%x, expected 0x%x", l_codeCheck, l_code);
+ FAPI_ERR("rcTest3. Code is 0x%x, expected FAPI_RC_INVALID_ATTR_GET",
+ l_codeCheck);
l_result = 1;
}
else
@@ -196,10 +197,8 @@ uint32_t rcTest4()
uint32_t l_result = 0;
// Create similar ReturnCodes
- uint32_t l_code = 6;
- uint32_t l_code2 = 7;
- ReturnCode l_rc(l_code);
- ReturnCode l_rc2(l_code);
+ 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))
@@ -218,7 +217,7 @@ uint32_t rcTest4()
else
{
// Change the code of l_rc2
- l_rc2 = l_code2;
+ l_rc2.setFapiError(FAPI_RC_PLAT_ERR_SEE_DATA);
// Ensure that the equality comparison returns false
if (l_rc == l_rc2)
@@ -254,13 +253,11 @@ uint32_t rcTest5()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 6;
- uint32_t l_code2 = 7;
- ReturnCode l_rc(l_code);
+ 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 == l_code))
+ if (!(l_rc == FAPI_RC_INVALID_ATTR_GET))
{
FAPI_ERR("rcTest5. 1. Equality comparison false");
l_result = 1;
@@ -269,7 +266,7 @@ uint32_t rcTest5()
{
// Ensure that the inequality comparison returns false when comparing to
// the same return code value
- if (l_rc != l_code)
+ if (l_rc != FAPI_RC_INVALID_ATTR_GET)
{
FAPI_ERR("rcTest5. 2. Inequality comparison true");
l_result = 2;
@@ -278,7 +275,7 @@ uint32_t rcTest5()
{
// Ensure that the equality comparison returns false when comparing
// to a different return code value
- if (l_rc == l_code2)
+ if (l_rc == FAPI_RC_PLAT_ERR_SEE_DATA)
{
FAPI_ERR("rcTest5. 3. Equality comparison true");
l_result = 3;
@@ -287,7 +284,7 @@ uint32_t rcTest5()
{
// Ensure that the inequality comparison returns true when
// comparing to a different return code value
- if (!(l_rc != l_code2))
+ if (!(l_rc != FAPI_RC_PLAT_ERR_SEE_DATA))
{
FAPI_ERR("rcTest5. 4. Inequality comparison false");
l_result = 4;
@@ -312,8 +309,7 @@ uint32_t rcTest6()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 6;
- ReturnCode l_rc(l_code);
+ ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
// Ensure that the getPlatData function returns NULL
void * l_pData = reinterpret_cast<void *> (0x12345678);
@@ -355,8 +351,7 @@ uint32_t rcTest7()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 10;
- ReturnCode l_rc(l_code);
+ 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
@@ -364,7 +359,7 @@ uint32_t rcTest7()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatData(l_pMyData);
+ (void) l_rc.setPlatError(l_pMyData);
// Ensure that getPlatData retrieves the PlatData
void * l_pMyDataCheck = l_rc.getPlatData();
@@ -406,8 +401,7 @@ uint32_t rcTest8()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 10;
- ReturnCode l_rc(l_code);
+ 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
@@ -415,7 +409,7 @@ uint32_t rcTest8()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatData(l_pMyData);
+ (void) l_rc.setPlatError(l_pMyData);
// Ensure that releasePlatData retrieves the PlatData
void * l_pMyDataCheck = l_rc.releasePlatData();
@@ -454,8 +448,7 @@ uint32_t rcTest9()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 10;
- ReturnCode l_rc(l_code);
+ 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
@@ -463,7 +456,7 @@ uint32_t rcTest9()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatData(l_pMyData);
+ (void) l_rc.setPlatError(l_pMyData);
// Create a ReturnCode using the copy constructor
ReturnCode l_rc2(l_rc);
@@ -518,8 +511,7 @@ uint32_t rcTest10()
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 10;
- ReturnCode l_rc(l_code);
+ 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
@@ -527,7 +519,7 @@ uint32_t rcTest10()
// destructed.
uint32_t l_myData = 6;
void * l_pMyData = reinterpret_cast<void *> (&l_myData);
- (void) l_rc.setPlatData(l_pMyData);
+ (void) l_rc.setPlatError(l_pMyData);
// Create a ReturnCode using the assignment operator
ReturnCode l_rc2;
@@ -610,7 +602,7 @@ uint32_t rcTest12()
// Create a ReturnCode
ReturnCode l_rc;
- l_rc = 5;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Create a DIMM target
uint32_t l_targetHandle = 3;
@@ -738,7 +730,7 @@ uint32_t rcTest13()
// Create a ReturnCode
ReturnCode l_rc;
- l_rc = 5;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Create a DIMM target
uint32_t l_targetHandle = 3;
@@ -815,7 +807,7 @@ uint32_t rcTest14()
// Create a ReturnCode
ReturnCode l_rc;
- l_rc = 5;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Create a DIMM target
uint32_t l_targetHandle = 3;
@@ -893,7 +885,7 @@ uint32_t rcTest15()
// Create a ReturnCode
ReturnCode l_rc;
- l_rc = 5;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Create a DIMM target
uint32_t l_targetHandle = 3;
@@ -935,7 +927,7 @@ uint32_t rcTest16()
// Create a ReturnCode
ReturnCode l_rc;
- l_rc = 5;
+ l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);
// Create 2 targets
uint32_t l_targetHandle = 3;
@@ -1116,14 +1108,15 @@ uint32_t rcTest17()
uint32_t l_result = 0;
// Create a ReturnCode
- ReturnCode l_rc;
- l_rc = 5;
+ ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET);
uint32_t l_check = static_cast<uint32_t>(l_rc);
- if (l_check != 5)
+ if (l_check != FAPI_RC_INVALID_ATTR_GET)
{
- FAPI_ERR("rcTest17. RC is not 5, it is 0x%x", l_check);
+ FAPI_ERR("rcTest17. RC is not FAPI_RC_INVALID_ATTR_GET, it is 0x%x",
+ l_check);
+ l_result = 1;
}
else
{
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
index 4251604a4..6368e93d5 100644
--- a/src/usr/hwpf/test/hwpftest.H
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -475,7 +475,7 @@ public:
"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;
+ FAPI_SET_HWP_ERROR(l_rc, RC_HWP_EXEC_INITFILE_TEST_FAILED);
break;
}
}
@@ -496,7 +496,7 @@ public:
TS_FAIL("testHwpf5: fapiPutScom to restore, error from "
"ecmdDataBuffer setDoubleWord() - rc 0x%.8X",
l_ecmdRc);
- l_rc = l_ecmdRc;
+ l_rc.setEcmdError(l_ecmdRc);
break;
}
diff --git a/src/usr/targeting/test/targetingtest.H b/src/usr/targeting/test/targetingtest.H
index 9e468ec20..25065e701 100644
--- a/src/usr/targeting/test/targetingtest.H
+++ b/src/usr/targeting/test/targetingtest.H
@@ -1181,7 +1181,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
using namespace TARGETING;
using namespace fapi;
- fapi::ReturnCode l_rc = 0;
+ fapi::ReturnCode l_rc;
//----------------------------------------------------------------------
// Test ATTR_MSS_EFF_PRIMARY_RANK
OpenPOWER on IntegriCloud