gem5 v24.0.0.0
Loading...
Searching...
No Matches
copy_engine_defs.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/* @file
30 * Register and structure descriptions for Intel's I/O AT DMA Engine
31 */
32#include "base/bitfield.hh"
33#include "base/compiler.hh"
34#include "sim/serialize.hh"
35
36namespace gem5
37{
38
39namespace copy_engine_reg
40{
41
42// General Channel independant registers, 128 bytes starting at 0x00
43const uint32_t GEN_CHANCOUNT = 0x00;
44const uint32_t GEN_XFERCAP = 0x01;
45const uint32_t GEN_INTRCTRL = 0x03;
46const uint32_t GEN_ATTNSTATUS = 0x04;
47
48
49// Channel specific registers, each block is 128 bytes, starting at 0x80
50const uint32_t CHAN_CONTROL = 0x00;
51const uint32_t CHAN_STATUS = 0x04;
52const uint32_t CHAN_CHAINADDR = 0x0C;
53const uint32_t CHAN_CHAINADDR_LOW = 0x0C;
54const uint32_t CHAN_CHAINADDR_HIGH = 0x10;
55const uint32_t CHAN_COMMAND = 0x14;
56const uint32_t CHAN_CMPLNADDR = 0x18;
57const uint32_t CHAN_CMPLNADDR_LOW = 0x18;
58const uint32_t CHAN_CMPLNADDR_HIGH = 0x1C;
59const uint32_t CHAN_ERROR = 0x28;
60
61
62const uint32_t DESC_CTRL_INT_GEN = 0x00000001;
63const uint32_t DESC_CTRL_SRC_SN = 0x00000002;
64const uint32_t DESC_CTRL_DST_SN = 0x00000004;
65const uint32_t DESC_CTRL_CP_STS = 0x00000008;
66const uint32_t DESC_CTRL_FRAME = 0x00000010;
67const uint32_t DESC_CTRL_NULL = 0x00000020;
68
69struct DmaDesc
70{
71 uint32_t len;
72 uint32_t command;
76 uint64_t reserved1;
77 uint64_t reserved2;
78 uint64_t user1;
79 uint64_t user2;
80};
81
82#define ADD_FIELD8(NAME, OFFSET, BITS) \
83 inline uint8_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
84 inline void NAME(uint8_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
85
86#define ADD_FIELD16(NAME, OFFSET, BITS) \
87 inline uint16_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
88 inline void NAME(uint16_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
89
90#define ADD_FIELD32(NAME, OFFSET, BITS) \
91 inline uint32_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
92 inline void NAME(uint32_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
93
94#define ADD_FIELD64(NAME, OFFSET, BITS) \
95 inline uint64_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
96 inline void NAME(uint64_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
97
98template<class T>
99struct Reg
100{
102 T operator()() { return _data; }
103 const Reg<T> &operator=(T d) { _data = d; return *this;}
104 bool operator==(T d) { return d == _data; }
105 void operator()(T d) { _data = d; }
106 Reg() { _data = 0; }
107 void serialize(CheckpointOut &cp) const
108 {
110 }
115};
116
117
118struct Regs : public Serializable
119{
120 uint8_t chanCount;
121 uint8_t xferCap;
122
123 struct INTRCTRL : public Reg<uint8_t>
124 {
125 // 0x03
126 using Reg<uint8_t>::operator =;
127 ADD_FIELD8(master_int_enable,0,1);
128 ADD_FIELD8(interrupt_status,1,1);
129 ADD_FIELD8(interrupt,2,1);
130 };
132
133 uint32_t attnStatus; // Read clears
134
135 void serialize(CheckpointOut &cp) const override
136 {
139 paramOut(cp, "intrctrl", intrctrl._data);
141 }
142
150
151};
152
153struct ChanRegs : public Serializable
154{
155 struct CHANCTRL : public Reg<uint16_t>
156 {
157 // channelX + 0x00
158 using Reg<uint16_t>::operator =;
159 ADD_FIELD16(interrupt_disable,0,1);
160 ADD_FIELD16(error_completion_enable, 2,1);
161 ADD_FIELD16(any_error_abort_enable,3,1);
162 ADD_FIELD16(error_int_enable,4,1);
163 ADD_FIELD16(desc_addr_snoop_control,5,1);
164 ADD_FIELD16(in_use, 8,1);
165 };
167
168 struct CHANSTS : public Reg<uint64_t>
169 {
170 // channelX + 0x04
171 ADD_FIELD64(dma_transfer_status, 0, 3);
172 ADD_FIELD64(unaffiliated_error, 3, 1);
173 ADD_FIELD64(soft_error, 4, 1);
174 ADD_FIELD64(compl_desc_addr, 6, 58);
175 };
177
179
180 struct CHANCMD : public Reg<uint8_t>
181 {
182 // channelX + 0x14
183 ADD_FIELD8(start_dma,0,1);
184 ADD_FIELD8(append_dma,1,1);
185 ADD_FIELD8(suspend_dma,2,1);
186 ADD_FIELD8(abort_dma,3,1);
187 ADD_FIELD8(resume_dma,4,1);
188 ADD_FIELD8(reset_dma,5,1);
189 };
191
193
194 struct CHANERR : public Reg<uint32_t>
195 {
196 // channel X + 0x28
197 ADD_FIELD32(source_addr_error,0,1);
198 ADD_FIELD32(dest_addr_error,1,1);
199 ADD_FIELD32(ndesc_addr_error,2,1);
200 ADD_FIELD32(desc_error,3,1);
201 ADD_FIELD32(chain_addr_error,4,1);
202 ADD_FIELD32(chain_cmd_error,5,1);
203 ADD_FIELD32(chipset_parity_error,6,1);
204 ADD_FIELD32(dma_parity_error,7,1);
205 ADD_FIELD32(read_data_error,8,1);
206 ADD_FIELD32(write_data_error,9,1);
207 ADD_FIELD32(desc_control_error,10,1);
208 ADD_FIELD32(desc_len_error,11,1);
209 ADD_FIELD32(completion_addr_error,12,1);
210 ADD_FIELD32(interrupt_config_error,13,1);
211 ADD_FIELD32(soft_error,14,1);
212 ADD_FIELD32(unaffiliated_error,15,1);
213 };
215
216 void serialize(CheckpointOut &cp) const override
217 {
218 paramOut(cp, "ctrl", ctrl._data);
219 paramOut(cp, "status", status._data);
221 paramOut(cp, "command", command._data);
223 paramOut(cp, "error", error._data);
224 }
225
226 void unserialize(CheckpointIn &cp) override
227 {
228 paramIn(cp, "ctrl", ctrl._data);
229 paramIn(cp, "status", status._data);
231 paramIn(cp, "command", command._data);
233 paramIn(cp, "error", error._data);
234 }
235
236
237};
238
239} // namespace copy_engine_reg
240} // namespace gem5
Basic support for object serialization.
Definition serialize.hh:170
Bitfield< 9 > d
Definition misc_types.hh:64
const uint32_t DESC_CTRL_SRC_SN
const uint32_t DESC_CTRL_NULL
const uint32_t DESC_CTRL_DST_SN
const uint32_t CHAN_CHAINADDR_LOW
const uint32_t DESC_CTRL_CP_STS
const uint32_t DESC_CTRL_INT_GEN
const uint32_t GEN_ATTNSTATUS
const uint32_t GEN_CHANCOUNT
const uint32_t DESC_CTRL_FRAME
const uint32_t CHAN_CMPLNADDR_HIGH
const uint32_t CHAN_CONTROL
const uint32_t CHAN_CMPLNADDR
const uint32_t CHAN_CHAINADDR
const uint32_t CHAN_CMPLNADDR_LOW
const uint32_t CHAN_CHAINADDR_HIGH
const uint32_t GEN_INTRCTRL
const uint32_t CHAN_COMMAND
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
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
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Definition types.cc:40
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
Definition types.cc:72
#define UNSERIALIZE_SCALAR(scalar)
Definition serialize.hh:575
#define SERIALIZE_SCALAR(scalar)
Definition serialize.hh:568
ADD_FIELD16(any_error_abort_enable, 3, 1)
ADD_FIELD16(interrupt_disable, 0, 1)
ADD_FIELD16(desc_addr_snoop_control, 5, 1)
ADD_FIELD16(error_completion_enable, 2, 1)
ADD_FIELD32(source_addr_error, 0, 1)
ADD_FIELD32(unaffiliated_error, 15, 1)
ADD_FIELD32(completion_addr_error, 12, 1)
ADD_FIELD32(desc_control_error, 10, 1)
ADD_FIELD32(chipset_parity_error, 6, 1)
ADD_FIELD32(interrupt_config_error, 13, 1)
ADD_FIELD64(dma_transfer_status, 0, 3)
ADD_FIELD64(unaffiliated_error, 3, 1)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const Reg< T > & operator=(T d)
void unserialize(CheckpointIn &cp)
void serialize(CheckpointOut &cp) const
ADD_FIELD8(interrupt_status, 1, 1)
ADD_FIELD8(master_int_enable, 0, 1)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.

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