Debian Codegraph @

drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c

raw
1 // SPDX-License-Identifier: GPL-2.0
2 /* Marvell Octeon EP (EndPoint) Ethernet Driver
3 *
4 * Copyright (C) 2020 Marvell.
5 *
6 */
7
8 #include <linux/pci.h>
9 #include <linux/netdevice.h>
10 #include <linux/etherdevice.h>
11
12 #include "octep_config.h"
13 #include "octep_main.h"
14 #include "octep_regs_cn9k_pf.h"
15
16 #define CTRL_MBOX_MAX_PF 128
17 #define CTRL_MBOX_SZ ((size_t)(0x400000 / CTRL_MBOX_MAX_PF))
18
19 /* Names of Hardware non-queue generic interrupts */
20 static char *cn93_non_ioq_msix_names[] = {
21 "epf_ire_rint",
22 "epf_ore_rint",
23 "epf_vfire_rint0",
24 "epf_vfire_rint1",
25 "epf_vfore_rint0",
26 "epf_vfore_rint1",
27 "epf_mbox_rint0",
28 "epf_mbox_rint1",
29 "epf_oei_rint",
30 "epf_dma_rint",
31 "epf_dma_vf_rint0",
32 "epf_dma_vf_rint1",
33 "epf_pp_vf_rint0",
34 "epf_pp_vf_rint1",
35 "epf_misc_rint",
36 "epf_rsvd",
37 };
38
39 /* Dump useful hardware CSRs for debug purpose */
40 static void cn93_dump_regs(struct octep_device *oct, int qno)
41 {
42 struct device *dev = &oct->pdev->dev;
43
44 dev_info(dev, "IQ-%d register dump\n", qno);
45 dev_info(dev, "R[%d]_IN_INSTR_DBELL[0x%llx]: 0x%016llx\n",
46 qno, CN93_SDP_R_IN_INSTR_DBELL(qno),
47 octep_read_csr64(oct, CN93_SDP_R_IN_INSTR_DBELL(qno)));
48 dev_info(dev, "R[%d]_IN_CONTROL[0x%llx]: 0x%016llx\n",
49 qno, CN93_SDP_R_IN_CONTROL(qno),
50 octep_read_csr64(oct, CN93_SDP_R_IN_CONTROL(qno)));
51 dev_info(dev, "R[%d]_IN_ENABLE[0x%llx]: 0x%016llx\n",
52 qno, CN93_SDP_R_IN_ENABLE(qno),
53 octep_read_csr64(oct, CN93_SDP_R_IN_ENABLE(qno)));
54 dev_info(dev, "R[%d]_IN_INSTR_BADDR[0x%llx]: 0x%016llx\n",
55 qno, CN93_SDP_R_IN_INSTR_BADDR(qno),
56 octep_read_csr64(oct, CN93_SDP_R_IN_INSTR_BADDR(qno)));
57 dev_info(dev, "R[%d]_IN_INSTR_RSIZE[0x%llx]: 0x%016llx\n",
58 qno, CN93_SDP_R_IN_INSTR_RSIZE(qno),
59 octep_read_csr64(oct, CN93_SDP_R_IN_INSTR_RSIZE(qno)));
60 dev_info(dev, "R[%d]_IN_CNTS[0x%llx]: 0x%016llx\n",
61 qno, CN93_SDP_R_IN_CNTS(qno),
62 octep_read_csr64(oct, CN93_SDP_R_IN_CNTS(qno)));
63 dev_info(dev, "R[%d]_IN_INT_LEVELS[0x%llx]: 0x%016llx\n",
64 qno, CN93_SDP_R_IN_INT_LEVELS(qno),
65 octep_read_csr64(oct, CN93_SDP_R_IN_INT_LEVELS(qno)));
66 dev_info(dev, "R[%d]_IN_PKT_CNT[0x%llx]: 0x%016llx\n",
67 qno, CN93_SDP_R_IN_PKT_CNT(qno),
68 octep_read_csr64(oct, CN93_SDP_R_IN_PKT_CNT(qno)));
69 dev_info(dev, "R[%d]_IN_BYTE_CNT[0x%llx]: 0x%016llx\n",
70 qno, CN93_SDP_R_IN_BYTE_CNT(qno),
71 octep_read_csr64(oct, CN93_SDP_R_IN_BYTE_CNT(qno)));
72
73 dev_info(dev, "OQ-%d register dump\n", qno);
74 dev_info(dev, "R[%d]_OUT_SLIST_DBELL[0x%llx]: 0x%016llx\n",
75 qno, CN93_SDP_R_OUT_SLIST_DBELL(qno),
76 octep_read_csr64(oct, CN93_SDP_R_OUT_SLIST_DBELL(qno)));
77 dev_info(dev, "R[%d]_OUT_CONTROL[0x%llx]: 0x%016llx\n",
78 qno, CN93_SDP_R_OUT_CONTROL(qno),
79 octep_read_csr64(oct, CN93_SDP_R_OUT_CONTROL(qno)));
80 dev_info(dev, "R[%d]_OUT_ENABLE[0x%llx]: 0x%016llx\n",
81 qno, CN93_SDP_R_OUT_ENABLE(qno),
82 octep_read_csr64(oct, CN93_SDP_R_OUT_ENABLE(qno)));
83 dev_info(dev, "R[%d]_OUT_SLIST_BADDR[0x%llx]: 0x%016llx\n",
84 qno, CN93_SDP_R_OUT_SLIST_BADDR(qno),
85 octep_read_csr64(oct, CN93_SDP_R_OUT_SLIST_BADDR(qno)));
86 dev_info(dev, "R[%d]_OUT_SLIST_RSIZE[0x%llx]: 0x%016llx\n",
87 qno, CN93_SDP_R_OUT_SLIST_RSIZE(qno),
88 octep_read_csr64(oct, CN93_SDP_R_OUT_SLIST_RSIZE(qno)));
89 dev_info(dev, "R[%d]_OUT_CNTS[0x%llx]: 0x%016llx\n",
90 qno, CN93_SDP_R_OUT_CNTS(qno),
91 octep_read_csr64(oct, CN93_SDP_R_OUT_CNTS(qno)));
92 dev_info(dev, "R[%d]_OUT_INT_LEVELS[0x%llx]: 0x%016llx\n",
93 qno, CN93_SDP_R_OUT_INT_LEVELS(qno),
94 octep_read_csr64(oct, CN93_SDP_R_OUT_INT_LEVELS(qno)));
95 dev_info(dev, "R[%d]_OUT_PKT_CNT[0x%llx]: 0x%016llx\n",
96 qno, CN93_SDP_R_OUT_PKT_CNT(qno),
97 octep_read_csr64(oct, CN93_SDP_R_OUT_PKT_CNT(qno)));
98 dev_info(dev, "R[%d]_OUT_BYTE_CNT[0x%llx]: 0x%016llx\n",
99 qno, CN93_SDP_R_OUT_BYTE_CNT(qno),
100 octep_read_csr64(oct, CN93_SDP_R_OUT_BYTE_CNT(qno)));
101 dev_info(dev, "R[%d]_ERR_TYPE[0x%llx]: 0x%016llx\n",
102 qno, CN93_SDP_R_ERR_TYPE(qno),
103 octep_read_csr64(oct, CN93_SDP_R_ERR_TYPE(qno)));
104 }
105
106 /* Reset Hardware Tx queue */
107 static int cn93_reset_iq(struct octep_device *oct, int q_no)
108 {
109 struct octep_config *conf = oct->conf;
110 u64 val = 0ULL;
111
112 dev_dbg(&oct->pdev->dev, "Reset PF IQ-%d\n", q_no);
113
114 /* Get absolute queue number */
115 q_no += conf->pf_ring_cfg.srn;
116
117 /* Disable the Tx/Instruction Ring */
118 octep_write_csr64(oct, CN93_SDP_R_IN_ENABLE(q_no), val);
119
120 /* clear the Instruction Ring packet/byte counts and doorbell CSRs */
121 octep_write_csr64(oct, CN93_SDP_R_IN_CNTS(q_no), val);
122 octep_write_csr64(oct, CN93_SDP_R_IN_INT_LEVELS(q_no), val);
123 octep_write_csr64(oct, CN93_SDP_R_IN_PKT_CNT(q_no), val);
124 octep_write_csr64(oct, CN93_SDP_R_IN_BYTE_CNT(q_no), val);
125 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_BADDR(q_no), val);
126 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_RSIZE(q_no), val);
127
128 val = 0xFFFFFFFF;
129 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_DBELL(q_no), val);
130
131 return 0;
132 }
133
134 /* Reset Hardware Rx queue */
135 static void cn93_reset_oq(struct octep_device *oct, int q_no)
136 {
137 u64 val = 0ULL;
138
139 q_no += CFG_GET_PORTS_PF_SRN(oct->conf);
140
141 /* Disable Output (Rx) Ring */
142 octep_write_csr64(oct, CN93_SDP_R_OUT_ENABLE(q_no), val);
143
144 /* Clear count CSRs */
145 val = octep_read_csr(oct, CN93_SDP_R_OUT_CNTS(q_no));
146 octep_write_csr(oct, CN93_SDP_R_OUT_CNTS(q_no), val);
147
148 octep_write_csr64(oct, CN93_SDP_R_OUT_PKT_CNT(q_no), 0xFFFFFFFFFULL);
149 octep_write_csr64(oct, CN93_SDP_R_OUT_SLIST_DBELL(q_no), 0xFFFFFFFF);
150 }
151
152 /* Reset all hardware Tx/Rx queues */
153 static void octep_reset_io_queues_cn93_pf(struct octep_device *oct)
154 {
155 struct pci_dev *pdev = oct->pdev;
156 int q;
157
158 dev_dbg(&pdev->dev, "Reset OCTEP_CN93 PF IO Queues\n");
159
160 for (q = 0; q < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); q++) {
161 cn93_reset_iq(oct, q);
162 cn93_reset_oq(oct, q);
163 }
164 }
165
166 /* Initialize windowed addresses to access some hardware registers */
167 static void octep_setup_pci_window_regs_cn93_pf(struct octep_device *oct)
168 {
169 u8 __iomem *bar0_pciaddr = oct->mmio[0].hw_addr;
170
171 oct->pci_win_regs.pci_win_wr_addr = (u8 __iomem *)(bar0_pciaddr + CN93_SDP_WIN_WR_ADDR64);
172 oct->pci_win_regs.pci_win_rd_addr = (u8 __iomem *)(bar0_pciaddr + CN93_SDP_WIN_RD_ADDR64);
173 oct->pci_win_regs.pci_win_wr_data = (u8 __iomem *)(bar0_pciaddr + CN93_SDP_WIN_WR_DATA64);
174 oct->pci_win_regs.pci_win_rd_data = (u8 __iomem *)(bar0_pciaddr + CN93_SDP_WIN_RD_DATA64);
175 }
176
177 /* Configure Hardware mapping: inform hardware which rings belong to PF. */
178 static void octep_configure_ring_mapping_cn93_pf(struct octep_device *oct)
179 {
180 struct octep_config *conf = oct->conf;
181 struct pci_dev *pdev = oct->pdev;
182 u64 pf_srn = CFG_GET_PORTS_PF_SRN(oct->conf);
183 int q;
184
185 for (q = 0; q < CFG_GET_PORTS_ACTIVE_IO_RINGS(conf); q++) {
186 u64 regval = 0;
187
188 if (oct->pcie_port)
189 regval = 8 << CN93_SDP_FUNC_SEL_EPF_BIT_POS;
190
191 octep_write_csr64(oct, CN93_SDP_EPVF_RING(pf_srn + q), regval);
192
193 regval = octep_read_csr64(oct, CN93_SDP_EPVF_RING(pf_srn + q));
194 dev_dbg(&pdev->dev, "Write SDP_EPVF_RING[0x%llx] = 0x%llx\n",
195 CN93_SDP_EPVF_RING(pf_srn + q), regval);
196 }
197 }
198
199 /* Initialize configuration limits and initial active config 93xx PF. */
200 static void octep_init_config_cn93_pf(struct octep_device *oct)
201 {
202 struct octep_config *conf = oct->conf;
203 struct pci_dev *pdev = oct->pdev;
204 u8 link = 0;
205 u64 val;
206 int pos;
207
208 /* Read ring configuration:
209 * PF ring count, number of VFs and rings per VF supported
210 */
211 val = octep_read_csr64(oct, CN93_SDP_EPF_RINFO);
212 conf->sriov_cfg.max_rings_per_vf = CN93_SDP_EPF_RINFO_RPVF(val);
213 conf->sriov_cfg.active_rings_per_vf = conf->sriov_cfg.max_rings_per_vf;
214 conf->sriov_cfg.max_vfs = CN93_SDP_EPF_RINFO_NVFS(val);
215 conf->sriov_cfg.active_vfs = conf->sriov_cfg.max_vfs;
216 conf->sriov_cfg.vf_srn = CN93_SDP_EPF_RINFO_SRN(val);
217
218 val = octep_read_csr64(oct, CN93_SDP_MAC_PF_RING_CTL(oct->pcie_port));
219 if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) {
220 conf->pf_ring_cfg.srn = CN98_SDP_MAC_PF_RING_CTL_SRN(val);
221 conf->pf_ring_cfg.max_io_rings = CN98_SDP_MAC_PF_RING_CTL_RPPF(val);
222 conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings;
223 } else {
224 conf->pf_ring_cfg.srn = CN93_SDP_MAC_PF_RING_CTL_SRN(val);
225 conf->pf_ring_cfg.max_io_rings = CN93_SDP_MAC_PF_RING_CTL_RPPF(val);
226 conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings;
227 }
228 dev_info(&pdev->dev, "pf_srn=%u rpvf=%u nvfs=%u rppf=%u\n",
229 conf->pf_ring_cfg.srn, conf->sriov_cfg.active_rings_per_vf,
230 conf->sriov_cfg.active_vfs, conf->pf_ring_cfg.active_io_rings);
231
232 conf->iq.num_descs = OCTEP_IQ_MAX_DESCRIPTORS;
233 conf->iq.instr_type = OCTEP_64BYTE_INSTR;
234 conf->iq.db_min = OCTEP_DB_MIN;
235 conf->iq.intr_threshold = OCTEP_IQ_INTR_THRESHOLD;
236
237 conf->oq.num_descs = OCTEP_OQ_MAX_DESCRIPTORS;
238 conf->oq.buf_size = OCTEP_OQ_BUF_SIZE;
239 conf->oq.refill_threshold = OCTEP_OQ_REFILL_THRESHOLD;
240 conf->oq.oq_intr_pkt = OCTEP_OQ_INTR_PKT_THRESHOLD;
241 conf->oq.oq_intr_time = OCTEP_OQ_INTR_TIME_THRESHOLD;
242
243 conf->msix_cfg.non_ioq_msix = CN93_NUM_NON_IOQ_INTR;
244 conf->msix_cfg.ioq_msix = conf->pf_ring_cfg.active_io_rings;
245 conf->msix_cfg.non_ioq_msix_names = cn93_non_ioq_msix_names;
246
247 pos = pci_find_ext_capability(oct->pdev, PCI_EXT_CAP_ID_SRIOV);
248 if (pos) {
249 pci_read_config_byte(oct->pdev,
250 pos + PCI_SRIOV_FUNC_LINK,
251 &link);
252 link = PCI_DEVFN(PCI_SLOT(oct->pdev->devfn), link);
253 }
254 conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr +
255 CN93_PEM_BAR4_INDEX_OFFSET +
256 (link * CTRL_MBOX_SZ);
257
258 conf->fw_info.hb_interval = OCTEP_DEFAULT_FW_HB_INTERVAL;
259 conf->fw_info.hb_miss_count = OCTEP_DEFAULT_FW_HB_MISS_COUNT;
260 }
261
262 /* Setup registers for a hardware Tx Queue */
263 static void octep_setup_iq_regs_cn93_pf(struct octep_device *oct, int iq_no)
264 {
265 struct octep_iq *iq = oct->iq[iq_no];
266 u32 reset_instr_cnt;
267 u64 reg_val;
268
269 iq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
270 reg_val = octep_read_csr64(oct, CN93_SDP_R_IN_CONTROL(iq_no));
271
272 /* wait for IDLE to set to 1 */
273 if (!(reg_val & CN93_R_IN_CTL_IDLE)) {
274 do {
275 reg_val = octep_read_csr64(oct, CN93_SDP_R_IN_CONTROL(iq_no));
276 } while (!(reg_val & CN93_R_IN_CTL_IDLE));
277 }
278
279 reg_val |= CN93_R_IN_CTL_RDSIZE;
280 reg_val |= CN93_R_IN_CTL_IS_64B;
281 reg_val |= CN93_R_IN_CTL_ESR;
282 octep_write_csr64(oct, CN93_SDP_R_IN_CONTROL(iq_no), reg_val);
283
284 /* Write the start of the input queue's ring and its size */
285 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_BADDR(iq_no),
286 iq->desc_ring_dma);
287 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_RSIZE(iq_no),
288 iq->max_count);
289
290 /* Remember the doorbell & instruction count register addr
291 * for this queue
292 */
293 iq->doorbell_reg = oct->mmio[0].hw_addr +
294 CN93_SDP_R_IN_INSTR_DBELL(iq_no);
295 iq->inst_cnt_reg = oct->mmio[0].hw_addr +
296 CN93_SDP_R_IN_CNTS(iq_no);
297 iq->intr_lvl_reg = oct->mmio[0].hw_addr +
298 CN93_SDP_R_IN_INT_LEVELS(iq_no);
299
300 /* Store the current instruction counter (used in flush_iq calculation) */
301 reset_instr_cnt = readl(iq->inst_cnt_reg);
302 writel(reset_instr_cnt, iq->inst_cnt_reg);
303
304 /* INTR_THRESHOLD is set to max(FFFFFFFF) to disable the INTR */
305 reg_val = CFG_GET_IQ_INTR_THRESHOLD(oct->conf) & 0xffffffff;
306 octep_write_csr64(oct, CN93_SDP_R_IN_INT_LEVELS(iq_no), reg_val);
307 }
308
309 /* Setup registers for a hardware Rx Queue */
310 static int octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_no)
311 {
312 u64 reg_val;
313 u64 oq_ctl = 0ULL;
314 u32 time_threshold = 0;
315 struct octep_oq *oq = oct->oq[oq_no];
316
317 oq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
318 reg_val = octep_read_csr64(oct, CN93_SDP_R_OUT_CONTROL(oq_no));
319
320 /* wait for IDLE to set to 1 */
321 if (!(reg_val & CN93_R_OUT_CTL_IDLE)) {
322 do {
323 reg_val = octep_read_csr64(oct, CN93_SDP_R_OUT_CONTROL(oq_no));
324 } while (!(reg_val & CN93_R_OUT_CTL_IDLE));
325 }
326
327 reg_val &= ~(CN93_R_OUT_CTL_IMODE);
328 reg_val &= ~(CN93_R_OUT_CTL_ROR_P);
329 reg_val &= ~(CN93_R_OUT_CTL_NSR_P);
330 reg_val &= ~(CN93_R_OUT_CTL_ROR_I);
331 reg_val &= ~(CN93_R_OUT_CTL_NSR_I);
332 reg_val &= ~(CN93_R_OUT_CTL_ES_I);
333 reg_val &= ~(CN93_R_OUT_CTL_ROR_D);
334 reg_val &= ~(CN93_R_OUT_CTL_NSR_D);
335 reg_val &= ~(CN93_R_OUT_CTL_ES_D);
336 reg_val |= (CN93_R_OUT_CTL_ES_P);
337
338 octep_write_csr64(oct, CN93_SDP_R_OUT_CONTROL(oq_no), reg_val);
339 octep_write_csr64(oct, CN93_SDP_R_OUT_SLIST_BADDR(oq_no),
340 oq->desc_ring_dma);
341 octep_write_csr64(oct, CN93_SDP_R_OUT_SLIST_RSIZE(oq_no),
342 oq->max_count);
343
344 oq_ctl = octep_read_csr64(oct, CN93_SDP_R_OUT_CONTROL(oq_no));
345 oq_ctl &= ~0x7fffffULL; //clear the ISIZE and BSIZE (22-0)
346 oq_ctl |= (oq->buffer_size & 0xffff); //populate the BSIZE (15-0)
347 octep_write_csr64(oct, CN93_SDP_R_OUT_CONTROL(oq_no), oq_ctl);
348
349 /* Get the mapped address of the pkt_sent and pkts_credit regs */
350 oq->pkts_sent_reg = oct->mmio[0].hw_addr + CN93_SDP_R_OUT_CNTS(oq_no);
351 oq->pkts_credit_reg = oct->mmio[0].hw_addr +
352 CN93_SDP_R_OUT_SLIST_DBELL(oq_no);
353
354 time_threshold = CFG_GET_OQ_INTR_TIME(oct->conf);
355 reg_val = ((u64)time_threshold << 32) |
356 CFG_GET_OQ_INTR_PKT(oct->conf);
357 octep_write_csr64(oct, CN93_SDP_R_OUT_INT_LEVELS(oq_no), reg_val);
358 return 0;
359 }
360
361 /* Setup registers for a PF mailbox */
362 static void octep_setup_mbox_regs_cn93_pf(struct octep_device *oct, int q_no)
363 {
364 struct octep_mbox *mbox = oct->mbox[q_no];
365
366 /* PF to VF DATA reg. PF writes into this reg */
367 mbox->pf_vf_data_reg = oct->mmio[0].hw_addr + CN93_SDP_MBOX_PF_VF_DATA(q_no);
368
369 /* VF to PF DATA reg. PF reads from this reg */
370 mbox->vf_pf_data_reg = oct->mmio[0].hw_addr + CN93_SDP_MBOX_VF_PF_DATA(q_no);
371 }
372
373 /* Poll for mailbox messages from VF */
374 static void octep_poll_pfvf_mailbox(struct octep_device *oct)
375 {
376 u32 vf, active_vfs, active_rings_per_vf, vf_mbox_queue;
377 u64 reg0, reg1;
378
379 reg0 = octep_read_csr64(oct, CN93_SDP_EPF_MBOX_RINT(0));
380 reg1 = octep_read_csr64(oct, CN93_SDP_EPF_MBOX_RINT(1));
381 if (reg0 || reg1) {
382 active_vfs = CFG_GET_ACTIVE_VFS(oct->conf);
383 active_rings_per_vf = CFG_GET_ACTIVE_RPVF(oct->conf);
384 for (vf = 0; vf < active_vfs; vf++) {
385 vf_mbox_queue = vf * active_rings_per_vf;
386
387 if (vf_mbox_queue < 64) {
388 if (!(reg0 & (0x1UL << vf_mbox_queue)))
389 continue;
390 } else {
391 if (!(reg1 & (0x1UL << (vf_mbox_queue - 64))))
392 continue;
393 }
394
395 if (!oct->mbox[vf_mbox_queue]) {
396 dev_err(&oct->pdev->dev, "bad mbox vf %d\n", vf);
397 continue;
398 }
399 schedule_work(&oct->mbox[vf_mbox_queue]->wk.work);
400 }
401 if (reg0)
402 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT(0), reg0);
403 if (reg1)
404 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT(1), reg1);
405 }
406 }
407
408 /* PF-VF mailbox interrupt handler */
409 static irqreturn_t octep_pfvf_mbox_intr_handler_cn93_pf(void *dev)
410 {
411 struct octep_device *oct = (struct octep_device *)dev;
412
413 octep_poll_pfvf_mailbox(oct);
414 return IRQ_HANDLED;
415 }
416
417 /* Poll OEI events like heartbeat */
418 static void octep_poll_oei_cn93_pf(struct octep_device *oct)
419 {
420 u64 reg;
421
422 reg = octep_read_csr64(oct, CN93_SDP_EPF_OEI_RINT);
423 if (reg) {
424 octep_write_csr64(oct, CN93_SDP_EPF_OEI_RINT, reg);
425 if (reg & CN93_SDP_EPF_OEI_RINT_DATA_BIT_MBOX)
426 queue_work(octep_wq, &oct->ctrl_mbox_task);
427 else if (reg & CN93_SDP_EPF_OEI_RINT_DATA_BIT_HBEAT)
428 atomic_set(&oct->hb_miss_cnt, 0);
429 }
430 }
431
432 /* OEI interrupt handler */
433 static irqreturn_t octep_oei_intr_handler_cn93_pf(void *dev)
434 {
435 struct octep_device *oct = (struct octep_device *)dev;
436
437 octep_poll_oei_cn93_pf(oct);
438 return IRQ_HANDLED;
439 }
440
441 /* Process non-ioq interrupts required to keep pf interface running.
442 * OEI_RINT is needed for control mailbox
443 */
444 static void octep_poll_non_ioq_interrupts_cn93_pf(struct octep_device *oct)
445 {
446 octep_poll_pfvf_mailbox(oct);
447 octep_poll_oei_cn93_pf(oct);
448 }
449
450 /* Interrupt handler for input ring error interrupts. */
451 static irqreturn_t octep_ire_intr_handler_cn93_pf(void *dev)
452 {
453 struct octep_device *oct = (struct octep_device *)dev;
454 struct pci_dev *pdev = oct->pdev;
455 u64 reg_val = 0;
456 int i = 0;
457
458 /* Check for IRERR INTR */
459 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_IRERR_RINT);
460 if (reg_val) {
461 dev_info(&pdev->dev,
462 "received IRERR_RINT intr: 0x%llx\n", reg_val);
463 octep_write_csr64(oct, CN93_SDP_EPF_IRERR_RINT, reg_val);
464
465 for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++) {
466 reg_val = octep_read_csr64(oct,
467 CN93_SDP_R_ERR_TYPE(i));
468 if (reg_val) {
469 dev_info(&pdev->dev,
470 "Received err type on IQ-%d: 0x%llx\n",
471 i, reg_val);
472 octep_write_csr64(oct, CN93_SDP_R_ERR_TYPE(i),
473 reg_val);
474 }
475 }
476 }
477 return IRQ_HANDLED;
478 }
479
480 /* Interrupt handler for output ring error interrupts. */
481 static irqreturn_t octep_ore_intr_handler_cn93_pf(void *dev)
482 {
483 struct octep_device *oct = (struct octep_device *)dev;
484 struct pci_dev *pdev = oct->pdev;
485 u64 reg_val = 0;
486 int i = 0;
487
488 /* Check for ORERR INTR */
489 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_ORERR_RINT);
490 if (reg_val) {
491 dev_info(&pdev->dev,
492 "Received ORERR_RINT intr: 0x%llx\n", reg_val);
493 octep_write_csr64(oct, CN93_SDP_EPF_ORERR_RINT, reg_val);
494 for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++) {
495 reg_val = octep_read_csr64(oct, CN93_SDP_R_ERR_TYPE(i));
496 if (reg_val) {
497 dev_info(&pdev->dev,
498 "Received err type on OQ-%d: 0x%llx\n",
499 i, reg_val);
500 octep_write_csr64(oct, CN93_SDP_R_ERR_TYPE(i),
501 reg_val);
502 }
503 }
504 }
505 return IRQ_HANDLED;
506 }
507
508 /* Interrupt handler for vf input ring error interrupts. */
509 static irqreturn_t octep_vfire_intr_handler_cn93_pf(void *dev)
510 {
511 struct octep_device *oct = (struct octep_device *)dev;
512 struct pci_dev *pdev = oct->pdev;
513 u64 reg_val = 0;
514
515 /* Check for VFIRE INTR */
516 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_VFIRE_RINT(0));
517 if (reg_val) {
518 dev_info(&pdev->dev,
519 "Received VFIRE_RINT intr: 0x%llx\n", reg_val);
520 octep_write_csr64(oct, CN93_SDP_EPF_VFIRE_RINT(0), reg_val);
521 }
522 return IRQ_HANDLED;
523 }
524
525 /* Interrupt handler for vf output ring error interrupts. */
526 static irqreturn_t octep_vfore_intr_handler_cn93_pf(void *dev)
527 {
528 struct octep_device *oct = (struct octep_device *)dev;
529 struct pci_dev *pdev = oct->pdev;
530 u64 reg_val = 0;
531
532 /* Check for VFORE INTR */
533 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_VFORE_RINT(0));
534 if (reg_val) {
535 dev_info(&pdev->dev,
536 "Received VFORE_RINT intr: 0x%llx\n", reg_val);
537 octep_write_csr64(oct, CN93_SDP_EPF_VFORE_RINT(0), reg_val);
538 }
539 return IRQ_HANDLED;
540 }
541
542 /* Interrupt handler for dpi dma related interrupts. */
543 static irqreturn_t octep_dma_intr_handler_cn93_pf(void *dev)
544 {
545 struct octep_device *oct = (struct octep_device *)dev;
546 u64 reg_val = 0;
547
548 /* Check for DMA INTR */
549 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_DMA_RINT);
550 if (reg_val) {
551 octep_write_csr64(oct, CN93_SDP_EPF_DMA_RINT, reg_val);
552 }
553 return IRQ_HANDLED;
554 }
555
556 /* Interrupt handler for dpi dma transaction error interrupts for VFs */
557 static irqreturn_t octep_dma_vf_intr_handler_cn93_pf(void *dev)
558 {
559 struct octep_device *oct = (struct octep_device *)dev;
560 struct pci_dev *pdev = oct->pdev;
561 u64 reg_val = 0;
562
563 /* Check for DMA VF INTR */
564 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_DMA_VF_RINT(0));
565 if (reg_val) {
566 dev_info(&pdev->dev,
567 "Received DMA_VF_RINT intr: 0x%llx\n", reg_val);
568 octep_write_csr64(oct, CN93_SDP_EPF_DMA_VF_RINT(0), reg_val);
569 }
570 return IRQ_HANDLED;
571 }
572
573 /* Interrupt handler for pp transaction error interrupts for VFs */
574 static irqreturn_t octep_pp_vf_intr_handler_cn93_pf(void *dev)
575 {
576 struct octep_device *oct = (struct octep_device *)dev;
577 struct pci_dev *pdev = oct->pdev;
578 u64 reg_val = 0;
579
580 /* Check for PPVF INTR */
581 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_PP_VF_RINT(0));
582 if (reg_val) {
583 dev_info(&pdev->dev,
584 "Received PP_VF_RINT intr: 0x%llx\n", reg_val);
585 octep_write_csr64(oct, CN93_SDP_EPF_PP_VF_RINT(0), reg_val);
586 }
587 return IRQ_HANDLED;
588 }
589
590 /* Interrupt handler for mac related interrupts. */
591 static irqreturn_t octep_misc_intr_handler_cn93_pf(void *dev)
592 {
593 struct octep_device *oct = (struct octep_device *)dev;
594 struct pci_dev *pdev = oct->pdev;
595 u64 reg_val = 0;
596
597 /* Check for MISC INTR */
598 reg_val = octep_read_csr64(oct, CN93_SDP_EPF_MISC_RINT);
599 if (reg_val) {
600 dev_info(&pdev->dev,
601 "Received MISC_RINT intr: 0x%llx\n", reg_val);
602 octep_write_csr64(oct, CN93_SDP_EPF_MISC_RINT, reg_val);
603 }
604 return IRQ_HANDLED;
605 }
606
607 /* Interrupts handler for all reserved interrupts. */
608 static irqreturn_t octep_rsvd_intr_handler_cn93_pf(void *dev)
609 {
610 struct octep_device *oct = (struct octep_device *)dev;
611 struct pci_dev *pdev = oct->pdev;
612
613 dev_info(&pdev->dev, "Reserved interrupts raised; Ignore\n");
614 return IRQ_HANDLED;
615 }
616
617 /* Tx/Rx queue interrupt handler */
618 static irqreturn_t octep_ioq_intr_handler_cn93_pf(void *data)
619 {
620 struct octep_ioq_vector *vector = (struct octep_ioq_vector *)data;
621 struct octep_oq *oq = vector->oq;
622
623 napi_schedule_irqoff(oq->napi);
624 return IRQ_HANDLED;
625 }
626
627 /* soft reset of 98xx */
628 static int octep_soft_reset_cn98_pf(struct octep_device *oct)
629 {
630 dev_info(&oct->pdev->dev, "CN98XX: skip soft reset\n");
631 return 0;
632 }
633
634 /* soft reset of 93xx */
635 static int octep_soft_reset_cn93_pf(struct octep_device *oct)
636 {
637 dev_info(&oct->pdev->dev, "CN93XX: Doing soft reset\n");
638
639 octep_write_csr64(oct, CN93_SDP_WIN_WR_MASK_REG, 0xFF);
640
641 /* Firmware status CSR is supposed to be cleared by
642 * core domain reset, but due to a hw bug, it is not.
643 * Set it to RUNNING right before reset so that it is not
644 * left in READY (1) state after a reset. This is required
645 * in addition to the early setting to handle the case where
646 * the OcteonTX is unexpectedly reset, reboots, and then
647 * the module is removed.
648 */
649 OCTEP_PCI_WIN_WRITE(oct,
650 CN9K_PEMX_PFX_CSX_PFCFGX(0,
651 0, CN9K_PCIEEP_VSECST_CTL),
652 FW_STATUS_DOWNING);
653
654 /* Set core domain reset bit */
655 OCTEP_PCI_WIN_WRITE(oct, CN93_RST_CORE_DOMAIN_W1S, 1);
656 /* Wait for 100ms as Octeon resets. */
657 mdelay(100);
658 /* clear core domain reset bit */
659 OCTEP_PCI_WIN_WRITE(oct, CN93_RST_CORE_DOMAIN_W1C, 1);
660
661 return 0;
662 }
663
664 /* Re-initialize Octeon hardware registers */
665 static void octep_reinit_regs_cn93_pf(struct octep_device *oct)
666 {
667 u32 i;
668
669 for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
670 oct->hw_ops.setup_iq_regs(oct, i);
671
672 for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
673 oct->hw_ops.setup_oq_regs(oct, i);
674
675 oct->hw_ops.enable_interrupts(oct);
676 oct->hw_ops.enable_io_queues(oct);
677
678 for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
679 writel(oct->oq[i]->max_count, oct->oq[i]->pkts_credit_reg);
680 }
681
682 /* Enable all interrupts */
683 static void octep_enable_interrupts_cn93_pf(struct octep_device *oct)
684 {
685 u64 intr_mask = 0ULL;
686 int srn, num_rings, i;
687
688 srn = CFG_GET_PORTS_PF_SRN(oct->conf);
689 num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
690
691 for (i = 0; i < num_rings; i++)
692 intr_mask |= (0x1ULL << (srn + i));
693
694 octep_write_csr64(oct, CN93_SDP_EPF_IRERR_RINT_ENA_W1S, intr_mask);
695 octep_write_csr64(oct, CN93_SDP_EPF_ORERR_RINT_ENA_W1S, intr_mask);
696 octep_write_csr64(oct, CN93_SDP_EPF_OEI_RINT_ENA_W1S, -1ULL);
697
698 octep_write_csr64(oct, CN93_SDP_EPF_VFIRE_RINT_ENA_W1S(0), -1ULL);
699 octep_write_csr64(oct, CN93_SDP_EPF_VFORE_RINT_ENA_W1S(0), -1ULL);
700
701 octep_write_csr64(oct, CN93_SDP_EPF_MISC_RINT_ENA_W1S, intr_mask);
702 octep_write_csr64(oct, CN93_SDP_EPF_DMA_RINT_ENA_W1S, intr_mask);
703 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT_ENA_W1S(0), -1ULL);
704 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT_ENA_W1S(1), -1ULL);
705
706 octep_write_csr64(oct, CN93_SDP_EPF_DMA_VF_RINT_ENA_W1S(0), -1ULL);
707 octep_write_csr64(oct, CN93_SDP_EPF_PP_VF_RINT_ENA_W1S(0), -1ULL);
708 }
709
710 /* Disable all interrupts */
711 static void octep_disable_interrupts_cn93_pf(struct octep_device *oct)
712 {
713 u64 reg_val, intr_mask = 0ULL;
714 int srn, num_rings, i;
715
716 srn = CFG_GET_PORTS_PF_SRN(oct->conf);
717 num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
718
719 for (i = 0; i < num_rings; i++) {
720 intr_mask |= BIT_ULL(srn + i);
721 reg_val = octep_read_csr64(oct,
722 CN93_SDP_R_IN_INT_LEVELS(srn + i));
723 reg_val &= ~CN93_INT_ENA_BIT;
724 octep_write_csr64(oct,
725 CN93_SDP_R_IN_INT_LEVELS(srn + i), reg_val);
726
727 reg_val = octep_read_csr64(oct,
728 CN93_SDP_R_OUT_INT_LEVELS(srn + i));
729 reg_val &= ~CN93_INT_ENA_BIT;
730 octep_write_csr64(oct,
731 CN93_SDP_R_OUT_INT_LEVELS(srn + i), reg_val);
732 }
733
734 octep_write_csr64(oct, CN93_SDP_EPF_IRERR_RINT_ENA_W1C, intr_mask);
735 octep_write_csr64(oct, CN93_SDP_EPF_ORERR_RINT_ENA_W1C, intr_mask);
736 octep_write_csr64(oct, CN93_SDP_EPF_OEI_RINT_ENA_W1C, -1ULL);
737
738 octep_write_csr64(oct, CN93_SDP_EPF_VFIRE_RINT_ENA_W1C(0), -1ULL);
739 octep_write_csr64(oct, CN93_SDP_EPF_VFORE_RINT_ENA_W1C(0), -1ULL);
740
741 octep_write_csr64(oct, CN93_SDP_EPF_MISC_RINT_ENA_W1C, intr_mask);
742 octep_write_csr64(oct, CN93_SDP_EPF_DMA_RINT_ENA_W1C, intr_mask);
743 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT_ENA_W1C(0), -1ULL);
744 octep_write_csr64(oct, CN93_SDP_EPF_MBOX_RINT_ENA_W1C(1), -1ULL);
745
746 octep_write_csr64(oct, CN93_SDP_EPF_DMA_VF_RINT_ENA_W1C(0), -1ULL);
747 octep_write_csr64(oct, CN93_SDP_EPF_PP_VF_RINT_ENA_W1C(0), -1ULL);
748 }
749
750 /* Get new Octeon Read Index: index of descriptor that Octeon reads next. */
751 static u32 octep_update_iq_read_index_cn93_pf(struct octep_iq *iq)
752 {
753 u32 pkt_in_done = readl(iq->inst_cnt_reg);
754 u32 last_done, new_idx;
755
756 last_done = pkt_in_done - iq->pkt_in_done;
757 iq->pkt_in_done = pkt_in_done;
758
759 new_idx = (iq->octep_read_index + last_done) % iq->max_count;
760
761 return new_idx;
762 }
763
764 /* Enable a hardware Tx Queue */
765 static void octep_enable_iq_cn93_pf(struct octep_device *oct, int iq_no)
766 {
767 u64 loop = HZ;
768 u64 reg_val;
769
770 iq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
771
772 octep_write_csr64(oct, CN93_SDP_R_IN_INSTR_DBELL(iq_no), 0xFFFFFFFF);
773
774 while (octep_read_csr64(oct, CN93_SDP_R_IN_INSTR_DBELL(iq_no)) &&
775 loop--) {
776 schedule_timeout_interruptible(1);
777 }
778
779 reg_val = octep_read_csr64(oct, CN93_SDP_R_IN_INT_LEVELS(iq_no));
780 reg_val |= (0x1ULL << 62);
781 octep_write_csr64(oct, CN93_SDP_R_IN_INT_LEVELS(iq_no), reg_val);
782
783 reg_val = octep_read_csr64(oct, CN93_SDP_R_IN_ENABLE(iq_no));
784 reg_val |= 0x1ULL;
785 octep_write_csr64(oct, CN93_SDP_R_IN_ENABLE(iq_no), reg_val);
786 }
787
788 /* Enable a hardware Rx Queue */
789 static void octep_enable_oq_cn93_pf(struct octep_device *oct, int oq_no)
790 {
791 u64 reg_val = 0ULL;
792
793 oq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
794
795 reg_val = octep_read_csr64(oct, CN93_SDP_R_OUT_INT_LEVELS(oq_no));
796 reg_val |= (0x1ULL << 62);
797 octep_write_csr64(oct, CN93_SDP_R_OUT_INT_LEVELS(oq_no), reg_val);
798
799 octep_write_csr64(oct, CN93_SDP_R_OUT_SLIST_DBELL(oq_no), 0xFFFFFFFF);
800
801 reg_val = octep_read_csr64(oct, CN93_SDP_R_OUT_ENABLE(oq_no));
802 reg_val |= 0x1ULL;
803 octep_write_csr64(oct, CN93_SDP_R_OUT_ENABLE(oq_no), reg_val);
804 }
805
806 /* Enable all hardware Tx/Rx Queues assined to PF */
807 static void octep_enable_io_queues_cn93_pf(struct octep_device *oct)
808 {
809 u8 q;
810
811 for (q = 0; q < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); q++) {
812 octep_enable_iq_cn93_pf(oct, q);
813 octep_enable_oq_cn93_pf(oct, q);
814 }
815 }
816
817 /* Disable a hardware Tx Queue assined to PF */
818 static void octep_disable_iq_cn93_pf(struct octep_device *oct, int iq_no)
819 {
820 u64 reg_val = 0ULL;
821
822 iq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
823
824 reg_val = octep_read_csr64(oct, CN93_SDP_R_IN_ENABLE(iq_no));
825 reg_val &= ~0x1ULL;
826 octep_write_csr64(oct, CN93_SDP_R_IN_ENABLE(iq_no), reg_val);
827 }
828
829 /* Disable a hardware Rx Queue assined to PF */
830 static void octep_disable_oq_cn93_pf(struct octep_device *oct, int oq_no)
831 {
832 u64 reg_val = 0ULL;
833
834 oq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
835 reg_val = octep_read_csr64(oct, CN93_SDP_R_OUT_ENABLE(oq_no));
836 reg_val &= ~0x1ULL;
837 octep_write_csr64(oct, CN93_SDP_R_OUT_ENABLE(oq_no), reg_val);
838 }
839
840 /* Disable all hardware Tx/Rx Queues assined to PF */
841 static void octep_disable_io_queues_cn93_pf(struct octep_device *oct)
842 {
843 int q = 0;
844
845 for (q = 0; q < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); q++) {
846 octep_disable_iq_cn93_pf(oct, q);
847 octep_disable_oq_cn93_pf(oct, q);
848 }
849 }
850
851 /* Dump hardware registers (including Tx/Rx queues) for debugging. */
852 static void octep_dump_registers_cn93_pf(struct octep_device *oct)
853 {
854 u8 srn, num_rings, q;
855
856 srn = CFG_GET_PORTS_PF_SRN(oct->conf);
857 num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
858
859 for (q = srn; q < srn + num_rings; q++)
860 cn93_dump_regs(oct, q);
861 }
862
863 /**
864 * octep_device_setup_cn93_pf() - Setup Octeon device.
865 *
866 * @oct: Octeon device private data structure.
867 *
868 * - initialize hardware operations.
869 * - get target side pcie port number for the device.
870 * - setup window access to hardware registers.
871 * - set initial configuration and max limits.
872 * - setup hardware mapping of rings to the PF device.
873 */
874 void octep_device_setup_cn93_pf(struct octep_device *oct)
875 {
876 oct->hw_ops.setup_iq_regs = octep_setup_iq_regs_cn93_pf;
877 oct->hw_ops.setup_oq_regs = octep_setup_oq_regs_cn93_pf;
878 oct->hw_ops.setup_mbox_regs = octep_setup_mbox_regs_cn93_pf;
879
880 oct->hw_ops.mbox_intr_handler = octep_pfvf_mbox_intr_handler_cn93_pf;
881 oct->hw_ops.oei_intr_handler = octep_oei_intr_handler_cn93_pf;
882 oct->hw_ops.ire_intr_handler = octep_ire_intr_handler_cn93_pf;
883 oct->hw_ops.ore_intr_handler = octep_ore_intr_handler_cn93_pf;
884 oct->hw_ops.vfire_intr_handler = octep_vfire_intr_handler_cn93_pf;
885 oct->hw_ops.vfore_intr_handler = octep_vfore_intr_handler_cn93_pf;
886 oct->hw_ops.dma_intr_handler = octep_dma_intr_handler_cn93_pf;
887 oct->hw_ops.dma_vf_intr_handler = octep_dma_vf_intr_handler_cn93_pf;
888 oct->hw_ops.pp_vf_intr_handler = octep_pp_vf_intr_handler_cn93_pf;
889 oct->hw_ops.misc_intr_handler = octep_misc_intr_handler_cn93_pf;
890 oct->hw_ops.rsvd_intr_handler = octep_rsvd_intr_handler_cn93_pf;
891 oct->hw_ops.ioq_intr_handler = octep_ioq_intr_handler_cn93_pf;
892 if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF)
893 oct->hw_ops.soft_reset = octep_soft_reset_cn98_pf;
894 else
895 oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf;
896 oct->hw_ops.reinit_regs = octep_reinit_regs_cn93_pf;
897
898 oct->hw_ops.enable_interrupts = octep_enable_interrupts_cn93_pf;
899 oct->hw_ops.disable_interrupts = octep_disable_interrupts_cn93_pf;
900 oct->hw_ops.poll_non_ioq_interrupts = octep_poll_non_ioq_interrupts_cn93_pf;
901
902 oct->hw_ops.update_iq_read_idx = octep_update_iq_read_index_cn93_pf;
903
904 oct->hw_ops.enable_iq = octep_enable_iq_cn93_pf;
905 oct->hw_ops.enable_oq = octep_enable_oq_cn93_pf;
906 oct->hw_ops.enable_io_queues = octep_enable_io_queues_cn93_pf;
907
908 oct->hw_ops.disable_iq = octep_disable_iq_cn93_pf;
909 oct->hw_ops.disable_oq = octep_disable_oq_cn93_pf;
910 oct->hw_ops.disable_io_queues = octep_disable_io_queues_cn93_pf;
911 oct->hw_ops.reset_io_queues = octep_reset_io_queues_cn93_pf;
912
913 oct->hw_ops.dump_registers = octep_dump_registers_cn93_pf;
914
915 octep_setup_pci_window_regs_cn93_pf(oct);
916
917 oct->pcie_port = octep_read_csr64(oct, CN93_SDP_MAC_NUMBER) & 0xff;
918 dev_info(&oct->pdev->dev,
919 "Octeon device using PCIE Port %d\n", oct->pcie_port);
920
921 octep_init_config_cn93_pf(oct);
922 octep_configure_ring_mapping_cn93_pf(oct);
923
924 if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF)
925 return;
926
927 /* Firmware status CSR is supposed to be cleared by
928 * core domain reset, but due to IPBUPEM-38842, it is not.
929 * Set it to RUNNING early in boot, so that unexpected resets
930 * leave it in a state that is not READY (1).
931 */
932 OCTEP_PCI_WIN_WRITE(oct,
933 CN9K_PEMX_PFX_CSX_PFCFGX(0,
934 0, CN9K_PCIEEP_VSECST_CTL),
935 FW_STATUS_RUNNING);
936 }