1218792Snp/*- 2218792Snp * Copyright (c) 2011 Chelsio Communications, Inc. 3218792Snp * All rights reserved. 4218792Snp * 5218792Snp * Redistribution and use in source and binary forms, with or without 6218792Snp * modification, are permitted provided that the following conditions 7218792Snp * are met: 8218792Snp * 1. Redistributions of source code must retain the above copyright 9218792Snp * notice, this list of conditions and the following disclaimer. 10218792Snp * 2. Redistributions in binary form must reproduce the above copyright 11218792Snp * notice, this list of conditions and the following disclaimer in the 12218792Snp * documentation and/or other materials provided with the distribution. 13218792Snp * 14218792Snp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15218792Snp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16218792Snp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17218792Snp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18218792Snp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19218792Snp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20218792Snp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21218792Snp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22218792Snp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23218792Snp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24218792Snp * SUCH DAMAGE. 25218792Snp * 26218792Snp * $FreeBSD: releng/10.3/sys/dev/cxgbe/common/common.h 275092 2014-11-26 00:44:48Z np $ 27218792Snp * 28218792Snp */ 29218792Snp 30218792Snp#ifndef __CHELSIO_COMMON_H 31218792Snp#define __CHELSIO_COMMON_H 32218792Snp 33218792Snp#include "t4_hw.h" 34218792Snp 35218792Snp 36218792Snpenum { 37218792Snp MAX_NPORTS = 4, /* max # of ports */ 38218792Snp SERNUM_LEN = 24, /* Serial # length */ 39218792Snp EC_LEN = 16, /* E/C length */ 40218792Snp ID_LEN = 16, /* ID length */ 41237436Snp PN_LEN = 16, /* Part Number length */ 42237436Snp MACADDR_LEN = 12, /* MAC Address length */ 43218792Snp}; 44218792Snp 45248925Snpenum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 }; 46218792Snp 47228561Snpenum { 48228561Snp MEMWIN0_APERTURE = 2048, 49228561Snp MEMWIN0_BASE = 0x1b800, 50228561Snp MEMWIN1_APERTURE = 32768, 51228561Snp MEMWIN1_BASE = 0x28000, 52248925Snp 53248925Snp MEMWIN2_APERTURE_T4 = 65536, 54248925Snp MEMWIN2_BASE_T4 = 0x30000, 55248925Snp 56248925Snp MEMWIN2_APERTURE_T5 = 128 * 1024, 57248925Snp MEMWIN2_BASE_T5 = 0x60000, 58228561Snp}; 59228561Snp 60218792Snpenum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; 61218792Snp 62218792Snpenum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR }; 63218792Snp 64218792Snpenum { 65218792Snp PAUSE_RX = 1 << 0, 66218792Snp PAUSE_TX = 1 << 1, 67218792Snp PAUSE_AUTONEG = 1 << 2 68218792Snp}; 69218792Snp 70248925Snpstruct memwin { 71248925Snp uint32_t base; 72248925Snp uint32_t aperture; 73248925Snp}; 74248925Snp 75218792Snpstruct port_stats { 76218792Snp u64 tx_octets; /* total # of octets in good frames */ 77218792Snp u64 tx_frames; /* all good frames */ 78218792Snp u64 tx_bcast_frames; /* all broadcast frames */ 79218792Snp u64 tx_mcast_frames; /* all multicast frames */ 80218792Snp u64 tx_ucast_frames; /* all unicast frames */ 81218792Snp u64 tx_error_frames; /* all error frames */ 82218792Snp 83218792Snp u64 tx_frames_64; /* # of Tx frames in a particular range */ 84218792Snp u64 tx_frames_65_127; 85218792Snp u64 tx_frames_128_255; 86218792Snp u64 tx_frames_256_511; 87218792Snp u64 tx_frames_512_1023; 88218792Snp u64 tx_frames_1024_1518; 89218792Snp u64 tx_frames_1519_max; 90218792Snp 91218792Snp u64 tx_drop; /* # of dropped Tx frames */ 92218792Snp u64 tx_pause; /* # of transmitted pause frames */ 93218792Snp u64 tx_ppp0; /* # of transmitted PPP prio 0 frames */ 94218792Snp u64 tx_ppp1; /* # of transmitted PPP prio 1 frames */ 95218792Snp u64 tx_ppp2; /* # of transmitted PPP prio 2 frames */ 96218792Snp u64 tx_ppp3; /* # of transmitted PPP prio 3 frames */ 97218792Snp u64 tx_ppp4; /* # of transmitted PPP prio 4 frames */ 98218792Snp u64 tx_ppp5; /* # of transmitted PPP prio 5 frames */ 99218792Snp u64 tx_ppp6; /* # of transmitted PPP prio 6 frames */ 100218792Snp u64 tx_ppp7; /* # of transmitted PPP prio 7 frames */ 101218792Snp 102218792Snp u64 rx_octets; /* total # of octets in good frames */ 103218792Snp u64 rx_frames; /* all good frames */ 104218792Snp u64 rx_bcast_frames; /* all broadcast frames */ 105218792Snp u64 rx_mcast_frames; /* all multicast frames */ 106218792Snp u64 rx_ucast_frames; /* all unicast frames */ 107218792Snp u64 rx_too_long; /* # of frames exceeding MTU */ 108218792Snp u64 rx_jabber; /* # of jabber frames */ 109218792Snp u64 rx_fcs_err; /* # of received frames with bad FCS */ 110218792Snp u64 rx_len_err; /* # of received frames with length error */ 111218792Snp u64 rx_symbol_err; /* symbol errors */ 112218792Snp u64 rx_runt; /* # of short frames */ 113218792Snp 114218792Snp u64 rx_frames_64; /* # of Rx frames in a particular range */ 115218792Snp u64 rx_frames_65_127; 116218792Snp u64 rx_frames_128_255; 117218792Snp u64 rx_frames_256_511; 118218792Snp u64 rx_frames_512_1023; 119218792Snp u64 rx_frames_1024_1518; 120218792Snp u64 rx_frames_1519_max; 121218792Snp 122218792Snp u64 rx_pause; /* # of received pause frames */ 123218792Snp u64 rx_ppp0; /* # of received PPP prio 0 frames */ 124218792Snp u64 rx_ppp1; /* # of received PPP prio 1 frames */ 125218792Snp u64 rx_ppp2; /* # of received PPP prio 2 frames */ 126218792Snp u64 rx_ppp3; /* # of received PPP prio 3 frames */ 127218792Snp u64 rx_ppp4; /* # of received PPP prio 4 frames */ 128218792Snp u64 rx_ppp5; /* # of received PPP prio 5 frames */ 129218792Snp u64 rx_ppp6; /* # of received PPP prio 6 frames */ 130218792Snp u64 rx_ppp7; /* # of received PPP prio 7 frames */ 131218792Snp 132218792Snp u64 rx_ovflow0; /* drops due to buffer-group 0 overflows */ 133218792Snp u64 rx_ovflow1; /* drops due to buffer-group 1 overflows */ 134218792Snp u64 rx_ovflow2; /* drops due to buffer-group 2 overflows */ 135218792Snp u64 rx_ovflow3; /* drops due to buffer-group 3 overflows */ 136218792Snp u64 rx_trunc0; /* buffer-group 0 truncated packets */ 137218792Snp u64 rx_trunc1; /* buffer-group 1 truncated packets */ 138218792Snp u64 rx_trunc2; /* buffer-group 2 truncated packets */ 139218792Snp u64 rx_trunc3; /* buffer-group 3 truncated packets */ 140218792Snp}; 141218792Snp 142218792Snpstruct lb_port_stats { 143218792Snp u64 octets; 144218792Snp u64 frames; 145218792Snp u64 bcast_frames; 146218792Snp u64 mcast_frames; 147218792Snp u64 ucast_frames; 148218792Snp u64 error_frames; 149218792Snp 150218792Snp u64 frames_64; 151218792Snp u64 frames_65_127; 152218792Snp u64 frames_128_255; 153218792Snp u64 frames_256_511; 154218792Snp u64 frames_512_1023; 155218792Snp u64 frames_1024_1518; 156218792Snp u64 frames_1519_max; 157218792Snp 158218792Snp u64 drop; 159218792Snp 160218792Snp u64 ovflow0; 161218792Snp u64 ovflow1; 162218792Snp u64 ovflow2; 163218792Snp u64 ovflow3; 164218792Snp u64 trunc0; 165218792Snp u64 trunc1; 166218792Snp u64 trunc2; 167218792Snp u64 trunc3; 168218792Snp}; 169218792Snp 170218792Snpstruct tp_tcp_stats { 171218792Snp u32 tcpOutRsts; 172218792Snp u64 tcpInSegs; 173218792Snp u64 tcpOutSegs; 174218792Snp u64 tcpRetransSegs; 175218792Snp}; 176218792Snp 177218792Snpstruct tp_usm_stats { 178218792Snp u32 frames; 179218792Snp u32 drops; 180218792Snp u64 octets; 181218792Snp}; 182218792Snp 183218792Snpstruct tp_fcoe_stats { 184218792Snp u32 framesDDP; 185218792Snp u32 framesDrop; 186218792Snp u64 octetsDDP; 187218792Snp}; 188218792Snp 189218792Snpstruct tp_err_stats { 190218792Snp u32 macInErrs[4]; 191218792Snp u32 hdrInErrs[4]; 192218792Snp u32 tcpInErrs[4]; 193218792Snp u32 tnlCongDrops[4]; 194218792Snp u32 ofldChanDrops[4]; 195218792Snp u32 tnlTxDrops[4]; 196218792Snp u32 ofldVlanDrops[4]; 197218792Snp u32 tcp6InErrs[4]; 198218792Snp u32 ofldNoNeigh; 199218792Snp u32 ofldCongDefer; 200218792Snp}; 201218792Snp 202218792Snpstruct tp_proxy_stats { 203218792Snp u32 proxy[4]; 204218792Snp}; 205218792Snp 206218792Snpstruct tp_cpl_stats { 207218792Snp u32 req[4]; 208218792Snp u32 rsp[4]; 209218792Snp}; 210218792Snp 211218792Snpstruct tp_rdma_stats { 212218792Snp u32 rqe_dfr_mod; 213218792Snp u32 rqe_dfr_pkt; 214218792Snp}; 215218792Snp 216218792Snpstruct tp_params { 217218792Snp unsigned int ntxchan; /* # of Tx channels */ 218218792Snp unsigned int tre; /* log2 of core clocks per TP tick */ 219218792Snp unsigned int dack_re; /* DACK timer resolution */ 220218792Snp unsigned int la_mask; /* what events are recorded by TP LA */ 221218792Snp unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */ 222252705Snp uint32_t vlan_pri_map; 223252705Snp uint32_t ingress_config; 224252705Snp int8_t vlan_shift; 225252705Snp int8_t vnic_shift; 226252705Snp int8_t port_shift; 227252705Snp int8_t protocol_shift; 228218792Snp}; 229218792Snp 230218792Snpstruct vpd_params { 231218792Snp unsigned int cclk; 232218792Snp u8 ec[EC_LEN + 1]; 233218792Snp u8 sn[SERNUM_LEN + 1]; 234218792Snp u8 id[ID_LEN + 1]; 235237436Snp u8 pn[PN_LEN + 1]; 236237436Snp u8 na[MACADDR_LEN + 1]; 237218792Snp}; 238218792Snp 239218792Snpstruct pci_params { 240228561Snp unsigned int vpd_cap_addr; 241275092Snp unsigned int mps; 242228561Snp unsigned short speed; 243228561Snp unsigned short width; 244218792Snp}; 245218792Snp 246218792Snp/* 247218792Snp * Firmware device log. 248218792Snp */ 249218792Snpstruct devlog_params { 250256791Snp u32 memtype; /* which memory (FW_MEMTYPE_* ) */ 251218792Snp u32 start; /* start of log in firmware memory */ 252218792Snp u32 size; /* size of log */ 253218792Snp}; 254218792Snp 255218792Snpstruct adapter_params { 256218792Snp struct tp_params tp; 257218792Snp struct vpd_params vpd; 258218792Snp struct pci_params pci; 259218792Snp struct devlog_params devlog; 260218792Snp 261218792Snp unsigned int sf_size; /* serial flash size in bytes */ 262218792Snp unsigned int sf_nsec; /* # of flash sectors */ 263218792Snp 264218792Snp unsigned int fw_vers; 265218792Snp unsigned int tp_vers; 266218792Snp 267218792Snp unsigned short mtus[NMTUS]; 268218792Snp unsigned short a_wnd[NCCTRL_WIN]; 269218792Snp unsigned short b_wnd[NCCTRL_WIN]; 270218792Snp 271265426Snp u_int ftid_min; 272265426Snp u_int ftid_max; 273265426Snp u_int etid_min; 274265426Snp u_int netids; 275218792Snp 276218792Snp unsigned int cim_la_size; 277218792Snp 278248925Snp uint8_t nports; /* # of ethernet ports */ 279248925Snp uint8_t portvec; 280248925Snp unsigned int chipid:4; /* chip ID. T4 = 4, T5 = 5, ... */ 281248925Snp unsigned int rev:4; /* chip revision */ 282248925Snp unsigned int fpga:1; /* this is an FPGA */ 283248925Snp unsigned int offload:1; /* hw is TOE capable, fw has divvied up card 284248925Snp resources for TOE operation. */ 285248925Snp unsigned int bypass:1; /* this is a bypass card */ 286265426Snp unsigned int ethoffload:1; 287218792Snp 288218792Snp unsigned int ofldq_wr_cred; 289265426Snp unsigned int eo_wr_cred; 290218792Snp}; 291218792Snp 292248925Snp#define CHELSIO_T4 0x4 293248925Snp#define CHELSIO_T5 0x5 294218792Snp 295218792Snpstruct trace_params { 296218792Snp u32 data[TRACE_LEN / 4]; 297218792Snp u32 mask[TRACE_LEN / 4]; 298218792Snp unsigned short snap_len; 299218792Snp unsigned short min_len; 300218792Snp unsigned char skip_ofst; 301218792Snp unsigned char skip_len; 302218792Snp unsigned char invert; 303218792Snp unsigned char port; 304218792Snp}; 305218792Snp 306218792Snpstruct link_config { 307218792Snp unsigned short supported; /* link capabilities */ 308218792Snp unsigned short advertising; /* advertised capabilities */ 309218792Snp unsigned short requested_speed; /* speed user has requested */ 310218792Snp unsigned short speed; /* actual link speed */ 311218792Snp unsigned char requested_fc; /* flow control user has requested */ 312218792Snp unsigned char fc; /* actual link flow control */ 313218792Snp unsigned char autoneg; /* autonegotiating? */ 314218792Snp unsigned char link_ok; /* link up? */ 315218792Snp}; 316218792Snp 317218792Snp#include "adapter.h" 318218792Snp 319218792Snp#ifndef PCI_VENDOR_ID_CHELSIO 320218792Snp# define PCI_VENDOR_ID_CHELSIO 0x1425 321218792Snp#endif 322218792Snp 323218792Snp#define for_each_port(adapter, iter) \ 324218792Snp for (iter = 0; iter < (adapter)->params.nports; ++iter) 325218792Snp 326265426Snpstatic inline int is_ftid(const struct adapter *sc, u_int tid) 327265426Snp{ 328265426Snp 329265426Snp return (tid >= sc->params.ftid_min && tid <= sc->params.ftid_max); 330265426Snp} 331265426Snp 332265426Snpstatic inline int is_etid(const struct adapter *sc, u_int tid) 333265426Snp{ 334265426Snp 335265426Snp return (tid >= sc->params.etid_min); 336265426Snp} 337265426Snp 338218792Snpstatic inline int is_offload(const struct adapter *adap) 339218792Snp{ 340218792Snp return adap->params.offload; 341218792Snp} 342218792Snp 343265426Snpstatic inline int is_ethoffload(const struct adapter *adap) 344265426Snp{ 345265426Snp return adap->params.ethoffload; 346265426Snp} 347265426Snp 348248925Snpstatic inline int chip_id(struct adapter *adap) 349248925Snp{ 350248925Snp return adap->params.chipid; 351248925Snp} 352248925Snp 353248925Snpstatic inline int chip_rev(struct adapter *adap) 354248925Snp{ 355248925Snp return adap->params.rev; 356248925Snp} 357248925Snp 358248925Snpstatic inline int is_t4(struct adapter *adap) 359248925Snp{ 360248925Snp return adap->params.chipid == CHELSIO_T4; 361248925Snp} 362248925Snp 363248925Snpstatic inline int is_t5(struct adapter *adap) 364248925Snp{ 365248925Snp return adap->params.chipid == CHELSIO_T5; 366248925Snp} 367248925Snp 368248925Snpstatic inline int is_fpga(struct adapter *adap) 369248925Snp{ 370248925Snp return adap->params.fpga; 371248925Snp} 372248925Snp 373218792Snpstatic inline unsigned int core_ticks_per_usec(const struct adapter *adap) 374218792Snp{ 375218792Snp return adap->params.vpd.cclk / 1000; 376218792Snp} 377218792Snp 378218792Snpstatic inline unsigned int us_to_core_ticks(const struct adapter *adap, 379218792Snp unsigned int us) 380218792Snp{ 381218792Snp return (us * adap->params.vpd.cclk) / 1000; 382218792Snp} 383218792Snp 384218792Snpstatic inline unsigned int dack_ticks_to_usec(const struct adapter *adap, 385218792Snp unsigned int ticks) 386218792Snp{ 387218792Snp return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap); 388218792Snp} 389218792Snp 390218792Snpvoid t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val); 391218792Snpint t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, 392218792Snp int attempts, int delay, u32 *valp); 393218792Snp 394218792Snpstatic inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask, 395218792Snp int polarity, int attempts, int delay) 396218792Snp{ 397218792Snp return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts, 398218792Snp delay, NULL); 399218792Snp} 400218792Snp 401218792Snpint t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, 402218792Snp void *rpl, bool sleep_ok); 403218792Snp 404218792Snpstatic inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd, 405218792Snp int size, void *rpl) 406218792Snp{ 407218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true); 408218792Snp} 409218792Snp 410218792Snpstatic inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, 411218792Snp int size, void *rpl) 412218792Snp{ 413218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false); 414218792Snp} 415218792Snp 416218792Snpvoid t4_read_indirect(struct adapter *adap, unsigned int addr_reg, 417218792Snp unsigned int data_reg, u32 *vals, unsigned int nregs, 418218792Snp unsigned int start_idx); 419218792Snpvoid t4_write_indirect(struct adapter *adap, unsigned int addr_reg, 420218792Snp unsigned int data_reg, const u32 *vals, 421218792Snp unsigned int nregs, unsigned int start_idx); 422218792Snp 423237436Snpu32 t4_hw_pci_read_cfg4(adapter_t *adapter, int reg); 424237436Snp 425218792Snpstruct fw_filter_wr; 426218792Snp 427218792Snpvoid t4_intr_enable(struct adapter *adapter); 428218792Snpvoid t4_intr_disable(struct adapter *adapter); 429218792Snpvoid t4_intr_clear(struct adapter *adapter); 430218792Snpint t4_slow_intr_handler(struct adapter *adapter); 431218792Snp 432218792Snpint t4_hash_mac_addr(const u8 *addr); 433218792Snpint t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port, 434218792Snp struct link_config *lc); 435218792Snpint t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); 436218792Snpint t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); 437218792Snpint t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data); 438218792Snpint t4_eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz); 439218792Snpint t4_seeprom_wp(struct adapter *adapter, int enable); 440218792Snpint t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, 441218792Snp u32 *data, int byte_oriented); 442218792Snpint t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); 443237436Snpint t4_load_boot(struct adapter *adap, u8 *boot_data, 444228561Snp unsigned int boot_addr, unsigned int size); 445250090Snpint t4_flash_cfg_addr(struct adapter *adapter); 446218792Snpint t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); 447218792Snpint t4_get_fw_version(struct adapter *adapter, u32 *vers); 448218792Snpint t4_get_tp_version(struct adapter *adapter, u32 *vers); 449218792Snpint t4_check_fw_version(struct adapter *adapter); 450218792Snpint t4_init_hw(struct adapter *adapter, u32 fw_params); 451218792Snpint t4_prep_adapter(struct adapter *adapter); 452252705Snpint t4_init_tp_params(struct adapter *adap); 453252705Snpint t4_filter_field_shift(const struct adapter *adap, int filter_sel); 454218792Snpint t4_port_init(struct port_info *p, int mbox, int pf, int vf); 455218792Snpint t4_reinit_adapter(struct adapter *adap); 456218792Snpvoid t4_fatal_err(struct adapter *adapter); 457218792Snpint t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, 458218792Snp int filter_index, int enable); 459218792Snpvoid t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, 460218792Snp int filter_index, int *enabled); 461218792Snpint t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, 462218792Snp int start, int n, const u16 *rspq, unsigned int nrspq); 463218792Snpint t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, 464218792Snp unsigned int flags); 465218792Snpint t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid, 466218792Snp unsigned int flags, unsigned int defq); 467218792Snpint t4_read_rss(struct adapter *adapter, u16 *entries); 468218792Snpvoid t4_read_rss_key(struct adapter *adapter, u32 *key); 469218792Snpvoid t4_write_rss_key(struct adapter *adap, const u32 *key, int idx); 470218792Snpvoid t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); 471218792Snpvoid t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); 472218792Snpvoid t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, 473218792Snp u32 *vfl, u32 *vfh); 474218792Snpvoid t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, 475218792Snp u32 vfl, u32 vfh); 476218792Snpu32 t4_read_rss_pf_map(struct adapter *adapter); 477218792Snpvoid t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap); 478218792Snpu32 t4_read_rss_pf_mask(struct adapter *adapter); 479218792Snpvoid t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask); 480218792Snpint t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); 481218792Snpvoid t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 482218792Snpvoid t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 483218792Snpvoid t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres); 484218792Snpint t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 485218792Snpint t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 486218792Snpint t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, 487218792Snp unsigned int *valp); 488218792Snpint t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, 489218792Snp const unsigned int *valp); 490218792Snpint t4_cim_ctl_read(struct adapter *adap, unsigned int addr, unsigned int n, 491218792Snp unsigned int *valp); 492218792Snpint t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr); 493218792Snpvoid t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp, 494218792Snp unsigned int *pif_req_wrptr, unsigned int *pif_rsp_wrptr); 495218792Snpvoid t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp); 496248925Snpint t4_mc_read(struct adapter *adap, int idx, u32 addr, 497248925Snp __be32 *data, u64 *parity); 498218792Snpint t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); 499218792Snpint t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size, 500218792Snp __be32 *data); 501218792Snp 502218792Snpvoid t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); 503237436Snpvoid t4_get_port_stats_offset(struct adapter *adap, int idx, 504237436Snp struct port_stats *stats, 505237436Snp struct port_stats *offset); 506218792Snpvoid t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); 507218792Snpvoid t4_clr_port_stats(struct adapter *adap, int idx); 508218792Snp 509218792Snpvoid t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); 510218792Snpvoid t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); 511218792Snpvoid t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]); 512218792Snpvoid t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, 513218792Snp unsigned int *ipg); 514218792Snpvoid t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, 515218792Snp unsigned int mask, unsigned int val); 516218792Snpvoid t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); 517218792Snpvoid t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); 518218792Snpvoid t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st); 519218792Snpvoid t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st); 520218792Snpvoid t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st); 521218792Snpvoid t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st); 522218792Snpvoid t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, 523218792Snp struct tp_tcp_stats *v6); 524218792Snpvoid t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, 525218792Snp struct tp_fcoe_stats *st); 526218792Snpvoid t4_load_mtus(struct adapter *adap, const unsigned short *mtus, 527218792Snp const unsigned short *alpha, const unsigned short *beta); 528218792Snp 529218792Snpvoid t4_ulprx_read_la(struct adapter *adap, u32 *la_buf); 530218792Snp 531218792Snpint t4_set_sched_bps(struct adapter *adap, int sched, unsigned int kbps); 532218792Snpint t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg); 533218792Snpint t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, 534218792Snp unsigned int start, unsigned int n); 535218792Snpvoid t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); 536218792Snpint t4_set_filter_mode(struct adapter *adap, unsigned int mode_map); 537218792Snpvoid t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); 538218792Snp 539218792Snpvoid t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); 540218792Snpint t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map, 541218792Snp u64 mask0, u64 mask1, unsigned int crc, bool enable); 542218792Snp 543218792Snpint t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, 544218792Snp enum dev_master master, enum dev_state *state); 545218792Snpint t4_fw_bye(struct adapter *adap, unsigned int mbox); 546218792Snpint t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); 547237436Snpint t4_fw_halt(struct adapter *adap, unsigned int mbox, int force); 548237436Snpint t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); 549237436Snpint t4_fw_upgrade(struct adapter *adap, unsigned int mbox, 550237436Snp const u8 *fw_data, unsigned int size, int force); 551228561Snpint t4_fw_initialize(struct adapter *adap, unsigned int mbox); 552218792Snpint t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 553218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 554218792Snp u32 *val); 555218792Snpint t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 556218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 557218792Snp const u32 *val); 558218792Snpint t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, 559218792Snp unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl, 560218792Snp unsigned int rxqi, unsigned int rxq, unsigned int tc, 561218792Snp unsigned int vi, unsigned int cmask, unsigned int pmask, 562218792Snp unsigned int exactf, unsigned int rcaps, unsigned int wxcaps); 563237436Snpint t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, 564237436Snp unsigned int port, unsigned int pf, unsigned int vf, 565270297Snp unsigned int nmac, u8 *mac, u16 *rss_size, 566237436Snp unsigned int portfunc, unsigned int idstype); 567218792Snpint t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, 568218792Snp unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, 569270297Snp u16 *rss_size); 570218792Snpint t4_free_vi(struct adapter *adap, unsigned int mbox, 571218792Snp unsigned int pf, unsigned int vf, 572218792Snp unsigned int viid); 573218792Snpint t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 574218792Snp int mtu, int promisc, int all_multi, int bcast, int vlanex, 575218792Snp bool sleep_ok); 576218792Snpint t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, 577218792Snp bool free, unsigned int naddr, const u8 **addr, u16 *idx, 578218792Snp u64 *hash, bool sleep_ok); 579218792Snpint t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, 580218792Snp int idx, const u8 *addr, bool persist, bool add_smt); 581218792Snpint t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, 582218792Snp bool ucast, u64 vec, bool sleep_ok); 583218792Snpint t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, 584218792Snp bool rx_en, bool tx_en); 585218792Snpint t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, 586218792Snp unsigned int nblinks); 587218792Snpint t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 588218792Snp unsigned int mmd, unsigned int reg, unsigned int *valp); 589218792Snpint t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 590218792Snp unsigned int mmd, unsigned int reg, unsigned int val); 591269082Snpint t4_i2c_rd(struct adapter *adap, unsigned int mbox, 592269082Snp int port, unsigned int devid, 593269082Snp unsigned int offset, unsigned int len, 594269082Snp u8 *buf); 595269082Snpint t4_i2c_wr(struct adapter *adap, unsigned int mbox, 596269082Snp int port, unsigned int devid, 597269082Snp unsigned int offset, unsigned int len, 598269082Snp u8 *buf); 599218792Snpint t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, 600218792Snp unsigned int pf, unsigned int vf, unsigned int iqid, 601218792Snp unsigned int fl0id, unsigned int fl1id); 602218792Snpint t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 603218792Snp unsigned int vf, unsigned int iqtype, unsigned int iqid, 604218792Snp unsigned int fl0id, unsigned int fl1id); 605218792Snpint t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 606218792Snp unsigned int vf, unsigned int eqid); 607218792Snpint t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 608218792Snp unsigned int vf, unsigned int eqid); 609218792Snpint t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 610218792Snp unsigned int vf, unsigned int eqid); 611218792Snpint t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid, 612218792Snp enum ctxt_type ctype, u32 *data); 613218792Snpint t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, 614218792Snp u32 *data); 615237436Snpint t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); 616218792Snpint t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); 617237436Snpint t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); 618270297Snpint t4_sched_config(struct adapter *adapter, int type, int minmaxen, 619270297Snp int sleep_ok); 620259142Snpint t4_sched_params(struct adapter *adapter, int type, int level, int mode, 621259142Snp int rateunit, int ratemode, int channel, int cl, 622270297Snp int minrate, int maxrate, int weight, int pktsize, 623270297Snp int sleep_ok); 624218792Snp#endif /* __CHELSIO_COMMON_H */ 625