gem5  v21.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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/trace.hh"
50 #include "debug/DMACopyEngine.hh"
51 #include "debug/Drain.hh"
52 #include "mem/packet.hh"
53 #include "mem/packet_access.hh"
54 #include "params/CopyEngine.hh"
55 #include "sim/stats.hh"
56 #include "sim/system.hh"
57 
58 using namespace CopyEngineReg;
59 
61  : PciDevice(p),
62  copyEngineStats(this, p.ChanCnt)
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()),
87  readCompleteEvent([this]{ readCopyBytesComplete(); }, name()),
88  writeCompleteEvent([this]{ writeCopyBytesComplete(); }, name()),
89  statusCompleteEvent([this]{ writeStatusComplete(); }, 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);
142  nextState = DescriptorFetch;
143  fetchAddress = cr.descChainAddr;
144  if (ce->drainState() == DrainState::Running)
145  fetchDescriptor(cr.descChainAddr);
146  } else if (cr.command.append_dma()) {
147  if (!busy) {
148  nextState = AddressFetch;
149  if (ce->drainState() == DrainState::Running)
150  fetchNextAddr(lastDescriptorAddr);
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  M5_VAR_USED uint64_t val = 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  M5_VAR_USED uint32_t val = 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  M5_VAR_USED uint16_t val = 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  M5_VAR_USED uint8_t val = 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 
431  const uint8_t &channel_count)
432  : Stats::Group(parent, "CopyEngine"),
433  ADD_STAT(bytesCopied, UNIT_BYTE,
434  "Number of bytes copied by each engine"),
435  ADD_STAT(copiesProcessed, UNIT_COUNT,
436  "Number of copies processed by each engine")
437 {
439  .init(channel_count)
441  ;
443  .init(channel_count)
445  ;
446 }
447 
448 void
450 {
451  DPRINTF(DMACopyEngine, "Reading descriptor from at memory location %#x(%#x)\n",
452  address, ce->pciToDma(address));
453  assert(address);
454  busy = true;
455 
456  DPRINTF(DMACopyEngine, "dmaAction: %#x, %d bytes, to addr %#x\n",
457  ce->pciToDma(address), sizeof(DmaDesc), curDmaDesc);
458 
459  cePort.dmaAction(MemCmd::ReadReq, ce->pciToDma(address),
460  sizeof(DmaDesc), &fetchCompleteEvent,
461  (uint8_t*)curDmaDesc, latBeforeBegin);
462  lastDescriptorAddr = address;
463 }
464 
465 void
467 {
468  DPRINTF(DMACopyEngine, "Read of descriptor complete\n");
469 
470  if ((curDmaDesc->command & DESC_CTRL_NULL)) {
471  DPRINTF(DMACopyEngine, "Got NULL descriptor, skipping\n");
472  assert(!(curDmaDesc->command & DESC_CTRL_CP_STS));
473  if (curDmaDesc->command & DESC_CTRL_CP_STS) {
474  panic("Shouldn't be able to get here\n");
475  nextState = CompletionWrite;
476  if (inDrain()) return;
477  writeCompletionStatus();
478  } else {
479  busy = false;
480  nextState = Idle;
481  inDrain();
482  }
483  return;
484  }
485 
486  if (curDmaDesc->command & ~DESC_CTRL_CP_STS)
487  panic("Descriptor has flag other that completion status set\n");
488 
489  nextState = DMARead;
490  if (inDrain()) return;
491  readCopyBytes();
492 }
493 
494 void
496 {
497  DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n",
498  curDmaDesc->len, curDmaDesc->dest,
499  ce->pciToDma(curDmaDesc->src));
500  cePort.dmaAction(MemCmd::ReadReq, ce->pciToDma(curDmaDesc->src),
501  curDmaDesc->len, &readCompleteEvent, copyBuffer, 0);
502 }
503 
504 void
506 {
507  DPRINTF(DMACopyEngine, "Read of bytes to copy complete\n");
508 
509  nextState = DMAWrite;
510  if (inDrain()) return;
511  writeCopyBytes();
512 }
513 
514 void
516 {
517  DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location %#x(%#x)\n",
518  curDmaDesc->len, curDmaDesc->dest,
519  ce->pciToDma(curDmaDesc->dest));
520 
521  cePort.dmaAction(MemCmd::WriteReq, ce->pciToDma(curDmaDesc->dest),
522  curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0);
523 
524  ce->copyEngineStats.bytesCopied[channelId] += curDmaDesc->len;
525  ce->copyEngineStats.copiesProcessed[channelId]++;
526 }
527 
528 void
530 {
531  DPRINTF(DMACopyEngine, "Write of bytes to copy complete user1: %#x\n",
532  curDmaDesc->user1);
533 
534  cr.status.compl_desc_addr(lastDescriptorAddr >> 6);
535  completionDataReg = cr.status() | 1;
536 
537  if (curDmaDesc->command & DESC_CTRL_CP_STS) {
538  nextState = CompletionWrite;
539  if (inDrain()) return;
540  writeCompletionStatus();
541  return;
542  }
543 
544  continueProcessing();
545 }
546 
547 void
549 {
550  busy = false;
551 
552  if (underReset) {
553  underReset = false;
554  refreshNext = false;
555  busy = false;
556  nextState = Idle;
557  return;
558  }
559 
560  if (curDmaDesc->next) {
561  nextState = DescriptorFetch;
562  fetchAddress = curDmaDesc->next;
563  if (inDrain()) return;
564  fetchDescriptor(curDmaDesc->next);
565  } else if (refreshNext) {
566  nextState = AddressFetch;
567  refreshNext = false;
568  if (inDrain()) return;
569  fetchNextAddr(lastDescriptorAddr);
570  } else {
571  inDrain();
572  nextState = Idle;
573  }
574 }
575 
576 void
578 {
579  DPRINTF(DMACopyEngine, "Writing completion status %#x to address %#x(%#x)\n",
580  completionDataReg, cr.completionAddr,
581  ce->pciToDma(cr.completionAddr));
582 
583  cePort.dmaAction(MemCmd::WriteReq,
584  ce->pciToDma(cr.completionAddr),
585  sizeof(completionDataReg), &statusCompleteEvent,
586  (uint8_t*)&completionDataReg, latAfterCompletion);
587 }
588 
589 void
591 {
592  DPRINTF(DMACopyEngine, "Writing completion status complete\n");
593  continueProcessing();
594 }
595 
596 void
598 {
599  DPRINTF(DMACopyEngine, "Fetching next address...\n");
600  busy = true;
601  cePort.dmaAction(MemCmd::ReadReq,
602  ce->pciToDma(address + offsetof(DmaDesc, next)),
603  sizeof(Addr), &addrCompleteEvent,
604  (uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0);
605 }
606 
607 void
609 {
610  DPRINTF(DMACopyEngine, "Fetching next address complete: %#x\n",
611  curDmaDesc->next);
612  if (!curDmaDesc->next) {
613  DPRINTF(DMACopyEngine, "Got NULL descriptor, nothing more to do\n");
614  busy = false;
615  nextState = Idle;
616  inDrain();
617  return;
618  }
619  nextState = DescriptorFetch;
620  fetchAddress = curDmaDesc->next;
621  if (inDrain()) return;
622  fetchDescriptor(curDmaDesc->next);
623 }
624 
625 bool
627 {
628  if (drainState() == DrainState::Draining) {
629  DPRINTF(Drain, "CopyEngine done draining, processing drain event\n");
630  signalDrainDone();
631  }
632 
633  return ce->drainState() != DrainState::Running;
634 }
635 
638 {
639  if (nextState == Idle || ce->drainState() != DrainState::Running) {
640  return DrainState::Drained;
641  } else {
642  DPRINTF(Drain, "CopyEngineChannel not drained\n");
643  return DrainState::Draining;
644  }
645 }
646 
647 void
649 {
651  regs.serialize(cp);
652  for (int x =0; x < chan.size(); x++)
653  chan[x]->serializeSection(cp, csprintf("channel%d", x));
654 }
655 
656 void
658 {
661  for (int x = 0; x < chan.size(); x++)
662  chan[x]->unserializeSection(cp, csprintf("channel%d", x));
663 }
664 
665 void
667 {
668  SERIALIZE_SCALAR(channelId);
669  SERIALIZE_SCALAR(busy);
670  SERIALIZE_SCALAR(underReset);
671  SERIALIZE_SCALAR(refreshNext);
672  SERIALIZE_SCALAR(lastDescriptorAddr);
673  SERIALIZE_SCALAR(completionDataReg);
674  SERIALIZE_SCALAR(fetchAddress);
675  int nextState = this->nextState;
676  SERIALIZE_SCALAR(nextState);
677  arrayParamOut(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc));
678  SERIALIZE_ARRAY(copyBuffer, ce->params().XferCap);
679  cr.serialize(cp);
680 
681 }
682 void
684 {
685  UNSERIALIZE_SCALAR(channelId);
686  UNSERIALIZE_SCALAR(busy);
687  UNSERIALIZE_SCALAR(underReset);
688  UNSERIALIZE_SCALAR(refreshNext);
689  UNSERIALIZE_SCALAR(lastDescriptorAddr);
690  UNSERIALIZE_SCALAR(completionDataReg);
691  UNSERIALIZE_SCALAR(fetchAddress);
692  int nextState;
693  UNSERIALIZE_SCALAR(nextState);
694  this->nextState = (ChannelState)nextState;
695  arrayParamIn(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc));
696  UNSERIALIZE_ARRAY(copyBuffer, ce->params().XferCap);
697  cr.unserialize(cp);
698 
699 }
700 
701 void
703 {
704  switch(nextState) {
705  case AddressFetch:
706  fetchNextAddr(lastDescriptorAddr);
707  break;
708  case DescriptorFetch:
709  fetchDescriptor(fetchAddress);
710  break;
711  case DMARead:
712  readCopyBytes();
713  break;
714  case DMAWrite:
715  writeCopyBytes();
716  break;
717  case CompletionWrite:
718  writeCompletionStatus();
719  break;
720  case Idle:
721  break;
722  default:
723  panic("Unknown state for CopyEngineChannel\n");
724  }
725 }
726 
727 void
729 {
730  DPRINTF(DMACopyEngine, "Restarting state machine at state %d\n", nextState);
731  restartStateMachine();
732 }
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
CopyEngineReg::CHAN_CHAINADDR
const uint32_t CHAN_CHAINADDR
Definition: copy_engine_defs.hh:48
CopyEngineReg::CHAN_CHAINADDR_HIGH
const uint32_t CHAN_CHAINADDR_HIGH
Definition: copy_engine_defs.hh:50
Packet::makeAtomicResponse
void makeAtomicResponse()
Definition: packet.hh:1017
CopyEngine::CopyEngineChannel::continueProcessing
void continueProcessing()
Definition: copy_engine.cc:548
CopyEngine::chan
std::vector< CopyEngineChannel * > chan
Definition: copy_engine.hh:154
Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:177
UNIT_BYTE
#define UNIT_BYTE
Definition: units.hh:43
CopyEngine::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:290
CopyEngine::regs
CopyEngineReg::Regs regs
Definition: copy_engine.hh:151
system.hh
DrainState::Running
@ Running
Running normally.
CopyEngineReg::CHAN_CMPLNADDR_HIGH
const uint32_t CHAN_CMPLNADDR_HIGH
Definition: copy_engine_defs.hh:54
CopyEngineReg::CHAN_STATUS
const uint32_t CHAN_STATUS
Definition: copy_engine_defs.hh:47
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:591
Packet::getAddr
Addr getAddr() const
Definition: packet.hh:755
CopyEngine::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:167
CopyEngine::CopyEngineChannel::fetchDescComplete
void fetchDescComplete()
Definition: copy_engine.cc:466
CopyEngineReg::DESC_CTRL_CP_STS
const uint32_t DESC_CTRL_CP_STS
Definition: copy_engine_defs.hh:61
CopyEngine::CopyEngineChannel::channelWrite
void channelWrite(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:368
CopyEngine::CopyEngineChannel::writeCopyBytes
void writeCopyBytes()
Definition: copy_engine.cc:515
MemCmd::ReadReq
@ ReadReq
Definition: packet.hh:83
CopyEngineReg::DmaDesc
Definition: copy_engine_defs.hh:65
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:59
CopyEngine::CopyEngineChannel::fetchDescriptor
void fetchDescriptor(Addr address)
Definition: copy_engine.cc:449
CopyEngine::CopyEngineChannel::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: copy_engine.cc:637
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:243
CopyEngine::CopyEngineChannel::channelRead
void channelRead(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:240
Stats::Group::Group
Group()=delete
copy_engine.hh
Packet::getSize
unsigned getSize() const
Definition: packet.hh:765
MipsISA::ce
Bitfield< 29, 28 > ce
Definition: pra_constants.hh:177
CopyEngine
Definition: copy_engine.hh:58
Serializable::serializeSection
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:170
CopyEngineReg::GEN_XFERCAP
const uint32_t GEN_XFERCAP
Definition: copy_engine_defs.hh:40
CopyEngine::CopyEngineChannel::getPort
Port & getPort()
Definition: copy_engine.cc:131
CopyEngineReg::Regs::intrctrl
INTRCTRL intrctrl
Definition: copy_engine_defs.hh:122
packet.hh
Stats::DataWrap::flags
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:339
DrainState::Drained
@ Drained
Buffers drained, ready for serialization/handover.
MemCmd::WriteReq
@ WriteReq
Definition: packet.hh:86
DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:71
stats.hh
CopyEngine::CopyEngineChannel::writeCopyBytesComplete
void writeCopyBytesComplete()
Definition: copy_engine.cc:529
cp
Definition: cprintf.cc:37
CopyEngine::getPort
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
CopyEngine::CopyEngineStats::copiesProcessed
Stats::Vector copiesProcessed
Definition: copy_engine.hh:147
arrayParamOut
decltype(std::begin(std::declval< const T & >()), std::end(std::declval< const T & >()), void()) arrayParamOut(CheckpointOut &os, const std::string &name, const T &param)
Definition: serialize.hh:415
CopyEngineReg::CHAN_CONTROL
const uint32_t CHAN_CONTROL
Definition: copy_engine_defs.hh:46
CopyEngine::CopyEngineChannel::writeCompletionStatus
void writeCompletionStatus()
Definition: copy_engine.cc:577
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:237
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:71
PciDevice::serialize
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
Definition: device.cc:399
CopyEngine::CopyEngineChannel::restartStateMachine
void restartStateMachine()
Definition: copy_engine.cc:702
CopyEngineReg::Regs::attnStatus
uint32_t attnStatus
Definition: copy_engine_defs.hh:124
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
CopyEngine::CopyEngineChannel::readCopyBytesComplete
void readCopyBytesComplete()
Definition: copy_engine.cc:505
CopyEngine::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:657
CopyEngine::CopyEngineChannel::fetchNextAddr
void fetchNextAddr(Addr address)
Definition: copy_engine.cc:597
DmaDevice::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: dma_device.cc:360
Drainable::signalDrainDone
void signalDrainDone() const
Signal that an object is drained.
Definition: drain.hh:301
PciDevice::unserialize
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
Definition: device.cc:462
SERIALIZE_ARRAY
#define SERIALIZE_ARRAY(member, size)
Definition: serialize.hh:626
CopyEngineReg::CHAN_COMMAND
const uint32_t CHAN_COMMAND
Definition: copy_engine_defs.hh:51
RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:70
CopyEngineReg::GEN_ATTNSTATUS
const uint32_t GEN_ATTNSTATUS
Definition: copy_engine_defs.hh:42
CopyEngine::CopyEngineChannel::CopyEngineChannel
CopyEngineChannel(CopyEngine *_ce, int cid)
Definition: copy_engine.cc:79
CopyEngine::CopyEngineChannel::recvCommand
void recvCommand()
Definition: copy_engine.cc:137
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
UNIT_COUNT
#define UNIT_COUNT
Definition: units.hh:49
CopyEngineReg::Regs::xferCap
uint8_t xferCap
Definition: copy_engine_defs.hh:114
CopyEngine::CopyEngineChannel
Definition: copy_engine.hh:60
CopyEngine::~CopyEngine
~CopyEngine()
Definition: copy_engine.cc:101
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
Stats::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1028
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:584
CopyEngine::CopyEngineChannel::fetchAddrComplete
void fetchAddrComplete()
Definition: copy_engine.cc:608
packet_access.hh
CopyEngine::CopyEngineChannel::readCopyBytes
void readCopyBytes()
Definition: copy_engine.cc:495
Drainable::drainState
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:320
CopyEngineReg::DESC_CTRL_NULL
const uint32_t DESC_CTRL_NULL
Definition: copy_engine_defs.hh:63
CopyEngine::CopyEngineChannel::inDrain
bool inDrain()
Definition: copy_engine.cc:626
CopyEngine::CopyEngineChannel::ChannelState
ChannelState
Definition: copy_engine.hh:81
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:182
CopyEngine::CopyEngine
CopyEngine(const Params &params)
Definition: copy_engine.cc:60
CopyEngine::CopyEngineChannel::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:666
findMsbSet
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Definition: bitfield.hh:240
Packet::getLE
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Definition: packet_access.hh:75
CopyEngineReg::Regs::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine_defs.hh:126
CopyEngine::CopyEngineStats::bytesCopied
Stats::Vector bytesCopied
Definition: copy_engine.hh:146
UNSERIALIZE_ARRAY
#define UNSERIALIZE_ARRAY(member, size)
Definition: serialize.hh:634
CopyEngine::CopyEngineChannel::writeStatusComplete
void writeStatusComplete()
Definition: copy_engine.cc:590
CopyEngineReg::GEN_INTRCTRL
const uint32_t GEN_INTRCTRL
Definition: copy_engine_defs.hh:41
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:258
Stats::Group
Statistics container.
Definition: group.hh:87
CopyEngine::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:648
CopyEngine::CopyEngineStats::CopyEngineStats
CopyEngineStats(Stats::Group *parent, const uint8_t &channel_count)
Definition: copy_engine.cc:430
Packet::setLE
void setLE(T v)
Set the value in the data pointer to v as little endian.
Definition: packet_access.hh:105
PciDevice::pioDelay
Tick pioDelay
Definition: device.hh:351
CopyEngineReg::GEN_CHANCOUNT
const uint32_t GEN_CHANCOUNT
Definition: copy_engine_defs.hh:39
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:64
bits
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:73
CopyEngine::CopyEngineChannel::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: copy_engine.cc:728
arrayParamIn
void arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf< T > &param)
Definition: circlebuf.hh:254
Stats
Definition: statistics.cc:53
CopyEngineReg::CHAN_ERROR
const uint32_t CHAN_ERROR
Definition: copy_engine_defs.hh:55
trace.hh
CopyEngineReg
Definition: copy_engine_defs.hh:35
CopyEngine::CopyEngineChannel::~CopyEngineChannel
virtual ~CopyEngineChannel()
Definition: copy_engine.cc:108
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Stats::total
const FlagsType total
Print the total.
Definition: info.hh:50
CheckpointIn
Definition: serialize.hh:68
CopyEngine::CopyEngineChannel::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:683
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
PciDevice
PCI device, base implementation is only config space.
Definition: device.hh:266
DmaDevice::Params
DmaDeviceParams Params
Definition: dma_device.hh:206
DrainState::Draining
@ Draining
Draining buffers pending serialization/handover.
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711
CopyEngineReg::Regs::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine_defs.hh:134
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
PciDevice::getBAR
bool getBAR(Addr addr, int &num, Addr &offs)
Which base address register (if any) maps the given address?
Definition: device.hh:317
CopyEngineReg::Regs::chanCount
uint8_t chanCount
Definition: copy_engine_defs.hh:113
CopyEngineReg::CHAN_CMPLNADDR
const uint32_t CHAN_CMPLNADDR
Definition: copy_engine_defs.hh:52

Generated on Tue Mar 23 2021 19:41:26 for gem5 by doxygen 1.8.17