2 * Copyright (c) 2005-2008 Chelsio, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 #ifndef __CHELSIO_COMMON_H
33 #define __CHELSIO_COMMON_H
35 #include <linux/kernel.h>
36 #include <linux/types.h>
37 #include <linux/ctype.h>
38 #include <linux/delay.h>
39 #include <linux/init.h>
40 #include <linux/netdevice.h>
41 #include <linux/ethtool.h>
42 #include <linux/mii.h>
45 #define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ## __VA_ARGS__)
46 #define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ## __VA_ARGS__)
47 #define CH_ALERT(adap, fmt, ...) \
48 dev_printk(KERN_ALERT, &adap->pdev->dev, fmt, ## __VA_ARGS__)
51 * More powerful macro that selectively prints messages based on msg_enable.
52 * For info and debugging messages.
54 #define CH_MSG(adapter, level, category, fmt, ...) do { \
55 if ((adapter)->msg_enable & NETIF_MSG_##category) \
56 dev_printk(KERN_##level, &adapter->pdev->dev, fmt, \
61 # define CH_DBG(adapter, category, fmt, ...) \
62 CH_MSG(adapter, DEBUG, category, fmt, ## __VA_ARGS__)
64 # define CH_DBG(adapter, category, fmt, ...)
67 /* Additional NETIF_MSG_* categories */
68 #define NETIF_MSG_MMIO 0x8000000
71 struct net_device
*dev
;
72 struct dev_mc_list
*mclist
;
76 static inline void init_rx_mode(struct t3_rx_mode
*p
, struct net_device
*dev
,
77 struct dev_mc_list
*mclist
)
84 static inline u8
*t3_get_next_mcaddr(struct t3_rx_mode
*rm
)
88 if (rm
->mclist
&& rm
->idx
< rm
->dev
->mc_count
) {
89 addr
= rm
->mclist
->dmi_addr
;
90 rm
->mclist
= rm
->mclist
->next
;
97 MAX_NPORTS
= 2, /* max # of ports */
98 MAX_FRAME_SIZE
= 10240, /* max MAC frame size, including header + FCS */
99 EEPROMSIZE
= 8192, /* Serial EEPROM size */
100 SERNUM_LEN
= 16, /* Serial # length */
101 RSS_TABLE_SIZE
= 64, /* size of RSS lookup and mapping tables */
102 TCB_SIZE
= 128, /* TCB size */
103 NMTUS
= 16, /* size of MTU table */
104 NCCTRL_WIN
= 32, /* # of congestion control windows */
105 PROTO_SRAM_LINES
= 128, /* size of TP sram */
108 #define MAX_RX_COALESCING_LEN 12288U
113 PAUSE_AUTONEG
= 1 << 2
117 SUPPORTED_IRQ
= 1 << 24
120 enum { /* adapter interrupt-maintained statistics */
121 STAT_ULP_CH0_PBL_OOB
,
122 STAT_ULP_CH1_PBL_OOB
,
125 IRQ_NUM_STATS
/* keep last */
129 TP_VERSION_MAJOR
= 1,
130 TP_VERSION_MINOR
= 1,
134 #define S_TP_VERSION_MAJOR 16
135 #define M_TP_VERSION_MAJOR 0xFF
136 #define V_TP_VERSION_MAJOR(x) ((x) << S_TP_VERSION_MAJOR)
137 #define G_TP_VERSION_MAJOR(x) \
138 (((x) >> S_TP_VERSION_MAJOR) & M_TP_VERSION_MAJOR)
140 #define S_TP_VERSION_MINOR 8
141 #define M_TP_VERSION_MINOR 0xFF
142 #define V_TP_VERSION_MINOR(x) ((x) << S_TP_VERSION_MINOR)
143 #define G_TP_VERSION_MINOR(x) \
144 (((x) >> S_TP_VERSION_MINOR) & M_TP_VERSION_MINOR)
146 #define S_TP_VERSION_MICRO 0
147 #define M_TP_VERSION_MICRO 0xFF
148 #define V_TP_VERSION_MICRO(x) ((x) << S_TP_VERSION_MICRO)
149 #define G_TP_VERSION_MICRO(x) \
150 (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO)
153 SGE_QSETS
= 8, /* # of SGE Tx/Rx/RspQ sets */
154 SGE_RXQ_PER_SET
= 2, /* # of Rx queues per set */
155 SGE_TXQ_PER_SET
= 3 /* # of Tx queues per set */
158 enum sge_context_type
{ /* SGE egress context types */
166 AN_PKT_SIZE
= 32, /* async notification packet size */
167 IMMED_PKT_SIZE
= 48 /* packet size for immediate data */
170 struct sg_ent
{ /* SGE scatter/gather entry */
175 #ifndef SGE_NUM_GENBITS
177 # define SGE_NUM_GENBITS 2
180 #define TX_DESC_FLITS 16U
181 #define WR_FLITS (TX_DESC_FLITS + 1 - SGE_NUM_GENBITS)
187 int (*read
)(struct adapter
*adapter
, int phy_addr
, int mmd_addr
,
188 int reg_addr
, unsigned int *val
);
189 int (*write
)(struct adapter
*adapter
, int phy_addr
, int mmd_addr
,
190 int reg_addr
, unsigned int val
);
193 struct adapter_info
{
194 unsigned char nports
; /* # of ports */
195 unsigned char phy_base_addr
; /* MDIO PHY base address */
196 unsigned int gpio_out
; /* GPIO output settings */
197 unsigned char gpio_intr
[MAX_NPORTS
]; /* GPIO PHY IRQ pins */
198 unsigned long caps
; /* adapter capabilities */
199 const struct mdio_ops
*mdio_ops
; /* MDIO operations */
200 const char *desc
; /* product description */
204 unsigned long parity_err
;
205 unsigned long active_rgn_full
;
206 unsigned long nfa_srch_err
;
207 unsigned long unknown_cmd
;
208 unsigned long reqq_parity_err
;
209 unsigned long dispq_parity_err
;
210 unsigned long del_act_empty
;
214 unsigned long corr_err
;
215 unsigned long uncorr_err
;
216 unsigned long parity_err
;
217 unsigned long addr_err
;
221 u64 tx_octets
; /* total # of octets in good frames */
222 u64 tx_octets_bad
; /* total # of octets in error frames */
223 u64 tx_frames
; /* all good frames */
224 u64 tx_mcast_frames
; /* good multicast frames */
225 u64 tx_bcast_frames
; /* good broadcast frames */
226 u64 tx_pause
; /* # of transmitted pause frames */
227 u64 tx_deferred
; /* frames with deferred transmissions */
228 u64 tx_late_collisions
; /* # of late collisions */
229 u64 tx_total_collisions
; /* # of total collisions */
230 u64 tx_excess_collisions
; /* frame errors from excessive collissions */
231 u64 tx_underrun
; /* # of Tx FIFO underruns */
232 u64 tx_len_errs
; /* # of Tx length errors */
233 u64 tx_mac_internal_errs
; /* # of internal MAC errors on Tx */
234 u64 tx_excess_deferral
; /* # of frames with excessive deferral */
235 u64 tx_fcs_errs
; /* # of frames with bad FCS */
237 u64 tx_frames_64
; /* # of Tx frames in a particular range */
238 u64 tx_frames_65_127
;
239 u64 tx_frames_128_255
;
240 u64 tx_frames_256_511
;
241 u64 tx_frames_512_1023
;
242 u64 tx_frames_1024_1518
;
243 u64 tx_frames_1519_max
;
245 u64 rx_octets
; /* total # of octets in good frames */
246 u64 rx_octets_bad
; /* total # of octets in error frames */
247 u64 rx_frames
; /* all good frames */
248 u64 rx_mcast_frames
; /* good multicast frames */
249 u64 rx_bcast_frames
; /* good broadcast frames */
250 u64 rx_pause
; /* # of received pause frames */
251 u64 rx_fcs_errs
; /* # of received frames with bad FCS */
252 u64 rx_align_errs
; /* alignment errors */
253 u64 rx_symbol_errs
; /* symbol errors */
254 u64 rx_data_errs
; /* data errors */
255 u64 rx_sequence_errs
; /* sequence errors */
256 u64 rx_runt
; /* # of runt frames */
257 u64 rx_jabber
; /* # of jabber frames */
258 u64 rx_short
; /* # of short frames */
259 u64 rx_too_long
; /* # of oversized frames */
260 u64 rx_mac_internal_errs
; /* # of internal MAC errors on Rx */
262 u64 rx_frames_64
; /* # of Rx frames in a particular range */
263 u64 rx_frames_65_127
;
264 u64 rx_frames_128_255
;
265 u64 rx_frames_256_511
;
266 u64 rx_frames_512_1023
;
267 u64 rx_frames_1024_1518
;
268 u64 rx_frames_1519_max
;
270 u64 rx_cong_drops
; /* # of Rx drops due to SGE congestion */
272 unsigned long tx_fifo_parity_err
;
273 unsigned long rx_fifo_parity_err
;
274 unsigned long tx_fifo_urun
;
275 unsigned long rx_fifo_ovfl
;
276 unsigned long serdes_signal_loss
;
277 unsigned long xaui_pcs_ctc_err
;
278 unsigned long xaui_pcs_align_change
;
280 unsigned long num_toggled
; /* # times toggled TxEn due to stuck TX */
281 unsigned long num_resets
; /* # times reset due to stuck TX */
285 struct tp_mib_stats
{
288 u32 ipInHdrErrors_hi
;
289 u32 ipInHdrErrors_lo
;
290 u32 ipInAddrErrors_hi
;
291 u32 ipInAddrErrors_lo
;
292 u32 ipInUnknownProtos_hi
;
293 u32 ipInUnknownProtos_lo
;
298 u32 ipOutRequests_hi
;
299 u32 ipOutRequests_lo
;
300 u32 ipOutDiscards_hi
;
301 u32 ipOutDiscards_lo
;
302 u32 ipOutNoRoutes_hi
;
303 u32 ipOutNoRoutes_lo
;
321 u32 tcpRetransSeg_hi
;
322 u32 tcpRetransSeg_lo
;
330 unsigned int nchan
; /* # of channels */
331 unsigned int pmrx_size
; /* total PMRX capacity */
332 unsigned int pmtx_size
; /* total PMTX capacity */
333 unsigned int cm_size
; /* total CM capacity */
334 unsigned int chan_rx_size
; /* per channel Rx size */
335 unsigned int chan_tx_size
; /* per channel Tx size */
336 unsigned int rx_pg_size
; /* Rx page size */
337 unsigned int tx_pg_size
; /* Tx page size */
338 unsigned int rx_num_pgs
; /* # of Rx pages */
339 unsigned int tx_num_pgs
; /* # of Tx pages */
340 unsigned int ntimer_qs
; /* # of timer queues */
343 struct qset_params
{ /* SGE queue set parameters */
344 unsigned int polling
; /* polling/interrupt service for rspq */
345 unsigned int lro
; /* large receive offload */
346 unsigned int coalesce_usecs
; /* irq coalescing timer */
347 unsigned int rspq_size
; /* # of entries in response queue */
348 unsigned int fl_size
; /* # of entries in regular free list */
349 unsigned int jumbo_size
; /* # of entries in jumbo free list */
350 unsigned int txq_size
[SGE_TXQ_PER_SET
]; /* Tx queue sizes */
351 unsigned int cong_thres
; /* FL congestion threshold */
352 unsigned int vector
; /* Interrupt (line or vector) number */
356 unsigned int max_pkt_size
; /* max offload pkt size */
357 struct qset_params qset
[SGE_QSETS
];
361 unsigned int mode
; /* selects MC5 width */
362 unsigned int nservers
; /* size of server region */
363 unsigned int nfilters
; /* size of filter region */
364 unsigned int nroutes
; /* size of routing region */
367 /* Default MC5 region sizes */
369 DEFAULT_NSERVERS
= 512,
370 DEFAULT_NFILTERS
= 128
373 /* MC5 modes, these must be non-0 */
375 MC5_MODE_144_BIT
= 1,
379 /* MC5 min active region size */
380 enum { MC5_MIN_TIDS
= 16 };
387 unsigned int mem_timing
;
388 u8 sn
[SERNUM_LEN
+ 1];
390 u8 port_type
[MAX_NPORTS
];
391 unsigned short xauicfg
[2];
395 unsigned int vpd_cap_addr
;
396 unsigned int pcie_cap_addr
;
397 unsigned short speed
;
399 unsigned char variant
;
404 PCI_VARIANT_PCIX_MODE1_PARITY
,
405 PCI_VARIANT_PCIX_MODE1_ECC
,
406 PCI_VARIANT_PCIX_266_MODE2
,
410 struct adapter_params
{
411 struct sge_params sge
;
412 struct mc5_params mc5
;
414 struct vpd_params vpd
;
415 struct pci_params pci
;
417 const struct adapter_info
*info
;
419 unsigned short mtus
[NMTUS
];
420 unsigned short a_wnd
[NCCTRL_WIN
];
421 unsigned short b_wnd
[NCCTRL_WIN
];
423 unsigned int nports
; /* # of ethernet ports */
424 unsigned int stats_update_period
; /* MAC stats accumulation period */
425 unsigned int linkpoll_period
; /* link poll period in 0.1s */
426 unsigned int rev
; /* chip revision */
427 unsigned int offload
;
430 enum { /* chip revisions */
437 struct trace_params
{
455 unsigned int supported
; /* link capabilities */
456 unsigned int advertising
; /* advertised capabilities */
457 unsigned short requested_speed
; /* speed user has requested */
458 unsigned short speed
; /* actual link speed */
459 unsigned char requested_duplex
; /* duplex user has requested */
460 unsigned char duplex
; /* actual link duplex */
461 unsigned char requested_fc
; /* flow control user has requested */
462 unsigned char fc
; /* actual link flow control */
463 unsigned char autoneg
; /* autonegotiating? */
464 unsigned int link_ok
; /* link up? */
467 #define SPEED_INVALID 0xffff
468 #define DUPLEX_INVALID 0xff
471 struct adapter
*adapter
;
472 unsigned int tcam_size
;
473 unsigned char part_type
;
474 unsigned char parity_enabled
;
476 struct mc5_stats stats
;
479 static inline unsigned int t3_mc5_size(const struct mc5
*p
)
485 struct adapter
*adapter
; /* backpointer to adapter */
486 unsigned int size
; /* memory size in bytes */
487 unsigned int width
; /* MC7 interface width */
488 unsigned int offset
; /* register address offset for MC7 instance */
489 const char *name
; /* name of MC7 instance */
490 struct mc7_stats stats
; /* MC7 statistics */
493 static inline unsigned int t3_mc7_size(const struct mc7
*p
)
499 struct adapter
*adapter
;
501 unsigned int nucast
; /* # of address filters for unicast MACs */
502 unsigned int tx_tcnt
;
503 unsigned int tx_xcnt
;
505 unsigned int rx_xcnt
;
506 unsigned int rx_ocnt
;
508 unsigned int toggle_cnt
;
511 struct mac_stats stats
;
515 MAC_DIRECTION_RX
= 1,
516 MAC_DIRECTION_TX
= 2,
517 MAC_RXFIFO_SIZE
= 32768
520 /* IEEE 802.3 specified MDIO devices */
522 MDIO_DEV_PMA_PMD
= 1,
531 /* LASI control and status registers */
533 RX_ALARM_CTRL
= 0x9000,
534 TX_ALARM_CTRL
= 0x9001,
536 RX_ALARM_STAT
= 0x9003,
537 TX_ALARM_STAT
= 0x9004,
541 /* PHY loopback direction */
547 /* PHY interrupt types */
549 cphy_cause_link_change
= 1,
550 cphy_cause_fifo_error
= 2,
551 cphy_cause_module_change
= 4,
554 /* PHY module types */
561 phy_modtype_twinax_long
,
567 int (*reset
)(struct cphy
*phy
, int wait
);
569 int (*intr_enable
)(struct cphy
*phy
);
570 int (*intr_disable
)(struct cphy
*phy
);
571 int (*intr_clear
)(struct cphy
*phy
);
572 int (*intr_handler
)(struct cphy
*phy
);
574 int (*autoneg_enable
)(struct cphy
*phy
);
575 int (*autoneg_restart
)(struct cphy
*phy
);
577 int (*advertise
)(struct cphy
*phy
, unsigned int advertise_map
);
578 int (*set_loopback
)(struct cphy
*phy
, int mmd
, int dir
, int enable
);
579 int (*set_speed_duplex
)(struct cphy
*phy
, int speed
, int duplex
);
580 int (*get_link_status
)(struct cphy
*phy
, int *link_ok
, int *speed
,
581 int *duplex
, int *fc
);
582 int (*power_down
)(struct cphy
*phy
, int enable
);
587 u8 addr
; /* PHY address */
588 u8 modtype
; /* PHY module type */
589 short priv
; /* scratch pad */
590 unsigned int caps
; /* PHY capabilities */
591 struct adapter
*adapter
; /* associated adapter */
592 const char *desc
; /* PHY description */
593 unsigned long fifo_errors
; /* FIFO over/under-flows */
594 const struct cphy_ops
*ops
; /* PHY operations */
595 int (*mdio_read
)(struct adapter
*adapter
, int phy_addr
, int mmd_addr
,
596 int reg_addr
, unsigned int *val
);
597 int (*mdio_write
)(struct adapter
*adapter
, int phy_addr
, int mmd_addr
,
598 int reg_addr
, unsigned int val
);
601 /* Convenience MDIO read/write wrappers */
602 static inline int mdio_read(struct cphy
*phy
, int mmd
, int reg
,
605 return phy
->mdio_read(phy
->adapter
, phy
->addr
, mmd
, reg
, valp
);
608 static inline int mdio_write(struct cphy
*phy
, int mmd
, int reg
,
611 return phy
->mdio_write(phy
->adapter
, phy
->addr
, mmd
, reg
, val
);
614 /* Convenience initializer */
615 static inline void cphy_init(struct cphy
*phy
, struct adapter
*adapter
,
616 int phy_addr
, struct cphy_ops
*phy_ops
,
617 const struct mdio_ops
*mdio_ops
,
618 unsigned int caps
, const char *desc
)
620 phy
->addr
= phy_addr
;
622 phy
->adapter
= adapter
;
626 phy
->mdio_read
= mdio_ops
->read
;
627 phy
->mdio_write
= mdio_ops
->write
;
631 /* Accumulate MAC statistics every 180 seconds. For 1G we multiply by 10. */
632 #define MAC_STATS_ACCUM_SECS 180
634 #define XGM_REG(reg_addr, idx) \
635 ((reg_addr) + (idx) * (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR))
637 struct addr_val_pair
{
638 unsigned int reg_addr
;
644 #ifndef PCI_VENDOR_ID_CHELSIO
645 # define PCI_VENDOR_ID_CHELSIO 0x1425
648 #define for_each_port(adapter, iter) \
649 for (iter = 0; iter < (adapter)->params.nports; ++iter)
651 #define adapter_info(adap) ((adap)->params.info)
653 static inline int uses_xaui(const struct adapter
*adap
)
655 return adapter_info(adap
)->caps
& SUPPORTED_AUI
;
658 static inline int is_10G(const struct adapter
*adap
)
660 return adapter_info(adap
)->caps
& SUPPORTED_10000baseT_Full
;
663 static inline int is_offload(const struct adapter
*adap
)
665 return adap
->params
.offload
;
668 static inline unsigned int core_ticks_per_usec(const struct adapter
*adap
)
670 return adap
->params
.vpd
.cclk
/ 1000;
673 static inline unsigned int is_pcie(const struct adapter
*adap
)
675 return adap
->params
.pci
.variant
== PCI_VARIANT_PCIE
;
678 void t3_set_reg_field(struct adapter
*adap
, unsigned int addr
, u32 mask
,
680 void t3_write_regs(struct adapter
*adapter
, const struct addr_val_pair
*p
,
681 int n
, unsigned int offset
);
682 int t3_wait_op_done_val(struct adapter
*adapter
, int reg
, u32 mask
,
683 int polarity
, int attempts
, int delay
, u32
*valp
);
684 static inline int t3_wait_op_done(struct adapter
*adapter
, int reg
, u32 mask
,
685 int polarity
, int attempts
, int delay
)
687 return t3_wait_op_done_val(adapter
, reg
, mask
, polarity
, attempts
,
690 int t3_mdio_change_bits(struct cphy
*phy
, int mmd
, int reg
, unsigned int clear
,
692 int t3_phy_reset(struct cphy
*phy
, int mmd
, int wait
);
693 int t3_phy_advertise(struct cphy
*phy
, unsigned int advert
);
694 int t3_phy_advertise_fiber(struct cphy
*phy
, unsigned int advert
);
695 int t3_set_phy_speed_duplex(struct cphy
*phy
, int speed
, int duplex
);
696 int t3_phy_lasi_intr_enable(struct cphy
*phy
);
697 int t3_phy_lasi_intr_disable(struct cphy
*phy
);
698 int t3_phy_lasi_intr_clear(struct cphy
*phy
);
699 int t3_phy_lasi_intr_handler(struct cphy
*phy
);
701 void t3_intr_enable(struct adapter
*adapter
);
702 void t3_intr_disable(struct adapter
*adapter
);
703 void t3_intr_clear(struct adapter
*adapter
);
704 void t3_port_intr_enable(struct adapter
*adapter
, int idx
);
705 void t3_port_intr_disable(struct adapter
*adapter
, int idx
);
706 void t3_port_intr_clear(struct adapter
*adapter
, int idx
);
707 int t3_slow_intr_handler(struct adapter
*adapter
);
708 int t3_phy_intr_handler(struct adapter
*adapter
);
710 void t3_link_changed(struct adapter
*adapter
, int port_id
);
711 int t3_link_start(struct cphy
*phy
, struct cmac
*mac
, struct link_config
*lc
);
712 const struct adapter_info
*t3_get_adapter_info(unsigned int board_id
);
713 int t3_seeprom_read(struct adapter
*adapter
, u32 addr
, __le32
*data
);
714 int t3_seeprom_write(struct adapter
*adapter
, u32 addr
, __le32 data
);
715 int t3_seeprom_wp(struct adapter
*adapter
, int enable
);
716 int t3_get_tp_version(struct adapter
*adapter
, u32
*vers
);
717 int t3_check_tpsram_version(struct adapter
*adapter
);
718 int t3_check_tpsram(struct adapter
*adapter
, const u8
*tp_ram
,
720 int t3_set_proto_sram(struct adapter
*adap
, const u8
*data
);
721 int t3_read_flash(struct adapter
*adapter
, unsigned int addr
,
722 unsigned int nwords
, u32
*data
, int byte_oriented
);
723 int t3_load_fw(struct adapter
*adapter
, const u8
* fw_data
, unsigned int size
);
724 int t3_get_fw_version(struct adapter
*adapter
, u32
*vers
);
725 int t3_check_fw_version(struct adapter
*adapter
);
726 int t3_init_hw(struct adapter
*adapter
, u32 fw_params
);
727 void mac_prep(struct cmac
*mac
, struct adapter
*adapter
, int index
);
728 void early_hw_init(struct adapter
*adapter
, const struct adapter_info
*ai
);
729 int t3_reset_adapter(struct adapter
*adapter
);
730 int t3_prep_adapter(struct adapter
*adapter
, const struct adapter_info
*ai
,
732 int t3_replay_prep_adapter(struct adapter
*adapter
);
733 void t3_led_ready(struct adapter
*adapter
);
734 void t3_fatal_err(struct adapter
*adapter
);
735 void t3_set_vlan_accel(struct adapter
*adapter
, unsigned int ports
, int on
);
736 void t3_config_rss(struct adapter
*adapter
, unsigned int rss_config
,
737 const u8
* cpus
, const u16
*rspq
);
738 int t3_read_rss(struct adapter
*adapter
, u8
* lkup
, u16
*map
);
739 int t3_mps_set_active_ports(struct adapter
*adap
, unsigned int port_mask
);
740 int t3_cim_ctl_blk_read(struct adapter
*adap
, unsigned int addr
,
741 unsigned int n
, unsigned int *valp
);
742 int t3_mc7_bd_read(struct mc7
*mc7
, unsigned int start
, unsigned int n
,
745 int t3_mac_reset(struct cmac
*mac
);
746 void t3b_pcs_reset(struct cmac
*mac
);
747 int t3_mac_enable(struct cmac
*mac
, int which
);
748 int t3_mac_disable(struct cmac
*mac
, int which
);
749 int t3_mac_set_mtu(struct cmac
*mac
, unsigned int mtu
);
750 int t3_mac_set_rx_mode(struct cmac
*mac
, struct t3_rx_mode
*rm
);
751 int t3_mac_set_address(struct cmac
*mac
, unsigned int idx
, u8 addr
[6]);
752 int t3_mac_set_num_ucast(struct cmac
*mac
, int n
);
753 const struct mac_stats
*t3_mac_update_stats(struct cmac
*mac
);
754 int t3_mac_set_speed_duplex_fc(struct cmac
*mac
, int speed
, int duplex
, int fc
);
755 int t3b2_mac_watchdog_task(struct cmac
*mac
);
757 void t3_mc5_prep(struct adapter
*adapter
, struct mc5
*mc5
, int mode
);
758 int t3_mc5_init(struct mc5
*mc5
, unsigned int nservers
, unsigned int nfilters
,
759 unsigned int nroutes
);
760 void t3_mc5_intr_handler(struct mc5
*mc5
);
761 int t3_read_mc5_range(const struct mc5
*mc5
, unsigned int start
, unsigned int n
,
764 int t3_tp_set_coalescing_size(struct adapter
*adap
, unsigned int size
, int psh
);
765 void t3_tp_set_max_rxsize(struct adapter
*adap
, unsigned int size
);
766 void t3_tp_set_offload_mode(struct adapter
*adap
, int enable
);
767 void t3_tp_get_mib_stats(struct adapter
*adap
, struct tp_mib_stats
*tps
);
768 void t3_load_mtus(struct adapter
*adap
, unsigned short mtus
[NMTUS
],
769 unsigned short alpha
[NCCTRL_WIN
],
770 unsigned short beta
[NCCTRL_WIN
], unsigned short mtu_cap
);
771 void t3_read_hw_mtus(struct adapter
*adap
, unsigned short mtus
[NMTUS
]);
772 void t3_get_cong_cntl_tab(struct adapter
*adap
,
773 unsigned short incr
[NMTUS
][NCCTRL_WIN
]);
774 void t3_config_trace_filter(struct adapter
*adapter
,
775 const struct trace_params
*tp
, int filter_index
,
776 int invert
, int enable
);
777 int t3_config_sched(struct adapter
*adap
, unsigned int kbps
, int sched
);
779 void t3_sge_prep(struct adapter
*adap
, struct sge_params
*p
);
780 void t3_sge_init(struct adapter
*adap
, struct sge_params
*p
);
781 int t3_sge_init_ecntxt(struct adapter
*adapter
, unsigned int id
, int gts_enable
,
782 enum sge_context_type type
, int respq
, u64 base_addr
,
783 unsigned int size
, unsigned int token
, int gen
,
785 int t3_sge_init_flcntxt(struct adapter
*adapter
, unsigned int id
,
786 int gts_enable
, u64 base_addr
, unsigned int size
,
787 unsigned int esize
, unsigned int cong_thres
, int gen
,
789 int t3_sge_init_rspcntxt(struct adapter
*adapter
, unsigned int id
,
790 int irq_vec_idx
, u64 base_addr
, unsigned int size
,
791 unsigned int fl_thres
, int gen
, unsigned int cidx
);
792 int t3_sge_init_cqcntxt(struct adapter
*adapter
, unsigned int id
, u64 base_addr
,
793 unsigned int size
, int rspq
, int ovfl_mode
,
794 unsigned int credits
, unsigned int credit_thres
);
795 int t3_sge_enable_ecntxt(struct adapter
*adapter
, unsigned int id
, int enable
);
796 int t3_sge_disable_fl(struct adapter
*adapter
, unsigned int id
);
797 int t3_sge_disable_rspcntxt(struct adapter
*adapter
, unsigned int id
);
798 int t3_sge_disable_cqcntxt(struct adapter
*adapter
, unsigned int id
);
799 int t3_sge_read_ecntxt(struct adapter
*adapter
, unsigned int id
, u32 data
[4]);
800 int t3_sge_read_fl(struct adapter
*adapter
, unsigned int id
, u32 data
[4]);
801 int t3_sge_read_cq(struct adapter
*adapter
, unsigned int id
, u32 data
[4]);
802 int t3_sge_read_rspq(struct adapter
*adapter
, unsigned int id
, u32 data
[4]);
803 int t3_sge_cqcntxt_op(struct adapter
*adapter
, unsigned int id
, unsigned int op
,
804 unsigned int credits
);
806 int t3_vsc8211_phy_prep(struct cphy
*phy
, struct adapter
*adapter
,
807 int phy_addr
, const struct mdio_ops
*mdio_ops
);
808 int t3_ael1002_phy_prep(struct cphy
*phy
, struct adapter
*adapter
,
809 int phy_addr
, const struct mdio_ops
*mdio_ops
);
810 int t3_ael1006_phy_prep(struct cphy
*phy
, struct adapter
*adapter
,
811 int phy_addr
, const struct mdio_ops
*mdio_ops
);
812 int t3_ael2005_phy_prep(struct cphy
*phy
, struct adapter
*adapter
,
813 int phy_addr
, const struct mdio_ops
*mdio_ops
);
814 int t3_qt2045_phy_prep(struct cphy
*phy
, struct adapter
*adapter
, int phy_addr
,
815 const struct mdio_ops
*mdio_ops
);
816 int t3_xaui_direct_phy_prep(struct cphy
*phy
, struct adapter
*adapter
,
817 int phy_addr
, const struct mdio_ops
*mdio_ops
);
818 #endif /* __CHELSIO_COMMON_H */