io_device.hh (6227:a17798f2a52c) io_device.hh (7403:3d433863cd41)
1/*
2 * Copyright (c) 2004-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;

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

87 Addr totBytes;
88
89 /** Number of bytes that have been acked for this transaction. */
90 Addr numBytes;
91
92 /** Amount to delay completion of dma by */
93 Tick delay;
94
1/*
2 * Copyright (c) 2004-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;

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

87 Addr totBytes;
88
89 /** Number of bytes that have been acked for this transaction. */
90 Addr numBytes;
91
92 /** Amount to delay completion of dma by */
93 Tick delay;
94
95
95 DmaReqState(Event *ce, Port *p, Addr tb, Tick _delay)
96 : completionEvent(ce), outPort(p), totBytes(tb), numBytes(0),
97 delay(_delay)
98 {}
99 };
100
96 DmaReqState(Event *ce, Port *p, Addr tb, Tick _delay)
97 : completionEvent(ce), outPort(p), totBytes(tb), numBytes(0),
98 delay(_delay)
99 {}
100 };
101
101 DmaDevice *device;
102 MemObject *device;
102 std::list<PacketPtr> transmitList;
103
104 /** The system that device/port are in. This is used to select which mode
105 * we are currently operating in. */
106 System *sys;
107
108 /** Number of outstanding packets the dma port has. */
109 int pendingCount;

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

114 /** If we need to drain, keep the drain event around until we're done
115 * here.*/
116 Event *drainEvent;
117
118 /** time to wait between sending another packet, increases as NACKs are
119 * recived, decreases as responses are recived. */
120 Tick backoffTime;
121
103 std::list<PacketPtr> transmitList;
104
105 /** The system that device/port are in. This is used to select which mode
106 * we are currently operating in. */
107 System *sys;
108
109 /** Number of outstanding packets the dma port has. */
110 int pendingCount;

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

115 /** If we need to drain, keep the drain event around until we're done
116 * here.*/
117 Event *drainEvent;
118
119 /** time to wait between sending another packet, increases as NACKs are
120 * recived, decreases as responses are recived. */
121 Tick backoffTime;
122
123 /** Minimum time that device should back off for after failed sendTiming */
124 Tick minBackoffDelay;
125
126 /** Maximum time that device should back off for after failed sendTiming */
127 Tick maxBackoffDelay;
128
122 /** If the port is currently waiting for a retry before it can send whatever
123 * it is that it's sending. */
124 bool inRetry;
125
126 virtual bool recvTiming(PacketPtr pkt);
127 virtual Tick recvAtomic(PacketPtr pkt)
128 { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
129 virtual void recvFunctional(PacketPtr pkt)

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

140
141 void queueDma(PacketPtr pkt, bool front = false);
142 void sendDma();
143
144 /** event to give us a kick every time we backoff time is reached. */
145 EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
146
147 public:
129 /** If the port is currently waiting for a retry before it can send whatever
130 * it is that it's sending. */
131 bool inRetry;
132
133 virtual bool recvTiming(PacketPtr pkt);
134 virtual Tick recvAtomic(PacketPtr pkt)
135 { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
136 virtual void recvFunctional(PacketPtr pkt)

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

147
148 void queueDma(PacketPtr pkt, bool front = false);
149 void sendDma();
150
151 /** event to give us a kick every time we backoff time is reached. */
152 EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
153
154 public:
148 DmaPort(DmaDevice *dev, System *s);
155 DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff);
149
150 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
151 uint8_t *data, Tick delay);
152
153 bool dmaPending() { return pendingCount > 0; }
154
155 unsigned cacheBlockSize() const { return peerBlockSize(); }
156 unsigned int drain(Event *de);

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

251 void addressRanges(AddrRangeList &range_list);
252
253};
254
255class DmaDevice : public PioDevice
256{
257 protected:
258 DmaPort *dmaPort;
156
157 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
158 uint8_t *data, Tick delay);
159
160 bool dmaPending() { return pendingCount > 0; }
161
162 unsigned cacheBlockSize() const { return peerBlockSize(); }
163 unsigned int drain(Event *de);

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

258 void addressRanges(AddrRangeList &range_list);
259
260};
261
262class DmaDevice : public PioDevice
263{
264 protected:
265 DmaPort *dmaPort;
259 Tick minBackoffDelay;
260 Tick maxBackoffDelay;
261
262 public:
263 typedef DmaDeviceParams Params;
264 DmaDevice(const Params *p);
265 virtual ~DmaDevice();
266
267 const Params *
268 params() const

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

293 fatal("%s: pio port already connected to %s",
294 name(), pioPort->getPeer()->name());
295 pioPort = new PioPort(this, sys);
296 return pioPort;
297 } else if (if_name == "dma") {
298 if (dmaPort != NULL)
299 fatal("%s: dma port already connected to %s",
300 name(), dmaPort->getPeer()->name());
266
267 public:
268 typedef DmaDeviceParams Params;
269 DmaDevice(const Params *p);
270 virtual ~DmaDevice();
271
272 const Params *
273 params() const

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

298 fatal("%s: pio port already connected to %s",
299 name(), pioPort->getPeer()->name());
300 pioPort = new PioPort(this, sys);
301 return pioPort;
302 } else if (if_name == "dma") {
303 if (dmaPort != NULL)
304 fatal("%s: dma port already connected to %s",
305 name(), dmaPort->getPeer()->name());
301 dmaPort = new DmaPort(this, sys);
306 dmaPort = new DmaPort(this, sys, params()->min_backoff_delay,
307 params()->max_backoff_delay);
302 return dmaPort;
303 } else
304 return NULL;
305 }
306
307 friend class DmaPort;
308};
309
310
311#endif // __DEV_IO_DEVICE_HH__
308 return dmaPort;
309 } else
310 return NULL;
311 }
312
313 friend class DmaPort;
314};
315
316
317#endif // __DEV_IO_DEVICE_HH__