+
+void
+BasePrefetcher::probeNotify(const PacketPtr &pkt, bool miss)
+{
+ // Don't notify prefetcher on SWPrefetch, cache maintenance
+ // operations or for writes that we are coaslescing.
+ if (pkt->cmd.isSWPrefetch()) return;
+ if (pkt->req->isCacheMaintenance()) return;
+ if (pkt->isWrite() && cache != nullptr && cache->coalesce()) return;
+ if (!pkt->req->hasPaddr()) {
+ panic("Request must have a physical address");
+ }
+
+ if (hasBeenPrefetched(pkt->getAddr(), pkt->isSecure())) {
+ usefulPrefetches += 1;
+ }
+
+ // Verify this access type is observed by prefetcher
+ if (observeAccess(pkt, miss)) {
+ if (useVirtualAddresses && pkt->req->hasVaddr()) {
+ PrefetchInfo pfi(pkt, pkt->req->getVaddr(), miss);
+ notify(pkt, pfi);
+ } else if (!useVirtualAddresses) {
+ PrefetchInfo pfi(pkt, pkt->req->getPaddr(), miss);
+ notify(pkt, pfi);
+ }
+ }
+}
+
+void
+BasePrefetcher::regProbeListeners()
+{
+ /**
+ * If no probes were added by the configuration scripts, connect to the
+ * parent cache using the probe "Miss". Also connect to "Hit", if the
+ * cache is configured to prefetch on accesses.
+ */
+ if (listeners.empty() && cache != nullptr) {
+ ProbeManager *pm(cache->getProbeManager());
+ listeners.push_back(new PrefetchListener(*this, pm, "Miss", false,
+ true));
+ listeners.push_back(new PrefetchListener(*this, pm, "Fill", true,
+ false));
+ if (prefetchOnAccess) {
+ listeners.push_back(new PrefetchListener(*this, pm, "Hit", false,
+ false));
+ }
+ }
+}
+
+void
+BasePrefetcher::addEventProbe(SimObject *obj, const char *name)
+{
+ ProbeManager *pm(obj->getProbeManager());
+ listeners.push_back(new PrefetchListener(*this, pm, name));
+}
+
+void
+BasePrefetcher::addTLB(BaseTLB *t)
+{
+ fatal_if(tlb != nullptr, "Only one TLB can be registered");
+ tlb = t;
+}