summaryrefslogtreecommitdiffstats
path: root/src/usr/devicefw
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-05-24 21:18:35 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-06-02 15:14:28 -0500
commit74b9b31c9ae811dd527d4eb328e9fa93327442ab (patch)
tree848b6ad8a46f8a5a8065f80fcaddf07d061b3be2 /src/usr/devicefw
parentf0e44bc60ca80d5bf875f0836a119e361d84dd44 (diff)
downloadtalos-hostboot-74b9b31c9ae811dd527d4eb328e9fa93327442ab.tar.gz
talos-hostboot-74b9b31c9ae811dd527d4eb328e9fa93327442ab.zip
Errl support for device framework.
Change-Id: I7849df2994312c6e91d9f86431c2d084c26b21cf Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/99 Tested-by: Jenkins Server Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Diffstat (limited to 'src/usr/devicefw')
-rw-r--r--src/usr/devicefw/associator.C57
-rw-r--r--src/usr/devicefw/associator.H8
-rw-r--r--src/usr/devicefw/driverif.C20
-rw-r--r--src/usr/devicefw/test/associatortest.H60
-rw-r--r--src/usr/devicefw/userif.C16
5 files changed, 115 insertions, 46 deletions
diff --git a/src/usr/devicefw/associator.C b/src/usr/devicefw/associator.C
index 95c8ef7a0..d076c311e 100644
--- a/src/usr/devicefw/associator.C
+++ b/src/usr/devicefw/associator.C
@@ -1,7 +1,12 @@
#include <algorithm>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <trace/interface.H>
+
+#include <devicefw/devfwreasoncodes.H>
#include "associator.H"
-#include <trace/interface.H>
+using namespace ERRORLOG;
namespace DeviceFW
{
@@ -71,9 +76,24 @@ namespace DeviceFW
if(((targets.flag) && (i_targetType != WILDCARD)) ||
((!targets.flag) && (i_targetType == WILDCARD)))
{
- // TODO: Create error log for invalid target type?
- bool l_invalidTargetType = false;
- assert(l_invalidTargetType);
+ /*@
+ * @errortype
+ * @moduleid DEVFW_MOD_ASSOCIATOR
+ * @reasoncode DEVFW_RC_INVALID_REGISTRATION
+ * @userdata1 (OpType << 32) | (AccessType)
+ * @userdata2 TargetType
+ *
+ * @devdesc An invalid registration type was given to
+ * register a device with the routing framework.
+ */
+ errlHndl_t l_errl =
+ new ErrlEntry(ERRL_SEV_INFORMATIONAL,
+ DEVFW_MOD_ASSOCIATOR,
+ DEVFW_RC_INVALID_REGISTRATION,
+ TWO_UINT32_TO_UINT64(i_opType, i_accType),
+ TO_UINT64(i_targetType)
+ );
+ errlCommit(l_errl);
}
// Index offset to proper target type. This is now lowest level of map.
@@ -101,10 +121,10 @@ namespace DeviceFW
mutex_unlock(iv_mutex);
}
- ErrorHandle_t Associator::performOp(OperationType i_opType,
- TargetHandle_t i_target,
- void* io_buffer, size_t& io_buflen,
- int64_t i_accessType, va_list i_addr)
+ errlHndl_t Associator::performOp(OperationType i_opType,
+ TargetHandle_t i_target,
+ void* io_buffer, size_t& io_buflen,
+ int64_t i_accessType, va_list i_addr)
const
{
TRACDCOMP(g_traceBuffer, "Device op requested for (%d, %d, %d)",
@@ -114,7 +134,7 @@ namespace DeviceFW
// compiler due to the template specializations in driverif.H.
// No assert-checks will be done here.
- ErrorHandle_t l_errl = NULL;
+ errlHndl_t l_errl = NULL;
mutex_lock(iv_mutex);
@@ -188,8 +208,23 @@ namespace DeviceFW
// Call function if one was found, create error otherwise.
if (NULL == l_devRoute)
{
- // TODO: create error log.
- assert(NULL != l_devRoute);
+ /*@
+ * @errortype
+ * @moduleid DEVFW_MOD_ASSOCIATOR
+ * @reasoncode DEVFW_RC_NO_ROUTE_FOUND
+ * @userdata1 (OpType << 32) | (AccessType)
+ * @userdata1 TargetType
+ *
+ * @devdesc A device driver operation was attempted for
+ * which no driver has been registered.
+ */
+ l_errl = new ErrlEntry(ERRL_SEV_INFORMATIONAL,
+ DEVFW_MOD_ASSOCIATOR,
+ DEVFW_RC_NO_ROUTE_FOUND,
+ TWO_UINT32_TO_UINT64(i_opType, i_accessType),
+ /*TODO: i_target->type*/
+ TO_UINT64(PROCESSOR)
+ );
}
else
{
diff --git a/src/usr/devicefw/associator.H b/src/usr/devicefw/associator.H
index 67b35e31b..2052781b7 100644
--- a/src/usr/devicefw/associator.H
+++ b/src/usr/devicefw/associator.H
@@ -50,10 +50,10 @@ namespace DeviceFW
deviceOp_t i_regRoute);
/** Perform routing. See deviceOp. */
- ErrorHandle_t performOp(OperationType i_opType,
- TargetHandle_t i_target,
- void* io_buffer, size_t& io_buflen,
- int64_t i_accessType, va_list i_addr) const;
+ errlHndl_t performOp(OperationType i_opType,
+ TargetHandle_t i_target,
+ void* io_buffer, size_t& io_buflen,
+ int64_t i_accessType, va_list i_addr) const;
private:
typedef std::vector<deviceOp_t> opVector_t;
diff --git a/src/usr/devicefw/driverif.C b/src/usr/devicefw/driverif.C
index f6a2b9321..f6109ffea 100644
--- a/src/usr/devicefw/driverif.C
+++ b/src/usr/devicefw/driverif.C
@@ -117,13 +117,13 @@ namespace DeviceFW
// TargType - TargetType only.
// AccType - AccessType, AccessType_DriverOnly (no WILDCARD).
template <>
- ErrorHandle_t deviceOp<>(OperationType i_opType,
- TargetHandle_t i_target,
- void* io_buffer, size_t& io_buflen,
- AccessType i_accessType, ...)
+ errlHndl_t deviceOp<>(OperationType i_opType,
+ TargetHandle_t i_target,
+ void* io_buffer, size_t& io_buflen,
+ AccessType i_accessType, ...)
{
va_list args;
- ErrorHandle_t errl;
+ errlHndl_t errl;
va_start(args, i_accessType);
@@ -136,13 +136,13 @@ namespace DeviceFW
}
template <>
- ErrorHandle_t deviceOp<>(OperationType i_opType,
- TargetHandle_t i_target,
- void* io_buffer, size_t& io_buflen,
- AccessType_DriverOnly i_accessType, ...)
+ errlHndl_t deviceOp<>(OperationType i_opType,
+ TargetHandle_t i_target,
+ void* io_buffer, size_t& io_buflen,
+ AccessType_DriverOnly i_accessType, ...)
{
va_list args;
- ErrorHandle_t errl;
+ errlHndl_t errl;
va_start(args, i_accessType);
diff --git a/src/usr/devicefw/test/associatortest.H b/src/usr/devicefw/test/associatortest.H
index 792b6c3ef..3d7aa6a32 100644
--- a/src/usr/devicefw/test/associatortest.H
+++ b/src/usr/devicefw/test/associatortest.H
@@ -2,6 +2,8 @@
#define __TEST_ASSOCIATORTEST_H
#include <cxxtest/TestSuite.H>
+#include <errl/errlentry.H>
+#include <devicefw/devfwreasoncodes.H>
#include "../associator.H"
using namespace DeviceFW;
@@ -33,10 +35,10 @@ public:
// Used for registration testing.
static
- ErrorHandle_t performOperation(OperationType i_opType,
- TargetHandle_t i_target,
- void* io_buffer, size_t& io_buflen,
- int64_t i_accessType, va_list i_addr)
+ errlHndl_t performOperation(OperationType i_opType,
+ TargetHandle_t i_target,
+ void* io_buffer, size_t& io_buflen,
+ int64_t i_accessType, va_list i_addr)
{
g_associatorTest_result = g_associatorTest_value;
g_associatorTest_opType = i_opType;
@@ -61,9 +63,9 @@ public:
PROCESSOR,
&performOperation);
- ErrorHandle_t l_errl = as.performOp(READ, TargetHandle_t(),
- buf, bufsize,
- SCOM, va_list());
+ errlHndl_t l_errl = as.performOp(READ, TargetHandle_t(),
+ buf, bufsize,
+ SCOM, va_list());
if (l_errl)
{
@@ -102,9 +104,9 @@ public:
PROCESSOR,
&performOperation);
- ErrorHandle_t l_errl = as.performOp(WRITE, TargetHandle_t(),
- buf, bufsize,
- SCOM, va_list());
+ errlHndl_t l_errl = as.performOp(WRITE, TargetHandle_t(),
+ buf, bufsize,
+ SCOM, va_list());
if (l_errl)
{
@@ -143,9 +145,9 @@ public:
WILDCARD,
&performOperation);
- ErrorHandle_t l_errl = as.performOp(READ, TargetHandle_t(),
- buf, bufsize,
- SCOM, va_list());
+ errlHndl_t l_errl = as.performOp(READ, TargetHandle_t(),
+ buf, bufsize,
+ SCOM, va_list());
if (l_errl)
{
@@ -168,6 +170,38 @@ public:
}
}
+
+ /**
+ * @test Verify missing registration returns an error log.
+ */
+ void testMissingRegistration()
+ {
+ void* buf = NULL;
+ size_t bufsize = 0;
+
+ g_associatorTest_value = &AssociatorTest::testMissingRegistration;
+
+ Associator as;
+ as.registerRoute(READ,
+ SCOM,
+ WILDCARD,
+ &performOperation);
+
+ errlHndl_t l_errl = as.performOp(READ, TargetHandle_t(),
+ buf, bufsize,
+ MAILBOX, va_list());
+
+ if (NULL == l_errl)
+ {
+ TS_FAIL("Error not received from performOp.");
+ }
+ else if (DEVFW_RC_NO_ROUTE_FOUND != l_errl->reasonCode())
+ {
+ TS_FAIL("Reason code different from DEVFW_RC_NO_ROUTE_FOUND.");
+ }
+ }
+
+
};
#endif
diff --git a/src/usr/devicefw/userif.C b/src/usr/devicefw/userif.C
index 3b1f237f8..248077358 100644
--- a/src/usr/devicefw/userif.C
+++ b/src/usr/devicefw/userif.C
@@ -9,12 +9,12 @@
namespace DeviceFW
{
- ErrorHandle_t deviceRead(TargetHandle_t i_target,
- void* o_buffer, size_t& io_buflen,
- AccessType i_accessType, ...)
+ errlHndl_t deviceRead(TargetHandle_t i_target,
+ void* o_buffer, size_t& io_buflen,
+ AccessType i_accessType, ...)
{
va_list args;
- ErrorHandle_t errl;
+ errlHndl_t errl;
va_start(args, i_accessType);
@@ -26,12 +26,12 @@ namespace DeviceFW
return errl;
}
- ErrorHandle_t deviceWrite(TargetHandle_t i_target,
- void* i_buffer, size_t& io_buflen,
- AccessType i_accessType, ...)
+ errlHndl_t deviceWrite(TargetHandle_t i_target,
+ void* i_buffer, size_t& io_buflen,
+ AccessType i_accessType, ...)
{
va_list args;
- ErrorHandle_t errl;
+ errlHndl_t errl;
va_start(args, i_accessType);
OpenPOWER on IntegriCloud