/*
* 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
*/
/*
*/
/*
* Hermon Configuration Profile Routines
*
* Implements the routines necessary for initializing and (later) tearing
* down the list of Hermon configuration information.
*/
#include <sys/sysmacros.h>
/*
* Below are the elements that make up the Hermon configuration profile.
* For advanced users who wish to alter these values, this can be done via
* supported resources, either from the HCA's reported capacities or by
* a by-design limit in the driver.
*/
/* Number of supported QPs, CQs and SRQs */
/* XXX use the same for all queues if limitation in srq.h is resolved */
/* Maximum "responder resources" (in) and "initiator depth" (out) per QP */
/*
* Number of multicast groups (MCGs), number of QP per MCG, and the number
* of entries (from the total number) in the multicast group "hash table"
*/
/* Number of UD AVs */
/* Number of EQs and their default size */
/*
* Number of supported MPTs, MTTs and also the maximum MPT size.
*/
/*
* Number of supported UAR (User Access Regions) for this HCA.
* We could in the future read in uar_sz from devlim, and thus
* derive the number of UAR. Since this is derived from PAGESIZE,
* however, this means that x86 systems would have twice as many
* UARs as SPARC systems. Therefore for consistency's sake, we will
* just use 1024 pages, which is the maximum on SPARC systems.
*/
/*
* Number of remaps allowed for FMR before a sync is required. This value
* determines how many times we can fmr_deregister() before the underlying fmr
* framework places the region to wait for an MTT_SYNC operation, cleaning up
* the old mappings.
*/
/*
* Number of supported Hermon mailboxes ("In" and "Out") and their maximum
* sizes, respectively
*/
/* Number of supported Protection Domains (PD) */
/*
* Number of total supported PKeys per PKey table (i.e.
* per port). Also the number of SGID per GID table.
*/
/* Maximum supported MTU and portwidth */
/* Number of supported Virtual Lanes (VL) */
/*
* Whether or not to use the built-in (i.e. in firmware) agents for QP0 and
* QP1, respectively.
*/
/*
* Whether DMA mappings should bypass the PCI IOMMU or not.
* hermon_iommu_bypass is a global setting for all memory addresses.
*/
/*
* Whether *DATA* buffers should be bound w/ Relaxed Ordering (RO) turned on
* via the SW workaround (HCAs don't support RO in HW). Defaulted on,
* though care must be taken w/ some Userland clients that *MAY* have
* peeked in the data to understand when data xfer was done - MPI does
* as an efficiency
*/
/*
* Whether Hermon should use MSI (Message Signaled Interrupts), if available.
* Note: 0 indicates 'legacy interrupt', 1 indicates MSI (if available)
*/
/*
* This is a patchable variable that determines the time we will wait after
* initiating SW reset before we do our first read from Hermon config space.
* If this value is set too small (less than the default 100ms), it is
* possible for Hermon hardware to be unready to respond to the config cycle
* reads. This could cause master abort on the PCI bridge. Note: If
* "hermon_sw_reset_delay" is set to zero, then no software reset of the Hermon
* device will be attempted.
*/
/*
* These are patchable variables for hermon command polling. The poll_delay is
* the number of usec to wait in-between calls to poll the 'go' bit. The
* poll_max is the total number of usec to loop in waiting for the 'go' bit to
* clear.
*/
/*
* This is a patchable variable that determines the frequency with which
* the AckReq bit will be set in outgoing RC packets. The AckReq bit will be
* set in at least every 2^hermon_qp_ackreq_freq packets (but at least once
* per message, i.e. in the last packet). Tuning this value can increase
* IB fabric utilization by cutting down on the number of unnecessary ACKs.
*/
#ifdef __sparc
#endif
/*
* hermon_cfg_profile_init_phase1()
* Context: Only called from attach() path context
*/
int
{
/*
* Allocate space for the configuration profile structure
*/
KM_SLEEP);
/*
* Common to all profiles.
*/
/*
* Although most of the configuration is enabled in "phase2" of the
* cfg_profile_init, we have to setup the OUT mailboxes soon, since
* they are used immediately after this "phase1" completes, to run the
* firmware and get the device limits, which we'll need for 'phase2'.
* That's done in rsrc_init_phase1, called shortly after we do this
* and the sw reset - see hermon.c
*/
} else {
return (DDI_FAILURE);
}
/*
* Set IOMMU bypass or not. Ensure consistency of flags with
* architecture type.
*/
#ifdef __sparc
if (hermon_iommu_bypass == 1) {
} else {
}
#else
#endif
/* Attach the configuration profile to Hermon softstate */
return (DDI_SUCCESS);
}
/*
* hermon_cfg_profile_init_phase2()
* Context: Only called from attach() path context
*/
int
{
int i;
/* Read in the device limits */
/* and the port information */
/* Read the configuration profile */
/*
* We configure all Hermon HCAs with the same profile, which
* is based upon the default value assignments above. If we want to
* add additional profiles in the future, they can be added here.
*/
return (DDI_FAILURE);
}
/*
* Note for most configuration parameters, we use the lesser of our
* desired configuration value or the device-defined maximum value.
*/
/* per PRM */
/* until srq_resize is debugged, disable it */
cp->cp_srq_resize_enabled = 0;
/* cp->cp_log_num_uar = hermon_log_num_uar; */
/*
* now, we HAVE to calculate the number of UAR pages, so that we can
* get the blueflame stuff correct as well
*/
/* 1MB (2^^20) times size (2^^size) / sparc_pg (2^^13) */
/* while we're at it, calculate the index of the kernel uar page */
/* either the reserved uar's or 128, whichever is smaller */
/* Paranoia, ensure no arrays indexed by port_num are out of bounds */
"supported; Using %d ports\n",
};
/* allocate variable sized arrays */
for (i = 0; i < HERMON_MAX_PORTS; i++) {
}
/* Determine WQE sizes from requested max SGLs */
/* Set whether to use MSIs or not */
#if !defined(_ELF64)
/*
* Need to reduce the hermon kernel virtual memory footprint
* on 32-bit kernels.
*/
#endif
return (DDI_SUCCESS);
}
/*
* hermon_cfg_profile_fini()
*/
void
{
/*
* Free up the space for configuration profile
*/
}
/*
* hermon_cfg_wqe_sizes()
* Context: Only called from attach() path context
*/
static void
{
/*
* Get the requested maximum number SGL per WQE from the Hermon
* patchable variable
*/
/*
* Use requested maximum number of SGL to calculate the max descriptor
* size (while guaranteeing that the descriptor size is a power-of-2
* cachelines). We have to use the calculation for QP1 MLX transport
* because the possibility that we might need to inline a GRH, along
* with all the other headers and alignment restrictions, sets the
* maximum for the number of SGLs that we can advertise support for.
*/
}
/*
* Then use the calculated max descriptor size to determine the "real"
* maximum SGL (the number beyond which we would roll over to the next
* power-of-2).
*/
/* Then save away this configuration information */
/* SRQ SGL gets set to it's own patchable variable value */
}
#ifdef __sparc
/*
* hermon_check_iommu_bypass()
* Context: Only called from attach() path context
* XXX This is a DMA allocation routine outside the normal
* path. FMA hardening will not like this.
*/
static void
{
int status;
/* Try mapping for IOMMU bypass (Force Physical) */
/*
* Call ddi_dma_alloc_handle(). If this returns DDI_DMA_BADATTR then
* it is not possible to use IOMMU bypass with our PCI bridge parent.
* Since the function we are in can only be called if iommu bypass was
* requested in the config profile, we configure for bypass if the
* ddi_dma_alloc_handle() was successful. Otherwise, we configure
* for non-bypass (ie: normal) mapping.
*/
if (status == DDI_DMA_BADATTR) {
return;
return;
} else {
}
return;
}
if (status == DDI_DMA_MAPPED) {
(void) ddi_dma_unbind_handle(dmahdl);
} else {
}
}
#endif