px_pci.c revision 9fc8611e0064102116cc6da9f958f9d95c2dbc1c
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Sun4 PCI Express to PCI bus bridge nexus driver
*/
#include <sys/sysmacros.h>
#include <sys/autoconf.h>
#include <sys/ddi_impldefs.h>
#include <sys/ddi_subrdefs.h>
#include <sys/pcie_impl.h>
#include <sys/pci_impl.h>
#include "pcie_pwr.h"
#include "px_pci.h"
#ifdef PX_PLX
#include "pxb_plx.h"
#endif /* PX_PLX */
#if defined(DEBUG)
static uint_t pxb_dbg_print = 0;
#else /* DEBUG */
#define DBG 0 &&
#endif /* DEBUG */
typedef enum { /* same sequence as px_debug_sym[] */
/* 0 */ DBG_ATTACH,
/* 1 */ DBG_PWR
static char *pxb_debug_sym [] = { /* same sequence as px_debug_bit */
/* 0 */ "attach",
/* 1 */ "pwr"
};
/* Tunables. Beware: Some are for debug purpose only. */
/*
* PXB MSI tunable:
*
* By default MSI is enabled on all supported platforms.
*/
void *, void *);
/*
* FMA functions
*/
#ifdef PRINT_PLX_SEEPROM_CRC
#endif
static struct bus_ops pxb_bus_ops = {
0,
0,
0,
ndi_busop_get_eventcookie, /* (*bus_get_eventcookie)(); */
ndi_busop_add_eventcall, /* (*bus_add_eventcall)(); */
ndi_busop_remove_eventcall, /* (*bus_remove_eventcall)(); */
ndi_post_event, /* (*bus_post_event)(); */
NULL, /* (*bus_intr_ctl)(); */
NULL, /* (*bus_config)(); */
NULL, /* (*bus_unconfig)(); */
pxb_fm_init_child, /* (*bus_fm_init)(); */
NULL, /* (*bus_fm_fini)(); */
i_ndi_busop_access_enter, /* (*bus_fm_access_enter)(); */
i_ndi_busop_access_exit, /* (*bus_fm_access_fini)(); */
pcie_bus_power, /* (*bus_power)(); */
pxb_intr_ops /* (*bus_intr_op)(); */
};
static struct cb_ops pxb_cb_ops = {
pxb_open, /* open */
pxb_close, /* close */
nulldev, /* strategy */
nulldev, /* print */
nulldev, /* dump */
nulldev, /* read */
nulldev, /* write */
pxb_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
pxb_prop_op, /* cb_prop_op */
NULL, /* streamtab */
CB_REV, /* rev */
nodev, /* int (*cb_aread)() */
nodev /* int (*cb_awrite)() */
};
static int pxb_probe(dev_info_t *);
/* PLX specific functions */
#ifdef PX_PLX
#endif /* PX_PLX */
/* Hotplug related functions */
DEVO_REV, /* devo_rev */
0, /* refcnt */
pxb_info, /* info */
nulldev, /* identify */
pxb_probe, /* probe */
pxb_attach, /* attach */
pxb_detach, /* detach */
nulldev, /* reset */
&pxb_cb_ops, /* driver operations */
&pxb_bus_ops, /* bus operations */
pcie_power, /* power entry */
ddi_quiesce_not_needed, /* quiesce */
};
/*
* Module linkage information for the kernel.
*/
&mod_driverops, /* Type of module */
&pxb_ops, /* driver ops */
};
static struct modlinkage modlinkage = {
(void *)&modldrv,
};
/*
* soft state pointer and structure template:
*/
void *pxb_state;
/*
* SW workaround for PLX HW bug Flag
*/
static int pxb_tlp_count = 64;
/*
* forward function declarations:
*/
static void pxb_removechild(dev_info_t *);
int
_init(void)
{
int e;
return (e);
}
int
_fini(void)
{
int e;
if ((e = mod_remove(&modlinkage)) == 0)
return (e);
}
int
{
}
/*ARGSUSED*/
static int
{
instance);
switch (infocmd) {
default:
return (DDI_FAILURE);
case DDI_INFO_DEVT2INSTANCE:
return (DDI_SUCCESS);
case DDI_INFO_DEVT2DEVINFO:
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
}
/*ARGSUSED*/
static int
{
return (DDI_PROBE_SUCCESS);
}
/*ARGSUSED*/
static int
{
int instance;
char device_type[8];
#ifdef PX_PLX
#endif /* PX_PLX */
switch (cmd) {
case DDI_RESUME:
/*
* Get the soft state structure for the bridge.
*/
(void) pcie_pwr_resume(devi);
return (DDI_SUCCESS);
case DDI_ATTACH:
/* Follow through to below the switch statement */
break;
default:
return (DDI_FAILURE);
}
/*
* Allocate and get soft state structure.
*/
return (DDI_FAILURE);
}
/* Create Mutex */
/* Setup and save the config space pointer */
goto fail;
}
/* Save the vendor id and device id */
/* create special properties for device identification */
/*
* is at D0 during attach.
*/
goto fail;
}
#ifdef PX_PLX
#else
#endif /* PX_PLX */
goto fail;
}
if (!(PCIE_IS_BDG(bus_p))) {
goto fail;
}
/*
* Make sure the "device_type" property exists.
*/
else
"device_type", device_type);
/*
* Check whether the "ranges" property is present.
* Otherwise create the ranges property by reading
* the configuration registers
*/
"ranges") == 0) {
}
/*
* Create an integer property with PCIE2PCI bridge's secondary
* PCI bus number. This property will be read and saved in all
* PCI and PCI-X device driver's parent private data structure
* as part of their init child function.
*/
if (PCIE_IS_PCI_BDG(bus_p)) {
PCI_BCNF_SECBUS)) != DDI_PROP_SUCCESS) {
"ndi_prop_update_int() failed\n");
goto fail;
}
}
/*
* Initialize hotplug support on this bus except for the PLX 8532
* revision AA. At a minimum (for non hotplug bus) this would create
* ":devctl" minor node to support DEVCTL_DEVICE_* and DEVCTL_BUS_*
* ioctls to this bus. This all takes place if this nexus has hot-plug
* slots and successfully initializes Hot Plug Framework.
*/
#ifdef PX_PLX
/*
* Due to a PLX HW bug we need to disable the receiver error CE on all
* ports. To this end we create a property "pcie_ce_mask" with value
* set to PCIE_AER_CE_RECEIVER_ERR. The pcie module will check for this
* property before setting the AER CE mask.
*/
"pcie_ce_mask", PCIE_AER_CE_RECEIVER_ERR);
/*
* There is a bug in the PLX 8114 bridge, such that an 8-bit
* write to the secondary bus number register will corrupt an
* internal shadow copy of the primary bus number. Reading
* out the registers and writing the same values back as
* 16-bits resolves the problem. This bug was reported by
* PLX as errata #19.
*/
/*
* Disable PLX Special Relaxed Ordering
*/
goto hotplug_done;
#endif /* PX_PLX */
if ((dev_type == PCIE_PCIECAP_DEV_TYPE_DOWN) ||
(dev_type == PCIE_PCIECAP_DEV_TYPE_ROOT) ||
#ifdef PX_PLX
/*
* Workaround for a race condition between hotplug
* initialization and actual MSI interrupt registration
* for hotplug functionality. The hotplug initialization
* generates an INTx interrupt for hotplug events and this
* INTx interrupt may interfere with shared leaf drivers
* using same INTx interrupt, which may eventually block
* the leaf drivers.
*/
#endif /* PX_PLX */
goto fail;
}
#ifdef PRINT_PLX_SEEPROM_CRC
/* check seeprom CRC to ensure the platform config is right */
(void) pxb_print_plx_seeprom_crc_data(pxb);
#endif
/*
* create minor node for devctl interfaces
*/
DDI_NT_NEXUS, 0) != DDI_SUCCESS)
goto fail;
}
"pxb_attach(): this nexus %s hotplug slots\n",
goto fail;
}
return (DDI_SUCCESS);
fail:
return (DDI_FAILURE);
}
/*ARGSUSED*/
static int
{
int error = DDI_SUCCESS;
switch (cmd) {
case DDI_DETACH:
/*
* And finally free the per-pci soft state after
* uninitializing hotplug support for this bus in
* opposite order of attach.
*/
pxb = (pxb_devstate_t *)
#ifdef PX_PLX
"pcie_ce_mask");
#endif /* PX_PLX */
error = DDI_FAILURE;
(void) pciehpc_uninit(devi);
(void) pcishpc_uninit(devi);
}
else
"pcie2pci-sec-bus");
return (error);
case DDI_SUSPEND:
pxb = (pxb_devstate_t *)
return (error);
}
return (DDI_FAILURE);
}
/*ARGSUSED*/
static int
{
register dev_info_t *pdip;
}
/*ARGSUSED*/
static int
{
int reglen;
int rn;
int totreg;
struct detachspec *ds;
struct attachspec *as;
switch (ctlop) {
case DDI_CTLOPS_REPORTDEV:
if (rdip == (dev_info_t *)0)
return (DDI_FAILURE);
return (DDI_SUCCESS);
case DDI_CTLOPS_INITCHILD:
case DDI_CTLOPS_UNINITCHILD:
return (DDI_SUCCESS);
case DDI_CTLOPS_SIDDEV:
return (DDI_SUCCESS);
case DDI_CTLOPS_REGSIZE:
case DDI_CTLOPS_NREGS:
if (rdip == (dev_info_t *)0)
return (DDI_FAILURE);
break;
case DDI_CTLOPS_ATTACH:
return (DDI_SUCCESS);
case DDI_PRE:
return (pcie_pm_hold(dip));
}
}
return (DDI_SUCCESS);
case DDI_POST: {
/*
* For empty hotplug-capable slots, we should explicitly
* disable the errors, so that we won't panic upon
* unsupported hotplug messages.
*/
DDI_PROP_DONTPASS, "hotplug-capable")) ||
ddi_get_child(rdip)) {
(void) pcie_postattach_child(rdip);
return (DDI_SUCCESS);
}
return (DDI_SUCCESS);
}
default:
break;
}
break;
case DDI_CTLOPS_DETACH:
return (DDI_SUCCESS);
case DDI_PRE:
return (DDI_SUCCESS);
case DDI_POST:
}
return (DDI_SUCCESS);
default:
break;
}
break;
default:
}
*(int *)result = 0;
return (DDI_FAILURE);
if (ctlop == DDI_CTLOPS_NREGS)
else if (ctlop == DDI_CTLOPS_REGSIZE) {
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
static int
{
if ((intr_op == DDI_INTROP_SUPPORTED_TYPES) ||
goto done;
/*
* If the interrupt-map property is defined at this
* node, it will have performed the interrupt
* translation as part of the property, so no
* rotation needs to be done.
*/
goto done;
/*
* Use the devices reg property to determine its
* PCI bus number and device number.
*/
return (DDI_FAILURE);
/* spin the interrupt */
else
done:
/* Pass up the request to our parent. */
}
/*
* name_child
*
* This function is called from init_child to name a node. It is
* also passed as a callback for node merging functions.
*
* return value: DDI_SUCCESS, DDI_FAILURE
*/
static int
{
char **unit_addr;
uint_t n;
/*
* Pseudo nodes indicate a prototype node with per-instance
* properties to be merged into the real h/w device node.
* The interpretation of the unit-address is DD[,F]
* where DD is the device id and F is the function.
*/
if (ndi_dev_is_persistent_node(child) == 0) {
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* Get the address portion of the node name based on
* the function and device number.
*/
return (DDI_FAILURE);
}
if (func != 0)
else
return (DDI_SUCCESS);
}
static int
{
char name[MAXNAMELEN];
int result = DDI_FAILURE;
#ifdef PX_PLX
int i;
#endif /* PX_PLX */
/*
* Name the child
*/
goto done;
}
/*
* XXX set ppd to 1 to disable iommu BDF protection
* It relies on unused parent private data for PCI devices.
*/
"dvma-share"))
ppd = 1;
/*
* Pseudo nodes indicate a prototype node with per-instance
* properties to be merged into the real h/w device node.
* The interpretation of the unit-address is DD[,F]
* where DD is the device id and F is the function.
*/
if (ndi_dev_is_persistent_node(child) == 0) {
extern int pci_allow_pseudo_children;
/*
* Try to merge the properties from this prototype
* node into real h/w nodes.
*/
/*
* Merged ok - return failure to remove the node.
*/
goto done;
}
/* workaround for ddivs to run under PCI */
if (pci_allow_pseudo_children) {
goto done;
}
/*
* The child was not merged into a h/w node,
* but there's not much we can do with it other
* than return failure to cause the node to be removed.
*/
goto done;
}
"INITCHILD: px_pm_hold failed\n");
goto done;
}
/* Any return from here must call pcie_pm_release */
/*
* If configuration registers were previously saved by
* child (before it entered D3), then let the child do the
* restore to set up the config regs as it'll first need to
* power the device out of D3.
*/
"config-regs-saved-by-child") == 1) {
"INITCHILD: config regs to be restored by child"
goto cleanup;
}
"INITCHILD: config regs setup for %s@%s\n",
goto cleanup;
}
#ifdef PX_PLX
/*
* Due to a PLX HW bug, a SW workaround to prevent the chip from
* wedging is needed. SW just needs to tranfer 64 TLPs from
* the downstream port to the child device.
* The most benign way of doing this is to read the ID register
* 64 times. This SW workaround should have minimum performance
* impact and shouldn't cause a problem for all other bridges
* and switches.
*
* The code needs to be written in a way to make sure it isn't
* optimized out.
*/
if (!pxb_tlp_count) {
goto cleanup;
}
goto cleanup;
}
for (i = 0; i < pxb_tlp_count; i += 1)
#endif /* PX_PLX */
done:
return (result);
}
static int
{
int intr_types;
/*
* Initialize interrupt handlers.
* If both MSI and FIXED are supported, try to attach MSI first.
* If MSI fails for any reason, then try FIXED, but only allow one
* type to be attached.
*/
return (DDI_FAILURE);
}
else
}
if (intr_types & DDI_INTR_TYPE_FIXED) {
"Unable to attach INTx handler\n");
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
/*
* This function initializes internally generated interrupts only.
* It does not affect any interrupts generated by downstream devices
* or the forwarding of them.
*
* Enable Device Specific Interrupts or Hotplug features here.
* Enabling features may change how many interrupts are requested
* by the device. If features are not enabled first, the
* device might not ask for any interrupts.
*/
static int
{
int ret;
int intr_cap = 0;
"Attaching %s handler\n",
/*
* Get number of requested interrupts. If none requested or DDI_FAILURE
* just return DDI_SUCCESS.
*
* in a FAILURE, if the device is not configured in a way that
* interrupts are needed. (eg. hotplugging)
*/
return (DDI_SUCCESS);
}
/* Find out how many MSI's are available. */
if (intr_type == DDI_INTR_TYPE_MSI) {
"ddi_intr_get_navail() ret: %d available: %d\n",
goto fail;
}
"Requested Intr: %d Available: %d\n",
}
}
/* Allocate an array of interrupt handlers */
"ddi_intr_alloc() ret: %d ask: %d actual: %d\n",
goto fail;
}
/* Save the actually number of interrupts allocated */
"Requested Intr: %d Received: %d\n",
}
/* Get interrupt priority */
if (ret != DDI_SUCCESS) {
goto fail;
}
if (ret != DDI_SUCCESS) {
ret);
goto fail;
}
}
if (ret != DDI_SUCCESS) {
"ddi_intr_add_handler() ret: %d\n",
ret);
break;
}
}
/* If unsucessful remove the added handlers */
if (ret != DDI_SUCCESS) {
for (x = 0; x < count; x++) {
}
goto fail;
}
if (intr_cap & DDI_INTR_FLAG_BLOCK) {
} else {
}
}
/* Save the interrupt type */
return (DDI_SUCCESS);
fail:
return (DDI_FAILURE);
}
static void
{
int x;
}
for (x = 0; x < count; x++) {
if (flags & PXB_INIT_ENABLE)
if (flags & PXB_INIT_HANDLER)
if (flags & PXB_INIT_ALLOC)
}
if (flags & PXB_INIT_HTABLE)
flags &= ~PXB_INIT_HTABLE;
}
/*
* This only handles internal errors, not bus errors.
* Currently the only known interrupt would be from hotplugging.
*/
/*ARGSUSED*/
static uint_t
{
int rval = DDI_INTR_UNCLAIMED;
else
}
if ((rval == DDI_INTR_UNCLAIMED) &&
return (rval);
}
static void
{
/*
* Strip the node to properly convert it back to prototype form
*/
/*
* XXX Clear parent private data used as a flag to disable
* iommu BDF protection
*/
}
/*
* Initialize hotplug framework if we are hotpluggable.
* Sets flag in the soft state if Hot Plug is supported and initialized
* properly.
*/
/*ARGSUSED*/
static int
{
int rv = DDI_FAILURE;
if (((dev_type == PCIE_PCIECAP_DEV_TYPE_DOWN) ||
(dev_type == PCIE_PCIECAP_DEV_TYPE_ROOT)) &&
} else if ((dev_type == PCIE_PCIECAP_DEV_TYPE_PCIE2PCI) &&
} else {
return (DDI_SUCCESS);
}
goto fail;
if (rv != DDI_SUCCESS)
goto fail;
goto fail;
}
"hotplug-capable");
return (DDI_SUCCESS);
fail:
return (DDI_FAILURE);
}
static void
{
int i = 0, rangelen = sizeof (pxb_ranges_t)/sizeof (int);
/*
* Create ranges for IO space
*/
(PCI_REG_REL_M | PCI_ADDR_IO);
}
}
}
/*
* Create ranges for 32bit memory space
*/
i++;
}
if (i) {
}
}
/*ARGSUSED*/
static int
{
/*
* Make sure the open is for the right file type.
*/
return (EINVAL);
/*
* Get the soft state structure for the device.
*/
instance);
return (ENXIO);
/*
* Handle the open by tracking the device state.
*/
return (EBUSY);
}
} else {
return (EBUSY);
}
}
return (0);
}
/*ARGSUSED*/
static int
{
return (EINVAL);
instance);
return (ENXIO);
return (0);
}
/*
* pxb_ioctl: devctl hotplug controls
*/
/*ARGSUSED*/
static int
int *rvalp)
{
struct devctl_iocdata *dcp;
int rv = 0;
instance);
return (ENXIO);
/*
* We can use the generic implementation for these ioctls
*/
switch (cmd) {
case DEVCTL_DEVICE_GETSTATE:
case DEVCTL_DEVICE_ONLINE:
case DEVCTL_DEVICE_OFFLINE:
case DEVCTL_BUS_GETSTATE:
}
/*
* read devctl ioctl data
*/
return (EFAULT);
switch (cmd) {
case DEVCTL_DEVICE_RESET:
break;
case DEVCTL_BUS_QUIESCE:
if (bus_state == BUS_QUIESCED)
break;
break;
case DEVCTL_BUS_UNQUIESCE:
if (bus_state == BUS_ACTIVE)
break;
break;
case DEVCTL_BUS_RESET:
break;
case DEVCTL_BUS_RESETALL:
break;
default:
}
return (rv);
}
{
instance);
return (ENXIO);
}
#ifdef PX_PLX
/*
* Disable PM for PLX 8532 switch. Transitioning one port on
* this switch to low power causes links on other ports on the
* same station to die.
* Due to PLX erratum #34, we can't allow the downstream device
* go to non-D0 state.
*/
static int
{
"disabling PM\n");
return (DDI_SUCCESS);
}
#endif /* PX_PLX */
/*
* Power management related initialization specific to px_pci.
* Called by pxb_attach()
*/
static int
{
char *comp_array[5];
int i;
/* Code taken from pci_pci driver */
return (DDI_FAILURE);
}
/*
* Walk the capabilities searching for a PM entry.
*/
DDI_FAILURE) {
" PM data structure not found in config header\n");
return (DDI_SUCCESS);
}
/*
* Save offset to pmcsr for future references.
*/
if (pmcap & PCI_PMCAP_D1) {
}
if (pmcap & PCI_PMCAP_D2) {
}
i = 0;
comp_array[i++] = "NAME=PCIe switch/bridge PM";
comp_array[i++] = "0=Power Off (D3)";
comp_array[i++] = "1=D2";
comp_array[i++] = "2=D1";
comp_array[i++] = "3=Full Power D0";
/*
* Create pm-components property, if it does not exist already.
*/
return (DDI_FAILURE);
}
}
/*
* Initializes the power level and raise the power to D0, if it is
* not at D0.
*/
static int
{
int ret = DDI_SUCCESS;
/*
* Intialize our power level from PMCSR. The common code initializes
* this to UNKNOWN. There is no guarantee that we will be at full
* power at attach. If we are not at D0, raise the power.
*/
switch (pmcsr) {
case PCI_PMCSR_D0:
break;
case PCI_PMCSR_D1:
break;
case PCI_PMCSR_D2:
break;
case PCI_PMCSR_D3HOT:
break;
default:
break;
}
/* Raise the power to D0. */
/*
* Read PMCSR again. If it is at D0, ignore the return
* value from pm_raise_power.
*/
ret = DDI_SUCCESS;
else {
"power to D0 \n");
}
}
if (ret == DDI_SUCCESS)
return (ret);
}
static int
{
int fm_cap = DDI_FM_EREPORT_CAPABLE |
/*
* Request our capability level and get our parents capability
* and ibc.
*/
return (DDI_SUCCESS);
}
/*
* Breakdown our FMA resources
*/
static void
{
/*
* Clean up allocated fm structures
*/
}
/*
* Function used to initialize FMA for our children nodes. Called
* through pci busops when child node calls ddi_fm_init.
*/
/*ARGSUSED*/
int
{
}
/*
* undo whatever is done in pxb_pwr_setup. called by pxb_detach()
*/
static void
{
return;
if (pwr_p->pwr_conf_hdl)
}
/*ARGSUSED*/
{
DDI_FAILURE) {
if (slotimpl)
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}
/*ARGSUSED*/
{
DDI_FAILURE) {
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}
/*
* For PCI and PCI-X devices including PCIe2PCI bridge, initialize
* cache-line-size and latency timer configuration registers.
*/
static void
{
uint_t n;
/* Initialize cache-line-size configuration register if needed */
"cache-line-size", 0) == 0) {
if (n != 0) {
"cache-line-size", n);
}
}
/* Initialize latency timer configuration registers if needed */
"latency-timer", 0) == 0) {
/* Determine the configuration header type */
} else {
}
if (n != 0) {
"latency-timer", n);
}
}
}
#ifdef PRINT_PLX_SEEPROM_CRC
static void
{
int nregs;
};
return;
return;
return;
return;
&mattr, &h) != DDI_SUCCESS)
return;
printf("%s#%d: EEPROM StatusReg = %x, CRC = %x\n",
#ifdef PLX_HOT_RESET_DISABLE
/* prevent hot reset from propogating downstream. */
printf("%s#%d: EEPROM 0x1DC prewrite=%x postwrite=%x\n",
#endif
ddi_regs_map_free(&h);
}
#endif
static void
{
/*
* Identify first in chassis. In the special case of a Sun branded
* PLX device, it obviously is first in chassis. Otherwise, in the
* general case, look for an Expansion Slot Register and check its
* first-in-chassis bit.
*/
#ifdef PX_PLX
fic = 1;
}
#endif /* PX_PLX */
if (PCI_CAPSLOT_FIC(esr))
fic = 1;
}
/* Serialid can be 0 thru a full 40b number */
serialid <<= 32;
}
if (fic)
"first-in-chassis");
if (serialid)
"serialid#", serialid);
}
/*
* Some PCI-X to PCI-E bridges do not support full 64-bit addressing on the
* PCI-X side of the bridge. We build a special version of this driver for
* to define the range of values which the chip can handle. The code below
* then clamps the DMA address range supplied by the driver, preventing the
* PCI-E nexus driver from allocating any memory the bridge can't deal
* with.
*/
static int
{
int ret;
#ifdef BCM_SW_WORKAROUNDS
/*
* If the leaf device's limits are outside than what the Broadcom
* bridge can handle, we need to clip the values passed up the chain.
*/
#endif /* BCM_SW_WORKAROUNDS */
/*
* This is a software workaround to fix the Broadcom 5714/5715 PCIe-PCI
* bridge prefetch bug. Intercept the DMA alloc handle request and set
* PX_DMAI_FLAGS_MAP_BUFZONE flag in the handle. If this flag is set,
* the px nexus driver will allocate an extra page & make it valid one,
* for any DVMA request that comes from any of the Broadcom bridge child
* devices.
*/
handlep)) == DDI_SUCCESS) {
#ifdef BCM_SW_WORKAROUNDS
#endif /* BCM_SW_WORKAROUNDS */
/*
* For a given rdip, update mp->dmai_bdf with the bdf value
* of px_pci's immediate child or secondary bus-id of the
* PCIe2PCI bridge.
*/
}
return (ret);
}
/*
* FDVMA feature is not supported for any child device of Broadcom 5714/5715
* PCIe-PCI bridge due to prefetch bug. Return failure immediately, so that
* these drivers will switch to regular DVMA path.
*/
/*ARGSUSED*/
static int
{
int ret;
#ifdef BCM_SW_WORKAROUNDS
if (cmd == DDI_DMA_RESERVE)
return (DDI_FAILURE);
#endif /* BCM_SW_WORKAROUNDS */
/*
* For a given rdip, update mp->dmai_bdf with the bdf value
* of px_pci's immediate child or secondary bus-id of the
* PCIe2PCI bridge.
*/
}
return (ret);
}
#ifdef DEBUG
static void
{
if (!(bit & pxb_dbg_print))
return;
if (dip)
body:
if (ap)
else
}
#endif
#ifdef PX_PLX
/*
* Disable PLX specific relaxed ordering mode. Due to PLX
* erratum #6, use of this mode with Cut-Through Cancellation
* can result in dropped Completion type packets.
*/
static void
{
switch (pxb->pxb_device_id) {
case PXB_DEVICE_PLX_8533:
case PXB_DEVICE_PLX_8548:
/*
* Clear the Relaxed Ordering Mode bit of the Egress
* Performance Counter register on 8533 and 8548 switches.
*/
if (val & PLX_RO_MODE_BIT) {
val ^= PLX_RO_MODE_BIT;
}
break;
}
}
#endif /* PX_PLX */