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);
113 std::shared_ptr<SequencerMsg> msg =
114 std::make_shared<SequencerMsg>(
clockEdge());
115 msg->getPhysicalAddress() = paddr;
116 msg->getLineAddress() = line_addr;
118 if (pkt->
req->isAtomic()) {
119 msg->setType(SequencerRequestType_ATOMIC);
125 int atomic_offset = pkt->
getAddr() - line_addr;
127 assert(atomic_offset + pkt->
getSize() <= block_size);
129 for (
int idx = 0; idx < pkt->
getSize(); ++idx) {
130 access_mask[atomic_offset + idx] =
true;
137 atomic_ops.emplace_back(atomic_op);
138 msg->getwriteMask().setAtomicOps(atomic_ops);
140 msg->setType(SequencerRequestType_ST);
143 msg->setType(SequencerRequestType_LD);
151 if (write && (
data != NULL)) {
152 if (active_request.
data != NULL) {
153 msg->getDataBlk().setData(
data,
offset, msg->getLen());
163 return RequestStatus_Issued;
177 DPRINTF(RubyDma,
"DMA request completed: addr %p, size %d\n",
178 address, active_request.
len);
186 std::shared_ptr<SequencerMsg> msg =
187 std::make_shared<SequencerMsg>(
clockEdge());
188 msg->getPhysicalAddress() = active_request.
start_paddr +
194 msg->getType() = (active_request.
write ? SequencerRequestType_ST :
195 SequencerRequestType_LD);
198 (active_request.
len -
203 if (active_request.
write) {
213 "DMA request bytes issued %d, bytes completed %d, total len %d\n",
230 assert(!active_request.
write);
231 if (active_request.
data != NULL) {
267 DPRINTF(RubyStats,
"Recorded statistic: %s\n",
268 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 bypassStrictFIFO=false)
void ruby_hit_callback(PacketPtr pkt)
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
static uint32_t getBlockSizeBytes()
static uint32_t getBlockSizeBits()
Addr makeLineAddress(Addr addr)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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)