gem5  v20.1.0.0
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 "sim/serialize.hh"
34 
35 namespace CopyEngineReg {
36 
37 
38 // General Channel independant registers, 128 bytes starting at 0x00
39 const uint32_t GEN_CHANCOUNT = 0x00;
40 const uint32_t GEN_XFERCAP = 0x01;
41 const uint32_t GEN_INTRCTRL = 0x03;
42 const uint32_t GEN_ATTNSTATUS = 0x04;
43 
44 
45 // Channel specific registers, each block is 128 bytes, starting at 0x80
46 const uint32_t CHAN_CONTROL = 0x00;
47 const uint32_t CHAN_STATUS = 0x04;
48 const uint32_t CHAN_CHAINADDR = 0x0C;
49 const uint32_t CHAN_CHAINADDR_LOW = 0x0C;
50 const uint32_t CHAN_CHAINADDR_HIGH = 0x10;
51 const uint32_t CHAN_COMMAND = 0x14;
52 const uint32_t CHAN_CMPLNADDR = 0x18;
53 const uint32_t CHAN_CMPLNADDR_LOW = 0x18;
54 const uint32_t CHAN_CMPLNADDR_HIGH = 0x1C;
55 const uint32_t CHAN_ERROR = 0x28;
56 
57 
58 const uint32_t DESC_CTRL_INT_GEN = 0x00000001;
59 const uint32_t DESC_CTRL_SRC_SN = 0x00000002;
60 const uint32_t DESC_CTRL_DST_SN = 0x00000004;
61 const uint32_t DESC_CTRL_CP_STS = 0x00000008;
62 const uint32_t DESC_CTRL_FRAME = 0x00000010;
63 const uint32_t DESC_CTRL_NULL = 0x00000020;
64 
65 struct DmaDesc {
66  uint32_t len;
67  uint32_t command;
71  uint64_t reserved1;
72  uint64_t reserved2;
73  uint64_t user1;
74  uint64_t user2;
75 };
76 
77 #define ADD_FIELD8(NAME, OFFSET, BITS) \
78  inline uint8_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
79  inline void NAME(uint8_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
80 
81 #define ADD_FIELD16(NAME, OFFSET, BITS) \
82  inline uint16_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
83  inline void NAME(uint16_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
84 
85 #define ADD_FIELD32(NAME, OFFSET, BITS) \
86  inline uint32_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
87  inline void NAME(uint32_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
88 
89 #define ADD_FIELD64(NAME, OFFSET, BITS) \
90  inline uint64_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \
91  inline void NAME(uint64_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); }
92 
93 template<class T>
94 struct Reg {
95  T _data;
96  T operator()() { return _data; }
97  const Reg<T> &operator=(T d) { _data = d; return *this;}
98  bool operator==(T d) { return d == _data; }
99  void operator()(T d) { _data = d; }
100  Reg() { _data = 0; }
102  {
104  }
106  {
108  }
109 };
110 
111 
112 struct Regs : public Serializable {
113  uint8_t chanCount;
114  uint8_t xferCap;
115 
116  struct INTRCTRL : public Reg<uint8_t> { // 0x03
117  using Reg<uint8_t>::operator =;
118  ADD_FIELD8(master_int_enable,0,1);
119  ADD_FIELD8(interrupt_status,1,1);
120  ADD_FIELD8(interrupt,2,1);
121  };
123 
124  uint32_t attnStatus; // Read clears
125 
126  void serialize(CheckpointOut &cp) const override
127  {
130  paramOut(cp, "intrctrl", intrctrl._data);
132  }
133 
134  void unserialize(CheckpointIn &cp) override
135  {
138  paramIn(cp, "intrctrl", intrctrl._data);
140  }
141 
142 };
143 
144 struct ChanRegs : public Serializable {
145  struct CHANCTRL : public Reg<uint16_t> { // channelX + 0x00
146  using Reg<uint16_t>::operator =;
147  ADD_FIELD16(interrupt_disable,0,1);
148  ADD_FIELD16(error_completion_enable, 2,1);
149  ADD_FIELD16(any_error_abort_enable,3,1);
150  ADD_FIELD16(error_int_enable,4,1);
151  ADD_FIELD16(desc_addr_snoop_control,5,1);
152  ADD_FIELD16(in_use, 8,1);
153  };
155 
156  struct CHANSTS : public Reg<uint64_t> { // channelX + 0x04
157  ADD_FIELD64(dma_transfer_status, 0, 3);
158  ADD_FIELD64(unaffiliated_error, 3, 1);
159  ADD_FIELD64(soft_error, 4, 1);
160  ADD_FIELD64(compl_desc_addr, 6, 58);
161  };
163 
164  uint64_t descChainAddr;
165 
166  struct CHANCMD : public Reg<uint8_t> { // channelX + 0x14
167  ADD_FIELD8(start_dma,0,1);
168  ADD_FIELD8(append_dma,1,1);
169  ADD_FIELD8(suspend_dma,2,1);
170  ADD_FIELD8(abort_dma,3,1);
171  ADD_FIELD8(resume_dma,4,1);
172  ADD_FIELD8(reset_dma,5,1);
173  };
175 
176  uint64_t completionAddr;
177 
178  struct CHANERR : public Reg<uint32_t> { // channel X + 0x28
179  ADD_FIELD32(source_addr_error,0,1);
180  ADD_FIELD32(dest_addr_error,1,1);
181  ADD_FIELD32(ndesc_addr_error,2,1);
182  ADD_FIELD32(desc_error,3,1);
183  ADD_FIELD32(chain_addr_error,4,1);
184  ADD_FIELD32(chain_cmd_error,5,1);
185  ADD_FIELD32(chipset_parity_error,6,1);
186  ADD_FIELD32(dma_parity_error,7,1);
187  ADD_FIELD32(read_data_error,8,1);
188  ADD_FIELD32(write_data_error,9,1);
189  ADD_FIELD32(desc_control_error,10,1);
190  ADD_FIELD32(desc_len_error,11,1);
191  ADD_FIELD32(completion_addr_error,12,1);
192  ADD_FIELD32(interrupt_config_error,13,1);
193  ADD_FIELD32(soft_error,14,1);
194  ADD_FIELD32(unaffiliated_error,15,1);
195  };
197 
198  void serialize(CheckpointOut &cp) const override
199  {
200  paramOut(cp, "ctrl", ctrl._data);
201  paramOut(cp, "status", status._data);
203  paramOut(cp, "command", command._data);
205  paramOut(cp, "error", error._data);
206  }
207 
208  void unserialize(CheckpointIn &cp) override
209  {
210  paramIn(cp, "ctrl", ctrl._data);
211  paramIn(cp, "status", status._data);
213  paramIn(cp, "command", command._data);
215  paramIn(cp, "error", error._data);
216  }
217 
218 
219 };
220 
221 } // namespace CopyEngineReg
222 
223 
CopyEngineReg::DmaDesc::user2
uint64_t user2
Definition: copy_engine_defs.hh:74
CopyEngineReg::ChanRegs::status
CHANSTS status
Definition: copy_engine_defs.hh:162
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
CopyEngineReg::ChanRegs
Definition: copy_engine_defs.hh:144
CopyEngineReg::Regs
Definition: copy_engine_defs.hh:112
CopyEngineReg::DmaDesc::reserved2
uint64_t reserved2
Definition: copy_engine_defs.hh:72
CopyEngineReg::CHAN_CMPLNADDR_HIGH
const uint32_t CHAN_CMPLNADDR_HIGH
Definition: copy_engine_defs.hh:54
CopyEngineReg::ChanRegs::CHANERR::ADD_FIELD32
ADD_FIELD32(source_addr_error, 0, 1)
CopyEngineReg::DmaDesc::dest
Addr dest
Definition: copy_engine_defs.hh:69
serialize.hh
CopyEngineReg::CHAN_STATUS
const uint32_t CHAN_STATUS
Definition: copy_engine_defs.hh:47
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:797
CopyEngineReg::ChanRegs::command
CHANCMD command
Definition: copy_engine_defs.hh:174
CopyEngineReg::ChanRegs::completionAddr
uint64_t completionAddr
Definition: copy_engine_defs.hh:176
CopyEngineReg::DmaDesc::command
uint32_t command
Definition: copy_engine_defs.hh:67
CopyEngineReg::ChanRegs::CHANCMD
Definition: copy_engine_defs.hh:166
Serializable
Basic support for object serialization.
Definition: serialize.hh:172
CopyEngineReg::DmaDesc::len
uint32_t len
Definition: copy_engine_defs.hh:66
CopyEngineReg::DESC_CTRL_CP_STS
const uint32_t DESC_CTRL_CP_STS
Definition: copy_engine_defs.hh:61
CopyEngineReg::CHAN_CMPLNADDR_LOW
const uint32_t CHAN_CMPLNADDR_LOW
Definition: copy_engine_defs.hh:53
CopyEngineReg::DmaDesc
Definition: copy_engine_defs.hh:65
CopyEngineReg::DmaDesc::src
Addr src
Definition: copy_engine_defs.hh:68
CopyEngineReg::DESC_CTRL_FRAME
const uint32_t DESC_CTRL_FRAME
Definition: copy_engine_defs.hh:62
CopyEngineReg::Reg::serialize
void serialize(CheckpointOut &cp) const
Definition: copy_engine_defs.hh:101
CopyEngineReg::DmaDesc::next
Addr next
Definition: copy_engine_defs.hh:70
CopyEngineReg::Reg
Definition: copy_engine_defs.hh:94
CopyEngineReg::DmaDesc::reserved1
uint64_t reserved1
Definition: copy_engine_defs.hh:71
CopyEngineReg::Reg::operator==
bool operator==(T d)
Definition: copy_engine_defs.hh:98
CopyEngineReg::Regs::INTRCTRL::ADD_FIELD8
ADD_FIELD8(master_int_enable, 0, 1)
CopyEngineReg::GEN_XFERCAP
const uint32_t GEN_XFERCAP
Definition: copy_engine_defs.hh:40
CopyEngineReg::Reg::operator()
T operator()()
Definition: copy_engine_defs.hh:96
paramOut
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
Definition: types.cc:38
CopyEngineReg::Reg::operator()
void operator()(T d)
Definition: copy_engine_defs.hh:99
CopyEngineReg::Regs::intrctrl
INTRCTRL intrctrl
Definition: copy_engine_defs.hh:122
cp
Definition: cprintf.cc:40
bitfield.hh
CopyEngineReg::CHAN_CONTROL
const uint32_t CHAN_CONTROL
Definition: copy_engine_defs.hh:46
CopyEngineReg::Reg::operator=
const Reg< T > & operator=(T d)
Definition: copy_engine_defs.hh:97
ArmISA::d
Bitfield< 9 > d
Definition: miscregs_types.hh:60
CopyEngineReg::Regs::attnStatus
uint32_t attnStatus
Definition: copy_engine_defs.hh:124
iGbReg::Regs::Reg
Definition: i8254xGBe_defs.hh:299
CopyEngineReg::ChanRegs::CHANSTS
Definition: copy_engine_defs.hh:156
CopyEngineReg::ChanRegs::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine_defs.hh:198
CopyEngineReg::ChanRegs::CHANCMD::ADD_FIELD8
ADD_FIELD8(start_dma, 0, 1)
CopyEngineReg::CHAN_COMMAND
const uint32_t CHAN_COMMAND
Definition: copy_engine_defs.hh:51
CopyEngineReg::GEN_ATTNSTATUS
const uint32_t GEN_ATTNSTATUS
Definition: copy_engine_defs.hh:42
CopyEngineReg::Regs::xferCap
uint8_t xferCap
Definition: copy_engine_defs.hh:114
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:790
CopyEngineReg::DESC_CTRL_DST_SN
const uint32_t DESC_CTRL_DST_SN
Definition: copy_engine_defs.hh:60
CopyEngineReg::ChanRegs::error
CHANERR error
Definition: copy_engine_defs.hh:196
CopyEngineReg::DESC_CTRL_NULL
const uint32_t DESC_CTRL_NULL
Definition: copy_engine_defs.hh:63
CopyEngineReg::ChanRegs::CHANCTRL
Definition: copy_engine_defs.hh:145
CopyEngineReg::Regs::INTRCTRL
Definition: copy_engine_defs.hh:116
CopyEngineReg::ChanRegs::descChainAddr
uint64_t descChainAddr
Definition: copy_engine_defs.hh:164
CopyEngineReg::DESC_CTRL_SRC_SN
const uint32_t DESC_CTRL_SRC_SN
Definition: copy_engine_defs.hh:59
CopyEngineReg::Regs::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: copy_engine_defs.hh:126
CopyEngineReg::DmaDesc::user1
uint64_t user1
Definition: copy_engine_defs.hh:73
CopyEngineReg::GEN_INTRCTRL
const uint32_t GEN_INTRCTRL
Definition: copy_engine_defs.hh:41
CopyEngineReg::ChanRegs::CHANSTS::ADD_FIELD64
ADD_FIELD64(dma_transfer_status, 0, 3)
paramIn
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
Definition: types.cc:69
CopyEngineReg::CHAN_CHAINADDR_LOW
const uint32_t CHAN_CHAINADDR_LOW
Definition: copy_engine_defs.hh:49
CopyEngineReg::GEN_CHANCOUNT
const uint32_t GEN_CHANCOUNT
Definition: copy_engine_defs.hh:39
CopyEngineReg::ChanRegs::CHANERR
Definition: copy_engine_defs.hh:178
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
CopyEngineReg::ChanRegs::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine_defs.hh:208
CopyEngineReg::CHAN_ERROR
const uint32_t CHAN_ERROR
Definition: copy_engine_defs.hh:55
CopyEngineReg
Definition: copy_engine_defs.hh:35
CopyEngineReg::Reg::_data
T _data
Definition: copy_engine_defs.hh:95
CopyEngineReg::Reg::unserialize
void unserialize(CheckpointIn &cp)
Definition: copy_engine_defs.hh:105
CopyEngineReg::Reg::Reg
Reg()
Definition: copy_engine_defs.hh:100
CopyEngineReg::DESC_CTRL_INT_GEN
const uint32_t DESC_CTRL_INT_GEN
Definition: copy_engine_defs.hh:58
CheckpointIn
Definition: serialize.hh:67
CopyEngineReg::ChanRegs::ctrl
CHANCTRL ctrl
Definition: copy_engine_defs.hh:154
CopyEngineReg::Regs::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: copy_engine_defs.hh:134
CopyEngineReg::ChanRegs::CHANCTRL::ADD_FIELD16
ADD_FIELD16(interrupt_disable, 0, 1)
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 Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17