arch: nios2: Add _nios2_dcache_flush_no_writeback() routine
Add _nios2_dcache_flush_no_writeback() routine to invalidate cache contents of address provided. This routine is ported from Altera Nios-II SDK v17. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
parent
9b5fa89547
commit
4073db79d7
2 changed files with 32 additions and 0 deletions
|
@ -60,3 +60,33 @@ void _nios2_dcache_flush_all(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _nios2_dcache_flush_no_writeback() is called to flush the data cache for a
|
||||||
|
* memory region of length "len" bytes, starting at address "start".
|
||||||
|
*
|
||||||
|
* Any dirty lines in the data cache are NOT written back to memory.
|
||||||
|
* Make sure you really want this behavior. If you aren't 100% sure,
|
||||||
|
* use the _nios2_dcache_flush() routine instead.
|
||||||
|
*/
|
||||||
|
#if ALT_CPU_DCACHE_SIZE > 0
|
||||||
|
void _nios2_dcache_flush_no_writeback(void *start, u32_t len)
|
||||||
|
{
|
||||||
|
u8_t *i;
|
||||||
|
u8_t *end = ((char *) start) + len;
|
||||||
|
|
||||||
|
for (i = start; i < end; i += ALT_CPU_DCACHE_LINE_SIZE) {
|
||||||
|
__asm__ volatile ("initda (%0)" :: "r" (i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For an unaligned flush request, we've got one more line left.
|
||||||
|
* Note that this is dependent on ALT_CPU_DCACHE_LINE_SIZE to be a
|
||||||
|
* multiple of 2 (which it always is).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (((u32_t) start) & (ALT_CPU_DCACHE_LINE_SIZE - 1)) {
|
||||||
|
__asm__ volatile ("initda (%0)" :: "r" (i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -60,8 +60,10 @@ void _nios2_icache_flush_all(void);
|
||||||
|
|
||||||
#if ALT_CPU_DCACHE_SIZE > 0
|
#if ALT_CPU_DCACHE_SIZE > 0
|
||||||
void _nios2_dcache_flush_all(void);
|
void _nios2_dcache_flush_all(void);
|
||||||
|
void _nios2_dcache_flush_no_writeback(void *start, u32_t len);
|
||||||
#else
|
#else
|
||||||
#define _nios2_dcache_flush_all() do { } while (0)
|
#define _nios2_dcache_flush_all() do { } while (0)
|
||||||
|
#define _nios2_dcache_flush_no_writeback(x, y) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue