]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
cxgbe(4): Retire t4_bus_space_read_8 and t4_bus_space_write_8.
authornp <np@FreeBSD.org>
Tue, 13 Dec 2016 20:35:57 +0000 (20:35 +0000)
committernp <np@FreeBSD.org>
Tue, 13 Dec 2016 20:35:57 +0000 (20:35 +0000)
MFC after: 3 days
Sponsored by: Chelsio Communications

sys/dev/cxgbe/adapter.h

index 1666bc781ddf41adda8e8250c8b90852e69eb8b4..29af300d39387a3fa2ca424a6487617fe847a61c 100644 (file)
@@ -84,45 +84,6 @@ prefetch(void *x)
 #define SBUF_DRAIN 1
 #endif
 
-#ifdef __amd64__
-/* XXX: need systemwide bus_space_read_8/bus_space_write_8 */
-static __inline uint64_t
-t4_bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle,
-    bus_size_t offset)
-{
-       KASSERT(tag == X86_BUS_SPACE_MEM,
-           ("%s: can only handle mem space", __func__));
-
-       return (*(volatile uint64_t *)(handle + offset));
-}
-
-static __inline void
-t4_bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh,
-    bus_size_t offset, uint64_t value)
-{
-       KASSERT(tag == X86_BUS_SPACE_MEM,
-           ("%s: can only handle mem space", __func__));
-
-       *(volatile uint64_t *)(bsh + offset) = value;
-}
-#else
-static __inline uint64_t
-t4_bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle,
-    bus_size_t offset)
-{
-       return (uint64_t)bus_space_read_4(tag, handle, offset) +
-           ((uint64_t)bus_space_read_4(tag, handle, offset + 4) << 32);
-}
-
-static __inline void
-t4_bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh,
-    bus_size_t offset, uint64_t value)
-{
-       bus_space_write_4(tag, bsh, offset, value);
-       bus_space_write_4(tag, bsh, offset + 4, value >> 32);
-}
-#endif
-
 struct adapter;
 typedef struct adapter adapter_t;
 
@@ -977,14 +938,25 @@ static inline uint64_t
 t4_read_reg64(struct adapter *sc, uint32_t reg)
 {
 
-       return t4_bus_space_read_8(sc->bt, sc->bh, reg);
+#ifdef __LP64__
+       return bus_space_read_8(sc->bt, sc->bh, reg);
+#else
+       return (uint64_t)bus_space_read_4(sc->bt, sc->bh, reg) +
+           ((uint64_t)bus_space_read_4(sc->bt, sc->bh, reg + 4) << 32);
+
+#endif
 }
 
 static inline void
 t4_write_reg64(struct adapter *sc, uint32_t reg, uint64_t val)
 {
 
-       t4_bus_space_write_8(sc->bt, sc->bh, reg, val);
+#ifdef __LP64__
+       bus_space_write_8(sc->bt, sc->bh, reg, val);
+#else
+       bus_space_write_4(sc->bt, sc->bh, reg, val);
+       bus_space_write_4(sc->bt, sc->bh, reg + 4, val>> 32);
+#endif
 }
 
 static inline void