MTHCA_SEND_DOORBELL_FENCE = 1 << 5
};
-#if BITS_PER_LONG == 64
+#ifdef _WIN64
/*
* Assume that we can just write a 64-bit doorbell atomically. s390
* actually doesn't have writeq() but S/390 systems don't even have
* PCI so we won't worry about it.
*/
+
+
#define MTHCA_DECLARE_DOORBELL_LOCK(name)
#define MTHCA_INIT_DOORBELL_LOCK(ptr) do { } while (0)
#define MTHCA_GET_DOORBELL_LOCK(ptr) (NULL)
static inline void mthca_write64(__be32 val[2], void __iomem *dest,
spinlock_t *doorbell_lock)
{
- __raw_writeq(*(u64 *) val, dest);
+ UNUSED_PARAM(doorbell_lock);
+ *(volatile u64 *)dest = *(volatile u64 *)val;
}
static inline void mthca_write_db_rec(__be32 val[2], __be32 *db)
{
- *(u64 *) db = *(u64 *) val;
+ *(volatile u64 *) db = *(volatile u64 *) val;
}
#else
enum {
MTHCA_SEND_DOORBELL_FENCE = 1 << 5
};
-
-#if defined (_WIN64)
-
-
-#ifdef __WRITE_QWORD_ATOMIC__
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define MTHCA_PAIR_TO_64(val) ((uint64_t) val[1] << 32 | val[0])
-#elif __BYTE_ORDER == __BIG_ENDIAN
-# define MTHCA_PAIR_TO_64(val) ((uint64_t) val[0] << 32 | val[1])
-#else
-# error __BYTE_ORDER not defined
-#endif
+#if defined _WIN64
static inline void mthca_write64(uint32_t val[2], struct mthca_context *ctx, int offset)
{
- *(volatile uint64_t *) (ctx->uar + offset) = MTHCA_PAIR_TO_64(val);
+ *(volatile uint64_t *) ((char *)ctx->uar + offset) = *(volatile uint64_t*)val;
}
static inline void mthca_write_db_rec(uint32_t val[2], uint32_t *db)
{
- *(volatile uint64_t *) db = MTHCA_PAIR_TO_64(val);
+ *(volatile uint64_t *) db = *(volatile uint64_t*)val;
}
-#else
-
-static inline void mthca_write64(uint32_t val[2], struct mthca_context *ctx, int offset)
-{
- cl_spinlock_acquire(&ctx->uar_lock);
- *(volatile uint32_t *) ((uint8_t*)ctx->uar + offset) = val[0];
- *(volatile uint32_t *) ((uint8_t*)ctx->uar + offset + 4) = val[1];
- cl_spinlock_release(&ctx->uar_lock);
-}
-
-static inline void mthca_write_db_rec(uint32_t val[2], uint32_t *db)
-{
- *(volatile uint32_t *) db = val[0];
- mb();
- *(volatile uint32_t *) (db + 1) = val[1];
-}
-
-#endif
#elif defined(_WIN32)