net/cxgbe: validate flows offloaded to HASH region
[dpdk.git] / drivers / net / cxgbe / base / common.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Chelsio Communications.
3  * All rights reserved.
4  */
5
6 #ifndef __CHELSIO_COMMON_H
7 #define __CHELSIO_COMMON_H
8
9 #include "cxgbe_compat.h"
10 #include "t4_hw.h"
11 #include "t4vf_hw.h"
12 #include "t4_chip_type.h"
13 #include "t4fw_interface.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 #define CXGBE_PAGE_SIZE RTE_PGSIZE_4K
20
21 #define T4_MEMORY_WRITE 0
22 #define T4_MEMORY_READ  1
23
24 enum {
25         MAX_NPORTS     = 4,     /* max # of ports */
26 };
27
28 enum {
29         T5_REGMAP_SIZE = (332 * 1024),
30 };
31
32 enum {
33         MEMWIN0_APERTURE = 2048,
34         MEMWIN0_BASE     = 0x1b800,
35 };
36
37 enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST };
38
39 enum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR };
40
41 enum cc_pause {
42         PAUSE_RX      = 1 << 0,
43         PAUSE_TX      = 1 << 1,
44         PAUSE_AUTONEG = 1 << 2
45 };
46
47 enum cc_fec {
48         FEC_AUTO     = 1 << 0,    /* IEEE 802.3 "automatic" */
49         FEC_RS       = 1 << 1,    /* Reed-Solomon */
50         FEC_BASER_RS = 1 << 2,    /* BaseR/Reed-Solomon */
51 };
52
53 enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 };
54
55 struct port_stats {
56         u64 tx_octets;            /* total # of octets in good frames */
57         u64 tx_frames;            /* all good frames */
58         u64 tx_bcast_frames;      /* all broadcast frames */
59         u64 tx_mcast_frames;      /* all multicast frames */
60         u64 tx_ucast_frames;      /* all unicast frames */
61         u64 tx_error_frames;      /* all error frames */
62
63         u64 tx_frames_64;         /* # of Tx frames in a particular range */
64         u64 tx_frames_65_127;
65         u64 tx_frames_128_255;
66         u64 tx_frames_256_511;
67         u64 tx_frames_512_1023;
68         u64 tx_frames_1024_1518;
69         u64 tx_frames_1519_max;
70
71         u64 tx_drop;              /* # of dropped Tx frames */
72         u64 tx_pause;             /* # of transmitted pause frames */
73         u64 tx_ppp0;              /* # of transmitted PPP prio 0 frames */
74         u64 tx_ppp1;              /* # of transmitted PPP prio 1 frames */
75         u64 tx_ppp2;              /* # of transmitted PPP prio 2 frames */
76         u64 tx_ppp3;              /* # of transmitted PPP prio 3 frames */
77         u64 tx_ppp4;              /* # of transmitted PPP prio 4 frames */
78         u64 tx_ppp5;              /* # of transmitted PPP prio 5 frames */
79         u64 tx_ppp6;              /* # of transmitted PPP prio 6 frames */
80         u64 tx_ppp7;              /* # of transmitted PPP prio 7 frames */
81
82         u64 rx_octets;            /* total # of octets in good frames */
83         u64 rx_frames;            /* all good frames */
84         u64 rx_bcast_frames;      /* all broadcast frames */
85         u64 rx_mcast_frames;      /* all multicast frames */
86         u64 rx_ucast_frames;      /* all unicast frames */
87         u64 rx_too_long;          /* # of frames exceeding MTU */
88         u64 rx_jabber;            /* # of jabber frames */
89         u64 rx_fcs_err;           /* # of received frames with bad FCS */
90         u64 rx_len_err;           /* # of received frames with length error */
91         u64 rx_symbol_err;        /* symbol errors */
92         u64 rx_runt;              /* # of short frames */
93
94         u64 rx_frames_64;         /* # of Rx frames in a particular range */
95         u64 rx_frames_65_127;
96         u64 rx_frames_128_255;
97         u64 rx_frames_256_511;
98         u64 rx_frames_512_1023;
99         u64 rx_frames_1024_1518;
100         u64 rx_frames_1519_max;
101
102         u64 rx_pause;             /* # of received pause frames */
103         u64 rx_ppp0;              /* # of received PPP prio 0 frames */
104         u64 rx_ppp1;              /* # of received PPP prio 1 frames */
105         u64 rx_ppp2;              /* # of received PPP prio 2 frames */
106         u64 rx_ppp3;              /* # of received PPP prio 3 frames */
107         u64 rx_ppp4;              /* # of received PPP prio 4 frames */
108         u64 rx_ppp5;              /* # of received PPP prio 5 frames */
109         u64 rx_ppp6;              /* # of received PPP prio 6 frames */
110         u64 rx_ppp7;              /* # of received PPP prio 7 frames */
111
112         u64 rx_ovflow0;           /* drops due to buffer-group 0 overflows */
113         u64 rx_ovflow1;           /* drops due to buffer-group 1 overflows */
114         u64 rx_ovflow2;           /* drops due to buffer-group 2 overflows */
115         u64 rx_ovflow3;           /* drops due to buffer-group 3 overflows */
116         u64 rx_trunc0;            /* buffer-group 0 truncated packets */
117         u64 rx_trunc1;            /* buffer-group 1 truncated packets */
118         u64 rx_trunc2;            /* buffer-group 2 truncated packets */
119         u64 rx_trunc3;            /* buffer-group 3 truncated packets */
120 };
121
122 struct sge_params {
123         u32 hps;                        /* host page size for our PF/VF */
124         u32 eq_qpp;                     /* egress queues/page for our PF/VF */
125         u32 iq_qpp;                     /* egress queues/page for our PF/VF */
126 };
127
128 struct tp_params {
129         unsigned int ntxchan;        /* # of Tx channels */
130         unsigned int tre;            /* log2 of core clocks per TP tick */
131         unsigned int dack_re;        /* DACK timer resolution */
132         unsigned int la_mask;        /* what events are recorded by TP LA */
133         unsigned short tx_modq[NCHAN];  /* channel to modulation queue map */
134
135         u32 vlan_pri_map;               /* cached TP_VLAN_PRI_MAP */
136         u32 ingress_config;             /* cached TP_INGRESS_CONFIG */
137
138         /* cached TP_OUT_CONFIG compressed error vector
139          * and passing outer header info for encapsulated packets.
140          */
141         int rx_pkt_encap;
142
143         /*
144          * TP_VLAN_PRI_MAP Compressed Filter Tuple field offsets.  This is a
145          * subset of the set of fields which may be present in the Compressed
146          * Filter Tuple portion of filters and TCP TCB connections.  The
147          * fields which are present are controlled by the TP_VLAN_PRI_MAP.
148          * Since a variable number of fields may or may not be present, their
149          * shifted field positions within the Compressed Filter Tuple may
150          * vary, or not even be present if the field isn't selected in
151          * TP_VLAN_PRI_MAP.  Since some of these fields are needed in various
152          * places we store their offsets here, or a -1 if the field isn't
153          * present.
154          */
155         int vlan_shift;
156         int vnic_shift;
157         int port_shift;
158         int protocol_shift;
159         int ethertype_shift;
160
161         u64 hash_filter_mask;
162 };
163
164 struct vpd_params {
165         unsigned int cclk;
166 };
167
168 struct pci_params {
169         uint16_t        vendor_id;
170         uint16_t        device_id;
171         uint32_t        vpd_cap_addr;
172         uint16_t        speed;
173         uint8_t         width;
174 };
175
176 /*
177  * Firmware device log.
178  */
179 struct devlog_params {
180         u32 memtype;                    /* which memory (EDC0, EDC1, MC) */
181         u32 start;                      /* start of log in firmware memory */
182         u32 size;                       /* size of log */
183 };
184
185 struct arch_specific_params {
186         u8 nchan;
187         u16 mps_rplc_size;
188         u16 vfcount;
189         u32 sge_fl_db;
190         u16 mps_tcam_size;
191 };
192
193 /*
194  * Global Receive Side Scaling (RSS) parameters in host-native format.
195  */
196 struct rss_params {
197         unsigned int mode;                      /* RSS mode */
198         union {
199                 struct {
200                         uint synmapen:1;        /* SYN Map Enable */
201                         uint syn4tupenipv6:1;   /* en 4-tuple IPv6 SYNs hash */
202                         uint syn2tupenipv6:1;   /* en 2-tuple IPv6 SYNs hash */
203                         uint syn4tupenipv4:1;   /* en 4-tuple IPv4 SYNs hash */
204                         uint syn2tupenipv4:1;   /* en 2-tuple IPv4 SYNs hash */
205                         uint ofdmapen:1;        /* Offload Map Enable */
206                         uint tnlmapen:1;        /* Tunnel Map Enable */
207                         uint tnlalllookup:1;    /* Tunnel All Lookup */
208                         uint hashtoeplitz:1;    /* use Toeplitz hash */
209                 } basicvirtual;
210         } u;
211 };
212
213 /*
214  * Maximum resources provisioned for a PCI VF.
215  */
216 struct vf_resources {
217         unsigned int nvi;               /* N virtual interfaces */
218         unsigned int neq;               /* N egress Qs */
219         unsigned int nethctrl;          /* N egress ETH or CTRL Qs */
220         unsigned int niqflint;          /* N ingress Qs/w free list(s) & intr */
221         unsigned int niq;               /* N ingress Qs */
222         unsigned int tc;                /* PCI-E traffic class */
223         unsigned int pmask;             /* port access rights mask */
224         unsigned int nexactf;           /* N exact MPS filters */
225         unsigned int r_caps;            /* read capabilities */
226         unsigned int wx_caps;           /* write/execute capabilities */
227 };
228
229 struct adapter_params {
230         struct sge_params sge;
231         struct tp_params  tp;
232         struct vpd_params vpd;
233         struct pci_params pci;
234         struct devlog_params devlog;
235         struct rss_params rss;
236         struct vf_resources vfres;
237         enum pcie_memwin drv_memwin;
238
239         unsigned int sf_size;             /* serial flash size in bytes */
240         unsigned int sf_nsec;             /* # of flash sectors */
241
242         unsigned int fw_vers;
243         unsigned int bs_vers;
244         unsigned int tp_vers;
245         unsigned int er_vers;
246
247         unsigned short mtus[NMTUS];
248         unsigned short a_wnd[NCCTRL_WIN];
249         unsigned short b_wnd[NCCTRL_WIN];
250
251         unsigned int mc_size;             /* MC memory size */
252         unsigned int cim_la_size;
253
254         unsigned char nports;             /* # of ethernet ports */
255         unsigned char portvec;
256
257         unsigned char hash_filter;
258
259         enum chip_type chip;              /* chip code */
260         struct arch_specific_params arch; /* chip specific params */
261
262         bool ulptx_memwrite_dsgl;          /* use of T5 DSGL allowed */
263         u8 fw_caps_support;               /* 32-bit Port Capabilities */
264 };
265
266 /* Firmware Port Capabilities types.
267  */
268 typedef u16 fw_port_cap16_t;    /* 16-bit Port Capabilities integral value */
269 typedef u32 fw_port_cap32_t;    /* 32-bit Port Capabilities integral value */
270
271 enum fw_caps {
272         FW_CAPS_UNKNOWN = 0,    /* 0'ed out initial state */
273         FW_CAPS16       = 1,    /* old Firmware: 16-bit Port Capabilities */
274         FW_CAPS32       = 2,    /* new Firmware: 32-bit Port Capabilities */
275 };
276
277 struct link_config {
278         fw_port_cap32_t pcaps;          /* link capabilities */
279         fw_port_cap32_t acaps;          /* advertised capabilities */
280
281         u32 requested_speed;            /* speed (Mb/s) user has requested */
282         u32 speed;                      /* actual link speed (Mb/s) */
283
284         enum cc_pause requested_fc;     /* flow control user has requested */
285         enum cc_pause fc;               /* actual link flow control */
286
287         enum cc_fec auto_fec;           /* Forward Error Correction
288                                          * "automatic" (IEEE 802.3)
289                                          */
290         enum cc_fec requested_fec;      /* Forward Error Correction requested */
291         enum cc_fec fec;                /* Forward Error Correction actual */
292
293         unsigned char autoneg;          /* autonegotiating? */
294
295         unsigned char link_ok;          /* link up? */
296         unsigned char link_down_rc;     /* link down reason */
297 };
298
299 #include "adapter.h"
300
301 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
302                       u32 val);
303 int t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask,
304                         int polarity,
305                         int attempts, int delay, u32 *valp);
306
307 static inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask,
308                                   int polarity, int attempts, int delay)
309 {
310         return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts,
311                                    delay, NULL);
312 }
313
314 static inline int is_pf4(struct adapter *adap)
315 {
316         return adap->pf == 4;
317 }
318
319 #define for_each_port(adapter, iter) \
320         for (iter = 0; iter < (adapter)->params.nports; ++iter)
321
322 static inline int is_hashfilter(const struct adapter *adap)
323 {
324         return adap->params.hash_filter;
325 }
326
327 void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
328 void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
329                             unsigned int mask, unsigned int val);
330 void t4_intr_enable(struct adapter *adapter);
331 void t4_intr_disable(struct adapter *adapter);
332 int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
333                   struct link_config *lc);
334 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
335                   const unsigned short *alpha, const unsigned short *beta);
336 int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
337                 enum dev_master master, enum dev_state *state);
338 int t4_fw_bye(struct adapter *adap, unsigned int mbox);
339 int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
340 int t4vf_fw_reset(struct adapter *adap);
341 int t4_fw_halt(struct adapter *adap, unsigned int mbox, int reset);
342 int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
343 int t4_fl_pkt_align(struct adapter *adap);
344 int t4vf_fl_pkt_align(struct adapter *adap, u32 sge_control, u32 sge_control2);
345 int t4vf_get_vfres(struct adapter *adap);
346 int t4_fixup_host_params_compat(struct adapter *adap, unsigned int page_size,
347                                 unsigned int cache_line_size,
348                                 enum chip_type chip_compat);
349 int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
350                          unsigned int cache_line_size);
351 int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
352 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
353                     unsigned int vf, unsigned int nparams, const u32 *params,
354                     u32 *val);
355 int t4vf_query_params(struct adapter *adap, unsigned int nparams,
356                       const u32 *params, u32 *vals);
357 int t4vf_get_dev_params(struct adapter *adap);
358 int t4vf_get_vpd_params(struct adapter *adap);
359 int t4vf_get_rss_glb_config(struct adapter *adap);
360 int t4vf_set_params(struct adapter *adapter, unsigned int nparams,
361                     const u32 *params, const u32 *vals);
362 int t4_set_params_timeout(struct adapter *adap, unsigned int mbox,
363                           unsigned int pf, unsigned int vf,
364                           unsigned int nparams, const u32 *params,
365                           const u32 *val, int timeout);
366 int t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
367                   unsigned int vf, unsigned int nparams, const u32 *params,
368                   const u32 *val);
369 int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox,
370                      unsigned int port, unsigned int pf, unsigned int vf,
371                      unsigned int nmac, u8 *mac, unsigned int *rss_size,
372                      unsigned int portfunc, unsigned int idstype);
373 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
374                 unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
375                 unsigned int *rss_size);
376 int t4_free_vi(struct adapter *adap, unsigned int mbox,
377                unsigned int pf, unsigned int vf,
378                unsigned int viid);
379 int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
380                   int mtu, int promisc, int all_multi, int bcast, int vlanex,
381                   bool sleep_ok);
382 int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
383                   int idx, const u8 *addr, bool persist, bool add_smt);
384 int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
385                         unsigned int viid, bool rx_en, bool tx_en, bool dcb_en);
386 int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid,
387                  bool rx_en, bool tx_en);
388 int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start,
389                      unsigned int pf, unsigned int vf, unsigned int iqid,
390                      unsigned int fl0id, unsigned int fl1id);
391 int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
392                unsigned int vf, unsigned int iqtype, unsigned int iqid,
393                unsigned int fl0id, unsigned int fl1id);
394 int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
395                    unsigned int vf, unsigned int eqid);
396 int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
397                     unsigned int vf, unsigned int eqid);
398
399 static inline unsigned int core_ticks_per_usec(const struct adapter *adap)
400 {
401         return adap->params.vpd.cclk / 1000;
402 }
403
404 static inline unsigned int us_to_core_ticks(const struct adapter *adap,
405                                             unsigned int us)
406 {
407         return (us * adap->params.vpd.cclk) / 1000;
408 }
409
410 static inline unsigned int core_ticks_to_us(const struct adapter *adapter,
411                                             unsigned int ticks)
412 {
413         /* add Core Clock / 2 to round ticks to nearest uS */
414         return ((ticks * 1000 + adapter->params.vpd.cclk / 2) /
415                 adapter->params.vpd.cclk);
416 }
417
418 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
419                             int size, void *rpl, bool sleep_ok, int timeout);
420 int t4_wr_mbox_meat(struct adapter *adap, int mbox,
421                     const void __attribute__((__may_alias__)) *cmd, int size,
422                     void *rpl, bool sleep_ok);
423
424 static inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox,
425                                      const void *cmd, int size, void *rpl,
426                                      int timeout)
427 {
428         return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, true,
429                                        timeout);
430 }
431
432 int t4_get_core_clock(struct adapter *adapter, struct vpd_params *p);
433
434 static inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd,
435                              int size, void *rpl)
436 {
437         return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true);
438 }
439
440 static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd,
441                                 int size, void *rpl)
442 {
443         return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
444 }
445
446 int t4vf_wr_mbox_core(struct adapter *, const void *, int, void *, bool);
447
448 static inline int t4vf_wr_mbox(struct adapter *adapter, const void *cmd,
449                                int size, void *rpl)
450 {
451         return t4vf_wr_mbox_core(adapter, cmd, size, rpl, true);
452 }
453
454 static inline int t4vf_wr_mbox_ns(struct adapter *adapter, const void *cmd,
455                                   int size, void *rpl)
456 {
457         return t4vf_wr_mbox_core(adapter, cmd, size, rpl, false);
458 }
459
460
461 void t4_read_indirect(struct adapter *adap, unsigned int addr_reg,
462                       unsigned int data_reg, u32 *vals, unsigned int nregs,
463                       unsigned int start_idx);
464 void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
465                        unsigned int data_reg, const u32 *vals,
466                        unsigned int nregs, unsigned int start_idx);
467
468 int t4_get_vpd_params(struct adapter *adapter, struct vpd_params *p);
469 int t4_read_flash(struct adapter *adapter, unsigned int addr,
470                   unsigned int nwords, u32 *data, int byte_oriented);
471 int t4_flash_cfg_addr(struct adapter *adapter);
472 unsigned int t4_get_mps_bg_map(struct adapter *adapter, unsigned int pidx);
473 unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx);
474 const char *t4_get_port_type_description(enum fw_port_type port_type);
475 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
476 void t4vf_get_port_stats(struct adapter *adapter, int pidx,
477                          struct port_stats *p);
478 void t4_get_port_stats_offset(struct adapter *adap, int idx,
479                               struct port_stats *stats,
480                               struct port_stats *offset);
481 void t4_clr_port_stats(struct adapter *adap, int idx);
482 void init_link_config(struct link_config *lc, fw_port_cap32_t pcaps,
483                       fw_port_cap32_t acaps);
484 void t4_reset_link_config(struct adapter *adap, int idx);
485 int t4_get_version_info(struct adapter *adapter);
486 void t4_dump_version_info(struct adapter *adapter);
487 int t4_get_flash_params(struct adapter *adapter);
488 int t4_get_chip_type(struct adapter *adap, int ver);
489 int t4_prep_adapter(struct adapter *adapter);
490 int t4vf_prep_adapter(struct adapter *adapter);
491 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
492 int t4vf_port_init(struct adapter *adap);
493 int t4_init_rss_mode(struct adapter *adap, int mbox);
494 int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
495                         int start, int n, const u16 *rspq, unsigned int nrspq);
496 int t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid,
497                      unsigned int flags, unsigned int defq);
498 int t4_read_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid,
499                           u64 *flags, unsigned int *defq);
500 void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs,
501                      unsigned int start_index, unsigned int rw);
502 void t4_write_rss_key(struct adapter *adap, u32 *key, int idx);
503 void t4_read_rss_key(struct adapter *adap, u32 *key);
504
505 enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS };
506 int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
507                       unsigned int qtype, u64 *pbar2_qoffset,
508                       unsigned int *pbar2_qid);
509
510 int t4_init_sge_params(struct adapter *adapter);
511 int t4_init_tp_params(struct adapter *adap);
512 int t4_filter_field_shift(const struct adapter *adap, unsigned int filter_sel);
513 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
514 unsigned int t4_get_regs_len(struct adapter *adap);
515 unsigned int t4vf_get_pf_from_vf(struct adapter *adap);
516 void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size);
517 int t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
518 int t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
519 int t4_seeprom_wp(struct adapter *adapter, int enable);
520 int t4_memory_rw_addr(struct adapter *adap, int win,
521                       u32 addr, u32 len, void *hbuf, int dir);
522 int t4_memory_rw_mtype(struct adapter *adap, int win, int mtype, u32 maddr,
523                        u32 len, void *hbuf, int dir);
524 static inline int t4_memory_rw(struct adapter *adap, int win,
525                                int mtype, u32 maddr, u32 len,
526                                void *hbuf, int dir)
527 {
528         return t4_memory_rw_mtype(adap, win, mtype, maddr, len, hbuf, dir);
529 }
530 fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16);
531 #endif /* __CHELSIO_COMMON_H */