45#include "debug/RubyDma.hh"
46#include "debug/RubyStats.hh"
47#include "mem/ruby/protocol/SequencerMsg.hh"
48#include "mem/ruby/protocol/SequencerRequestType.hh"
58 int bytes_completed,
int bytes_issued, uint8_t *
data,
60 : start_paddr(start_paddr),
len(
len), write(write),
61 bytes_completed(bytes_completed), bytes_issued(bytes_issued),
data(
data),
68 m_max_outstanding_requests(
p.max_outstanding_requests)
83 return RequestStatus_BufferFull;
98 std::forward_as_tuple(line_addr),
99 std::forward_as_tuple(paddr,
len, write, 0,
101 DMARequest& active_request = emplace_pair.first->second;
106 if (!emplace_pair.second) {
107 DPRINTF(RubyDma,
"DMA aliased: addr %p, len %d\n", line_addr,
len);
108 return RequestStatus_Aliased;
111 DPRINTF(RubyDma,
"DMA req created: addr %p, len %d\n", line_addr,
len);
115 std::shared_ptr<SequencerMsg> msg =
117 msg->getPhysicalAddress() = paddr;
118 msg->getLineAddress() = line_addr;
120 if (pkt->
req->isAtomic()) {
121 msg->setType(SequencerRequestType_ATOMIC);
127 int atomic_offset = pkt->
getAddr() - line_addr;
129 assert(atomic_offset + pkt->
getSize() <= block_size);
131 for (
int idx = 0; idx < pkt->
getSize(); ++idx) {
132 access_mask[atomic_offset + idx] =
true;
139 atomic_ops.emplace_back(atomic_op);
140 msg->getwriteMask().setAtomicOps(atomic_ops);
142 msg->setType(SequencerRequestType_ST);
145 msg->setType(SequencerRequestType_LD);
153 if (write && (
data != NULL)) {
154 if (active_request.
data != NULL) {
155 msg->getDataBlk().setData(
data,
offset, msg->getLen());
166 return RequestStatus_Issued;
180 DPRINTF(RubyDma,
"DMA request completed: addr %p, size %d\n",
181 address, active_request.
len);
191 std::shared_ptr<SequencerMsg> msg =
193 msg->getPhysicalAddress() = active_request.
start_paddr +
199 msg->getType() = (active_request.
write ? SequencerRequestType_ST :
200 SequencerRequestType_LD);
203 (active_request.
len -
208 if (active_request.
write) {
219 "DMA request bytes issued %d, bytes completed %d, total len %d\n",
236 assert(!active_request.
write);
237 if (active_request.
data != NULL) {
273 DPRINTF(RubyStats,
"Recorded statistic: %s\n",
274 DMASequencerRequestType_to_string(requestType));
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Tick cyclesToTicks(Cycles c) const
Cycles is a wrapper class for representing cycle counts, i.e.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
T * getPtr()
get a pointer to the data ptr.
RequestPtr req
A pointer to the original request.
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
bool isMaskedWrite() const
void dataCallback(const DataBlock &dblk, const Addr &addr)
DMASequencerParams Params
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void issueNext(const Addr &addr)
DMASequencer(const Params &)
RequestStatus makeRequest(PacketPtr pkt) override
void ackCallback(const Addr &addr)
int m_max_outstanding_requests
void atomicCallback(const DataBlock &dblk, const Addr &addr)
RequestTable m_RequestTable
void recordRequestType(DMASequencerRequestType requestType)
uint64_t m_data_block_mask
const uint8_t * getData(int offset, int len) const
void enqueue(MsgPtr message, Tick curTime, Tick delta, bool ruby_is_random, bool ruby_warmup, bool bypassStrictFIFO=false)
void ruby_hit_callback(PacketPtr pkt)
Addr makeLineAddress(Addr addr) const
RubySystem * m_ruby_system
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
MessageBuffer * m_mandatory_q_ptr
uint32_t getBlockSizeBits()
uint32_t getBlockSizeBytes()
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
DMARequest(uint64_t start_paddr, int len, bool write, int bytes_completed, int bytes_issued, uint8_t *data, PacketPtr pkt)