summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-08-16 08:01:12 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-08-16 09:40:45 -0500
commitcf617e3b919c87d2c8e382191d29b5e4bdb4cbf6 (patch)
tree1656b1e906f4a31b8175c47f139c44a8d44023d5 /src/include
parent97c63f858a9119e2f20bb132a486bfd042746c5d (diff)
downloadtalos-hostboot-cf617e3b919c87d2c8e382191d29b5e4bdb4cbf6.tar.gz
talos-hostboot-cf617e3b919c87d2c8e382191d29b5e4bdb4cbf6.zip
Allow multiple driver registrations of the same function.
Change-Id: I5fd9c222df4168ad6ae4f64307dd5e260141fa32 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/259 Tested-by: Jenkins Server Reviewed-by: Terry J. Opie <opiet@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/devicefw/driverif.H64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/include/usr/devicefw/driverif.H b/src/include/usr/devicefw/driverif.H
index 3f8759981..64bf466b0 100644
--- a/src/include/usr/devicefw/driverif.H
+++ b/src/include/usr/devicefw/driverif.H
@@ -39,7 +39,7 @@ namespace DeviceFW
LAST_OP_TYPE
};
-
+
/** @enum DriverSpecial
* @brief Special Wildcard enum that can be used for drivers to do
* routing registrations.
@@ -48,7 +48,7 @@ namespace DeviceFW
{
WILDCARD = -1,
};
-
+
/** Construct the device addressing parameters for XSCOM device ops.
* @param[in] i_address - XSCom address to operate on.
*/
@@ -62,7 +62,7 @@ namespace DeviceFW
DeviceFW::I2C, static_cast<uint64_t>(( i_address ))
- /** @class InvalidParameterType
+ /** @class InvalidParameterType
* @brief Unused type to cause compiler fails for invalid template types.
*
* Forward Declaration of type that is never actually used anywhere.
@@ -74,7 +74,7 @@ namespace DeviceFW
* type-safety above a int-parameter.
*/
class InvalidParameterType;
-
+
/** @typedef deviceOp_t
* @brief Function prototype for registered device-driver operations.
*/
@@ -82,7 +82,7 @@ namespace DeviceFW
TARGETING::Target*,
void*, size_t&,
int64_t, va_list);
-
+
/**
* @brief Register a device driver routing function with the framework.
*
@@ -123,21 +123,22 @@ namespace DeviceFW
* referencing a InvalidParameterType class.
*/
template <typename OpType, typename AccType, typename TargType>
- void deviceRegisterRoute(OpType i_opType,
+ void deviceRegisterRoute(OpType i_opType,
AccType i_accessType,
TargType i_targetType,
- deviceOp_t i_regRoute)
- {
+ deviceOp_t i_regRoute)
+ {
return InvalidParameterType(); // Cause a compile fail if not one of
// the explicit template specializations.
}
/** Assistance macro for stringification. */
- #define __DEVICE_REGISTER_ROUTE_XY(X,Y) X##Y
- /** Assistance macro for stringification. */
- #define __DEVICE_REGISTER_ROUTE_MAKENAME(X,Y) __DEVICE_REGISTER_ROUTE_XY(X,Y)
-
- /**
+ #define __DEVICE_REGISTER_ROUTE_XYZ(X,Y,Z) X##Y##Z
+ /** Assistance macro for stringification. */
+ #define __DEVICE_REGISTER_ROUTE_MAKENAME(X,Y,Z) \
+ __DEVICE_REGISTER_ROUTE_XYZ(X,Y,Z)
+
+ /**
* @brief Create a static constructed registration of a device driver
* function when a module is loaded.
*
@@ -145,25 +146,26 @@ namespace DeviceFW
* route function should be passed by name as opposed to pointer.
*
* If the route function is in a namespace, then this definition must
- * also be placed into that namespace.
+ * also be placed into that namespace.
*/
#define DEVICE_REGISTER_ROUTE(i_opType, i_accessType, \
i_targetType, i_regRoute) \
class __DEVICE_REGISTER_ROUTE_MAKENAME(DeviceRouteRegistrator_, \
- i_regRoute) \
+ i_regRoute, __LINE__) \
{ \
public: \
__DEVICE_REGISTER_ROUTE_MAKENAME(DeviceRouteRegistrator_, \
- i_regRoute)() \
+ i_regRoute, __LINE__)() \
{ \
DeviceFW::deviceRegisterRoute(i_opType, i_accessType, \
i_targetType, &i_regRoute); \
} \
}; \
- __DEVICE_REGISTER_ROUTE_MAKENAME(DeviceRouteRegistrator_, i_regRoute) \
+ __DEVICE_REGISTER_ROUTE_MAKENAME(DeviceRouteRegistrator_, \
+ i_regRoute, __LINE__) \
__DEVICE_REGISTER_ROUTE_MAKENAME(DeviceRouteRegistrator_instance_, \
- i_regRoute);
-
+ i_regRoute, __LINE__);
+
/**
* @brief Perform a device operation by routing through the framework and
* calling the appropriate registered operation.
@@ -182,25 +184,25 @@ namespace DeviceFW
errlHndl_t deviceOp(OperationType i_opType,
TARGETING::Target* i_target,
void* io_buffer, size_t& io_buflen,
- AccType i_accessType, ...)
- {
+ AccType i_accessType, ...)
+ {
return InvalidParameterType(); // Cause a compile fail if not one of
// the explicit template specializations.
}
// --- Below are template specializations to aid in type-safety. ---
-
+
// deviceRegisterRoute:
// OpType - OperationType or WILDCARD
// TargType - TargetType or WILDCARD
// AccType - AccessType, AccessType_DriverOnly (no WILDCARD).
- template <>
+ template <>
void deviceRegisterRoute<>(OperationType i_opType,
AccessType i_accessType,
TARGETING::TYPE i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(OperationType i_opType,
AccessType_DriverOnly i_accessType,
TARGETING::TYPE i_targetType,
@@ -210,27 +212,27 @@ namespace DeviceFW
AccessType i_accessType,
DriverSpecial i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(OperationType i_opType,
AccessType_DriverOnly i_accessType,
DriverSpecial i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(DriverSpecial i_opType,
AccessType i_accessType,
TARGETING::TYPE i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(DriverSpecial i_opType,
AccessType_DriverOnly i_accessType,
TARGETING::TYPE i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(DriverSpecial i_opType,
AccessType i_accessType,
DriverSpecial i_targetType,
deviceOp_t i_regRoute);
- template <>
+ template <>
void deviceRegisterRoute<>(DriverSpecial i_opType,
AccessType_DriverOnly i_accessType,
DriverSpecial i_targetType,
@@ -240,12 +242,12 @@ namespace DeviceFW
// OpType - OperationType only.
// TargType - TargetType only.
// AccType - AccessType, AccessType_DriverOnly (no WILDCARD).
- template <>
+ template <>
errlHndl_t deviceOp<>(OperationType i_opType,
TARGETING::Target* i_target,
void* io_buffer, size_t& io_buflen,
AccessType i_accessType, ...);
- template <>
+ template <>
errlHndl_t deviceOp<>(OperationType i_opType,
TARGETING::Target* i_target,
void* io_buffer, size_t& io_buflen,
OpenPOWER on IntegriCloud