1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 /* 30 * sun4u Fire Error Handling 31 */ 32 33 #include <sys/types.h> 34 #include <sys/ddi.h> 35 #include <sys/sunddi.h> 36 #include <sys/fm/protocol.h> 37 #include <sys/fm/util.h> 38 #include <sys/pcie.h> 39 #include <sys/pcie_impl.h> 40 #include "px_obj.h" 41 #include <px_regs.h> 42 #include <px_csr.h> 43 #include <sys/membar.h> 44 #include "pcie_pwr.h" 45 #include "px_lib4u.h" 46 #include "px_err.h" 47 #include "px_err_impl.h" 48 49 /* 50 * JBC error bit table 51 */ 52 #define JBC_BIT_DESC(bit, hdl, erpt) \ 53 JBC_INTERRUPT_STATUS_ ## bit ## _P, \ 54 0, \ 55 PX_ERR_BIT_HANDLE(hdl), \ 56 PX_ERPT_SEND(erpt), \ 57 PX_ERR_JBC_CLASS(bit) 58 px_err_bit_desc_t px_err_cb_tbl[] = { 59 /* JBC FATAL - see io erpt doc, section 1.1 */ 60 { JBC_BIT_DESC(MB_PEA, fatal_hw, jbc_fatal) }, 61 { JBC_BIT_DESC(CPE, fatal_hw, jbc_fatal) }, 62 { JBC_BIT_DESC(APE, fatal_hw, jbc_fatal) }, 63 { JBC_BIT_DESC(PIO_CPE, fatal_hw, jbc_fatal) }, 64 { JBC_BIT_DESC(JTCEEW, fatal_hw, jbc_fatal) }, 65 { JBC_BIT_DESC(JTCEEI, fatal_hw, jbc_fatal) }, 66 { JBC_BIT_DESC(JTCEER, fatal_hw, jbc_fatal) }, 67 68 /* JBC MERGE - see io erpt doc, section 1.2 */ 69 { JBC_BIT_DESC(MB_PER, jbc_merge, jbc_merge) }, 70 { JBC_BIT_DESC(MB_PEW, jbc_merge, jbc_merge) }, 71 72 /* JBC Jbusint IN - see io erpt doc, section 1.3 */ 73 { JBC_BIT_DESC(UE_ASYN, fatal_gos, jbc_in) }, 74 { JBC_BIT_DESC(CE_ASYN, jbc_jbusint_in, jbc_in) }, 75 { JBC_BIT_DESC(JTE, fatal_gos, jbc_in) }, 76 { JBC_BIT_DESC(JBE, jbc_jbusint_in, jbc_in) }, 77 { JBC_BIT_DESC(JUE, jbc_jbusint_in, jbc_in) }, 78 { JBC_BIT_DESC(ICISE, fatal_gos, jbc_in) }, 79 { JBC_BIT_DESC(WR_DPE, jbc_jbusint_in, jbc_in) }, 80 { JBC_BIT_DESC(RD_DPE, jbc_jbusint_in, jbc_in) }, 81 { JBC_BIT_DESC(ILL_BMW, jbc_jbusint_in, jbc_in) }, 82 { JBC_BIT_DESC(ILL_BMR, jbc_jbusint_in, jbc_in) }, 83 { JBC_BIT_DESC(BJC, jbc_jbusint_in, jbc_in) }, 84 85 /* JBC Jbusint Out - see io erpt doc, section 1.4 */ 86 { JBC_BIT_DESC(IJP, fatal_gos, jbc_out) }, 87 88 /* JBC Dmcint ODCD - see io erpt doc, section 1.5 */ 89 { JBC_BIT_DESC(PIO_UNMAP_RD, jbc_dmcint_odcd, jbc_odcd) }, 90 { JBC_BIT_DESC(ILL_ACC_RD, jbc_dmcint_odcd, jbc_odcd) }, 91 { JBC_BIT_DESC(PIO_UNMAP, jbc_dmcint_odcd, jbc_odcd) }, 92 { JBC_BIT_DESC(PIO_DPE, jbc_dmcint_odcd, jbc_odcd) }, 93 { JBC_BIT_DESC(PIO_CPE, non_fatal, jbc_odcd) }, 94 { JBC_BIT_DESC(ILL_ACC, jbc_dmcint_odcd, jbc_odcd) }, 95 96 /* JBC Dmcint IDC - see io erpt doc, section 1.6 */ 97 { JBC_BIT_DESC(UNSOL_RD, non_fatal, jbc_idc) }, 98 { JBC_BIT_DESC(UNSOL_INTR, non_fatal, jbc_idc) }, 99 100 /* JBC CSR - see io erpt doc, section 1.7 */ 101 { JBC_BIT_DESC(EBUS_TO, jbc_csr, jbc_csr) } 102 }; 103 104 #define px_err_cb_keys \ 105 (sizeof (px_err_cb_tbl)) / (sizeof (px_err_bit_desc_t)) 106 107 /* 108 * DMC error bit tables 109 */ 110 #define IMU_BIT_DESC(bit, hdl, erpt) \ 111 IMU_INTERRUPT_STATUS_ ## bit ## _P, \ 112 0, \ 113 PX_ERR_BIT_HANDLE(hdl), \ 114 PX_ERPT_SEND(erpt), \ 115 PX_ERR_DMC_CLASS(bit) 116 px_err_bit_desc_t px_err_imu_tbl[] = { 117 /* DMC IMU RDS - see io erpt doc, section 2.1 */ 118 { IMU_BIT_DESC(MSI_MAL_ERR, non_fatal, imu_rds) }, 119 { IMU_BIT_DESC(MSI_PAR_ERR, fatal_stuck, imu_rds) }, 120 { IMU_BIT_DESC(PMEACK_MES_NOT_EN, imu_rbne, imu_rds) }, 121 { IMU_BIT_DESC(PMPME_MES_NOT_EN, imu_pme, imu_rds) }, 122 { IMU_BIT_DESC(FATAL_MES_NOT_EN, imu_rbne, imu_rds) }, 123 { IMU_BIT_DESC(NONFATAL_MES_NOT_EN, imu_rbne, imu_rds) }, 124 { IMU_BIT_DESC(COR_MES_NOT_EN, imu_rbne, imu_rds) }, 125 { IMU_BIT_DESC(MSI_NOT_EN, imu_rbne, imu_rds) }, 126 127 /* DMC IMU SCS - see io erpt doc, section 2.2 */ 128 { IMU_BIT_DESC(EQ_NOT_EN, imu_rbne, imu_rds) }, 129 130 /* DMC IMU - see io erpt doc, section 2.3 */ 131 { IMU_BIT_DESC(EQ_OVER, imu_eq_ovfl, imu) } 132 }; 133 134 #define px_err_imu_keys (sizeof (px_err_imu_tbl)) / (sizeof (px_err_bit_desc_t)) 135 136 /* mmu errors */ 137 #define MMU_BIT_DESC(bit, hdl, erpt) \ 138 MMU_INTERRUPT_STATUS_ ## bit ## _P, \ 139 0, \ 140 PX_ERR_BIT_HANDLE(hdl), \ 141 PX_ERPT_SEND(erpt), \ 142 PX_ERR_DMC_CLASS(bit) 143 px_err_bit_desc_t px_err_mmu_tbl[] = { 144 /* DMC MMU TFAR/TFSR - see io erpt doc, section 2.4 */ 145 { MMU_BIT_DESC(BYP_ERR, mmu_rbne, mmu_tfar_tfsr) }, 146 { MMU_BIT_DESC(BYP_OOR, mmu_tfa, mmu_tfar_tfsr) }, 147 { MMU_BIT_DESC(TRN_ERR, mmu_rbne, mmu_tfar_tfsr) }, 148 { MMU_BIT_DESC(TRN_OOR, mmu_tfa, mmu_tfar_tfsr) }, 149 { MMU_BIT_DESC(TTE_INV, mmu_tfa, mmu_tfar_tfsr) }, 150 { MMU_BIT_DESC(TTE_PRT, mmu_tfa, mmu_tfar_tfsr) }, 151 { MMU_BIT_DESC(TTC_DPE, mmu_tfa, mmu_tfar_tfsr) }, 152 { MMU_BIT_DESC(TBW_DME, mmu_tblwlk, mmu_tfar_tfsr) }, 153 { MMU_BIT_DESC(TBW_UDE, mmu_tblwlk, mmu_tfar_tfsr) }, 154 { MMU_BIT_DESC(TBW_ERR, mmu_tblwlk, mmu_tfar_tfsr) }, 155 { MMU_BIT_DESC(TBW_DPE, mmu_tblwlk, mmu_tfar_tfsr) }, 156 157 /* DMC MMU - see io erpt doc, section 2.5 */ 158 { MMU_BIT_DESC(TTC_CAE, non_fatal, mmu) } 159 }; 160 #define px_err_mmu_keys (sizeof (px_err_mmu_tbl)) / (sizeof (px_err_bit_desc_t)) 161 162 /* 163 * PEC error bit tables 164 */ 165 #define ILU_BIT_DESC(bit, hdl, erpt) \ 166 ILU_INTERRUPT_STATUS_ ## bit ## _P, \ 167 0, \ 168 PX_ERR_BIT_HANDLE(hdl), \ 169 PX_ERPT_SEND(erpt), \ 170 PX_ERR_PEC_CLASS(bit) 171 px_err_bit_desc_t px_err_ilu_tbl[] = { 172 /* PEC ILU none - see io erpt doc, section 3.1 */ 173 { ILU_BIT_DESC(IHB_PE, fatal_gos, pec_ilu) } 174 }; 175 #define px_err_ilu_keys \ 176 (sizeof (px_err_ilu_tbl)) / (sizeof (px_err_bit_desc_t)) 177 178 /* 179 * PEC UE errors implementation is incomplete pending PCIE generic 180 * fabric rules. Must handle both PRIMARY and SECONDARY errors. 181 */ 182 /* pec ue errors */ 183 #define TLU_UC_BIT_DESC(bit, hdl, erpt) \ 184 TLU_UNCORRECTABLE_ERROR_STATUS_CLEAR_ ## bit ## _P, \ 185 0, \ 186 PX_ERR_BIT_HANDLE(hdl), \ 187 PX_ERPT_SEND(erpt), \ 188 PX_ERR_PEC_CLASS(bit) }, \ 189 { TLU_UNCORRECTABLE_ERROR_STATUS_CLEAR_ ## bit ## _S, \ 190 0, \ 191 PX_ERR_BIT_HANDLE(hdl), \ 192 PX_ERPT_SEND(erpt), \ 193 PX_ERR_PEC_CLASS(bit) 194 px_err_bit_desc_t px_err_tlu_ue_tbl[] = { 195 /* PCI-E Receive Uncorrectable Errors - see io erpt doc, section 3.2 */ 196 { TLU_UC_BIT_DESC(UR, pciex_ue, pciex_rx_ue) }, 197 { TLU_UC_BIT_DESC(UC, pciex_ue, pciex_rx_ue) }, 198 199 /* PCI-E Transmit Uncorrectable Errors - see io erpt doc, section 3.3 */ 200 { TLU_UC_BIT_DESC(CTO, pciex_ue, pciex_tx_ue) }, 201 { TLU_UC_BIT_DESC(ROF, pciex_ue, pciex_tx_ue) }, 202 203 /* PCI-E Rx/Tx Uncorrectable Errors - see io erpt doc, section 3.4 */ 204 { TLU_UC_BIT_DESC(MFP, pciex_ue, pciex_rx_tx_ue) }, 205 { TLU_UC_BIT_DESC(PP, pciex_ue, pciex_rx_tx_ue) }, 206 207 /* Other PCI-E Uncorrectable Errors - see io erpt doc, section 3.5 */ 208 { TLU_UC_BIT_DESC(FCP, pciex_ue, pciex_ue) }, 209 { TLU_UC_BIT_DESC(DLP, pciex_ue, pciex_ue) }, 210 { TLU_UC_BIT_DESC(TE, pciex_ue, pciex_ue) }, 211 212 /* Not used */ 213 { TLU_UC_BIT_DESC(CA, pciex_ue, do_not) } 214 }; 215 #define px_err_tlu_ue_keys \ 216 (sizeof (px_err_tlu_ue_tbl)) / (sizeof (px_err_bit_desc_t)) 217 218 /* 219 * PEC CE errors implementation is incomplete pending PCIE generic 220 * fabric rules. 221 */ 222 /* pec ce errors */ 223 #define TLU_CE_BIT_DESC(bit, hdl, erpt) \ 224 TLU_CORRECTABLE_ERROR_STATUS_CLEAR_ ## bit ## _P, \ 225 0, \ 226 PX_ERR_BIT_HANDLE(hdl), \ 227 PX_ERPT_SEND(erpt), \ 228 PX_ERR_PEC_CLASS(bit) }, \ 229 { TLU_CORRECTABLE_ERROR_STATUS_CLEAR_ ## bit ## _S, \ 230 0, \ 231 PX_ERR_BIT_HANDLE(hdl), \ 232 PX_ERPT_SEND(erpt), \ 233 PX_ERR_PEC_CLASS(bit) 234 px_err_bit_desc_t px_err_tlu_ce_tbl[] = { 235 /* PCI-E Correctable Errors - see io erpt doc, section 3.6 */ 236 { TLU_CE_BIT_DESC(RTO, pciex_ce, pciex_ce) }, 237 { TLU_CE_BIT_DESC(RNR, pciex_ce, pciex_ce) }, 238 { TLU_CE_BIT_DESC(BDP, pciex_ce, pciex_ce) }, 239 { TLU_CE_BIT_DESC(BTP, pciex_ce, pciex_ce) }, 240 { TLU_CE_BIT_DESC(RE, pciex_ce, pciex_ce) } 241 }; 242 #define px_err_tlu_ce_keys \ 243 (sizeof (px_err_tlu_ce_tbl)) / (sizeof (px_err_bit_desc_t)) 244 245 /* pec oe errors */ 246 #define TLU_OE_BIT_DESC(bit, hdl, erpt) \ 247 TLU_OTHER_EVENT_STATUS_CLEAR_ ## bit ## _P, \ 248 0, \ 249 PX_ERR_BIT_HANDLE(hdl), \ 250 PX_ERPT_SEND(erpt), \ 251 PX_ERR_PEC_CLASS(bit) 252 px_err_bit_desc_t px_err_tlu_oe_tbl[] = { 253 /* 254 * TLU Other Event Status (receive only) - see io erpt doc, section 3.7 255 */ 256 { TLU_OE_BIT_DESC(MRC, fatal_hw, pciex_rx_oe) }, 257 258 /* TLU Other Event Status (rx + tx) - see io erpt doc, section 3.8 */ 259 { TLU_OE_BIT_DESC(WUC, non_fatal, pciex_rx_tx_oe) }, 260 { TLU_OE_BIT_DESC(RUC, non_fatal, pciex_rx_tx_oe) }, 261 { TLU_OE_BIT_DESC(CRS, non_fatal, pciex_rx_tx_oe) }, 262 263 /* TLU Other Event - see io erpt doc, section 3.9 */ 264 { TLU_OE_BIT_DESC(IIP, fatal_gos, pciex_oe) }, 265 { TLU_OE_BIT_DESC(EDP, fatal_gos, pciex_oe) }, 266 { TLU_OE_BIT_DESC(EHP, fatal_gos, pciex_oe) }, 267 { TLU_OE_BIT_DESC(LIN, non_fatal, pciex_oe) }, 268 { TLU_OE_BIT_DESC(LRS, non_fatal, pciex_oe) }, 269 { TLU_OE_BIT_DESC(LDN, non_fatal, pciex_ldn) }, 270 { TLU_OE_BIT_DESC(LUP, tlu_lup, pciex_lup) }, 271 { TLU_OE_BIT_DESC(ERU, fatal_gos, pciex_oe) }, 272 { TLU_OE_BIT_DESC(ERO, fatal_gos, pciex_oe) }, 273 { TLU_OE_BIT_DESC(EMP, fatal_gos, pciex_oe) }, 274 { TLU_OE_BIT_DESC(EPE, fatal_gos, pciex_oe) }, 275 { TLU_OE_BIT_DESC(ERP, fatal_gos, pciex_oe) }, 276 { TLU_OE_BIT_DESC(EIP, fatal_gos, pciex_oe) } 277 }; 278 279 #define px_err_tlu_oe_keys \ 280 (sizeof (px_err_tlu_oe_tbl)) / (sizeof (px_err_bit_desc_t)) 281 282 /* 283 * All the following tables below are for LPU Interrupts. These interrupts 284 * are *NOT* error interrupts, but event status interrupts. 285 * 286 * These events are probably of most interest to: 287 * o Hotplug 288 * o Power Management 289 * o etc... 290 * 291 * There are also a few events that would be interresting for FMA. 292 * Again none of the regiseters below state that an error has occured 293 * or that data has been lost. If anything, they give status that an 294 * error is *about* to occur. examples 295 * o INT_SKP_ERR - indicates clock between fire and child is too far 296 * off and is most unlikely able to compensate 297 * o INT_TX_PAR_ERR - A parity error occured in ONE lane. This is 298 * HW recoverable, but will like end up as a future 299 * fabric error as well. 300 * 301 * For now, we don't care about any of these errors and should be ignore, 302 * but cleared. 303 */ 304 305 /* LPU Link Interrupt Table */ 306 #define LPUL_BIT_DESC(bit, hdl, erpt) \ 307 LPU_LINK_LAYER_INTERRUPT_AND_STATUS_INT_ ## bit, \ 308 0, \ 309 NULL, \ 310 NULL, \ 311 "" 312 px_err_bit_desc_t px_err_lpul_tbl[] = { 313 { LPUL_BIT_DESC(LINK_ERR_ACT, NULL, NULL) } 314 }; 315 #define px_err_lpul_keys \ 316 (sizeof (px_err_lpul_tbl)) / (sizeof (px_err_bit_desc_t)) 317 318 /* LPU Physical Interrupt Table */ 319 #define LPUP_BIT_DESC(bit, hdl, erpt) \ 320 LPU_PHY_LAYER_INTERRUPT_AND_STATUS_INT_ ## bit, \ 321 0, \ 322 NULL, \ 323 NULL, \ 324 "" 325 px_err_bit_desc_t px_err_lpup_tbl[] = { 326 { LPUP_BIT_DESC(PHY_LAYER_ERR, NULL, NULL) } 327 }; 328 #define px_err_lpup_keys \ 329 (sizeof (px_err_lpup_tbl)) / (sizeof (px_err_bit_desc_t)) 330 331 /* LPU Receive Interrupt Table */ 332 #define LPUR_BIT_DESC(bit, hdl, erpt) \ 333 LPU_RECEIVE_PHY_INTERRUPT_AND_STATUS_INT_ ## bit, \ 334 0, \ 335 NULL, \ 336 NULL, \ 337 "" 338 px_err_bit_desc_t px_err_lpur_tbl[] = { 339 { LPUR_BIT_DESC(RCV_PHY, NULL, NULL) } 340 }; 341 #define px_err_lpur_keys \ 342 (sizeof (px_err_lpur_tbl)) / (sizeof (px_err_bit_desc_t)) 343 344 /* LPU Transmit Interrupt Table */ 345 #define LPUX_BIT_DESC(bit, hdl, erpt) \ 346 LPU_TRANSMIT_PHY_INTERRUPT_AND_STATUS_INT_ ## bit, \ 347 0, \ 348 NULL, \ 349 NULL, \ 350 "" 351 px_err_bit_desc_t px_err_lpux_tbl[] = { 352 { LPUX_BIT_DESC(UNMSK, NULL, NULL) } 353 }; 354 #define px_err_lpux_keys \ 355 (sizeof (px_err_lpux_tbl)) / (sizeof (px_err_bit_desc_t)) 356 357 /* LPU LTSSM Interrupt Table */ 358 #define LPUS_BIT_DESC(bit, hdl, erpt) \ 359 LPU_LTSSM_INTERRUPT_AND_STATUS_INT_ ## bit, \ 360 0, \ 361 NULL, \ 362 NULL, \ 363 "" 364 px_err_bit_desc_t px_err_lpus_tbl[] = { 365 { LPUS_BIT_DESC(ANY, NULL, NULL) } 366 }; 367 #define px_err_lpus_keys \ 368 (sizeof (px_err_lpus_tbl)) / (sizeof (px_err_bit_desc_t)) 369 370 /* LPU Gigablaze Glue Interrupt Table */ 371 #define LPUG_BIT_DESC(bit, hdl, erpt) \ 372 LPU_GIGABLAZE_GLUE_INTERRUPT_AND_STATUS_INT_ ## bit, \ 373 0, \ 374 NULL, \ 375 NULL, \ 376 "" 377 px_err_bit_desc_t px_err_lpug_tbl[] = { 378 { LPUG_BIT_DESC(GLOBL_UNMSK, NULL, NULL) } 379 }; 380 #define px_err_lpug_keys \ 381 (sizeof (px_err_lpug_tbl)) / (sizeof (px_err_bit_desc_t)) 382 383 384 /* Mask and Tables */ 385 #define MnT6(pre) \ 386 B_FALSE, \ 387 &px_ ## pre ## _intr_mask, \ 388 &px_ ## pre ## _log_mask, \ 389 &px_ ## pre ## _count_mask, \ 390 px_err_ ## pre ## _tbl, \ 391 px_err_ ## pre ## _keys, \ 392 0 393 394 /* LPU Registers Addresses */ 395 #define LR4(pre) \ 396 NULL, \ 397 LPU_ ## pre ## _INTERRUPT_MASK, \ 398 LPU_ ## pre ## _INTERRUPT_AND_STATUS, \ 399 LPU_ ## pre ## _INTERRUPT_AND_STATUS 400 401 /* LPU Registers Addresses with Irregularities */ 402 #define LR4_FIXME(pre) \ 403 NULL, \ 404 LPU_ ## pre ## _INTERRUPT_MASK, \ 405 LPU_ ## pre ## _LAYER_INTERRUPT_AND_STATUS, \ 406 LPU_ ## pre ## _LAYER_INTERRUPT_AND_STATUS 407 408 /* TLU Registers Addresses */ 409 #define TR4(pre) \ 410 TLU_ ## pre ## _LOG_ENABLE, \ 411 TLU_ ## pre ## _INTERRUPT_ENABLE, \ 412 TLU_ ## pre ## _INTERRUPT_STATUS, \ 413 TLU_ ## pre ## _STATUS_CLEAR 414 415 /* Registers Addresses for JBC, MMU, IMU and ILU */ 416 #define R4(pre) \ 417 pre ## _ERROR_LOG_ENABLE, \ 418 pre ## _INTERRUPT_ENABLE, \ 419 pre ## _INTERRUPT_STATUS, \ 420 pre ## _ERROR_STATUS_CLEAR 421 422 /* 423 * Register error handling tables. 424 * The ID Field (first field) is identified by an enum px_err_id_t. 425 * It is located in px_err.h 426 */ 427 px_err_reg_desc_t px_err_reg_tbl[] = { 428 { MnT6(cb), R4(JBC), "JBC Error"}, 429 { MnT6(mmu), R4(MMU), "IMU Error"}, 430 { MnT6(imu), R4(IMU), "ILU Error"}, 431 { MnT6(tlu_ue), TR4(UNCORRECTABLE_ERROR), "TLU UE"}, 432 { MnT6(tlu_ce), TR4(CORRECTABLE_ERROR), "TLU CE"}, 433 { MnT6(tlu_oe), TR4(OTHER_EVENT), "TLU OE"}, 434 { MnT6(ilu), R4(ILU), "MMU Error"}, 435 { MnT6(lpul), LR4(LINK_LAYER), "LPU Link Layer"}, 436 { MnT6(lpup), LR4_FIXME(PHY), "LPU Phy Layer"}, 437 { MnT6(lpur), LR4(RECEIVE_PHY), "LPU RX Phy Layer"}, 438 { MnT6(lpux), LR4(TRANSMIT_PHY), "LPU TX Phy Layer"}, 439 { MnT6(lpus), LR4(LTSSM), "LPU LTSSM"}, 440 { MnT6(lpug), LR4(GIGABLAZE_GLUE), "LPU GigaBlaze Glue"} 441 }; 442 #define PX_ERR_REG_KEYS (sizeof (px_err_reg_tbl)) / (sizeof (px_err_reg_tbl[0])) 443 444 typedef struct px_err_ss { 445 uint64_t err_status[PX_ERR_REG_KEYS]; 446 } px_err_ss_t; 447 448 static void px_err_snapshot(px_t *px_p, px_err_ss_t *ss, boolean_t chkjbc); 449 static int px_err_erpt_and_clr(px_t *px_p, ddi_fm_error_t *derr, 450 px_err_ss_t *ss); 451 static int px_err_check_severity(px_t *px_p, ddi_fm_error_t *derr, 452 int err, int caller); 453 454 /* 455 * px_err_cb_intr: 456 * Interrupt handler for the JBC block. 457 * o lock 458 * o create derr 459 * o px_err_handle(leaf1, with jbc) 460 * o px_err_handle(leaf2, without jbc) 461 * o dispatch (leaf1) 462 * o dispatch (leaf2) 463 * o unlock 464 * o handle error: fatal? fm_panic() : return INTR_CLAIMED) 465 */ 466 uint_t 467 px_err_cb_intr(caddr_t arg) 468 { 469 px_fault_t *px_fault_p = (px_fault_t *)arg; 470 dev_info_t *rpdip = px_fault_p->px_fh_dip; 471 dev_info_t *leafdip; 472 px_t *px_p = DIP_TO_STATE(rpdip); 473 px_cb_t *cb_p = px_p->px_cb_p; 474 int err = PX_OK; 475 int ret = DDI_FM_OK; 476 int fatal = 0; 477 int nonfatal = 0; 478 int unknown = 0; 479 int i; 480 boolean_t chkjbc = B_TRUE; 481 ddi_fm_error_t derr; 482 483 /* Create the derr */ 484 bzero(&derr, sizeof (ddi_fm_error_t)); 485 derr.fme_version = DDI_FME_VERSION; 486 derr.fme_ena = fm_ena_generate(0, FM_ENA_FMT1); 487 derr.fme_flag = DDI_FM_ERR_UNEXPECTED; 488 489 mutex_enter(&cb_p->xbc_fm_mutex); 490 491 /* send ereport/handle/clear for ALL fire leaves */ 492 for (i = 0; i < PX_CB_MAX_LEAF; i++) { 493 if ((px_p = cb_p->xbc_px_list[i]) == NULL) 494 continue; 495 496 err |= px_err_handle(px_p, &derr, PX_INTR_CALL, chkjbc); 497 chkjbc = B_FALSE; 498 } 499 500 /* Check all child devices for errors on ALL fire leaves */ 501 for (i = 0; i < PX_CB_MAX_LEAF; i++) { 502 if ((px_p = cb_p->xbc_px_list[i]) != NULL) { 503 leafdip = px_p->px_dip; 504 ret = ndi_fm_handler_dispatch(leafdip, NULL, &derr); 505 switch (ret) { 506 case DDI_FM_FATAL: 507 fatal++; 508 break; 509 case DDI_FM_NONFATAL: 510 nonfatal++; 511 break; 512 case DDI_FM_UNKNOWN: 513 unknown++; 514 break; 515 default: 516 break; 517 } 518 } 519 } 520 521 /* Set the intr state to idle for the leaf that received the mondo */ 522 (void) px_lib_intr_setstate(rpdip, px_fault_p->px_fh_sysino, 523 INTR_IDLE_STATE); 524 525 mutex_exit(&cb_p->xbc_fm_mutex); 526 527 /* 528 * PX_FATAL_HW error is diagnosed after system recovered from 529 * HW initiated reset, therefore no furthur handling is required. 530 */ 531 if (fatal || err & (PX_FATAL_GOS | PX_FATAL_SW)) 532 fm_panic("Fatal System Bus Error has occurred\n"); 533 534 return (DDI_INTR_CLAIMED); 535 } 536 537 /* 538 * px_err_dmc_pec_intr: 539 * Interrupt handler for the DMC/PEC block. 540 * o lock 541 * o create derr 542 * o px_err_handle(leaf, with jbc) 543 * o dispatch (leaf) 544 * o unlock 545 * o handle error: fatal? fm_panic() : return INTR_CLAIMED) 546 */ 547 uint_t 548 px_err_dmc_pec_intr(caddr_t arg) 549 { 550 px_fault_t *px_fault_p = (px_fault_t *)arg; 551 dev_info_t *rpdip = px_fault_p->px_fh_dip; 552 px_t *px_p = DIP_TO_STATE(rpdip); 553 px_cb_t *cb_p = px_p->px_cb_p; 554 int err = PX_OK; 555 int ret = DDI_FM_OK; 556 ddi_fm_error_t derr; 557 558 /* Create the derr */ 559 bzero(&derr, sizeof (ddi_fm_error_t)); 560 derr.fme_version = DDI_FME_VERSION; 561 derr.fme_ena = fm_ena_generate(0, FM_ENA_FMT1); 562 derr.fme_flag = DDI_FM_ERR_UNEXPECTED; 563 564 mutex_enter(&cb_p->xbc_fm_mutex); 565 566 /* send ereport/handle/clear fire registers */ 567 err |= px_err_handle(px_p, &derr, PX_INTR_CALL, B_TRUE); 568 569 /* Check all child devices for errors */ 570 ret = ndi_fm_handler_dispatch(rpdip, NULL, &derr); 571 572 /* Set the interrupt state to idle */ 573 (void) px_lib_intr_setstate(rpdip, px_fault_p->px_fh_sysino, 574 INTR_IDLE_STATE); 575 576 mutex_exit(&cb_p->xbc_fm_mutex); 577 578 /* 579 * PX_FATAL_HW indicates a condition recovered from Fatal-Reset, 580 * therefore it does not cause panic. 581 */ 582 if ((err & (PX_FATAL_GOS | PX_FATAL_SW)) || (ret == DDI_FM_FATAL)) 583 fm_panic("Fatal System Port Error has occurred\n"); 584 585 return (DDI_INTR_CLAIMED); 586 } 587 588 /* 589 * Error register are being handled by px_hlib xxx_init functions. 590 * They are also called again by px_err_add_intr for mondo62 and 63 591 * from px_cb_attach and px_attach 592 */ 593 void 594 px_err_reg_enable(px_t *px_p, px_err_id_t id) 595 { 596 px_err_reg_desc_t *reg_desc = &px_err_reg_tbl[id]; 597 uint64_t intr_mask = *reg_desc->intr_mask_p; 598 uint64_t log_mask = *reg_desc->log_mask_p; 599 caddr_t csr_base; 600 pxu_t *pxu_p = (pxu_t *)px_p->px_plat_p; 601 602 if (id == PX_ERR_JBC) 603 csr_base = (caddr_t)pxu_p->px_address[PX_REG_XBC]; 604 else 605 csr_base = (caddr_t)pxu_p->px_address[PX_REG_CSR]; 606 607 reg_desc->enabled = B_TRUE; 608 609 /* Enable logs if it exists */ 610 if (reg_desc->log_addr != NULL) 611 CSR_XS(csr_base, reg_desc->log_addr, log_mask); 612 613 /* 614 * For readability you in code you set 1 to enable an interrupt. 615 * But in Fire it's backwards. You set 1 to *disable* an intr. 616 * Reverse the user tunable intr mask field. 617 * 618 * Disable All Errors 619 * Clear All Errors 620 * Enable Errors 621 */ 622 CSR_XS(csr_base, reg_desc->enable_addr, 0); 623 CSR_XS(csr_base, reg_desc->clear_addr, -1); 624 CSR_XS(csr_base, reg_desc->enable_addr, intr_mask); 625 DBG(DBG_ATTACH, NULL, "%s Mask: 0x%llx\n", 626 reg_desc->msg, CSR_XR(csr_base, reg_desc->enable_addr)); 627 DBG(DBG_ATTACH, NULL, "%s Status: 0x%llx\n", 628 reg_desc->msg, CSR_XR(csr_base, reg_desc->status_addr)); 629 DBG(DBG_ATTACH, NULL, "%s Clear: 0x%llx\n", 630 reg_desc->msg, CSR_XR(csr_base, reg_desc->clear_addr)); 631 if (reg_desc->log_addr != NULL) { 632 DBG(DBG_ATTACH, NULL, "%s Log: 0x%llx\n", 633 reg_desc->msg, CSR_XR(csr_base, reg_desc->log_addr)); 634 } 635 } 636 637 void 638 px_err_reg_disable(px_t *px_p, px_err_id_t id) 639 { 640 px_err_reg_desc_t *reg_desc = &px_err_reg_tbl[id]; 641 caddr_t csr_base; 642 643 if (id == PX_ERR_JBC) 644 csr_base = (caddr_t)px_p->px_inos[PX_INTR_XBC]; 645 else 646 csr_base = (caddr_t)px_p->px_inos[PX_INTR_PEC]; 647 648 reg_desc->enabled = B_FALSE; 649 650 switch (id) { 651 case PX_ERR_JBC: 652 case PX_ERR_MMU: 653 case PX_ERR_IMU: 654 case PX_ERR_TLU_UE: 655 case PX_ERR_TLU_CE: 656 case PX_ERR_TLU_OE: 657 case PX_ERR_ILU: 658 if (reg_desc->log_addr != NULL) { 659 CSR_XS(csr_base, reg_desc->log_addr, 0); 660 } 661 CSR_XS(csr_base, reg_desc->enable_addr, 0); 662 break; 663 case PX_ERR_LPU_LINK: 664 case PX_ERR_LPU_PHY: 665 case PX_ERR_LPU_RX: 666 case PX_ERR_LPU_TX: 667 case PX_ERR_LPU_LTSSM: 668 case PX_ERR_LPU_GIGABLZ: 669 if (reg_desc->log_addr != NULL) { 670 CSR_XS(csr_base, reg_desc->log_addr, -1); 671 } 672 CSR_XS(csr_base, reg_desc->enable_addr, -1); 673 break; 674 } 675 } 676 677 /* 678 * px_err_handle: 679 * Common function called by trap, mondo and fabric intr. 680 * o Snap shot current fire registers 681 * o check for safe access 682 * o send ereport and clear snap shot registers 683 * o check severity of snap shot registers 684 * 685 * @param px_p leaf in which to check access 686 * @param derr fm err data structure to be updated 687 * @param caller PX_TRAP_CALL | PX_INTR_CALL 688 * @param chkjbc whether to handle jbc registers 689 * @return err PX_OK | PX_NONFATAL | 690 * PX_FATAL_GOS | PX_FATAL_HW | PX_STUCK_FATAL 691 */ 692 int 693 px_err_handle(px_t *px_p, ddi_fm_error_t *derr, int caller, 694 boolean_t chkjbc) 695 { 696 px_cb_t *cb_p = px_p->px_cb_p; /* for fm_mutex */ 697 px_err_ss_t ss; 698 int err = PX_OK; 699 700 ASSERT(MUTEX_HELD(&cb_p->xbc_fm_mutex)); 701 702 /* snap shot the current fire registers */ 703 px_err_snapshot(px_p, &ss, chkjbc); 704 705 /* check for safe access */ 706 px_err_safeacc_check(px_p, derr); 707 708 /* send ereports/handle/clear registers */ 709 err = px_err_erpt_and_clr(px_p, derr, &ss); 710 711 /* check for error severity */ 712 err = px_err_check_severity(px_p, derr, err, caller); 713 714 /* Mark the On Trap Handle if an error occured */ 715 if (err != PX_OK) { 716 px_pec_t *pec_p = px_p->px_pec_p; 717 on_trap_data_t *otd = pec_p->pec_ontrap_data; 718 719 if ((otd != NULL) && (otd->ot_prot & OT_DATA_ACCESS)) 720 otd->ot_trap |= OT_DATA_ACCESS; 721 } 722 723 return (err); 724 } 725 726 /* 727 * Static function 728 */ 729 730 /* 731 * px_err_snapshot: 732 * Take a current snap shot of all the fire error registers. This includes 733 * JBC, DMC, and PEC, unless chkjbc == false; 734 * 735 * @param px_p leaf in which to take the snap shot. 736 * @param ss pre-allocated memory to store the snap shot. 737 * @param chkjbc boolean on whether to store jbc register. 738 */ 739 static void 740 px_err_snapshot(px_t *px_p, px_err_ss_t *ss, boolean_t chkjbc) 741 { 742 pxu_t *pxu_p = (pxu_t *)px_p->px_plat_p; 743 caddr_t xbc_csr_base = (caddr_t)pxu_p->px_address[PX_REG_XBC]; 744 caddr_t pec_csr_base = (caddr_t)pxu_p->px_address[PX_REG_CSR]; 745 px_err_reg_desc_t *reg_desc; 746 int reg_id; 747 748 /* snapshot JBC interrupt status */ 749 reg_id = PX_ERR_JBC; 750 if (chkjbc == B_TRUE) { 751 reg_desc = &px_err_reg_tbl[reg_id]; 752 ss->err_status[reg_id] = CSR_XR(xbc_csr_base, 753 reg_desc->status_addr); 754 } else { 755 ss->err_status[reg_id] = 0; 756 } 757 758 /* snapshot DMC/PEC interrupt status */ 759 for (reg_id = 1; reg_id < PX_ERR_REG_KEYS; reg_id += 1) { 760 reg_desc = &px_err_reg_tbl[reg_id]; 761 ss->err_status[reg_id] = CSR_XR(pec_csr_base, 762 reg_desc->status_addr); 763 } 764 } 765 766 /* 767 * px_err_erpt_and_clr: 768 * This function does the following thing to all the fire registers based 769 * on an earlier snap shot. 770 * o Send ereport 771 * o Handle the error 772 * o Clear the error 773 * 774 * @param px_p leaf in which to take the snap shot. 775 * @param derr fm err in which the ereport is to be based on 776 * @param ss pre-allocated memory to store the snap shot. 777 */ 778 static int 779 px_err_erpt_and_clr(px_t *px_p, ddi_fm_error_t *derr, px_err_ss_t *ss) 780 { 781 dev_info_t *rpdip = px_p->px_dip; 782 px_cb_t *cb_p = px_p->px_cb_p; /* for fm_mutex */ 783 pxu_t *pxu_p = (pxu_t *)px_p->px_plat_p; 784 caddr_t csr_base; 785 px_err_reg_desc_t *err_reg_tbl; 786 px_err_bit_desc_t *err_bit_tbl; 787 px_err_bit_desc_t *err_bit_desc; 788 789 uint64_t *log_mask, *count_mask; 790 uint64_t status_addr, clear_addr; 791 uint64_t ss_reg; 792 793 int (*err_handler)(); 794 int (*erpt_handler)(); 795 int reg_id, key; 796 int err = PX_OK; 797 798 ASSERT(MUTEX_HELD(&cb_p->xbc_fm_mutex)); 799 800 /* send erport/handle/clear JBC errors */ 801 for (reg_id = 0; reg_id < PX_ERR_REG_KEYS; reg_id += 1) { 802 /* Get the correct register description table */ 803 err_reg_tbl = &px_err_reg_tbl[reg_id]; 804 805 /* Get the correct CSR BASE */ 806 if (reg_id == PX_ERR_JBC) { 807 csr_base = (caddr_t)pxu_p->px_address[PX_REG_XBC]; 808 } else { 809 csr_base = (caddr_t)pxu_p->px_address[PX_REG_CSR]; 810 } 811 812 /* Get pointers to masks and register addresses */ 813 log_mask = err_reg_tbl->log_mask_p; 814 count_mask = err_reg_tbl->count_mask_p; 815 status_addr = err_reg_tbl->status_addr; 816 clear_addr = err_reg_tbl->clear_addr; 817 ss_reg = ss->err_status[reg_id]; 818 819 /* Get the register BIT description table */ 820 err_bit_tbl = err_reg_tbl->err_bit_tbl; 821 822 /* For each known bit in the register send erpt and handle */ 823 for (key = 0; key < err_reg_tbl->err_bit_keys; key += 1) { 824 /* Get the bit description table for this register */ 825 err_bit_desc = &err_bit_tbl[key]; 826 827 /* 828 * If the ss_reg is set for this bit, 829 * send ereport and handle 830 */ 831 if (BIT_TST(ss_reg, err_bit_desc->bit)) { 832 /* Increment the counter if necessary */ 833 if (BIT_TST(*count_mask, err_bit_desc->bit)) { 834 err_bit_desc->counter++; 835 } 836 837 /* Error Handle for this bit */ 838 err_handler = err_bit_desc->err_handler; 839 if (err_handler) 840 err |= err_handler(rpdip, 841 csr_base, 842 derr, 843 err_reg_tbl, 844 err_bit_desc); 845 846 /* Send the ereport if it's an UNEXPECTED err */ 847 erpt_handler = err_bit_desc->erpt_handler; 848 if (derr->fme_flag == DDI_FM_ERR_UNEXPECTED) { 849 if (erpt_handler) 850 (void) erpt_handler(rpdip, 851 csr_base, 852 ss_reg, 853 derr, 854 err_bit_desc->class_name); 855 } 856 } 857 858 } 859 860 /* Print register status */ 861 if (ss_reg & *log_mask) 862 DBG(DBG_ERR_INTR, rpdip, "<%x>=%16llx %s\n", 863 status_addr, ss_reg, err_reg_tbl->msg); 864 865 /* Clear the register and error */ 866 CSR_XS(csr_base, clear_addr, ss_reg); 867 } 868 869 return (err); 870 } 871 872 /* 873 * px_err_check_severity: 874 * Check the severity of the fire error based on an earlier snapshot 875 * 876 * @param px_p leaf in which to take the snap shot. 877 * @param derr fm err in which the ereport is to be based on 878 * @param ss pre-allocated memory to store the snap shot. 879 */ 880 static int 881 px_err_check_severity(px_t *px_p, ddi_fm_error_t *derr, int err, int caller) 882 { 883 px_pec_t *pec_p = px_p->px_pec_p; 884 boolean_t is_safeacc = B_FALSE; 885 886 /* nothing to do if called with no error */ 887 if (err == PX_OK) 888 return (err); 889 890 /* Cautious access error handling */ 891 switch (derr->fme_flag) { 892 case DDI_FM_ERR_EXPECTED: 893 if (caller == PX_TRAP_CALL) { 894 /* 895 * for ddi_caut_get treat all events as nonfatal 896 * The trampoline will set err_ena = 0, 897 * err_status = NONFATAL. 898 */ 899 derr->fme_status = DDI_FM_NONFATAL; 900 is_safeacc = B_TRUE; 901 } else { 902 /* 903 * For ddi_caut_put treat all events as nonfatal. Here 904 * we have the handle and can call ndi_fm_acc_err_set(). 905 */ 906 derr->fme_status = DDI_FM_NONFATAL; 907 ndi_fm_acc_err_set(pec_p->pec_acc_hdl, derr); 908 is_safeacc = B_TRUE; 909 } 910 break; 911 case DDI_FM_ERR_PEEK: 912 case DDI_FM_ERR_POKE: 913 /* 914 * For ddi_peek/poke treat all events as nonfatal. 915 */ 916 is_safeacc = B_TRUE; 917 break; 918 default: 919 is_safeacc = B_FALSE; 920 } 921 922 /* 923 * The third argument "err" is passed in as error status from checking 924 * Fire register, re-adjust error status from safe access. 925 */ 926 if (is_safeacc && !(err & PX_FATAL_GOS)) 927 return (PX_NONFATAL); 928 929 return (err); 930 } 931 932 /* predefined convenience functions */ 933 /* ARGSUSED */ 934 int 935 px_err_fatal_hw_handle(dev_info_t *rpdip, caddr_t csr_base, 936 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 937 px_err_bit_desc_t *err_bit_descr) 938 { 939 return (PX_FATAL_HW); 940 } 941 942 /* ARGSUSED */ 943 int 944 px_err_fatal_gos_handle(dev_info_t *rpdip, caddr_t csr_base, 945 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 946 px_err_bit_desc_t *err_bit_descr) 947 { 948 return (PX_FATAL_GOS); 949 } 950 951 /* ARGSUSED */ 952 int 953 px_err_fatal_stuck_handle(dev_info_t *rpdip, caddr_t csr_base, 954 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 955 px_err_bit_desc_t *err_bit_descr) 956 { 957 return (PX_STUCK_FATAL); 958 } 959 960 /* ARGSUSED */ 961 int 962 px_err_fatal_sw_handle(dev_info_t *rpdip, caddr_t csr_base, 963 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 964 px_err_bit_desc_t *err_bit_descr) 965 { 966 return (PX_FATAL_SW); 967 } 968 969 /* ARGSUSED */ 970 int 971 px_err_non_fatal_handle(dev_info_t *rpdip, caddr_t csr_base, 972 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 973 px_err_bit_desc_t *err_bit_descr) 974 { 975 return (PX_NONFATAL); 976 } 977 978 /* ARGSUSED */ 979 int 980 px_err_ok_handle(dev_info_t *rpdip, caddr_t csr_base, ddi_fm_error_t *derr, 981 px_err_reg_desc_t *err_reg_descr, px_err_bit_desc_t *err_bit_descr) 982 { 983 return (PX_OK); 984 } 985 986 /* ARGSUSED */ 987 int 988 px_err_unknown_handle(dev_info_t *rpdip, caddr_t csr_base, ddi_fm_error_t *derr, 989 px_err_reg_desc_t *err_reg_descr, px_err_bit_desc_t *err_bit_descr) 990 { 991 return (PX_ERR_UNKNOWN); 992 } 993 994 /* ARGSUSED */ 995 PX_ERPT_SEND_DEC(do_not) 996 { 997 return (PX_OK); 998 } 999 1000 1001 /* JBC FATAL - see io erpt doc, section 1.1 */ 1002 PX_ERPT_SEND_DEC(jbc_fatal) 1003 { 1004 char buf[FM_MAX_CLASS]; 1005 1006 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1007 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1008 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1009 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1010 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1011 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1012 FIRE_JBC_IE, DATA_TYPE_UINT64, 1013 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1014 FIRE_JBC_IS, DATA_TYPE_UINT64, 1015 ss_reg, 1016 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1017 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1018 FIRE_JBC_FEL1, DATA_TYPE_UINT64, 1019 CSR_XR(csr_base, FATAL_ERROR_LOG_1), 1020 FIRE_JBC_FEL2, DATA_TYPE_UINT64, 1021 CSR_XR(csr_base, FATAL_ERROR_LOG_2), 1022 NULL); 1023 1024 return (PX_OK); 1025 } 1026 1027 /* JBC MERGE - see io erpt doc, section 1.2 */ 1028 PX_ERPT_SEND_DEC(jbc_merge) 1029 { 1030 char buf[FM_MAX_CLASS]; 1031 1032 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1033 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1034 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1035 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1036 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1037 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1038 FIRE_JBC_IE, DATA_TYPE_UINT64, 1039 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1040 FIRE_JBC_IS, DATA_TYPE_UINT64, 1041 ss_reg, 1042 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1043 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1044 FIRE_JBC_MTEL, DATA_TYPE_UINT64, 1045 CSR_XR(csr_base, MERGE_TRANSACTION_ERROR_LOG), 1046 NULL); 1047 1048 return (PX_OK); 1049 } 1050 1051 /* 1052 * JBC Merge buffer nonfatal errors: 1053 * Merge buffer parity error (rd_buf): dma:read:M:nonfatal 1054 * Merge buffer parity error (wr_buf): dma:write:M:nonfatal 1055 */ 1056 /* ARGSUSED */ 1057 int 1058 px_err_jbc_merge_handle(dev_info_t *rpdip, caddr_t csr_base, 1059 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1060 px_err_bit_desc_t *err_bit_descr) 1061 { 1062 uint64_t paddr; 1063 int ret; 1064 1065 paddr = CSR_XR(csr_base, MERGE_TRANSACTION_ERROR_LOG); 1066 paddr &= MERGE_TRANSACTION_ERROR_LOG_ADDRESS_MASK; 1067 1068 ret = px_handle_lookup( 1069 rpdip, DMA_HANDLE, derr->fme_ena, (void *)paddr); 1070 1071 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1072 } 1073 1074 /* JBC Jbusint IN - see io erpt doc, section 1.3 */ 1075 PX_ERPT_SEND_DEC(jbc_in) 1076 { 1077 char buf[FM_MAX_CLASS]; 1078 1079 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1080 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1081 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1082 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1083 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1084 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1085 FIRE_JBC_IE, DATA_TYPE_UINT64, 1086 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1087 FIRE_JBC_IS, DATA_TYPE_UINT64, 1088 ss_reg, 1089 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1090 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1091 FIRE_JBC_JITEL1, DATA_TYPE_UINT64, 1092 CSR_XR(csr_base, JBCINT_IN_TRANSACTION_ERROR_LOG), 1093 FIRE_JBC_JITEL2, DATA_TYPE_UINT64, 1094 CSR_XR(csr_base, JBCINT_IN_TRANSACTION_ERROR_LOG_2), 1095 NULL); 1096 1097 return (PX_OK); 1098 } 1099 1100 /* 1101 * JBC Jbusint IN nonfatal errors: PA logged in Jbusint In Transaction Error 1102 * Log Reg[42:0]. 1103 * CE async fault error: nonfatal 1104 * Jbus bus error: dma::nonfatal 1105 * Jbus unmapped error: pio|dma:rdwr:M:nonfatal 1106 * Write data parity error: pio/write:M:nonfatal 1107 * Read data parity error: pio/read:M:nonfatal 1108 * Illegal NCWR bytemask: pio:write:M:nonfatal 1109 * Illegal NCRD bytemask: pio:write:M:nonfatal 1110 * Invalid jbus transaction: nonfatal 1111 */ 1112 /* ARGSUSED */ 1113 int 1114 px_err_jbc_jbusint_in_handle(dev_info_t *rpdip, caddr_t csr_base, 1115 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1116 px_err_bit_desc_t *err_bit_descr) 1117 { 1118 uint64_t paddr; 1119 int ret; 1120 1121 paddr = CSR_XR(csr_base, JBCINT_IN_TRANSACTION_ERROR_LOG); 1122 paddr &= JBCINT_IN_TRANSACTION_ERROR_LOG_ADDRESS_MASK; 1123 1124 ret = px_handle_lookup( 1125 rpdip, DMA_HANDLE, derr->fme_ena, (void *)paddr); 1126 1127 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1128 } 1129 1130 1131 /* JBC Jbusint Out - see io erpt doc, section 1.4 */ 1132 PX_ERPT_SEND_DEC(jbc_out) 1133 { 1134 char buf[FM_MAX_CLASS]; 1135 1136 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1137 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1138 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1139 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1140 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1141 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1142 FIRE_JBC_IE, DATA_TYPE_UINT64, 1143 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1144 FIRE_JBC_IS, DATA_TYPE_UINT64, 1145 ss_reg, 1146 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1147 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1148 FIRE_JBC_JOTEL1, DATA_TYPE_UINT64, 1149 CSR_XR(csr_base, JBCINT_OUT_TRANSACTION_ERROR_LOG), 1150 FIRE_JBC_JOTEL2, DATA_TYPE_UINT64, 1151 CSR_XR(csr_base, JBCINT_OUT_TRANSACTION_ERROR_LOG_2), 1152 NULL); 1153 1154 return (PX_OK); 1155 } 1156 1157 /* JBC Dmcint ODCD - see io erpt doc, section 1.5 */ 1158 PX_ERPT_SEND_DEC(jbc_odcd) 1159 { 1160 char buf[FM_MAX_CLASS]; 1161 1162 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1163 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1164 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1165 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1166 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1167 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1168 FIRE_JBC_IE, DATA_TYPE_UINT64, 1169 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1170 FIRE_JBC_IS, DATA_TYPE_UINT64, 1171 ss_reg, 1172 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1173 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1174 FIRE_JBC_DMC_ODCD, DATA_TYPE_UINT64, 1175 CSR_XR(csr_base, DMCINT_ODCD_ERROR_LOG), 1176 NULL); 1177 1178 return (PX_OK); 1179 } 1180 1181 /* 1182 * JBC Dmcint ODCO nonfatal errer handling - 1183 * Unmapped PIO read error: pio:read:M:nonfatal 1184 * Unmapped PIO write error: pio:write:M:nonfatal 1185 * PIO data parity error: pio:write:M:nonfatal 1186 * Invalid PIO write to PCIe cfg/io, csr, ebus or i2c bus: pio:write:nonfatal 1187 * Invalid PIO read to PCIe cfg/io, csr, ebus or i2c bus: pio:read:nonfatal 1188 */ 1189 /* ARGSUSED */ 1190 int 1191 px_err_jbc_dmcint_odcd_handle(dev_info_t *rpdip, caddr_t csr_base, 1192 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1193 px_err_bit_desc_t *err_bit_descr) 1194 { 1195 uint64_t paddr; 1196 int ret; 1197 1198 paddr = CSR_XR(csr_base, DMCINT_ODCD_ERROR_LOG); 1199 paddr &= DMCINT_ODCD_ERROR_LOG_ADDRESS_MASK; 1200 1201 ret = px_handle_lookup( 1202 rpdip, DMA_HANDLE, derr->fme_ena, (void *)paddr); 1203 1204 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1205 } 1206 1207 /* JBC Dmcint IDC - see io erpt doc, section 1.6 */ 1208 PX_ERPT_SEND_DEC(jbc_idc) 1209 { 1210 char buf[FM_MAX_CLASS]; 1211 1212 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1213 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1214 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1215 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1216 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1217 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1218 FIRE_JBC_IE, DATA_TYPE_UINT64, 1219 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1220 FIRE_JBC_IS, DATA_TYPE_UINT64, 1221 ss_reg, 1222 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1223 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1224 FIRE_JBC_DMC_IDC, DATA_TYPE_UINT64, 1225 CSR_XR(csr_base, DMCINT_IDC_ERROR_LOG), 1226 NULL); 1227 1228 return (PX_OK); 1229 } 1230 1231 /* JBC CSR - see io erpt doc, section 1.7 */ 1232 PX_ERPT_SEND_DEC(jbc_csr) 1233 { 1234 char buf[FM_MAX_CLASS]; 1235 1236 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1237 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1238 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1239 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1240 FIRE_JBC_ELE, DATA_TYPE_UINT64, 1241 CSR_XR(csr_base, JBC_ERROR_LOG_ENABLE), 1242 FIRE_JBC_IE, DATA_TYPE_UINT64, 1243 CSR_XR(csr_base, JBC_INTERRUPT_ENABLE), 1244 FIRE_JBC_IS, DATA_TYPE_UINT64, 1245 ss_reg, 1246 FIRE_JBC_ESS, DATA_TYPE_UINT64, 1247 CSR_XR(csr_base, JBC_ERROR_STATUS_SET), 1248 "jbc-error-reg", DATA_TYPE_UINT64, 1249 CSR_XR(csr_base, CSR_ERROR_LOG), 1250 NULL); 1251 1252 return (PX_OK); 1253 } 1254 1255 /* 1256 * JBC CSR errer handling - 1257 * Ebus ready timeout error: pio:rdwr:M:nonfatal 1258 */ 1259 /* ARGSUSED */ 1260 int 1261 px_err_jbc_csr_handle(dev_info_t *rpdip, caddr_t csr_base, 1262 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1263 px_err_bit_desc_t *err_bit_descr) 1264 { 1265 uint64_t paddr; 1266 int ret; 1267 1268 paddr = CSR_XR(csr_base, CSR_ERROR_LOG); 1269 paddr &= CSR_ERROR_LOG_ADDRESS_MASK; 1270 1271 ret = px_handle_lookup( 1272 rpdip, DMA_HANDLE, derr->fme_ena, (void *)paddr); 1273 1274 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1275 } 1276 1277 /* JBC Dmcint IDC - see io erpt doc, section 1.6 */ 1278 1279 /* DMC IMU RDS - see io erpt doc, section 2.1 */ 1280 PX_ERPT_SEND_DEC(imu_rds) 1281 { 1282 char buf[FM_MAX_CLASS]; 1283 1284 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1285 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1286 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1287 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1288 FIRE_IMU_ELE, DATA_TYPE_UINT64, 1289 CSR_XR(csr_base, IMU_ERROR_LOG_ENABLE), 1290 FIRE_IMU_IE, DATA_TYPE_UINT64, 1291 CSR_XR(csr_base, IMU_INTERRUPT_ENABLE), 1292 FIRE_IMU_IS, DATA_TYPE_UINT64, 1293 ss_reg, 1294 FIRE_IMU_ESS, DATA_TYPE_UINT64, 1295 CSR_XR(csr_base, IMU_ERROR_STATUS_SET), 1296 FIRE_IMU_RDS, DATA_TYPE_UINT64, 1297 CSR_XR(csr_base, IMU_RDS_ERROR_LOG), 1298 NULL); 1299 1300 return (PX_OK); 1301 } 1302 1303 /* imu function to handle all Received but Not Enabled errors */ 1304 /* ARGSUSED */ 1305 int 1306 px_err_imu_rbne_handle(dev_info_t *rpdip, caddr_t csr_base, 1307 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1308 px_err_bit_desc_t *err_bit_descr) 1309 { 1310 uint64_t imu_log_enable, imu_intr_enable; 1311 int mask = BITMASK(err_bit_descr->bit); 1312 int err = PX_NONFATAL; 1313 1314 imu_log_enable = CSR_XR(csr_base, err_reg_descr->log_addr); 1315 imu_intr_enable = CSR_XR(csr_base, err_reg_descr->enable_addr); 1316 1317 if (imu_log_enable & imu_intr_enable & mask) { 1318 err = PX_FATAL_SW; 1319 } else { 1320 /* 1321 * S/W bug - this error should always be enabled 1322 */ 1323 1324 /* enable error & intr reporting for this bit */ 1325 CSR_XS(csr_base, IMU_ERROR_LOG_ENABLE, imu_log_enable | mask); 1326 CSR_XS(csr_base, IMU_INTERRUPT_ENABLE, imu_intr_enable | mask); 1327 err = PX_NONFATAL; 1328 } 1329 1330 return (err); 1331 } 1332 1333 /* 1334 * No platforms uses PME. Any PME received is simply logged 1335 * for analysis. 1336 */ 1337 /* ARGSUSED */ 1338 int 1339 px_err_imu_pme_handle(dev_info_t *rpdip, caddr_t csr_base, 1340 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1341 px_err_bit_desc_t *err_bit_descr) 1342 { 1343 px_t *px_p = DIP_TO_STATE(rpdip); 1344 1345 px_p->px_pme_ignored++; 1346 return (PX_NONFATAL); 1347 } 1348 1349 /* handle EQ overflow */ 1350 /* ARGSUSED */ 1351 int 1352 px_err_imu_eq_ovfl_handle(dev_info_t *rpdip, caddr_t csr_base, 1353 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1354 px_err_bit_desc_t *err_bit_descr) 1355 { 1356 px_t *px_p = DIP_TO_STATE(rpdip); 1357 px_msiq_state_t *msiq_state_p = &px_p->px_ib_p->ib_msiq_state; 1358 msiqid_t eqno; 1359 pci_msiq_state_t msiq_state; 1360 int err = PX_NONFATAL; 1361 int i; 1362 1363 eqno = msiq_state_p->msiq_1st_msiq_id; 1364 for (i = 0; i < msiq_state_p->msiq_cnt; i++) { 1365 if (px_lib_msiq_getstate(rpdip, eqno, &msiq_state) == 1366 DDI_SUCCESS) { 1367 if (msiq_state == PCI_MSIQ_STATE_ERROR) { 1368 err = PX_FATAL_SW; 1369 } 1370 } 1371 } 1372 1373 return (err); 1374 } 1375 1376 /* DMC IMU SCS - see io erpt doc, section 2.2 */ 1377 PX_ERPT_SEND_DEC(imu_scs) 1378 { 1379 char buf[FM_MAX_CLASS]; 1380 1381 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1382 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1383 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1384 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1385 FIRE_IMU_ELE, DATA_TYPE_UINT64, 1386 CSR_XR(csr_base, IMU_ERROR_LOG_ENABLE), 1387 FIRE_IMU_IE, DATA_TYPE_UINT64, 1388 CSR_XR(csr_base, IMU_INTERRUPT_ENABLE), 1389 FIRE_IMU_IS, DATA_TYPE_UINT64, 1390 ss_reg, 1391 FIRE_IMU_ESS, DATA_TYPE_UINT64, 1392 CSR_XR(csr_base, IMU_ERROR_STATUS_SET), 1393 FIRE_IMU_SCS, DATA_TYPE_UINT64, 1394 CSR_XR(csr_base, IMU_SCS_ERROR_LOG), 1395 NULL); 1396 1397 return (PX_OK); 1398 } 1399 1400 /* DMC IMU - see io erpt doc, section 2.3 */ 1401 PX_ERPT_SEND_DEC(imu) 1402 { 1403 char buf[FM_MAX_CLASS]; 1404 1405 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1406 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1407 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1408 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1409 FIRE_IMU_ELE, DATA_TYPE_UINT64, 1410 CSR_XR(csr_base, IMU_ERROR_LOG_ENABLE), 1411 FIRE_IMU_IE, DATA_TYPE_UINT64, 1412 CSR_XR(csr_base, IMU_INTERRUPT_ENABLE), 1413 FIRE_IMU_IS, DATA_TYPE_UINT64, 1414 ss_reg, 1415 FIRE_IMU_ESS, DATA_TYPE_UINT64, 1416 CSR_XR(csr_base, IMU_ERROR_STATUS_SET), 1417 NULL); 1418 1419 return (PX_OK); 1420 } 1421 1422 /* DMC MMU TFAR/TFSR - see io erpt doc, section 2.4 */ 1423 PX_ERPT_SEND_DEC(mmu_tfar_tfsr) 1424 { 1425 char buf[FM_MAX_CLASS]; 1426 1427 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1428 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1429 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1430 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1431 FIRE_MMU_ELE, DATA_TYPE_UINT64, 1432 CSR_XR(csr_base, MMU_ERROR_LOG_ENABLE), 1433 FIRE_MMU_IE, DATA_TYPE_UINT64, 1434 CSR_XR(csr_base, MMU_INTERRUPT_ENABLE), 1435 FIRE_MMU_IS, DATA_TYPE_UINT64, 1436 ss_reg, 1437 FIRE_MMU_ESS, DATA_TYPE_UINT64, 1438 CSR_XR(csr_base, MMU_ERROR_STATUS_SET), 1439 FIRE_MMU_TFAR, DATA_TYPE_UINT64, 1440 CSR_XR(csr_base, MMU_TRANSLATION_FAULT_ADDRESS), 1441 FIRE_MMU_TFSR, DATA_TYPE_UINT64, 1442 CSR_XR(csr_base, MMU_TRANSLATION_FAULT_STATUS), 1443 NULL); 1444 1445 return (PX_OK); 1446 } 1447 1448 /* DMC MMU - see io erpt doc, section 2.5 */ 1449 PX_ERPT_SEND_DEC(mmu) 1450 { 1451 char buf[FM_MAX_CLASS]; 1452 1453 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1454 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1455 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1456 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1457 FIRE_MMU_ELE, DATA_TYPE_UINT64, 1458 CSR_XR(csr_base, MMU_ERROR_LOG_ENABLE), 1459 FIRE_MMU_IE, DATA_TYPE_UINT64, 1460 CSR_XR(csr_base, MMU_INTERRUPT_ENABLE), 1461 FIRE_MMU_IS, DATA_TYPE_UINT64, 1462 ss_reg, 1463 FIRE_MMU_ESS, DATA_TYPE_UINT64, 1464 CSR_XR(csr_base, MMU_ERROR_STATUS_SET), 1465 NULL); 1466 1467 return (PX_OK); 1468 } 1469 1470 /* imu function to handle all Received but Not Enabled errors */ 1471 int 1472 px_err_mmu_rbne_handle(dev_info_t *rpdip, caddr_t csr_base, 1473 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1474 px_err_bit_desc_t *err_bit_descr) 1475 { 1476 uint64_t mmu_log_enable, mmu_intr_enable; 1477 uint64_t mask = BITMASK(err_bit_descr->bit); 1478 uint64_t mmu_tfa, mmu_ctrl; 1479 uint64_t mmu_enable_bit = 0; 1480 int err = PX_NONFATAL; 1481 int ret; 1482 1483 mmu_log_enable = CSR_XR(csr_base, err_reg_descr->log_addr); 1484 mmu_intr_enable = CSR_XR(csr_base, err_reg_descr->enable_addr); 1485 1486 mmu_tfa = CSR_XR(csr_base, MMU_TRANSLATION_FAULT_ADDRESS); 1487 mmu_ctrl = CSR_XR(csr_base, MMU_CONTROL_AND_STATUS); 1488 1489 switch (err_bit_descr->bit) { 1490 case MMU_INTERRUPT_STATUS_BYP_ERR_P: 1491 mmu_enable_bit = BITMASK(MMU_CONTROL_AND_STATUS_BE); 1492 break; 1493 case MMU_INTERRUPT_STATUS_TRN_ERR_P: 1494 mmu_enable_bit = BITMASK(MMU_CONTROL_AND_STATUS_TE); 1495 break; 1496 default: 1497 mmu_enable_bit = 0; 1498 break; 1499 } 1500 1501 /* 1502 * If the interrupts are enabled and Translation/Bypass Enable bit 1503 * was set, then panic. This error should not have occured. 1504 */ 1505 if (mmu_log_enable & mmu_intr_enable & 1506 (mmu_ctrl & mmu_enable_bit)) { 1507 err = PX_FATAL_SW; 1508 } else { 1509 ret = px_handle_lookup( 1510 rpdip, DMA_HANDLE, derr->fme_ena, (void *)mmu_tfa); 1511 err = (ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL; 1512 1513 /* 1514 * S/W bug - this error should always be enabled 1515 */ 1516 1517 /* enable error & intr reporting for this bit */ 1518 CSR_XS(csr_base, MMU_ERROR_LOG_ENABLE, mmu_log_enable | mask); 1519 CSR_XS(csr_base, MMU_INTERRUPT_ENABLE, mmu_intr_enable | mask); 1520 1521 /* enable translation access/bypass enable */ 1522 CSR_XS(csr_base, MMU_CONTROL_AND_STATUS, 1523 mmu_ctrl | mmu_enable_bit); 1524 } 1525 1526 return (err); 1527 } 1528 1529 /* Generic error handling functions that involve MMU Translation Fault Addr */ 1530 /* ARGSUSED */ 1531 int 1532 px_err_mmu_tfa_handle(dev_info_t *rpdip, caddr_t csr_base, 1533 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1534 px_err_bit_desc_t *err_bit_descr) 1535 { 1536 uint64_t mmu_tfa; 1537 uint_t ret; 1538 1539 mmu_tfa = CSR_XR(csr_base, MMU_TRANSLATION_FAULT_ADDRESS); 1540 ret = px_handle_lookup( 1541 rpdip, DMA_HANDLE, derr->fme_ena, (void *)mmu_tfa); 1542 1543 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1544 } 1545 1546 /* MMU Table walk errors */ 1547 /* ARGSUSED */ 1548 int 1549 px_err_mmu_tblwlk_handle(dev_info_t *rpdip, caddr_t csr_base, 1550 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1551 px_err_bit_desc_t *err_bit_descr) 1552 { 1553 uint64_t mmu_tfa; 1554 uint_t ret; 1555 1556 mmu_tfa = CSR_XR(csr_base, MMU_TRANSLATION_FAULT_ADDRESS); 1557 ret = px_handle_lookup( 1558 rpdip, DMA_HANDLE, derr->fme_ena, (void *)mmu_tfa); 1559 1560 return ((ret == DDI_FM_FATAL) ? PX_FATAL_GOS : PX_NONFATAL); 1561 } 1562 1563 /* 1564 * TLU LUP event - power management code is interested in this event. 1565 */ 1566 /* ARGSUSED */ 1567 int 1568 px_err_tlu_lup_handle(dev_info_t *rpdip, caddr_t csr_base, 1569 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1570 px_err_bit_desc_t *err_bit_descr) 1571 { 1572 px_t *px_p = DIP_TO_STATE(rpdip); 1573 1574 /* 1575 * Existense of pm info indicates the power management 1576 * is interested in this event. 1577 */ 1578 if (!PCIE_PMINFO(rpdip) || !PCIE_NEXUS_PMINFO(rpdip)) 1579 return (PX_OK); 1580 1581 mutex_enter(&px_p->px_lup_lock); 1582 px_p->px_lupsoft_pending++; 1583 mutex_exit(&px_p->px_lup_lock); 1584 1585 /* 1586 * Post a soft interrupt to wake up threads waiting for this. 1587 */ 1588 ddi_trigger_softintr(px_p->px_lupsoft_id); 1589 1590 return (PX_OK); 1591 } 1592 1593 /* PEC ILU none - see io erpt doc, section 3.1 */ 1594 PX_ERPT_SEND_DEC(pec_ilu) 1595 { 1596 char buf[FM_MAX_CLASS]; 1597 1598 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1599 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1600 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1601 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1602 FIRE_ILU_ELE, DATA_TYPE_UINT64, 1603 CSR_XR(csr_base, ILU_ERROR_LOG_ENABLE), 1604 FIRE_ILU_IE, DATA_TYPE_UINT64, 1605 CSR_XR(csr_base, ILU_INTERRUPT_ENABLE), 1606 FIRE_ILU_IS, DATA_TYPE_UINT64, 1607 ss_reg, 1608 FIRE_ILU_ESS, DATA_TYPE_UINT64, 1609 CSR_XR(csr_base, ILU_ERROR_STATUS_SET), 1610 NULL); 1611 1612 return (PX_OK); 1613 } 1614 1615 /* PCIEX UE Errors */ 1616 /* ARGSUSED */ 1617 px_err_pciex_ue_handle(dev_info_t *rpdip, caddr_t csr_base, 1618 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1619 px_err_bit_desc_t *err_bit_descr) 1620 { 1621 uint32_t mask = (uint32_t)BITMASK(err_bit_descr->bit); 1622 1623 return ((err_bit_descr->bit >= 32 && px_fabric_die_rc_ue_gos) ? 1624 PX_FATAL_GOS : PX_FABRIC_ERR_SEV(mask, px_fabric_die_rc_ue, 1625 px_fabric_die_rc_ue_gos)); 1626 } 1627 1628 /* PCI-E Uncorrectable Errors - see io erpt doc, section 3.2 */ 1629 PX_ERPT_SEND_DEC(pciex_rx_ue) 1630 { 1631 char buf[FM_MAX_CLASS]; 1632 1633 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1634 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1635 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1636 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1637 FIRE_TLU_UELE, DATA_TYPE_UINT64, 1638 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_LOG_ENABLE), 1639 FIRE_TLU_UIE, DATA_TYPE_UINT64, 1640 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_INTERRUPT_ENABLE), 1641 FIRE_TLU_UIS, DATA_TYPE_UINT64, 1642 ss_reg, 1643 FIRE_TLU_UESS, DATA_TYPE_UINT64, 1644 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_STATUS_SET), 1645 FIRE_TLU_RUEH1L, DATA_TYPE_UINT64, 1646 CSR_XR(csr_base, TLU_RECEIVE_UNCORRECTABLE_ERROR_HEADER1_LOG), 1647 FIRE_TLU_RUEH2L, DATA_TYPE_UINT64, 1648 CSR_XR(csr_base, TLU_RECEIVE_UNCORRECTABLE_ERROR_HEADER2_LOG), 1649 NULL); 1650 1651 return (PX_OK); 1652 } 1653 1654 /* PCI-E Uncorrectable Errors - see io erpt doc, section 3.3 */ 1655 PX_ERPT_SEND_DEC(pciex_tx_ue) 1656 { 1657 char buf[FM_MAX_CLASS]; 1658 1659 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1660 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1661 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1662 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1663 FIRE_TLU_UELE, DATA_TYPE_UINT64, 1664 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_LOG_ENABLE), 1665 FIRE_TLU_UIE, DATA_TYPE_UINT64, 1666 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_INTERRUPT_ENABLE), 1667 FIRE_TLU_UIS, DATA_TYPE_UINT64, 1668 ss_reg, 1669 FIRE_TLU_UESS, DATA_TYPE_UINT64, 1670 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_STATUS_SET), 1671 FIRE_TLU_TUEH1L, DATA_TYPE_UINT64, 1672 CSR_XR(csr_base, TLU_TRANSMIT_UNCORRECTABLE_ERROR_HEADER1_LOG), 1673 FIRE_TLU_TUEH2L, DATA_TYPE_UINT64, 1674 CSR_XR(csr_base, TLU_TRANSMIT_UNCORRECTABLE_ERROR_HEADER2_LOG), 1675 NULL); 1676 1677 return (PX_OK); 1678 } 1679 1680 /* PCI-E Uncorrectable Errors - see io erpt doc, section 3.4 */ 1681 PX_ERPT_SEND_DEC(pciex_rx_tx_ue) 1682 { 1683 char buf[FM_MAX_CLASS]; 1684 1685 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1686 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1687 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1688 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1689 FIRE_TLU_UELE, DATA_TYPE_UINT64, 1690 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_LOG_ENABLE), 1691 FIRE_TLU_UIE, DATA_TYPE_UINT64, 1692 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_INTERRUPT_ENABLE), 1693 FIRE_TLU_UIS, DATA_TYPE_UINT64, 1694 ss_reg, 1695 FIRE_TLU_UESS, DATA_TYPE_UINT64, 1696 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_STATUS_SET), 1697 FIRE_TLU_RUEH1L, DATA_TYPE_UINT64, 1698 CSR_XR(csr_base, TLU_RECEIVE_UNCORRECTABLE_ERROR_HEADER1_LOG), 1699 FIRE_TLU_RUEH2L, DATA_TYPE_UINT64, 1700 CSR_XR(csr_base, TLU_RECEIVE_UNCORRECTABLE_ERROR_HEADER2_LOG), 1701 FIRE_TLU_TUEH1L, DATA_TYPE_UINT64, 1702 CSR_XR(csr_base, TLU_TRANSMIT_UNCORRECTABLE_ERROR_HEADER1_LOG), 1703 FIRE_TLU_TUEH2L, DATA_TYPE_UINT64, 1704 CSR_XR(csr_base, TLU_TRANSMIT_UNCORRECTABLE_ERROR_HEADER2_LOG), 1705 NULL); 1706 1707 return (PX_OK); 1708 } 1709 1710 /* PCI-E Uncorrectable Errors - see io erpt doc, section 3.5 */ 1711 PX_ERPT_SEND_DEC(pciex_ue) 1712 { 1713 char buf[FM_MAX_CLASS]; 1714 1715 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1716 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1717 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1718 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1719 FIRE_TLU_UELE, DATA_TYPE_UINT64, 1720 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_LOG_ENABLE), 1721 FIRE_TLU_UIE, DATA_TYPE_UINT64, 1722 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_INTERRUPT_ENABLE), 1723 FIRE_TLU_UIS, DATA_TYPE_UINT64, 1724 ss_reg, 1725 FIRE_TLU_UESS, DATA_TYPE_UINT64, 1726 CSR_XR(csr_base, TLU_UNCORRECTABLE_ERROR_STATUS_SET), 1727 NULL); 1728 1729 return (PX_OK); 1730 } 1731 1732 /* PCIEX UE Errors */ 1733 /* ARGSUSED */ 1734 px_err_pciex_ce_handle(dev_info_t *rpdip, caddr_t csr_base, 1735 ddi_fm_error_t *derr, px_err_reg_desc_t *err_reg_descr, 1736 px_err_bit_desc_t *err_bit_descr) 1737 { 1738 uint32_t mask = (uint32_t)BITMASK(err_bit_descr->bit); 1739 1740 return ((err_bit_descr->bit >= 32 && px_fabric_die_rc_ce_gos) ? 1741 PX_FATAL_GOS : PX_FABRIC_ERR_SEV(mask, px_fabric_die_rc_ce, 1742 px_fabric_die_rc_ce_gos)); 1743 } 1744 1745 /* PCI-E Correctable Errors - see io erpt doc, section 3.6 */ 1746 PX_ERPT_SEND_DEC(pciex_ce) 1747 { 1748 char buf[FM_MAX_CLASS]; 1749 1750 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1751 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1752 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1753 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1754 FIRE_TLU_CELE, DATA_TYPE_UINT64, 1755 CSR_XR(csr_base, TLU_CORRECTABLE_ERROR_LOG_ENABLE), 1756 FIRE_TLU_CIE, DATA_TYPE_UINT64, 1757 CSR_XR(csr_base, TLU_CORRECTABLE_ERROR_INTERRUPT_ENABLE), 1758 FIRE_TLU_CIS, DATA_TYPE_UINT64, 1759 ss_reg, 1760 FIRE_TLU_CESS, DATA_TYPE_UINT64, 1761 CSR_XR(csr_base, TLU_CORRECTABLE_ERROR_STATUS_SET), 1762 NULL); 1763 1764 return (PX_OK); 1765 } 1766 1767 /* TLU Other Event Status (receive only) - see io erpt doc, section 3.7 */ 1768 PX_ERPT_SEND_DEC(pciex_rx_oe) 1769 { 1770 char buf[FM_MAX_CLASS]; 1771 1772 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1773 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1774 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1775 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1776 FIRE_TLU_OEELE, DATA_TYPE_UINT64, 1777 CSR_XR(csr_base, TLU_OTHER_EVENT_LOG_ENABLE), 1778 FIRE_TLU_OEIE, DATA_TYPE_UINT64, 1779 CSR_XR(csr_base, TLU_OTHER_EVENT_INTERRUPT_ENABLE), 1780 FIRE_TLU_OEIS, DATA_TYPE_UINT64, 1781 ss_reg, 1782 FIRE_TLU_OEESS, DATA_TYPE_UINT64, 1783 CSR_XR(csr_base, TLU_OTHER_EVENT_STATUS_SET), 1784 FIRE_TLU_RUEH1L, DATA_TYPE_UINT64, 1785 CSR_XR(csr_base, TLU_RECEIVE_OTHER_EVENT_HEADER1_LOG), 1786 FIRE_TLU_RUEH2L, DATA_TYPE_UINT64, 1787 CSR_XR(csr_base, TLU_RECEIVE_OTHER_EVENT_HEADER2_LOG), 1788 NULL); 1789 1790 return (PX_OK); 1791 } 1792 1793 /* TLU Other Event Status (rx + tx) - see io erpt doc, section 3.8 */ 1794 PX_ERPT_SEND_DEC(pciex_rx_tx_oe) 1795 { 1796 char buf[FM_MAX_CLASS]; 1797 1798 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1799 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1800 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1801 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1802 FIRE_TLU_OEELE, DATA_TYPE_UINT64, 1803 CSR_XR(csr_base, TLU_OTHER_EVENT_LOG_ENABLE), 1804 FIRE_TLU_OEIE, DATA_TYPE_UINT64, 1805 CSR_XR(csr_base, TLU_OTHER_EVENT_INTERRUPT_ENABLE), 1806 FIRE_TLU_OEIS, DATA_TYPE_UINT64, 1807 ss_reg, 1808 FIRE_TLU_OEESS, DATA_TYPE_UINT64, 1809 CSR_XR(csr_base, TLU_OTHER_EVENT_STATUS_SET), 1810 FIRE_TLU_ROEEH1L, DATA_TYPE_UINT64, 1811 CSR_XR(csr_base, TLU_RECEIVE_OTHER_EVENT_HEADER1_LOG), 1812 FIRE_TLU_ROEEH2L, DATA_TYPE_UINT64, 1813 CSR_XR(csr_base, TLU_RECEIVE_OTHER_EVENT_HEADER2_LOG), 1814 FIRE_TLU_TOEEH1L, DATA_TYPE_UINT64, 1815 CSR_XR(csr_base, TLU_TRANSMIT_OTHER_EVENT_HEADER1_LOG), 1816 FIRE_TLU_TOEEH2L, DATA_TYPE_UINT64, 1817 CSR_XR(csr_base, TLU_TRANSMIT_OTHER_EVENT_HEADER2_LOG), 1818 NULL); 1819 1820 return (PX_OK); 1821 } 1822 1823 /* TLU Other Event - see io erpt doc, section 3.9 */ 1824 PX_ERPT_SEND_DEC(pciex_oe) 1825 { 1826 char buf[FM_MAX_CLASS]; 1827 1828 (void) snprintf(buf, FM_MAX_CLASS, "%s", class_name); 1829 ddi_fm_ereport_post(rpdip, buf, derr->fme_ena, 1830 DDI_NOSLEEP, FM_VERSION, DATA_TYPE_UINT8, 0, 1831 FIRE_PRIMARY, DATA_TYPE_BOOLEAN_VALUE, B_TRUE, 1832 FIRE_TLU_OEELE, DATA_TYPE_UINT64, 1833 CSR_XR(csr_base, TLU_OTHER_EVENT_LOG_ENABLE), 1834 FIRE_TLU_OEIE, DATA_TYPE_UINT64, 1835 CSR_XR(csr_base, TLU_OTHER_EVENT_INTERRUPT_ENABLE), 1836 FIRE_TLU_OEIS, DATA_TYPE_UINT64, 1837 ss_reg, 1838 FIRE_TLU_OEESS, DATA_TYPE_UINT64, 1839 CSR_XR(csr_base, TLU_OTHER_EVENT_STATUS_SET), 1840 NULL); 1841 1842 return (PX_OK); 1843 } 1844 1845 /* TLU Other Event - Link Down see io erpt doc, section 3.9 */ 1846 PX_ERPT_SEND_DEC(pciex_ldn) 1847 { 1848 px_t *px_p = DIP_TO_STATE(rpdip); 1849 1850 /* 1851 * Don't post ereport, if ldn event is due to 1852 * power management. 1853 */ 1854 if (px_p->px_pm_flags & PX_LDN_EXPECTED) { 1855 px_p->px_pm_flags &= ~PX_LDN_EXPECTED; 1856 return (PX_OK); 1857 } 1858 return (PX_ERPT_SEND(pciex_oe)(rpdip, csr_base, ss_reg, derr, 1859 class_name)); 1860 1861 } 1862 1863 /* TLU Other Event - Link Up see io erpt doc, section 3.9 */ 1864 PX_ERPT_SEND_DEC(pciex_lup) 1865 { 1866 px_t *px_p = DIP_TO_STATE(rpdip); 1867 1868 /* 1869 * Don't post ereport, if lup event is due to 1870 * power management. 1871 */ 1872 if (px_p->px_pm_flags & PX_LUP_EXPECTED) { 1873 px_p->px_pm_flags &= ~PX_LUP_EXPECTED; 1874 return (PX_OK); 1875 } 1876 1877 return (PX_ERPT_SEND(pciex_oe)(rpdip, csr_base, ss_reg, derr, 1878 class_name)); 1879 } 1880