1*f7917c00SJeff Kirsher /* 2*f7917c00SJeff Kirsher * Copyright (c) 2005-2008 Chelsio, Inc. All rights reserved. 3*f7917c00SJeff Kirsher * 4*f7917c00SJeff Kirsher * This software is available to you under a choice of one of two 5*f7917c00SJeff Kirsher * licenses. You may choose to be licensed under the terms of the GNU 6*f7917c00SJeff Kirsher * General Public License (GPL) Version 2, available from the file 7*f7917c00SJeff Kirsher * COPYING in the main directory of this source tree, or the 8*f7917c00SJeff Kirsher * OpenIB.org BSD license below: 9*f7917c00SJeff Kirsher * 10*f7917c00SJeff Kirsher * Redistribution and use in source and binary forms, with or 11*f7917c00SJeff Kirsher * without modification, are permitted provided that the following 12*f7917c00SJeff Kirsher * conditions are met: 13*f7917c00SJeff Kirsher * 14*f7917c00SJeff Kirsher * - Redistributions of source code must retain the above 15*f7917c00SJeff Kirsher * copyright notice, this list of conditions and the following 16*f7917c00SJeff Kirsher * disclaimer. 17*f7917c00SJeff Kirsher * 18*f7917c00SJeff Kirsher * - Redistributions in binary form must reproduce the above 19*f7917c00SJeff Kirsher * copyright notice, this list of conditions and the following 20*f7917c00SJeff Kirsher * disclaimer in the documentation and/or other materials 21*f7917c00SJeff Kirsher * provided with the distribution. 22*f7917c00SJeff Kirsher * 23*f7917c00SJeff Kirsher * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24*f7917c00SJeff Kirsher * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25*f7917c00SJeff Kirsher * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26*f7917c00SJeff Kirsher * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27*f7917c00SJeff Kirsher * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28*f7917c00SJeff Kirsher * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29*f7917c00SJeff Kirsher * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30*f7917c00SJeff Kirsher * SOFTWARE. 31*f7917c00SJeff Kirsher */ 32*f7917c00SJeff Kirsher #ifndef __CHELSIO_COMMON_H 33*f7917c00SJeff Kirsher #define __CHELSIO_COMMON_H 34*f7917c00SJeff Kirsher 35*f7917c00SJeff Kirsher #include <linux/kernel.h> 36*f7917c00SJeff Kirsher #include <linux/types.h> 37*f7917c00SJeff Kirsher #include <linux/ctype.h> 38*f7917c00SJeff Kirsher #include <linux/delay.h> 39*f7917c00SJeff Kirsher #include <linux/init.h> 40*f7917c00SJeff Kirsher #include <linux/netdevice.h> 41*f7917c00SJeff Kirsher #include <linux/ethtool.h> 42*f7917c00SJeff Kirsher #include <linux/mdio.h> 43*f7917c00SJeff Kirsher #include "version.h" 44*f7917c00SJeff Kirsher 45*f7917c00SJeff Kirsher #define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ## __VA_ARGS__) 46*f7917c00SJeff Kirsher #define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ## __VA_ARGS__) 47*f7917c00SJeff Kirsher #define CH_ALERT(adap, fmt, ...) \ 48*f7917c00SJeff Kirsher dev_printk(KERN_ALERT, &adap->pdev->dev, fmt, ## __VA_ARGS__) 49*f7917c00SJeff Kirsher 50*f7917c00SJeff Kirsher /* 51*f7917c00SJeff Kirsher * More powerful macro that selectively prints messages based on msg_enable. 52*f7917c00SJeff Kirsher * For info and debugging messages. 53*f7917c00SJeff Kirsher */ 54*f7917c00SJeff Kirsher #define CH_MSG(adapter, level, category, fmt, ...) do { \ 55*f7917c00SJeff Kirsher if ((adapter)->msg_enable & NETIF_MSG_##category) \ 56*f7917c00SJeff Kirsher dev_printk(KERN_##level, &adapter->pdev->dev, fmt, \ 57*f7917c00SJeff Kirsher ## __VA_ARGS__); \ 58*f7917c00SJeff Kirsher } while (0) 59*f7917c00SJeff Kirsher 60*f7917c00SJeff Kirsher #ifdef DEBUG 61*f7917c00SJeff Kirsher # define CH_DBG(adapter, category, fmt, ...) \ 62*f7917c00SJeff Kirsher CH_MSG(adapter, DEBUG, category, fmt, ## __VA_ARGS__) 63*f7917c00SJeff Kirsher #else 64*f7917c00SJeff Kirsher # define CH_DBG(adapter, category, fmt, ...) 65*f7917c00SJeff Kirsher #endif 66*f7917c00SJeff Kirsher 67*f7917c00SJeff Kirsher /* Additional NETIF_MSG_* categories */ 68*f7917c00SJeff Kirsher #define NETIF_MSG_MMIO 0x8000000 69*f7917c00SJeff Kirsher 70*f7917c00SJeff Kirsher enum { 71*f7917c00SJeff Kirsher MAX_NPORTS = 2, /* max # of ports */ 72*f7917c00SJeff Kirsher MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ 73*f7917c00SJeff Kirsher EEPROMSIZE = 8192, /* Serial EEPROM size */ 74*f7917c00SJeff Kirsher SERNUM_LEN = 16, /* Serial # length */ 75*f7917c00SJeff Kirsher RSS_TABLE_SIZE = 64, /* size of RSS lookup and mapping tables */ 76*f7917c00SJeff Kirsher TCB_SIZE = 128, /* TCB size */ 77*f7917c00SJeff Kirsher NMTUS = 16, /* size of MTU table */ 78*f7917c00SJeff Kirsher NCCTRL_WIN = 32, /* # of congestion control windows */ 79*f7917c00SJeff Kirsher PROTO_SRAM_LINES = 128, /* size of TP sram */ 80*f7917c00SJeff Kirsher }; 81*f7917c00SJeff Kirsher 82*f7917c00SJeff Kirsher #define MAX_RX_COALESCING_LEN 12288U 83*f7917c00SJeff Kirsher 84*f7917c00SJeff Kirsher enum { 85*f7917c00SJeff Kirsher PAUSE_RX = 1 << 0, 86*f7917c00SJeff Kirsher PAUSE_TX = 1 << 1, 87*f7917c00SJeff Kirsher PAUSE_AUTONEG = 1 << 2 88*f7917c00SJeff Kirsher }; 89*f7917c00SJeff Kirsher 90*f7917c00SJeff Kirsher enum { 91*f7917c00SJeff Kirsher SUPPORTED_IRQ = 1 << 24 92*f7917c00SJeff Kirsher }; 93*f7917c00SJeff Kirsher 94*f7917c00SJeff Kirsher enum { /* adapter interrupt-maintained statistics */ 95*f7917c00SJeff Kirsher STAT_ULP_CH0_PBL_OOB, 96*f7917c00SJeff Kirsher STAT_ULP_CH1_PBL_OOB, 97*f7917c00SJeff Kirsher STAT_PCI_CORR_ECC, 98*f7917c00SJeff Kirsher 99*f7917c00SJeff Kirsher IRQ_NUM_STATS /* keep last */ 100*f7917c00SJeff Kirsher }; 101*f7917c00SJeff Kirsher 102*f7917c00SJeff Kirsher #define TP_VERSION_MAJOR 1 103*f7917c00SJeff Kirsher #define TP_VERSION_MINOR 1 104*f7917c00SJeff Kirsher #define TP_VERSION_MICRO 0 105*f7917c00SJeff Kirsher 106*f7917c00SJeff Kirsher #define S_TP_VERSION_MAJOR 16 107*f7917c00SJeff Kirsher #define M_TP_VERSION_MAJOR 0xFF 108*f7917c00SJeff Kirsher #define V_TP_VERSION_MAJOR(x) ((x) << S_TP_VERSION_MAJOR) 109*f7917c00SJeff Kirsher #define G_TP_VERSION_MAJOR(x) \ 110*f7917c00SJeff Kirsher (((x) >> S_TP_VERSION_MAJOR) & M_TP_VERSION_MAJOR) 111*f7917c00SJeff Kirsher 112*f7917c00SJeff Kirsher #define S_TP_VERSION_MINOR 8 113*f7917c00SJeff Kirsher #define M_TP_VERSION_MINOR 0xFF 114*f7917c00SJeff Kirsher #define V_TP_VERSION_MINOR(x) ((x) << S_TP_VERSION_MINOR) 115*f7917c00SJeff Kirsher #define G_TP_VERSION_MINOR(x) \ 116*f7917c00SJeff Kirsher (((x) >> S_TP_VERSION_MINOR) & M_TP_VERSION_MINOR) 117*f7917c00SJeff Kirsher 118*f7917c00SJeff Kirsher #define S_TP_VERSION_MICRO 0 119*f7917c00SJeff Kirsher #define M_TP_VERSION_MICRO 0xFF 120*f7917c00SJeff Kirsher #define V_TP_VERSION_MICRO(x) ((x) << S_TP_VERSION_MICRO) 121*f7917c00SJeff Kirsher #define G_TP_VERSION_MICRO(x) \ 122*f7917c00SJeff Kirsher (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO) 123*f7917c00SJeff Kirsher 124*f7917c00SJeff Kirsher enum { 125*f7917c00SJeff Kirsher SGE_QSETS = 8, /* # of SGE Tx/Rx/RspQ sets */ 126*f7917c00SJeff Kirsher SGE_RXQ_PER_SET = 2, /* # of Rx queues per set */ 127*f7917c00SJeff Kirsher SGE_TXQ_PER_SET = 3 /* # of Tx queues per set */ 128*f7917c00SJeff Kirsher }; 129*f7917c00SJeff Kirsher 130*f7917c00SJeff Kirsher enum sge_context_type { /* SGE egress context types */ 131*f7917c00SJeff Kirsher SGE_CNTXT_RDMA = 0, 132*f7917c00SJeff Kirsher SGE_CNTXT_ETH = 2, 133*f7917c00SJeff Kirsher SGE_CNTXT_OFLD = 4, 134*f7917c00SJeff Kirsher SGE_CNTXT_CTRL = 5 135*f7917c00SJeff Kirsher }; 136*f7917c00SJeff Kirsher 137*f7917c00SJeff Kirsher enum { 138*f7917c00SJeff Kirsher AN_PKT_SIZE = 32, /* async notification packet size */ 139*f7917c00SJeff Kirsher IMMED_PKT_SIZE = 48 /* packet size for immediate data */ 140*f7917c00SJeff Kirsher }; 141*f7917c00SJeff Kirsher 142*f7917c00SJeff Kirsher struct sg_ent { /* SGE scatter/gather entry */ 143*f7917c00SJeff Kirsher __be32 len[2]; 144*f7917c00SJeff Kirsher __be64 addr[2]; 145*f7917c00SJeff Kirsher }; 146*f7917c00SJeff Kirsher 147*f7917c00SJeff Kirsher #ifndef SGE_NUM_GENBITS 148*f7917c00SJeff Kirsher /* Must be 1 or 2 */ 149*f7917c00SJeff Kirsher # define SGE_NUM_GENBITS 2 150*f7917c00SJeff Kirsher #endif 151*f7917c00SJeff Kirsher 152*f7917c00SJeff Kirsher #define TX_DESC_FLITS 16U 153*f7917c00SJeff Kirsher #define WR_FLITS (TX_DESC_FLITS + 1 - SGE_NUM_GENBITS) 154*f7917c00SJeff Kirsher 155*f7917c00SJeff Kirsher struct cphy; 156*f7917c00SJeff Kirsher struct adapter; 157*f7917c00SJeff Kirsher 158*f7917c00SJeff Kirsher struct mdio_ops { 159*f7917c00SJeff Kirsher int (*read)(struct net_device *dev, int phy_addr, int mmd_addr, 160*f7917c00SJeff Kirsher u16 reg_addr); 161*f7917c00SJeff Kirsher int (*write)(struct net_device *dev, int phy_addr, int mmd_addr, 162*f7917c00SJeff Kirsher u16 reg_addr, u16 val); 163*f7917c00SJeff Kirsher unsigned mode_support; 164*f7917c00SJeff Kirsher }; 165*f7917c00SJeff Kirsher 166*f7917c00SJeff Kirsher struct adapter_info { 167*f7917c00SJeff Kirsher unsigned char nports0; /* # of ports on channel 0 */ 168*f7917c00SJeff Kirsher unsigned char nports1; /* # of ports on channel 1 */ 169*f7917c00SJeff Kirsher unsigned char phy_base_addr; /* MDIO PHY base address */ 170*f7917c00SJeff Kirsher unsigned int gpio_out; /* GPIO output settings */ 171*f7917c00SJeff Kirsher unsigned char gpio_intr[MAX_NPORTS]; /* GPIO PHY IRQ pins */ 172*f7917c00SJeff Kirsher unsigned long caps; /* adapter capabilities */ 173*f7917c00SJeff Kirsher const struct mdio_ops *mdio_ops; /* MDIO operations */ 174*f7917c00SJeff Kirsher const char *desc; /* product description */ 175*f7917c00SJeff Kirsher }; 176*f7917c00SJeff Kirsher 177*f7917c00SJeff Kirsher struct mc5_stats { 178*f7917c00SJeff Kirsher unsigned long parity_err; 179*f7917c00SJeff Kirsher unsigned long active_rgn_full; 180*f7917c00SJeff Kirsher unsigned long nfa_srch_err; 181*f7917c00SJeff Kirsher unsigned long unknown_cmd; 182*f7917c00SJeff Kirsher unsigned long reqq_parity_err; 183*f7917c00SJeff Kirsher unsigned long dispq_parity_err; 184*f7917c00SJeff Kirsher unsigned long del_act_empty; 185*f7917c00SJeff Kirsher }; 186*f7917c00SJeff Kirsher 187*f7917c00SJeff Kirsher struct mc7_stats { 188*f7917c00SJeff Kirsher unsigned long corr_err; 189*f7917c00SJeff Kirsher unsigned long uncorr_err; 190*f7917c00SJeff Kirsher unsigned long parity_err; 191*f7917c00SJeff Kirsher unsigned long addr_err; 192*f7917c00SJeff Kirsher }; 193*f7917c00SJeff Kirsher 194*f7917c00SJeff Kirsher struct mac_stats { 195*f7917c00SJeff Kirsher u64 tx_octets; /* total # of octets in good frames */ 196*f7917c00SJeff Kirsher u64 tx_octets_bad; /* total # of octets in error frames */ 197*f7917c00SJeff Kirsher u64 tx_frames; /* all good frames */ 198*f7917c00SJeff Kirsher u64 tx_mcast_frames; /* good multicast frames */ 199*f7917c00SJeff Kirsher u64 tx_bcast_frames; /* good broadcast frames */ 200*f7917c00SJeff Kirsher u64 tx_pause; /* # of transmitted pause frames */ 201*f7917c00SJeff Kirsher u64 tx_deferred; /* frames with deferred transmissions */ 202*f7917c00SJeff Kirsher u64 tx_late_collisions; /* # of late collisions */ 203*f7917c00SJeff Kirsher u64 tx_total_collisions; /* # of total collisions */ 204*f7917c00SJeff Kirsher u64 tx_excess_collisions; /* frame errors from excessive collissions */ 205*f7917c00SJeff Kirsher u64 tx_underrun; /* # of Tx FIFO underruns */ 206*f7917c00SJeff Kirsher u64 tx_len_errs; /* # of Tx length errors */ 207*f7917c00SJeff Kirsher u64 tx_mac_internal_errs; /* # of internal MAC errors on Tx */ 208*f7917c00SJeff Kirsher u64 tx_excess_deferral; /* # of frames with excessive deferral */ 209*f7917c00SJeff Kirsher u64 tx_fcs_errs; /* # of frames with bad FCS */ 210*f7917c00SJeff Kirsher 211*f7917c00SJeff Kirsher u64 tx_frames_64; /* # of Tx frames in a particular range */ 212*f7917c00SJeff Kirsher u64 tx_frames_65_127; 213*f7917c00SJeff Kirsher u64 tx_frames_128_255; 214*f7917c00SJeff Kirsher u64 tx_frames_256_511; 215*f7917c00SJeff Kirsher u64 tx_frames_512_1023; 216*f7917c00SJeff Kirsher u64 tx_frames_1024_1518; 217*f7917c00SJeff Kirsher u64 tx_frames_1519_max; 218*f7917c00SJeff Kirsher 219*f7917c00SJeff Kirsher u64 rx_octets; /* total # of octets in good frames */ 220*f7917c00SJeff Kirsher u64 rx_octets_bad; /* total # of octets in error frames */ 221*f7917c00SJeff Kirsher u64 rx_frames; /* all good frames */ 222*f7917c00SJeff Kirsher u64 rx_mcast_frames; /* good multicast frames */ 223*f7917c00SJeff Kirsher u64 rx_bcast_frames; /* good broadcast frames */ 224*f7917c00SJeff Kirsher u64 rx_pause; /* # of received pause frames */ 225*f7917c00SJeff Kirsher u64 rx_fcs_errs; /* # of received frames with bad FCS */ 226*f7917c00SJeff Kirsher u64 rx_align_errs; /* alignment errors */ 227*f7917c00SJeff Kirsher u64 rx_symbol_errs; /* symbol errors */ 228*f7917c00SJeff Kirsher u64 rx_data_errs; /* data errors */ 229*f7917c00SJeff Kirsher u64 rx_sequence_errs; /* sequence errors */ 230*f7917c00SJeff Kirsher u64 rx_runt; /* # of runt frames */ 231*f7917c00SJeff Kirsher u64 rx_jabber; /* # of jabber frames */ 232*f7917c00SJeff Kirsher u64 rx_short; /* # of short frames */ 233*f7917c00SJeff Kirsher u64 rx_too_long; /* # of oversized frames */ 234*f7917c00SJeff Kirsher u64 rx_mac_internal_errs; /* # of internal MAC errors on Rx */ 235*f7917c00SJeff Kirsher 236*f7917c00SJeff Kirsher u64 rx_frames_64; /* # of Rx frames in a particular range */ 237*f7917c00SJeff Kirsher u64 rx_frames_65_127; 238*f7917c00SJeff Kirsher u64 rx_frames_128_255; 239*f7917c00SJeff Kirsher u64 rx_frames_256_511; 240*f7917c00SJeff Kirsher u64 rx_frames_512_1023; 241*f7917c00SJeff Kirsher u64 rx_frames_1024_1518; 242*f7917c00SJeff Kirsher u64 rx_frames_1519_max; 243*f7917c00SJeff Kirsher 244*f7917c00SJeff Kirsher u64 rx_cong_drops; /* # of Rx drops due to SGE congestion */ 245*f7917c00SJeff Kirsher 246*f7917c00SJeff Kirsher unsigned long tx_fifo_parity_err; 247*f7917c00SJeff Kirsher unsigned long rx_fifo_parity_err; 248*f7917c00SJeff Kirsher unsigned long tx_fifo_urun; 249*f7917c00SJeff Kirsher unsigned long rx_fifo_ovfl; 250*f7917c00SJeff Kirsher unsigned long serdes_signal_loss; 251*f7917c00SJeff Kirsher unsigned long xaui_pcs_ctc_err; 252*f7917c00SJeff Kirsher unsigned long xaui_pcs_align_change; 253*f7917c00SJeff Kirsher 254*f7917c00SJeff Kirsher unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */ 255*f7917c00SJeff Kirsher unsigned long num_resets; /* # times reset due to stuck TX */ 256*f7917c00SJeff Kirsher 257*f7917c00SJeff Kirsher unsigned long link_faults; /* # detected link faults */ 258*f7917c00SJeff Kirsher }; 259*f7917c00SJeff Kirsher 260*f7917c00SJeff Kirsher struct tp_mib_stats { 261*f7917c00SJeff Kirsher u32 ipInReceive_hi; 262*f7917c00SJeff Kirsher u32 ipInReceive_lo; 263*f7917c00SJeff Kirsher u32 ipInHdrErrors_hi; 264*f7917c00SJeff Kirsher u32 ipInHdrErrors_lo; 265*f7917c00SJeff Kirsher u32 ipInAddrErrors_hi; 266*f7917c00SJeff Kirsher u32 ipInAddrErrors_lo; 267*f7917c00SJeff Kirsher u32 ipInUnknownProtos_hi; 268*f7917c00SJeff Kirsher u32 ipInUnknownProtos_lo; 269*f7917c00SJeff Kirsher u32 ipInDiscards_hi; 270*f7917c00SJeff Kirsher u32 ipInDiscards_lo; 271*f7917c00SJeff Kirsher u32 ipInDelivers_hi; 272*f7917c00SJeff Kirsher u32 ipInDelivers_lo; 273*f7917c00SJeff Kirsher u32 ipOutRequests_hi; 274*f7917c00SJeff Kirsher u32 ipOutRequests_lo; 275*f7917c00SJeff Kirsher u32 ipOutDiscards_hi; 276*f7917c00SJeff Kirsher u32 ipOutDiscards_lo; 277*f7917c00SJeff Kirsher u32 ipOutNoRoutes_hi; 278*f7917c00SJeff Kirsher u32 ipOutNoRoutes_lo; 279*f7917c00SJeff Kirsher u32 ipReasmTimeout; 280*f7917c00SJeff Kirsher u32 ipReasmReqds; 281*f7917c00SJeff Kirsher u32 ipReasmOKs; 282*f7917c00SJeff Kirsher u32 ipReasmFails; 283*f7917c00SJeff Kirsher 284*f7917c00SJeff Kirsher u32 reserved[8]; 285*f7917c00SJeff Kirsher 286*f7917c00SJeff Kirsher u32 tcpActiveOpens; 287*f7917c00SJeff Kirsher u32 tcpPassiveOpens; 288*f7917c00SJeff Kirsher u32 tcpAttemptFails; 289*f7917c00SJeff Kirsher u32 tcpEstabResets; 290*f7917c00SJeff Kirsher u32 tcpOutRsts; 291*f7917c00SJeff Kirsher u32 tcpCurrEstab; 292*f7917c00SJeff Kirsher u32 tcpInSegs_hi; 293*f7917c00SJeff Kirsher u32 tcpInSegs_lo; 294*f7917c00SJeff Kirsher u32 tcpOutSegs_hi; 295*f7917c00SJeff Kirsher u32 tcpOutSegs_lo; 296*f7917c00SJeff Kirsher u32 tcpRetransSeg_hi; 297*f7917c00SJeff Kirsher u32 tcpRetransSeg_lo; 298*f7917c00SJeff Kirsher u32 tcpInErrs_hi; 299*f7917c00SJeff Kirsher u32 tcpInErrs_lo; 300*f7917c00SJeff Kirsher u32 tcpRtoMin; 301*f7917c00SJeff Kirsher u32 tcpRtoMax; 302*f7917c00SJeff Kirsher }; 303*f7917c00SJeff Kirsher 304*f7917c00SJeff Kirsher struct tp_params { 305*f7917c00SJeff Kirsher unsigned int nchan; /* # of channels */ 306*f7917c00SJeff Kirsher unsigned int pmrx_size; /* total PMRX capacity */ 307*f7917c00SJeff Kirsher unsigned int pmtx_size; /* total PMTX capacity */ 308*f7917c00SJeff Kirsher unsigned int cm_size; /* total CM capacity */ 309*f7917c00SJeff Kirsher unsigned int chan_rx_size; /* per channel Rx size */ 310*f7917c00SJeff Kirsher unsigned int chan_tx_size; /* per channel Tx size */ 311*f7917c00SJeff Kirsher unsigned int rx_pg_size; /* Rx page size */ 312*f7917c00SJeff Kirsher unsigned int tx_pg_size; /* Tx page size */ 313*f7917c00SJeff Kirsher unsigned int rx_num_pgs; /* # of Rx pages */ 314*f7917c00SJeff Kirsher unsigned int tx_num_pgs; /* # of Tx pages */ 315*f7917c00SJeff Kirsher unsigned int ntimer_qs; /* # of timer queues */ 316*f7917c00SJeff Kirsher }; 317*f7917c00SJeff Kirsher 318*f7917c00SJeff Kirsher struct qset_params { /* SGE queue set parameters */ 319*f7917c00SJeff Kirsher unsigned int polling; /* polling/interrupt service for rspq */ 320*f7917c00SJeff Kirsher unsigned int coalesce_usecs; /* irq coalescing timer */ 321*f7917c00SJeff Kirsher unsigned int rspq_size; /* # of entries in response queue */ 322*f7917c00SJeff Kirsher unsigned int fl_size; /* # of entries in regular free list */ 323*f7917c00SJeff Kirsher unsigned int jumbo_size; /* # of entries in jumbo free list */ 324*f7917c00SJeff Kirsher unsigned int txq_size[SGE_TXQ_PER_SET]; /* Tx queue sizes */ 325*f7917c00SJeff Kirsher unsigned int cong_thres; /* FL congestion threshold */ 326*f7917c00SJeff Kirsher unsigned int vector; /* Interrupt (line or vector) number */ 327*f7917c00SJeff Kirsher }; 328*f7917c00SJeff Kirsher 329*f7917c00SJeff Kirsher struct sge_params { 330*f7917c00SJeff Kirsher unsigned int max_pkt_size; /* max offload pkt size */ 331*f7917c00SJeff Kirsher struct qset_params qset[SGE_QSETS]; 332*f7917c00SJeff Kirsher }; 333*f7917c00SJeff Kirsher 334*f7917c00SJeff Kirsher struct mc5_params { 335*f7917c00SJeff Kirsher unsigned int mode; /* selects MC5 width */ 336*f7917c00SJeff Kirsher unsigned int nservers; /* size of server region */ 337*f7917c00SJeff Kirsher unsigned int nfilters; /* size of filter region */ 338*f7917c00SJeff Kirsher unsigned int nroutes; /* size of routing region */ 339*f7917c00SJeff Kirsher }; 340*f7917c00SJeff Kirsher 341*f7917c00SJeff Kirsher /* Default MC5 region sizes */ 342*f7917c00SJeff Kirsher enum { 343*f7917c00SJeff Kirsher DEFAULT_NSERVERS = 512, 344*f7917c00SJeff Kirsher DEFAULT_NFILTERS = 128 345*f7917c00SJeff Kirsher }; 346*f7917c00SJeff Kirsher 347*f7917c00SJeff Kirsher /* MC5 modes, these must be non-0 */ 348*f7917c00SJeff Kirsher enum { 349*f7917c00SJeff Kirsher MC5_MODE_144_BIT = 1, 350*f7917c00SJeff Kirsher MC5_MODE_72_BIT = 2 351*f7917c00SJeff Kirsher }; 352*f7917c00SJeff Kirsher 353*f7917c00SJeff Kirsher /* MC5 min active region size */ 354*f7917c00SJeff Kirsher enum { MC5_MIN_TIDS = 16 }; 355*f7917c00SJeff Kirsher 356*f7917c00SJeff Kirsher struct vpd_params { 357*f7917c00SJeff Kirsher unsigned int cclk; 358*f7917c00SJeff Kirsher unsigned int mclk; 359*f7917c00SJeff Kirsher unsigned int uclk; 360*f7917c00SJeff Kirsher unsigned int mdc; 361*f7917c00SJeff Kirsher unsigned int mem_timing; 362*f7917c00SJeff Kirsher u8 sn[SERNUM_LEN + 1]; 363*f7917c00SJeff Kirsher u8 eth_base[6]; 364*f7917c00SJeff Kirsher u8 port_type[MAX_NPORTS]; 365*f7917c00SJeff Kirsher unsigned short xauicfg[2]; 366*f7917c00SJeff Kirsher }; 367*f7917c00SJeff Kirsher 368*f7917c00SJeff Kirsher struct pci_params { 369*f7917c00SJeff Kirsher unsigned int vpd_cap_addr; 370*f7917c00SJeff Kirsher unsigned short speed; 371*f7917c00SJeff Kirsher unsigned char width; 372*f7917c00SJeff Kirsher unsigned char variant; 373*f7917c00SJeff Kirsher }; 374*f7917c00SJeff Kirsher 375*f7917c00SJeff Kirsher enum { 376*f7917c00SJeff Kirsher PCI_VARIANT_PCI, 377*f7917c00SJeff Kirsher PCI_VARIANT_PCIX_MODE1_PARITY, 378*f7917c00SJeff Kirsher PCI_VARIANT_PCIX_MODE1_ECC, 379*f7917c00SJeff Kirsher PCI_VARIANT_PCIX_266_MODE2, 380*f7917c00SJeff Kirsher PCI_VARIANT_PCIE 381*f7917c00SJeff Kirsher }; 382*f7917c00SJeff Kirsher 383*f7917c00SJeff Kirsher struct adapter_params { 384*f7917c00SJeff Kirsher struct sge_params sge; 385*f7917c00SJeff Kirsher struct mc5_params mc5; 386*f7917c00SJeff Kirsher struct tp_params tp; 387*f7917c00SJeff Kirsher struct vpd_params vpd; 388*f7917c00SJeff Kirsher struct pci_params pci; 389*f7917c00SJeff Kirsher 390*f7917c00SJeff Kirsher const struct adapter_info *info; 391*f7917c00SJeff Kirsher 392*f7917c00SJeff Kirsher unsigned short mtus[NMTUS]; 393*f7917c00SJeff Kirsher unsigned short a_wnd[NCCTRL_WIN]; 394*f7917c00SJeff Kirsher unsigned short b_wnd[NCCTRL_WIN]; 395*f7917c00SJeff Kirsher 396*f7917c00SJeff Kirsher unsigned int nports; /* # of ethernet ports */ 397*f7917c00SJeff Kirsher unsigned int chan_map; /* bitmap of in-use Tx channels */ 398*f7917c00SJeff Kirsher unsigned int stats_update_period; /* MAC stats accumulation period */ 399*f7917c00SJeff Kirsher unsigned int linkpoll_period; /* link poll period in 0.1s */ 400*f7917c00SJeff Kirsher unsigned int rev; /* chip revision */ 401*f7917c00SJeff Kirsher unsigned int offload; 402*f7917c00SJeff Kirsher }; 403*f7917c00SJeff Kirsher 404*f7917c00SJeff Kirsher enum { /* chip revisions */ 405*f7917c00SJeff Kirsher T3_REV_A = 0, 406*f7917c00SJeff Kirsher T3_REV_B = 2, 407*f7917c00SJeff Kirsher T3_REV_B2 = 3, 408*f7917c00SJeff Kirsher T3_REV_C = 4, 409*f7917c00SJeff Kirsher }; 410*f7917c00SJeff Kirsher 411*f7917c00SJeff Kirsher struct trace_params { 412*f7917c00SJeff Kirsher u32 sip; 413*f7917c00SJeff Kirsher u32 sip_mask; 414*f7917c00SJeff Kirsher u32 dip; 415*f7917c00SJeff Kirsher u32 dip_mask; 416*f7917c00SJeff Kirsher u16 sport; 417*f7917c00SJeff Kirsher u16 sport_mask; 418*f7917c00SJeff Kirsher u16 dport; 419*f7917c00SJeff Kirsher u16 dport_mask; 420*f7917c00SJeff Kirsher u32 vlan:12; 421*f7917c00SJeff Kirsher u32 vlan_mask:12; 422*f7917c00SJeff Kirsher u32 intf:4; 423*f7917c00SJeff Kirsher u32 intf_mask:4; 424*f7917c00SJeff Kirsher u8 proto; 425*f7917c00SJeff Kirsher u8 proto_mask; 426*f7917c00SJeff Kirsher }; 427*f7917c00SJeff Kirsher 428*f7917c00SJeff Kirsher struct link_config { 429*f7917c00SJeff Kirsher unsigned int supported; /* link capabilities */ 430*f7917c00SJeff Kirsher unsigned int advertising; /* advertised capabilities */ 431*f7917c00SJeff Kirsher unsigned short requested_speed; /* speed user has requested */ 432*f7917c00SJeff Kirsher unsigned short speed; /* actual link speed */ 433*f7917c00SJeff Kirsher unsigned char requested_duplex; /* duplex user has requested */ 434*f7917c00SJeff Kirsher unsigned char duplex; /* actual link duplex */ 435*f7917c00SJeff Kirsher unsigned char requested_fc; /* flow control user has requested */ 436*f7917c00SJeff Kirsher unsigned char fc; /* actual link flow control */ 437*f7917c00SJeff Kirsher unsigned char autoneg; /* autonegotiating? */ 438*f7917c00SJeff Kirsher unsigned int link_ok; /* link up? */ 439*f7917c00SJeff Kirsher }; 440*f7917c00SJeff Kirsher 441*f7917c00SJeff Kirsher #define SPEED_INVALID 0xffff 442*f7917c00SJeff Kirsher #define DUPLEX_INVALID 0xff 443*f7917c00SJeff Kirsher 444*f7917c00SJeff Kirsher struct mc5 { 445*f7917c00SJeff Kirsher struct adapter *adapter; 446*f7917c00SJeff Kirsher unsigned int tcam_size; 447*f7917c00SJeff Kirsher unsigned char part_type; 448*f7917c00SJeff Kirsher unsigned char parity_enabled; 449*f7917c00SJeff Kirsher unsigned char mode; 450*f7917c00SJeff Kirsher struct mc5_stats stats; 451*f7917c00SJeff Kirsher }; 452*f7917c00SJeff Kirsher 453*f7917c00SJeff Kirsher static inline unsigned int t3_mc5_size(const struct mc5 *p) 454*f7917c00SJeff Kirsher { 455*f7917c00SJeff Kirsher return p->tcam_size; 456*f7917c00SJeff Kirsher } 457*f7917c00SJeff Kirsher 458*f7917c00SJeff Kirsher struct mc7 { 459*f7917c00SJeff Kirsher struct adapter *adapter; /* backpointer to adapter */ 460*f7917c00SJeff Kirsher unsigned int size; /* memory size in bytes */ 461*f7917c00SJeff Kirsher unsigned int width; /* MC7 interface width */ 462*f7917c00SJeff Kirsher unsigned int offset; /* register address offset for MC7 instance */ 463*f7917c00SJeff Kirsher const char *name; /* name of MC7 instance */ 464*f7917c00SJeff Kirsher struct mc7_stats stats; /* MC7 statistics */ 465*f7917c00SJeff Kirsher }; 466*f7917c00SJeff Kirsher 467*f7917c00SJeff Kirsher static inline unsigned int t3_mc7_size(const struct mc7 *p) 468*f7917c00SJeff Kirsher { 469*f7917c00SJeff Kirsher return p->size; 470*f7917c00SJeff Kirsher } 471*f7917c00SJeff Kirsher 472*f7917c00SJeff Kirsher struct cmac { 473*f7917c00SJeff Kirsher struct adapter *adapter; 474*f7917c00SJeff Kirsher unsigned int offset; 475*f7917c00SJeff Kirsher unsigned int nucast; /* # of address filters for unicast MACs */ 476*f7917c00SJeff Kirsher unsigned int tx_tcnt; 477*f7917c00SJeff Kirsher unsigned int tx_xcnt; 478*f7917c00SJeff Kirsher u64 tx_mcnt; 479*f7917c00SJeff Kirsher unsigned int rx_xcnt; 480*f7917c00SJeff Kirsher unsigned int rx_ocnt; 481*f7917c00SJeff Kirsher u64 rx_mcnt; 482*f7917c00SJeff Kirsher unsigned int toggle_cnt; 483*f7917c00SJeff Kirsher unsigned int txen; 484*f7917c00SJeff Kirsher u64 rx_pause; 485*f7917c00SJeff Kirsher struct mac_stats stats; 486*f7917c00SJeff Kirsher }; 487*f7917c00SJeff Kirsher 488*f7917c00SJeff Kirsher enum { 489*f7917c00SJeff Kirsher MAC_DIRECTION_RX = 1, 490*f7917c00SJeff Kirsher MAC_DIRECTION_TX = 2, 491*f7917c00SJeff Kirsher MAC_RXFIFO_SIZE = 32768 492*f7917c00SJeff Kirsher }; 493*f7917c00SJeff Kirsher 494*f7917c00SJeff Kirsher /* PHY loopback direction */ 495*f7917c00SJeff Kirsher enum { 496*f7917c00SJeff Kirsher PHY_LOOPBACK_TX = 1, 497*f7917c00SJeff Kirsher PHY_LOOPBACK_RX = 2 498*f7917c00SJeff Kirsher }; 499*f7917c00SJeff Kirsher 500*f7917c00SJeff Kirsher /* PHY interrupt types */ 501*f7917c00SJeff Kirsher enum { 502*f7917c00SJeff Kirsher cphy_cause_link_change = 1, 503*f7917c00SJeff Kirsher cphy_cause_fifo_error = 2, 504*f7917c00SJeff Kirsher cphy_cause_module_change = 4, 505*f7917c00SJeff Kirsher }; 506*f7917c00SJeff Kirsher 507*f7917c00SJeff Kirsher /* PHY module types */ 508*f7917c00SJeff Kirsher enum { 509*f7917c00SJeff Kirsher phy_modtype_none, 510*f7917c00SJeff Kirsher phy_modtype_sr, 511*f7917c00SJeff Kirsher phy_modtype_lr, 512*f7917c00SJeff Kirsher phy_modtype_lrm, 513*f7917c00SJeff Kirsher phy_modtype_twinax, 514*f7917c00SJeff Kirsher phy_modtype_twinax_long, 515*f7917c00SJeff Kirsher phy_modtype_unknown 516*f7917c00SJeff Kirsher }; 517*f7917c00SJeff Kirsher 518*f7917c00SJeff Kirsher /* PHY operations */ 519*f7917c00SJeff Kirsher struct cphy_ops { 520*f7917c00SJeff Kirsher int (*reset)(struct cphy *phy, int wait); 521*f7917c00SJeff Kirsher 522*f7917c00SJeff Kirsher int (*intr_enable)(struct cphy *phy); 523*f7917c00SJeff Kirsher int (*intr_disable)(struct cphy *phy); 524*f7917c00SJeff Kirsher int (*intr_clear)(struct cphy *phy); 525*f7917c00SJeff Kirsher int (*intr_handler)(struct cphy *phy); 526*f7917c00SJeff Kirsher 527*f7917c00SJeff Kirsher int (*autoneg_enable)(struct cphy *phy); 528*f7917c00SJeff Kirsher int (*autoneg_restart)(struct cphy *phy); 529*f7917c00SJeff Kirsher 530*f7917c00SJeff Kirsher int (*advertise)(struct cphy *phy, unsigned int advertise_map); 531*f7917c00SJeff Kirsher int (*set_loopback)(struct cphy *phy, int mmd, int dir, int enable); 532*f7917c00SJeff Kirsher int (*set_speed_duplex)(struct cphy *phy, int speed, int duplex); 533*f7917c00SJeff Kirsher int (*get_link_status)(struct cphy *phy, int *link_ok, int *speed, 534*f7917c00SJeff Kirsher int *duplex, int *fc); 535*f7917c00SJeff Kirsher int (*power_down)(struct cphy *phy, int enable); 536*f7917c00SJeff Kirsher 537*f7917c00SJeff Kirsher u32 mmds; 538*f7917c00SJeff Kirsher }; 539*f7917c00SJeff Kirsher enum { 540*f7917c00SJeff Kirsher EDC_OPT_AEL2005 = 0, 541*f7917c00SJeff Kirsher EDC_OPT_AEL2005_SIZE = 1084, 542*f7917c00SJeff Kirsher EDC_TWX_AEL2005 = 1, 543*f7917c00SJeff Kirsher EDC_TWX_AEL2005_SIZE = 1464, 544*f7917c00SJeff Kirsher EDC_TWX_AEL2020 = 2, 545*f7917c00SJeff Kirsher EDC_TWX_AEL2020_SIZE = 1628, 546*f7917c00SJeff Kirsher EDC_MAX_SIZE = EDC_TWX_AEL2020_SIZE, /* Max cache size */ 547*f7917c00SJeff Kirsher }; 548*f7917c00SJeff Kirsher 549*f7917c00SJeff Kirsher /* A PHY instance */ 550*f7917c00SJeff Kirsher struct cphy { 551*f7917c00SJeff Kirsher u8 modtype; /* PHY module type */ 552*f7917c00SJeff Kirsher short priv; /* scratch pad */ 553*f7917c00SJeff Kirsher unsigned int caps; /* PHY capabilities */ 554*f7917c00SJeff Kirsher struct adapter *adapter; /* associated adapter */ 555*f7917c00SJeff Kirsher const char *desc; /* PHY description */ 556*f7917c00SJeff Kirsher unsigned long fifo_errors; /* FIFO over/under-flows */ 557*f7917c00SJeff Kirsher const struct cphy_ops *ops; /* PHY operations */ 558*f7917c00SJeff Kirsher struct mdio_if_info mdio; 559*f7917c00SJeff Kirsher u16 phy_cache[EDC_MAX_SIZE]; /* EDC cache */ 560*f7917c00SJeff Kirsher }; 561*f7917c00SJeff Kirsher 562*f7917c00SJeff Kirsher /* Convenience MDIO read/write wrappers */ 563*f7917c00SJeff Kirsher static inline int t3_mdio_read(struct cphy *phy, int mmd, int reg, 564*f7917c00SJeff Kirsher unsigned int *valp) 565*f7917c00SJeff Kirsher { 566*f7917c00SJeff Kirsher int rc = phy->mdio.mdio_read(phy->mdio.dev, phy->mdio.prtad, mmd, reg); 567*f7917c00SJeff Kirsher *valp = (rc >= 0) ? rc : -1; 568*f7917c00SJeff Kirsher return (rc >= 0) ? 0 : rc; 569*f7917c00SJeff Kirsher } 570*f7917c00SJeff Kirsher 571*f7917c00SJeff Kirsher static inline int t3_mdio_write(struct cphy *phy, int mmd, int reg, 572*f7917c00SJeff Kirsher unsigned int val) 573*f7917c00SJeff Kirsher { 574*f7917c00SJeff Kirsher return phy->mdio.mdio_write(phy->mdio.dev, phy->mdio.prtad, mmd, 575*f7917c00SJeff Kirsher reg, val); 576*f7917c00SJeff Kirsher } 577*f7917c00SJeff Kirsher 578*f7917c00SJeff Kirsher /* Convenience initializer */ 579*f7917c00SJeff Kirsher static inline void cphy_init(struct cphy *phy, struct adapter *adapter, 580*f7917c00SJeff Kirsher int phy_addr, struct cphy_ops *phy_ops, 581*f7917c00SJeff Kirsher const struct mdio_ops *mdio_ops, 582*f7917c00SJeff Kirsher unsigned int caps, const char *desc) 583*f7917c00SJeff Kirsher { 584*f7917c00SJeff Kirsher phy->caps = caps; 585*f7917c00SJeff Kirsher phy->adapter = adapter; 586*f7917c00SJeff Kirsher phy->desc = desc; 587*f7917c00SJeff Kirsher phy->ops = phy_ops; 588*f7917c00SJeff Kirsher if (mdio_ops) { 589*f7917c00SJeff Kirsher phy->mdio.prtad = phy_addr; 590*f7917c00SJeff Kirsher phy->mdio.mmds = phy_ops->mmds; 591*f7917c00SJeff Kirsher phy->mdio.mode_support = mdio_ops->mode_support; 592*f7917c00SJeff Kirsher phy->mdio.mdio_read = mdio_ops->read; 593*f7917c00SJeff Kirsher phy->mdio.mdio_write = mdio_ops->write; 594*f7917c00SJeff Kirsher } 595*f7917c00SJeff Kirsher } 596*f7917c00SJeff Kirsher 597*f7917c00SJeff Kirsher /* Accumulate MAC statistics every 180 seconds. For 1G we multiply by 10. */ 598*f7917c00SJeff Kirsher #define MAC_STATS_ACCUM_SECS 180 599*f7917c00SJeff Kirsher 600*f7917c00SJeff Kirsher #define XGM_REG(reg_addr, idx) \ 601*f7917c00SJeff Kirsher ((reg_addr) + (idx) * (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR)) 602*f7917c00SJeff Kirsher 603*f7917c00SJeff Kirsher struct addr_val_pair { 604*f7917c00SJeff Kirsher unsigned int reg_addr; 605*f7917c00SJeff Kirsher unsigned int val; 606*f7917c00SJeff Kirsher }; 607*f7917c00SJeff Kirsher 608*f7917c00SJeff Kirsher #include "adapter.h" 609*f7917c00SJeff Kirsher 610*f7917c00SJeff Kirsher #ifndef PCI_VENDOR_ID_CHELSIO 611*f7917c00SJeff Kirsher # define PCI_VENDOR_ID_CHELSIO 0x1425 612*f7917c00SJeff Kirsher #endif 613*f7917c00SJeff Kirsher 614*f7917c00SJeff Kirsher #define for_each_port(adapter, iter) \ 615*f7917c00SJeff Kirsher for (iter = 0; iter < (adapter)->params.nports; ++iter) 616*f7917c00SJeff Kirsher 617*f7917c00SJeff Kirsher #define adapter_info(adap) ((adap)->params.info) 618*f7917c00SJeff Kirsher 619*f7917c00SJeff Kirsher static inline int uses_xaui(const struct adapter *adap) 620*f7917c00SJeff Kirsher { 621*f7917c00SJeff Kirsher return adapter_info(adap)->caps & SUPPORTED_AUI; 622*f7917c00SJeff Kirsher } 623*f7917c00SJeff Kirsher 624*f7917c00SJeff Kirsher static inline int is_10G(const struct adapter *adap) 625*f7917c00SJeff Kirsher { 626*f7917c00SJeff Kirsher return adapter_info(adap)->caps & SUPPORTED_10000baseT_Full; 627*f7917c00SJeff Kirsher } 628*f7917c00SJeff Kirsher 629*f7917c00SJeff Kirsher static inline int is_offload(const struct adapter *adap) 630*f7917c00SJeff Kirsher { 631*f7917c00SJeff Kirsher return adap->params.offload; 632*f7917c00SJeff Kirsher } 633*f7917c00SJeff Kirsher 634*f7917c00SJeff Kirsher static inline unsigned int core_ticks_per_usec(const struct adapter *adap) 635*f7917c00SJeff Kirsher { 636*f7917c00SJeff Kirsher return adap->params.vpd.cclk / 1000; 637*f7917c00SJeff Kirsher } 638*f7917c00SJeff Kirsher 639*f7917c00SJeff Kirsher static inline unsigned int is_pcie(const struct adapter *adap) 640*f7917c00SJeff Kirsher { 641*f7917c00SJeff Kirsher return adap->params.pci.variant == PCI_VARIANT_PCIE; 642*f7917c00SJeff Kirsher } 643*f7917c00SJeff Kirsher 644*f7917c00SJeff Kirsher void t3_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, 645*f7917c00SJeff Kirsher u32 val); 646*f7917c00SJeff Kirsher void t3_write_regs(struct adapter *adapter, const struct addr_val_pair *p, 647*f7917c00SJeff Kirsher int n, unsigned int offset); 648*f7917c00SJeff Kirsher int t3_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, 649*f7917c00SJeff Kirsher int polarity, int attempts, int delay, u32 *valp); 650*f7917c00SJeff Kirsher static inline int t3_wait_op_done(struct adapter *adapter, int reg, u32 mask, 651*f7917c00SJeff Kirsher int polarity, int attempts, int delay) 652*f7917c00SJeff Kirsher { 653*f7917c00SJeff Kirsher return t3_wait_op_done_val(adapter, reg, mask, polarity, attempts, 654*f7917c00SJeff Kirsher delay, NULL); 655*f7917c00SJeff Kirsher } 656*f7917c00SJeff Kirsher int t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsigned int clear, 657*f7917c00SJeff Kirsher unsigned int set); 658*f7917c00SJeff Kirsher int t3_phy_reset(struct cphy *phy, int mmd, int wait); 659*f7917c00SJeff Kirsher int t3_phy_advertise(struct cphy *phy, unsigned int advert); 660*f7917c00SJeff Kirsher int t3_phy_advertise_fiber(struct cphy *phy, unsigned int advert); 661*f7917c00SJeff Kirsher int t3_set_phy_speed_duplex(struct cphy *phy, int speed, int duplex); 662*f7917c00SJeff Kirsher int t3_phy_lasi_intr_enable(struct cphy *phy); 663*f7917c00SJeff Kirsher int t3_phy_lasi_intr_disable(struct cphy *phy); 664*f7917c00SJeff Kirsher int t3_phy_lasi_intr_clear(struct cphy *phy); 665*f7917c00SJeff Kirsher int t3_phy_lasi_intr_handler(struct cphy *phy); 666*f7917c00SJeff Kirsher 667*f7917c00SJeff Kirsher void t3_intr_enable(struct adapter *adapter); 668*f7917c00SJeff Kirsher void t3_intr_disable(struct adapter *adapter); 669*f7917c00SJeff Kirsher void t3_intr_clear(struct adapter *adapter); 670*f7917c00SJeff Kirsher void t3_xgm_intr_enable(struct adapter *adapter, int idx); 671*f7917c00SJeff Kirsher void t3_xgm_intr_disable(struct adapter *adapter, int idx); 672*f7917c00SJeff Kirsher void t3_port_intr_enable(struct adapter *adapter, int idx); 673*f7917c00SJeff Kirsher void t3_port_intr_disable(struct adapter *adapter, int idx); 674*f7917c00SJeff Kirsher int t3_slow_intr_handler(struct adapter *adapter); 675*f7917c00SJeff Kirsher int t3_phy_intr_handler(struct adapter *adapter); 676*f7917c00SJeff Kirsher 677*f7917c00SJeff Kirsher void t3_link_changed(struct adapter *adapter, int port_id); 678*f7917c00SJeff Kirsher void t3_link_fault(struct adapter *adapter, int port_id); 679*f7917c00SJeff Kirsher int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); 680*f7917c00SJeff Kirsher const struct adapter_info *t3_get_adapter_info(unsigned int board_id); 681*f7917c00SJeff Kirsher int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data); 682*f7917c00SJeff Kirsher int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data); 683*f7917c00SJeff Kirsher int t3_seeprom_wp(struct adapter *adapter, int enable); 684*f7917c00SJeff Kirsher int t3_get_tp_version(struct adapter *adapter, u32 *vers); 685*f7917c00SJeff Kirsher int t3_check_tpsram_version(struct adapter *adapter); 686*f7917c00SJeff Kirsher int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, 687*f7917c00SJeff Kirsher unsigned int size); 688*f7917c00SJeff Kirsher int t3_set_proto_sram(struct adapter *adap, const u8 *data); 689*f7917c00SJeff Kirsher int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size); 690*f7917c00SJeff Kirsher int t3_get_fw_version(struct adapter *adapter, u32 *vers); 691*f7917c00SJeff Kirsher int t3_check_fw_version(struct adapter *adapter); 692*f7917c00SJeff Kirsher int t3_init_hw(struct adapter *adapter, u32 fw_params); 693*f7917c00SJeff Kirsher int t3_reset_adapter(struct adapter *adapter); 694*f7917c00SJeff Kirsher int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, 695*f7917c00SJeff Kirsher int reset); 696*f7917c00SJeff Kirsher int t3_replay_prep_adapter(struct adapter *adapter); 697*f7917c00SJeff Kirsher void t3_led_ready(struct adapter *adapter); 698*f7917c00SJeff Kirsher void t3_fatal_err(struct adapter *adapter); 699*f7917c00SJeff Kirsher void t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on); 700*f7917c00SJeff Kirsher void t3_config_rss(struct adapter *adapter, unsigned int rss_config, 701*f7917c00SJeff Kirsher const u8 * cpus, const u16 *rspq); 702*f7917c00SJeff Kirsher int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, 703*f7917c00SJeff Kirsher unsigned int n, unsigned int *valp); 704*f7917c00SJeff Kirsher int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n, 705*f7917c00SJeff Kirsher u64 *buf); 706*f7917c00SJeff Kirsher 707*f7917c00SJeff Kirsher int t3_mac_reset(struct cmac *mac); 708*f7917c00SJeff Kirsher void t3b_pcs_reset(struct cmac *mac); 709*f7917c00SJeff Kirsher void t3_mac_disable_exact_filters(struct cmac *mac); 710*f7917c00SJeff Kirsher void t3_mac_enable_exact_filters(struct cmac *mac); 711*f7917c00SJeff Kirsher int t3_mac_enable(struct cmac *mac, int which); 712*f7917c00SJeff Kirsher int t3_mac_disable(struct cmac *mac, int which); 713*f7917c00SJeff Kirsher int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); 714*f7917c00SJeff Kirsher int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev); 715*f7917c00SJeff Kirsher int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); 716*f7917c00SJeff Kirsher int t3_mac_set_num_ucast(struct cmac *mac, int n); 717*f7917c00SJeff Kirsher const struct mac_stats *t3_mac_update_stats(struct cmac *mac); 718*f7917c00SJeff Kirsher int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); 719*f7917c00SJeff Kirsher int t3b2_mac_watchdog_task(struct cmac *mac); 720*f7917c00SJeff Kirsher 721*f7917c00SJeff Kirsher void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); 722*f7917c00SJeff Kirsher int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, 723*f7917c00SJeff Kirsher unsigned int nroutes); 724*f7917c00SJeff Kirsher void t3_mc5_intr_handler(struct mc5 *mc5); 725*f7917c00SJeff Kirsher 726*f7917c00SJeff Kirsher void t3_tp_set_offload_mode(struct adapter *adap, int enable); 727*f7917c00SJeff Kirsher void t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps); 728*f7917c00SJeff Kirsher void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS], 729*f7917c00SJeff Kirsher unsigned short alpha[NCCTRL_WIN], 730*f7917c00SJeff Kirsher unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap); 731*f7917c00SJeff Kirsher void t3_config_trace_filter(struct adapter *adapter, 732*f7917c00SJeff Kirsher const struct trace_params *tp, int filter_index, 733*f7917c00SJeff Kirsher int invert, int enable); 734*f7917c00SJeff Kirsher int t3_config_sched(struct adapter *adap, unsigned int kbps, int sched); 735*f7917c00SJeff Kirsher 736*f7917c00SJeff Kirsher void t3_sge_prep(struct adapter *adap, struct sge_params *p); 737*f7917c00SJeff Kirsher void t3_sge_init(struct adapter *adap, struct sge_params *p); 738*f7917c00SJeff Kirsher int t3_sge_init_ecntxt(struct adapter *adapter, unsigned int id, int gts_enable, 739*f7917c00SJeff Kirsher enum sge_context_type type, int respq, u64 base_addr, 740*f7917c00SJeff Kirsher unsigned int size, unsigned int token, int gen, 741*f7917c00SJeff Kirsher unsigned int cidx); 742*f7917c00SJeff Kirsher int t3_sge_init_flcntxt(struct adapter *adapter, unsigned int id, 743*f7917c00SJeff Kirsher int gts_enable, u64 base_addr, unsigned int size, 744*f7917c00SJeff Kirsher unsigned int esize, unsigned int cong_thres, int gen, 745*f7917c00SJeff Kirsher unsigned int cidx); 746*f7917c00SJeff Kirsher int t3_sge_init_rspcntxt(struct adapter *adapter, unsigned int id, 747*f7917c00SJeff Kirsher int irq_vec_idx, u64 base_addr, unsigned int size, 748*f7917c00SJeff Kirsher unsigned int fl_thres, int gen, unsigned int cidx); 749*f7917c00SJeff Kirsher int t3_sge_init_cqcntxt(struct adapter *adapter, unsigned int id, u64 base_addr, 750*f7917c00SJeff Kirsher unsigned int size, int rspq, int ovfl_mode, 751*f7917c00SJeff Kirsher unsigned int credits, unsigned int credit_thres); 752*f7917c00SJeff Kirsher int t3_sge_enable_ecntxt(struct adapter *adapter, unsigned int id, int enable); 753*f7917c00SJeff Kirsher int t3_sge_disable_fl(struct adapter *adapter, unsigned int id); 754*f7917c00SJeff Kirsher int t3_sge_disable_rspcntxt(struct adapter *adapter, unsigned int id); 755*f7917c00SJeff Kirsher int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id); 756*f7917c00SJeff Kirsher int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, 757*f7917c00SJeff Kirsher unsigned int credits); 758*f7917c00SJeff Kirsher 759*f7917c00SJeff Kirsher int t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, 760*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 761*f7917c00SJeff Kirsher int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, 762*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 763*f7917c00SJeff Kirsher int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, 764*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 765*f7917c00SJeff Kirsher int t3_ael2005_phy_prep(struct cphy *phy, struct adapter *adapter, 766*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 767*f7917c00SJeff Kirsher int t3_ael2020_phy_prep(struct cphy *phy, struct adapter *adapter, 768*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 769*f7917c00SJeff Kirsher int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr, 770*f7917c00SJeff Kirsher const struct mdio_ops *mdio_ops); 771*f7917c00SJeff Kirsher int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, 772*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 773*f7917c00SJeff Kirsher int t3_aq100x_phy_prep(struct cphy *phy, struct adapter *adapter, 774*f7917c00SJeff Kirsher int phy_addr, const struct mdio_ops *mdio_ops); 775*f7917c00SJeff Kirsher #endif /* __CHELSIO_COMMON_H */ 776