]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MTHCA] Better implementation of doorbells on 64 bit systems.
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 7 Feb 2007 12:11:24 +0000 (12:11 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 7 Feb 2007 12:11:24 +0000 (12:11 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@580 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/hw/mthca/kernel/mthca_doorbell.h
trunk/hw/mthca/user/mlnx_uvp_doorbell.h

index e848b366c9eec3856c09d29f51a8c2e66e1ff35a..c873c9c940f0bf9eb4590eba05fd2bbcccaee876 100644 (file)
@@ -38,13 +38,15 @@ enum {
        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)
@@ -57,12 +59,13 @@ static inline void mthca_write64_raw(__be64 val, void __iomem *dest)
 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
index 95458e909734502dff070c7546a127f5c91c1345..7928eceb9e3575d76218831bc1bdd77601c1f4a2 100644 (file)
 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)