Skip to content
Snippets Groups Projects
Commit aefe9637 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

SAM3/4 CMCC: if region to be invalidate is bigger than that cache, then invalidate all

parent 316bc832
No related branches found
No related tags found
No related merge requests found
......@@ -146,8 +146,27 @@ void sam_cmcc_invalidate(uintptr_t start, uintptr_t end)
uint32_t regval;
uint32_t way
uint32_t index;
size_t size;
int nlines;
/* Get the aligned addresses and size for the memory region to be
* invalidated.
*/
start = ALIGN_DOWN(start);
end = ALIGN_up(end);
size = end - start;
/* If this is a large region (as big as the cache), then just invalidate
* the entire cache the easy way.
*/
if (size >= (CMCC_CACHE_SIZE / CMCC_CACHE_LINE_SIZE / CMCC_NWAYS)
{
sam_cmcc_invalidateall();
return;
}
/* "When an invalidate by line command is issued the cache controller resets
* the valid bit information of the decoded cache line. As the line is no
* longer valid the replacement counter points to that line.
......@@ -170,9 +189,6 @@ void sam_cmcc_invalidate(uintptr_t start, uintptr_t end)
/* Invalidate the address region */
start = ALIGN_DOWN(start);
end = ALIGN_up(end);
index = (start >> CMCC_SHIFT)
nlines = ((end - start) >> CMCC_SHIFT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment