/*
* 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 2014 QLogic Corporation
* The contents of this file are subject to the terms of the
* QLogic End User License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
*/
#include "bnxe.h"
#ifndef STRINGIFY
#define XSTRINGIFY(x) #x
#endif
#define BNXE_PRODUCT_BANNER "QLogic NetXtreme II 10 Gigabit Ethernet Driver v" STRINGIFY(MAJVERSION) "." STRINGIFY(MINVERSION) "." STRINGIFY(REVVERSION)
#define BNXE_PRODUCT_INFO "QLogic NXII 10 GbE v" STRINGIFY(MAJVERSION) "." STRINGIFY(MINVERSION) "." STRINGIFY(REVVERSION)
#define BNXE_REGS_MAP_OFFSET 0
extern ddi_dma_attr_t bnxeDmaPageAttrib;
extern ddi_dma_attr_t bnxeRxDmaAttrib;
extern ddi_dma_attr_t bnxeTxDmaAttrib;
extern ddi_dma_attr_t bnxeTxCbDmaAttrib;
{
}
/* pass in pointer to either lm_device_t or um_device_t */
{
}
{
{
case 0x164e: return "BCM57710";
case 0x164f: return "BCM57711";
case 0x1650: return "BCM57711E";
case 0x1662: return "BCM57712";
case 0x1663: return "BCM57712NP";
case 0x16a1: return "BCM57840";
case 0x168d: return "BCM57840";
case 0x16a4: return "BCM57840NP";
case 0x16ab: return "BCM57840NP";
case 0x168e: return "BCM57810";
case 0x16ae: return "BCM57810NP";
case 0x168a: return "BCM57800";
case 0x16a5: return "BCM57800NP";
default: return "UNKNOWN";
}
}
{
{
{
{
}
{
}
}
else
{
/* mcp is not present so allow enumeration */
}
}
else /* SF */
{
/* check per port storage personality config from NVRAM */
switch (port_feature_config_sf)
{
break;
default:
break;
}
}
{
}
}
{
}
{
/* setup resources needed for accessing the PCI configuration space */
{
return B_FALSE;
}
return B_TRUE;
}
{
{
}
}
{
/* free the BAR mappings */
{
pMemRegion->size);
}
}
{
int idx;
{
}
{
}
{
}
{
}
}
{
int idx;
{
}
{
}
{
}
}
/* FMA support */
{
return (de.fme_status);
}
{
return (de.fme_status);
}
/* The IO fault service error handling callback function */
const void * impl_data)
{
/*
* As the driver can always deal with an error in any dma or
* access handle, we can just return the fme_status value.
*/
return (err->fme_status);
}
{
int fma_acc_flag;
int fma_dma_flag;
/* Only register with IO Fault Services if we have some capability */
{
}
{
}
if (pUM->fmCapabilities)
{
/* Register capabilities with IO Fault Services */
/* Initialize pci ereport capabilities if ereport capable */
{
}
/* Register error callback if error callback capable */
{
}
}
}
{
/* Only unregister FMA capabilities if we registered some */
if (pUM->fmCapabilities)
{
/* Release any resources allocated by pci_ereport_setup() */
{
}
/* Un-register error callback if error callback capable */
{
}
/* Unregister from IO Fault Services */
}
}
char * detail)
{
{
}
}
{
int rc;
/* fm-capable in bnxe.conf can be used to set fmCapabilities. */
"fm-capable",
/* Register capabilities with IO Fault Services. */
if (!BnxePciInit(pUM))
{
return B_FALSE;
}
if (!BnxeWorkQueueInit(pUM))
{
return B_FALSE;
}
if (pUM->fmCapabilities &&
{
return B_FALSE;
}
if (pUM->fmCapabilities &&
{
return B_FALSE;
}
if (rc != LM_STATUS_SUCCESS)
{
return B_FALSE;
}
#if 0
{
}
#endif
/* check if FCoE is enabled on this function */
#if 0
#else
#endif
{
}
if (!BnxeIntrInit(pUM))
{
return B_FALSE;
}
if (!BnxeKstatInit(pUM))
{
return B_FALSE;
}
if (BnxeProtoFcoeAfex(pUM))
{
/* No support for L2 on FCoE enabled AFEX function! */
#if 0
/*
* The following is wonky. Doing a CLONE_DEV makes it visible to
* various L2 networking commands even though the instance was
* not registered with GLDv3 via mac_register().
*/
/* Create a style-2 DLPI device */
0,
DDI_PSEUDO, //DDI_NT_NET,
CLONE_DEV) != DDI_SUCCESS)
{
return B_FALSE;
}
/* Create a style-1 DLPI device */
DDI_PSEUDO, //DDI_NT_NET,
0) != DDI_SUCCESS)
{
return B_FALSE;
}
#endif
}
else
{
/* register with the GLDv3 MAC layer */
if (!BnxeGldInit(pUM))
{
return B_FALSE;
}
}
"%d.%d.%d",
"%d.%d.%d",
"%d.%d.%d.%d",
"%d.%d.%d",
"%s",
BnxeChipName(pUM));
"0x%x",
*pUM->bus_dev_func = 0;
{
sizeof(pUM->bus_dev_func),
"%04x:%02x:%02x",
PCI_REG_BUS_G(props[0]),
PCI_REG_DEV_G(props[0]),
PCI_REG_FUNC_G(props[0]));
}
vendor_id = 0;
{
}
device_id = 0;
{
}
sizeof(pUM->vendor_device),
"%04x:%04x",
"%d %s",
"Fixed");
"(0x%p) %s %s - v%s - FW v%s - BC v%s - %s (%s)",
pUM,
return B_TRUE;
}
{
int rc;
{
return B_FALSE;
}
if (BnxeProtoFcoeAfex(pUM))
{
/* No support for L2 on FCoE enabled AFEX function! */
;
#if 0
#endif
}
else
{
if (!BnxeGldFini(pUM))
{
return B_FALSE;
}
}
return B_TRUE;
}
{
switch (cmd)
{
case DDI_ATTACH:
{
return DDI_FAILURE;
}
/* set magic number for identification */
/* default for debug logging is dump everything */
/* save dev_info_t in the driver structure */
#ifdef BNXE_DEBUG_DMA_LIST
#endif
/* obtain a human-readable device name log messages with */
if (!BnxeAttachDevice(pUM))
{
return DDI_FAILURE;
}
{
}
return DDI_SUCCESS;
case DDI_RESUME:
case DDI_PM_RESUME:
#endif
/* sanity check */
{
return DDI_FAILURE;
}
if (BnxeHwResume(pUM) != 0)
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
default:
return DDI_FAILURE;
}
}
{
switch (cmd)
{
case DDI_DETACH:
/* sanity check */
{
return DDI_FAILURE;
}
{
return DDI_FAILURE;
}
if (!BnxeDetachDevice(pUM))
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
case DDI_SUSPEND:
case DDI_PM_SUSPEND:
#endif
/* sanity check */
{
return DDI_FAILURE;
}
if (BnxeHwSuspend(pUM) != 0)
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
default:
return DDI_FAILURE;
}
}
#if (DEVO_REV > 3)
{
/* sanity check */
{
return DDI_FAILURE;
}
{
return DDI_SUCCESS;
}
if (BnxeHwQuiesce(pUM) != 0)
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
}
#endif
dev_info_t * cDip)
{
{
return;
}
}
dev_info_t * cDip)
{
}
dev_info_t * pRDev,
void * pArg,
void * pResult)
{
/* sanity check */
{
return DDI_FAILURE;
}
switch (op)
{
case DDI_CTLOPS_REPORTDEV:
case DDI_CTLOPS_IOMIN:
break;
case DDI_CTLOPS_INITCHILD:
break;
case DDI_CTLOPS_UNINITCHILD:
break;
default:
}
return DDI_SUCCESS;
}
int cmd,
int mode,
int * rvalp)
{
(void)dev;
(void)mode;
(void)credp;
(void)rvalp;
{
return DDI_FAILURE;
}
/* sanity checks */
{
return DDI_FAILURE;
}
{
return DDI_FAILURE;
}
switch (cmd)
{
case BNXE_BIND_FCOE:
/* copy the binding struct and fill in the provider callback */
{
return DDI_FAILURE;
}
{
return DDI_FAILURE;
}
if (BnxeHwStartFCOE(pUM))
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
case BNXE_UNBIND_FCOE:
/* clear the binding struct and stats */
{
return DDI_FAILURE;
}
{
return DDI_FAILURE;
}
/* We must not detach until all packets held by fcoe are retrieved. */
{
return DDI_FAILURE;
}
return DDI_SUCCESS;
default:
return DDI_FAILURE;
}
}
#ifndef ILLUMOS
{
nullbusmap, /* bus_map */
NULL, /* bus_get_intrspec */
NULL, /* bus_add_intrspec */
NULL, /* bus_remove_intrspec */
i_ddi_map_fault, /* bus_map_fault */
ddi_dma_map, /* bus_dma_map */
ddi_dma_allochdl, /* bus_dma_allochdl */
ddi_dma_freehdl, /* bus_dma_freehdl */
ddi_dma_bindhdl, /* bus_dma_bindhdl */
ddi_dma_unbindhdl, /* bus_unbindhdl */
ddi_dma_flush, /* bus_dma_flush */
ddi_dma_win, /* bus_dma_win */
ddi_dma_mctl, /* bus_dma_ctl */
BnxeBusCtl, /* bus_ctl */
ddi_bus_prop_op, /* bus_prop_op */
NULL, /* bus_get_eventcookie */
NULL, /* bus_add_eventcall */
NULL, /* bus_remove_event */
NULL, /* bus_post_event */
NULL, /* bus_intr_ctl */
NULL, /* bus_config */
NULL, /* bus_unconfig */
NULL, /* bus_fm_init */
NULL, /* bus_fm_fini */
NULL, /* bus_fm_access_enter */
NULL, /* bus_fm_access_exit */
NULL, /* bus_power */
};
#endif /* ILLUMOS */
{
nulldev, /* cb_open */
nulldev, /* cb_close */
nodev, /* cb_strategy */
nodev, /* cb_print */
nodev, /* cb_dump */
nodev, /* cb_read */
nodev, /* cb_write */
BnxeCbIoctl, /* cb_ioctl */
nodev, /* cb_devmap */
nodev, /* cb_mmap */
nodev, /* cb_segmap */
nochpoll, /* cb_chpoll */
ddi_prop_op, /* cb_prop_op */
NULL, /* cb_stream */
CB_REV, /* cb_rev */
nodev, /* cb_aread */
nodev, /* cb_awrite */
};
#if (DEVO_REV > 3)
{
DEVO_REV, /* devo_rev */
0, /* devo_refcnt */
NULL, /* devo_getinfo */
nulldev, /* devo_identify */
nulldev, /* devo_probe */
BnxeAttach, /* devo_attach */
BnxeDetach, /* devo_detach */
nodev, /* devo_reset */
&bnxe_cb_ops, /* devo_cb_ops */
#ifndef ILLUMOS
&bnxe_bus_ops, /* devo_bus_ops */
#else
NULL, /* devo_bus_ops */
#endif
NULL, /* devo_power */
BnxeQuiesce /* devo_quiesce */
};
#else
{
DEVO_REV, /* devo_rev */
0, /* devo_refcnt */
NULL, /* devo_getinfo */
nulldev, /* devo_identify */
nulldev, /* devo_probe */
BnxeAttach, /* devo_attach */
BnxeDetach, /* devo_detach */
nodev, /* devo_reset */
&bnxe_cb_ops, /* devo_cb_ops */
&bnxe_bus_ops, /* devo_bus_ops */
NULL /* devo_power */
};
#endif
{
&mod_driverops, /* drv_modops (must be mod_driverops for drivers) */
BNXE_PRODUCT_INFO, /* drv_linkinfo (string displayed by modinfo) */
&bnxe_dev_ops /* drv_dev_ops */
};
{
MODREV_1, /* ml_rev */
{
&bnxe_modldrv, /* ml_linkage */
NULL /* NULL termination */
}
};
int _init(void)
{
int rc;
/* Install module information with O/S */
{
return rc;
}
bnxeNumPlumbed = 0;
return rc;
}
int _fini(void)
{
int rc;
{
if (bnxeNumPlumbed > 0)
{
/*
* This shouldn't be possible since modunload must only call _fini
* when no instances are currently plumbed.
*/
}
}
return rc;
}
{
}