1/* 2 * Copyright (c) 2013-2014 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 --- 67 unchanged lines hidden (view full) --- 76} 77 78BasePrefetcher::BasePrefetcher(const BasePrefetcherParams *p) 79 : ClockedObject(p), listeners(), cache(nullptr), blkSize(p->block_size), 80 lBlkSize(floorLog2(blkSize)), onMiss(p->on_miss), onRead(p->on_read), 81 onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst), 82 masterId(p->sys->getMasterId(this)), pageBytes(p->sys->getPageBytes()), 83 prefetchOnAccess(p->prefetch_on_access), |
84 useVirtualAddresses(p->use_virtual_addresses), issuedPrefetches(0), 85 usefulPrefetches(0) |
86{ 87} 88 89void 90BasePrefetcher::setCache(BaseCache *_cache) 91{ 92 assert(!cache); 93 cache = _cache; --- 48 unchanged lines hidden (view full) --- 142 143bool 144BasePrefetcher::inMissQueue(Addr addr, bool is_secure) const 145{ 146 return cache->inMissQueue(addr, is_secure); 147} 148 149bool |
150BasePrefetcher::hasBeenPrefetched(Addr addr, bool is_secure) const 151{ 152 return cache->hasBeenPrefetched(addr, is_secure); 153} 154 155bool |
156BasePrefetcher::samePage(Addr a, Addr b) const 157{ 158 return roundDown(a, pageBytes) == roundDown(b, pageBytes); 159} 160 161Addr 162BasePrefetcher::blockAddress(Addr a) const 163{ --- 28 unchanged lines hidden (view full) --- 192BasePrefetcher::probeNotify(const PacketPtr &pkt) 193{ 194 // Don't notify prefetcher on SWPrefetch, cache maintenance 195 // operations or for writes that we are coaslescing. 196 if (pkt->cmd.isSWPrefetch()) return; 197 if (pkt->req->isCacheMaintenance()) return; 198 if (pkt->isWrite() && cache != nullptr && cache->coalesce()) return; 199 |
200 if (hasBeenPrefetched(pkt->getAddr(), pkt->isSecure())) { 201 usefulPrefetches += 1; 202 } 203 |
204 // Verify this access type is observed by prefetcher 205 if (observeAccess(pkt)) { 206 if (useVirtualAddresses && pkt->req->hasVaddr()) { 207 PrefetchInfo pfi(pkt, pkt->req->getVaddr()); 208 notify(pkt, pfi); 209 } else if (!useVirtualAddresses && pkt->req->hasPaddr()) { 210 PrefetchInfo pfi(pkt, pkt->req->getPaddr()); 211 notify(pkt, pfi); --- 27 unchanged lines hidden --- |