packet_queue.cc (8948:e95ee70f876c) packet_queue.cc (8975:7f36d4436074)
1/*
2 * Copyright (c) 2012 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

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

41 * Andreas Hansson
42 */
43
44#include "debug/PacketQueue.hh"
45#include "mem/packet_queue.hh"
46
47using namespace std;
48
1/*
2 * Copyright (c) 2012 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

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

41 * Andreas Hansson
42 */
43
44#include "debug/PacketQueue.hh"
45#include "mem/packet_queue.hh"
46
47using namespace std;
48
49PacketQueue::PacketQueue(EventManager& _em, Port& _port,
50 const std::string _label)
51 : em(_em), label(_label), sendEvent(this), drainEvent(NULL), port(_port),
49PacketQueue::PacketQueue(EventManager& _em, const std::string& _label)
50 : em(_em), sendEvent(this), drainEvent(NULL), label(_label),
52 waitingOnRetry(false)
53{
54}
55
56PacketQueue::~PacketQueue()
57{
58}
59

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

137{
138 assert(deferredPacketReady());
139
140 // take the next packet off the list here, as we might return to
141 // ourselves through the sendTiming call below
142 DeferredPacket dp = transmitList.front();
143 transmitList.pop_front();
144
51 waitingOnRetry(false)
52{
53}
54
55PacketQueue::~PacketQueue()
56{
57}
58

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

136{
137 assert(deferredPacketReady());
138
139 // take the next packet off the list here, as we might return to
140 // ourselves through the sendTiming call below
141 DeferredPacket dp = transmitList.front();
142 transmitList.pop_front();
143
145 // attempt to send the packet and remember the outcome
146 if (!dp.sendAsSnoop)
147 waitingOnRetry = !port.sendTiming(dp.pkt);
148 else
149 waitingOnRetry = !port.sendTimingSnoop(dp.pkt);
144 // use the appropriate implementation of sendTiming based on the
145 // type of port associated with the queue, and whether the packet
146 // is to be sent as a snoop or not
147 waitingOnRetry = !sendTiming(dp.pkt, dp.sendAsSnoop);
150
151 if (waitingOnRetry) {
152 // put the packet back at the front of the list (packet should
153 // not have changed since it wasn't accepted)
154 assert(!sendEvent.scheduled());
155 transmitList.push_front(dp);
156 }
157}

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

201unsigned int
202PacketQueue::drain(Event *de)
203{
204 if (transmitList.empty() && !sendEvent.scheduled())
205 return 0;
206 drainEvent = de;
207 return 1;
208}
148
149 if (waitingOnRetry) {
150 // put the packet back at the front of the list (packet should
151 // not have changed since it wasn't accepted)
152 assert(!sendEvent.scheduled());
153 transmitList.push_front(dp);
154 }
155}

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

199unsigned int
200PacketQueue::drain(Event *de)
201{
202 if (transmitList.empty() && !sendEvent.scheduled())
203 return 0;
204 drainEvent = de;
205 return 1;
206}
207
208MasterPacketQueue::MasterPacketQueue(EventManager& _em, MasterPort& _masterPort,
209 const std::string _label)
210 : PacketQueue(_em, _label), masterPort(_masterPort)
211{
212}
213
214bool
215MasterPacketQueue::sendTiming(PacketPtr pkt, bool send_as_snoop)
216{
217 // attempt to send the packet and return according to the outcome
218 if (!send_as_snoop)
219 return masterPort.sendTimingReq(pkt);
220 else
221 return masterPort.sendTimingSnoopResp(pkt);
222}
223
224SlavePacketQueue::SlavePacketQueue(EventManager& _em, SlavePort& _slavePort,
225 const std::string _label)
226 : PacketQueue(_em, _label), slavePort(_slavePort)
227{
228}
229
230bool
231SlavePacketQueue::sendTiming(PacketPtr pkt, bool send_as_snoop)
232{
233 // we should never have queued snoop requests
234 assert(!send_as_snoop);
235 return slavePort.sendTimingResp(pkt);
236}