|
@@ -13,17 +13,9 @@
|
|
#include <linux/rio.h>
|
|
#include <linux/rio.h>
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
|
|
|
|
-/*
|
|
|
|
- * These interrupt-safe spinlocks protect all accesses to RIO
|
|
|
|
- * configuration space and doorbell access.
|
|
|
|
- */
|
|
|
|
-static DEFINE_SPINLOCK(rio_config_lock);
|
|
|
|
-static DEFINE_SPINLOCK(rio_doorbell_lock);
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Wrappers for all RIO configuration access functions. They just check
|
|
* Wrappers for all RIO configuration access functions. They just check
|
|
- * alignment, do locking and call the low-level functions pointed to
|
|
|
|
- * by rio_mport->ops.
|
|
|
|
|
|
+ * alignment and call the low-level functions pointed to by rio_mport->ops.
|
|
*/
|
|
*/
|
|
|
|
|
|
#define RIO_8_BAD 0
|
|
#define RIO_8_BAD 0
|
|
@@ -44,13 +36,10 @@ int __rio_local_read_config_##size \
|
|
(struct rio_mport *mport, u32 offset, type *value) \
|
|
(struct rio_mport *mport, u32 offset, type *value) \
|
|
{ \
|
|
{ \
|
|
int res; \
|
|
int res; \
|
|
- unsigned long flags; \
|
|
|
|
u32 data = 0; \
|
|
u32 data = 0; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
- spin_lock_irqsave(&rio_config_lock, flags); \
|
|
|
|
res = mport->ops->lcread(mport, mport->id, offset, len, &data); \
|
|
res = mport->ops->lcread(mport, mport->id, offset, len, &data); \
|
|
*value = (type)data; \
|
|
*value = (type)data; \
|
|
- spin_unlock_irqrestore(&rio_config_lock, flags); \
|
|
|
|
return res; \
|
|
return res; \
|
|
}
|
|
}
|
|
|
|
|
|
@@ -67,13 +56,8 @@ int __rio_local_read_config_##size \
|
|
int __rio_local_write_config_##size \
|
|
int __rio_local_write_config_##size \
|
|
(struct rio_mport *mport, u32 offset, type value) \
|
|
(struct rio_mport *mport, u32 offset, type value) \
|
|
{ \
|
|
{ \
|
|
- int res; \
|
|
|
|
- unsigned long flags; \
|
|
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
- spin_lock_irqsave(&rio_config_lock, flags); \
|
|
|
|
- res = mport->ops->lcwrite(mport, mport->id, offset, len, value);\
|
|
|
|
- spin_unlock_irqrestore(&rio_config_lock, flags); \
|
|
|
|
- return res; \
|
|
|
|
|
|
+ return mport->ops->lcwrite(mport, mport->id, offset, len, value);\
|
|
}
|
|
}
|
|
|
|
|
|
RIO_LOP_READ(8, u8, 1)
|
|
RIO_LOP_READ(8, u8, 1)
|
|
@@ -104,13 +88,10 @@ int rio_mport_read_config_##size \
|
|
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type *value) \
|
|
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type *value) \
|
|
{ \
|
|
{ \
|
|
int res; \
|
|
int res; \
|
|
- unsigned long flags; \
|
|
|
|
u32 data = 0; \
|
|
u32 data = 0; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
- spin_lock_irqsave(&rio_config_lock, flags); \
|
|
|
|
res = mport->ops->cread(mport, mport->id, destid, hopcount, offset, len, &data); \
|
|
res = mport->ops->cread(mport, mport->id, destid, hopcount, offset, len, &data); \
|
|
*value = (type)data; \
|
|
*value = (type)data; \
|
|
- spin_unlock_irqrestore(&rio_config_lock, flags); \
|
|
|
|
return res; \
|
|
return res; \
|
|
}
|
|
}
|
|
|
|
|
|
@@ -127,13 +108,9 @@ int rio_mport_read_config_##size \
|
|
int rio_mport_write_config_##size \
|
|
int rio_mport_write_config_##size \
|
|
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type value) \
|
|
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type value) \
|
|
{ \
|
|
{ \
|
|
- int res; \
|
|
|
|
- unsigned long flags; \
|
|
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
|
|
- spin_lock_irqsave(&rio_config_lock, flags); \
|
|
|
|
- res = mport->ops->cwrite(mport, mport->id, destid, hopcount, offset, len, value); \
|
|
|
|
- spin_unlock_irqrestore(&rio_config_lock, flags); \
|
|
|
|
- return res; \
|
|
|
|
|
|
+ return mport->ops->cwrite(mport, mport->id, destid, hopcount, \
|
|
|
|
+ offset, len, value); \
|
|
}
|
|
}
|
|
|
|
|
|
RIO_OP_READ(8, u8, 1)
|
|
RIO_OP_READ(8, u8, 1)
|
|
@@ -162,14 +139,7 @@ EXPORT_SYMBOL_GPL(rio_mport_write_config_32);
|
|
*/
|
|
*/
|
|
int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, u16 data)
|
|
int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, u16 data)
|
|
{
|
|
{
|
|
- int res;
|
|
|
|
- unsigned long flags;
|
|
|
|
-
|
|
|
|
- spin_lock_irqsave(&rio_doorbell_lock, flags);
|
|
|
|
- res = mport->ops->dsend(mport, mport->id, destid, data);
|
|
|
|
- spin_unlock_irqrestore(&rio_doorbell_lock, flags);
|
|
|
|
-
|
|
|
|
- return res;
|
|
|
|
|
|
+ return mport->ops->dsend(mport, mport->id, destid, data);
|
|
}
|
|
}
|
|
|
|
|
|
EXPORT_SYMBOL_GPL(rio_mport_send_doorbell);
|
|
EXPORT_SYMBOL_GPL(rio_mport_send_doorbell);
|