/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ddi_impldefs.h>
/*LINTLIBRARY*/
/*
* The routines below are generic sun4u PCI interfaces to support
* Fault Management.
*
* pci_dma_check, pci_acc_check, pci_handle_lookup are functions used
*
* pci_fm_acc_setup, pci_fm_init_child, pci_fm_create,
* pci_fm_destroy are constructors/destructors used to setup and teardown
* necessary resources.
*
* pci_bus_enter, pci_bus_exit are registered via busops and are used to
* provide exclusive access to the PCI bus.
*
* pci_err_callback is the registered callback for PCI which is called
*
* pbm_ereport_post is used by the PBM code to generically report all
* PBM errors.
*
*/
/*
* Function used to setup access functions depending on level of desired
* protection.
*/
void
{
switch (fflag) {
case DDI_FLAGERR_ACC:
break;
case DDI_CAUTIOUS_ACC :
break;
default:
break;
}
}
}
/*
* Function used to initialize FMA for our children nodes. Called
* through pci busops when child node calls ddi_fm_init.
*/
/* ARGSUSED */
int
{
return (pci_p->pci_fm_cap);
}
/*
* Lock accesses to the pci bus, to be able to protect against bus errors.
*/
void
{
membar_sync();
}
/*
* Unlock access to bus and clear errors before exiting.
*/
/* ARGSUSED */
void
{
membar_sync();
if (pci_check_error(pci_p) != 0) {
(const void *)pci_p, PCI_BUS_EXIT_CALL);
}
}
}
/*
* PCI error callback which is registered with our parent to call
*/
int
const void *impl_data)
{
int fatal = 0;
int nonfatal = 0;
int unknown = 0;
/*
* Check and log ecc and pbm errors
*/
fatal++;
else if (ret == DDI_FM_NONFATAL)
nonfatal++;
else if (ret == DDI_FM_UNKNOWN)
unknown++;
if (pci_check_error(pci_p) != 0) {
(const void *)pci_p, PCI_TRAP_CALL);
if (err == DDI_FM_FATAL)
fatal++;
else if (err == DDI_FM_NONFATAL)
nonfatal++;
else if (err == DDI_FM_UNKNOWN)
unknown++;
}
if (fatal)
return (DDI_FM_FATAL);
else if (nonfatal)
return (DDI_FM_NONFATAL);
else if (unknown)
return (DDI_FM_UNKNOWN);
else
return (DDI_FM_OK);
}
void
{
/*
* PCI detected ECC errorq, to schedule async handling
* of ECC errors and logging.
* The errorq is created here but destroyed when _fini is called
* for the pci module.
*/
if (pci_ecc_queue == NULL) {
ECC_MAX_ERRS, sizeof (ecc_errstate_t),
if (pci_ecc_queue == NULL)
panic("failed to create required system error queue");
}
/*
* Initialize pci_target_queue for FMA handling of pci errors.
*/
/*
* Initialize FMA support
* The axq workaround prevents fault management of access errors
*/
else
/*
* Call parent to get it's capablity
*/
&pci_p->pci_fm_ibc);
/*
* Need to be ereport and error handler cabable
*/
/*
* Initialize error handling mutex.
*/
if (cmn_p->pci_common_refcnt == 0) {
(void *)pci_p->pci_fm_ibc);
}
/*
* Register error callback with our parent.
*/
pci_p);
}
void
{
/* schizo non-shared objects */
if (cmn_p->pci_common_refcnt != 0)
return;
}
/*
* Function used to post PCI block module specific ereports.
*/
void
{
NULL);
}