gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DmaPort Class Reference

#include <dma_device.hh>

Inheritance diagram for DmaPort:
MasterPort Drainable BaseMasterPort Port

Classes

struct  DmaReqState
 

Public Member Functions

 DmaPort (MemObject *dev, System *s)
 
RequestPtr dmaAction (Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
 
bool dmaPending () const
 
DrainState drain () override
 Notify an object that it needs to drain its state. More...
 
- Public Member Functions inherited from MasterPort
 MasterPort (const std::string &name, MemObject *owner, PortID id=InvalidPortID)
 Master port. More...
 
virtual ~MasterPort ()
 
void bind (BaseSlavePort &slave_port)
 Bind this master port to a slave port. More...
 
void unbind ()
 Unbind this master port and the associated slave port. More...
 
Tick sendAtomic (PacketPtr pkt)
 Send an atomic request packet, where the data is moved and the state is updated in zero time, without interleaving with other memory accesses. More...
 
void sendFunctional (PacketPtr pkt)
 Send a functional request packet, where the data is instantly updated everywhere in the memory system, without affecting the current state of any block or moving the block. More...
 
bool sendTimingReq (PacketPtr pkt)
 Attempt to send a timing request to the slave port by calling its corresponding receive function. More...
 
bool sendTimingSnoopResp (PacketPtr pkt)
 Attempt to send a timing snoop response packet to the slave port by calling its corresponding receive function. More...
 
virtual void sendRetryResp ()
 Send a retry to the slave port that previously attempted a sendTimingResp to this master port and failed. More...
 
virtual bool isSnooping () const
 Determine if this master port is snooping or not. More...
 
AddrRangeList getAddrRanges () const
 Get the address ranges of the connected slave port. More...
 
void printAddr (Addr a)
 Inject a PrintReq for the given address to print the state of that address throughout the memory system. More...
 
- Public Member Functions inherited from BaseMasterPort
BaseSlavePortgetSlavePort () const
 
bool isConnected () const
 
- Public Member Functions inherited from Port
const std::string name () const
 Return port name (for DPRINTF). More...
 
PortID getId () const
 Get the port id. More...
 
- Public Member Functions inherited from Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 

Public Attributes

MemObject *const device
 The device that owns this port. More...
 
System *const sys
 The system that device/port are in. More...
 
const MasterID masterId
 Id for all requests. More...
 

Protected Member Functions

bool recvTimingResp (PacketPtr pkt) override
 Receive a timing response from the slave port. More...
 
void recvReqRetry () override
 Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be called on the slave port) and was unsuccesful. More...
 
void queueDma (PacketPtr pkt)
 
- Protected Member Functions inherited from MasterPort
virtual Tick recvAtomicSnoop (PacketPtr pkt)
 Receive an atomic snoop request packet from the slave port. More...
 
virtual void recvFunctionalSnoop (PacketPtr pkt)
 Receive a functional snoop request packet from the slave port. More...
 
virtual void recvTimingSnoopReq (PacketPtr pkt)
 Receive a timing snoop request from the slave port. More...
 
virtual void recvRetrySnoopResp ()
 Called by the slave port if sendTimingSnoopResp was called on this master port (causing recvTimingSnoopResp to be called on the slave port) and was unsuccesful. More...
 
virtual void recvRangeChange ()
 Called to receive an address range change from the peer slave port. More...
 
- Protected Member Functions inherited from BaseMasterPort
 BaseMasterPort (const std::string &name, MemObject *owner, PortID id=InvalidPortID)
 
virtual ~BaseMasterPort ()
 
- Protected Member Functions inherited from Port
 Port (const std::string &_name, MemObject &_owner, PortID _id)
 Abstract base class for ports. More...
 
virtual ~Port ()
 Virtual destructor due to inheritance. More...
 
- Protected Member Functions inherited from Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 

Protected Attributes

std::deque< PacketPtrtransmitList
 Use a deque as we never do any insertion or removal in the middle. More...
 
EventWrapper< DmaPort,&DmaPort::sendDmasendEvent
 Event used to schedule a future sending from the transmit list. More...
 
uint32_t pendingCount
 Number of outstanding packets the dma port has. More...
 
bool inRetry
 If the port is currently waiting for a retry before it can send whatever it is that it's sending. More...
 
- Protected Attributes inherited from BaseMasterPort
BaseSlavePort_baseSlavePort
 
- Protected Attributes inherited from Port
const PortID id
 A numeric identifier to distinguish ports in a vector, and set to InvalidPortID in case this port is not part of a vector. More...
 
MemObjectowner
 A reference to the MemObject that owns this port. More...
 

Private Member Functions

void trySendTimingReq ()
 Take the first packet of the transmit list and attempt to send it as a timing request. More...
 
void sendDma ()
 For timing, attempt to send the first item on the transmit list, and if it is successful and there are more packets waiting, then schedule the sending of the next packet. More...
 
void handleResp (PacketPtr pkt, Tick delay=0)
 Handle a response packet by updating the corresponding DMA request state to reflect the bytes received, and also update the pending request counter. More...
 

Detailed Description

Definition at line 57 of file dma_device.hh.

Constructor & Destructor Documentation

DmaPort::DmaPort ( MemObject dev,
System s 
)

Definition at line 56 of file dma_device.cc.

Member Function Documentation

RequestPtr DmaPort::dmaAction ( Packet::Command  cmd,
Addr  addr,
int  size,
Event event,
uint8_t *  data,
Tick  delay,
Request::Flags  flag = 0 
)
bool DmaPort::dmaPending ( ) const
inline

Definition at line 149 of file dma_device.hh.

References pendingCount.

Referenced by DmaDevice::dmaPending().

DrainState DmaPort::drain ( )
overridevirtual

Notify an object that it needs to drain its state.

If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.

Note
An object that has entered the Drained state can be disturbed by other objects in the system and consequently stop being drained. These perturbations are not visible in the drain state. The simulator therefore repeats the draining process until all objects return DrainState::Drained on the first call to drain().
Returns
DrainState::Drained if the object is drained at this point in time, DrainState::Draining if it needs further simulation.

Implements Drainable.

Definition at line 131 of file dma_device.cc.

References DPRINTF, Drained, Draining, and pendingCount.

void DmaPort::handleResp ( PacketPtr  pkt,
Tick  delay = 0 
)
private

Handle a response packet by updating the corresponding DMA request state to reflect the bytes received, and also update the pending request counter.

If the DMA request that this packet is part of is complete, then signal the completion event if present, potentially with a delay added to it.

Parameters
pktResponse packet to handler
delayAdditional delay for scheduling the completion event

Definition at line 63 of file dma_device.cc.

References Packet::cmdString(), curTick(), device, ContextSwitchTaskId::DMA, DPRINTF, Packet::getAddr(), Request::getSize(), Packet::isResponse(), pendingCount, Packet::req, EventManager::schedule(), Packet::senderState, and Drainable::signalDrainDone().

Referenced by recvTimingResp(), and sendDma().

void DmaPort::queueDma ( PacketPtr  pkt)
protected

Definition at line 191 of file dma_device.cc.

References pendingCount, and transmitList.

Referenced by dmaAction().

void DmaPort::recvReqRetry ( )
overrideprotectedvirtual

Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be called on the slave port) and was unsuccesful.

Implements MasterPort.

Definition at line 142 of file dma_device.cc.

References transmitList, and trySendTimingReq().

bool DmaPort::recvTimingResp ( PacketPtr  pkt)
overrideprotectedvirtual

Receive a timing response from the slave port.

Implements MasterPort.

Definition at line 107 of file dma_device.cc.

References Packet::cacheResponding(), handleResp(), Packet::hasSharers(), Request::isUncacheable(), and Packet::req.

void DmaPort::sendDma ( )
private

For timing, attempt to send the first item on the transmit list, and if it is successful and there are more packets waiting, then schedule the sending of the next packet.

For atomic, simply send and process everything on the transmit list.

Definition at line 230 of file dma_device.cc.

References ContextSwitchTaskId::DMA, DPRINTF, Request::getPaddr(), Request::getSize(), handleResp(), inRetry, System::isAtomicMode(), System::isTimingMode(), panic, Packet::req, Event::scheduled(), MasterPort::sendAtomic(), sendEvent, sys, transmitList, and trySendTimingReq().

Referenced by dmaAction().

void DmaPort::trySendTimingReq ( )
private

Take the first packet of the transmit list and attempt to send it as a timing request.

If it is successful, schedule the sending of the next packet, otherwise remember that we are waiting for a retry.

Definition at line 201 of file dma_device.cc.

References Clocked::clockEdge(), Packet::cmdString(), device, ContextSwitchTaskId::DMA, DPRINTF, Packet::getAddr(), inRetry, EventManager::schedule(), sendEvent, MasterPort::sendTimingReq(), and transmitList.

Referenced by recvReqRetry(), and sendDma().

Member Data Documentation

MemObject* const DmaPort::device

The device that owns this port.

Definition at line 112 of file dma_device.hh.

Referenced by handleResp(), and trySendTimingReq().

bool DmaPort::inRetry
protected

If the port is currently waiting for a retry before it can send whatever it is that it's sending.

Definition at line 133 of file dma_device.hh.

Referenced by sendDma(), and trySendTimingReq().

const MasterID DmaPort::masterId

Id for all requests.

Definition at line 119 of file dma_device.hh.

Referenced by dmaAction().

uint32_t DmaPort::pendingCount
protected

Number of outstanding packets the dma port has.

Definition at line 129 of file dma_device.hh.

Referenced by dmaPending(), drain(), handleResp(), and queueDma().

EventWrapper<DmaPort, &DmaPort::sendDma> DmaPort::sendEvent
protected

Event used to schedule a future sending from the transmit list.

Definition at line 126 of file dma_device.hh.

Referenced by sendDma(), and trySendTimingReq().

System* const DmaPort::sys

The system that device/port are in.

This is used to select which mode we are currently operating in.

Definition at line 116 of file dma_device.hh.

Referenced by dmaAction(), DmaReadFifo::resumeFill(), DmaReadFifo::resumeFillFunctional(), and sendDma().

std::deque<PacketPtr> DmaPort::transmitList
protected

Use a deque as we never do any insertion or removal in the middle.

Definition at line 123 of file dma_device.hh.

Referenced by queueDma(), recvReqRetry(), sendDma(), and trySendTimingReq().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:07 for gem5 by doxygen 1.8.6