1 /***********************license start***************
2 * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
35 * For any questions regarding licensing please contact marketing@caviumnetworks.com
37 ***********************license end**************************************/
42 * Utility functions to decode Octeon's RSL_INT_BLOCKS
43 * interrupts into error messages.
45 * <hr>$Revision: 32636 $<hr>
48 #include "cvmx-interrupt.h"
52 #define PRINT_ERROR(format, ...) cvmx_safe_printf("ERROR " format, ##__VA_ARGS__)
55 /* Change this to a 1 before calling cvmx_interrupt_rsl_enable() to report
56 single bit ecc errors and other correctable errors */
57 CVMX_SHARED int __cvmx_interrupt_ecc_report_single_bit_errors = 0;
59 void __cvmx_interrupt_agl_gmx_rxx_int_en_enable(int index);
60 void __cvmx_interrupt_agl_gmx_rxx_int_reg_decode(int index);
61 void __cvmx_interrupt_fpa_int_enb_enable(void);
62 void __cvmx_interrupt_fpa_int_sum_decode(void);
63 void __cvmx_interrupt_gmxx_rxx_int_en_enable(int index, int block);
64 void __cvmx_interrupt_gmxx_rxx_int_reg_decode(int index, int block);
65 void __cvmx_interrupt_iob_int_enb_enable(void);
66 void __cvmx_interrupt_iob_int_sum_decode(void);
67 void __cvmx_interrupt_ipd_int_enb_enable(void);
68 void __cvmx_interrupt_ipd_int_sum_decode(void);
69 void __cvmx_interrupt_key_int_enb_enable(void);
70 void __cvmx_interrupt_key_int_sum_decode(void);
71 void __cvmx_interrupt_mio_boot_int_enable(void);
72 void __cvmx_interrupt_mio_boot_err_decode(void);
73 void __cvmx_interrupt_npei_int_sum_decode(void);
74 void __cvmx_interrupt_npei_int_enb2_enable(void);
75 void __cvmx_interrupt_npi_int_enb_enable(void);
76 void __cvmx_interrupt_npi_int_sum_decode(void);
77 void __cvmx_interrupt_pcsx_intx_en_reg_enable(int index, int block);
78 void __cvmx_interrupt_pcsx_intx_reg_decode(int index, int block);
79 void __cvmx_interrupt_pcsxx_int_en_reg_enable(int index);
80 void __cvmx_interrupt_pcsxx_int_reg_decode(int index);
81 void __cvmx_interrupt_pescx_dbg_info_en_enable(int index);
82 void __cvmx_interrupt_pescx_dbg_info_decode(int index);
83 void __cvmx_interrupt_pip_int_en_enable(void);
84 void __cvmx_interrupt_pip_int_reg_decode(void);
85 void __cvmx_interrupt_pko_reg_int_mask_enable(void);
86 void __cvmx_interrupt_pko_reg_error_decode(void);
87 void __cvmx_interrupt_rad_reg_int_mask_enable(void);
88 void __cvmx_interrupt_rad_reg_error_decode(void);
89 void __cvmx_interrupt_spxx_int_msk_enable(int index);
90 void __cvmx_interrupt_spxx_int_reg_decode(int index);
91 void __cvmx_interrupt_stxx_int_msk_enable(int index);
92 void __cvmx_interrupt_stxx_int_reg_decode(int index);
93 void __cvmx_interrupt_usbnx_int_enb_enable(int index);
94 void __cvmx_interrupt_usbnx_int_sum_decode(int index);
95 void __cvmx_interrupt_zip_int_mask_enable(void);
96 void __cvmx_interrupt_zip_error_decode(void);
100 * Enable ASX error interrupts that exist on CN3XXX, CN50XX, and
103 * @param block Interface to enable 0-1
105 static void __cvmx_interrupt_asxx_enable(int block)
108 cvmx_asxx_int_en_t csr;
109 /* CN38XX and CN58XX have two interfaces with 4 ports per interface. All
110 other chips have a max of 3 ports on interface 0 */
111 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
112 mask = 0xf; /* Set enables for 4 ports */
114 mask = 0x7; /* Set enables for 3 ports */
116 /* Enable interface interrupts */
117 csr.u64 = cvmx_read_csr(CVMX_ASXX_INT_EN(block));
121 cvmx_write_csr(CVMX_ASXX_INT_EN(block), csr.u64);
126 * Decode ASX error interrupts for CN3XXX, CN50XX, and CN58XX
128 * @param block Interface to decode 0-1
130 static void __cvmx_interrupt_asxx_decode(int block)
132 cvmx_asxx_int_reg_t err;
133 err.u64 = cvmx_read_csr(CVMX_ASXX_INT_REG(block));
134 cvmx_write_csr(CVMX_ASXX_INT_REG(block), err.u64);
138 for (port = 0; port < 4; port++)
140 if (err.s.ovrflw & (1 << port))
141 PRINT_ERROR("ASX%d_INT_REG[OVRFLW]: RX FIFO overflow on RMGII port %d\n",
142 block, port + block*16);
143 if (err.s.txpop & (1 << port))
144 PRINT_ERROR("ASX%d_INT_REG[TXPOP]: TX FIFO underflow on RMGII port %d\n",
145 block, port + block*16);
146 if (err.s.txpsh & (1 << port))
147 PRINT_ERROR("ASX%d_INT_REG[TXPSH]: TX FIFO overflow on RMGII port %d\n",
148 block, port + block*16);
155 * Enable DFA errors for CN38XX, CN58XX, and CN31XX
157 static void __cvmx_interrupt_dfa_enable(void)
160 csr.u64 = cvmx_read_csr(CVMX_DFA_ERR);
167 csr.s.dtesbina = __cvmx_interrupt_ecc_report_single_bit_errors;
170 csr.s.cp2sbina = __cvmx_interrupt_ecc_report_single_bit_errors;
172 cvmx_write_csr(CVMX_DFA_ERR, csr.u64);
177 * Decode DFA errors for CN38XX, CN58XX, and CN31XX
179 static void __cvmx_interrupt_dfa_decode(void)
183 err.u64 = cvmx_read_csr(CVMX_DFA_ERR);
184 cvmx_write_csr(CVMX_DFA_ERR, err.u64);
188 PRINT_ERROR("DFA_ERR[DBLOVF]: Doorbell Overflow detected\n");
190 PRINT_ERROR("DFA_ERR[CP2PERR]: PP-CP2 Parity Error Detected\n");
192 PRINT_ERROR("DFA_ERR[DTEPERR]: DTE Parity Error Detected\n");
195 PRINT_ERROR("DFA_ERR[DTEDBE]: DFA DTE 29b Double Bit Error Detected\n");
196 if (err.s.dtesbe && __cvmx_interrupt_ecc_report_single_bit_errors)
197 PRINT_ERROR("DFA_ERR[DTESBE]: DFA DTE 29b Single Bit Error Corrected\n");
198 if (err.s.dtedbe || (err.s.dtesbe && __cvmx_interrupt_ecc_report_single_bit_errors))
199 PRINT_ERROR("DFA_ERR[DTESYN]: Failing syndrome %u\n", err.s.dtesyn);
202 PRINT_ERROR("DFA_ERR[CP2DBE]: DFA PP-CP2 Double Bit Error Detected\n");
203 if (err.s.cp2sbe && __cvmx_interrupt_ecc_report_single_bit_errors)
204 PRINT_ERROR("DFA_ERR[CP2SBE]: DFA PP-CP2 Single Bit Error Corrected\n");
205 if (err.s.cp2dbe || (err.s.cp2sbe && __cvmx_interrupt_ecc_report_single_bit_errors))
206 PRINT_ERROR("DFA_ERR[CP2SYN]: Failing syndrome %u\n", err.s.cp2syn);
212 * Enable L2 error interrupts for all chips
214 static void __cvmx_interrupt_l2_enable(void)
219 /* Enable ECC Interrupts for double bit errors from L2C Tags */
220 csr.u64 = cvmx_read_csr(CVMX_L2T_ERR);
221 csr.s.lck_intena2 = 1;
222 csr.s.lck_intena = 1;
223 csr.s.ded_intena = 1;
224 csr.s.sec_intena = __cvmx_interrupt_ecc_report_single_bit_errors;
226 cvmx_write_csr(CVMX_L2T_ERR, csr.u64);
228 /* Enable ECC Interrupts for double bit errors from L2D Errors */
229 csr2.u64 = cvmx_read_csr(CVMX_L2D_ERR);
230 csr2.s.ded_intena = 1;
231 csr2.s.sec_intena = __cvmx_interrupt_ecc_report_single_bit_errors;
233 cvmx_write_csr(CVMX_L2D_ERR, csr2.u64);
238 * Decode L2 error interrupts for all chips
240 static void __cvmx_interrupt_l2_decode(void)
246 terr.u64 = cvmx_read_csr(CVMX_L2T_ERR);
247 cvmx_write_csr(CVMX_L2T_ERR, terr.u64);
251 PRINT_ERROR("L2T_ERR[DED_ERR]: double bit:\tfadr: 0x%x, fset: 0x%x, fsyn: 0x%x\n",
252 terr.s.fadr, terr.s.fset, terr.s.fsyn);
253 if (terr.s.sec_err && __cvmx_interrupt_ecc_report_single_bit_errors)
254 PRINT_ERROR("L2T_ERR[SEC_ERR]: single bit:\tfadr: 0x%x, fset: 0x%x, fsyn: 0x%x\n",
255 terr.s.fadr, terr.s.fset, terr.s.fsyn);
256 if (terr.s.ded_err || terr.s.sec_err)
260 /* Syndrome is zero, which means error was in non-hit line,
261 so flush all associations */
263 int l2_assoc = cvmx_l2c_get_num_assoc();
265 for (i = 0; i < l2_assoc; i++)
266 cvmx_l2c_flush_line(i, terr.s.fadr);
269 cvmx_l2c_flush_line(terr.s.fset, terr.s.fadr);
273 PRINT_ERROR("L2T_ERR[LCKERR2]: HW detected a case where a Rd/Wr Miss from PP#n could not find an available/unlocked set (for replacement).\n");
275 PRINT_ERROR("L2T_ERR[LCKERR]: SW attempted to LOCK DOWN the last available set of the INDEX (which is ignored by HW - but reported to SW).\n");
278 clr_val = derr.u64 = cvmx_read_csr(CVMX_L2D_ERR);
281 cvmx_l2d_fadr_t fadr;
283 if (derr.s.ded_err || (derr.s.sec_err && __cvmx_interrupt_ecc_report_single_bit_errors))
285 const int coreid = (int) cvmx_get_core_num();
286 uint64_t syn0 = cvmx_read_csr(CVMX_L2D_FSYN0);
287 uint64_t syn1 = cvmx_read_csr(CVMX_L2D_FSYN1);
288 fadr.u64 = cvmx_read_csr(CVMX_L2D_FADR);
290 PRINT_ERROR("L2D_ERR[DED_ERR] ECC double (core %d): fadr: 0x%llx, syn0:0x%llx, syn1: 0x%llx\n",
291 coreid, (unsigned long long) fadr.u64, (unsigned long long) syn0, (unsigned long long) syn1);
293 PRINT_ERROR("L2D_ERR[SEC_ERR] ECC single (core %d): fadr: 0x%llx, syn0:0x%llx, syn1: 0x%llx\n",
294 coreid, (unsigned long long) fadr.u64, (unsigned long long) syn0, (unsigned long long) syn1);
295 /* Flush the line that had the error */
296 if (derr.s.ded_err || derr.s.sec_err)
297 cvmx_l2c_flush_line(fadr.s.fset, fadr.s.fadr >> 1);
300 cvmx_write_csr(CVMX_L2D_ERR, clr_val);
305 * Enable LMC (DDR controller) interrupts for all chips
307 * @param ddr_controller
308 * Which controller to enable for 0-1
310 static void __cvmx_interrupt_lmcx_enable(int ddr_controller)
312 cvmx_lmc_mem_cfg0_t csr;
314 /* The LMC controllers can be independently enabled/disabled on CN56XX.
315 If a controller is disabled it can't be accessed at all since it
317 if (OCTEON_IS_MODEL(OCTEON_CN56XX))
319 cvmx_l2c_cfg_t l2c_cfg;
320 l2c_cfg.u64 = cvmx_read_csr(CVMX_L2C_CFG);
321 if (!l2c_cfg.s.dpres0 && (ddr_controller == 0))
323 if (!l2c_cfg.s.dpres1 && (ddr_controller == 1))
327 csr.u64 = cvmx_read_csr(CVMX_LMCX_MEM_CFG0(ddr_controller));
328 csr.s.intr_ded_ena = 1;
329 csr.s.intr_sec_ena = __cvmx_interrupt_ecc_report_single_bit_errors;
330 cvmx_write_csr(CVMX_LMCX_MEM_CFG0(ddr_controller), csr.u64);
335 * Decode LMC (DDR controller) interrupts for all chips
337 * @param ddr_controller
338 * Which controller to decode 0-1
340 static void __cvmx_interrupt_lmcx_decode(int ddr_controller)
342 /* These static counters are used to track ECC error counts */
343 static CVMX_SHARED unsigned long single_bit_errors[2] = {0, 0};
344 static CVMX_SHARED unsigned long double_bit_errors[2] = {0, 0};
345 cvmx_lmcx_mem_cfg0_t mem_cfg0;
346 cvmx_lmc_fadr_t fadr;
348 mem_cfg0.u64 =cvmx_read_csr(CVMX_LMCX_MEM_CFG0(ddr_controller));
349 fadr.u64 = cvmx_read_csr(CVMX_LMCX_FADR (ddr_controller));
350 cvmx_write_csr(CVMX_LMCX_MEM_CFG0(ddr_controller),mem_cfg0.u64);
351 if (mem_cfg0.s.sec_err || mem_cfg0.s.ded_err)
354 CVMX_DPOP(pop_count, mem_cfg0.s.sec_err);
355 single_bit_errors[ddr_controller] += pop_count;
356 CVMX_DPOP(pop_count, mem_cfg0.s.ded_err);
357 double_bit_errors[ddr_controller] += pop_count;
358 if (mem_cfg0.s.ded_err || (mem_cfg0.s.sec_err && __cvmx_interrupt_ecc_report_single_bit_errors))
360 PRINT_ERROR("DDR%d ECC: %lu Single bit corrections, %lu Double bit errors\n"
361 "DDR%d ECC:\tFailing dimm: %u\n"
362 "DDR%d ECC:\tFailing rank: %u\n"
363 "DDR%d ECC:\tFailing bank: %u\n"
364 "DDR%d ECC:\tFailing row: 0x%x\n"
365 "DDR%d ECC:\tFailing column: 0x%x\n",
366 ddr_controller, single_bit_errors[ddr_controller], double_bit_errors[ddr_controller],
367 ddr_controller, fadr.s.fdimm,
368 ddr_controller, fadr.s.fbunk,
369 ddr_controller, fadr.s.fbank,
370 ddr_controller, fadr.s.frow,
371 ddr_controller, fadr.s.fcol);
378 * Decode GMX error interrupts
380 * @param block GMX interface to decode
382 static void __cvmx_interrupt_gmxx_decode(int block)
385 cvmx_gmxx_tx_int_reg_t csr;
387 csr.u64 = cvmx_read_csr(CVMX_GMXX_TX_INT_REG(block)) & cvmx_read_csr(CVMX_GMXX_TX_INT_EN(block));
388 cvmx_write_csr(CVMX_GMXX_TX_INT_REG(block), csr.u64);
390 for (index=0; index<4; index++)
392 if (csr.s.late_col & (1<<index))
393 PRINT_ERROR("GMX%d_TX%d_INT_REG[LATE_COL]: TX Late Collision\n", block, index);
394 if (csr.s.xsdef & (1<<index))
395 PRINT_ERROR("GMX%d_TX%d_INT_REG[XSDEF]: TX Excessive deferral\n", block, index);
396 if (csr.s.xscol & (1<<index))
397 PRINT_ERROR("GMX%d_TX%d_INT_REG[XSCOL]: TX Excessive collisions\n", block, index);
398 if (csr.s.undflw & (1<<index))
399 PRINT_ERROR("GMX%d_TX%d_INT_REG[UNDFLW]: TX Underflow\n", block, index);
402 PRINT_ERROR("GMX%d_TX_INT_REG[NCB_NXA]: Port address out-of-range from NCB Interface\n", block);
404 PRINT_ERROR("GMX%d_TX_INT_REG[PKO_NXA]: Port address out-of-range from PKO Interface\n", block);
406 __cvmx_interrupt_gmxx_rxx_int_reg_decode(0, block);
407 __cvmx_interrupt_gmxx_rxx_int_reg_decode(1, block);
408 __cvmx_interrupt_gmxx_rxx_int_reg_decode(2, block);
409 if (!(OCTEON_IS_MODEL(OCTEON_CN31XX) || OCTEON_IS_MODEL(OCTEON_CN30XX) || OCTEON_IS_MODEL(OCTEON_CN50XX)))
410 __cvmx_interrupt_gmxx_rxx_int_reg_decode(3, block);
415 * Enable POW error interrupts for all chips
417 static void __cvmx_interrupt_pow_enable(void)
419 cvmx_pow_ecc_err_t csr;
420 csr.u64 = cvmx_read_csr(CVMX_POW_ECC_ERR);
421 if (!OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2) && !OCTEON_IS_MODEL(OCTEON_CN31XX))
423 /* These doesn't exist for chips CN31XX and CN38XXp2 */
424 csr.s.iop_ie = 0x1fff;
428 csr.s.sbe_ie = __cvmx_interrupt_ecc_report_single_bit_errors;
429 cvmx_write_csr(CVMX_POW_ECC_ERR, csr.u64);
434 * Decode POW error interrupts for all chips
436 static void __cvmx_interrupt_pow_decode(void)
438 cvmx_pow_ecc_err_t err;
440 err.u64 = cvmx_read_csr(CVMX_POW_ECC_ERR);
441 cvmx_write_csr(CVMX_POW_ECC_ERR, err.u64);
444 if (err.s.sbe && __cvmx_interrupt_ecc_report_single_bit_errors)
445 PRINT_ERROR("POW_ECC_ERR[SBE]: POW single bit error\n");
447 PRINT_ERROR("POW_ECC_ERR[DBE]: POW double bit error\n");
448 if (err.s.dbe || (err.s.sbe && __cvmx_interrupt_ecc_report_single_bit_errors))
449 PRINT_ERROR("POW_ECC_ERR[SYN]: Failing syndrome %u\n", err.s.syn);
451 PRINT_ERROR("POW_ECC_ERR[RPE]: Remote pointer error\n");
452 if (err.s.iop & (1 << 0))
453 PRINT_ERROR("POW_ECC_ERR[IOP0]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP from PP in NULL_NULL state\n");
454 if (err.s.iop & (1 << 1))
455 PRINT_ERROR("POW_ECC_ERR[IOP1]: Received SWTAG/SWTAG_DESCH/DESCH/UPD_WQP from PP in NULL state\n");
456 if (err.s.iop & (1 << 2))
457 PRINT_ERROR("POW_ECC_ERR[IOP2]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH/GET_WORK from PP with pending tag switch to ORDERED or ATOMIC\n");
458 if (err.s.iop & (1 << 3))
459 PRINT_ERROR("POW_ECC_ERR[IOP3]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH from PP with tag specified as NULL_NULL\n");
460 if (err.s.iop & (1 << 4))
461 PRINT_ERROR("POW_ECC_ERR[IOP4]: Received SWTAG_FULL/SWTAG_DESCH from PP with tag specified as NULL\n");
462 if (err.s.iop & (1 << 5))
463 PRINT_ERROR("POW_ECC_ERR[IOP5]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with GET_WORK pending\n");
464 if (err.s.iop & (1 << 6))
465 PRINT_ERROR("POW_ECC_ERR[IOP6]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with NULL_RD pending\n");
466 if (err.s.iop & (1 << 7))
467 PRINT_ERROR("POW_ECC_ERR[IOP7]: Received CLR_NSCHED from PP with SWTAG_DESCH/DESCH/CLR_NSCHED pending\n");
468 if (err.s.iop & (1 << 8))
469 PRINT_ERROR("POW_ECC_ERR[IOP8]: Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with CLR_NSCHED pending\n");
470 if (err.s.iop & (1 << 9))
471 PRINT_ERROR("POW_ECC_ERR[IOP9]: Received illegal opcode\n");
472 if (err.s.iop & (1 << 10))
473 PRINT_ERROR("POW_ECC_ERR[IOP10]: Received ADD_WORK with tag specified as NULL_NULL\n");
474 if (err.s.iop & (1 << 11))
475 PRINT_ERROR("POW_ECC_ERR[IOP11]: Received DBG load from PP with DBG load pending\n");
476 if (err.s.iop & (1 << 12))
477 PRINT_ERROR("POW_ECC_ERR[IOP12]: Received CSR load from PP with CSR load pending\n");
483 * Enable TIM tiemr wheel interrupts for all chips
485 static void __cvmx_interrupt_tim_enable(void)
487 cvmx_tim_reg_int_mask_t csr;
488 csr.u64 = cvmx_read_csr(CVMX_TIM_REG_INT_MASK);
490 cvmx_write_csr(CVMX_TIM_REG_INT_MASK, csr.u64);
495 * Decode TIM timer wheel interrupts
497 static void __cvmx_interrupt_tim_decode(void)
499 cvmx_tim_reg_error_t err;
501 err.u64 = cvmx_read_csr(CVMX_TIM_REG_ERROR);
502 cvmx_write_csr(CVMX_TIM_REG_ERROR, err.u64);
506 for (i = 0; i < 16; i++)
507 if (err.s.mask & (1 << i))
508 PRINT_ERROR("TIM_REG_ERROR[MASK]: Timer wheel %d error\n", i);
514 * Utility function to decode Octeon's RSL_INT_BLOCKS interrupts
515 * into error messages.
517 void cvmx_interrupt_rsl_decode(void)
519 uint64_t rsl_int_blocks;
521 /* Reading the RSL interrupts is different between PCI and PCIe chips */
522 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
523 rsl_int_blocks = cvmx_read_csr(CVMX_PEXP_NPEI_RSL_INT_BLOCKS);
525 rsl_int_blocks = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
527 /* Not all chips support all error interrupts. This code assumes
528 that unsupported interrupts always are zero */
530 /* Bits 63-31 are unused on all chips */
531 if (rsl_int_blocks & (1ull<<30)) __cvmx_interrupt_iob_int_sum_decode();
532 if (rsl_int_blocks & (1ull<<29)) __cvmx_interrupt_lmcx_decode(1);
533 if (rsl_int_blocks & (1ull<<28))
535 __cvmx_interrupt_agl_gmx_rxx_int_reg_decode(0);
536 if (OCTEON_IS_MODEL(OCTEON_CN52XX))
537 __cvmx_interrupt_agl_gmx_rxx_int_reg_decode(1);
539 /* Bit 27-24 are unused on all chips */
540 if (rsl_int_blocks & (1ull<<23))
542 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
544 __cvmx_interrupt_pcsx_intx_reg_decode(0, 1);
545 __cvmx_interrupt_pcsx_intx_reg_decode(1, 1);
546 __cvmx_interrupt_pcsx_intx_reg_decode(2, 1);
547 __cvmx_interrupt_pcsx_intx_reg_decode(3, 1);
548 __cvmx_interrupt_pcsxx_int_reg_decode(1);
551 __cvmx_interrupt_asxx_decode(1);
553 if (rsl_int_blocks & (1ull<<22))
555 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
557 __cvmx_interrupt_pcsx_intx_reg_decode(0, 0);
558 __cvmx_interrupt_pcsx_intx_reg_decode(1, 0);
559 __cvmx_interrupt_pcsx_intx_reg_decode(2, 0);
560 __cvmx_interrupt_pcsx_intx_reg_decode(3, 0);
561 __cvmx_interrupt_pcsxx_int_reg_decode(0);
564 __cvmx_interrupt_asxx_decode(0);
566 /* Bit 21 is unsed on all chips */
567 if (rsl_int_blocks & (1ull<<20)) __cvmx_interrupt_pip_int_reg_decode();
568 if (rsl_int_blocks & (1ull<<19))
570 __cvmx_interrupt_spxx_int_reg_decode(1);
571 __cvmx_interrupt_stxx_int_reg_decode(1);
573 if (rsl_int_blocks & (1ull<<18))
575 __cvmx_interrupt_spxx_int_reg_decode(0);
576 __cvmx_interrupt_stxx_int_reg_decode(0);
578 if (rsl_int_blocks & (1ull<<17)) __cvmx_interrupt_lmcx_decode(0);
579 if (rsl_int_blocks & (1ull<<16)) __cvmx_interrupt_l2_decode();
580 if (rsl_int_blocks & (1ull<<15)) __cvmx_interrupt_usbnx_int_sum_decode(1);
581 if (rsl_int_blocks & (1ull<<14)) __cvmx_interrupt_rad_reg_error_decode();
582 if (rsl_int_blocks & (1ull<<13)) __cvmx_interrupt_usbnx_int_sum_decode(0);
583 if (rsl_int_blocks & (1ull<<12)) __cvmx_interrupt_pow_decode();
584 if (rsl_int_blocks & (1ull<<11)) __cvmx_interrupt_tim_decode();
585 if (rsl_int_blocks & (1ull<<10)) __cvmx_interrupt_pko_reg_error_decode();
586 if (rsl_int_blocks & (1ull<< 9)) __cvmx_interrupt_ipd_int_sum_decode();
587 /* Bit 8 is unused on all chips */
588 if (rsl_int_blocks & (1ull<< 7)) __cvmx_interrupt_zip_error_decode();
589 if (rsl_int_blocks & (1ull<< 6)) __cvmx_interrupt_dfa_decode();
590 if (rsl_int_blocks & (1ull<< 5)) __cvmx_interrupt_fpa_int_sum_decode();
591 if (rsl_int_blocks & (1ull<< 4)) __cvmx_interrupt_key_int_sum_decode();
592 if (rsl_int_blocks & (1ull<< 3))
594 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
595 __cvmx_interrupt_npei_int_sum_decode();
597 __cvmx_interrupt_npi_int_sum_decode();
599 if (rsl_int_blocks & (1ull<< 2)) __cvmx_interrupt_gmxx_decode(1);
600 if (rsl_int_blocks & (1ull<< 1)) __cvmx_interrupt_gmxx_decode(0);
601 if (rsl_int_blocks & (1ull<< 0)) __cvmx_interrupt_mio_boot_err_decode();
606 * Enable GMX error reporting for the supplied interface
608 * @param interface Interface to enable
610 static void __cvmx_interrupt_gmxx_enable(int interface)
612 cvmx_gmxx_inf_mode_t mode;
613 cvmx_gmxx_tx_int_en_t gmx_tx_int_en;
617 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
619 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX))
623 switch(mode.cn56xx.mode)
632 default: /* Disabled */
644 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
646 /* SPI on CN38XX and CN58XX report all errors through port 0.
647 RGMII needs to check all 4 ports */
655 /* CN30XX, CN31XX, and CN50XX have two or three ports. GMII
656 and MII has 2, RGMII has three */
667 gmx_tx_int_en.u64 = 0;
670 gmx_tx_int_en.s.ncb_nxa = 1;
671 gmx_tx_int_en.s.pko_nxa = 1;
673 gmx_tx_int_en.s.undflw = (1<<num_ports)-1;
674 cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), gmx_tx_int_en.u64);
675 for (index=0; index<num_ports;index++)
676 __cvmx_interrupt_gmxx_rxx_int_en_enable(index, interface);
681 * Utility function to enable all RSL error interupts
683 void cvmx_interrupt_rsl_enable(void)
685 /* Bits 63-31 are unused on all chips */
686 __cvmx_interrupt_iob_int_enb_enable();
687 if (OCTEON_IS_MODEL(OCTEON_CN56XX))
688 __cvmx_interrupt_lmcx_enable(1);
689 if (octeon_has_feature(OCTEON_FEATURE_MGMT_PORT))
691 // FIXME __cvmx_interrupt_agl_gmx_rxx_int_en_enable(0);
692 //if (OCTEON_IS_MODEL(OCTEON_CN52XX))
693 // __cvmx_interrupt_agl_gmx_rxx_int_en_enable(1);
695 /* Bit 27-24 are unused on all chips */
696 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
697 __cvmx_interrupt_asxx_enable(1);
698 if (OCTEON_IS_MODEL(OCTEON_CN56XX))
700 __cvmx_interrupt_pcsx_intx_en_reg_enable(0, 1);
701 __cvmx_interrupt_pcsx_intx_en_reg_enable(1, 1);
702 __cvmx_interrupt_pcsx_intx_en_reg_enable(2, 1);
703 __cvmx_interrupt_pcsx_intx_en_reg_enable(3, 1);
704 __cvmx_interrupt_pcsxx_int_en_reg_enable(1);
706 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
708 __cvmx_interrupt_pcsx_intx_en_reg_enable(0, 0);
709 __cvmx_interrupt_pcsx_intx_en_reg_enable(1, 0);
710 __cvmx_interrupt_pcsx_intx_en_reg_enable(2, 0);
711 __cvmx_interrupt_pcsx_intx_en_reg_enable(3, 0);
712 __cvmx_interrupt_pcsxx_int_en_reg_enable(0);
715 __cvmx_interrupt_asxx_enable(0);
716 /* Bit 21 is unsed on all chips */
717 __cvmx_interrupt_pip_int_en_enable();
718 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
720 __cvmx_interrupt_spxx_int_msk_enable(1);
721 __cvmx_interrupt_stxx_int_msk_enable(1);
722 __cvmx_interrupt_spxx_int_msk_enable(0);
723 __cvmx_interrupt_stxx_int_msk_enable(0);
725 __cvmx_interrupt_lmcx_enable(0);
726 __cvmx_interrupt_l2_enable();
727 if (OCTEON_IS_MODEL(OCTEON_CN52XX))
728 __cvmx_interrupt_usbnx_int_enb_enable(1);
729 if (octeon_has_feature(OCTEON_FEATURE_RAID))
730 __cvmx_interrupt_rad_reg_int_mask_enable();
731 if (octeon_has_feature(OCTEON_FEATURE_USB))
732 __cvmx_interrupt_usbnx_int_enb_enable(0);
733 __cvmx_interrupt_pow_enable();
734 __cvmx_interrupt_tim_enable();
735 __cvmx_interrupt_pko_reg_int_mask_enable();
736 __cvmx_interrupt_ipd_int_enb_enable();
737 /* Bit 8 is unused on all chips */
738 if (octeon_has_feature(OCTEON_FEATURE_ZIP))
739 __cvmx_interrupt_zip_int_mask_enable();
740 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
741 __cvmx_interrupt_dfa_enable();
742 __cvmx_interrupt_fpa_int_enb_enable();
743 if (octeon_has_feature(OCTEON_FEATURE_KEY_MEMORY))
744 __cvmx_interrupt_key_int_enb_enable();
745 if (octeon_has_feature(OCTEON_FEATURE_PCIE))
747 cvmx_ciu_soft_prst_t ciu_soft_prst;
748 ciu_soft_prst.u64 = cvmx_read_csr(CVMX_CIU_SOFT_PRST);
749 if (ciu_soft_prst.s.soft_prst == 0)
750 __cvmx_interrupt_npei_int_enb2_enable();
752 else if (cvmx_sysinfo_get()->bootloader_config_flags & CVMX_BOOTINFO_CFG_FLAG_PCI_HOST)
753 __cvmx_interrupt_npi_int_enb_enable();
755 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX) ||
756 OCTEON_IS_MODEL(OCTEON_CN56XX))
757 __cvmx_interrupt_gmxx_enable(1);
758 __cvmx_interrupt_gmxx_enable(0);
760 __cvmx_interrupt_mio_boot_int_enable();