Deleted Added
sdiff udiff text old ( 12729:9870d6f73e04 ) new ( 12730:6c2ea88bf129 )
full compact
1/*
2 * Copyright (c) 2012-2013, 2018 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 99 unchanged lines hidden (view full) ---

108 // queue on every single allocation, whereas the write queue has
109 // as many reserve entries as we have MSHRs, since every MSHR may
110 // eventually require a writeback, and we do not check the write
111 // buffer before committing to an MSHR
112
113 // forward snoops is overridden in init() once we can query
114 // whether the connected master is actually snooping or not
115
116 tempBlock = new CacheBlk();
117 tempBlock->data = new uint8_t[blkSize];
118
119 tags->setCache(this);
120 if (prefetcher)
121 prefetcher->setCache(this);
122}
123
124BaseCache::~BaseCache()

--- 34 unchanged lines hidden (view full) ---

159{
160 DPRINTF(CachePort, "Port is sending retry\n");
161
162 // reset the flag and call retry
163 mustSendRetry = false;
164 sendRetryReq();
165}
166
167void
168BaseCache::init()
169{
170 if (!cpuSidePort.isConnected() || !memSidePort.isConnected())
171 fatal("Cache ports on %s are not connected\n", name());
172 cpuSidePort.sendRangeChange();
173 forwardSnoops = cpuSidePort.isSnooping();
174}

--- 943 unchanged lines hidden (view full) ---

1118 blk = allocate ? allocateBlock(addr, is_secure, writebacks) : nullptr;
1119
1120 if (!blk) {
1121 // No replaceable block or a mostly exclusive
1122 // cache... just use temporary storage to complete the
1123 // current request and then get rid of it
1124 assert(!tempBlock->isValid());
1125 blk = tempBlock;
1126 tempBlock->set = tags->extractSet(addr);
1127 tempBlock->tag = tags->extractTag(addr);
1128 DPRINTF(Cache, "using temp block for %#llx (%s)\n", addr,
1129 is_secure ? "s" : "ns");
1130 } else {
1131 tags->insertBlock(pkt, blk);
1132 }
1133
1134 // we should never be overwriting a valid block
1135 assert(!blk->isValid());

--- 66 unchanged lines hidden (view full) ---

1202 // Find replacement victim
1203 CacheBlk *blk = tags->findVictim(addr);
1204
1205 // It is valid to return nullptr if there is no victim
1206 if (!blk)
1207 return nullptr;
1208
1209 if (blk->isValid()) {
1210 Addr repl_addr = tags->regenerateBlkAddr(blk);
1211 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
1212 if (repl_mshr) {
1213 // must be an outstanding upgrade or clean request
1214 // on a block we're about to replace...
1215 assert((!blk->isWritable() && repl_mshr->needsWritable()) ||
1216 repl_mshr->isCleaning());
1217 // too hard to replace block with transient state
1218 // allocation failed, block not inserted

--- 27 unchanged lines hidden (view full) ---

1246BaseCache::writebackBlk(CacheBlk *blk)
1247{
1248 chatty_assert(!isReadOnly || writebackClean,
1249 "Writeback from read-only cache");
1250 assert(blk && blk->isValid() && (blk->isDirty() || writebackClean));
1251
1252 writebacks[Request::wbMasterId]++;
1253
1254 Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0,
1255 Request::wbMasterId);
1256 if (blk->isSecure())
1257 req->setFlags(Request::SECURE);
1258
1259 req->taskId(blk->task_id);
1260
1261 PacketPtr pkt =
1262 new Packet(req, blk->isDirty() ?

--- 18 unchanged lines hidden (view full) ---

1281 pkt->setDataFromBlock(blk->data, blkSize);
1282
1283 return pkt;
1284}
1285
1286PacketPtr
1287BaseCache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
1288{
1289 Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0,
1290 Request::wbMasterId);
1291 if (blk->isSecure()) {
1292 req->setFlags(Request::SECURE);
1293 }
1294 req->taskId(blk->task_id);
1295
1296 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id);
1297

--- 43 unchanged lines hidden (view full) ---

1341}
1342
1343void
1344BaseCache::writebackVisitor(CacheBlk &blk)
1345{
1346 if (blk.isDirty()) {
1347 assert(blk.isValid());
1348
1349 Request request(tags->regenerateBlkAddr(&blk),
1350 blkSize, 0, Request::funcMasterId);
1351 request.taskId(blk.task_id);
1352 if (blk.isSecure()) {
1353 request.setFlags(Request::SECURE);
1354 }
1355
1356 Packet packet(&request, MemCmd::WriteReq);
1357 packet.dataStatic(blk.data);

--- 942 unchanged lines hidden ---