ref: fdfd856d1d2ba158f25a18706571616aad472877
parent: 6fb9ae8f4356f6b17f15894491d6339245dcd8ec
author: cinap_lenrek <[email protected]>
date: Sat Sep 5 06:36:53 EDT 2015
zynq: clean cache unconditionally *before* dma, invalidate cache *after* dma for read case processor might bring data speculatively into the cache, before the dma completes.
--- a/sys/src/9/zynq/emmc.c
+++ b/sys/src/9/zynq/emmc.c
@@ -339,7 +339,7 @@
}
static void
-emmciosetup(int write, void *buf, int bsize, int bcount)
+emmciosetup(int, void *buf, int bsize, int bcount)
{
u32int *r;
uintptr pa;
@@ -350,15 +350,8 @@
error(Etoobig);
pa = PADDR(buf);
- if(write){
- /* flush cache before write */
- cleandse((uchar*)buf, (uchar*)buf+len);
- clean2pa(pa, pa+len);
- } else {
- /* invalidate cache before read */
- invaldse((uchar*)buf, (uchar*)buf+len);
- inval2pa(pa, pa+len);
- }
+ cleandse((uchar*)buf, (uchar*)buf+len);
+ clean2pa(pa, pa+len);
r = emmc.regs;
r[Sysaddr] = pa;
@@ -367,7 +360,7 @@
}
static void
-emmcio(int write, uchar *, int)
+emmcio(int write, uchar *buf, int len)
{
u32int *r;
int i;
@@ -392,6 +385,12 @@
}
if(i)
r[Interrupt] = i;
+
+ if(!write){
+ uintptr pa = PADDR(buf);
+ invaldse((uchar*)buf, (uchar*)buf+len);
+ inval2pa(pa, pa+len);
+ }
}
SDio sdio = {