提交 bced7cce 编写于 作者: K Kumar Gala 提交者: Wolfgang Denk

ppc: Fix roll over bug in flush_cache()

If we call flush_cache(0xfffff000, 0x1000) it would never
terminate the loop since end = 0xffffffff and we'd roll over
our counter from 0xfffffe0 to 0 (assuming a 32-byte cache line)
Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
上级 87c90639
......@@ -33,14 +33,16 @@ void flush_cache(ulong start_addr, ulong size)
start = start_addr & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
end = start_addr + size - 1;
for (addr = start; addr <= end; addr += CONFIG_SYS_CACHELINE_SIZE) {
for (addr = start; (addr <= end) && (addr >= start);
addr += CONFIG_SYS_CACHELINE_SIZE) {
asm volatile("dcbst 0,%0" : : "r" (addr) : "memory");
WATCHDOG_RESET();
}
/* wait for all dcbst to complete on bus */
asm volatile("sync" : : : "memory");
for (addr = start; addr <= end; addr += CONFIG_SYS_CACHELINE_SIZE) {
for (addr = start; (addr <= end) && (addr >= start);
addr += CONFIG_SYS_CACHELINE_SIZE) {
asm volatile("icbi 0,%0" : : "r" (addr) : "memory");
WATCHDOG_RESET();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册