Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Sep 2005 13:24:13 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        alpha@FreeBSD.org
Subject:   [PATCH] Add membar to bus dma PREWRITE operations
Message-ID:  <200509021324.13391.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
The patch below adds a memory barrier to bus_dma PREWRITE operations to ensure 
that writes by the CPU to populate a buffer before it is read via DMA by a 
device will be completed before later writes by the CPU (later as in program 
order) to trigger the DMA.  Please test!  Patch should apply to 5.x and 
later.  Thanks.

--- //depot/vendor/freebsd/src/sys/alpha/alpha/busdma_machdep.c	2005/05/25 
07:26:16
+++ //depot/user/jhb/acpipci/alpha/alpha/busdma_machdep.c	2005/08/18 17:55:22
@@ -891,6 +891,10 @@
 			}
 		}
 	}
+
+	/* Ensure any pending writes have drained. */
+	if (op & (BUS_DMASYNC_PREWRITE))
+		alpha_mb();
 }
 
 static void

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509021324.13391.jhb>