gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
copy_engine.hh
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 Acceleration Technology (I/OAT).
43  * A DMA asyncronous copy engine
44  */
45 
46 #ifndef __DEV_PCI_COPY_ENGINE_HH__
47 #define __DEV_PCI_COPY_ENGINE_HH__
48 
49 #include <vector>
50 
51 #include "base/statistics.hh"
53 #include "dev/pci/device.hh"
54 #include "params/CopyEngine.hh"
55 #include "sim/drain.hh"
56 #include "sim/eventq.hh"
57 
58 namespace gem5
59 {
60 
61 class CopyEngine : public PciDevice
62 {
63  class CopyEngineChannel : public Drainable, public Serializable
64  {
65  private:
69  int channelId;
71  uint8_t *copyBuffer;
72 
73  bool busy;
74  bool underReset;
78 
81 
83 
85  {
92  };
93 
95 
96  public:
97  CopyEngineChannel(CopyEngine *_ce, int cid);
98  virtual ~CopyEngineChannel();
99  Port &getPort();
100 
101  std::string
103  {
104  assert(ce);
105  return ce->name() + csprintf("-chan%d", channelId);
106  }
107 
108  virtual Tick read(PacketPtr pkt)
109  { panic("CopyEngineChannel has no I/O access\n");}
110  virtual Tick write(PacketPtr pkt)
111  { panic("CopyEngineChannel has no I/O access\n"); }
112 
113  void channelRead(PacketPtr pkt, Addr daddr, int size);
114  void channelWrite(PacketPtr pkt, Addr daddr, int size);
115 
116  DrainState drain() override;
117  void drainResume() override;
118 
119  void serialize(CheckpointOut &cp) const override;
120  void unserialize(CheckpointIn &cp) override;
121 
122  private:
123  void fetchDescriptor(Addr address);
124  void fetchDescComplete();
126 
127  void fetchNextAddr(Addr address);
128  void fetchAddrComplete();
130 
131  void readCopyBytes();
132  void readCopyBytesComplete();
134 
135  void writeCopyBytes();
136  void writeCopyBytesComplete();
138 
139  void writeCompletionStatus();
140  void writeStatusComplete();
142 
143 
144  void continueProcessing();
145  void recvCommand();
146  bool inDrain();
147  void restartStateMachine();
148  };
149 
150  private:
151 
153  {
155  const uint8_t& channel_count);
156 
159  } copyEngineStats;
160 
161  // device registers
163 
164  // Array of channels each one with regs/dma port/etc
166 
167  public:
169  CopyEngine(const Params &params);
170  ~CopyEngine();
171 
172  Port &getPort(const std::string &if_name,
173  PortID idx = InvalidPortID) override;
174 
175  Tick read(PacketPtr pkt) override;
176  Tick write(PacketPtr pkt) override;
177 
178  void serialize(CheckpointOut &cp) const override;
179  void unserialize(CheckpointIn &cp) override;
180 };
181 
182 } // namespace gem5
183 
184 #endif //__DEV_PCI_COPY_ENGINE_HH__
gem5::CopyEngine::CopyEngineChannel::fetchNextAddr
void fetchNextAddr(Addr address)
Definition: copy_engine.cc:601
gem5::CopyEngine::CopyEngineStats::CopyEngineStats
CopyEngineStats(statistics::Group *parent, const uint8_t &channel_count)
Definition: copy_engine.cc:434
gem5::CopyEngine::copyEngineStats
gem5::CopyEngine::CopyEngineStats copyEngineStats
gem5::CopyEngine::CopyEngineChannel::writeCopyBytes
void writeCopyBytes()
Definition: copy_engine.cc:519
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::CopyEngine::CopyEngineChannel::~CopyEngineChannel
virtual ~CopyEngineChannel()
Definition: copy_engine.cc:112
gem5::CopyEngine::CopyEngineChannel::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:687
gem5::CopyEngine::CopyEngineChannel::continueProcessing
void continueProcessing()
Definition: copy_engine.cc:552
gem5::CopyEngine::CopyEngineChannel::ce
CopyEngine * ce
Definition: copy_engine.hh:67
gem5::CopyEngine::PARAMS
PARAMS(CopyEngine)
gem5::CopyEngine::CopyEngineChannel::curDmaDesc
copy_engine_reg::DmaDesc * curDmaDesc
Definition: copy_engine.hh:70
gem5::CopyEngine::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:294
gem5::CopyEngine::CopyEngineChannel::ChannelState
ChannelState
Definition: copy_engine.hh:84
gem5::CopyEngine::CopyEngineChannel::statusCompleteEvent
EventFunctionWrapper statusCompleteEvent
Definition: copy_engine.hh:141
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2005
std::vector
STL vector class.
Definition: stl.hh:37
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::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:641
gem5::CopyEngine::CopyEngineChannel::recvCommand
void recvCommand()
Definition: copy_engine.cc:141
gem5::CopyEngine::CopyEngineStats::bytesCopied
statistics::Vector bytesCopied
Definition: copy_engine.hh:157
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:246
gem5::CopyEngine::CopyEngine
CopyEngine(const Params &params)
Definition: copy_engine.cc:64
gem5::CopyEngine::CopyEngineChannel::fetchAddress
Addr fetchAddress
Definition: copy_engine.hh:77
device.hh
gem5::CopyEngine::CopyEngineChannel::cePort
DmaPort cePort
Definition: copy_engine.hh:66
gem5::CopyEngine::CopyEngineChannel::addrCompleteEvent
EventFunctionWrapper addrCompleteEvent
Definition: copy_engine.hh:129
gem5::CopyEngine::CopyEngineChannel::channelWrite
void channelWrite(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:372
gem5::CopyEngine::CopyEngineChannel::readCompleteEvent
EventFunctionWrapper readCompleteEvent
Definition: copy_engine.hh:133
gem5::copy_engine_reg::Regs
Definition: copy_engine_defs.hh:118
gem5::copy_engine_reg::DmaDesc
Definition: copy_engine_defs.hh:69
gem5::CopyEngine::CopyEngineChannel::write
virtual Tick write(PacketPtr pkt)
Definition: copy_engine.hh:110
gem5::Serializable
Basic support for object serialization.
Definition: serialize.hh:169
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::CopyEngine::CopyEngineChannel::fetchAddrComplete
void fetchAddrComplete()
Definition: copy_engine.cc:612
gem5::CopyEngine::CopyEngineStats::copiesProcessed
statistics::Vector copiesProcessed
Definition: copy_engine.hh:158
gem5::CopyEngine::CopyEngineChannel::DMAWrite
@ DMAWrite
Definition: copy_engine.hh:90
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::CopyEngine::CopyEngineChannel::lastDescriptorAddr
Addr lastDescriptorAddr
Definition: copy_engine.hh:76
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::CopyEngine::CopyEngineChannel::channelId
int channelId
Definition: copy_engine.hh:69
gem5::CopyEngine::CopyEngineChannel::readCopyBytesComplete
void readCopyBytesComplete()
Definition: copy_engine.cc:509
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::CopyEngine::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine.cc:661
statistics.hh
gem5::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:119
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::CopyEngine::CopyEngineChannel::CopyEngineChannel
CopyEngineChannel(CopyEngine *_ce, int cid)
Definition: copy_engine.cc:83
gem5::CopyEngine::regs
copy_engine_reg::Regs regs
Definition: copy_engine.hh:162
gem5::PciDevice
PCI device, base implementation is only config space.
Definition: device.hh:269
gem5::CopyEngine::chan
std::vector< CopyEngineChannel * > chan
Definition: copy_engine.hh:165
gem5::CopyEngine::CopyEngineChannel::writeStatusComplete
void writeStatusComplete()
Definition: copy_engine.cc:594
gem5::copy_engine_reg::ChanRegs
Definition: copy_engine_defs.hh:153
gem5::CopyEngine::CopyEngineChannel::nextState
ChannelState nextState
Definition: copy_engine.hh:94
gem5::CopyEngine::CopyEngineChannel::busy
bool busy
Definition: copy_engine.hh:73
gem5::DmaDevice::Params
DmaDeviceParams Params
Definition: dma_device.hh:224
gem5::CopyEngine::CopyEngineChannel::DescriptorFetch
@ DescriptorFetch
Definition: copy_engine.hh:88
gem5::CopyEngine::CopyEngineChannel::inDrain
bool inDrain()
Definition: copy_engine.cc:630
gem5::CopyEngine::CopyEngineChannel::writeCompletionStatus
void writeCompletionStatus()
Definition: copy_engine.cc:581
gem5::CopyEngine::~CopyEngine
~CopyEngine()
Definition: copy_engine.cc:105
gem5::CopyEngine::CopyEngineChannel::DMARead
@ DMARead
Definition: copy_engine.hh:89
gem5::CopyEngine::CopyEngineChannel::completionDataReg
uint64_t completionDataReg
Definition: copy_engine.hh:82
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::CopyEngine::CopyEngineChannel::copyBuffer
uint8_t * copyBuffer
Definition: copy_engine.hh:71
gem5::CopyEngine::CopyEngineChannel::restartStateMachine
void restartStateMachine()
Definition: copy_engine.cc:706
gem5::CopyEngine::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:652
gem5::CopyEngine::CopyEngineChannel::writeCopyBytesComplete
void writeCopyBytesComplete()
Definition: copy_engine.cc:533
gem5::CopyEngine::CopyEngineChannel::writeCompleteEvent
EventFunctionWrapper writeCompleteEvent
Definition: copy_engine.hh:137
gem5::EventFunctionWrapper
Definition: eventq.hh:1136
gem5::CopyEngine::CopyEngineChannel::channelRead
void channelRead(PacketPtr pkt, Addr daddr, int size)
Definition: copy_engine.cc:244
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::CopyEngine::CopyEngineChannel::refreshNext
bool refreshNext
Definition: copy_engine.hh:75
gem5::CopyEngine::CopyEngineChannel::readCopyBytes
void readCopyBytes()
Definition: copy_engine.cc:499
gem5::CopyEngine::CopyEngineChannel::name
std::string name()
Definition: copy_engine.hh:102
gem5::CopyEngine
Definition: copy_engine.hh:61
gem5::CopyEngine::CopyEngineChannel::latBeforeBegin
Tick latBeforeBegin
Definition: copy_engine.hh:79
gem5::Drainable
Interface for objects that might require draining before checkpointing.
Definition: drain.hh:234
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
gem5::CopyEngine::CopyEngineStats
Definition: copy_engine.hh:152
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::DmaPort
Definition: dma_device.hh:61
gem5::CopyEngine::CopyEngineChannel::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: copy_engine.cc:732
gem5::CopyEngine::CopyEngineChannel::read
virtual Tick read(PacketPtr pkt)
Definition: copy_engine.hh:108
drain.hh
gem5::CopyEngine::CopyEngineChannel
Definition: copy_engine.hh:63
gem5::CopyEngine::CopyEngineChannel::latAfterCompletion
Tick latAfterCompletion
Definition: copy_engine.hh:80
gem5::CopyEngine::CopyEngineChannel::Idle
@ Idle
Definition: copy_engine.hh:86
gem5::CopyEngine::CopyEngineChannel::CompletionWrite
@ CompletionWrite
Definition: copy_engine.hh:91
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::CopyEngine::CopyEngineChannel::fetchCompleteEvent
EventFunctionWrapper fetchCompleteEvent
Definition: copy_engine.hh:125
gem5::CopyEngine::CopyEngineChannel::fetchDescComplete
void fetchDescComplete()
Definition: copy_engine.cc:470
copy_engine_defs.hh
gem5::CopyEngine::CopyEngineChannel::AddressFetch
@ AddressFetch
Definition: copy_engine.hh:87
gem5::CopyEngine::CopyEngineChannel::cr
copy_engine_reg::ChanRegs cr
Definition: copy_engine.hh:68
gem5::CopyEngine::CopyEngineChannel::getPort
Port & getPort()
Definition: copy_engine.cc:135
gem5::CopyEngine::CopyEngineChannel::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine.cc:670
gem5::CopyEngine::CopyEngineChannel::fetchDescriptor
void fetchDescriptor(Addr address)
Definition: copy_engine.cc:453
gem5::CopyEngine::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: copy_engine.cc:171
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:188
gem5::CopyEngine::CopyEngineChannel::underReset
bool underReset
Definition: copy_engine.hh:74
eventq.hh

Generated on Sun Jul 30 2023 01:56:56 for gem5 by doxygen 1.8.17