Deleted Added
sdiff udiff text old ( 5730:dea5fcd1ead0 ) new ( 5875:d82be3235ab4 )
full compact
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

59
60MSHR::TargetList::TargetList()
61 : needsExclusive(false), hasUpgrade(false)
62{}
63
64
65inline void
66MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
67 Counter order, Target::Source source, bool markPending)
68{
69 if (source != Target::FromSnoop) {
70 if (pkt->needsExclusive()) {
71 needsExclusive = true;
72 }
73
74 if (pkt->cmd == MemCmd::UpgradeReq) {
75 hasUpgrade = true;
76 }
77 }
78
79 if (markPending) {
80 MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState);
81 if (mshr != NULL) {
82 assert(!mshr->downstreamPending);
83 mshr->downstreamPending = true;
84 }
85 }
86
87 push_back(Target(pkt, readyTime, order, source, markPending));
88}
89
90
91void
92MSHR::TargetList::replaceUpgrades()
93{
94 if (!hasUpgrade)
95 return;

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

136
137
138void
139MSHR::TargetList::
140print(std::ostream &os, int verbosity, const std::string &prefix) const
141{
142 ConstIterator end_i = end();
143 for (ConstIterator i = begin(); i != end_i; ++i) {
144 const char *s;
145 switch (i->source) {
146 case Target::FromCPU: s = "FromCPU";
147 case Target::FromSnoop: s = "FromSnoop";
148 case Target::FromPrefetcher: s = "FromPrefetcher";
149 default: s = "";
150 }
151 ccprintf(os, "%s%s: ", prefix, s);
152 i->pkt->print(os, verbosity, "");
153 }
154}
155
156
157void
158MSHR::allocate(Addr _addr, int _size, PacketPtr target,
159 Tick whenReady, Counter _order)

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

164 order = _order;
165 assert(target);
166 isForward = false;
167 _isUncacheable = target->req->isUncacheable();
168 inService = false;
169 downstreamPending = false;
170 threadNum = 0;
171 ntargets = 1;
172 assert(targets->isReset());
173 // Don't know of a case where we would allocate a new MSHR for a
174 // snoop (mem-side request), so set source according to request here
175 Target::Source source = (target->cmd == MemCmd::HardPFReq) ?
176 Target::FromPrefetcher : Target::FromCPU;
177 targets->add(target, whenReady, _order, source, true);
178 assert(deferredTargets->isReset());
179 pendingInvalidate = false;
180 pendingShared = false;
181 data = NULL;
182}
183
184
185void

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

234 // if there's a request already in service for this MSHR, we will
235 // have to defer the new target until after the response if any of
236 // the following are true:
237 // - there are other targets already deferred
238 // - there's a pending invalidate to be applied after the response
239 // comes back (but before this target is processed)
240 // - the outstanding request is for a non-exclusive block and this
241 // target requires an exclusive block
242
243 // assume we'd never issue a prefetch when we've got an
244 // outstanding miss
245 assert(pkt->cmd != MemCmd::HardPFReq);
246
247 if (inService &&
248 (!deferredTargets->empty() || pendingInvalidate ||
249 (!targets->needsExclusive && pkt->needsExclusive()))) {
250 // need to put on deferred list
251 deferredTargets->add(pkt, whenReady, _order, Target::FromCPU, true);
252 } else {
253 // No request outstanding, or still OK to append to
254 // outstanding request: append to regular target list. Only
255 // mark pending if current request hasn't been issued yet
256 // (isn't in service).
257 targets->add(pkt, whenReady, _order, Target::FromCPU, !inService);
258 }
259
260 ++ntargets;
261}
262
263bool
264MSHR::handleSnoop(PacketPtr pkt, Counter _order)
265{

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

300 // further snooping.
301 return true;
302 }
303
304 if (targets->needsExclusive || pkt->needsExclusive()) {
305 // actual target device (typ. PhysicalMemory) will delete the
306 // packet on reception, so we need to save a copy here
307 PacketPtr cp_pkt = new Packet(pkt, true);
308 targets->add(cp_pkt, curTick, _order, Target::FromSnoop,
309 downstreamPending && targets->needsExclusive);
310 ++ntargets;
311
312 if (targets->needsExclusive) {
313 // We're awaiting an exclusive copy, so ownership is pending.
314 // It's up to us to respond once the data arrives.
315 pkt->assertMemInhibit();
316 pkt->setSupplyExclusive();

--- 123 unchanged lines hidden ---