1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright (c) 2007-2018 Solarflare Communications Inc.
7 #ifndef _SYS_EFX_IMPL_H
8 #define _SYS_EFX_IMPL_H
12 #include "efx_regs_ef10.h"
15 #endif /* EFSYS_OPT_MCDI */
17 /* FIXME: Add definition for driver generated software events */
18 #ifndef ESE_DZ_EV_CODE_DRV_GEN_EV
19 #define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV
24 #include "siena_impl.h"
25 #endif /* EFSYS_OPT_SIENA */
27 #if EFSYS_OPT_HUNTINGTON
28 #include "hunt_impl.h"
29 #endif /* EFSYS_OPT_HUNTINGTON */
32 #include "medford_impl.h"
33 #endif /* EFSYS_OPT_MEDFORD */
35 #if EFSYS_OPT_MEDFORD2
36 #include "medford2_impl.h"
37 #endif /* EFSYS_OPT_MEDFORD2 */
40 #include "ef10_impl.h"
41 #endif /* EFX_OPTS_EF10() */
47 #define EFX_MOD_MCDI 0x00000001
48 #define EFX_MOD_PROBE 0x00000002
49 #define EFX_MOD_NVRAM 0x00000004
50 #define EFX_MOD_VPD 0x00000008
51 #define EFX_MOD_NIC 0x00000010
52 #define EFX_MOD_INTR 0x00000020
53 #define EFX_MOD_EV 0x00000040
54 #define EFX_MOD_RX 0x00000080
55 #define EFX_MOD_TX 0x00000100
56 #define EFX_MOD_PORT 0x00000200
57 #define EFX_MOD_MON 0x00000400
58 #define EFX_MOD_FILTER 0x00001000
59 #define EFX_MOD_LIC 0x00002000
60 #define EFX_MOD_TUNNEL 0x00004000
61 #define EFX_MOD_EVB 0x00008000
63 #define EFX_RESET_PHY 0x00000001
64 #define EFX_RESET_RXQ_ERR 0x00000002
65 #define EFX_RESET_TXQ_ERR 0x00000004
66 #define EFX_RESET_HW_UNAVAIL 0x00000008
68 typedef enum efx_mac_type_e {
77 typedef struct efx_ev_ops_s {
78 efx_rc_t (*eevo_init)(efx_nic_t *);
79 void (*eevo_fini)(efx_nic_t *);
80 efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int,
81 efsys_mem_t *, size_t, uint32_t,
82 uint32_t, uint32_t, efx_evq_t *);
83 void (*eevo_qdestroy)(efx_evq_t *);
84 efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int);
85 void (*eevo_qpost)(efx_evq_t *, uint16_t);
86 efx_rc_t (*eevo_qmoderate)(efx_evq_t *, unsigned int);
88 void (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *);
92 typedef struct efx_tx_ops_s {
93 efx_rc_t (*etxo_init)(efx_nic_t *);
94 void (*etxo_fini)(efx_nic_t *);
95 efx_rc_t (*etxo_qcreate)(efx_nic_t *,
96 unsigned int, unsigned int,
97 efsys_mem_t *, size_t,
99 efx_evq_t *, efx_txq_t *,
101 void (*etxo_qdestroy)(efx_txq_t *);
102 efx_rc_t (*etxo_qpost)(efx_txq_t *, efx_buffer_t *,
103 unsigned int, unsigned int,
105 void (*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int);
106 efx_rc_t (*etxo_qpace)(efx_txq_t *, unsigned int);
107 efx_rc_t (*etxo_qflush)(efx_txq_t *);
108 void (*etxo_qenable)(efx_txq_t *);
109 efx_rc_t (*etxo_qpio_enable)(efx_txq_t *);
110 void (*etxo_qpio_disable)(efx_txq_t *);
111 efx_rc_t (*etxo_qpio_write)(efx_txq_t *, uint8_t *, size_t,
113 efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int,
115 efx_rc_t (*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *,
116 unsigned int, unsigned int,
118 void (*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t,
121 void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t,
124 void (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
125 uint16_t, uint32_t, uint16_t,
127 void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
129 void (*etxo_qdesc_checksum_create)(efx_txq_t *, uint16_t,
132 void (*etxo_qstats_update)(efx_txq_t *,
137 typedef union efx_rxq_type_data_u {
141 #if EFSYS_OPT_RX_PACKED_STREAM
143 uint32_t eps_buf_size;
144 } ertd_packed_stream;
146 #if EFSYS_OPT_RX_ES_SUPER_BUFFER
148 uint32_t eessb_bufs_per_desc;
149 uint32_t eessb_max_dma_len;
150 uint32_t eessb_buf_stride;
151 uint32_t eessb_hol_block_timeout;
152 } ertd_es_super_buffer;
154 } efx_rxq_type_data_t;
156 typedef struct efx_rx_ops_s {
157 efx_rc_t (*erxo_init)(efx_nic_t *);
158 void (*erxo_fini)(efx_nic_t *);
159 #if EFSYS_OPT_RX_SCATTER
160 efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int);
162 #if EFSYS_OPT_RX_SCALE
163 efx_rc_t (*erxo_scale_context_alloc)(efx_nic_t *,
164 efx_rx_scale_context_type_t,
165 uint32_t, uint32_t *);
166 efx_rc_t (*erxo_scale_context_free)(efx_nic_t *, uint32_t);
167 efx_rc_t (*erxo_scale_mode_set)(efx_nic_t *, uint32_t,
169 efx_rx_hash_type_t, boolean_t);
170 efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint32_t,
172 efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, uint32_t,
173 unsigned int *, size_t);
174 uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t,
176 #endif /* EFSYS_OPT_RX_SCALE */
177 efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *,
179 void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t,
180 unsigned int, unsigned int,
182 void (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *);
183 #if EFSYS_OPT_RX_PACKED_STREAM
184 void (*erxo_qpush_ps_credits)(efx_rxq_t *);
185 uint8_t * (*erxo_qps_packet_info)(efx_rxq_t *, uint8_t *,
187 uint16_t *, uint32_t *, uint32_t *);
189 efx_rc_t (*erxo_qflush)(efx_rxq_t *);
190 void (*erxo_qenable)(efx_rxq_t *);
191 efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
192 unsigned int, efx_rxq_type_t,
193 const efx_rxq_type_data_t *,
194 efsys_mem_t *, size_t, uint32_t,
196 efx_evq_t *, efx_rxq_t *);
197 void (*erxo_qdestroy)(efx_rxq_t *);
200 typedef struct efx_mac_ops_s {
201 efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *);
202 efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *);
203 efx_rc_t (*emo_addr_set)(efx_nic_t *);
204 efx_rc_t (*emo_pdu_set)(efx_nic_t *);
205 efx_rc_t (*emo_pdu_get)(efx_nic_t *, size_t *);
206 efx_rc_t (*emo_reconfigure)(efx_nic_t *);
207 efx_rc_t (*emo_multicast_list_set)(efx_nic_t *);
208 efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *,
209 efx_rxq_t *, boolean_t);
210 void (*emo_filter_default_rxq_clear)(efx_nic_t *);
211 #if EFSYS_OPT_LOOPBACK
212 efx_rc_t (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t,
213 efx_loopback_type_t);
214 #endif /* EFSYS_OPT_LOOPBACK */
215 #if EFSYS_OPT_MAC_STATS
216 efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t);
217 efx_rc_t (*emo_stats_clear)(efx_nic_t *);
218 efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *);
219 efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *,
220 uint16_t, boolean_t);
221 efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
222 efsys_stat_t *, uint32_t *);
223 #endif /* EFSYS_OPT_MAC_STATS */
226 typedef struct efx_phy_ops_s {
227 efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */
228 efx_rc_t (*epo_reset)(efx_nic_t *);
229 efx_rc_t (*epo_reconfigure)(efx_nic_t *);
230 efx_rc_t (*epo_verify)(efx_nic_t *);
231 efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *);
232 efx_rc_t (*epo_link_state_get)(efx_nic_t *, efx_phy_link_state_t *);
233 #if EFSYS_OPT_PHY_STATS
234 efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
236 #endif /* EFSYS_OPT_PHY_STATS */
238 efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *);
239 efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t);
240 efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t,
241 efx_bist_result_t *, uint32_t *,
242 unsigned long *, size_t);
243 void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t);
244 #endif /* EFSYS_OPT_BIST */
248 typedef struct efx_filter_ops_s {
249 efx_rc_t (*efo_init)(efx_nic_t *);
250 void (*efo_fini)(efx_nic_t *);
251 efx_rc_t (*efo_restore)(efx_nic_t *);
252 efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *,
253 boolean_t may_replace);
254 efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *);
255 efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *,
257 efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
258 boolean_t, boolean_t, boolean_t,
259 uint8_t const *, uint32_t);
262 extern __checkReturn efx_rc_t
263 efx_filter_reconfigure(
265 __in_ecount(6) uint8_t const *mac_addr,
266 __in boolean_t all_unicst,
267 __in boolean_t mulcst,
268 __in boolean_t all_mulcst,
269 __in boolean_t brdcst,
270 __in_ecount(6*count) uint8_t const *addrs,
271 __in uint32_t count);
273 #endif /* EFSYS_OPT_FILTER */
276 typedef struct efx_tunnel_ops_s {
277 boolean_t (*eto_udp_encap_supported)(efx_nic_t *);
278 efx_rc_t (*eto_reconfigure)(efx_nic_t *);
280 #endif /* EFSYS_OPT_TUNNEL */
282 typedef struct efx_port_s {
283 efx_mac_type_t ep_mac_type;
284 uint32_t ep_phy_type;
287 uint8_t ep_mac_addr[6];
288 efx_link_mode_t ep_link_mode;
289 boolean_t ep_all_unicst;
291 boolean_t ep_all_mulcst;
293 unsigned int ep_fcntl;
294 boolean_t ep_fcntl_autoneg;
295 efx_oword_t ep_multicst_hash[2];
296 uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN *
297 EFX_MAC_MULTICAST_LIST_MAX];
298 uint32_t ep_mulcst_addr_count;
299 #if EFSYS_OPT_LOOPBACK
300 efx_loopback_type_t ep_loopback_type;
301 efx_link_mode_t ep_loopback_link_mode;
302 #endif /* EFSYS_OPT_LOOPBACK */
303 #if EFSYS_OPT_PHY_FLAGS
304 uint32_t ep_phy_flags;
305 #endif /* EFSYS_OPT_PHY_FLAGS */
306 #if EFSYS_OPT_PHY_LED_CONTROL
307 efx_phy_led_mode_t ep_phy_led_mode;
308 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
309 efx_phy_media_type_t ep_fixed_port_type;
310 efx_phy_media_type_t ep_module_type;
311 uint32_t ep_adv_cap_mask;
312 uint32_t ep_lp_cap_mask;
313 uint32_t ep_default_adv_cap_mask;
314 uint32_t ep_phy_cap_mask;
315 boolean_t ep_mac_drain;
317 efx_bist_type_t ep_current_bist;
319 const efx_mac_ops_t *ep_emop;
320 const efx_phy_ops_t *ep_epop;
323 typedef struct efx_mon_ops_s {
324 #if EFSYS_OPT_MON_STATS
325 efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
326 efx_mon_stat_value_t *);
327 efx_rc_t (*emo_limits_update)(efx_nic_t *,
328 efx_mon_stat_limits_t *);
329 #endif /* EFSYS_OPT_MON_STATS */
332 typedef struct efx_mon_s {
333 efx_mon_type_t em_type;
334 const efx_mon_ops_t *em_emop;
337 typedef struct efx_intr_ops_s {
338 efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *);
339 void (*eio_enable)(efx_nic_t *);
340 void (*eio_disable)(efx_nic_t *);
341 void (*eio_disable_unlocked)(efx_nic_t *);
342 efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int);
343 void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *);
344 void (*eio_status_message)(efx_nic_t *, unsigned int,
346 void (*eio_fatal)(efx_nic_t *);
347 void (*eio_fini)(efx_nic_t *);
350 typedef struct efx_intr_s {
351 const efx_intr_ops_t *ei_eiop;
352 efsys_mem_t *ei_esmp;
353 efx_intr_type_t ei_type;
354 unsigned int ei_level;
357 typedef struct efx_nic_ops_s {
358 efx_rc_t (*eno_probe)(efx_nic_t *);
359 efx_rc_t (*eno_board_cfg)(efx_nic_t *);
360 efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*);
361 efx_rc_t (*eno_reset)(efx_nic_t *);
362 efx_rc_t (*eno_init)(efx_nic_t *);
363 efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *);
364 efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t,
365 uint32_t *, size_t *);
366 boolean_t (*eno_hw_unavailable)(efx_nic_t *);
367 void (*eno_set_hw_unavailable)(efx_nic_t *);
369 efx_rc_t (*eno_register_test)(efx_nic_t *);
370 #endif /* EFSYS_OPT_DIAG */
371 void (*eno_fini)(efx_nic_t *);
372 void (*eno_unprobe)(efx_nic_t *);
375 #ifndef EFX_TXQ_LIMIT_TARGET
376 #define EFX_TXQ_LIMIT_TARGET 259
378 #ifndef EFX_RXQ_LIMIT_TARGET
379 #define EFX_RXQ_LIMIT_TARGET 512
387 typedef struct siena_filter_spec_s {
390 uint32_t sfs_dmaq_id;
391 uint32_t sfs_dword[3];
392 } siena_filter_spec_t;
394 typedef enum siena_filter_type_e {
395 EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
396 EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */
397 EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
398 EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */
399 EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
400 EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
402 EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
403 EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
404 EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
405 EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */
406 EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */
407 EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */
409 EFX_SIENA_FILTER_NTYPES
410 } siena_filter_type_t;
412 typedef enum siena_filter_tbl_id_e {
413 EFX_SIENA_FILTER_TBL_RX_IP = 0,
414 EFX_SIENA_FILTER_TBL_RX_MAC,
415 EFX_SIENA_FILTER_TBL_TX_IP,
416 EFX_SIENA_FILTER_TBL_TX_MAC,
417 EFX_SIENA_FILTER_NTBLS
418 } siena_filter_tbl_id_t;
420 typedef struct siena_filter_tbl_s {
421 int sft_size; /* number of entries */
422 int sft_used; /* active count */
423 uint32_t *sft_bitmap; /* active bitmap */
424 siena_filter_spec_t *sft_spec; /* array of saved specs */
425 } siena_filter_tbl_t;
427 typedef struct siena_filter_s {
428 siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS];
429 unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES];
432 #endif /* EFSYS_OPT_SIENA */
434 typedef struct efx_filter_s {
436 siena_filter_t *ef_siena_filter;
437 #endif /* EFSYS_OPT_SIENA */
439 ef10_filter_table_t *ef_ef10_filter_table;
440 #endif /* EFX_OPTS_EF10() */
446 siena_filter_tbl_clear(
448 __in siena_filter_tbl_id_t tbl);
450 #endif /* EFSYS_OPT_SIENA */
452 #endif /* EFSYS_OPT_FILTER */
456 #define EFX_TUNNEL_MAXNENTRIES (16)
460 typedef struct efx_tunnel_udp_entry_s {
461 uint16_t etue_port; /* host/cpu-endian */
462 uint16_t etue_protocol;
463 } efx_tunnel_udp_entry_t;
465 typedef struct efx_tunnel_cfg_s {
466 efx_tunnel_udp_entry_t etc_udp_entries[EFX_TUNNEL_MAXNENTRIES];
467 unsigned int etc_udp_entries_num;
470 #endif /* EFSYS_OPT_TUNNEL */
472 typedef struct efx_mcdi_ops_s {
473 efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
474 void (*emco_send_request)(efx_nic_t *, void *, size_t,
476 efx_rc_t (*emco_poll_reboot)(efx_nic_t *);
477 boolean_t (*emco_poll_response)(efx_nic_t *);
478 void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t);
479 void (*emco_fini)(efx_nic_t *);
480 efx_rc_t (*emco_feature_supported)(efx_nic_t *,
481 efx_mcdi_feature_id_t, boolean_t *);
482 void (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *,
486 typedef struct efx_mcdi_s {
487 const efx_mcdi_ops_t *em_emcop;
488 const efx_mcdi_transport_t *em_emtp;
489 efx_mcdi_iface_t em_emip;
492 #endif /* EFSYS_OPT_MCDI */
496 /* Invalid partition ID for en_nvram_partn_locked field of efx_nc_t */
497 #define EFX_NVRAM_PARTN_INVALID (0xffffffffu)
499 typedef struct efx_nvram_ops_s {
501 efx_rc_t (*envo_test)(efx_nic_t *);
502 #endif /* EFSYS_OPT_DIAG */
503 efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
505 efx_rc_t (*envo_partn_info)(efx_nic_t *, uint32_t,
507 efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *);
508 efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t,
509 unsigned int, caddr_t, size_t);
510 efx_rc_t (*envo_partn_read_backup)(efx_nic_t *, uint32_t,
511 unsigned int, caddr_t, size_t);
512 efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t,
513 unsigned int, size_t);
514 efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t,
515 unsigned int, caddr_t, size_t);
516 efx_rc_t (*envo_partn_rw_finish)(efx_nic_t *, uint32_t,
518 efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t,
519 uint32_t *, uint16_t *);
520 efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t,
522 efx_rc_t (*envo_buffer_validate)(uint32_t,
525 #endif /* EFSYS_OPT_NVRAM */
528 typedef struct efx_vpd_ops_s {
529 efx_rc_t (*evpdo_init)(efx_nic_t *);
530 efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *);
531 efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t);
532 efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t);
533 efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t);
534 efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t,
536 efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t,
538 efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t,
539 efx_vpd_value_t *, unsigned int *);
540 efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t);
541 void (*evpdo_fini)(efx_nic_t *);
543 #endif /* EFSYS_OPT_VPD */
545 #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM
547 __checkReturn efx_rc_t
548 efx_mcdi_nvram_partitions(
550 __out_bcount(size) caddr_t data,
552 __out unsigned int *npartnp);
554 __checkReturn efx_rc_t
555 efx_mcdi_nvram_metadata(
558 __out uint32_t *subtypep,
559 __out_ecount(4) uint16_t version[4],
560 __out_bcount_opt(size) char *descp,
563 __checkReturn efx_rc_t
567 __out efx_nvram_info_t *eni);
569 __checkReturn efx_rc_t
570 efx_mcdi_nvram_update_start(
572 __in uint32_t partn);
574 __checkReturn efx_rc_t
578 __in uint32_t offset,
579 __out_bcount(size) caddr_t data,
583 __checkReturn efx_rc_t
584 efx_mcdi_nvram_erase(
587 __in uint32_t offset,
590 __checkReturn efx_rc_t
591 efx_mcdi_nvram_write(
594 __in uint32_t offset,
595 __in_bcount(size) caddr_t data,
598 #define EFX_NVRAM_UPDATE_FLAGS_BACKGROUND 0x00000001
599 #define EFX_NVRAM_UPDATE_FLAGS_POLL 0x00000002
601 __checkReturn efx_rc_t
602 efx_mcdi_nvram_update_finish(
605 __in boolean_t reboot,
607 __out_opt uint32_t *verify_resultp);
611 __checkReturn efx_rc_t
614 __in uint32_t partn);
616 #endif /* EFSYS_OPT_DIAG */
618 #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
620 #if EFSYS_OPT_LICENSING
622 typedef struct efx_lic_ops_s {
623 efx_rc_t (*elo_update_licenses)(efx_nic_t *);
624 efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
625 efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
626 efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
627 size_t *, uint8_t *);
628 efx_rc_t (*elo_find_start)
629 (efx_nic_t *, caddr_t, size_t, uint32_t *);
630 efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t,
631 uint32_t, uint32_t *);
632 boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t,
633 uint32_t, uint32_t *, uint32_t *);
634 boolean_t (*elo_validate_key)(efx_nic_t *,
636 efx_rc_t (*elo_read_key)(efx_nic_t *,
637 caddr_t, size_t, uint32_t, uint32_t,
638 caddr_t, size_t, uint32_t *);
639 efx_rc_t (*elo_write_key)(efx_nic_t *,
640 caddr_t, size_t, uint32_t,
641 caddr_t, uint32_t, uint32_t *);
642 efx_rc_t (*elo_delete_key)(efx_nic_t *,
643 caddr_t, size_t, uint32_t,
644 uint32_t, uint32_t, uint32_t *);
645 efx_rc_t (*elo_create_partition)(efx_nic_t *,
647 efx_rc_t (*elo_finish_partition)(efx_nic_t *,
655 struct efx_vswitch_s {
657 efx_vswitch_id_t ev_vswitch_id;
658 uint32_t ev_num_vports;
660 * Vport configuration array: index 0 to store PF configuration
661 * and next ev_num_vports-1 entries hold VFs configuration.
663 efx_vport_config_t *ev_evcp;
666 typedef struct efx_evb_ops_s {
667 efx_rc_t (*eeo_init)(efx_nic_t *);
668 void (*eeo_fini)(efx_nic_t *);
669 efx_rc_t (*eeo_vswitch_alloc)(efx_nic_t *, efx_vswitch_id_t *);
670 efx_rc_t (*eeo_vswitch_free)(efx_nic_t *, efx_vswitch_id_t);
671 efx_rc_t (*eeo_vport_alloc)(efx_nic_t *, efx_vswitch_id_t,
672 efx_vport_type_t, uint16_t,
673 boolean_t, efx_vport_id_t *);
674 efx_rc_t (*eeo_vport_free)(efx_nic_t *, efx_vswitch_id_t,
676 efx_rc_t (*eeo_vport_mac_addr_add)(efx_nic_t *, efx_vswitch_id_t,
677 efx_vport_id_t, uint8_t *);
678 efx_rc_t (*eeo_vport_mac_addr_del)(efx_nic_t *, efx_vswitch_id_t,
679 efx_vport_id_t, uint8_t *);
680 efx_rc_t (*eeo_vadaptor_alloc)(efx_nic_t *, efx_vswitch_id_t,
682 efx_rc_t (*eeo_vadaptor_free)(efx_nic_t *, efx_vswitch_id_t,
684 efx_rc_t (*eeo_vport_assign)(efx_nic_t *, efx_vswitch_id_t,
685 efx_vport_id_t, uint32_t);
688 extern __checkReturn boolean_t
689 efx_is_zero_eth_addr(
690 __in_bcount(EFX_MAC_ADDR_LEN) const uint8_t *addrp);
692 #endif /* EFSYS_OPT_EVB */
694 #define EFX_DRV_VER_MAX 20
696 typedef struct efx_drv_cfg_s {
697 uint32_t edc_min_vi_count;
698 uint32_t edc_max_vi_count;
700 uint32_t edc_max_piobuf_count;
701 uint32_t edc_pio_alloc_size;
706 efx_family_t en_family;
707 uint32_t en_features;
708 efsys_identifier_t *en_esip;
709 efsys_lock_t *en_eslp;
710 efsys_bar_t *en_esbp;
711 unsigned int en_mod_flags;
712 unsigned int en_reset_flags;
713 efx_nic_cfg_t en_nic_cfg;
714 efx_drv_cfg_t en_drv_cfg;
718 uint32_t en_ev_qcount;
719 uint32_t en_rx_qcount;
720 uint32_t en_tx_qcount;
721 const efx_nic_ops_t *en_enop;
722 const efx_ev_ops_t *en_eevop;
723 const efx_tx_ops_t *en_etxop;
724 const efx_rx_ops_t *en_erxop;
725 efx_fw_variant_t efv;
726 char en_drv_version[EFX_DRV_VER_MAX];
728 efx_filter_t en_filter;
729 const efx_filter_ops_t *en_efop;
730 #endif /* EFSYS_OPT_FILTER */
732 efx_tunnel_cfg_t en_tunnel_cfg;
733 const efx_tunnel_ops_t *en_etop;
734 #endif /* EFSYS_OPT_TUNNEL */
737 #endif /* EFSYS_OPT_MCDI */
739 uint32_t en_nvram_partn_locked;
740 const efx_nvram_ops_t *en_envop;
741 #endif /* EFSYS_OPT_NVRAM */
743 const efx_vpd_ops_t *en_evpdop;
744 #endif /* EFSYS_OPT_VPD */
745 #if EFSYS_OPT_RX_SCALE
746 efx_rx_hash_support_t en_hash_support;
747 efx_rx_scale_context_type_t en_rss_context_type;
748 uint32_t en_rss_context;
749 #endif /* EFSYS_OPT_RX_SCALE */
750 uint32_t en_vport_id;
751 #if EFSYS_OPT_LICENSING
752 const efx_lic_ops_t *en_elop;
753 boolean_t en_licensing_supported;
758 #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
759 unsigned int enu_partn_mask;
760 #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
763 size_t enu_svpd_length;
764 #endif /* EFSYS_OPT_VPD */
767 #endif /* EFSYS_OPT_SIENA */
778 size_t ena_svpd_length;
779 #endif /* EFSYS_OPT_VPD */
780 efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS];
781 uint32_t ena_piobuf_count;
782 uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS];
783 uint32_t ena_pio_write_vi_base;
784 /* Memory BAR mapping regions */
785 uint32_t ena_uc_mem_map_offset;
786 size_t ena_uc_mem_map_size;
787 uint32_t ena_wc_mem_map_offset;
788 size_t ena_wc_mem_map_size;
791 #endif /* EFX_OPTS_EF10() */
793 const efx_evb_ops_t *en_eeop;
794 struct efx_vswitch_s *en_vswitchp;
795 #endif /* EFSYS_OPT_EVB */
798 #define EFX_FAMILY_IS_EF10(_enp) \
799 ((_enp)->en_family == EFX_FAMILY_MEDFORD2 || \
800 (_enp)->en_family == EFX_FAMILY_MEDFORD || \
801 (_enp)->en_family == EFX_FAMILY_HUNTINGTON)
804 #define EFX_NIC_MAGIC 0x02121996
806 typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *,
807 const efx_ev_callbacks_t *, void *);
809 typedef struct efx_evq_rxq_state_s {
810 unsigned int eers_rx_read_ptr;
811 unsigned int eers_rx_mask;
812 #if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
813 unsigned int eers_rx_stream_npackets;
814 boolean_t eers_rx_packed_stream;
816 #if EFSYS_OPT_RX_PACKED_STREAM
817 unsigned int eers_rx_packed_stream_credits;
819 } efx_evq_rxq_state_t;
825 unsigned int ee_index;
826 unsigned int ee_mask;
827 efsys_mem_t *ee_esmp;
829 uint32_t ee_stat[EV_NQSTATS];
830 #endif /* EFSYS_OPT_QSTATS */
832 efx_ev_handler_t ee_rx;
833 efx_ev_handler_t ee_tx;
834 efx_ev_handler_t ee_driver;
835 efx_ev_handler_t ee_global;
836 efx_ev_handler_t ee_drv_gen;
838 efx_ev_handler_t ee_mcdi;
839 #endif /* EFSYS_OPT_MCDI */
841 efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS];
844 #define EFX_EVQ_MAGIC 0x08081997
846 #define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */
849 #define EFX_EV_QSTAT_INCR(_eep, _stat) \
851 (_eep)->ee_stat[_stat]++; \
852 _NOTE(CONSTANTCONDITION) \
855 #define EFX_EV_QSTAT_INCR(_eep, _stat)
862 unsigned int er_index;
863 unsigned int er_label;
864 unsigned int er_mask;
866 efsys_mem_t *er_esmp;
867 efx_evq_rxq_state_t *er_ev_qstate;
870 #define EFX_RXQ_MAGIC 0x15022005
875 unsigned int et_index;
876 unsigned int et_mask;
877 efsys_mem_t *et_esmp;
878 #if EFSYS_OPT_HUNTINGTON
879 uint32_t et_pio_bufnum;
880 uint32_t et_pio_blknum;
881 uint32_t et_pio_write_offset;
882 uint32_t et_pio_offset;
886 uint32_t et_stat[TX_NQSTATS];
887 #endif /* EFSYS_OPT_QSTATS */
890 #define EFX_TXQ_MAGIC 0x05092005
892 #define EFX_MAC_ADDR_COPY(_dst, _src) \
894 (_dst)[0] = (_src)[0]; \
895 (_dst)[1] = (_src)[1]; \
896 (_dst)[2] = (_src)[2]; \
897 (_dst)[3] = (_src)[3]; \
898 (_dst)[4] = (_src)[4]; \
899 (_dst)[5] = (_src)[5]; \
900 _NOTE(CONSTANTCONDITION) \
903 #define EFX_MAC_BROADCAST_ADDR_SET(_dst) \
905 uint16_t *_d = (uint16_t *)(_dst); \
909 _NOTE(CONSTANTCONDITION) \
912 #if EFSYS_OPT_CHECK_REG
913 #define EFX_CHECK_REG(_enp, _reg) \
915 const char *name = #_reg; \
916 char min = name[4]; \
917 char max = name[5]; \
920 switch ((_enp)->en_family) { \
921 case EFX_FAMILY_SIENA: \
925 case EFX_FAMILY_HUNTINGTON: \
929 case EFX_FAMILY_MEDFORD: \
933 case EFX_FAMILY_MEDFORD2: \
942 EFSYS_ASSERT3S(rev, >=, min); \
943 EFSYS_ASSERT3S(rev, <=, max); \
945 _NOTE(CONSTANTCONDITION) \
948 #define EFX_CHECK_REG(_enp, _reg) do { \
949 _NOTE(CONSTANTCONDITION) \
953 #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \
955 EFX_CHECK_REG((_enp), (_reg)); \
956 EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \
958 EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \
959 uint32_t, _reg ## _OFST, \
960 uint32_t, (_edp)->ed_u32[0]); \
961 _NOTE(CONSTANTCONDITION) \
964 #define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \
966 EFX_CHECK_REG((_enp), (_reg)); \
967 EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \
968 uint32_t, _reg ## _OFST, \
969 uint32_t, (_edp)->ed_u32[0]); \
970 EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \
972 _NOTE(CONSTANTCONDITION) \
975 #define EFX_BAR_READQ(_enp, _reg, _eqp) \
977 EFX_CHECK_REG((_enp), (_reg)); \
978 EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \
980 EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \
981 uint32_t, _reg ## _OFST, \
982 uint32_t, (_eqp)->eq_u32[1], \
983 uint32_t, (_eqp)->eq_u32[0]); \
984 _NOTE(CONSTANTCONDITION) \
987 #define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \
989 EFX_CHECK_REG((_enp), (_reg)); \
990 EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \
991 uint32_t, _reg ## _OFST, \
992 uint32_t, (_eqp)->eq_u32[1], \
993 uint32_t, (_eqp)->eq_u32[0]); \
994 EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \
996 _NOTE(CONSTANTCONDITION) \
999 #define EFX_BAR_READO(_enp, _reg, _eop) \
1001 EFX_CHECK_REG((_enp), (_reg)); \
1002 EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \
1004 EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \
1005 uint32_t, _reg ## _OFST, \
1006 uint32_t, (_eop)->eo_u32[3], \
1007 uint32_t, (_eop)->eo_u32[2], \
1008 uint32_t, (_eop)->eo_u32[1], \
1009 uint32_t, (_eop)->eo_u32[0]); \
1010 _NOTE(CONSTANTCONDITION) \
1013 #define EFX_BAR_WRITEO(_enp, _reg, _eop) \
1015 EFX_CHECK_REG((_enp), (_reg)); \
1016 EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \
1017 uint32_t, _reg ## _OFST, \
1018 uint32_t, (_eop)->eo_u32[3], \
1019 uint32_t, (_eop)->eo_u32[2], \
1020 uint32_t, (_eop)->eo_u32[1], \
1021 uint32_t, (_eop)->eo_u32[0]); \
1022 EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \
1024 _NOTE(CONSTANTCONDITION) \
1028 * Accessors for memory BAR non-VI tables.
1030 * Code used on EF10 *must* use EFX_BAR_VI_*() macros for per-VI registers,
1031 * to ensure the correct runtime VI window size is used on Medford2.
1033 * Siena-only code may continue using EFX_BAR_TBL_*() macros for VI registers.
1036 #define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \
1038 EFX_CHECK_REG((_enp), (_reg)); \
1039 EFSYS_BAR_READD((_enp)->en_esbp, \
1040 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1042 EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \
1043 uint32_t, (_index), \
1044 uint32_t, _reg ## _OFST, \
1045 uint32_t, (_edp)->ed_u32[0]); \
1046 _NOTE(CONSTANTCONDITION) \
1049 #define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \
1051 EFX_CHECK_REG((_enp), (_reg)); \
1052 EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \
1053 uint32_t, (_index), \
1054 uint32_t, _reg ## _OFST, \
1055 uint32_t, (_edp)->ed_u32[0]); \
1056 EFSYS_BAR_WRITED((_enp)->en_esbp, \
1057 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1059 _NOTE(CONSTANTCONDITION) \
1062 #define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \
1064 EFX_CHECK_REG((_enp), (_reg)); \
1065 EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \
1066 uint32_t, (_index), \
1067 uint32_t, _reg ## _OFST, \
1068 uint32_t, (_edp)->ed_u32[0]); \
1069 EFSYS_BAR_WRITED((_enp)->en_esbp, \
1071 (3 * sizeof (efx_dword_t)) + \
1072 ((_index) * _reg ## _STEP)), \
1074 _NOTE(CONSTANTCONDITION) \
1077 #define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \
1079 EFX_CHECK_REG((_enp), (_reg)); \
1080 EFSYS_BAR_READQ((_enp)->en_esbp, \
1081 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1083 EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \
1084 uint32_t, (_index), \
1085 uint32_t, _reg ## _OFST, \
1086 uint32_t, (_eqp)->eq_u32[1], \
1087 uint32_t, (_eqp)->eq_u32[0]); \
1088 _NOTE(CONSTANTCONDITION) \
1091 #define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \
1093 EFX_CHECK_REG((_enp), (_reg)); \
1094 EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \
1095 uint32_t, (_index), \
1096 uint32_t, _reg ## _OFST, \
1097 uint32_t, (_eqp)->eq_u32[1], \
1098 uint32_t, (_eqp)->eq_u32[0]); \
1099 EFSYS_BAR_WRITEQ((_enp)->en_esbp, \
1100 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1102 _NOTE(CONSTANTCONDITION) \
1105 #define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \
1107 EFX_CHECK_REG((_enp), (_reg)); \
1108 EFSYS_BAR_READO((_enp)->en_esbp, \
1109 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1111 EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \
1112 uint32_t, (_index), \
1113 uint32_t, _reg ## _OFST, \
1114 uint32_t, (_eop)->eo_u32[3], \
1115 uint32_t, (_eop)->eo_u32[2], \
1116 uint32_t, (_eop)->eo_u32[1], \
1117 uint32_t, (_eop)->eo_u32[0]); \
1118 _NOTE(CONSTANTCONDITION) \
1121 #define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \
1123 EFX_CHECK_REG((_enp), (_reg)); \
1124 EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \
1125 uint32_t, (_index), \
1126 uint32_t, _reg ## _OFST, \
1127 uint32_t, (_eop)->eo_u32[3], \
1128 uint32_t, (_eop)->eo_u32[2], \
1129 uint32_t, (_eop)->eo_u32[1], \
1130 uint32_t, (_eop)->eo_u32[0]); \
1131 EFSYS_BAR_WRITEO((_enp)->en_esbp, \
1132 (_reg ## _OFST + ((_index) * _reg ## _STEP)), \
1134 _NOTE(CONSTANTCONDITION) \
1138 * Accessors for memory BAR per-VI registers.
1140 * The VI window size is 8KB for Medford and all earlier controllers.
1141 * For Medford2, the VI window size can be 8KB, 16KB or 64KB.
1144 #define EFX_BAR_VI_READD(_enp, _reg, _index, _edp, _lock) \
1146 EFX_CHECK_REG((_enp), (_reg)); \
1147 EFSYS_BAR_READD((_enp)->en_esbp, \
1148 ((_reg ## _OFST) + \
1149 ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
1151 EFSYS_PROBE4(efx_bar_vi_readd, const char *, #_reg, \
1152 uint32_t, (_index), \
1153 uint32_t, _reg ## _OFST, \
1154 uint32_t, (_edp)->ed_u32[0]); \
1155 _NOTE(CONSTANTCONDITION) \
1158 #define EFX_BAR_VI_WRITED(_enp, _reg, _index, _edp, _lock) \
1160 EFX_CHECK_REG((_enp), (_reg)); \
1161 EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \
1162 uint32_t, (_index), \
1163 uint32_t, _reg ## _OFST, \
1164 uint32_t, (_edp)->ed_u32[0]); \
1165 EFSYS_BAR_WRITED((_enp)->en_esbp, \
1166 ((_reg ## _OFST) + \
1167 ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
1169 _NOTE(CONSTANTCONDITION) \
1172 #define EFX_BAR_VI_WRITED2(_enp, _reg, _index, _edp, _lock) \
1174 EFX_CHECK_REG((_enp), (_reg)); \
1175 EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \
1176 uint32_t, (_index), \
1177 uint32_t, _reg ## _OFST, \
1178 uint32_t, (_edp)->ed_u32[0]); \
1179 EFSYS_BAR_WRITED((_enp)->en_esbp, \
1180 ((_reg ## _OFST) + \
1181 (2 * sizeof (efx_dword_t)) + \
1182 ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
1184 _NOTE(CONSTANTCONDITION) \
1188 * Allow drivers to perform optimised 128-bit VI doorbell writes.
1189 * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
1190 * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid
1191 * the need for locking in the host, and are the only ones known to be safe to
1192 * use 128-bites write with.
1194 #define EFX_BAR_VI_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \
1196 EFX_CHECK_REG((_enp), (_reg)); \
1197 EFSYS_PROBE7(efx_bar_vi_doorbell_writeo, \
1198 const char *, #_reg, \
1199 uint32_t, (_index), \
1200 uint32_t, _reg ## _OFST, \
1201 uint32_t, (_eop)->eo_u32[3], \
1202 uint32_t, (_eop)->eo_u32[2], \
1203 uint32_t, (_eop)->eo_u32[1], \
1204 uint32_t, (_eop)->eo_u32[0]); \
1205 EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \
1207 ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
1209 _NOTE(CONSTANTCONDITION) \
1212 #define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \
1214 unsigned int _new = (_wptr); \
1215 unsigned int _old = (_owptr); \
1217 if ((_new) >= (_old)) \
1218 EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \
1219 (_old) * sizeof (efx_desc_t), \
1220 ((_new) - (_old)) * sizeof (efx_desc_t)); \
1223 * It is cheaper to sync entire map than sync \
1224 * two parts especially when offset/size are \
1225 * ignored and entire map is synced in any case.\
1227 EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \
1229 (_entries) * sizeof (efx_desc_t)); \
1230 _NOTE(CONSTANTCONDITION) \
1233 extern __checkReturn efx_rc_t
1235 __in efx_nic_t *enp);
1238 efx_mac_multicast_hash_compute(
1239 __in_ecount(6*count) uint8_t const *addrs,
1241 __out efx_oword_t *hash_low,
1242 __out efx_oword_t *hash_high);
1244 extern __checkReturn efx_rc_t
1246 __in efx_nic_t *enp);
1250 __in efx_nic_t *enp);
1254 /* VPD utility functions */
1256 extern __checkReturn efx_rc_t
1257 efx_vpd_hunk_length(
1258 __in_bcount(size) caddr_t data,
1260 __out size_t *lengthp);
1262 extern __checkReturn efx_rc_t
1263 efx_vpd_hunk_verify(
1264 __in_bcount(size) caddr_t data,
1266 __out_opt boolean_t *cksummedp);
1268 extern __checkReturn efx_rc_t
1269 efx_vpd_hunk_reinit(
1270 __in_bcount(size) caddr_t data,
1272 __in boolean_t wantpid);
1274 extern __checkReturn efx_rc_t
1276 __in_bcount(size) caddr_t data,
1278 __in efx_vpd_tag_t tag,
1279 __in efx_vpd_keyword_t keyword,
1280 __out unsigned int *payloadp,
1281 __out uint8_t *paylenp);
1283 extern __checkReturn efx_rc_t
1285 __in_bcount(size) caddr_t data,
1287 __out efx_vpd_tag_t *tagp,
1288 __out efx_vpd_keyword_t *keyword,
1289 __out_opt unsigned int *payloadp,
1290 __out_opt uint8_t *paylenp,
1291 __inout unsigned int *contp);
1293 extern __checkReturn efx_rc_t
1295 __in_bcount(size) caddr_t data,
1297 __in efx_vpd_value_t *evvp);
1299 #endif /* EFSYS_OPT_VPD */
1303 extern __checkReturn efx_rc_t
1304 efx_mcdi_set_workaround(
1305 __in efx_nic_t *enp,
1307 __in boolean_t enabled,
1308 __out_opt uint32_t *flagsp);
1310 extern __checkReturn efx_rc_t
1311 efx_mcdi_get_workarounds(
1312 __in efx_nic_t *enp,
1313 __out_opt uint32_t *implementedp,
1314 __out_opt uint32_t *enabledp);
1316 #endif /* EFSYS_OPT_MCDI */
1318 #if EFSYS_OPT_MAC_STATS
1321 * Closed range of stats (i.e. the first and the last are included).
1322 * The last must be greater or equal (if the range is one item only) to
1325 struct efx_mac_stats_range {
1326 efx_mac_stat_t first;
1327 efx_mac_stat_t last;
1331 efx_mac_stats_mask_add_ranges(
1332 __inout_bcount(mask_size) uint32_t *maskp,
1333 __in size_t mask_size,
1334 __in_ecount(rng_count) const struct efx_mac_stats_range *rngp,
1335 __in unsigned int rng_count);
1337 #endif /* EFSYS_OPT_MAC_STATS */
1343 #endif /* _SYS_EFX_IMPL_H */