io_device.cc (8711:c7e14f52c682) io_device.cc (8742:9df38d259935)
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 * Authors: Ali Saidi
29 * Nathan Binkert
30 */
31
32#include "base/chunk_generator.hh"
33#include "base/trace.hh"
34#include "debug/BusAddrRanges.hh"
35#include "debug/DMA.hh"
36#include "dev/io_device.hh"
37#include "sim/system.hh"
38
39PioPort::PioPort(PioDevice *dev, System *s, std::string pname)
40 : SimpleTimingPort(dev->name() + pname, dev), device(dev)
41{ }
42
43
44Tick
45PioPort::recvAtomic(PacketPtr pkt)
46{
47 return pkt->isRead() ? device->read(pkt) : device->write(pkt);
48}
49
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 * Authors: Ali Saidi
29 * Nathan Binkert
30 */
31
32#include "base/chunk_generator.hh"
33#include "base/trace.hh"
34#include "debug/BusAddrRanges.hh"
35#include "debug/DMA.hh"
36#include "dev/io_device.hh"
37#include "sim/system.hh"
38
39PioPort::PioPort(PioDevice *dev, System *s, std::string pname)
40 : SimpleTimingPort(dev->name() + pname, dev), device(dev)
41{ }
42
43
44Tick
45PioPort::recvAtomic(PacketPtr pkt)
46{
47 return pkt->isRead() ? device->read(pkt) : device->write(pkt);
48}
49
50AddrRangeList
51PioPort::getAddrRanges()
50void
51PioPort::getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
52{
52{
53 return device->getAddrRanges();
53 snoop = false;
54 device->addressRanges(resp);
55 for (AddrRangeIter i = resp.begin(); i != resp.end(); i++)
56 DPRINTF(BusAddrRanges, "Adding Range %#x-%#x\n", i->start, i->end);
54}
55
56
57PioDevice::PioDevice(const Params *p)
57}
58
59
60PioDevice::PioDevice(const Params *p)
58 : MemObject(p), platform(p->platform), sys(p->system), pioPort(NULL)
61 : MemObject(p), sys(p->system), pioPort(NULL)
59{}
60
61PioDevice::~PioDevice()
62{
63 if (pioPort)
64 delete pioPort;
65}
66
67void
68PioDevice::init()
69{
70 if (!pioPort)
62{}
63
64PioDevice::~PioDevice()
65{
66 if (pioPort)
67 delete pioPort;
68}
69
70void
71PioDevice::init()
72{
73 if (!pioPort)
71 panic("Pio port of %s not connected to anything!", name());
72 pioPort->sendRangeChange();
74 panic("Pio port not connected to anything!");
75 pioPort->sendStatusChange(Port::RangeChange);
73}
74
76}
77
75Port *
76PioDevice::getPort(const std::string &if_name, int idx)
77{
78 if (if_name == "pio") {
79 if (pioPort != NULL)
80 fatal("%s: pio port already connected to %s",
81 name(), pioPort->getPeer()->name());
82 pioPort = new PioPort(this, sys);
83 return pioPort;
84 }
85 return NULL;
86}
87
88unsigned int
89PioDevice::drain(Event *de)
90{
91 unsigned int count;
92 count = pioPort->drain(de);
93 if (count)
94 changeState(Draining);
95 else
96 changeState(Drained);
97 return count;
98}
99
100BasicPioDevice::BasicPioDevice(const Params *p)
101 : PioDevice(p), pioAddr(p->pio_addr), pioSize(0),
102 pioDelay(p->pio_latency)
103{}
104
78
79unsigned int
80PioDevice::drain(Event *de)
81{
82 unsigned int count;
83 count = pioPort->drain(de);
84 if (count)
85 changeState(Draining);
86 else
87 changeState(Drained);
88 return count;
89}
90
91BasicPioDevice::BasicPioDevice(const Params *p)
92 : PioDevice(p), pioAddr(p->pio_addr), pioSize(0),
93 pioDelay(p->pio_latency)
94{}
95
105AddrRangeList
106BasicPioDevice::getAddrRanges()
96void
97BasicPioDevice::addressRanges(AddrRangeList &range_list)
107{
108 assert(pioSize != 0);
98{
99 assert(pioSize != 0);
109 AddrRangeList ranges;
100 range_list.clear();
110 DPRINTF(BusAddrRanges, "registering range: %#x-%#x\n", pioAddr, pioSize);
101 DPRINTF(BusAddrRanges, "registering range: %#x-%#x\n", pioAddr, pioSize);
111 ranges.push_back(RangeSize(pioAddr, pioSize));
112 return ranges;
102 range_list.push_back(RangeSize(pioAddr, pioSize));
113}
114
115
103}
104
105
116DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
117 bool recv_snoops)
106DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff)
118 : Port(dev->name() + "-dmaport", dev), device(dev), sys(s),
119 pendingCount(0), actionInProgress(0), drainEvent(NULL),
120 backoffTime(0), minBackoffDelay(min_backoff),
107 : Port(dev->name() + "-dmaport", dev), device(dev), sys(s),
108 pendingCount(0), actionInProgress(0), drainEvent(NULL),
109 backoffTime(0), minBackoffDelay(min_backoff),
121 maxBackoffDelay(max_backoff), inRetry(false), recvSnoops(recv_snoops),
122 backoffEvent(this)
110 maxBackoffDelay(max_backoff), inRetry(false), backoffEvent(this)
123{ }
124
125bool
126DmaPort::recvTiming(PacketPtr pkt)
127{
128 if (pkt->wasNacked()) {
129 DPRINTF(DMA, "Received nacked %s addr %#x\n",
130 pkt->cmdString(), pkt->getAddr());
131
132 if (backoffTime < minBackoffDelay)
133 backoffTime = minBackoffDelay;
134 else if (backoffTime < maxBackoffDelay)
135 backoffTime <<= 1;
136
111{ }
112
113bool
114DmaPort::recvTiming(PacketPtr pkt)
115{
116 if (pkt->wasNacked()) {
117 DPRINTF(DMA, "Received nacked %s addr %#x\n",
118 pkt->cmdString(), pkt->getAddr());
119
120 if (backoffTime < minBackoffDelay)
121 backoffTime = minBackoffDelay;
122 else if (backoffTime < maxBackoffDelay)
123 backoffTime <<= 1;
124
137 device->reschedule(backoffEvent, curTick() + backoffTime, true);
125 reschedule(backoffEvent, curTick() + backoffTime, true);
138
139 DPRINTF(DMA, "Backoff time set to %d ticks\n", backoffTime);
140
141 pkt->reinitNacked();
142 queueDma(pkt, true);
126
127 DPRINTF(DMA, "Backoff time set to %d ticks\n", backoffTime);
128
129 pkt->reinitNacked();
130 queueDma(pkt, true);
143 } else if (pkt->isRequest() && recvSnoops) {
144 return true;
145 } else if (pkt->senderState) {
146 DmaReqState *state;
147 backoffTime >>= 2;
148
149 DPRINTF(DMA, "Received response %s addr %#x size %#x\n",
150 pkt->cmdString(), pkt->getAddr(), pkt->req->getSize());
151 state = dynamic_cast<DmaReqState*>(pkt->senderState);
152 pendingCount--;
153
154 assert(pendingCount >= 0);
155 assert(state);
156
157 // We shouldn't ever get a block in ownership state
158 assert(!(pkt->memInhibitAsserted() && !pkt->sharedAsserted()));
159
160 state->numBytes += pkt->req->getSize();
161 assert(state->totBytes >= state->numBytes);
162 if (state->totBytes == state->numBytes) {
163 if (state->completionEvent) {
164 if (state->delay)
131 } else if (pkt->senderState) {
132 DmaReqState *state;
133 backoffTime >>= 2;
134
135 DPRINTF(DMA, "Received response %s addr %#x size %#x\n",
136 pkt->cmdString(), pkt->getAddr(), pkt->req->getSize());
137 state = dynamic_cast<DmaReqState*>(pkt->senderState);
138 pendingCount--;
139
140 assert(pendingCount >= 0);
141 assert(state);
142
143 // We shouldn't ever get a block in ownership state
144 assert(!(pkt->memInhibitAsserted() && !pkt->sharedAsserted()));
145
146 state->numBytes += pkt->req->getSize();
147 assert(state->totBytes >= state->numBytes);
148 if (state->totBytes == state->numBytes) {
149 if (state->completionEvent) {
150 if (state->delay)
165 device->schedule(state->completionEvent,
166 curTick() + state->delay);
151 schedule(state->completionEvent, curTick() + state->delay);
167 else
168 state->completionEvent->process();
169 }
170 delete state;
171 }
172 delete pkt->req;
173 delete pkt;
174
175 if (pendingCount == 0 && drainEvent) {
176 drainEvent->process();
177 drainEvent = NULL;
178 }
179 } else {
180 panic("Got packet without sender state... huh?\n");
181 }
182
183 return true;
184}
185
186DmaDevice::DmaDevice(const Params *p)
187 : PioDevice(p), dmaPort(NULL)
188{ }
189
190
191unsigned int
192DmaDevice::drain(Event *de)
193{
194 unsigned int count;
195 count = pioPort->drain(de) + dmaPort->drain(de);
196 if (count)
197 changeState(Draining);
198 else
199 changeState(Drained);
200 return count;
201}
202
203unsigned int
204DmaPort::drain(Event *de)
205{
206 if (pendingCount == 0)
207 return 0;
208 drainEvent = de;
209 return 1;
210}
211
212
213void
214DmaPort::recvRetry()
215{
216 assert(transmitList.size());
217 bool result = true;
218 do {
219 PacketPtr pkt = transmitList.front();
220 DPRINTF(DMA, "Retry on %s addr %#x\n",
221 pkt->cmdString(), pkt->getAddr());
222 result = sendTiming(pkt);
223 if (result) {
224 DPRINTF(DMA, "-- Done\n");
225 transmitList.pop_front();
226 inRetry = false;
227 } else {
228 inRetry = true;
229 DPRINTF(DMA, "-- Failed, queued\n");
230 }
231 } while (!backoffTime && result && transmitList.size());
232
233 if (transmitList.size() && backoffTime && !inRetry) {
234 DPRINTF(DMA, "Scheduling backoff for %d\n", curTick()+backoffTime);
235 if (!backoffEvent.scheduled())
152 else
153 state->completionEvent->process();
154 }
155 delete state;
156 }
157 delete pkt->req;
158 delete pkt;
159
160 if (pendingCount == 0 && drainEvent) {
161 drainEvent->process();
162 drainEvent = NULL;
163 }
164 } else {
165 panic("Got packet without sender state... huh?\n");
166 }
167
168 return true;
169}
170
171DmaDevice::DmaDevice(const Params *p)
172 : PioDevice(p), dmaPort(NULL)
173{ }
174
175
176unsigned int
177DmaDevice::drain(Event *de)
178{
179 unsigned int count;
180 count = pioPort->drain(de) + dmaPort->drain(de);
181 if (count)
182 changeState(Draining);
183 else
184 changeState(Drained);
185 return count;
186}
187
188unsigned int
189DmaPort::drain(Event *de)
190{
191 if (pendingCount == 0)
192 return 0;
193 drainEvent = de;
194 return 1;
195}
196
197
198void
199DmaPort::recvRetry()
200{
201 assert(transmitList.size());
202 bool result = true;
203 do {
204 PacketPtr pkt = transmitList.front();
205 DPRINTF(DMA, "Retry on %s addr %#x\n",
206 pkt->cmdString(), pkt->getAddr());
207 result = sendTiming(pkt);
208 if (result) {
209 DPRINTF(DMA, "-- Done\n");
210 transmitList.pop_front();
211 inRetry = false;
212 } else {
213 inRetry = true;
214 DPRINTF(DMA, "-- Failed, queued\n");
215 }
216 } while (!backoffTime && result && transmitList.size());
217
218 if (transmitList.size() && backoffTime && !inRetry) {
219 DPRINTF(DMA, "Scheduling backoff for %d\n", curTick()+backoffTime);
220 if (!backoffEvent.scheduled())
236 device->schedule(backoffEvent, backoffTime + curTick());
221 schedule(backoffEvent, backoffTime + curTick());
237 }
238 DPRINTF(DMA, "TransmitList: %d, backoffTime: %d inRetry: %d es: %d\n",
239 transmitList.size(), backoffTime, inRetry,
240 backoffEvent.scheduled());
241}
242
243
244void
245DmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
246 uint8_t *data, Tick delay, Request::Flags flag)
247{
248 assert(device->getState() == SimObject::Running);
249
250 DmaReqState *reqState = new DmaReqState(event, this, size, delay);
251
252
253 DPRINTF(DMA, "Starting DMA for addr: %#x size: %d sched: %d\n", addr, size,
254 event ? event->scheduled() : -1 );
255 for (ChunkGenerator gen(addr, size, peerBlockSize());
256 !gen.done(); gen.next()) {
257 Request *req = new Request(gen.addr(), gen.size(), flag);
258 PacketPtr pkt = new Packet(req, cmd, Packet::Broadcast);
259
260 // Increment the data pointer on a write
261 if (data)
262 pkt->dataStatic(data + gen.complete());
263
264 pkt->senderState = reqState;
265
266 assert(pendingCount >= 0);
267 pendingCount++;
268 DPRINTF(DMA, "--Queuing DMA for addr: %#x size: %d\n", gen.addr(),
269 gen.size());
270 queueDma(pkt);
271 }
272
273}
274
275void
276DmaPort::queueDma(PacketPtr pkt, bool front)
277{
278
279 if (front)
280 transmitList.push_front(pkt);
281 else
282 transmitList.push_back(pkt);
283 sendDma();
284}
285
286
287void
288DmaPort::sendDma()
289{
290 // some kind of selction between access methods
291 // more work is going to have to be done to make
292 // switching actually work
293 assert(transmitList.size());
294 PacketPtr pkt = transmitList.front();
295
296 Enums::MemoryMode state = sys->getMemoryMode();
297 if (state == Enums::timing) {
298 if (backoffEvent.scheduled() || inRetry) {
299 DPRINTF(DMA, "Can't send immediately, waiting for retry or backoff timer\n");
300 return;
301 }
302
303 DPRINTF(DMA, "Attempting to send %s addr %#x\n",
304 pkt->cmdString(), pkt->getAddr());
305
306 bool result;
307 do {
308 result = sendTiming(pkt);
309 if (result) {
310 transmitList.pop_front();
311 DPRINTF(DMA, "-- Done\n");
312 } else {
313 inRetry = true;
314 DPRINTF(DMA, "-- Failed: queued\n");
315 }
316 } while (result && !backoffTime && transmitList.size());
317
318 if (transmitList.size() && backoffTime && !inRetry &&
319 !backoffEvent.scheduled()) {
320 DPRINTF(DMA, "-- Scheduling backoff timer for %d\n",
321 backoffTime+curTick());
222 }
223 DPRINTF(DMA, "TransmitList: %d, backoffTime: %d inRetry: %d es: %d\n",
224 transmitList.size(), backoffTime, inRetry,
225 backoffEvent.scheduled());
226}
227
228
229void
230DmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
231 uint8_t *data, Tick delay, Request::Flags flag)
232{
233 assert(device->getState() == SimObject::Running);
234
235 DmaReqState *reqState = new DmaReqState(event, this, size, delay);
236
237
238 DPRINTF(DMA, "Starting DMA for addr: %#x size: %d sched: %d\n", addr, size,
239 event ? event->scheduled() : -1 );
240 for (ChunkGenerator gen(addr, size, peerBlockSize());
241 !gen.done(); gen.next()) {
242 Request *req = new Request(gen.addr(), gen.size(), flag);
243 PacketPtr pkt = new Packet(req, cmd, Packet::Broadcast);
244
245 // Increment the data pointer on a write
246 if (data)
247 pkt->dataStatic(data + gen.complete());
248
249 pkt->senderState = reqState;
250
251 assert(pendingCount >= 0);
252 pendingCount++;
253 DPRINTF(DMA, "--Queuing DMA for addr: %#x size: %d\n", gen.addr(),
254 gen.size());
255 queueDma(pkt);
256 }
257
258}
259
260void
261DmaPort::queueDma(PacketPtr pkt, bool front)
262{
263
264 if (front)
265 transmitList.push_front(pkt);
266 else
267 transmitList.push_back(pkt);
268 sendDma();
269}
270
271
272void
273DmaPort::sendDma()
274{
275 // some kind of selction between access methods
276 // more work is going to have to be done to make
277 // switching actually work
278 assert(transmitList.size());
279 PacketPtr pkt = transmitList.front();
280
281 Enums::MemoryMode state = sys->getMemoryMode();
282 if (state == Enums::timing) {
283 if (backoffEvent.scheduled() || inRetry) {
284 DPRINTF(DMA, "Can't send immediately, waiting for retry or backoff timer\n");
285 return;
286 }
287
288 DPRINTF(DMA, "Attempting to send %s addr %#x\n",
289 pkt->cmdString(), pkt->getAddr());
290
291 bool result;
292 do {
293 result = sendTiming(pkt);
294 if (result) {
295 transmitList.pop_front();
296 DPRINTF(DMA, "-- Done\n");
297 } else {
298 inRetry = true;
299 DPRINTF(DMA, "-- Failed: queued\n");
300 }
301 } while (result && !backoffTime && transmitList.size());
302
303 if (transmitList.size() && backoffTime && !inRetry &&
304 !backoffEvent.scheduled()) {
305 DPRINTF(DMA, "-- Scheduling backoff timer for %d\n",
306 backoffTime+curTick());
322 device->schedule(backoffEvent, backoffTime + curTick());
307 schedule(backoffEvent, backoffTime + curTick());
323 }
324 } else if (state == Enums::atomic) {
325 transmitList.pop_front();
326
327 Tick lat;
328 DPRINTF(DMA, "--Sending DMA for addr: %#x size: %d\n",
329 pkt->req->getPaddr(), pkt->req->getSize());
330 lat = sendAtomic(pkt);
331 assert(pkt->senderState);
332 DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState);
333 assert(state);
334 state->numBytes += pkt->req->getSize();
335
336 DPRINTF(DMA, "--Received response for DMA for addr: %#x size: %d nb: %d, tot: %d sched %d\n",
337 pkt->req->getPaddr(), pkt->req->getSize(), state->numBytes,
338 state->totBytes,
339 state->completionEvent ? state->completionEvent->scheduled() : 0 );
340
341 if (state->totBytes == state->numBytes) {
342 if (state->completionEvent) {
343 assert(!state->completionEvent->scheduled());
308 }
309 } else if (state == Enums::atomic) {
310 transmitList.pop_front();
311
312 Tick lat;
313 DPRINTF(DMA, "--Sending DMA for addr: %#x size: %d\n",
314 pkt->req->getPaddr(), pkt->req->getSize());
315 lat = sendAtomic(pkt);
316 assert(pkt->senderState);
317 DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState);
318 assert(state);
319 state->numBytes += pkt->req->getSize();
320
321 DPRINTF(DMA, "--Received response for DMA for addr: %#x size: %d nb: %d, tot: %d sched %d\n",
322 pkt->req->getPaddr(), pkt->req->getSize(), state->numBytes,
323 state->totBytes,
324 state->completionEvent ? state->completionEvent->scheduled() : 0 );
325
326 if (state->totBytes == state->numBytes) {
327 if (state->completionEvent) {
328 assert(!state->completionEvent->scheduled());
344 device->schedule(state->completionEvent,
345 curTick() + lat + state->delay);
329 schedule(state->completionEvent, curTick() + lat + state->delay);
346 }
347 delete state;
348 delete pkt->req;
349 }
350 pendingCount--;
351 assert(pendingCount >= 0);
352 delete pkt;
353
354 if (pendingCount == 0 && drainEvent) {
355 drainEvent->process();
356 drainEvent = NULL;
357 }
358
359 } else
360 panic("Unknown memory command state.");
361}
362
363DmaDevice::~DmaDevice()
364{
365 if (dmaPort)
366 delete dmaPort;
367}
330 }
331 delete state;
332 delete pkt->req;
333 }
334 pendingCount--;
335 assert(pendingCount >= 0);
336 delete pkt;
337
338 if (pendingCount == 0 && drainEvent) {
339 drainEvent->process();
340 drainEvent = NULL;
341 }
342
343 } else
344 panic("Unknown memory command state.");
345}
346
347DmaDevice::~DmaDevice()
348{
349 if (dmaPort)
350 delete dmaPort;
351}
368
369
370Port *
371DmaDevice::getPort(const std::string &if_name, int idx)
372{
373 if (if_name == "dma") {
374 if (dmaPort != NULL)
375 fatal("%s: dma port already connected to %s",
376 name(), dmaPort->getPeer()->name());
377 dmaPort = new DmaPort(this, sys, params()->min_backoff_delay,
378 params()->max_backoff_delay);
379 return dmaPort;
380 }
381 return PioDevice::getPort(if_name, idx);
382}
383