gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
58namespace gem5
59{
60
61class CopyEngine : public PciDevice
62{
64 {
65 private:
71 uint8_t *copyBuffer;
72
73 bool busy;
78
81
83
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();
134
135 void writeCopyBytes();
138
140 void writeStatusComplete();
142
143
144 void continueProcessing();
145 void recvCommand();
146 bool inDrain();
147 void restartStateMachine();
148 };
149
150 private:
151
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__
void unserialize(CheckpointIn &cp) override
Unserialize an object.
EventFunctionWrapper addrCompleteEvent
EventFunctionWrapper statusCompleteEvent
virtual Tick write(PacketPtr pkt)
copy_engine_reg::DmaDesc * curDmaDesc
CopyEngineChannel(CopyEngine *_ce, int cid)
EventFunctionWrapper readCompleteEvent
void channelWrite(PacketPtr pkt, Addr daddr, int size)
EventFunctionWrapper writeCompleteEvent
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
copy_engine_reg::ChanRegs cr
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual Tick read(PacketPtr pkt)
void drainResume() override
Resume execution after a successful drain.
void channelRead(PacketPtr pkt, Addr daddr, int size)
EventFunctionWrapper fetchCompleteEvent
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
PARAMS(CopyEngine)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::vector< CopyEngineChannel * > chan
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
CopyEngine(const Params &params)
gem5::CopyEngine::CopyEngineStats copyEngineStats
copy_engine_reg::Regs regs
DmaDeviceParams Params
Interface for objects that might require draining before checkpointing.
Definition drain.hh:235
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:295
PCI device, base implementation is only config space.
Definition device.hh:270
Ports are used to interface objects to each other.
Definition port.hh:62
Basic support for object serialization.
Definition serialize.hh:170
Statistics container.
Definition group.hh:93
A vector of scalar stats.
STL vector class.
Definition stl.hh:37
DrainState
Object drain/handover states.
Definition drain.hh:75
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
const Params & params() const
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
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
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161
Declaration of Statistics objects.
CopyEngineStats(statistics::Group *parent, const uint8_t &channel_count)

Generated on Tue Jun 18 2024 16:24:03 for gem5 by doxygen 1.11.0