common.h revision 259142
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: stable/10/sys/dev/cxgbe/common/common.h 259142 2013-12-09 22:40:22Z 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; 241228561Snp unsigned short speed; 242228561Snp unsigned short width; 243218792Snp}; 244218792Snp 245218792Snp/* 246218792Snp * Firmware device log. 247218792Snp */ 248218792Snpstruct devlog_params { 249256791Snp u32 memtype; /* which memory (FW_MEMTYPE_* ) */ 250218792Snp u32 start; /* start of log in firmware memory */ 251218792Snp u32 size; /* size of log */ 252218792Snp}; 253218792Snp 254218792Snpstruct adapter_params { 255218792Snp struct tp_params tp; 256218792Snp struct vpd_params vpd; 257218792Snp struct pci_params pci; 258218792Snp struct devlog_params devlog; 259218792Snp 260218792Snp unsigned int sf_size; /* serial flash size in bytes */ 261218792Snp unsigned int sf_nsec; /* # of flash sectors */ 262218792Snp 263218792Snp unsigned int fw_vers; 264218792Snp unsigned int tp_vers; 265218792Snp 266218792Snp unsigned short mtus[NMTUS]; 267218792Snp unsigned short a_wnd[NCCTRL_WIN]; 268218792Snp unsigned short b_wnd[NCCTRL_WIN]; 269218792Snp 270228561Snp unsigned int mc_size; /* MC memory size */ 271228561Snp unsigned int nfilters; /* size of filter region */ 272218792Snp 273218792Snp unsigned int cim_la_size; 274218792Snp 275248925Snp uint8_t nports; /* # of ethernet ports */ 276248925Snp uint8_t portvec; 277248925Snp unsigned int chipid:4; /* chip ID. T4 = 4, T5 = 5, ... */ 278248925Snp unsigned int rev:4; /* chip revision */ 279248925Snp unsigned int fpga:1; /* this is an FPGA */ 280248925Snp unsigned int offload:1; /* hw is TOE capable, fw has divvied up card 281248925Snp resources for TOE operation. */ 282248925Snp unsigned int bypass:1; /* this is a bypass card */ 283218792Snp 284218792Snp unsigned int ofldq_wr_cred; 285218792Snp}; 286218792Snp 287248925Snp#define CHELSIO_T4 0x4 288248925Snp#define CHELSIO_T5 0x5 289218792Snp 290218792Snpstruct trace_params { 291218792Snp u32 data[TRACE_LEN / 4]; 292218792Snp u32 mask[TRACE_LEN / 4]; 293218792Snp unsigned short snap_len; 294218792Snp unsigned short min_len; 295218792Snp unsigned char skip_ofst; 296218792Snp unsigned char skip_len; 297218792Snp unsigned char invert; 298218792Snp unsigned char port; 299218792Snp}; 300218792Snp 301218792Snpstruct link_config { 302218792Snp unsigned short supported; /* link capabilities */ 303218792Snp unsigned short advertising; /* advertised capabilities */ 304218792Snp unsigned short requested_speed; /* speed user has requested */ 305218792Snp unsigned short speed; /* actual link speed */ 306218792Snp unsigned char requested_fc; /* flow control user has requested */ 307218792Snp unsigned char fc; /* actual link flow control */ 308218792Snp unsigned char autoneg; /* autonegotiating? */ 309218792Snp unsigned char link_ok; /* link up? */ 310218792Snp}; 311218792Snp 312218792Snp#include "adapter.h" 313218792Snp 314218792Snp#ifndef PCI_VENDOR_ID_CHELSIO 315218792Snp# define PCI_VENDOR_ID_CHELSIO 0x1425 316218792Snp#endif 317218792Snp 318218792Snp#define for_each_port(adapter, iter) \ 319218792Snp for (iter = 0; iter < (adapter)->params.nports; ++iter) 320218792Snp 321218792Snpstatic inline int is_offload(const struct adapter *adap) 322218792Snp{ 323218792Snp return adap->params.offload; 324218792Snp} 325218792Snp 326248925Snpstatic inline int chip_id(struct adapter *adap) 327248925Snp{ 328248925Snp return adap->params.chipid; 329248925Snp} 330248925Snp 331248925Snpstatic inline int chip_rev(struct adapter *adap) 332248925Snp{ 333248925Snp return adap->params.rev; 334248925Snp} 335248925Snp 336248925Snpstatic inline int is_t4(struct adapter *adap) 337248925Snp{ 338248925Snp return adap->params.chipid == CHELSIO_T4; 339248925Snp} 340248925Snp 341248925Snpstatic inline int is_t5(struct adapter *adap) 342248925Snp{ 343248925Snp return adap->params.chipid == CHELSIO_T5; 344248925Snp} 345248925Snp 346248925Snpstatic inline int is_fpga(struct adapter *adap) 347248925Snp{ 348248925Snp return adap->params.fpga; 349248925Snp} 350248925Snp 351218792Snpstatic inline unsigned int core_ticks_per_usec(const struct adapter *adap) 352218792Snp{ 353218792Snp return adap->params.vpd.cclk / 1000; 354218792Snp} 355218792Snp 356218792Snpstatic inline unsigned int us_to_core_ticks(const struct adapter *adap, 357218792Snp unsigned int us) 358218792Snp{ 359218792Snp return (us * adap->params.vpd.cclk) / 1000; 360218792Snp} 361218792Snp 362218792Snpstatic inline unsigned int dack_ticks_to_usec(const struct adapter *adap, 363218792Snp unsigned int ticks) 364218792Snp{ 365218792Snp return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap); 366218792Snp} 367218792Snp 368218792Snpvoid t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val); 369218792Snpint t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, 370218792Snp int attempts, int delay, u32 *valp); 371218792Snp 372218792Snpstatic inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask, 373218792Snp int polarity, int attempts, int delay) 374218792Snp{ 375218792Snp return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts, 376218792Snp delay, NULL); 377218792Snp} 378218792Snp 379218792Snpint t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, 380218792Snp void *rpl, bool sleep_ok); 381218792Snp 382218792Snpstatic inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd, 383218792Snp int size, void *rpl) 384218792Snp{ 385218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true); 386218792Snp} 387218792Snp 388218792Snpstatic inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, 389218792Snp int size, void *rpl) 390218792Snp{ 391218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false); 392218792Snp} 393218792Snp 394218792Snpvoid t4_read_indirect(struct adapter *adap, unsigned int addr_reg, 395218792Snp unsigned int data_reg, u32 *vals, unsigned int nregs, 396218792Snp unsigned int start_idx); 397218792Snpvoid t4_write_indirect(struct adapter *adap, unsigned int addr_reg, 398218792Snp unsigned int data_reg, const u32 *vals, 399218792Snp unsigned int nregs, unsigned int start_idx); 400218792Snp 401237436Snpu32 t4_hw_pci_read_cfg4(adapter_t *adapter, int reg); 402237436Snp 403218792Snpstruct fw_filter_wr; 404218792Snp 405218792Snpvoid t4_intr_enable(struct adapter *adapter); 406218792Snpvoid t4_intr_disable(struct adapter *adapter); 407218792Snpvoid t4_intr_clear(struct adapter *adapter); 408218792Snpint t4_slow_intr_handler(struct adapter *adapter); 409218792Snp 410218792Snpint t4_hash_mac_addr(const u8 *addr); 411218792Snpint t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port, 412218792Snp struct link_config *lc); 413218792Snpint t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); 414218792Snpint t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); 415218792Snpint t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data); 416218792Snpint t4_eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz); 417218792Snpint t4_seeprom_wp(struct adapter *adapter, int enable); 418218792Snpint t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, 419218792Snp u32 *data, int byte_oriented); 420218792Snpint t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); 421237436Snpint t4_load_boot(struct adapter *adap, u8 *boot_data, 422228561Snp unsigned int boot_addr, unsigned int size); 423250090Snpint t4_flash_cfg_addr(struct adapter *adapter); 424218792Snpint t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); 425218792Snpint t4_get_fw_version(struct adapter *adapter, u32 *vers); 426218792Snpint t4_get_tp_version(struct adapter *adapter, u32 *vers); 427218792Snpint t4_check_fw_version(struct adapter *adapter); 428218792Snpint t4_init_hw(struct adapter *adapter, u32 fw_params); 429218792Snpint t4_prep_adapter(struct adapter *adapter); 430252705Snpint t4_init_tp_params(struct adapter *adap); 431252705Snpint t4_filter_field_shift(const struct adapter *adap, int filter_sel); 432218792Snpint t4_port_init(struct port_info *p, int mbox, int pf, int vf); 433218792Snpint t4_reinit_adapter(struct adapter *adap); 434218792Snpvoid t4_fatal_err(struct adapter *adapter); 435218792Snpint t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, 436218792Snp int filter_index, int enable); 437218792Snpvoid t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, 438218792Snp int filter_index, int *enabled); 439218792Snpint t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, 440218792Snp int start, int n, const u16 *rspq, unsigned int nrspq); 441218792Snpint t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, 442218792Snp unsigned int flags); 443218792Snpint t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid, 444218792Snp unsigned int flags, unsigned int defq); 445218792Snpint t4_read_rss(struct adapter *adapter, u16 *entries); 446218792Snpvoid t4_read_rss_key(struct adapter *adapter, u32 *key); 447218792Snpvoid t4_write_rss_key(struct adapter *adap, const u32 *key, int idx); 448218792Snpvoid t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); 449218792Snpvoid t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); 450218792Snpvoid t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, 451218792Snp u32 *vfl, u32 *vfh); 452218792Snpvoid t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, 453218792Snp u32 vfl, u32 vfh); 454218792Snpu32 t4_read_rss_pf_map(struct adapter *adapter); 455218792Snpvoid t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap); 456218792Snpu32 t4_read_rss_pf_mask(struct adapter *adapter); 457218792Snpvoid t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask); 458218792Snpint t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); 459218792Snpvoid t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 460218792Snpvoid t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 461218792Snpvoid t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres); 462218792Snpint t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 463218792Snpint t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 464218792Snpint t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, 465218792Snp unsigned int *valp); 466218792Snpint t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, 467218792Snp const unsigned int *valp); 468218792Snpint t4_cim_ctl_read(struct adapter *adap, unsigned int addr, unsigned int n, 469218792Snp unsigned int *valp); 470218792Snpint t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr); 471218792Snpvoid t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp, 472218792Snp unsigned int *pif_req_wrptr, unsigned int *pif_rsp_wrptr); 473218792Snpvoid t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp); 474248925Snpint t4_mc_read(struct adapter *adap, int idx, u32 addr, 475248925Snp __be32 *data, u64 *parity); 476218792Snpint t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); 477218792Snpint t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size, 478218792Snp __be32 *data); 479218792Snp 480218792Snpvoid t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); 481237436Snpvoid t4_get_port_stats_offset(struct adapter *adap, int idx, 482237436Snp struct port_stats *stats, 483237436Snp struct port_stats *offset); 484218792Snpvoid t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); 485218792Snpvoid t4_clr_port_stats(struct adapter *adap, int idx); 486218792Snp 487218792Snpvoid t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); 488218792Snpvoid t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); 489218792Snpvoid t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]); 490218792Snpvoid t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, 491218792Snp unsigned int *ipg); 492218792Snpvoid t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, 493218792Snp unsigned int mask, unsigned int val); 494218792Snpvoid t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); 495218792Snpvoid t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); 496218792Snpvoid t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st); 497218792Snpvoid t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st); 498218792Snpvoid t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st); 499218792Snpvoid t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st); 500218792Snpvoid t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, 501218792Snp struct tp_tcp_stats *v6); 502218792Snpvoid t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, 503218792Snp struct tp_fcoe_stats *st); 504218792Snpvoid t4_load_mtus(struct adapter *adap, const unsigned short *mtus, 505218792Snp const unsigned short *alpha, const unsigned short *beta); 506218792Snp 507218792Snpvoid t4_ulprx_read_la(struct adapter *adap, u32 *la_buf); 508218792Snp 509218792Snpint t4_set_sched_bps(struct adapter *adap, int sched, unsigned int kbps); 510218792Snpint t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg); 511218792Snpint t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, 512218792Snp unsigned int start, unsigned int n); 513218792Snpvoid t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); 514218792Snpint t4_set_filter_mode(struct adapter *adap, unsigned int mode_map); 515218792Snpvoid t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); 516218792Snp 517218792Snpvoid t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); 518218792Snpint t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map, 519218792Snp u64 mask0, u64 mask1, unsigned int crc, bool enable); 520218792Snp 521218792Snpint t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, 522218792Snp enum dev_master master, enum dev_state *state); 523218792Snpint t4_fw_bye(struct adapter *adap, unsigned int mbox); 524218792Snpint t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); 525237436Snpint t4_fw_halt(struct adapter *adap, unsigned int mbox, int force); 526237436Snpint t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); 527237436Snpint t4_fw_upgrade(struct adapter *adap, unsigned int mbox, 528237436Snp const u8 *fw_data, unsigned int size, int force); 529228561Snpint t4_fw_initialize(struct adapter *adap, unsigned int mbox); 530218792Snpint t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 531218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 532218792Snp u32 *val); 533218792Snpint t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 534218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 535218792Snp const u32 *val); 536218792Snpint t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, 537218792Snp unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl, 538218792Snp unsigned int rxqi, unsigned int rxq, unsigned int tc, 539218792Snp unsigned int vi, unsigned int cmask, unsigned int pmask, 540218792Snp unsigned int exactf, unsigned int rcaps, unsigned int wxcaps); 541237436Snpint t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, 542237436Snp unsigned int port, unsigned int pf, unsigned int vf, 543237436Snp unsigned int nmac, u8 *mac, unsigned int *rss_size, 544237436Snp unsigned int portfunc, unsigned int idstype); 545218792Snpint t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, 546218792Snp unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, 547218792Snp unsigned int *rss_size); 548218792Snpint t4_free_vi(struct adapter *adap, unsigned int mbox, 549218792Snp unsigned int pf, unsigned int vf, 550218792Snp unsigned int viid); 551218792Snpint t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 552218792Snp int mtu, int promisc, int all_multi, int bcast, int vlanex, 553218792Snp bool sleep_ok); 554218792Snpint t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, 555218792Snp bool free, unsigned int naddr, const u8 **addr, u16 *idx, 556218792Snp u64 *hash, bool sleep_ok); 557218792Snpint t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, 558218792Snp int idx, const u8 *addr, bool persist, bool add_smt); 559218792Snpint t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, 560218792Snp bool ucast, u64 vec, bool sleep_ok); 561218792Snpint t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, 562218792Snp bool rx_en, bool tx_en); 563218792Snpint t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, 564218792Snp unsigned int nblinks); 565241399Snpint t4_i2c_rd(struct adapter *adap, unsigned int mbox, unsigned int port_id, 566241399Snp u8 dev_addr, u8 offset, u8 *valp); 567218792Snpint t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 568218792Snp unsigned int mmd, unsigned int reg, unsigned int *valp); 569218792Snpint t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 570218792Snp unsigned int mmd, unsigned int reg, unsigned int val); 571218792Snpint t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, 572218792Snp unsigned int pf, unsigned int vf, unsigned int iqid, 573218792Snp unsigned int fl0id, unsigned int fl1id); 574218792Snpint t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 575218792Snp unsigned int vf, unsigned int iqtype, unsigned int iqid, 576218792Snp unsigned int fl0id, unsigned int fl1id); 577218792Snpint t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 578218792Snp unsigned int vf, unsigned int eqid); 579218792Snpint t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 580218792Snp unsigned int vf, unsigned int eqid); 581218792Snpint t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 582218792Snp unsigned int vf, unsigned int eqid); 583218792Snpint t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid, 584218792Snp enum ctxt_type ctype, u32 *data); 585218792Snpint t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, 586218792Snp u32 *data); 587237436Snpint t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); 588218792Snpint t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); 589237436Snpint t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); 590259142Snpint t4_sched_config(struct adapter *adapter, int type, int minmaxen); 591259142Snpint t4_sched_params(struct adapter *adapter, int type, int level, int mode, 592259142Snp int rateunit, int ratemode, int channel, int cl, 593259142Snp int minrate, int maxrate, int weight, int pktsize); 594218792Snp#endif /* __CHELSIO_COMMON_H */ 595