pcie.c revision 911fc2e57de04c6f6a4da8afebbafbcc3e3c4ee5
/*
* 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/sysmacros.h>
#include <sys/pcie_impl.h>
#ifdef DEBUG
uint_t pcie_debug_flags = 0;
#else /* DEBUG */
#define PCIE_DBG 0 &&
#endif /* DEBUG */
/* Variable to control default PCI-Express config settings */
uint32_t pcie_aer_ce_mask = 0;
/*
* modload support
*/
extern struct mod_ops mod_miscops;
&mod_miscops, /* Type of module */
"PCIE: PCI Express Architecture %I%"
};
struct modlinkage modlinkage = {
(void *)&modlmisc,
};
int
_init(void)
{
int rval;
return (rval);
}
int
_fini()
{
int rval;
return (rval);
}
int
{
}
/*
* PCI-Express child device initialization.
* This function enables generic pci-express interrupts and error
* handling.
*
* @param pdip root dip (root nexus's dip)
* @param cdip child's dip (device's dip)
* @return DDI_SUCCESS or DDI_FAILURE
*/
/* ARGSUSED */
int
{
return (DDI_FAILURE);
/*
* Determine the configuration header type.
*/
/*
* Setup the device's command register
*/
/*
* If the device has a bus control register then program it
* based on the settings in the command register.
*/
}
!= DDI_FAILURE)
return (DDI_SUCCESS);
fail:
return (DDI_FAILURE);
}
/*
* PCI-Express child device de-initialization.
* This function disables generic pci-express interrupts and error
* handling.
*
* @param pdip parent dip (root nexus's dip)
* @param cdip child's dip (device's dip)
* @param arg pcie private data
*/
/* ARGSUSED */
void
{
return;
}
/* ARGSUSED */
void
{
int rval = DDI_FAILURE;
!= DDI_FAILURE) {
(PCIE_EXT_CAP_ID_AER), &aer_ptr);
}
/*
* Clear any pending errors
*/
/* 1. clear the Advanced PCIe Errors */
if (rval != DDI_FAILURE) {
-1);
-1);
if (dev_type == PCIE_PCIECAP_DEV_TYPE_PCIE2PCI) {
PCIE_AER_SUCE_STS, -1);
}
}
/* 2. clear the PCIe Errors */
PCIE_DEVSTS)) != 0xffff)
/* 3. clear the Legacy PCI Errors */
if (dev_type == PCIE_PCIECAP_DEV_TYPE_PCIE2PCI) {
}
}
void
{
int rval = DDI_FAILURE;
!= DDI_FAILURE) {
(PCIE_EXT_CAP_ID_AER), &aer_ptr);
}
/*
* Clear any pending errors
*/
/*
* Enable PCI-Express Baseline Error Handling
*/
PCIE_DEVCTL)) != 0xffff) {
PCIE_DBG("%s: device control=0x%x->0x%x\n",
}
/*
* Enable PCI-Express Advanced Error Handling if Exists
*/
if (rval == DDI_FAILURE) {
return;
}
/* Enable Uncorrectable errors */
PCIE_AER_UCE_MASK)) != DDI_FAILURE) {
}
/* Enable Correctable errors */
PCIE_AER_CE_MASK)) != DDI_FAILURE) {
}
/*
* Enable Secondary Uncorrectable errors if this is a bridge
*/
if (!(dev_type == PCIE_PCIECAP_DEV_TYPE_PCIE2PCI))
return;
/*
* Enable secondary bus errors
*/
PCIE_AER_SUCE_MASK)) != DDI_FAILURE) {
}
}
/* ARGSUSED */
void
{
int rval = DDI_FAILURE;
!= DDI_FAILURE) {
(PCIE_EXT_CAP_ID_AER), &aer_ptr);
}
/*
* Disable PCI-Express Baseline Error Handling
*/
/*
* Disable PCI-Express Advanced Error Handling if Exists
*/
if (rval == DDI_FAILURE) {
return;
}
/* Disable Uncorrectable errors */
/* Disable Correctable errors */
/*
* Disable Secondary Uncorrectable errors if this is a bridge
*/
if (!(dev_type == PCIE_PCIECAP_DEV_TYPE_PCIE2PCI))
return;
/*
* Disable secondary bus errors
*/
}
#ifdef DEBUG
/*
* This is a temporary stop gap measure.
* PX runs at PIL 14, which is higher than the clock's PIL.
* As a results we cannot safely print while servicing interrupts using
* cmn_err or prom_printf.
*
* For debugging purposes set px_dbg_print != 0 to see printf messages
* during interrupt.
*
* When a proper solution is in place this code will disappear.
* Potential solutions are:
* o circular buffers
* o taskq to print at lower pil
*/
int pcie_dbg_print = 0;
static void
{
if (!pcie_debug_flags) {
return;
}
if (servicing_interrupt()) {
if (pcie_dbg_print) {
}
} else {
}
}
#endif /* DEBUG */