gem5  v20.0.0.3
copy_engine.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 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) 2008 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 /* @file
42  * Device model for Intel's I/O AT DMA copy engine.
43  */
44 
45 #include "dev/pci/copy_engine.hh"
46 
47 #include <algorithm>
48 
49 #include "base/cp_annotate.hh"
50 #include "base/trace.hh"
51 #include "debug/DMACopyEngine.hh"
52 #include "debug/Drain.hh"
53 #include "mem/packet.hh"
54 #include "mem/packet_access.hh"
55 #include "params/CopyEngine.hh"
56 #include "sim/stats.hh"
57 #include "sim/system.hh"
58 
59 using namespace CopyEngineReg;
60 
62  : PciDevice(p)
63 {
64  // All Reg regs are initialized to 0 by default
65  regs.chanCount = p->ChanCnt;
66  regs.xferCap = findMsbSet(p->XferCap);
67  regs.attnStatus = 0;
68 
69  if (regs.chanCount > 64)
70  fatal("CopyEngine interface doesn't support more than 64 DMA engines\n");
71 
72  for (int x = 0; x < regs.chanCount; x++) {
73  CopyEngineChannel *ch = new CopyEngineChannel(this, x);
74  chan.push_back(ch);
75  }
76 }
77 
78 
80  : cePort(_ce, _ce->sys),
81  ce(_ce), channelId(cid), busy(false), underReset(false),
82  refreshNext(false), latBeforeBegin(ce->params()->latBeforeBegin),
83  latAfterCompletion(ce->params()->latAfterCompletion),
84  completionDataReg(0), nextState(Idle),
85  fetchCompleteEvent([this]{ fetchDescComplete(); }, name()),
86  addrCompleteEvent([this]{ fetchAddrComplete(); }, name()),
90 
91 {
92  cr.status.dma_transfer_status(3);
93  cr.descChainAddr = 0;
94  cr.completionAddr = 0;
95 
96  curDmaDesc = new DmaDesc;
97  memset(curDmaDesc, 0, sizeof(DmaDesc));
98  copyBuffer = new uint8_t[ce->params()->XferCap];
99 }
100 
102 {
103  for (int x = 0; x < chan.size(); x++) {
104  delete chan[x];
105  }
106 }
107 
109 {
110  delete curDmaDesc;
111  delete [] copyBuffer;
112 }
113 
114 Port &
115 CopyEngine::getPort(const std::string &if_name, PortID idx)
116 {
117  if (if_name != "dma") {
118  // pass it along to our super class
119  return PciDevice::getPort(if_name, idx);
120  } else {
121  if (idx >= static_cast<int>(chan.size())) {
122  panic("CopyEngine::getPort: unknown index %d\n", idx);
123  }
124 
125  return chan[idx]->getPort();
126  }
127 }
128 
129 
130 Port &
132 {
133  return cePort;
134 }
135 
136 void
138 {
139  if (cr.command.start_dma()) {
140  assert(!busy);
141  cr.status.dma_transfer_status(0);
146  } else if (cr.command.append_dma()) {
147  if (!busy) {
151  } else
152  refreshNext = true;
153  } else if (cr.command.reset_dma()) {
154  if (busy)
155  underReset = true;
156  else {
157  cr.status.dma_transfer_status(3);
158  nextState = Idle;
159  }
160  } else if (cr.command.resume_dma() || cr.command.abort_dma() ||
161  cr.command.suspend_dma())
162  panic("Resume, Abort, and Suspend are not supported\n");
163  cr.command(0);
164 }
165 
166 Tick
168 {
169  int bar;
170  Addr daddr;
171 
172  if (!getBAR(pkt->getAddr(), bar, daddr))
173  panic("Invalid PCI memory access to unmapped memory.\n");
174 
175  // Only Memory register BAR is allowed
176  assert(bar == 0);
177 
178  int size = pkt->getSize();
179  if (size != sizeof(uint64_t) && size != sizeof(uint32_t) &&
180  size != sizeof(uint16_t) && size != sizeof(uint8_t)) {
181  panic("Unknown size for MMIO access: %d\n", pkt->getSize());
182  }
183 
184  DPRINTF(DMACopyEngine, "Read device register %#X size: %d\n", daddr, size);
185 
189 
190  if (daddr < 0x80) {
191  switch (daddr) {
192  case GEN_CHANCOUNT:
193  assert(size == sizeof(regs.chanCount));
194  pkt->setLE<uint8_t>(regs.chanCount);
195  break;
196  case GEN_XFERCAP:
197  assert(size == sizeof(regs.xferCap));
198  pkt->setLE<uint8_t>(regs.xferCap);
199  break;
200  case GEN_INTRCTRL:
201  assert(size == sizeof(uint8_t));
202  pkt->setLE<uint8_t>(regs.intrctrl());
203  regs.intrctrl.master_int_enable(0);
204  break;
205  case GEN_ATTNSTATUS:
206  assert(size == sizeof(regs.attnStatus));
207  pkt->setLE<uint32_t>(regs.attnStatus);
208  regs.attnStatus = 0;
209  break;
210  default:
211  panic("Read request to unknown register number: %#x\n", daddr);
212  }
213  pkt->makeAtomicResponse();
214  return pioDelay;
215  }
216 
217 
218  // Find which channel we're accessing
219  int chanid = 0;
220  daddr -= 0x80;
221  while (daddr >= 0x80) {
222  chanid++;
223  daddr -= 0x80;
224  }
225 
226  if (chanid >= regs.chanCount)
227  panic("Access to channel %d (device only configured for %d channels)",
228  chanid, regs.chanCount);
229 
233  chan[chanid]->channelRead(pkt, daddr, size);
234 
235  pkt->makeAtomicResponse();
236  return pioDelay;
237 }
238 
239 void
241 {
242  switch (daddr) {
243  case CHAN_CONTROL:
244  assert(size == sizeof(uint16_t));
245  pkt->setLE<uint16_t>(cr.ctrl());
246  cr.ctrl.in_use(1);
247  break;
248  case CHAN_STATUS:
249  assert(size == sizeof(uint64_t));
250  pkt->setLE<uint64_t>(cr.status() | (busy ? 0 : 1));
251  break;
252  case CHAN_CHAINADDR:
253  assert(size == sizeof(uint64_t) || size == sizeof(uint32_t));
254  if (size == sizeof(uint64_t))
255  pkt->setLE<uint64_t>(cr.descChainAddr);
256  else
257  pkt->setLE<uint32_t>(bits(cr.descChainAddr,0,31));
258  break;
259  case CHAN_CHAINADDR_HIGH:
260  assert(size == sizeof(uint32_t));
261  pkt->setLE<uint32_t>(bits(cr.descChainAddr,32,63));
262  break;
263  case CHAN_COMMAND:
264  assert(size == sizeof(uint8_t));
265  pkt->setLE<uint32_t>(cr.command());
266  break;
267  case CHAN_CMPLNADDR:
268  assert(size == sizeof(uint64_t) || size == sizeof(uint32_t));
269  if (size == sizeof(uint64_t))
270  pkt->setLE<uint64_t>(cr.completionAddr);
271  else
272  pkt->setLE<uint32_t>(bits(cr.completionAddr,0,31));
273  break;
274  case CHAN_CMPLNADDR_HIGH:
275  assert(size == sizeof(uint32_t));
276  pkt->setLE<uint32_t>(bits(cr.completionAddr,32,63));
277  break;
278  case CHAN_ERROR:
279  assert(size == sizeof(uint32_t));
280  pkt->setLE<uint32_t>(cr.error());
281  break;
282  default:
283  panic("Read request to unknown channel register number: (%d)%#x\n",
284  channelId, daddr);
285  }
286 }
287 
288 
289 Tick
291 {
292  int bar;
293  Addr daddr;
294 
295 
296  if (!getBAR(pkt->getAddr(), bar, daddr))
297  panic("Invalid PCI memory access to unmapped memory.\n");
298 
299  // Only Memory register BAR is allowed
300  assert(bar == 0);
301 
302  int size = pkt->getSize();
303 
307 
308  if (size == sizeof(uint64_t)) {
309  uint64_t val M5_VAR_USED = pkt->getLE<uint64_t>();
310  DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
311  daddr, val);
312  } else if (size == sizeof(uint32_t)) {
313  uint32_t val M5_VAR_USED = pkt->getLE<uint32_t>();
314  DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
315  daddr, val);
316  } else if (size == sizeof(uint16_t)) {
317  uint16_t val M5_VAR_USED = pkt->getLE<uint16_t>();
318  DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
319  daddr, val);
320  } else if (size == sizeof(uint8_t)) {
321  uint8_t val M5_VAR_USED = pkt->getLE<uint8_t>();
322  DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
323  daddr, val);
324  } else {
325  panic("Unknown size for MMIO access: %d\n", size);
326  }
327 
328  if (daddr < 0x80) {
329  switch (daddr) {
330  case GEN_CHANCOUNT:
331  case GEN_XFERCAP:
332  case GEN_ATTNSTATUS:
333  DPRINTF(DMACopyEngine, "Warning, ignorning write to register %x\n",
334  daddr);
335  break;
336  case GEN_INTRCTRL:
337  regs.intrctrl.master_int_enable(bits(pkt->getLE<uint8_t>(), 0, 1));
338  break;
339  default:
340  panic("Read request to unknown register number: %#x\n", daddr);
341  }
342  pkt->makeAtomicResponse();
343  return pioDelay;
344  }
345 
346  // Find which channel we're accessing
347  int chanid = 0;
348  daddr -= 0x80;
349  while (daddr >= 0x80) {
350  chanid++;
351  daddr -= 0x80;
352  }
353 
354  if (chanid >= regs.chanCount)
355  panic("Access to channel %d (device only configured for %d channels)",
356  chanid, regs.chanCount);
357 
361  chan[chanid]->channelWrite(pkt, daddr, size);
362 
363  pkt->makeAtomicResponse();
364  return pioDelay;
365 }
366 
367 void
369 {
370  switch (daddr) {
371  case CHAN_CONTROL:
372  assert(size == sizeof(uint16_t));
373  int old_int_disable;
374  old_int_disable = cr.ctrl.interrupt_disable();
375  cr.ctrl(pkt->getLE<uint16_t>());
376  if (cr.ctrl.interrupt_disable())
377  cr.ctrl.interrupt_disable(0);
378  else
379  cr.ctrl.interrupt_disable(old_int_disable);
380  break;
381  case CHAN_STATUS:
382  assert(size == sizeof(uint64_t));
383  DPRINTF(DMACopyEngine, "Warning, ignorning write to register %x\n",
384  daddr);
385  break;
386  case CHAN_CHAINADDR:
387  assert(size == sizeof(uint64_t) || size == sizeof(uint32_t));
388  if (size == sizeof(uint64_t))
389  cr.descChainAddr = pkt->getLE<uint64_t>();
390  else
391  cr.descChainAddr = (uint64_t)pkt->getLE<uint32_t>() |
392  (cr.descChainAddr & ~mask(32));
393  DPRINTF(DMACopyEngine, "Chain Address %x\n", cr.descChainAddr);
394  break;
395  case CHAN_CHAINADDR_HIGH:
396  assert(size == sizeof(uint32_t));
397  cr.descChainAddr = ((uint64_t)pkt->getLE<uint32_t>() << 32) |
398  (cr.descChainAddr & mask(32));
399  DPRINTF(DMACopyEngine, "Chain Address %x\n", cr.descChainAddr);
400  break;
401  case CHAN_COMMAND:
402  assert(size == sizeof(uint8_t));
403  cr.command(pkt->getLE<uint8_t>());
404  recvCommand();
405  break;
406  case CHAN_CMPLNADDR:
407  assert(size == sizeof(uint64_t) || size == sizeof(uint32_t));
408  if (size == sizeof(uint64_t))
409  cr.completionAddr = pkt->getLE<uint64_t>();
410  else
411  cr.completionAddr = pkt->getLE<uint32_t>() |
412  (cr.completionAddr & ~mask(32));
413  break;
414  case CHAN_CMPLNADDR_HIGH:
415  assert(size == sizeof(uint32_t));
416  cr.completionAddr = ((uint64_t)pkt->getLE<uint32_t>() <<32) |
417  (cr.completionAddr & mask(32));
418  break;
419  case CHAN_ERROR:
420  assert(size == sizeof(uint32_t));
421  cr.error(~pkt->getLE<uint32_t>() & cr.error());
422  break;
423  default:
424  panic("Read request to unknown channel register number: (%d)%#x\n",
425  channelId, daddr);
426  }
427 }
428 
429 void
431 {
433 
434  using namespace Stats;
437  .name(name() + ".bytes_copied")
438  .desc("Number of bytes copied by each engine")
439  .flags(total)
440  ;
443  .name(name() + ".copies_processed")
444  .desc("Number of copies processed by each engine")
445  .flags(total)
446  ;
447 }
448 
449 void
451 {
452  anDq();
453  anBegin("FetchDescriptor");
454  DPRINTF(DMACopyEngine, "Reading descriptor from at memory location %#x(%#x)\n",
455  address, ce->pciToDma(address));
456  assert(address);
457  busy = true;
458 
459  DPRINTF(DMACopyEngine, "dmaAction: %#x, %d bytes, to addr %#x\n",
460  ce->pciToDma(address), sizeof(DmaDesc), curDmaDesc);
461 
463  sizeof(DmaDesc), &fetchCompleteEvent,
464  (uint8_t*)curDmaDesc, latBeforeBegin);
465  lastDescriptorAddr = address;
466 }
467 
468 void
470 {
471  DPRINTF(DMACopyEngine, "Read of descriptor complete\n");
472 
473  if ((curDmaDesc->command & DESC_CTRL_NULL)) {
474  DPRINTF(DMACopyEngine, "Got NULL descriptor, skipping\n");
475  assert(!(curDmaDesc->command & DESC_CTRL_CP_STS));
477  panic("Shouldn't be able to get here\n");
479  if (inDrain()) return;
481  } else {
482  anBegin("Idle");
483  anWait();
484  busy = false;
485  nextState = Idle;
486  inDrain();
487  }
488  return;
489  }
490 
492  panic("Descriptor has flag other that completion status set\n");
493 
494  nextState = DMARead;
495  if (inDrain()) return;
496  readCopyBytes();
497 }
498 
499 void
501 {
502  anBegin("ReadCopyBytes");
503  DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n",
508 }
509 
510 void
512 {
513  DPRINTF(DMACopyEngine, "Read of bytes to copy complete\n");
514 
516  if (inDrain()) return;
517  writeCopyBytes();
518 }
519 
520 void
522 {
523  anBegin("WriteCopyBytes");
524  DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location %#x(%#x)\n",
527 
530 
533 }
534 
535 void
537 {
538  DPRINTF(DMACopyEngine, "Write of bytes to copy complete user1: %#x\n",
539  curDmaDesc->user1);
540 
541  cr.status.compl_desc_addr(lastDescriptorAddr >> 6);
542  completionDataReg = cr.status() | 1;
543 
544  anQ("DMAUsedDescQ", channelId, 1);
545  anQ("AppRecvQ", curDmaDesc->user1, curDmaDesc->len);
548  if (inDrain()) return;
550  return;
551  }
552 
554 }
555 
556 void
558 {
559  busy = false;
560 
561  if (underReset) {
562  anBegin("Reset");
563  anWait();
564  underReset = false;
565  refreshNext = false;
566  busy = false;
567  nextState = Idle;
568  return;
569  }
570 
571  if (curDmaDesc->next) {
574  if (inDrain()) return;
576  } else if (refreshNext) {
578  refreshNext = false;
579  if (inDrain()) return;
581  } else {
582  inDrain();
583  nextState = Idle;
584  anWait();
585  anBegin("Idle");
586  }
587 }
588 
589 void
591 {
592  anBegin("WriteCompletionStatus");
593  DPRINTF(DMACopyEngine, "Writing completion status %#x to address %#x(%#x)\n",
596 
601 }
602 
603 void
605 {
606  DPRINTF(DMACopyEngine, "Writing completion status complete\n");
608 }
609 
610 void
612 {
613  anBegin("FetchNextAddr");
614  DPRINTF(DMACopyEngine, "Fetching next address...\n");
615  busy = true;
617  ce->pciToDma(address + offsetof(DmaDesc, next)),
618  sizeof(Addr), &addrCompleteEvent,
619  (uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0);
620 }
621 
622 void
624 {
625  DPRINTF(DMACopyEngine, "Fetching next address complete: %#x\n",
626  curDmaDesc->next);
627  if (!curDmaDesc->next) {
628  DPRINTF(DMACopyEngine, "Got NULL descriptor, nothing more to do\n");
629  busy = false;
630  nextState = Idle;
631  anWait();
632  anBegin("Idle");
633  inDrain();
634  return;
635  }
638  if (inDrain()) return;
640 }
641 
642 bool
644 {
645  if (drainState() == DrainState::Draining) {
646  DPRINTF(Drain, "CopyEngine done draining, processing drain event\n");
647  signalDrainDone();
648  }
649 
650  return ce->drainState() != DrainState::Running;
651 }
652 
655 {
656  if (nextState == Idle || ce->drainState() != DrainState::Running) {
657  return DrainState::Drained;
658  } else {
659  DPRINTF(Drain, "CopyEngineChannel not drained\n");
660  return DrainState::Draining;
661  }
662 }
663 
664 void
666 {
668  regs.serialize(cp);
669  for (int x =0; x < chan.size(); x++)
670  chan[x]->serializeSection(cp, csprintf("channel%d", x));
671 }
672 
673 void
675 {
677  regs.unserialize(cp);
678  for (int x = 0; x < chan.size(); x++)
679  chan[x]->unserializeSection(cp, csprintf("channel%d", x));
680 }
681 
682 void
684 {
692  int nextState = this->nextState;
693  SERIALIZE_SCALAR(nextState);
694  arrayParamOut(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc));
695  SERIALIZE_ARRAY(copyBuffer, ce->params()->XferCap);
696  cr.serialize(cp);
697 
698 }
699 void
701 {
709  int nextState;
710  UNSERIALIZE_SCALAR(nextState);
711  this->nextState = (ChannelState)nextState;
712  arrayParamIn(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc));
713  UNSERIALIZE_ARRAY(copyBuffer, ce->params()->XferCap);
714  cr.unserialize(cp);
715 
716 }
717 
718 void
720 {
721  switch(nextState) {
722  case AddressFetch:
724  break;
725  case DescriptorFetch:
727  break;
728  case DMARead:
729  readCopyBytes();
730  break;
731  case DMAWrite:
732  writeCopyBytes();
733  break;
734  case CompletionWrite:
736  break;
737  case Idle:
738  break;
739  default:
740  panic("Unknown state for CopyEngineChannel\n");
741  }
742 }
743 
744 void
746 {
747  DPRINTF(DMACopyEngine, "Restarting state machine at state %d\n", nextState);
749 }
750 
751 CopyEngine *
752 CopyEngineParams::create()
753 {
754  return new CopyEngine(this);
755 }
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:163
EventFunctionWrapper fetchCompleteEvent
Definition: copy_engine.hh:116
#define DPRINTF(x,...)
Definition: trace.hh:225
void anBegin(const char *s)
Definition: copy_engine.hh:139
Ports are used to interface objects to each other.
Definition: port.hh:56
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
Definition: device.cc:507
const uint32_t CHAN_CHAINADDR_HIGH
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:171
EventFunctionWrapper statusCompleteEvent
Definition: copy_engine.hh:132
const uint32_t CHAN_CHAINADDR
Addr pciToDma(Addr pci_addr) const
Definition: device.hh:194
void fetchDescriptor(Addr address)
Definition: copy_engine.cc:450
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const uint32_t DESC_CTRL_CP_STS
PCI device, base implementation is only config space.
Definition: device.hh:66
const uint32_t CHAN_CMPLNADDR_HIGH
const uint32_t CHAN_STATUS
void channelWrite(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:368
Bitfield< 29, 28 > ce
void anQ(const char *s, uint64_t id, int size=1)
Definition: copy_engine.hh:163
EventFunctionWrapper readCompleteEvent
Definition: copy_engine.hh:124
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:665
void serialize(CheckpointOut &cp) const override
Serialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:683
Definition: cprintf.cc:40
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:700
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:333
DrainState
Object drain/handover states.
Definition: drain.hh:71
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:171
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1149
Bitfield< 63 > val
Definition: misc.hh:769
void setLE(T v)
Set the value in the data pointer to v as little endian.
Bitfield< 3 > x
Definition: pagetable.hh:69
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:308
const uint32_t GEN_XFERCAP
unsigned getSize() const
Definition: packet.hh:730
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:770
Draining buffers pending serialization/handover.
Stats::Vector copiesProcessed
Definition: copy_engine.hh:174
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
void serialize(CheckpointOut &cp) const override
Serialize an object.
void makeAtomicResponse()
Definition: packet.hh:943
DmaDeviceParams Params
Definition: dma_device.hh:171
uint64_t Tick
Tick count type.
Definition: types.hh:61
const uint32_t CHAN_CONTROL
CopyEngineReg::Regs regs
Definition: copy_engine.hh:177
Addr getAddr() const
Definition: packet.hh:720
void channelRead(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:240
int getBAR(Addr addr)
Which base address register (if any) maps the given address?
Definition: device.hh:139
Tick pioDelay
Definition: device.hh:190
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:167
void arrayParamOut(CheckpointOut &cp, const std::string &name, const CircleBuf< T > &param)
Definition: circlebuf.hh:174
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:290
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: dma_device.cc:277
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
std::vector< CopyEngineChannel * > chan
Definition: copy_engine.hh:180
System * sys
Definition: io_device.hh:102
CopyEngineReg::ChanRegs cr
Definition: copy_engine.hh:66
const uint32_t DESC_CTRL_NULL
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:249
#define SERIALIZE_ARRAY(member, size)
Definition: serialize.hh:805
CopyEngineReg::DmaDesc * curDmaDesc
Definition: copy_engine.hh:68
void regStats() override
Callback to set stat parameters.
Definition: copy_engine.cc:430
const FlagsType total
Print the total.
Definition: info.hh:49
RequestPtr dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
Definition: dma_device.cc:197
const uint32_t CHAN_COMMAND
CopyEngineChannel(CopyEngine *_ce, int cid)
Definition: copy_engine.cc:79
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:763
const uint32_t GEN_ATTNSTATUS
void drainResume() override
Resume execution after a successful drain.
Definition: copy_engine.cc:745
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:276
#define UNSERIALIZE_ARRAY(member, size)
Definition: serialize.hh:813
EventFunctionWrapper writeCompleteEvent
Definition: copy_engine.hh:128
Declaration of the Packet class.
std::ostream CheckpointOut
Definition: serialize.hh:63
const uint32_t GEN_CHANCOUNT
void signalDrainDone() const
Signal that an object is drained.
Definition: drain.hh:289
Stats::Vector bytesCopied
Definition: copy_engine.hh:173
const uint32_t CHAN_ERROR
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Definition: bitfield.hh:203
const uint32_t GEN_INTRCTRL
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf< T > &param)
Definition: circlebuf.hh:184
EventFunctionWrapper addrCompleteEvent
Definition: copy_engine.hh:120
Bitfield< 3, 0 > mask
Definition: types.hh:62
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:309
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:235
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:64
T bits(T val, int first, int last)
Extract the bitfield from position &#39;first&#39; to &#39;last&#39; (inclusive) from &#39;val&#39; and right justify it...
Definition: bitfield.hh:71
CopyEngine(const Params *params)
Definition: copy_engine.cc:61
Bitfield< 0 > p
Running normally.
const uint32_t CHAN_CMPLNADDR
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:674
DrainState drain() override
Notify an object that it needs to drain its state.
Definition: copy_engine.cc:654
const Params * params() const
Definition: copy_engine.hh:185
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
Definition: device.cc:442
void fetchNextAddr(Addr address)
Definition: copy_engine.cc:611
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: copy_engine.cc:115
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:178
void unserialize(CheckpointIn &cp) override
Unserialize an object.

Generated on Fri Jul 3 2020 15:53:02 for gem5 by doxygen 1.8.13