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 353418 2019-10-10 23:27:02Z np $
27218792Snp *
28218792Snp */
29218792Snp
30218792Snp#ifndef __CHELSIO_COMMON_H
31218792Snp#define __CHELSIO_COMMON_H
32218792Snp
33218792Snp#include "t4_hw.h"
34218792Snp
35308304Sjhb#define GLBL_INTR_MASK (F_CIM | F_MPS | F_PL | F_PCIE | F_MC0 | F_EDC0 | \
36308304Sjhb		F_EDC1 | F_LE | F_TP | F_MA | F_PM_TX | F_PM_RX | F_ULP_RX | \
37308304Sjhb		F_CPL_SWITCH | F_SGE | F_ULP_TX)
38218792Snp
39218792Snpenum {
40218792Snp	MAX_NPORTS     = 4,     /* max # of ports */
41218792Snp	SERNUM_LEN     = 24,    /* Serial # length */
42218792Snp	EC_LEN         = 16,    /* E/C length */
43218792Snp	ID_LEN         = 16,    /* ID length */
44237436Snp	PN_LEN         = 16,    /* Part Number length */
45237436Snp	MACADDR_LEN    = 12,    /* MAC Address length */
46218792Snp};
47218792Snp
48308304Sjhbenum {
49308304Sjhb	T4_REGMAP_SIZE = (160 * 1024),
50308304Sjhb	T5_REGMAP_SIZE = (332 * 1024),
51308304Sjhb};
52308304Sjhb
53248925Snpenum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 };
54218792Snp
55218792Snpenum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST };
56218792Snp
57218792Snpenum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR };
58218792Snp
59218792Snpenum {
60218792Snp	PAUSE_RX      = 1 << 0,
61218792Snp	PAUSE_TX      = 1 << 1,
62218792Snp	PAUSE_AUTONEG = 1 << 2
63218792Snp};
64218792Snp
65311261Snpenum {
66311261Snp	FEC_RS        = 1 << 0,
67311261Snp	FEC_BASER_RS  = 1 << 1,
68311261Snp	FEC_RESERVED  = 1 << 2,
69311261Snp};
70311261Snp
71218792Snpstruct port_stats {
72218792Snp	u64 tx_octets;            /* total # of octets in good frames */
73218792Snp	u64 tx_frames;            /* all good frames */
74218792Snp	u64 tx_bcast_frames;      /* all broadcast frames */
75218792Snp	u64 tx_mcast_frames;      /* all multicast frames */
76218792Snp	u64 tx_ucast_frames;      /* all unicast frames */
77218792Snp	u64 tx_error_frames;      /* all error frames */
78218792Snp
79218792Snp	u64 tx_frames_64;         /* # of Tx frames in a particular range */
80218792Snp	u64 tx_frames_65_127;
81218792Snp	u64 tx_frames_128_255;
82218792Snp	u64 tx_frames_256_511;
83218792Snp	u64 tx_frames_512_1023;
84218792Snp	u64 tx_frames_1024_1518;
85218792Snp	u64 tx_frames_1519_max;
86218792Snp
87218792Snp	u64 tx_drop;              /* # of dropped Tx frames */
88218792Snp	u64 tx_pause;             /* # of transmitted pause frames */
89218792Snp	u64 tx_ppp0;              /* # of transmitted PPP prio 0 frames */
90218792Snp	u64 tx_ppp1;              /* # of transmitted PPP prio 1 frames */
91218792Snp	u64 tx_ppp2;              /* # of transmitted PPP prio 2 frames */
92218792Snp	u64 tx_ppp3;              /* # of transmitted PPP prio 3 frames */
93218792Snp	u64 tx_ppp4;              /* # of transmitted PPP prio 4 frames */
94218792Snp	u64 tx_ppp5;              /* # of transmitted PPP prio 5 frames */
95218792Snp	u64 tx_ppp6;              /* # of transmitted PPP prio 6 frames */
96218792Snp	u64 tx_ppp7;              /* # of transmitted PPP prio 7 frames */
97218792Snp
98218792Snp	u64 rx_octets;            /* total # of octets in good frames */
99218792Snp	u64 rx_frames;            /* all good frames */
100218792Snp	u64 rx_bcast_frames;      /* all broadcast frames */
101218792Snp	u64 rx_mcast_frames;      /* all multicast frames */
102218792Snp	u64 rx_ucast_frames;      /* all unicast frames */
103218792Snp	u64 rx_too_long;          /* # of frames exceeding MTU */
104218792Snp	u64 rx_jabber;            /* # of jabber frames */
105218792Snp	u64 rx_fcs_err;           /* # of received frames with bad FCS */
106218792Snp	u64 rx_len_err;           /* # of received frames with length error */
107218792Snp	u64 rx_symbol_err;        /* symbol errors */
108218792Snp	u64 rx_runt;              /* # of short frames */
109218792Snp
110218792Snp	u64 rx_frames_64;         /* # of Rx frames in a particular range */
111218792Snp	u64 rx_frames_65_127;
112218792Snp	u64 rx_frames_128_255;
113218792Snp	u64 rx_frames_256_511;
114218792Snp	u64 rx_frames_512_1023;
115218792Snp	u64 rx_frames_1024_1518;
116218792Snp	u64 rx_frames_1519_max;
117218792Snp
118218792Snp	u64 rx_pause;             /* # of received pause frames */
119218792Snp	u64 rx_ppp0;              /* # of received PPP prio 0 frames */
120218792Snp	u64 rx_ppp1;              /* # of received PPP prio 1 frames */
121218792Snp	u64 rx_ppp2;              /* # of received PPP prio 2 frames */
122218792Snp	u64 rx_ppp3;              /* # of received PPP prio 3 frames */
123218792Snp	u64 rx_ppp4;              /* # of received PPP prio 4 frames */
124218792Snp	u64 rx_ppp5;              /* # of received PPP prio 5 frames */
125218792Snp	u64 rx_ppp6;              /* # of received PPP prio 6 frames */
126218792Snp	u64 rx_ppp7;              /* # of received PPP prio 7 frames */
127218792Snp
128218792Snp	u64 rx_ovflow0;           /* drops due to buffer-group 0 overflows */
129218792Snp	u64 rx_ovflow1;           /* drops due to buffer-group 1 overflows */
130218792Snp	u64 rx_ovflow2;           /* drops due to buffer-group 2 overflows */
131218792Snp	u64 rx_ovflow3;           /* drops due to buffer-group 3 overflows */
132218792Snp	u64 rx_trunc0;            /* buffer-group 0 truncated packets */
133218792Snp	u64 rx_trunc1;            /* buffer-group 1 truncated packets */
134218792Snp	u64 rx_trunc2;            /* buffer-group 2 truncated packets */
135218792Snp	u64 rx_trunc3;            /* buffer-group 3 truncated packets */
136218792Snp};
137218792Snp
138218792Snpstruct lb_port_stats {
139218792Snp	u64 octets;
140218792Snp	u64 frames;
141218792Snp	u64 bcast_frames;
142218792Snp	u64 mcast_frames;
143218792Snp	u64 ucast_frames;
144218792Snp	u64 error_frames;
145218792Snp
146218792Snp	u64 frames_64;
147218792Snp	u64 frames_65_127;
148218792Snp	u64 frames_128_255;
149218792Snp	u64 frames_256_511;
150218792Snp	u64 frames_512_1023;
151218792Snp	u64 frames_1024_1518;
152218792Snp	u64 frames_1519_max;
153218792Snp
154218792Snp	u64 drop;
155218792Snp
156218792Snp	u64 ovflow0;
157218792Snp	u64 ovflow1;
158218792Snp	u64 ovflow2;
159218792Snp	u64 ovflow3;
160218792Snp	u64 trunc0;
161218792Snp	u64 trunc1;
162218792Snp	u64 trunc2;
163218792Snp	u64 trunc3;
164218792Snp};
165218792Snp
166218792Snpstruct tp_tcp_stats {
167308304Sjhb	u32 tcp_out_rsts;
168308304Sjhb	u64 tcp_in_segs;
169308304Sjhb	u64 tcp_out_segs;
170308304Sjhb	u64 tcp_retrans_segs;
171218792Snp};
172218792Snp
173218792Snpstruct tp_usm_stats {
174218792Snp	u32 frames;
175218792Snp	u32 drops;
176218792Snp	u64 octets;
177218792Snp};
178218792Snp
179218792Snpstruct tp_fcoe_stats {
180308304Sjhb	u32 frames_ddp;
181308304Sjhb	u32 frames_drop;
182308304Sjhb	u64 octets_ddp;
183218792Snp};
184218792Snp
185218792Snpstruct tp_err_stats {
186308304Sjhb	u32 mac_in_errs[MAX_NCHAN];
187308304Sjhb	u32 hdr_in_errs[MAX_NCHAN];
188308304Sjhb	u32 tcp_in_errs[MAX_NCHAN];
189308304Sjhb	u32 tnl_cong_drops[MAX_NCHAN];
190308304Sjhb	u32 ofld_chan_drops[MAX_NCHAN];
191308304Sjhb	u32 tnl_tx_drops[MAX_NCHAN];
192308304Sjhb	u32 ofld_vlan_drops[MAX_NCHAN];
193308304Sjhb	u32 tcp6_in_errs[MAX_NCHAN];
194308304Sjhb	u32 ofld_no_neigh;
195308304Sjhb	u32 ofld_cong_defer;
196218792Snp};
197218792Snp
198218792Snpstruct tp_proxy_stats {
199308304Sjhb	u32 proxy[MAX_NCHAN];
200218792Snp};
201218792Snp
202218792Snpstruct tp_cpl_stats {
203308304Sjhb	u32 req[MAX_NCHAN];
204308304Sjhb	u32 rsp[MAX_NCHAN];
205218792Snp};
206218792Snp
207218792Snpstruct tp_rdma_stats {
208308304Sjhb	u32 rqe_dfr_pkt;
209218792Snp	u32 rqe_dfr_mod;
210218792Snp};
211218792Snp
212308304Sjhbstruct sge_params {
213318840Snp	int timer_val[SGE_NTIMERS];	/* final, scaled values */
214308304Sjhb	int counter_val[SGE_NCOUNTERS];
215308304Sjhb	int fl_starve_threshold;
216308304Sjhb	int fl_starve_threshold2;
217308304Sjhb	int page_shift;
218308304Sjhb	int eq_s_qpp;
219308304Sjhb	int iq_s_qpp;
220308304Sjhb	int spg_len;
221308304Sjhb	int pad_boundary;
222308304Sjhb	int pack_boundary;
223308304Sjhb	int fl_pktshift;
224309447Sjhb	u32 sge_control;
225309447Sjhb	u32 sge_fl_buffer_size[SGE_FLBUF_SIZES];
226308304Sjhb};
227308304Sjhb
228218792Snpstruct tp_params {
229218792Snp	unsigned int tre;            /* log2 of core clocks per TP tick */
230218792Snp	unsigned int dack_re;        /* DACK timer resolution */
231218792Snp	unsigned int la_mask;        /* what events are recorded by TP LA */
232308304Sjhb	unsigned short tx_modq[MAX_NCHAN];  /* channel to modulation queue map */
233308304Sjhb
234252705Snp	uint32_t vlan_pri_map;
235252705Snp	uint32_t ingress_config;
236311261Snp	__be16 err_vec_mask;
237308304Sjhb
238308304Sjhb	int8_t fcoe_shift;
239308304Sjhb	int8_t port_shift;
240308304Sjhb	int8_t vnic_shift;
241252705Snp	int8_t vlan_shift;
242308304Sjhb	int8_t tos_shift;
243252705Snp	int8_t protocol_shift;
244308304Sjhb	int8_t ethertype_shift;
245308304Sjhb	int8_t macmatch_shift;
246308304Sjhb	int8_t matchtype_shift;
247308304Sjhb	int8_t frag_shift;
248218792Snp};
249218792Snp
250218792Snpstruct vpd_params {
251218792Snp	unsigned int cclk;
252218792Snp	u8 ec[EC_LEN + 1];
253218792Snp	u8 sn[SERNUM_LEN + 1];
254218792Snp	u8 id[ID_LEN + 1];
255237436Snp	u8 pn[PN_LEN + 1];
256237436Snp	u8 na[MACADDR_LEN + 1];
257218792Snp};
258218792Snp
259218792Snpstruct pci_params {
260228561Snp	unsigned int vpd_cap_addr;
261275092Snp	unsigned int mps;
262228561Snp	unsigned short speed;
263228561Snp	unsigned short width;
264218792Snp};
265218792Snp
266218792Snp/*
267218792Snp * Firmware device log.
268218792Snp */
269218792Snpstruct devlog_params {
270256791Snp	u32 memtype;			/* which memory (FW_MEMTYPE_* ) */
271218792Snp	u32 start;			/* start of log in firmware memory */
272218792Snp	u32 size;			/* size of log */
273308305Sjhb	u32 addr;			/* start address in flat addr space */
274218792Snp};
275218792Snp
276308304Sjhb/* Stores chip specific parameters */
277308304Sjhbstruct chip_params {
278308304Sjhb	u8 nchan;
279308304Sjhb	u8 pm_stats_cnt;
280308304Sjhb	u8 cng_ch_bits_log;		/* congestion channel map bits width */
281308304Sjhb	u8 nsched_cls;
282308304Sjhb	u8 cim_num_obq;
283308304Sjhb	u16 mps_rplc_size;
284308304Sjhb	u16 vfcount;
285308304Sjhb	u32 sge_fl_db;
286308304Sjhb	u16 mps_tcam_size;
287308304Sjhb};
288308304Sjhb
289309447Sjhb/* VF-only parameters. */
290309447Sjhb
291309447Sjhb/*
292309447Sjhb * Global Receive Side Scaling (RSS) parameters in host-native format.
293309447Sjhb */
294309447Sjhbstruct rss_params {
295309447Sjhb	unsigned int mode;		/* RSS mode */
296309447Sjhb	union {
297309447Sjhb	    struct {
298309447Sjhb		u_int synmapen:1;	/* SYN Map Enable */
299309447Sjhb		u_int syn4tupenipv6:1;	/* enable hashing 4-tuple IPv6 SYNs */
300309447Sjhb		u_int syn2tupenipv6:1;	/* enable hashing 2-tuple IPv6 SYNs */
301309447Sjhb		u_int syn4tupenipv4:1;	/* enable hashing 4-tuple IPv4 SYNs */
302309447Sjhb		u_int syn2tupenipv4:1;	/* enable hashing 2-tuple IPv4 SYNs */
303309447Sjhb		u_int ofdmapen:1;	/* Offload Map Enable */
304309447Sjhb		u_int tnlmapen:1;	/* Tunnel Map Enable */
305309447Sjhb		u_int tnlalllookup:1;	/* Tunnel All Lookup */
306309447Sjhb		u_int hashtoeplitz:1;	/* use Toeplitz hash */
307309447Sjhb	    } basicvirtual;
308309447Sjhb	} u;
309309447Sjhb};
310309447Sjhb
311309447Sjhb/*
312309447Sjhb * Maximum resources provisioned for a PCI VF.
313309447Sjhb */
314309447Sjhbstruct vf_resources {
315309447Sjhb	unsigned int nvi;		/* N virtual interfaces */
316309447Sjhb	unsigned int neq;		/* N egress Qs */
317309447Sjhb	unsigned int nethctrl;		/* N egress ETH or CTRL Qs */
318309447Sjhb	unsigned int niqflint;		/* N ingress Qs/w free list(s) & intr */
319309447Sjhb	unsigned int niq;		/* N ingress Qs */
320309447Sjhb	unsigned int tc;		/* PCI-E traffic class */
321309447Sjhb	unsigned int pmask;		/* port access rights mask */
322309447Sjhb	unsigned int nexactf;		/* N exact MPS filters */
323309447Sjhb	unsigned int r_caps;		/* read capabilities */
324309447Sjhb	unsigned int wx_caps;		/* write/execute capabilities */
325309447Sjhb};
326309447Sjhb
327218792Snpstruct adapter_params {
328308304Sjhb	struct sge_params sge;
329309447Sjhb	struct tp_params  tp;		/* PF-only */
330218792Snp	struct vpd_params vpd;
331218792Snp	struct pci_params pci;
332309447Sjhb	struct devlog_params devlog;	/* PF-only */
333309447Sjhb	struct rss_params rss;		/* VF-only */
334309447Sjhb	struct vf_resources vfres;	/* VF-only */
335218792Snp
336218792Snp	unsigned int sf_size;             /* serial flash size in bytes */
337218792Snp	unsigned int sf_nsec;             /* # of flash sectors */
338218792Snp
339309458Sjhb	unsigned int fw_vers;		/* firmware version */
340309458Sjhb	unsigned int bs_vers;		/* bootstrap version */
341309458Sjhb	unsigned int tp_vers;		/* TP microcode version */
342309458Sjhb	unsigned int er_vers;		/* expansion ROM version */
343309458Sjhb	unsigned int scfg_vers;		/* Serial Configuration version */
344309458Sjhb	unsigned int vpd_vers;		/* VPD version */
345218792Snp
346218792Snp	unsigned short mtus[NMTUS];
347218792Snp	unsigned short a_wnd[NCCTRL_WIN];
348218792Snp	unsigned short b_wnd[NCCTRL_WIN];
349218792Snp
350265426Snp	u_int ftid_min;
351265426Snp	u_int ftid_max;
352265426Snp	u_int etid_min;
353265426Snp	u_int netids;
354218792Snp
355218792Snp	unsigned int cim_la_size;
356218792Snp
357248925Snp	uint8_t nports;		/* # of ethernet ports */
358248925Snp	uint8_t portvec;
359248925Snp	unsigned int chipid:4;	/* chip ID.  T4 = 4, T5 = 5, ... */
360248925Snp	unsigned int rev:4;	/* chip revision */
361248925Snp	unsigned int fpga:1;	/* this is an FPGA */
362248925Snp	unsigned int offload:1;	/* hw is TOE capable, fw has divvied up card
363248925Snp				   resources for TOE operation. */
364248925Snp	unsigned int bypass:1;	/* this is a bypass card */
365265426Snp	unsigned int ethoffload:1;
366218792Snp
367218792Snp	unsigned int ofldq_wr_cred;
368265426Snp	unsigned int eo_wr_cred;
369318797Snp
370318797Snp	unsigned int max_ordird_qp;
371318797Snp	unsigned int max_ird_adapter;
372218792Snp};
373218792Snp
374248925Snp#define CHELSIO_T4		0x4
375248925Snp#define CHELSIO_T5		0x5
376308304Sjhb#define CHELSIO_T6		0x6
377218792Snp
378308304Sjhb/*
379308304Sjhb * State needed to monitor the forward progress of SGE Ingress DMA activities
380308304Sjhb * and possible hangs.
381308304Sjhb */
382308304Sjhbstruct sge_idma_monitor_state {
383308304Sjhb	unsigned int idma_1s_thresh;	/* 1s threshold in Core Clock ticks */
384308304Sjhb	unsigned int idma_stalled[2];	/* synthesized stalled timers in HZ */
385308304Sjhb	unsigned int idma_state[2];	/* IDMA Hang detect state */
386308304Sjhb	unsigned int idma_qid[2];	/* IDMA Hung Ingress Queue ID */
387308304Sjhb	unsigned int idma_warn[2];	/* time to warning in HZ */
388308304Sjhb};
389308304Sjhb
390218792Snpstruct trace_params {
391218792Snp	u32 data[TRACE_LEN / 4];
392218792Snp	u32 mask[TRACE_LEN / 4];
393218792Snp	unsigned short snap_len;
394218792Snp	unsigned short min_len;
395218792Snp	unsigned char skip_ofst;
396218792Snp	unsigned char skip_len;
397218792Snp	unsigned char invert;
398218792Snp	unsigned char port;
399218792Snp};
400218792Snp
401218792Snpstruct link_config {
402353418Snp	/* OS-specific code owns all the requested_* fields */
403353418Snp	unsigned char  requested_aneg;   /* link aneg user has requested */
404353418Snp	unsigned char  requested_fc;     /* flow control user has requested */
405353418Snp	unsigned char  requested_fec;    /* FEC user has requested */
406353418Snp	unsigned int   requested_speed;  /* speed user has requested (Mbps) */
407353418Snp
408218792Snp	unsigned short supported;        /* link capabilities */
409218792Snp	unsigned short advertising;      /* advertised capabilities */
410311261Snp	unsigned short lp_advertising;   /* peer advertised capabilities */
411353418Snp	unsigned int   speed;            /* actual link speed (Mbps) */
412218792Snp	unsigned char  fc;               /* actual link flow control */
413311261Snp	unsigned char  fec;              /* actual FEC */
414218792Snp	unsigned char  link_ok;          /* link up? */
415311261Snp	unsigned char  link_down_rc;     /* link down reason */
416218792Snp};
417218792Snp
418218792Snp#include "adapter.h"
419218792Snp
420218792Snp#ifndef PCI_VENDOR_ID_CHELSIO
421218792Snp# define PCI_VENDOR_ID_CHELSIO 0x1425
422218792Snp#endif
423218792Snp
424218792Snp#define for_each_port(adapter, iter) \
425218792Snp	for (iter = 0; iter < (adapter)->params.nports; ++iter)
426218792Snp
427265426Snpstatic inline int is_ftid(const struct adapter *sc, u_int tid)
428265426Snp{
429265426Snp
430265426Snp	return (tid >= sc->params.ftid_min && tid <= sc->params.ftid_max);
431265426Snp}
432265426Snp
433265426Snpstatic inline int is_etid(const struct adapter *sc, u_int tid)
434265426Snp{
435265426Snp
436265426Snp	return (tid >= sc->params.etid_min);
437265426Snp}
438265426Snp
439218792Snpstatic inline int is_offload(const struct adapter *adap)
440218792Snp{
441218792Snp	return adap->params.offload;
442218792Snp}
443218792Snp
444265426Snpstatic inline int is_ethoffload(const struct adapter *adap)
445265426Snp{
446265426Snp	return adap->params.ethoffload;
447265426Snp}
448265426Snp
449248925Snpstatic inline int chip_id(struct adapter *adap)
450248925Snp{
451248925Snp	return adap->params.chipid;
452248925Snp}
453248925Snp
454248925Snpstatic inline int chip_rev(struct adapter *adap)
455248925Snp{
456248925Snp	return adap->params.rev;
457248925Snp}
458248925Snp
459248925Snpstatic inline int is_t4(struct adapter *adap)
460248925Snp{
461248925Snp	return adap->params.chipid == CHELSIO_T4;
462248925Snp}
463248925Snp
464248925Snpstatic inline int is_t5(struct adapter *adap)
465248925Snp{
466248925Snp	return adap->params.chipid == CHELSIO_T5;
467248925Snp}
468248925Snp
469308304Sjhbstatic inline int is_t6(struct adapter *adap)
470308304Sjhb{
471308304Sjhb	return adap->params.chipid == CHELSIO_T6;
472308304Sjhb}
473308304Sjhb
474248925Snpstatic inline int is_fpga(struct adapter *adap)
475248925Snp{
476248925Snp	 return adap->params.fpga;
477248925Snp}
478248925Snp
479218792Snpstatic inline unsigned int core_ticks_per_usec(const struct adapter *adap)
480218792Snp{
481218792Snp	return adap->params.vpd.cclk / 1000;
482218792Snp}
483218792Snp
484218792Snpstatic inline unsigned int us_to_core_ticks(const struct adapter *adap,
485218792Snp					    unsigned int us)
486218792Snp{
487218792Snp	return (us * adap->params.vpd.cclk) / 1000;
488218792Snp}
489218792Snp
490308304Sjhbstatic inline unsigned int core_ticks_to_us(const struct adapter *adapter,
491308304Sjhb					    unsigned int ticks)
492308304Sjhb{
493308304Sjhb	/* add Core Clock / 2 to round ticks to nearest uS */
494308304Sjhb	return ((ticks * 1000 + adapter->params.vpd.cclk/2) /
495308304Sjhb		adapter->params.vpd.cclk);
496308304Sjhb}
497308304Sjhb
498218792Snpstatic inline unsigned int dack_ticks_to_usec(const struct adapter *adap,
499218792Snp					      unsigned int ticks)
500218792Snp{
501218792Snp	return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap);
502218792Snp}
503218792Snp
504218792Snpvoid t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val);
505218792Snp
506308304Sjhbint t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
507308304Sjhb			    int size, void *rpl, bool sleep_ok, int timeout);
508308304Sjhbint t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
509308304Sjhb		    void *rpl, bool sleep_ok);
510308304Sjhb
511308304Sjhbstatic inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox,
512308304Sjhb				     const void *cmd, int size, void *rpl,
513308304Sjhb				     int timeout)
514218792Snp{
515308304Sjhb	return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, true,
516308304Sjhb				       timeout);
517218792Snp}
518218792Snp
519218792Snpstatic inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd,
520218792Snp			     int size, void *rpl)
521218792Snp{
522218792Snp	return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true);
523218792Snp}
524218792Snp
525218792Snpstatic inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd,
526218792Snp				int size, void *rpl)
527218792Snp{
528218792Snp	return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
529218792Snp}
530218792Snp
531218792Snpvoid t4_read_indirect(struct adapter *adap, unsigned int addr_reg,
532218792Snp		      unsigned int data_reg, u32 *vals, unsigned int nregs,
533218792Snp		      unsigned int start_idx);
534218792Snpvoid t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
535218792Snp		       unsigned int data_reg, const u32 *vals,
536218792Snp		       unsigned int nregs, unsigned int start_idx);
537218792Snp
538237436Snpu32 t4_hw_pci_read_cfg4(adapter_t *adapter, int reg);
539237436Snp
540218792Snpstruct fw_filter_wr;
541218792Snp
542218792Snpvoid t4_intr_enable(struct adapter *adapter);
543218792Snpvoid t4_intr_disable(struct adapter *adapter);
544218792Snpvoid t4_intr_clear(struct adapter *adapter);
545218792Snpint t4_slow_intr_handler(struct adapter *adapter);
546218792Snp
547218792Snpint t4_hash_mac_addr(const u8 *addr);
548308304Sjhbint t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
549218792Snp		  struct link_config *lc);
550218792Snpint t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
551218792Snpint t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
552218792Snpint t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
553218792Snpint t4_eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz);
554218792Snpint t4_seeprom_wp(struct adapter *adapter, int enable);
555218792Snpint t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords,
556218792Snp		  u32 *data, int byte_oriented);
557308304Sjhbint t4_write_flash(struct adapter *adapter, unsigned int addr,
558308304Sjhb		   unsigned int n, const u8 *data, int byte_oriented);
559218792Snpint t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
560308304Sjhbint t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op);
561308304Sjhbint t5_fw_init_extern_mem(struct adapter *adap);
562308304Sjhbint t4_load_bootcfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size);
563237436Snpint t4_load_boot(struct adapter *adap, u8 *boot_data,
564228561Snp                 unsigned int boot_addr, unsigned int size);
565308304Sjhbint t4_flash_erase_sectors(struct adapter *adapter, int start, int end);
566250090Snpint t4_flash_cfg_addr(struct adapter *adapter);
567218792Snpint t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size);
568218792Snpint t4_get_fw_version(struct adapter *adapter, u32 *vers);
569309458Sjhbint t4_get_bs_version(struct adapter *adapter, u32 *vers);
570218792Snpint t4_get_tp_version(struct adapter *adapter, u32 *vers);
571308304Sjhbint t4_get_exprom_version(struct adapter *adapter, u32 *vers);
572309458Sjhbint t4_get_scfg_version(struct adapter *adapter, u32 *vers);
573309458Sjhbint t4_get_vpd_version(struct adapter *adapter, u32 *vers);
574309458Sjhbint t4_get_version_info(struct adapter *adapter);
575218792Snpint t4_init_hw(struct adapter *adapter, u32 fw_params);
576309447Sjhbconst struct chip_params *t4_get_chip_params(int chipid);
577308304Sjhbint t4_prep_adapter(struct adapter *adapter, u8 *buf);
578308304Sjhbint t4_shutdown_adapter(struct adapter *adapter);
579308304Sjhbint t4_init_devlog_params(struct adapter *adapter, int fw_attach);
580308304Sjhbint t4_init_sge_params(struct adapter *adapter);
581353418Snpint t4_init_tp_params(struct adapter *adap, bool sleep_ok);
582252705Snpint t4_filter_field_shift(const struct adapter *adap, int filter_sel);
583308304Sjhbint t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id);
584218792Snpvoid t4_fatal_err(struct adapter *adapter);
585308304Sjhbvoid t4_db_full(struct adapter *adapter);
586308304Sjhbvoid t4_db_dropped(struct adapter *adapter);
587218792Snpint t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp,
588218792Snp			int filter_index, int enable);
589218792Snpvoid t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp,
590218792Snp			 int filter_index, int *enabled);
591218792Snpint t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
592218792Snp			int start, int n, const u16 *rspq, unsigned int nrspq);
593218792Snpint t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode,
594218792Snp		       unsigned int flags);
595218792Snpint t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid,
596309560Sjhb		     unsigned int flags, unsigned int defq, unsigned int skeyidx,
597309560Sjhb		     unsigned int skey);
598218792Snpint t4_read_rss(struct adapter *adapter, u16 *entries);
599353418Snpvoid t4_read_rss_key(struct adapter *adapter, u32 *key, bool sleep_ok);
600353418Snpvoid t4_write_rss_key(struct adapter *adap, const u32 *key, int idx,
601353418Snp		      bool sleep_ok);
602353418Snpvoid t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
603353418Snp			   u32 *valp, bool sleep_ok);
604353418Snpvoid t4_write_rss_pf_config(struct adapter *adapter, unsigned int index,
605353418Snp			    u32 val, bool sleep_ok);
606218792Snpvoid t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
607353418Snp			   u32 *vfl, u32 *vfh, bool sleep_ok);
608218792Snpvoid t4_write_rss_vf_config(struct adapter *adapter, unsigned int index,
609353418Snp			    u32 vfl, u32 vfh, bool sleep_ok);
610353418Snpu32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok);
611353418Snpvoid t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok);
612353418Snpu32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok);
613353418Snpvoid t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok);
614218792Snpint t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask);
615218792Snpvoid t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
616218792Snpvoid t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
617218792Snpvoid t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres);
618218792Snpint t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n);
619218792Snpint t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n);
620218792Snpint t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n,
621218792Snp		unsigned int *valp);
622218792Snpint t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n,
623218792Snp		 const unsigned int *valp);
624218792Snpint t4_cim_ctl_read(struct adapter *adap, unsigned int addr, unsigned int n,
625218792Snp		    unsigned int *valp);
626218792Snpint t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr);
627218792Snpvoid t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp,
628218792Snp		unsigned int *pif_req_wrptr, unsigned int *pif_rsp_wrptr);
629218792Snpvoid t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp);
630308304Sjhbint t4_get_flash_params(struct adapter *adapter);
631308304Sjhb
632308304Sjhbu32 t4_read_pcie_cfg4(struct adapter *adap, int reg, int drv_fw_attach);
633248925Snpint t4_mc_read(struct adapter *adap, int idx, u32 addr,
634248925Snp	       __be32 *data, u64 *parity);
635218792Snpint t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity);
636218792Snpint t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size,
637218792Snp		__be32 *data);
638308304Sjhbvoid t4_idma_monitor_init(struct adapter *adapter,
639308304Sjhb			  struct sge_idma_monitor_state *idma);
640308304Sjhbvoid t4_idma_monitor(struct adapter *adapter,
641308304Sjhb		     struct sge_idma_monitor_state *idma,
642308304Sjhb		     int hz, int ticks);
643218792Snp
644308304Sjhbunsigned int t4_get_regs_len(struct adapter *adapter);
645308304Sjhbvoid t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size);
646308304Sjhb
647308304Sjhbconst char *t4_get_port_type_description(enum fw_port_type port_type);
648218792Snpvoid t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
649237436Snpvoid t4_get_port_stats_offset(struct adapter *adap, int idx,
650237436Snp		struct port_stats *stats,
651237436Snp		struct port_stats *offset);
652218792Snpvoid t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p);
653218792Snpvoid t4_clr_port_stats(struct adapter *adap, int idx);
654218792Snp
655218792Snpvoid t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
656218792Snpvoid t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);
657218792Snpvoid t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]);
658218792Snpvoid t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps,
659353418Snp		     unsigned int *ipg, bool sleep_ok);
660218792Snpvoid t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
661218792Snp			    unsigned int mask, unsigned int val);
662218792Snpvoid t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr);
663353418Snpvoid t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st,
664353418Snp			 bool sleep_ok);
665353418Snpvoid t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st,
666353418Snp    			   bool sleep_ok);
667353418Snpvoid t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st,
668353418Snp			 bool sleep_ok);
669353418Snpvoid t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st,
670353418Snp			  bool sleep_ok);
671353418Snpvoid t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st,
672353418Snp		      bool sleep_ok);
673218792Snpvoid t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
674353418Snp			 struct tp_tcp_stats *v6, bool sleep_ok);
675218792Snpvoid t4_get_fcoe_stats(struct adapter *adap, unsigned int idx,
676353418Snp		       struct tp_fcoe_stats *st, bool sleep_ok);
677218792Snpvoid t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
678218792Snp		  const unsigned short *alpha, const unsigned short *beta);
679218792Snp
680218792Snpvoid t4_ulprx_read_la(struct adapter *adap, u32 *la_buf);
681218792Snp
682218792Snpint t4_set_sched_bps(struct adapter *adap, int sched, unsigned int kbps);
683218792Snpint t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg);
684218792Snpint t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals,
685218792Snp		    unsigned int start, unsigned int n);
686218792Snpvoid t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate);
687353418Snpint t4_set_filter_mode(struct adapter *adap, unsigned int mode_map,
688353418Snp    bool sleep_ok);
689218792Snpvoid t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid);
690218792Snp
691218792Snpvoid t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr);
692218792Snpint t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map,
693218792Snp		      u64 mask0, u64 mask1, unsigned int crc, bool enable);
694218792Snp
695218792Snpint t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
696218792Snp		enum dev_master master, enum dev_state *state);
697218792Snpint t4_fw_bye(struct adapter *adap, unsigned int mbox);
698218792Snpint t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
699237436Snpint t4_fw_halt(struct adapter *adap, unsigned int mbox, int force);
700237436Snpint t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
701237436Snpint t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
702237436Snp		  const u8 *fw_data, unsigned int size, int force);
703228561Snpint t4_fw_initialize(struct adapter *adap, unsigned int mbox);
704218792Snpint t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
705218792Snp		    unsigned int vf, unsigned int nparams, const u32 *params,
706218792Snp		    u32 *val);
707308304Sjhbint t4_query_params_rw(struct adapter *adap, unsigned int mbox, unsigned int pf,
708308304Sjhb		       unsigned int vf, unsigned int nparams, const u32 *params,
709308304Sjhb		       u32 *val, int rw);
710308304Sjhbint t4_set_params_timeout(struct adapter *adap, unsigned int mbox,
711308304Sjhb			  unsigned int pf, unsigned int vf,
712308304Sjhb			  unsigned int nparams, const u32 *params,
713308304Sjhb			  const u32 *val, int timeout);
714218792Snpint t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
715218792Snp		  unsigned int vf, unsigned int nparams, const u32 *params,
716218792Snp		  const u32 *val);
717218792Snpint t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
718218792Snp		unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl,
719218792Snp		unsigned int rxqi, unsigned int rxq, unsigned int tc,
720218792Snp		unsigned int vi, unsigned int cmask, unsigned int pmask,
721218792Snp		unsigned int exactf, unsigned int rcaps, unsigned int wxcaps);
722237436Snpint t4_alloc_vi_func(struct adapter *adap, unsigned int mbox,
723237436Snp		     unsigned int port, unsigned int pf, unsigned int vf,
724270297Snp		     unsigned int nmac, u8 *mac, u16 *rss_size,
725237436Snp		     unsigned int portfunc, unsigned int idstype);
726218792Snpint t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
727218792Snp		unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
728270297Snp		u16 *rss_size);
729218792Snpint t4_free_vi(struct adapter *adap, unsigned int mbox,
730218792Snp	       unsigned int pf, unsigned int vf,
731218792Snp	       unsigned int viid);
732218792Snpint t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
733218792Snp		  int mtu, int promisc, int all_multi, int bcast, int vlanex,
734218792Snp		  bool sleep_ok);
735218792Snpint t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid,
736218792Snp		      bool free, unsigned int naddr, const u8 **addr, u16 *idx,
737218792Snp		      u64 *hash, bool sleep_ok);
738218792Snpint t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
739218792Snp		  int idx, const u8 *addr, bool persist, bool add_smt);
740218792Snpint t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid,
741218792Snp		     bool ucast, u64 vec, bool sleep_ok);
742308304Sjhbint t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
743308304Sjhb			unsigned int viid, bool rx_en, bool tx_en, bool dcb_en);
744218792Snpint t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid,
745218792Snp		 bool rx_en, bool tx_en);
746218792Snpint t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid,
747218792Snp		     unsigned int nblinks);
748218792Snpint t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
749218792Snp	       unsigned int mmd, unsigned int reg, unsigned int *valp);
750218792Snpint t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
751218792Snp	       unsigned int mmd, unsigned int reg, unsigned int val);
752269082Snpint t4_i2c_rd(struct adapter *adap, unsigned int mbox,
753269082Snp	      int port, unsigned int devid,
754269082Snp	      unsigned int offset, unsigned int len,
755269082Snp	      u8 *buf);
756269082Snpint t4_i2c_wr(struct adapter *adap, unsigned int mbox,
757269082Snp	      int port, unsigned int devid,
758269082Snp	      unsigned int offset, unsigned int len,
759269082Snp	      u8 *buf);
760308304Sjhbint t4_iq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf,
761308304Sjhb	       unsigned int vf, unsigned int iqtype, unsigned int iqid,
762308304Sjhb	       unsigned int fl0id, unsigned int fl1id);
763218792Snpint t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
764218792Snp	       unsigned int vf, unsigned int iqtype, unsigned int iqid,
765218792Snp	       unsigned int fl0id, unsigned int fl1id);
766218792Snpint t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
767218792Snp		   unsigned int vf, unsigned int eqid);
768218792Snpint t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
769218792Snp		    unsigned int vf, unsigned int eqid);
770218792Snpint t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
771218792Snp		    unsigned int vf, unsigned int eqid);
772218792Snpint t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid,
773218792Snp		   enum ctxt_type ctype, u32 *data);
774218792Snpint t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype,
775218792Snp		      u32 *data);
776237436Snpint t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
777308304Sjhbconst char *t4_link_down_rc_str(unsigned char link_down_rc);
778353418Snpint t4_update_port_info(struct port_info *pi);
779218792Snpint t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
780237436Snpint t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val);
781270297Snpint t4_sched_config(struct adapter *adapter, int type, int minmaxen,
782270297Snp		    int sleep_ok);
783259142Snpint t4_sched_params(struct adapter *adapter, int type, int level, int mode,
784259142Snp		    int rateunit, int ratemode, int channel, int cl,
785270297Snp		    int minrate, int maxrate, int weight, int pktsize,
786270297Snp		    int sleep_ok);
787318851Snpint t4_sched_params_ch_rl(struct adapter *adapter, int channel, int ratemode,
788318851Snp			  unsigned int maxrate, int sleep_ok);
789318851Snpint t4_sched_params_cl_wrr(struct adapter *adapter, int channel, int cl,
790318851Snp			   int weight, int sleep_ok);
791318851Snpint t4_sched_params_cl_rl_kbps(struct adapter *adapter, int channel, int cl,
792318851Snp			       int mode, unsigned int maxrate, int pktsize,
793318851Snp			       int sleep_ok);
794308304Sjhbint t4_config_watchdog(struct adapter *adapter, unsigned int mbox,
795308304Sjhb		       unsigned int pf, unsigned int vf,
796308304Sjhb		       unsigned int timeout, unsigned int action);
797308304Sjhbint t4_get_devlog_level(struct adapter *adapter, unsigned int *level);
798308304Sjhbint t4_set_devlog_level(struct adapter *adapter, unsigned int level);
799308304Sjhbvoid t4_sge_decode_idma_state(struct adapter *adapter, int state);
800309447Sjhb
801353418Snpvoid t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
802353418Snp		    u32 start_index, bool sleep_ok);
803353418Snpvoid t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs,
804353418Snp		     u32 start_index, bool sleep_ok);
805353418Snpvoid t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
806353418Snp		       u32 start_index, bool sleep_ok);
807353418Snpvoid t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs,
808353418Snp		    u32 start_index, bool sleep_ok);
809353418Snp
810309447Sjhbstatic inline int t4vf_query_params(struct adapter *adapter,
811309447Sjhb				    unsigned int nparams, const u32 *params,
812309447Sjhb				    u32 *vals)
813309447Sjhb{
814309447Sjhb	return t4_query_params(adapter, 0, 0, 0, nparams, params, vals);
815309447Sjhb}
816309447Sjhb
817309447Sjhbstatic inline int t4vf_set_params(struct adapter *adapter,
818309447Sjhb				  unsigned int nparams, const u32 *params,
819309447Sjhb				  const u32 *vals)
820309447Sjhb{
821309447Sjhb	return t4_set_params(adapter, 0, 0, 0, nparams, params, vals);
822309447Sjhb}
823309447Sjhb
824309447Sjhbstatic inline int t4vf_wr_mbox(struct adapter *adap, const void *cmd,
825309447Sjhb			       int size, void *rpl)
826309447Sjhb{
827309447Sjhb	return t4_wr_mbox(adap, adap->mbox, cmd, size, rpl);
828309447Sjhb}
829309447Sjhb
830309447Sjhbint t4vf_wait_dev_ready(struct adapter *adapter);
831309447Sjhbint t4vf_fw_reset(struct adapter *adapter);
832309447Sjhbint t4vf_get_sge_params(struct adapter *adapter);
833309447Sjhbint t4vf_get_rss_glb_config(struct adapter *adapter);
834309447Sjhbint t4vf_get_vfres(struct adapter *adapter);
835309447Sjhbint t4vf_prep_adapter(struct adapter *adapter);
836309447Sjhb
837218792Snp#endif /* __CHELSIO_COMMON_H */
838