summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/bus_dma.h
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-05-18 00:06:10 +0000
committermsmith <msmith@FreeBSD.org>2000-05-18 00:06:10 +0000
commit41be5442139f940f014097e22e95af0423774eda (patch)
tree814a6dc5b3a7bf9abd3011bb8b4c5f80fffcfd09 /sys/i386/include/bus_dma.h
parentbb8be094ccc5099dd44f47b1fea2f30ff5eaa02f (diff)
downloadFreeBSD-src-41be5442139f940f014097e22e95af0423774eda.zip
FreeBSD-src-41be5442139f940f014097e22e95af0423774eda.tar.gz
Implement real read/write barriers for the i386. Despite the comment in
previous versions of this file, some barrier functionality is required.
Diffstat (limited to 'sys/i386/include/bus_dma.h')
-rw-r--r--sys/i386/include/bus_dma.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/i386/include/bus_dma.h b/sys/i386/include/bus_dma.h
index 2dc6ecb..601e2b4 100644
--- a/sys/i386/include/bus_dma.h
+++ b/sys/i386/include/bus_dma.h
@@ -1134,14 +1134,25 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1,
* void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
* bus_size_t offset, bus_size_t len, int flags);
*
- * Note: the i386 does not currently require barriers, but we must
- * provide the flags to MI code.
+ *
+ * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than
+ * prevent reordering by the compiler; all Intel x86 processors currently
+ * retire operations outside the CPU in program order.
*/
-#define bus_space_barrier(t, h, o, l, f) \
- ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
+static __inline void
+bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, bus_size_t len, int flags)
+{
+ if (flags & BUS_SPACE_BARRIER_READ)
+ __asm __volatile ("lock; addl $0,0(%esp)" : : : "memory");
+ else
+ __asm __volatile ("" : : : "memory");
+}
+
+
/*
* Flags used in various bus DMA methods.
*/
OpenPOWER on IntegriCloud