Deleted Added
sdiff udiff text old ( 2641:6d9d837e2032 ) new ( 2657:b119b774656b )
full compact
1/*
2 * Copyright (c) 2006 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;

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "base/trace.hh"
30#include "dev/io_device.hh"
31#include "sim/builder.hh"
32
33
34PioPort::PioPort(PioDevice *dev, Platform *p)
35 : Port(dev->name() + "-pioport"), device(dev), platform(p)
36{ }
37

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

51void
52PioPort::getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
53{
54 snoop.clear();
55 device->addressRanges(resp);
56}
57
58
59void
60PioPort::recvRetry()
61{
62 Packet* pkt = transmitList.front();
63 if (Port::sendTiming(pkt)) {
64 transmitList.pop_front();
65 }
66}
67
68
69void
70PioPort::SendEvent::process()
71{
72 if (port->Port::sendTiming(packet))
73 return;
74
75 port->transmitList.push_back(packet);
76}
77
78
79
80bool
81PioPort::recvTiming(Packet *pkt)
82{
83 device->recvAtomic(pkt);
84 // turn packet around to go back to requester
85 pkt->makeTimingResponse();
86 sendTiming(pkt, pkt->time - pkt->req->getTime());
87 return true;

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

114 : Port(dev->name() + "-dmaport"), device(dev), platform(p), pendingCount(0)
115{ }
116
117bool
118DmaPort::recvTiming(Packet *pkt)
119{
120 if (pkt->senderState) {
121 DmaReqState *state;
122 DPRINTF(DMA, "Received response Packet %#x with senderState: %#x\n",
123 pkt, pkt->senderState);
124 state = dynamic_cast<DmaReqState*>(pkt->senderState);
125 assert(state);
126 state->completionEvent->process();
127 delete pkt->req;
128 delete pkt;
129 } else {
130 DPRINTF(DMA, "Received response Packet %#x with no senderState\n", pkt);
131 delete pkt->req;
132 delete pkt;
133 }
134
135 return true;
136}
137
138DmaDevice::DmaDevice(Params *p)
139 : PioDevice(p), dmaPort(NULL)
140{ }
141
142void
143DmaPort::recvRetry()
144{
145 Packet* pkt = transmitList.front();
146 DPRINTF(DMA, "Retry on Packet %#x with senderState: %#x\n",
147 pkt, pkt->senderState);
148 if (sendTiming(pkt)) {
149 DPRINTF(DMA, "-- Done\n");
150 transmitList.pop_front();
151 pendingCount--;
152 assert(pendingCount >= 0);
153 } else {
154 DPRINTF(DMA, "-- Failed, queued\n");
155 }
156}
157
158
159void
160DmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
161 uint8_t *data)
162{
163 assert(event);

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

193void
194DmaPort::sendDma(Packet *pkt)
195{
196 // some kind of selction between access methods
197 // more work is going to have to be done to make
198 // switching actually work
199 /* MemState state = device->platform->system->memState;
200
201 if (state == Timing) { */
202 DPRINTF(DMA, "Attempting to send Packet %#x with senderState: %#x\n",
203 pkt, pkt->senderState);
204 if (!sendTiming(pkt)) {
205 transmitList.push_back(pkt);
206 DPRINTF(DMA, "-- Failed: queued\n");
207 } else {
208 DPRINTF(DMA, "-- Done\n");
209 pendingCount--;
210 assert(pendingCount >= 0);
211 }
212 /* } else if (state == Atomic) {
213 sendAtomic(pkt);
214 if (pkt->senderState) {
215 DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState);
216 assert(state);
217 state->completionEvent->schedule(curTick + (pkt->time - pkt->req->getTime()) +1);
218 }
219 pendingCount--;
220 assert(pendingCount >= 0);
221 delete pkt->req;
222 delete pkt;
223
224 } else if (state == Functional) {
225 sendFunctional(pkt);
226 // Is this correct???
227 completionEvent->schedule(pkt->req->responseTime - pkt->req->requestTime);
228 completionEvent == NULL;
229 } else
230 panic("Unknown memory command state.");
231 */
232}
233
234DmaDevice::~DmaDevice()
235{
236 if (dmaPort)
237 delete dmaPort;
238}
239
240