1*f391a51aSRobert Mustacchi /* 2*f391a51aSRobert Mustacchi * CDDL HEADER START 3*f391a51aSRobert Mustacchi * 4*f391a51aSRobert Mustacchi * The contents of this file are subject to the terms of the 5*f391a51aSRobert Mustacchi * Common Development and Distribution License (the "License"). 6*f391a51aSRobert Mustacchi * You may not use this file except in compliance with the License. 7*f391a51aSRobert Mustacchi * 8*f391a51aSRobert Mustacchi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*f391a51aSRobert Mustacchi * or http://www.opensolaris.org/os/licensing. 10*f391a51aSRobert Mustacchi * See the License for the specific language governing permissions 11*f391a51aSRobert Mustacchi * and limitations under the License. 12*f391a51aSRobert Mustacchi * 13*f391a51aSRobert Mustacchi * When distributing Covered Code, include this CDDL HEADER in each 14*f391a51aSRobert Mustacchi * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*f391a51aSRobert Mustacchi * If applicable, add the following below this CDDL HEADER, with the 16*f391a51aSRobert Mustacchi * fields enclosed by brackets "[]" replaced with your own identifying 17*f391a51aSRobert Mustacchi * information: Portions Copyright [yyyy] [name of copyright owner] 18*f391a51aSRobert Mustacchi * 19*f391a51aSRobert Mustacchi * CDDL HEADER END 20*f391a51aSRobert Mustacchi */ 21*f391a51aSRobert Mustacchi 22*f391a51aSRobert Mustacchi /* 23*f391a51aSRobert Mustacchi * Copyright 2014 QLogic Corporation 24*f391a51aSRobert Mustacchi * The contents of this file are subject to the terms of the 25*f391a51aSRobert Mustacchi * QLogic End User License (the "License"). 26*f391a51aSRobert Mustacchi * You may not use this file except in compliance with the License. 27*f391a51aSRobert Mustacchi * 28*f391a51aSRobert Mustacchi * You can obtain a copy of the License at 29*f391a51aSRobert Mustacchi * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/ 30*f391a51aSRobert Mustacchi * QLogic_End_User_Software_License.txt 31*f391a51aSRobert Mustacchi * See the License for the specific language governing permissions 32*f391a51aSRobert Mustacchi * and limitations under the License. 33*f391a51aSRobert Mustacchi */ 34*f391a51aSRobert Mustacchi 35*f391a51aSRobert Mustacchi #ifndef __BNXE_BINDING_H 36*f391a51aSRobert Mustacchi #define __BNXE_BINDING_H 37*f391a51aSRobert Mustacchi 38*f391a51aSRobert Mustacchi #include "bcmtype.h" 39*f391a51aSRobert Mustacchi #include "mac_drv_info.h" 40*f391a51aSRobert Mustacchi 41*f391a51aSRobert Mustacchi #define BNXE_BINDING_VERSION \ 42*f391a51aSRobert Mustacchi ((MAJVERSION << 16) | (MINVERSION << 8) | (REVVERSION << 0)) 43*f391a51aSRobert Mustacchi 44*f391a51aSRobert Mustacchi /* cb_ioctl commands sent to bnxe */ 45*f391a51aSRobert Mustacchi #define BNXE_BIND_FCOE 0x0ead0001 46*f391a51aSRobert Mustacchi #define BNXE_UNBIND_FCOE 0x0ead0002 47*f391a51aSRobert Mustacchi 48*f391a51aSRobert Mustacchi 49*f391a51aSRobert Mustacchi /* default FCoE max exchanges is 4096 for SF and 2048 for MF */ 50*f391a51aSRobert Mustacchi #define FCOE_MAX_EXCHANGES_SF 4096 51*f391a51aSRobert Mustacchi #define FCOE_MAX_EXCHANGES_MF 2048 52*f391a51aSRobert Mustacchi 53*f391a51aSRobert Mustacchi 54*f391a51aSRobert Mustacchi #ifndef BNXE_FCOE_WWN_SIZE 55*f391a51aSRobert Mustacchi #define BNXE_FCOE_WWN_SIZE 8 56*f391a51aSRobert Mustacchi #endif 57*f391a51aSRobert Mustacchi 58*f391a51aSRobert Mustacchi typedef struct bnxe_wwn_info 59*f391a51aSRobert Mustacchi { 60*f391a51aSRobert Mustacchi uint32_t fcp_pwwn_provided; 61*f391a51aSRobert Mustacchi uint8_t fcp_pwwn[BNXE_FCOE_WWN_SIZE]; 62*f391a51aSRobert Mustacchi uint32_t fcp_nwwn_provided; 63*f391a51aSRobert Mustacchi uint8_t fcp_nwwn[BNXE_FCOE_WWN_SIZE]; 64*f391a51aSRobert Mustacchi } BnxeWwnInfo; 65*f391a51aSRobert Mustacchi 66*f391a51aSRobert Mustacchi 67*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_FORCE_LOAD 0x1 68*f391a51aSRobert Mustacchi 69*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_MF_MODE_MASK 0x6 /* bits 2-3 */ 70*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_MF_MODE_SF 0x0 /* single function */ 71*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_MF_MODE_SD 0x2 /* switch dependent (vlan based) */ 72*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_MF_MODE_SI 0x4 /* switch independent (mac based) */ 73*f391a51aSRobert Mustacchi #define FCOE_INFO_FLAG_MF_MODE_AFEX 0x6 /* switch dependent (afex based) */ 74*f391a51aSRobert Mustacchi 75*f391a51aSRobert Mustacchi #define FCOE_INFO_IS_MF_MODE_SF(flags) \ 76*f391a51aSRobert Mustacchi (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SF) 77*f391a51aSRobert Mustacchi #define FCOE_INFO_IS_MF_MODE_SD(flags) \ 78*f391a51aSRobert Mustacchi (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SD) 79*f391a51aSRobert Mustacchi #define FCOE_INFO_IS_MF_MODE_SI(flags) \ 80*f391a51aSRobert Mustacchi (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SI) 81*f391a51aSRobert Mustacchi #define FCOE_INFO_IS_MF_MODE_AFEX(flags) \ 82*f391a51aSRobert Mustacchi (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_AFEX) 83*f391a51aSRobert Mustacchi 84*f391a51aSRobert Mustacchi typedef struct bnxe_fcoe_info 85*f391a51aSRobert Mustacchi { 86*f391a51aSRobert Mustacchi u32_t flags; 87*f391a51aSRobert Mustacchi u32_t max_fcoe_conn; 88*f391a51aSRobert Mustacchi u32_t max_fcoe_exchanges; 89*f391a51aSRobert Mustacchi BnxeWwnInfo wwn; 90*f391a51aSRobert Mustacchi } BnxeFcoeInfo; 91*f391a51aSRobert Mustacchi 92*f391a51aSRobert Mustacchi 93*f391a51aSRobert Mustacchi typedef struct bnxe_fcoe_caps 94*f391a51aSRobert Mustacchi { 95*f391a51aSRobert Mustacchi struct fcoe_capabilities fcoe_caps; 96*f391a51aSRobert Mustacchi } BnxeFcoeCaps; 97*f391a51aSRobert Mustacchi 98*f391a51aSRobert Mustacchi 99*f391a51aSRobert Mustacchi /* 100*f391a51aSRobert Mustacchi * cli_ctl - misc control interface up to the client 101*f391a51aSRobert Mustacchi * 102*f391a51aSRobert Mustacchi * cmd: CLI_CTL_LINK_UP - link up event, no data passed 103*f391a51aSRobert Mustacchi * CLI_CTL_LINK_DOWN - link down event, no data passed 104*f391a51aSRobert Mustacchi * CLI_CTL_UNLOAD - graceful unload event, no data passed 105*f391a51aSRobert Mustacchi * 106*f391a51aSRobert Mustacchi * pData: pointer to command data or NULL 107*f391a51aSRobert Mustacchi * 108*f391a51aSRobert Mustacchi * dataLen: length of command data or 0 109*f391a51aSRobert Mustacchi */ 110*f391a51aSRobert Mustacchi #define CLI_CTL_LINK_UP 1 111*f391a51aSRobert Mustacchi #define CLI_CTL_LINK_DOWN 2 112*f391a51aSRobert Mustacchi #define CLI_CTL_UNLOAD 3 113*f391a51aSRobert Mustacchi typedef boolean_t (*cli_ctl)(dev_info_t * pDev, 114*f391a51aSRobert Mustacchi int cmd, 115*f391a51aSRobert Mustacchi void * pData, 116*f391a51aSRobert Mustacchi int dataLen); 117*f391a51aSRobert Mustacchi 118*f391a51aSRobert Mustacchi typedef boolean_t (*cli_indicate_tx)(dev_info_t * pDev, 119*f391a51aSRobert Mustacchi mblk_t * pMblk); 120*f391a51aSRobert Mustacchi 121*f391a51aSRobert Mustacchi typedef boolean_t (*cli_indicate_rx)(dev_info_t * pDev, 122*f391a51aSRobert Mustacchi mblk_t * pMblk); 123*f391a51aSRobert Mustacchi 124*f391a51aSRobert Mustacchi typedef boolean_t (*cli_indicate_cqes)(dev_info_t * pDev, 125*f391a51aSRobert Mustacchi void * cqes[], 126*f391a51aSRobert Mustacchi int cqeCnt); 127*f391a51aSRobert Mustacchi 128*f391a51aSRobert Mustacchi 129*f391a51aSRobert Mustacchi /* 130*f391a51aSRobert Mustacchi * prv_ctl - misc control interface down to the provider 131*f391a51aSRobert Mustacchi * 132*f391a51aSRobert Mustacchi * cmd: PRV_CTL_GET_MAC_ADDR - get MAC Address, pass data buffer to hold addr 133*f391a51aSRobert Mustacchi * PRV_CTL_SET_MAC_ADDR - set MAC Address, pass data buffer contains addr 134*f391a51aSRobert Mustacchi * PRV_CTL_QUERY_PARAMS - query related params, pass BnxeXXXInfo struct 135*f391a51aSRobert Mustacchi * PRV_CTL_DISABLE_INTR - disable interrupts, no data passed 136*f391a51aSRobert Mustacchi * PRV_CTL_ENABLE_INTR - enable interrupts, no data passed 137*f391a51aSRobert Mustacchi * PRV_CTL_MBA_BOOT - check if MBA performed network boot 138*f391a51aSRobert Mustacchi * PRV_CTL_LINK_STATE - query the link state, pass boolean buffer 139*f391a51aSRobert Mustacchi * PRV_CTL_BOARD_TYPE - query the board type, pass string buffer 140*f391a51aSRobert Mustacchi * PRV_CTL_BOARD_SERNUM - query the board's serial number, pass string buffer 141*f391a51aSRobert Mustacchi * PRV_CTL_BOOTCODE_VERSION - query the MFW bootcode version, pass string buffer 142*f391a51aSRobert Mustacchi * PRV_CTL_REPORT_FCOE_STATS - report FCoE stats, pass filled in fcoe_stats_info_t 143*f391a51aSRobert Mustacchi * PRV_CTL_SET_CAPS - report FCoE capabilities, pass filled in BnxeFcoeCaps struct 144*f391a51aSRobert Mustacchi * 145*f391a51aSRobert Mustacchi * pData: pointer to command data or NULL 146*f391a51aSRobert Mustacchi * 147*f391a51aSRobert Mustacchi * dataLen: length of command data or 0 148*f391a51aSRobert Mustacchi * 149*f391a51aSRobert Mustacchi * returns: TRUE upon success, FALSE otherwise 150*f391a51aSRobert Mustacchi */ 151*f391a51aSRobert Mustacchi #define PRV_CTL_GET_MAC_ADDR 1 152*f391a51aSRobert Mustacchi #define PRV_CTL_SET_MAC_ADDR 2 153*f391a51aSRobert Mustacchi #define PRV_CTL_QUERY_PARAMS 3 154*f391a51aSRobert Mustacchi #define PRV_CTL_DISABLE_INTR 4 155*f391a51aSRobert Mustacchi #define PRV_CTL_ENABLE_INTR 5 156*f391a51aSRobert Mustacchi #define PRV_CTL_MBA_BOOT 6 157*f391a51aSRobert Mustacchi #define PRV_CTL_LINK_STATE 7 158*f391a51aSRobert Mustacchi #define PRV_CTL_BOARD_TYPE 8 159*f391a51aSRobert Mustacchi #define PRV_CTL_BOARD_SERNUM 9 160*f391a51aSRobert Mustacchi #define PRV_CTL_BOOTCODE_VERSION 10 161*f391a51aSRobert Mustacchi #define PRV_CTL_REPORT_FCOE_STATS 11 162*f391a51aSRobert Mustacchi #define PRV_CTL_SET_CAPS 12 163*f391a51aSRobert Mustacchi typedef boolean_t (*prv_ctl)(dev_info_t * pDev, 164*f391a51aSRobert Mustacchi int cmd, 165*f391a51aSRobert Mustacchi void * pData, 166*f391a51aSRobert Mustacchi int dataLen); 167*f391a51aSRobert Mustacchi 168*f391a51aSRobert Mustacchi #define PRV_TX_VLAN_TAG 1 169*f391a51aSRobert Mustacchi typedef mblk_t * (*prv_tx)(dev_info_t * pDev, 170*f391a51aSRobert Mustacchi mblk_t * pMblk, 171*f391a51aSRobert Mustacchi u32_t flags, 172*f391a51aSRobert Mustacchi u16_t vlan_tag); 173*f391a51aSRobert Mustacchi 174*f391a51aSRobert Mustacchi typedef boolean_t (*prv_poll)(dev_info_t * pDev); 175*f391a51aSRobert Mustacchi 176*f391a51aSRobert Mustacchi typedef boolean_t (*prv_send_wqes)(dev_info_t * pDev, 177*f391a51aSRobert Mustacchi void * wqes[], 178*f391a51aSRobert Mustacchi int wqeCnt); 179*f391a51aSRobert Mustacchi 180*f391a51aSRobert Mustacchi typedef boolean_t (*prv_map_mailboxq)(dev_info_t * pDev, 181*f391a51aSRobert Mustacchi u32_t cid, 182*f391a51aSRobert Mustacchi void ** ppMap, 183*f391a51aSRobert Mustacchi ddi_acc_handle_t * pAccHandle); 184*f391a51aSRobert Mustacchi 185*f391a51aSRobert Mustacchi typedef boolean_t (*prv_unmap_mailboxq)(dev_info_t * pDev, 186*f391a51aSRobert Mustacchi u32_t cid, 187*f391a51aSRobert Mustacchi void * pMap, 188*f391a51aSRobert Mustacchi ddi_acc_handle_t accHandle); 189*f391a51aSRobert Mustacchi 190*f391a51aSRobert Mustacchi 191*f391a51aSRobert Mustacchi typedef struct bnxe_binding 192*f391a51aSRobert Mustacchi { 193*f391a51aSRobert Mustacchi u32_t version; 194*f391a51aSRobert Mustacchi 195*f391a51aSRobert Mustacchi dev_info_t * pCliDev; /* bnxe client */ 196*f391a51aSRobert Mustacchi 197*f391a51aSRobert Mustacchi cli_ctl cliCtl; 198*f391a51aSRobert Mustacchi cli_indicate_tx cliIndicateTx; 199*f391a51aSRobert Mustacchi cli_indicate_rx cliIndicateRx; 200*f391a51aSRobert Mustacchi cli_indicate_cqes cliIndicateCqes; 201*f391a51aSRobert Mustacchi 202*f391a51aSRobert Mustacchi u32_t numRxDescs; 203*f391a51aSRobert Mustacchi u32_t numTxDescs; 204*f391a51aSRobert Mustacchi 205*f391a51aSRobert Mustacchi dev_info_t * pPrvDev; /* bnxe */ 206*f391a51aSRobert Mustacchi 207*f391a51aSRobert Mustacchi prv_ctl prvCtl; 208*f391a51aSRobert Mustacchi prv_tx prvTx; 209*f391a51aSRobert Mustacchi prv_poll prvPoll; 210*f391a51aSRobert Mustacchi prv_send_wqes prvSendWqes; 211*f391a51aSRobert Mustacchi prv_map_mailboxq prvMapMailboxq; 212*f391a51aSRobert Mustacchi prv_unmap_mailboxq prvUnmapMailboxq; 213*f391a51aSRobert Mustacchi } BnxeBinding; 214*f391a51aSRobert Mustacchi 215*f391a51aSRobert Mustacchi #endif /* __BNXE_BINDING_H */ 216*f391a51aSRobert Mustacchi 217