summaryrefslogtreecommitdiff
path: root/src/dev/io_device.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-05-23 09:15:45 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-05-23 09:15:45 -0400
commitd4847fe6ea63a1122ed14e6ac6d10ef0a8469194 (patch)
treeb0f2b009c004210e3866e2f1514e55b7eac3785a /src/dev/io_device.hh
parent5b36cf623cd065eea4f7b5e8b892dc904c030d56 (diff)
downloadgem5-d4847fe6ea63a1122ed14e6ac6d10ef0a8469194.tar.xz
DMA: Split the DMA device and IO device into seperate files
This patch moves the DMA device to its own set of files, splitting it from the IO device. There are no behavioural changes associated with this patch. The patch also grabs the opportunity to do some very minor tidying up, including some white space removal and pruning some redundant parameters. Besides the immediate benefits of the separation-of-concerns, this patch also makes upcoming changes more streamlined as it split the devices that are only slaves and the DMA device that also acts as a master. --HG-- rename : src/dev/io_device.cc => src/dev/dma_device.cc rename : src/dev/io_device.hh => src/dev/dma_device.hh
Diffstat (limited to 'src/dev/io_device.hh')
-rw-r--r--src/dev/io_device.hh134
1 files changed, 0 insertions, 134 deletions
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index 0e6556a50..3f2802332 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -44,18 +44,12 @@
#ifndef __DEV_IO_DEVICE_HH__
#define __DEV_IO_DEVICE_HH__
-#include "base/fast_alloc.hh"
#include "mem/mem_object.hh"
-#include "mem/packet.hh"
#include "mem/tport.hh"
#include "params/BasicPioDevice.hh"
-#include "params/DmaDevice.hh"
#include "params/PioDevice.hh"
-#include "sim/sim_object.hh"
-class Event;
class PioDevice;
-class DmaDevice;
class System;
/**
@@ -80,91 +74,6 @@ class PioPort : public SimpleTimingPort
PioPort(PioDevice *dev);
};
-
-class DmaPort : public MasterPort
-{
- protected:
- struct DmaReqState : public Packet::SenderState, public FastAlloc
- {
- /** Event to call on the device when this transaction (all packets)
- * complete. */
- Event *completionEvent;
-
- /** Where we came from for some sanity checking. */
- Port *outPort;
-
- /** Total number of bytes that this transaction involves. */
- Addr totBytes;
-
- /** Number of bytes that have been acked for this transaction. */
- Addr numBytes;
-
- /** Amount to delay completion of dma by */
- Tick delay;
-
-
- DmaReqState(Event *ce, Port *p, Addr tb, Tick _delay)
- : completionEvent(ce), outPort(p), totBytes(tb), numBytes(0),
- delay(_delay)
- {}
- };
-
- MemObject *device;
- std::list<PacketPtr> transmitList;
-
- /** The system that device/port are in. This is used to select which mode
- * we are currently operating in. */
- System *sys;
-
- /** Id for all requests */
- MasterID masterId;
-
- /** Number of outstanding packets the dma port has. */
- int pendingCount;
-
- /** If a dmaAction is in progress. */
- int actionInProgress;
-
- /** If we need to drain, keep the drain event around until we're done
- * here.*/
- Event *drainEvent;
-
- /** time to wait between sending another packet, increases as NACKs are
- * recived, decreases as responses are recived. */
- Tick backoffTime;
-
- /** Minimum time that device should back off for after failed sendTiming */
- Tick minBackoffDelay;
-
- /** Maximum time that device should back off for after failed sendTiming */
- Tick maxBackoffDelay;
-
- /** If the port is currently waiting for a retry before it can send whatever
- * it is that it's sending. */
- bool inRetry;
-
- virtual bool recvTimingResp(PacketPtr pkt);
-
- virtual void recvRetry() ;
-
- void queueDma(PacketPtr pkt, bool front = false);
- void sendDma();
-
- /** event to give us a kick every time we backoff time is reached. */
- EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
-
- public:
- DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff);
-
- void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
- uint8_t *data, Tick delay, Request::Flags flag = 0);
-
- bool dmaPending() { return pendingCount > 0; }
-
- unsigned cacheBlockSize() const { return peerBlockSize(); }
- unsigned int drain(Event *de);
-};
-
/**
* This device is the base class which all devices senstive to an address range
* inherit from. There are three pure virtual functions which all devices must
@@ -255,47 +164,4 @@ class BasicPioDevice : public PioDevice
};
-class DmaDevice : public PioDevice
-{
- protected:
- DmaPort dmaPort;
-
- public:
- typedef DmaDeviceParams Params;
- DmaDevice(const Params *p);
- virtual ~DmaDevice();
-
- const Params *
- params() const
- {
- return dynamic_cast<const Params *>(_params);
- }
-
- void dmaWrite(Addr addr, int size, Event *event, uint8_t *data,
- Tick delay = 0)
- {
- dmaPort.dmaAction(MemCmd::WriteReq, addr, size, event, data, delay);
- }
-
- void dmaRead(Addr addr, int size, Event *event, uint8_t *data,
- Tick delay = 0)
- {
- dmaPort.dmaAction(MemCmd::ReadReq, addr, size, event, data, delay);
- }
-
- bool dmaPending() { return dmaPort.dmaPending(); }
-
- virtual void init();
-
- virtual unsigned int drain(Event *de);
-
- unsigned cacheBlockSize() const { return dmaPort.cacheBlockSize(); }
-
- virtual MasterPort &getMasterPort(const std::string &if_name,
- int idx = -1);
-
- friend class DmaPort;
-};
-
-
#endif // __DEV_IO_DEVICE_HH__