gem5  v22.1.0.0
dma_device.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, 2015, 2017, 2019 ARM Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2006 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #include "dev/dma_device.hh"
42 
43 #include <algorithm>
44 #include <cassert>
45 #include <cstring>
46 #include <utility>
47 
48 #include "base/logging.hh"
49 #include "base/trace.hh"
50 #include "debug/DMA.hh"
51 #include "debug/Drain.hh"
52 #include "sim/clocked_object.hh"
53 #include "sim/system.hh"
54 
55 namespace gem5
56 {
57 
59  uint32_t sid, uint32_t ssid)
60  : RequestPort(dev->name() + ".dma", dev),
61  device(dev), sys(s), requestorId(s->getRequestorId(dev)),
62  sendEvent([this]{ sendDma(); }, dev->name()),
63  defaultSid(sid), defaultSSid(ssid), cacheLineSize(s->cacheLineSize())
64 { }
65 
66 void
68 {
69  // Should always see a response with a sender state.
70  assert(pkt->isResponse());
71 
72  // Get the DMA sender state.
73  auto *state = dynamic_cast<DmaReqState*>(pkt->senderState);
74  assert(state);
75 
76  handleResp(state, pkt->getAddr(), pkt->req->getSize(), delay);
77 
78  delete pkt;
79 }
80 
81 void
83 {
84  DPRINTF(DMA, "Received response %s for addr: %#x size: %d nb: %d," \
85  " tot: %d sched %d\n",
86  MemCmd(state->cmd).toString(), addr, size,
87  state->numBytes, state->totBytes,
88  state->completionEvent ?
89  state->completionEvent->scheduled() : 0);
90 
91  // Update the number of bytes received based on the request rather
92  // than the packet as the latter could be rounded up to line sizes.
93  state->numBytes += size;
94  assert(state->totBytes >= state->numBytes);
95 
96  // If we have reached the total number of bytes for this DMA request,
97  // then signal the completion and delete the sate.
98  if (state->totBytes == state->numBytes) {
99  assert(pendingCount != 0);
100  pendingCount--;
101  if (state->completionEvent) {
102  delay += state->delay;
103  device->schedule(state->completionEvent, curTick() + delay);
104  }
105  delete state;
106  }
107 
108  // We might be drained at this point, if so signal the drain event.
109  if (pendingCount == 0)
110  signalDrainDone();
111 }
112 
113 PacketPtr
115 {
116  RequestPtr req = std::make_shared<Request>(
117  gen.addr(), gen.size(), flags, id);
118  req->setStreamId(sid);
119  req->setSubstreamId(ssid);
120  req->taskId(context_switch_task_id::DMA);
121 
122  PacketPtr pkt = new Packet(req, cmd);
123 
124  if (data)
125  pkt->dataStatic(data + gen.complete());
126 
127  pkt->senderState = this;
128  return pkt;
129 }
130 
131 bool
133 {
134  // We shouldn't ever get a cacheable block in Modified state.
135  assert(pkt->req->isUncacheable() ||
136  !(pkt->cacheResponding() && !pkt->hasSharers()));
137 
138  handleRespPacket(pkt);
139 
140  return true;
141 }
142 
144  : PioDevice(p), dmaPort(this, sys, p.sid, p.ssid)
145 { }
146 
147 void
149 {
151  "DMA port of %s not connected to anything!", name());
152  PioDevice::init();
153 }
154 
157 {
158  if (pendingCount == 0) {
159  return DrainState::Drained;
160  } else {
161  DPRINTF(Drain, "DmaPort not drained\n");
162  return DrainState::Draining;
163  }
164 }
165 
166 void
168 {
169  assert(transmitList.size());
171 }
172 
173 void
175  uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay,
176  Request::Flags flag)
177 {
178  DPRINTF(DMA, "Starting DMA for addr: %#x size: %d sched: %d\n", addr, size,
179  event ? event->scheduled() : -1);
180 
181  // One DMA request sender state for every action, that is then
182  // split into many requests and packets based on the block size,
183  // i.e. cache line size.
184  transmitList.push_back(
185  new DmaReqState(cmd, addr, cacheLineSize, size,
186  data, flag, requestorId, sid, ssid, event, delay));
187  pendingCount++;
188 
189  // In zero time, also initiate the sending of the packets for the request
190  // we have just created. For atomic this involves actually completing all
191  // the requests.
192  sendDma();
193 }
194 
195 void
197  uint8_t *data, Tick delay, Request::Flags flag)
198 {
199  dmaAction(cmd, addr, size, event, data,
200  defaultSid, defaultSSid, delay, flag);
201 }
202 
203 void
205 {
206  // Send the next packet for the first DMA request on the transmit list,
207  // and schedule the following send if it is successful
208  DmaReqState *state = transmitList.front();
209 
210  PacketPtr pkt = inRetry ? inRetry : state->createPacket();
211  inRetry = nullptr;
212 
213  DPRINTF(DMA, "Trying to send %s addr %#x\n", pkt->cmdString(),
214  pkt->getAddr());
215 
216  // Check if this was the last packet now, since hypothetically the packet
217  // response may come immediately, and state may be deleted.
218  bool last = state->gen.last();
219  if (!sendTimingReq(pkt))
220  inRetry = pkt;
221  if (!inRetry) {
222  // If that was the last packet from this request, pop it from the list.
223  if (last)
224  transmitList.pop_front();
225  else
226  state->gen.next();
227  DPRINTF(DMA, "-- Done\n");
228  // If there is more to do, then do so.
229  if (!transmitList.empty()) {
230  // This should ultimately wait for as many cycles as the device
231  // needs to send the packet, but currently the port does not have
232  // any known width so simply wait a single cycle.
234  }
235  } else {
236  DPRINTF(DMA, "-- Failed, waiting for retry\n");
237  }
238 
239  DPRINTF(DMA, "TransmitList: %d, inRetry: %d\n",
240  transmitList.size(), inRetry ? 1 : 0);
241 }
242 
243 bool
245 {
246  PacketPtr pkt = state->createPacket();
247  DPRINTF(DMA, "Sending DMA for addr: %#x size: %d\n",
248  state->gen.addr(), state->gen.size());
249  Tick lat = sendAtomic(pkt);
250 
251  // Check if we're done, since handleResp may delete state.
252  bool done = !state->gen.next();
253  handleRespPacket(pkt, lat);
254  return done;
255 }
256 
257 bool
259 {
260  bool done = false;
261 
262  auto bd_it = memBackdoors.contains(state->gen.addr());
263  if (bd_it == memBackdoors.end()) {
264  // We don't have a backdoor for this address, so use a packet.
265 
266  PacketPtr pkt = state->createPacket();
267  DPRINTF(DMA, "Sending DMA for addr: %#x size: %d\n",
268  state->gen.addr(), state->gen.size());
269 
270  MemBackdoorPtr bd = nullptr;
271  Tick lat = sendAtomicBackdoor(pkt, bd);
272 
273  // If we got a backdoor, record it.
274  if (bd && memBackdoors.insert(bd->range(), bd) != memBackdoors.end()) {
275  // Invalidation callback which finds this backdoor and removes it.
276  auto callback = [this](const MemBackdoor &backdoor) {
277  for (auto it = memBackdoors.begin();
278  it != memBackdoors.end(); it++) {
279  if (it->second == &backdoor) {
280  memBackdoors.erase(it);
281  return;
282  }
283  }
284  panic("Got invalidation for unknown memory backdoor.");
285  };
286  bd->addInvalidationCallback(callback);
287  }
288 
289  // Check if we're done now, since handleResp may delete state.
290  done = !state->gen.next();
291  handleRespPacket(pkt, lat);
292  } else {
293  // We have a backdoor that can at least partially satisfy this request.
294  DPRINTF(DMA, "Handling DMA for addr: %#x size %d through backdoor\n",
295  state->gen.addr(), state->gen.size());
296 
297  const auto *bd = bd_it->second;
298  // Offset of this access into the backdoor.
299  const Addr offset = state->gen.addr() - bd->range().start();
300  // How many bytes we still need.
301  const Addr remaining = state->totBytes - state->gen.complete();
302  // How many bytes this backdoor can provide, starting from offset.
303  const Addr available = bd->range().size() - offset;
304 
305  // How many bytes we're going to handle through this backdoor.
306  const Addr handled = std::min(remaining, available);
307 
308  // If there's a buffer for data, read/write it.
309  if (state->data) {
310  uint8_t *bd_data = bd->ptr() + offset;
311  uint8_t *state_data = state->data + state->gen.complete();
312  if (MemCmd(state->cmd).isRead())
313  memcpy(state_data, bd_data, handled);
314  else
315  memcpy(bd_data, state_data, handled);
316  }
317 
318  // Advance the chunk generator past this region of memory.
319  state->gen.setNext(state->gen.addr() + handled);
320 
321  // Check if we're done now, since handleResp may delete state.
322  done = !state->gen.next();
323  handleResp(state, state->gen.addr(), handled);
324  }
325 
326  return done;
327 }
328 
329 void
331 {
332  // Some kind of selection between access methods. More work is going to
333  // have to be done to make switching actually work.
334  assert(transmitList.size());
335 
336  if (sys->isTimingMode()) {
337  // If we are either waiting for a retry or are still waiting after
338  // sending the last packet, then do not proceed.
339  if (inRetry || sendEvent.scheduled()) {
340  DPRINTF(DMA, "Can't send immediately, waiting to send\n");
341  return;
342  }
343 
345  } else if (sys->isAtomicMode()) {
346  const bool bypass = sys->bypassCaches();
347 
348  // Send everything there is to send in zero time.
349  while (!transmitList.empty()) {
350  DmaReqState *state = transmitList.front();
351  transmitList.pop_front();
352 
353  bool done = state->gen.done();
354  while (!done)
355  done = bypass ? sendAtomicBdReq(state) : sendAtomicReq(state);
356  }
357  } else {
358  panic("Unknown memory mode.");
359  }
360 }
361 
362 Port &
363 DmaDevice::getPort(const std::string &if_name, PortID idx)
364 {
365  if (if_name == "dma") {
366  return dmaPort;
367  }
368  return PioDevice::getPort(if_name, idx);
369 }
370 
371 DmaReadFifo::DmaReadFifo(DmaPort &_port, size_t size,
372  unsigned max_req_size,
373  unsigned max_pending,
375  : maxReqSize(max_req_size), fifoSize(size),
376  reqFlags(flags), port(_port), cacheLineSize(port.sys->cacheLineSize()),
377  buffer(size)
378 {
379  freeRequests.resize(max_pending);
380  for (auto &e : freeRequests)
381  e.reset(new DmaDoneEvent(this, max_req_size));
382 
383 }
384 
386 {
387  for (auto &p : pendingRequests) {
388  DmaDoneEvent *e(p.release());
389 
390  if (e->done()) {
391  delete e;
392  } else {
393  // We can't kill in-flight DMAs, so we'll just transfer
394  // ownership to the event queue so that they get freed
395  // when they are done.
396  e->kill();
397  }
398  }
399 }
400 
401 void
403 {
404  assert(pendingRequests.empty());
405 
409 }
410 
411 void
413 {
417 }
418 
419 bool
420 DmaReadFifo::tryGet(uint8_t *dst, size_t len)
421 {
422  if (buffer.size() >= len) {
423  buffer.read(dst, len);
424  resumeFill();
425  return true;
426  } else {
427  return false;
428  }
429 }
430 
431 void
432 DmaReadFifo::get(uint8_t *dst, size_t len)
433 {
434  panic_if(!tryGet(dst, len), "Buffer underrun in DmaReadFifo::get()");
435 }
436 
437 void
438 DmaReadFifo::startFill(Addr start, size_t size)
439 {
440  assert(atEndOfBlock());
441 
442  nextAddr = start;
443  endAddr = start + size;
444  resumeFill();
445 }
446 
447 void
449 {
450  // Prevent new DMA requests by setting the next address to the end
451  // address. Pending requests will still complete.
452  nextAddr = endAddr;
453 
454  // Flag in-flight accesses as canceled. This prevents their data
455  // from being written to the FIFO.
456  for (auto &p : pendingRequests)
457  p->cancel();
458 }
459 
460 void
462 {
463  // Don't try to fetch more data if we are draining. This ensures
464  // that the DMA engine settles down before we checkpoint it.
466  return;
467 
468  const bool old_eob(atEndOfBlock());
469 
470  if (port.sys->bypassCaches())
472  else
474 
475  if (!old_eob && atEndOfBlock())
476  onEndOfBlock();
477 }
478 
479 void
481 {
482  const size_t fifo_space = buffer.capacity() - buffer.size();
483  if (fifo_space >= cacheLineSize || buffer.capacity() < cacheLineSize) {
484  const size_t block_remaining = endAddr - nextAddr;
485  const size_t xfer_size = std::min(fifo_space, block_remaining);
486  std::vector<uint8_t> tmp_buffer(xfer_size);
487 
488  assert(pendingRequests.empty());
489  DPRINTF(DMA, "Direct bypass startAddr=%#x xfer_size=%#x " \
490  "fifo_space=%#x block_remaining=%#x\n",
491  nextAddr, xfer_size, fifo_space, block_remaining);
492 
493  port.dmaAction(MemCmd::ReadReq, nextAddr, xfer_size, nullptr,
494  tmp_buffer.data(), 0, reqFlags);
495 
496  buffer.write(tmp_buffer.begin(), xfer_size);
497  nextAddr += xfer_size;
498  }
499 }
500 
501 void
503 {
504  size_t size_pending(0);
505  for (auto &e : pendingRequests)
506  size_pending += e->requestSize();
507 
508  while (!freeRequests.empty() && !atEndOfBlock()) {
509  const size_t req_size(std::min(maxReqSize, endAddr - nextAddr));
510  if (buffer.size() + size_pending + req_size > fifoSize)
511  break;
512 
513  DmaDoneEventUPtr event(std::move(freeRequests.front()));
514  freeRequests.pop_front();
515  assert(event);
516 
517  event->reset(req_size);
518  port.dmaAction(MemCmd::ReadReq, nextAddr, req_size, event.get(),
519  event->data(), 0, reqFlags);
520  nextAddr += req_size;
521  size_pending += req_size;
522 
523  pendingRequests.emplace_back(std::move(event));
524  }
525 }
526 
527 void
529 {
530  const bool old_active(isActive());
531 
532  handlePending();
533  resumeFill();
534 
535  if (old_active && !isActive())
536  onIdle();
537 }
538 
539 void
541 {
542  while (!pendingRequests.empty() && pendingRequests.front()->done()) {
543  // Get the first finished pending request
544  DmaDoneEventUPtr event(std::move(pendingRequests.front()));
545  pendingRequests.pop_front();
546 
547  if (!event->canceled())
548  buffer.write(event->data(), event->requestSize());
549 
550  // Move the event to the list of free requests
551  freeRequests.emplace_back(std::move(event));
552  }
553 
554  if (pendingRequests.empty())
555  signalDrainDone();
556 }
557 
560 {
561  return pendingRequests.empty() ?
563 }
564 
565 
567  : parent(_parent), _data(max_size, 0)
568 {
569 }
570 
571 void
573 {
574  parent = nullptr;
575  setFlags(AutoDelete);
576 }
577 
578 void
580 {
581  _canceled = true;
582 }
583 
584 void
586 {
587  assert(size <= _data.size());
588  _done = false;
589  _canceled = false;
590  _requestSize = size;
591 }
592 
593 void
595 {
596  if (!parent)
597  return;
598 
599  assert(!_done);
600  _done = true;
601  parent->dmaDone();
602 }
603 
604 } // namespace gem5
#define DPRINTF(x,...)
Definition: trace.hh:186
const char data[]
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
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...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: dma_device.cc:363
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: dma_device.cc:148
DmaDevice(const Params &p)
Definition: dma_device.cc:143
DmaDeviceParams Params
Definition: dma_device.hh:209
ClockedObject *const device
The device that owns this port.
Definition: dma_device.hh:150
EventFunctionWrapper sendEvent
Event used to schedule a future sending from the transmit list.
Definition: dma_device.hh:164
System *const sys
The system that device/port are in.
Definition: dma_device.hh:154
void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
Definition: dma_device.cc:196
bool sendAtomicBdReq(DmaReqState *state)
Send the next packet from a DMA request in atomic mode, and request and/or use memory backdoors if po...
Definition: dma_device.cc:258
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: dma_device.cc:167
DmaPort(ClockedObject *dev, System *s, uint32_t sid=0, uint32_t ssid=0)
Definition: dma_device.cc:58
void trySendTimingReq()
Take the first request on the transmit list and attempt to send a timing packet from it.
Definition: dma_device.cc:204
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: dma_device.cc:156
PacketPtr inRetry
The packet (if any) waiting for a retry to send.
Definition: dma_device.hh:170
uint32_t pendingCount
Number of outstanding packets the dma port has.
Definition: dma_device.hh:167
std::deque< DmaReqState * > transmitList
Use a deque as we never do any insertion or removal in the middle.
Definition: dma_device.hh:161
AddrRangeMap< MemBackdoorPtr, 1 > memBackdoors
Definition: dma_device.hh:64
void sendDma()
For timing, attempt to send the first item on the transmit list, and if it is successful and there ar...
Definition: dma_device.cc:330
const uint32_t defaultSid
Default streamId.
Definition: dma_device.hh:173
void handleResp(DmaReqState *state, Addr addr, Addr size, Tick delay=0)
Definition: dma_device.cc:82
const RequestorID requestorId
Id for all requests.
Definition: dma_device.hh:157
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
Definition: dma_device.cc:132
bool sendAtomicReq(DmaReqState *state)
Send the next packet from a DMA request in atomic mode.
Definition: dma_device.cc:244
const uint32_t defaultSSid
Default substreamId.
Definition: dma_device.hh:176
void handleRespPacket(PacketPtr pkt, Tick delay=0)
Handle a response packet by updating the corresponding DMA request state to reflect the bytes receive...
Definition: dma_device.cc:67
const int cacheLineSize
Definition: dma_device.hh:178
DmaDoneEvent(DmaReadFifo *_parent, size_t max_size)
Definition: dma_device.cc:566
Buffered DMA engine helper class.
Definition: dma_device.hh:365
Fifo< uint8_t > buffer
Definition: dma_device.hh:562
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: dma_device.cc:402
size_t size() const
Get the amount of data stored in the FIFO.
Definition: dma_device.hh:427
virtual void onIdle()
Last response received callback.
Definition: dma_device.hh:501
bool tryGet(uint8_t *dst, size_t len)
Try to read data from the FIFO.
Definition: dma_device.cc:420
void startFill(Addr start, size_t size)
Start filling the FIFO.
Definition: dma_device.cc:438
DmaReadFifo(DmaPort &port, size_t size, unsigned max_req_size, unsigned max_pending, Request::Flags flags=0)
Definition: dma_device.cc:371
const Request::Flags reqFlags
Request flags.
Definition: dma_device.hh:510
virtual void onEndOfBlock()
End of block callback.
Definition: dma_device.hh:488
void resumeFill()
Try to issue new DMA requests or bypass DMA requests.
Definition: dma_device.cc:461
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: dma_device.cc:559
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: dma_device.cc:412
std::deque< DmaDoneEventUPtr > freeRequests
Definition: dma_device.hh:568
void dmaDone()
DMA request done, handle incoming data and issue new request.
Definition: dma_device.cc:528
bool isActive() const
Is the DMA engine active (i.e., are there still in-flight accesses)?
Definition: dma_device.hh:470
const int cacheLineSize
Definition: dma_device.hh:514
void stopFill()
Stop the DMA engine.
Definition: dma_device.cc:448
void resumeFillBypass()
Try to bypass DMA requests in non-caching mode.
Definition: dma_device.cc:480
bool atEndOfBlock() const
Has the DMA engine sent out the last request for the active block?
Definition: dma_device.hh:463
const Addr maxReqSize
Maximum request size in bytes.
Definition: dma_device.hh:501
const size_t fifoSize
Maximum FIFO size in bytes.
Definition: dma_device.hh:508
void handlePending()
Handle pending requests that have been flagged as done.
Definition: dma_device.cc:540
void resumeFillTiming()
Try to issue new DMA requests during normal execution.
Definition: dma_device.cc:502
std::unique_ptr< DmaDoneEvent > DmaDoneEventUPtr
Definition: dma_device.hh:541
std::deque< DmaDoneEventUPtr > pendingRequests
Definition: dma_device.hh:567
void write(InputIterator in, size_t len)
Definition: circlebuf.hh:234
size_t capacity() const
Definition: circlebuf.hh:223
size_t size() const
Definition: circlebuf.hh:222
void read(OutputIterator out, size_t len)
Definition: circlebuf.hh:230
const std::string & toString() const
Return the string to a cmd given by idx.
Definition: packet.hh:275
bool isRead() const
Definition: packet.hh:226
Command
List of all commands associated with a packet.
Definition: packet.hh:84
virtual std::string name() const
Definition: named.hh:47
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
Addr getAddr() const
Definition: packet.hh:805
bool isResponse() const
Definition: packet.hh:597
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Definition: packet.hh:1162
SenderState * senderState
This packet's sender state.
Definition: packet.hh:544
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
Definition: packet.hh:587
RequestPtr req
A pointer to the original request.
Definition: packet.hh:376
bool cacheResponding() const
Definition: packet.hh:657
bool hasSharers() const
Definition: packet.hh:684
This device is the base class which all devices senstive to an address range inherit from.
Definition: io_device.hh:103
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: io_device.cc:67
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: io_device.cc:59
Ports are used to interface objects to each other.
Definition: port.hh:62
bool isConnected() const
Is this port currently connected to a peer?
Definition: port.hh:133
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:79
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
Definition: port.hh:464
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
Definition: port.hh:495
Tick sendAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor)
Send an atomic request packet like above, but also request a backdoor to the data being accessed.
Definition: port.hh:474
bool isAtomicMode() const
Is the system in atomic mode?
Definition: system.hh:261
bool isTimingMode() const
Is the system in timing mode?
Definition: system.hh:273
bool bypassCaches() const
Should caches be bypassed?
Definition: system.hh:282
ClockedObject declaration and implementation.
Addr addr() const
Return starting address of current chunk.
Addr complete() const
Number of bytes we have already chunked up.
Addr size() const
Return size in bytes of current chunk.
void signalDrainDone() const
Signal that an object is drained.
Definition: drain.hh:305
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:324
DrainState
Object drain/handover states.
Definition: drain.hh:75
@ Draining
Draining buffers pending serialization/handover.
@ Drained
Buffers drained, ready for serialization/handover.
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:465
void schedule(Event &event, Tick when)
Definition: eventq.hh:1019
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:204
#define UNSERIALIZE_CONTAINER(member)
Definition: serialize.hh:634
#define SERIALIZE_CONTAINER(member)
Definition: serialize.hh:626
atomic_var_t state
Definition: helpers.cc:188
uint16_t len
Definition: helpers.cc:62
uint8_t flags
Definition: helpers.cc:66
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
Definition: utility.cc:65
Bitfield< 23, 0 > offset
Definition: types.hh:144
Bitfield< 9 > e
Definition: misc_types.hh:65
Bitfield< 10, 5 > event
Bitfield< 15, 2 > bd
Definition: types.hh:79
Bitfield< 1 > s
Definition: pagetable.hh:64
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 3 > addr
Definition: types.hh:84
ProbePointArg< PacketInfo > Packet
Packet probe point.
Definition: mem.hh:109
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
uint64_t Tick
Tick count type.
Definition: types.hh:58
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:575
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:568
const Packet::Command cmd
Command for the request.
Definition: dma_device.hh:114
const uint32_t sid
Stream IDs.
Definition: dma_device.hh:110
ChunkGenerator gen
Object to track what chunks of bytes to send at a time.
Definition: dma_device.hh:98
uint8_t *const data
Pointer to a buffer for the data.
Definition: dma_device.hh:101
const Request::Flags flags
The flags to use for requests.
Definition: dma_device.hh:104
const std::string & name()
Definition: trace.cc:49

Generated on Wed Dec 21 2022 10:22:33 for gem5 by doxygen 1.9.1