gem5
|
#include <dma_device.hh>
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 | |
BaseSlavePort & | getSlavePort () 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< PacketPtr > | transmitList |
Use a deque as we never do any insertion or removal in the middle. More... | |
EventWrapper< DmaPort,&DmaPort::sendDma > | sendEvent |
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... | |
MemObject & | owner |
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... | |
Definition at line 57 of file dma_device.hh.
Definition at line 56 of file dma_device.cc.
RequestPtr DmaPort::dmaAction | ( | Packet::Command | cmd, |
Addr | addr, | ||
int | size, | ||
Event * | event, | ||
uint8_t * | data, | ||
Tick | delay, | ||
Request::Flags | flag = 0 |
||
) |
Definition at line 149 of file dma_device.cc.
References System::cacheLineSize(), Packet::dataStatic(), ContextSwitchTaskId::DMA, ChunkGenerator::done(), DPRINTF, masterId, queueDma(), Event::scheduled(), sendDma(), Packet::senderState, sys, and Request::taskId().
Referenced by DmaDevice::dmaRead(), DmaDevice::dmaWrite(), ArmISA::TableWalker::fetchDescriptor(), Pl111::fillFifo(), UFSHostDevice::readDevice(), DmaReadFifo::resumeFillTiming(), and UFSHostDevice::writeDevice().
|
inline |
Definition at line 149 of file dma_device.hh.
References pendingCount.
Referenced by DmaDevice::dmaPending().
|
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.
Implements Drainable.
Definition at line 131 of file dma_device.cc.
References DPRINTF, Drained, Draining, and pendingCount.
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.
pkt | Response packet to handler |
delay | Additional 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().
|
protected |
Definition at line 191 of file dma_device.cc.
References pendingCount, and transmitList.
Referenced by dmaAction().
|
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().
|
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.
|
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().
|
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().
MemObject* const DmaPort::device |
The device that owns this port.
Definition at line 112 of file dma_device.hh.
Referenced by handleResp(), and trySendTimingReq().
|
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 |
|
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().
|
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().
|
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().