mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 10:46:02 +08:00
SAM3/4 CMCC: if region to be invalidate is bigger than that cache, then invalidate all
This commit is contained in:
@@ -146,8 +146,27 @@ void sam_cmcc_invalidate(uintptr_t start, uintptr_t end)
|
|||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
uint32_t way
|
uint32_t way
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
size_t size;
|
||||||
int nlines;
|
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
|
/* "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
|
* the valid bit information of the decoded cache line. As the line is no
|
||||||
* longer valid the replacement counter points to that line.
|
* 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 */
|
/* Invalidate the address region */
|
||||||
|
|
||||||
start = ALIGN_DOWN(start);
|
|
||||||
end = ALIGN_up(end);
|
|
||||||
|
|
||||||
index = (start >> CMCC_SHIFT)
|
index = (start >> CMCC_SHIFT)
|
||||||
nlines = ((end - start) >> CMCC_SHIFT);
|
nlines = ((end - start) >> CMCC_SHIFT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user