Properly mark the cache as clean after its written

This reduces the number of scans, but I doubt it noticeably improves
performance.
This commit is contained in:
Tim Newsome 2016-08-26 14:47:31 -07:00
parent 243233c8b8
commit c68b13ed67
1 changed files with 3 additions and 3 deletions

View File

@ -504,9 +504,10 @@ static void cache_set32(struct target *target, unsigned int index, uint32_t data
if (info->dram_cache[index].valid && if (info->dram_cache[index].valid &&
info->dram_cache[index].data == data) { info->dram_cache[index].data == data) {
// This is already preset on the target. // This is already preset on the target.
LOG_DEBUG("Cache hit at 0x%x for data 0x%x", index, data); LOG_DEBUG("cache[0x%x] = 0x%x (hit)", index, data);
return; return;
} }
LOG_DEBUG("cache[0x%x] = 0x%x", index, data);
info->dram_cache[index].data = data; info->dram_cache[index].data = data;
info->dram_cache[index].valid = true; info->dram_cache[index].valid = true;
info->dram_cache[index].dirty = true; info->dram_cache[index].dirty = true;
@ -568,9 +569,8 @@ static void cache_clean(struct target *target)
for (unsigned int i = 0; i < DRAM_CACHE_SIZE; i++) { for (unsigned int i = 0; i < DRAM_CACHE_SIZE; i++) {
if (i >= 4) { if (i >= 4) {
info->dram_cache[i].valid = false; info->dram_cache[i].valid = false;
} else {
info->dram_cache[i].dirty = false;
} }
info->dram_cache[i].dirty = false;
} }
} }