bnxe_mm.c revision d14abf155341d55053c76eeec58b787a456b753b
/*
* 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"
#define BNXE_DEF_TX_BD_PAGE_CNT 12
#define BNXE_DEF_TX_COAL_BUF_CNT 10
typedef struct
{
int bufCnt;
int txBdPageCnt;
int txCoalBufCnt;
static BnxeHwPageConfig bnxeHwPageConfigs[] =
{
/* Buffers TX BD Pages TX Coalesce Bufs */
{ 1000, 4, 10 },
{ 1500, 6, 10 },
{ 3000, 12, 10 },
{ 0, 0, 0 }
};
#if 0
#define MEM_LOG BnxeLogInfo
#else
#define MEM_LOG
#endif
{
DDI_DEVICE_ATTR_V0, /* devacc_attr_version */
DDI_STRUCTURE_LE_ACC, /* devacc_attr_endian_flags */
DDI_STRICTORDER_ACC, /* devacc_attr_dataorder */
DDI_DEFAULT_ACC /* devacc_attr_access */
};
{
DDI_DEVICE_ATTR_V0, /* devacc_attr_version */
DDI_NEVERSWAP_ACC, /* devacc_attr_endian_flags */
DDI_STRICTORDER_ACC, /* devacc_attr_dataorder */
DDI_DEFAULT_ACC /* devacc_attr_access */
};
{
DMA_ATTR_V0, /* dma_attr_version */
0, /* dma_attr_addr_lo */
0xffffffffffffffff, /* dma_attr_addr_hi */
0xffffffffffffffff, /* dma_attr_count_max */
0, /* dma_attr_align */
0xffffffff, /* dma_attr_burstsizes */
1, /* dma_attr_minxfer */
0xffffffffffffffff, /* dma_attr_maxxfer */
0xffffffffffffffff, /* dma_attr_seg */
1, /* dma_attr_sgllen */
1, /* dma_attr_granular */
0, /* dma_attr_flags */
};
{
(void)pDev;
}
{
return LM_STATUS_SUCCESS;
}
{
return LM_STATUS_SUCCESS;
}
int cli_idx)
{
pPageCfg = &bnxeHwPageConfigs[0];
{
{
break;
}
pPageCfg++;
}
}
unsigned long log2_align(unsigned long n);
{
/* XXX Wake on LAN? */
//pLM->params.wol_cap = (LM_WAKE_UP_MODE_MAGIC_PACKET | LM_WAKE_UP_MODE_NWUF);
/* keep the VLAN tag in the mac header when receiving */
/* set in BnxeIntrInit based on the allocated number of MSIX interrupts */
//pLM->params.rss_chain_cnt = pUM->devParams.numRings;
//pLM->params.tss_chain_cnt = pUM->devParams.numRings;
/* determine: 1. itl_client_page_size, #context in page*/
/* based on PCIe block INIT document */
/* We now need to calculate the page size based on the maximum number of
* connections supported. Since this property is identical to all ports, and
* is configured in COMMON registers, we need to use the maximum number of
* connections in all ports. */
/* The L2P table is used to map logical addresses to physical ones. There
* are four clients that use this table. We want to use only the ILT
* (Internal), we need to calculate the total size required for all clients,
* divide it by the number of entries in the ILT table and that will give us
* the page size we want. The following table describes the needs of each of
* these clients:
*
* HW block(L2P client) Area name Size [B]
* Searcher T1 ROUNDUP(LOG2(N)) * 64
* Timers Linear Array N * 8
* QM Queues N * 32 * 4
* CDU Context N * S + W * ROUNDUP (N/m) (W=0)
*
* N: Number of connections
* S: Context Size
* W: Block Waste (not really interesting) we configure the context size to
* be a power of 2.
* m: Number of cids in a block (not really interesting, since W will always
* be 0)
*/
if (required_page_size < LM_PAGE_SIZE)
{
}
{
}
else
{
}
/*
* l2_fw_flow_ctrl is read from the shmem in MF mode in E2 and above. In
* all other cases this parameter is read from the driver conf. We also
* read this parameter from the driver conf in E1.5 MF mode since 57711
* boot code does not have the struct func_ext_cfg.
*/
(CHIP_IS_E1x(pLM)))
{
}
/* enable rate shaping */
return LM_STATUS_SUCCESS;
}
int regNumber,
{
while (pMem)
{
{
return B_TRUE;
}
}
return B_FALSE;
}
{
//int numRegs;
int rc;
/*
* Solaris identifies:
* BAR 0 - size 0 (pci config regs?)
* BAR 1 - size 0x800000 (Everest 1/2 LM BAR 0)
* BAR 2 - size 0x4000000 (Everest 1 LM BAR 1)
* 0x800000 (Everest 2 LM BAR 1)
* BAR 3 - size 0x10000 (Everest 2 LM BAR 2)
*/
bar++;
//ddi_dev_nregs(pUM->pDev, &numRegs);
{
return NULL;
}
{
return NULL;
}
bar, // bar number
0, // region map offset,
size, // region memory window size (0=all)
{
return NULL;
}
bar--;
}
{
int rc;
/* see bar mapping described in mm_map_io_base above */
bar++;
{
return NULL;
}
{
return NULL;
}
bar, // bar number
offset, // region map offset,
size, // region memory window size (0=all)
pRegAccHandle)) != DDI_SUCCESS)
{
return NULL;
}
}
void * pVirtAddr,
{
while (pMemRegion)
{
{
break;
}
}
}
const char * sz_file,
const unsigned long line,
{
BnxeMemBlock * pMem;
void * pBuf;
int i;
(void)cli_idx;
{
return NULL;
}
{
return NULL;
}
/* fill in the header check */
i < BNXE_MEM_CHECK_LEN;
i += 4, pTmp++)
{
*pTmp = BNXE_MAGIC;
}
/* fill in the trailer check */
i < BNXE_MEM_CHECK_LEN;
i += 4, pTmp++)
{
*pTmp = BNXE_MAGIC;
}
return ((char *)pBuf + BNXE_MEM_CHECK_LEN);
}
const char * sz_file,
const unsigned long line,
{
int rc;
unsigned int count;
BnxeMemDma * pMem;
(void)memType;
(void)cli_idx;
if (memSize == 0)
{
return NULL;
}
{
return NULL;
}
(void *)0,
pDmaHandle)) != DDI_SUCCESS)
{
return NULL;
}
size,
(void *)0,
&pBuf,
&length,
pDmaAccHandle)) != DDI_SUCCESS)
{
return NULL;
}
(struct as *)0,
pBuf,
(void *)0,
&cookie,
&count)) != DDI_DMA_MAPPED)
{
return NULL;
}
/* save the virtual memory address so we can get the dma_handle later */
#if 0
#endif
/* Zero memory! */
/* make sure the new contents are flushed back to main memory */
return pBuf;
}
const char * sz_file,
const unsigned long line,
{
}
const char * sz_file,
const unsigned long line,
{
}
const char * sz_file,
const unsigned long line,
{
}
{
return 0;
}
void * pBuf,
{
BnxeMemBlock * pMem;
int i;
(void)cli_idx;
/* verify header check */
i < BNXE_MEM_CHECK_LEN;
i += 4, pTmp++)
{
if (*pTmp != BNXE_MAGIC)
{
}
}
/* verify trailer check */
i < BNXE_MEM_CHECK_LEN;
i += 4, pTmp++)
{
if (*pTmp != BNXE_MAGIC)
{
}
}
while (pMem)
{
{
{
/* Uh-Oh! */
return;
}
return;
}
}
}
void * pBuf,
{
BnxeMemDma * pMem;
(void)pPhysAddr;
(void)cli_idx;
while (pMem)
{
{
{
/* Uh-Oh! */
return;
}
return;
}
}
}
{
}
const void * pSrc,
{
}
void * pBuf2,
{
}
{
}
void * cookie)
{
#if 0
#else
(void)pDev;
(void)cid;
#endif
}
struct sq_pending_command * pPending)
{
/* XXX probably need a memory pool to pull from... */
}
{
/* XXX probably need a memory pool to pull from... */
}
{
//um_device_t * pUM = (um_device_t *)pDev;
copied = 0;
{
}
return copied;
}
{
return LM_STATUS_SUCCESS;
}
{
#define TBUF_SIZE 64
char * pDuplex;
char * pRxFlow;
char * pTxFlow;
char * pSpeed;
if (link != LM_STATUS_LINK_ACTIVE)
{
/* reset the link status */
/* reset the link partner status */
return;
}
{
pDuplex = "Half";
}
else
{
pDuplex = "Full";
}
{
pRxFlow = "ON";
}
else
{
pRxFlow = "OFF";
}
{
pTxFlow = "ON";
}
else
{
pTxFlow = "OFF";
}
#if 0
{
}
#endif
switch (GET_MEDIUM_SPEED(medium))
{
case LM_MEDIUM_SPEED_10MBPS:
pSpeed = "10Mb";
break;
case LM_MEDIUM_SPEED_100MBPS:
pSpeed = "100Mb";
break;
case LM_MEDIUM_SPEED_1000MBPS:
pSpeed = "1Gb";
break;
case LM_MEDIUM_SPEED_2500MBPS:
pSpeed = "2.5Gb";
break;
case LM_MEDIUM_SPEED_10GBPS:
pSpeed = "10Gb";
break;
case LM_MEDIUM_SPEED_12GBPS:
pSpeed = "12Gb";
break;
case LM_MEDIUM_SPEED_12_5GBPS:
pSpeed = "12.5Gb";
break;
case LM_MEDIUM_SPEED_13GBPS:
pSpeed = "13Gb";
break;
case LM_MEDIUM_SPEED_15GBPS:
pSpeed = "15Gb";
break;
case LM_MEDIUM_SPEED_16GBPS:
pSpeed = "16Gb";
break;
case LM_MEDIUM_SPEED_20GBPS:
pSpeed = "20Gb";
break;
default:
{
(LM_MEDIUM_SPEED_SEQ_START >> 8) +
1) * 100);
break;
}
pSpeed = "";
break;
}
if (*pSpeed == 0)
{
}
else
{
}
}
{
/* ignore link status if it has not changed since the last indicate */
{
return;
}
{
}
{
{
}
{
}
else
{
(link == LM_STATUS_LINK_ACTIVE) ?
NULL,
0);
}
}
}
void * param)
{
return LM_STATUS_SUCCESS;
}
{
(void)b_fw_access;
(void)b_queue_for_fw;
return LM_STATUS_SUCCESS;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
{
return LM_STATUS_INVALID_PARAMETER;
}
return LM_STATUS_SUCCESS;
}
{
{
return LM_STATUS_INVALID_PARAMETER;
}
return LM_STATUS_SUCCESS;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
void MM_ACQUIRE_LOADER_LOCK_IMP()
{
}
void MM_RELEASE_LOADER_LOCK_IMP()
{
}
{
}
{
}
{
}
{
}
{
}
{
}
unsigned int size,
unsigned int crc)
{
return 0;
}
unsigned int size,
unsigned short crc)
{
return 0;
}
const lm_log_id_t lm_log_id,
{
char * sz_vendor_name = NULL;
char * sz_vendor_pn = NULL;
switch (lm_log_id)
{
case LM_LOG_ID_FAN_FAILURE: // fan failure detected
break;
case LM_LOG_ID_UNQUAL_IO_MODULE: // SFP+ unqualified io module
/*
* expected parameters:
* u8 port, const char * vendor_name, const char * vendor_pn
*/
break;
case LM_LOG_ID_OVER_CURRENT: // SFP+ over current power
/*
* expected parametrs:
* u8 port
*/
break;
case LM_LOG_ID_NO_10G_SUPPORT: // 10g speed is requested but not supported
/*
* expected parametrs:
* u8 port
*/
break;
/*
* expected parametrs:
* u8 port
*/
break;
#define MM_PORT_NUM(pdev) \
break;
default:
break;
}
return LM_STATUS_SUCCESS;
}
const lm_log_id_t lm_log_id,
...)
{
return lm_status;
}
{
"%s",
}
{
}
{
offset));
}
{
offset));
}
{
offset));
}
{
offset));
}
{
val);
}
{
val);
}
{
val);
}
{
val);
}
{
u32_t i;
for (i = 0; i < size; i++)
{
offset + (i * 4)),
*(buf_ptr + i));
}
}
{
return 0xFFFFFFFF;
}
} else {
return 0xFFFFFFFF;
}
do {
reg_value = 0;
if (cap_id == capabilityID) {
break;
}
if (cap_offset == 0) {
break;
}
} else {
cap_offset = 0xFFFFFFFF;
break;
}
} while ((lm_status == LM_STATUS_SUCCESS));
return cap_offset;
}
{
return LM_WAKE_UP_MODE_NONE;
}
{
return 0;
}
{
return 0;
}
{
return LM_STATUS_SUCCESS;
}
u64_t mm_query_system_time(void)
{
return 0;
}