Deleted Added
sdiff udiff text old ( 12345:70c783a93195 ) new ( 12346:9b1144d046ca )
full compact
1/*
2 * Copyright (c) 2010-2016 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

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

425 } else if (pkt->cmd == MemCmd::WriteClean) {
426 // WriteClean handling is a special case. We can allocate a
427 // block directly if it doesn't exist and we can update the
428 // block immediately. The WriteClean transfers the ownership
429 // of the block as well.
430 assert(blkSize == pkt->getSize());
431
432 if (!blk) {
433 // a writeback that misses needs to allocate a new block
434 blk = allocateBlock(pkt->getAddr(), pkt->isSecure(),
435 writebacks);
436 if (!blk) {
437 // no replaceable block available: give up, fwd to
438 // next level.
439 incMissCount(pkt);
440 return false;
441 }
442 tags->insertBlock(pkt, blk);
443
444 blk->status = (BlkValid | BlkReadable);
445 if (pkt->isSecure()) {
446 blk->status |= BlkSecure;
447 }
448 }
449
450 // at this point either this is a writeback or a write-through
451 // write clean operation and the block is already in this
452 // cache, we need to update the data and the block flags
453 assert(blk);
454 blk->status |= BlkDirty;
455 // nothing else to do; writeback doesn't expect response
456 assert(!pkt->needsResponse());
457 std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
458 DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print());
459
460 incHitCount(pkt);
461 // populate the time when the block will be ready to access.
462 blk->whenReady = clockEdge(fillLatency) + pkt->headerDelay +
463 pkt->payloadDelay;
464 return true;
465 } else if (blk && (pkt->needsWritable() ? blk->isWritable() :
466 blk->isReadable())) {
467 // OK to satisfy access
468 incHitCount(pkt);
469 satisfyRequest(pkt, blk);
470 maintainClusivity(pkt->fromCache(), blk);
471
472 return true;

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

1618
1619 pkt->allocate();
1620 std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
1621
1622 return pkt;
1623}
1624
1625PacketPtr
1626Cache::writecleanBlk(CacheBlk *blk)
1627{
1628 Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set),
1629 blkSize, 0, Request::wbMasterId);
1630 if (blk->isSecure()) {
1631 req->setFlags(Request::SECURE);
1632 }
1633 req->taskId(blk->task_id);
1634 blk->task_id = ContextSwitchTaskId::Unknown;
1635 PacketPtr pkt = new Packet(req, MemCmd::WriteClean);
1636 DPRINTF(Cache, "Create %s writable: %d, dirty: %d\n", pkt->print(),
1637 blk->isWritable(), blk->isDirty());
1638 // make sure the block is not marked dirty
1639 blk->status &= ~BlkDirty;
1640 pkt->allocate();
1641 // We inform the cache below that the block has sharers in the
1642 // system as we retain our copy.
1643 pkt->setHasSharers();
1644 std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
1645 return pkt;
1646}
1647
1648
1649PacketPtr
1650Cache::cleanEvictBlk(CacheBlk *blk)
1651{

--- 1098 unchanged lines hidden ---