io_device.hh (4263:1cd4e07ab60b) io_device.hh (4435:7da241055348)
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;

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

102
103 /** If a dmaAction is in progress. */
104 int actionInProgress;
105
106 /** If we need to drain, keep the drain event around until we're done
107 * here.*/
108 Event *drainEvent;
109
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;

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

102
103 /** If a dmaAction is in progress. */
104 int actionInProgress;
105
106 /** If we need to drain, keep the drain event around until we're done
107 * here.*/
108 Event *drainEvent;
109
110 /** time to wait between sending another packet, increases as NACKs are
111 * recived, decreases as responses are recived. */
112 Tick backoffTime;
113
114 /** If the port is currently waiting for a retry before it can send whatever
115 * it is that it's sending. */
116 bool inRetry;
117
110 virtual bool recvTiming(PacketPtr pkt);
111 virtual Tick recvAtomic(PacketPtr pkt)
112 { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
113 virtual void recvFunctional(PacketPtr pkt)
114 { panic("dma port shouldn't be used for pio access."); }
115
116 virtual void recvStatusChange(Status status)
117 { ; }
118
119 virtual void recvRetry() ;
120
121 virtual void getDeviceAddressRanges(AddrRangeList &resp,
122 AddrRangeList &snoop)
123 { resp.clear(); snoop.clear(); }
124
118 virtual bool recvTiming(PacketPtr pkt);
119 virtual Tick recvAtomic(PacketPtr pkt)
120 { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
121 virtual void recvFunctional(PacketPtr pkt)
122 { panic("dma port shouldn't be used for pio access."); }
123
124 virtual void recvStatusChange(Status status)
125 { ; }
126
127 virtual void recvRetry() ;
128
129 virtual void getDeviceAddressRanges(AddrRangeList &resp,
130 AddrRangeList &snoop)
131 { resp.clear(); snoop.clear(); }
132
125 void sendDma(PacketPtr pkt, bool front = false);
133 void queueDma(PacketPtr pkt, bool front = false);
134 void sendDma();
126
135
136 /** event to give us a kick every time we backoff time is reached. */
137 EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
138
127 public:
128 DmaPort(DmaDevice *dev, System *s);
129
130 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
131 uint8_t *data = NULL);
132
133 bool dmaPending() { return pendingCount > 0; }
134

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

244 * @param range_list range list to populate with ranges
245 */
246 void addressRanges(AddrRangeList &range_list);
247
248};
249
250class DmaDevice : public PioDevice
251{
139 public:
140 DmaPort(DmaDevice *dev, System *s);
141
142 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
143 uint8_t *data = NULL);
144
145 bool dmaPending() { return pendingCount > 0; }
146

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

256 * @param range_list range list to populate with ranges
257 */
258 void addressRanges(AddrRangeList &range_list);
259
260};
261
262class DmaDevice : public PioDevice
263{
252 protected:
264 public:
265 struct Params : public PioDevice::Params
266 {
267 Tick min_backoff_delay;
268 Tick max_backoff_delay;
269 };
270
271 protected:
253 DmaPort *dmaPort;
272 DmaPort *dmaPort;
273 Tick minBackoffDelay;
274 Tick maxBackoffDelay;
254
255 public:
256 DmaDevice(Params *p);
257 virtual ~DmaDevice();
258
259 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data)
260 {
261 dmaPort->dmaAction(MemCmd::WriteInvalidateReq,

--- 35 unchanged lines hidden ---
275
276 public:
277 DmaDevice(Params *p);
278 virtual ~DmaDevice();
279
280 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data)
281 {
282 dmaPort->dmaAction(MemCmd::WriteInvalidateReq,

--- 35 unchanged lines hidden ---