summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-01-26 13:04:02 -0600
committerMIKE J. JONES <mjjones@us.ibm.com>2012-01-31 12:49:44 -0600
commit39b01da0087097401dea4d9a9f4e483734e751d8 (patch)
tree2158b4fc359edd3cadb79644514c46ae7a5d0830
parentcc2a06c9d91f0a38a8774623efaa99a2406d3a17 (diff)
downloadblackbird-hostboot-39b01da0087097401dea4d9a9f4e483734e751d8.tar.gz
blackbird-hostboot-39b01da0087097401dea4d9a9f4e483734e751d8.zip
HWPF: Enforce correct fapi::ReturnCode usage
Change-Id: Id5f2c7c4ebef5fa880133dd8ba353d69def10bbc Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/628 Tested-by: Jenkins Server Reviewed-by: Van H. Lee <vanlee@us.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
-rw-r--r--src/include/usr/hwpf/fapi/fapiReturnCode.H89
-rw-r--r--src/include/usr/hwpf/fapi/fapiReturnCodes.H6
-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
15 files changed, 200 insertions, 144 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H
index 34c060ca6..bd19c40e8 100644
--- a/src/include/usr/hwpf/fapi/fapiReturnCode.H
+++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H
@@ -38,6 +38,7 @@
* setHwpFfdc
* mjjones 09/22/2011 Added ErrorInfo Support
* mjjones 11/10/2011 Use ecmdDataBufferBase
+ * mjjones 01/12/2012 Enforce correct usage
*/
#ifndef FAPIRETURNCODE_H_
@@ -51,6 +52,7 @@
#include <fapiErrorInfo.H>
#include <fapiHwpErrorInfo.H>
#include <fapiPlatTrace.H>
+#include <fapiHwpReturnCodes.H>
/**
* @brief Set HWP Error macro
@@ -60,7 +62,7 @@
* needs to be processed
*/
#define FAPI_SET_HWP_ERROR(RC, ERROR) \
- RC.resetError(fapi::ERROR); \
+ RC._setHwpError(fapi::ERROR); \
ERROR##_CALL_FUNC_TO_ANALYZE_ERROR(RC); \
ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
ERROR##_ADD_ERROR_INFO(RC)
@@ -75,13 +77,17 @@ class ReturnCodeDataRef;
* @class ReturnCode
*
* This class provides a generic return code. It contains the rcValue (return
- * code value) which is of type uint32_t. A user can treat a ReturnCode just
- * as if it were a uint32_t.
+ * code value) which is of type uint32_t.
*
- * FAPI, PLAT and HWP code can all create a ReturnCode.
- * PLAT can associate PlatData to it (use-case is an error log).
- * HWPs can add ErrorInfo to it (via FAPI_SET_HWP_ERROR macro).
- * FFDC HWPs can add FFDC ErrorInfo to it (via addEIFfdc member function)
+ * FAPI can set an error in the ReturnCode by calling setFapiError.
+ * PLAT can set an error in the ReturnCode by calling setPlatError, this
+ * function associates heap based PlatData to the ReturnCode (use-case is
+ * an error log).
+ * HWP can set an error in the ReturnCode by calling FAPI_SET_HWP_ERROR, this
+ * macro adds any error information associated with the HWP error to the
+ * ReturnCode (error information is documented in an error XML file).
+ * FAPI/PLAT/HWP can set an ecmdDataBufferBase error in the ReturnCode by
+ * calling setEcmdError
*
* A ReturnCode is copyable and assignable. Therefore, it cannot be subclassed.
*
@@ -104,15 +110,13 @@ public:
/**
* @brief Constructor. Sets rcValue to the specified value
*
- * @note This allows an implicit conversion between a uint32_t and a
- * ReturnCode. A user is allowed to return a uint32_t from a function
- * that returns a ReturnCode or is allowed to pass a uint32_t to a
- * function that expects a ReturnCode and in both cases, the uint32_t
- * will be automatically converted to a ReturnCode.
+ * @note This allows an implicit conversion from a value from the
+ * ReturnCodes enumeration and a ReturnCode. This is provided so that
+ * a function can do "return FAPI_RC_SUCCESS;"
*
* @param[in] i_rcValue The rcValue to set
*/
- ReturnCode(const uint32_t i_rcValue);
+ ReturnCode(const ReturnCodes i_rcValue);
/**
* @brief Copy Constructor
@@ -136,7 +140,11 @@ public:
ReturnCode & operator=(const ReturnCode & i_right);
/**
- * @brief Assignment Operator.
+ * @brief ***DEPRECATED*** Assignment Operator.
+ *
+ * TODO
+ * This function will be deleted to prevent invalid usage of ReturnCode
+ * Use setFapiError, setPlatError, setEcmdError or FAPI_SET_HWP_ERROR
*
* @param[in] i_rc rcValue to assign
*
@@ -147,13 +155,6 @@ public:
ReturnCode & operator=(const uint32_t i_rcValue);
/**
- * @brief Any associated data is deleted and the specified rcValue is set
- *
- * @param[in] i_rc rcValue to set
- */
- void resetError(const uint32_t i_rcValue);
-
- /**
* @brief Returns if the return code indicates success
*
* @return bool. True if ok, else false
@@ -166,21 +167,57 @@ public:
* @note This allows a user to directly compare:
* 1/ ReturnCode to uint32_t (ReturnCode converted to uint32_t)
* 2/ ReturnCode to ReturnCode (Both ReturnCode converted to uint32_t)
+ * This allows a user to test if a ReturnCode is bad (if (l_rc){})
*/
operator uint32_t() const;
/**
- * @brief Associates heap based PlatData with the ReturnCode. The ReturnCode
- * object takes responsibility for deleting the data (platform code
- * actually implements the delete function and must know the type and
- * how to delete it). Any existing PlatData is deleted.
+ * @brief Sets a FAPI error. Sets the rcValue to the supplied value (from
+ * the ReturnCodes enumeration) and deletes any associated data.
+ *
+ * This is called by FAPI code to generate an error.
+ *
+ * @param[in] i_rcValue Error value to set
+ */
+ void setFapiError(const ReturnCodes i_rcValue);
+
+ /**
+ * @brief Sets an ecmd error. Sets the rcValue to the supplied value and
+ * deletes any associated data.
+ *
+ * This is called by FAPI/PLAT/HWP code to generate an error when an
+ * ecmdDataBufferBase call returns non zero. This can also be used by PLAT
+ * code that reports errors with ecmd return codes.
+ *
+ * @param[in] i_rcValue ecmdDataBufferBase error value to set
+ */
+ void setEcmdError(const uint32_t i_rcValue);
+
+ /**
+ * @brief Sets a PLAT error. Sets the rcValue to FAPI_RC_PLAT_ERR_SEE_DATA,
+ * deletes any associated data and associates the supplied heap based
+ * PlatData with the ReturnCode. The ReturnCode object takes
+ * responsibility for deleting the data (platform code implements the
+ * delete function and must know the type and how to delete it).
*
* This is called by PLAT. The expected use-case is to associate a platform
* error log with the ReturnCode.
*
* @param[in] i_pData Pointer to PlatData (on the heap)
*/
- void setPlatData(void * i_pData);
+ void setPlatError(void * i_pData);
+
+ /**
+ * @brief Sets a HWP error. Sets the rcValue to the supplied value (from
+ * the HwpReturnCode enumeration) and deletes any associated data.
+ *
+ * HWP code must call the FAPI_SET_HWP_ERROR macro rather than this function
+ * directly to generate an error so that any error information is
+ * automatically added to the ReturnCode
+ *
+ * @param[in] i_rcValue Error value to set
+ */
+ void _setHwpError(const HwpReturnCode i_rcValue);
/**
* @brief Get a pointer to any PlatData. ReturnCode is still responsible for
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodes.H b/src/include/usr/hwpf/fapi/fapiReturnCodes.H
index 2f0592f27..011b8e814 100644
--- a/src/include/usr/hwpf/fapi/fapiReturnCodes.H
+++ b/src/include/usr/hwpf/fapi/fapiReturnCodes.H
@@ -38,6 +38,7 @@
* mjjones 10/07/2011 Add FAPI_RC_INVALID_ATTR_GET
* mjjones 10/28/2011 Trim FAPI/PLAT errors
* mjjones 11/10/2011 Use ecmdDataBufferBase
+ * mjjones 01/13/2012 Name enumeration
*/
#ifndef FAPIRETURNCODES_H_
@@ -50,8 +51,11 @@ namespace fapi
/**
* @brief Enumeration of return codes
+ *
+ * @note HWP return codes are in the HwpReturnCode enumeration in the
+ * generated fapiHwpReturnCodes.H file
*/
-enum
+enum ReturnCodes
{
FAPI_RC_SUCCESS = 0,
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