mirror of
https://github.com/apache/nuttx.git
synced 2026-08-13 16:35:21 +00:00
SAM3/4 CMCC: if region to be invalidate is bigger than that cache, then invalidate all
This commit is contained in:
parent
316bc83220
commit
aefe9637c7
1 changed files with 19 additions and 3 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue