px_fm.c revision 2859562fdfd7ef8a00f5c8a5dc05117a732e7983
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * CDDL HEADER START
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * The contents of this file are subject to the terms of the
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Common Development and Distribution License (the "License").
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * You may not use this file except in compliance with the License.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * See the License for the specific language governing permissions
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * and limitations under the License.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * When distributing Covered Code, include this CDDL HEADER in each
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * If applicable, add the following below this CDDL HEADER, with the
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * fields enclosed by brackets "[]" replaced with your own identifying
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * information: Portions Copyright [yyyy] [name of copyright owner]
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * CDDL HEADER END
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Use is subject to license terms.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl#pragma ident "%Z%%M% %I% %E% SMI"
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * PX Fault Management Architecture
25cf1a301a396c38e8adf52c15f537b80d2483f7jltypedef struct px_fabric_cfgspace {
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* Error information */
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* Config space header and device type */
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* Register pointers */
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* PCI register values */
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* PCIE register values */
25cf1a301a396c38e8adf52c15f537b80d2483f7jl /* PCIE Header Log Registers */
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic uint16_t px_fabric_get_aer(px_t *px_p, pcie_req_id_t rid);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic uint16_t px_fabric_get_pciecap(px_t *px_p, pcie_req_id_t rid);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic int px_fabric_handle_psts(px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic int px_fabric_handle_ssts(px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic int px_fabric_handle_paer(px_t *px_p, px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic int px_fabric_handle_saer(px_t *px_p, px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic int px_fabric_handle(px_t *px_p, px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic void px_fabric_fill_cs(px_t *px_p, px_fabric_cfgspace_t *cs);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic uint_t px_fabric_check(px_t *px_p, msgcode_t msg_code,
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Initialize px FMA support
25cf1a301a396c38e8adf52c15f537b80d2483f7jl px_p->px_fm_cap = DDI_FM_EREPORT_CAPABLE | DDI_FM_ERRCB_CAPABLE |
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Initialize pci_target_queue for FMA handling of
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * pci errors.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * check parents' capability
25cf1a301a396c38e8adf52c15f537b80d2483f7jl ddi_fm_init(px_p->px_dip, &px_p->px_fm_cap, &px_p->px_fm_ibc);
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * parents need to be ereport and error handling capable
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Initialize lock to synchronize fabric error handling
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * register error callback in parent
25cf1a301a396c38e8adf52c15f537b80d2483f7jl ddi_fm_handler_register(px_p->px_dip, px_fm_callback, px_p);
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Deregister FMA
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Function used to setup access functions depending on level of desired
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * protection.
switch (fflag) {
case DDI_FLAGERR_ACC:
case DDI_CAUTIOUS_ACC :
int fatal = 0;
int nonfatal = 0;
int unknown = 0;
switch (ret) {
case DDI_FM_FATAL:
fatal++;
case DDI_FM_NONFATAL:
nonfatal++;
case DDI_FM_UNKNOWN:
unknown++;
return (ret);
static uint16_t
int deadcount = 0;
return (offset);
static uint16_t
int deadcount = 0;
hdr_cap_id = 0;
return (offset);
return (ret);
return (ret);
case PCIE_MSG_CODE_ERR_COR:
case PCIE_MSG_CODE_ERR_FATAL:
return (PX_FATAL_GOS);
return (ret);
case PCIE_MSG_CODE_ERR_COR:
sev = 0;
case PCIE_MSG_CODE_ERR_FATAL:
return (DDI_FM_FATAL);
return (ret);
if (!aer_off) {
if (aer_off) {
return (ret);
if (!cap_off)
if (!aer_off)
static uint_t
int ret;
NULL);
case DDI_FM_ERR_EXPECTED:
case DDI_FM_ERR_PEEK:
case DDI_FM_ERR_POKE:
if (px_fabric_die &&
return (ret);
return (DDI_INTR_CLAIMED);
switch (acctype) {
case DDI_FM_ERR_EXPECTED:
case DDI_FM_ERR_POKE:
membar_sync();
case DDI_FM_ERR_PEEK: