in your version of the function the iterated cache ops second argument was start_addr which stay constant.<br><br>the second bug is that it doesn't iterate over the entire range:<br>for example:<br>if size is 42 and the cache line size is 32 - it takes two cache lines to cache this buffer<br>
your version will iterate only over one cache line<br>my version will iterate over two cache line covering the entire range<br><br>eyalb<br><br><div class="gmail_quote">On Tue, May 13, 2008 at 4:19 PM, Shinya Kuribayashi <<a href="mailto:skuribay@ruby.dti.ne.jp">skuribay@ruby.dti.ne.jp</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">Eyal Bari wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
hi,<br>
<br>
i found two bugs in your flush_cache routine:<br>
* it was only flushing the first cacheline in the range<br>
* the loop was running one cacheline short<br>
<br>
the fixed version:<br>
void flush_cache(ulong start_addr, ulong size)<br>
{<br>
unsigned long lsize = CFG_CACHELINE_SIZE;<br>
unsigned long addr = start_addr & ~(lsize - 1);<br>
unsigned long aend = (start_addr + size - 1 + lsize) & ~(lsize - 1);<br>
<br>
while (1) {<br>
cache_op(Hit_Writeback_Inv_D, addr);<br>
cache_op(Hit_Invalidate_I, addr);<br>
if (addr == aend)<br>
break;<br>
addr += lsize;<br>
}<br>
}<br>
<br>
eyalb<br>
</blockquote>
<br></div></div>
Really? I don't think so.<br>
<br>
See Linux's include/asm-mips/r4kcache.h#413. This is the original.<br>
<br>
<a href="http://git.kernel.org/?p=linux/kernel/git/ralf/linux.git;a=blob;f=include/asm-mips/r4kcache.h;h=4c140db3678655975d2dde877d898a5f9861ad6e;hb=HEAD#l413" target="_blank">http://git.kernel.org/?p=linux/kernel/git/ralf/linux.git;a=blob;f=include/asm-mips/r4kcache.h;h=4c140db3678655975d2dde877d898a5f9861ad6e;hb=HEAD#l413</a><br>
<font color="#888888">
<br>
Shinya<br>
</font><br>
P.S. If you don't mind, please add Cc: u-boot-users when replying.<br>
<br>
</blockquote></div><br>