4 * Copyright(c) 2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include "e1000_ethdev.h"
45 static const struct reg_info igb_regs_general[] = {
46 {E1000_CTRL, 1, 1, "E1000_CTRL"},
47 {E1000_STATUS, 1, 1, "E1000_STATUS"},
48 {E1000_CTRL_EXT, 1, 1, "E1000_CTRL_EXT"},
49 {E1000_MDIC, 1, 1, "E1000_MDIC"},
50 {E1000_SCTL, 1, 1, "E1000_SCTL"},
51 {E1000_CONNSW, 1, 1, "E1000_CONNSW"},
52 {E1000_VET, 1, 1, "E1000_VET"},
53 {E1000_LEDCTL, 1, 1, "E1000_LEDCTL"},
54 {E1000_PBA, 1, 1, "E1000_PBA"},
55 {E1000_PBS, 1, 1, "E1000_PBS"},
56 {E1000_FRTIMER, 1, 1, "E1000_FRTIMER"},
57 {E1000_TCPTIMER, 1, 1, "E1000_TCPTIMER"},
61 static const struct reg_info igb_regs_nvm[] = {
62 {E1000_EECD, 1, 1, "E1000_EECD"},
66 static const struct reg_info igb_regs_interrupt[] = {
67 {E1000_EICS, 1, 1, "E1000_EICS"},
68 {E1000_EIMS, 1, 1, "E1000_EIMS"},
69 {E1000_EIMC, 1, 1, "E1000_EIMC"},
70 {E1000_EIAC, 1, 1, "E1000_EIAC"},
71 {E1000_EIAM, 1, 1, "E1000_EIAM"},
72 {E1000_ICS, 1, 1, "E1000_ICS"},
73 {E1000_IMS, 1, 1, "E1000_IMS"},
74 {E1000_IMC, 1, 1, "E1000_IMC"},
75 {E1000_IAC, 1, 1, "E1000_IAC"},
76 {E1000_IAM, 1, 1, "E1000_IAM"},
77 {E1000_IMIRVP, 1, 1, "E1000_IMIRVP"},
78 {E1000_EITR(0), 10, 4, "E1000_EITR"},
79 {E1000_IMIR(0), 8, 4, "E1000_IMIR"},
80 {E1000_IMIREXT(0), 8, 4, "E1000_IMIREXT"},
84 static const struct reg_info igb_regs_fctl[] = {
85 {E1000_FCAL, 1, 1, "E1000_FCAL"},
86 {E1000_FCAH, 1, 1, "E1000_FCAH"},
87 {E1000_FCTTV, 1, 1, "E1000_FCTTV"},
88 {E1000_FCRTL, 1, 1, "E1000_FCRTL"},
89 {E1000_FCRTH, 1, 1, "E1000_FCRTH"},
90 {E1000_FCRTV, 1, 1, "E1000_FCRTV"},
94 static const struct reg_info igb_regs_rxdma[] = {
95 {E1000_RDBAL(0), 4, 0x100, "E1000_RDBAL"},
96 {E1000_RDBAH(0), 4, 0x100, "E1000_RDBAH"},
97 {E1000_RDLEN(0), 4, 0x100, "E1000_RDLEN"},
98 {E1000_RDH(0), 4, 0x100, "E1000_RDH"},
99 {E1000_RDT(0), 4, 0x100, "E1000_RDT"},
100 {E1000_RXCTL(0), 4, 0x100, "E1000_RXCTL"},
101 {E1000_SRRCTL(0), 4, 0x100, "E1000_SRRCTL"},
102 {E1000_DCA_RXCTRL(0), 4, 0x100, "E1000_DCA_RXCTRL"},
106 static const struct reg_info igb_regs_rx[] = {
107 {E1000_RCTL, 1, 1, "E1000_RCTL"},
108 {E1000_RXCSUM, 1, 1, "E1000_RXCSUM"},
109 {E1000_RLPML, 1, 1, "E1000_RLPML"},
110 {E1000_RFCTL, 1, 1, "E1000_RFCTL"},
111 {E1000_MRQC, 1, 1, "E1000_MRQC"},
112 {E1000_VT_CTL, 1, 1, "E1000_VT_CTL"},
113 {E1000_RAL(0), 16, 8, "E1000_RAL"},
114 {E1000_RAH(0), 16, 8, "E1000_RAH"},
118 static const struct reg_info igb_regs_tx[] = {
119 {E1000_TCTL, 1, 1, "E1000_TCTL"},
120 {E1000_TCTL_EXT, 1, 1, "E1000_TCTL_EXT"},
121 {E1000_TIPG, 1, 1, "E1000_TIPG"},
122 {E1000_DTXCTL, 1, 1, "E1000_DTXCTL"},
123 {E1000_TDBAL(0), 4, 0x100, "E1000_TDBAL"},
124 {E1000_TDBAH(0), 4, 0x100, "E1000_TDBAH"},
125 {E1000_TDLEN(0), 4, 0x100, "E1000_TDLEN"},
126 {E1000_TDH(0), 4, 0x100, "E1000_TDLEN"},
127 {E1000_TDT(0), 4, 0x100, "E1000_TDT"},
128 {E1000_TXDCTL(0), 4, 0x100, "E1000_TXDCTL"},
129 {E1000_TDWBAL(0), 4, 0x100, "E1000_TDWBAL"},
130 {E1000_TDWBAH(0), 4, 0x100, "E1000_TDWBAH"},
131 {E1000_DCA_TXCTRL(0), 4, 0x100, "E1000_DCA_TXCTRL"},
132 {E1000_TDFH, 1, 1, "E1000_TDFH"},
133 {E1000_TDFT, 1, 1, "E1000_TDFT"},
134 {E1000_TDFHS, 1, 1, "E1000_TDFHS"},
135 {E1000_TDFPC, 1, 1, "E1000_TDFPC"},
139 static const struct reg_info igb_regs_wakeup[] = {
140 {E1000_WUC, 1, 1, "E1000_WUC"},
141 {E1000_WUFC, 1, 1, "E1000_WUFC"},
142 {E1000_WUS, 1, 1, "E1000_WUS"},
143 {E1000_IPAV, 1, 1, "E1000_IPAV"},
144 {E1000_WUPL, 1, 1, "E1000_WUPL"},
145 {E1000_IP4AT_REG(0), 4, 8, "E1000_IP4AT_REG"},
146 {E1000_IP6AT_REG(0), 4, 4, "E1000_IP6AT_REG"},
147 {E1000_WUPM_REG(0), 4, 4, "E1000_WUPM_REG"},
148 {E1000_FFMT_REG(0), 4, 8, "E1000_FFMT_REG"},
149 {E1000_FFVT_REG(0), 4, 8, "E1000_FFVT_REG"},
150 {E1000_FFLT_REG(0), 4, 8, "E1000_FFLT_REG"},
154 static const struct reg_info igb_regs_mac[] = {
155 {E1000_PCS_CFG0, 1, 1, "E1000_PCS_CFG0"},
156 {E1000_PCS_LCTL, 1, 1, "E1000_PCS_LCTL"},
157 {E1000_PCS_LSTAT, 1, 1, "E1000_PCS_LSTAT"},
158 {E1000_PCS_ANADV, 1, 1, "E1000_PCS_ANADV"},
159 {E1000_PCS_LPAB, 1, 1, "E1000_PCS_LPAB"},
160 {E1000_PCS_NPTX, 1, 1, "E1000_PCS_NPTX"},
161 {E1000_PCS_LPABNP, 1, 1, "E1000_PCS_LPABNP"},
165 static const struct reg_info *igb_regs[] = {
177 /* FIXME: reading igb_regs_interrupt results side-effect which doesn't
178 * work with VFIO; re-install igb_regs_interrupt once issue is resolved.
180 static const struct reg_info *igbvf_regs[] = {
187 igb_read_regs(struct e1000_hw *hw, const struct reg_info *reg,
192 for (i = 0; i < reg->count; i++) {
193 reg_buf[i] = E1000_READ_REG(hw,
194 reg->base_addr + i * reg->stride);
200 igb_reg_group_count(const struct reg_info *regs)
205 while (regs[i].count)
206 count += regs[i++].count;
211 igb_read_regs_group(struct rte_eth_dev *dev, uint32_t *reg_buf,
212 const struct reg_info *regs)
216 struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
218 while (regs[i].count)
219 count += igb_read_regs(hw, ®s[i++], ®_buf[count]);
223 #endif /* _IGB_REGS_H_ */