1*49ef7e06SGarrett D'Amore /*
2*49ef7e06SGarrett D'Amore  * Copyright (c) 2007-2015 Solarflare Communications Inc.
3*49ef7e06SGarrett D'Amore  * All rights reserved.
4*49ef7e06SGarrett D'Amore  *
5*49ef7e06SGarrett D'Amore  * Redistribution and use in source and binary forms, with or without
6*49ef7e06SGarrett D'Amore  * modification, are permitted provided that the following conditions are met:
7*49ef7e06SGarrett D'Amore  *
8*49ef7e06SGarrett D'Amore  * 1. Redistributions of source code must retain the above copyright notice,
9*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer.
10*49ef7e06SGarrett D'Amore  * 2. Redistributions in binary form must reproduce the above copyright notice,
11*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer in the documentation
12*49ef7e06SGarrett D'Amore  *    and/or other materials provided with the distribution.
13*49ef7e06SGarrett D'Amore  *
14*49ef7e06SGarrett D'Amore  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15*49ef7e06SGarrett D'Amore  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16*49ef7e06SGarrett D'Amore  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*49ef7e06SGarrett D'Amore  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18*49ef7e06SGarrett D'Amore  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19*49ef7e06SGarrett D'Amore  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20*49ef7e06SGarrett D'Amore  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21*49ef7e06SGarrett D'Amore  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22*49ef7e06SGarrett D'Amore  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23*49ef7e06SGarrett D'Amore  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24*49ef7e06SGarrett D'Amore  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*49ef7e06SGarrett D'Amore  *
26*49ef7e06SGarrett D'Amore  * The views and conclusions contained in the software and documentation are
27*49ef7e06SGarrett D'Amore  * those of the authors and should not be interpreted as representing official
28*49ef7e06SGarrett D'Amore  * policies, either expressed or implied, of the FreeBSD Project.
29*49ef7e06SGarrett D'Amore  */
30*49ef7e06SGarrett D'Amore 
31*49ef7e06SGarrett D'Amore #ifndef	_SYS_EFX_IMPL_H
32*49ef7e06SGarrett D'Amore #define	_SYS_EFX_IMPL_H
33*49ef7e06SGarrett D'Amore 
34*49ef7e06SGarrett D'Amore #include "efx.h"
35*49ef7e06SGarrett D'Amore #include "efx_regs.h"
36*49ef7e06SGarrett D'Amore #include "efx_regs_ef10.h"
37*49ef7e06SGarrett D'Amore 
38*49ef7e06SGarrett D'Amore /* FIXME: Add definition for driver generated software events */
39*49ef7e06SGarrett D'Amore #ifndef	ESE_DZ_EV_CODE_DRV_GEN_EV
40*49ef7e06SGarrett D'Amore #define	ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV
41*49ef7e06SGarrett D'Amore #endif
42*49ef7e06SGarrett D'Amore 
43*49ef7e06SGarrett D'Amore 
44*49ef7e06SGarrett D'Amore #if EFSYS_OPT_SIENA
45*49ef7e06SGarrett D'Amore #include "siena_impl.h"
46*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_SIENA */
47*49ef7e06SGarrett D'Amore 
48*49ef7e06SGarrett D'Amore #if EFSYS_OPT_HUNTINGTON
49*49ef7e06SGarrett D'Amore #include "hunt_impl.h"
50*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_HUNTINGTON */
51*49ef7e06SGarrett D'Amore 
52*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MEDFORD
53*49ef7e06SGarrett D'Amore #include "medford_impl.h"
54*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MEDFORD */
55*49ef7e06SGarrett D'Amore 
56*49ef7e06SGarrett D'Amore #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
57*49ef7e06SGarrett D'Amore #include "ef10_impl.h"
58*49ef7e06SGarrett D'Amore #endif	/* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
59*49ef7e06SGarrett D'Amore 
60*49ef7e06SGarrett D'Amore #ifdef	__cplusplus
61*49ef7e06SGarrett D'Amore extern "C" {
62*49ef7e06SGarrett D'Amore #endif
63*49ef7e06SGarrett D'Amore 
64*49ef7e06SGarrett D'Amore #define	EFX_MOD_MCDI		0x00000001
65*49ef7e06SGarrett D'Amore #define	EFX_MOD_PROBE		0x00000002
66*49ef7e06SGarrett D'Amore #define	EFX_MOD_NVRAM		0x00000004
67*49ef7e06SGarrett D'Amore #define	EFX_MOD_VPD		0x00000008
68*49ef7e06SGarrett D'Amore #define	EFX_MOD_NIC		0x00000010
69*49ef7e06SGarrett D'Amore #define	EFX_MOD_INTR		0x00000020
70*49ef7e06SGarrett D'Amore #define	EFX_MOD_EV		0x00000040
71*49ef7e06SGarrett D'Amore #define	EFX_MOD_RX		0x00000080
72*49ef7e06SGarrett D'Amore #define	EFX_MOD_TX		0x00000100
73*49ef7e06SGarrett D'Amore #define	EFX_MOD_PORT		0x00000200
74*49ef7e06SGarrett D'Amore #define	EFX_MOD_MON		0x00000400
75*49ef7e06SGarrett D'Amore #define	EFX_MOD_WOL		0x00000800
76*49ef7e06SGarrett D'Amore #define	EFX_MOD_FILTER		0x00001000
77*49ef7e06SGarrett D'Amore #define	EFX_MOD_LIC		0x00002000
78*49ef7e06SGarrett D'Amore 
79*49ef7e06SGarrett D'Amore #define	EFX_RESET_PHY		0x00000001
80*49ef7e06SGarrett D'Amore #define	EFX_RESET_RXQ_ERR	0x00000002
81*49ef7e06SGarrett D'Amore #define	EFX_RESET_TXQ_ERR	0x00000004
82*49ef7e06SGarrett D'Amore 
83*49ef7e06SGarrett D'Amore typedef enum efx_mac_type_e {
84*49ef7e06SGarrett D'Amore 	EFX_MAC_INVALID = 0,
85*49ef7e06SGarrett D'Amore 	EFX_MAC_SIENA,
86*49ef7e06SGarrett D'Amore 	EFX_MAC_HUNTINGTON,
87*49ef7e06SGarrett D'Amore 	EFX_MAC_MEDFORD,
88*49ef7e06SGarrett D'Amore 	EFX_MAC_NTYPES
89*49ef7e06SGarrett D'Amore } efx_mac_type_t;
90*49ef7e06SGarrett D'Amore 
91*49ef7e06SGarrett D'Amore typedef struct efx_ev_ops_s {
92*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eevo_init)(efx_nic_t *);
93*49ef7e06SGarrett D'Amore 	void		(*eevo_fini)(efx_nic_t *);
94*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eevo_qcreate)(efx_nic_t *, unsigned int,
95*49ef7e06SGarrett D'Amore 					  efsys_mem_t *, size_t, uint32_t,
96*49ef7e06SGarrett D'Amore 					  efx_evq_t *);
97*49ef7e06SGarrett D'Amore 	void		(*eevo_qdestroy)(efx_evq_t *);
98*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eevo_qprime)(efx_evq_t *, unsigned int);
99*49ef7e06SGarrett D'Amore 	void		(*eevo_qpost)(efx_evq_t *, uint16_t);
100*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eevo_qmoderate)(efx_evq_t *, unsigned int);
101*49ef7e06SGarrett D'Amore #if EFSYS_OPT_QSTATS
102*49ef7e06SGarrett D'Amore 	void		(*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *);
103*49ef7e06SGarrett D'Amore #endif
104*49ef7e06SGarrett D'Amore } efx_ev_ops_t;
105*49ef7e06SGarrett D'Amore 
106*49ef7e06SGarrett D'Amore typedef struct efx_tx_ops_s {
107*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_init)(efx_nic_t *);
108*49ef7e06SGarrett D'Amore 	void		(*etxo_fini)(efx_nic_t *);
109*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qcreate)(efx_nic_t *,
110*49ef7e06SGarrett D'Amore 					unsigned int, unsigned int,
111*49ef7e06SGarrett D'Amore 					efsys_mem_t *, size_t,
112*49ef7e06SGarrett D'Amore 					uint32_t, uint16_t,
113*49ef7e06SGarrett D'Amore 					efx_evq_t *, efx_txq_t *,
114*49ef7e06SGarrett D'Amore 					unsigned int *);
115*49ef7e06SGarrett D'Amore 	void		(*etxo_qdestroy)(efx_txq_t *);
116*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qpost)(efx_txq_t *, efx_buffer_t *,
117*49ef7e06SGarrett D'Amore 				      unsigned int, unsigned int,
118*49ef7e06SGarrett D'Amore 				      unsigned int *);
119*49ef7e06SGarrett D'Amore 	void		(*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int);
120*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qpace)(efx_txq_t *, unsigned int);
121*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qflush)(efx_txq_t *);
122*49ef7e06SGarrett D'Amore 	void		(*etxo_qenable)(efx_txq_t *);
123*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qpio_enable)(efx_txq_t *);
124*49ef7e06SGarrett D'Amore 	void		(*etxo_qpio_disable)(efx_txq_t *);
125*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qpio_write)(efx_txq_t *,uint8_t *, size_t,
126*49ef7e06SGarrett D'Amore 					   size_t);
127*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int,
128*49ef7e06SGarrett D'Amore 					   unsigned int *);
129*49ef7e06SGarrett D'Amore 	efx_rc_t	(*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *,
130*49ef7e06SGarrett D'Amore 				      unsigned int, unsigned int,
131*49ef7e06SGarrett D'Amore 				      unsigned int *);
132*49ef7e06SGarrett D'Amore 	void		(*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t,
133*49ef7e06SGarrett D'Amore 						size_t, boolean_t,
134*49ef7e06SGarrett D'Amore 						efx_desc_t *);
135*49ef7e06SGarrett D'Amore 	void		(*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t,
136*49ef7e06SGarrett D'Amore 						uint32_t, uint8_t,
137*49ef7e06SGarrett D'Amore 						efx_desc_t *);
138*49ef7e06SGarrett D'Amore 	void		(*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
139*49ef7e06SGarrett D'Amore 						uint32_t, uint16_t,
140*49ef7e06SGarrett D'Amore 						efx_desc_t *, int);
141*49ef7e06SGarrett D'Amore 	void		(*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
142*49ef7e06SGarrett D'Amore 						efx_desc_t *);
143*49ef7e06SGarrett D'Amore #if EFSYS_OPT_QSTATS
144*49ef7e06SGarrett D'Amore 	void		(*etxo_qstats_update)(efx_txq_t *,
145*49ef7e06SGarrett D'Amore 					      efsys_stat_t *);
146*49ef7e06SGarrett D'Amore #endif
147*49ef7e06SGarrett D'Amore } efx_tx_ops_t;
148*49ef7e06SGarrett D'Amore 
149*49ef7e06SGarrett D'Amore typedef struct efx_rx_ops_s {
150*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_init)(efx_nic_t *);
151*49ef7e06SGarrett D'Amore 	void		(*erxo_fini)(efx_nic_t *);
152*49ef7e06SGarrett D'Amore #if EFSYS_OPT_RX_SCATTER
153*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_scatter_enable)(efx_nic_t *, unsigned int);
154*49ef7e06SGarrett D'Amore #endif
155*49ef7e06SGarrett D'Amore #if EFSYS_OPT_RX_SCALE
156*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_scale_mode_set)(efx_nic_t *, efx_rx_hash_alg_t,
157*49ef7e06SGarrett D'Amore 					       efx_rx_hash_type_t, boolean_t);
158*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t);
159*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_scale_tbl_set)(efx_nic_t *, unsigned int *,
160*49ef7e06SGarrett D'Amore 					      size_t);
161*49ef7e06SGarrett D'Amore 	uint32_t	(*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t,
162*49ef7e06SGarrett D'Amore 					    uint8_t *);
163*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_RX_SCALE */
164*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *,
165*49ef7e06SGarrett D'Amore 					      uint16_t *);
166*49ef7e06SGarrett D'Amore 	void		(*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t,
167*49ef7e06SGarrett D'Amore 				      unsigned int, unsigned int,
168*49ef7e06SGarrett D'Amore 				      unsigned int);
169*49ef7e06SGarrett D'Amore 	void		(*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *);
170*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_qflush)(efx_rxq_t *);
171*49ef7e06SGarrett D'Amore 	void		(*erxo_qenable)(efx_rxq_t *);
172*49ef7e06SGarrett D'Amore 	efx_rc_t	(*erxo_qcreate)(efx_nic_t *enp, unsigned int,
173*49ef7e06SGarrett D'Amore 					unsigned int, efx_rxq_type_t,
174*49ef7e06SGarrett D'Amore 					efsys_mem_t *, size_t, uint32_t,
175*49ef7e06SGarrett D'Amore 					efx_evq_t *, efx_rxq_t *);
176*49ef7e06SGarrett D'Amore 	void		(*erxo_qdestroy)(efx_rxq_t *);
177*49ef7e06SGarrett D'Amore } efx_rx_ops_t;
178*49ef7e06SGarrett D'Amore 
179*49ef7e06SGarrett D'Amore typedef struct efx_mac_ops_s {
180*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_poll)(efx_nic_t *, efx_link_mode_t *);
181*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_up)(efx_nic_t *, boolean_t *);
182*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_addr_set)(efx_nic_t *);
183*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_pdu_set)(efx_nic_t *);
184*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_reconfigure)(efx_nic_t *);
185*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_multicast_list_set)(efx_nic_t *);
186*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_filter_default_rxq_set)(efx_nic_t *,
187*49ef7e06SGarrett D'Amore 						      efx_rxq_t *, boolean_t);
188*49ef7e06SGarrett D'Amore 	void		(*emo_filter_default_rxq_clear)(efx_nic_t *);
189*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LOOPBACK
190*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_loopback_set)(efx_nic_t *, efx_link_mode_t,
191*49ef7e06SGarrett D'Amore 					    efx_loopback_type_t);
192*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_LOOPBACK */
193*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MAC_STATS
194*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_stats_upload)(efx_nic_t *, efsys_mem_t *);
195*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *,
196*49ef7e06SGarrett D'Amore 					      uint16_t, boolean_t);
197*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
198*49ef7e06SGarrett D'Amore 					    efsys_stat_t *, uint32_t *);
199*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MAC_STATS */
200*49ef7e06SGarrett D'Amore } efx_mac_ops_t;
201*49ef7e06SGarrett D'Amore 
202*49ef7e06SGarrett D'Amore typedef struct efx_phy_ops_s {
203*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_power)(efx_nic_t *, boolean_t); /* optional */
204*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_reset)(efx_nic_t *);
205*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_reconfigure)(efx_nic_t *);
206*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_verify)(efx_nic_t *);
207*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_oui_get)(efx_nic_t *, uint32_t *);
208*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_STATS
209*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
210*49ef7e06SGarrett D'Amore 					    uint32_t *);
211*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_STATS */
212*49ef7e06SGarrett D'Amore #if EFSYS_OPT_BIST
213*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_bist_enable_offline)(efx_nic_t *);
214*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_bist_start)(efx_nic_t *, efx_bist_type_t);
215*49ef7e06SGarrett D'Amore 	efx_rc_t	(*epo_bist_poll)(efx_nic_t *, efx_bist_type_t,
216*49ef7e06SGarrett D'Amore 					 efx_bist_result_t *, uint32_t *,
217*49ef7e06SGarrett D'Amore 					 unsigned long *, size_t);
218*49ef7e06SGarrett D'Amore 	void		(*epo_bist_stop)(efx_nic_t *, efx_bist_type_t);
219*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_BIST */
220*49ef7e06SGarrett D'Amore } efx_phy_ops_t;
221*49ef7e06SGarrett D'Amore 
222*49ef7e06SGarrett D'Amore #if EFSYS_OPT_FILTER
223*49ef7e06SGarrett D'Amore typedef struct efx_filter_ops_s {
224*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_init)(efx_nic_t *);
225*49ef7e06SGarrett D'Amore 	void		(*efo_fini)(efx_nic_t *);
226*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_restore)(efx_nic_t *);
227*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_add)(efx_nic_t *, efx_filter_spec_t *,
228*49ef7e06SGarrett D'Amore 				   boolean_t may_replace);
229*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_delete)(efx_nic_t *, efx_filter_spec_t *);
230*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *);
231*49ef7e06SGarrett D'Amore 	efx_rc_t	(*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
232*49ef7e06SGarrett D'Amore 				   boolean_t, boolean_t, boolean_t,
233*49ef7e06SGarrett D'Amore 				   uint8_t const *, uint32_t);
234*49ef7e06SGarrett D'Amore } efx_filter_ops_t;
235*49ef7e06SGarrett D'Amore 
236*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
237*49ef7e06SGarrett D'Amore efx_filter_reconfigure(
238*49ef7e06SGarrett D'Amore 	__in				efx_nic_t *enp,
239*49ef7e06SGarrett D'Amore 	__in_ecount(6)			uint8_t const *mac_addr,
240*49ef7e06SGarrett D'Amore 	__in				boolean_t all_unicst,
241*49ef7e06SGarrett D'Amore 	__in				boolean_t mulcst,
242*49ef7e06SGarrett D'Amore 	__in				boolean_t all_mulcst,
243*49ef7e06SGarrett D'Amore 	__in				boolean_t brdcst,
244*49ef7e06SGarrett D'Amore 	__in_ecount(6*count)		uint8_t const *addrs,
245*49ef7e06SGarrett D'Amore 	__in				uint32_t count);
246*49ef7e06SGarrett D'Amore 
247*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_FILTER */
248*49ef7e06SGarrett D'Amore 
249*49ef7e06SGarrett D'Amore 
250*49ef7e06SGarrett D'Amore typedef struct efx_port_s {
251*49ef7e06SGarrett D'Amore 	efx_mac_type_t		ep_mac_type;
252*49ef7e06SGarrett D'Amore 	uint32_t  		ep_phy_type;
253*49ef7e06SGarrett D'Amore 	uint8_t			ep_port;
254*49ef7e06SGarrett D'Amore 	uint32_t		ep_mac_pdu;
255*49ef7e06SGarrett D'Amore 	uint8_t			ep_mac_addr[6];
256*49ef7e06SGarrett D'Amore 	efx_link_mode_t		ep_link_mode;
257*49ef7e06SGarrett D'Amore 	boolean_t		ep_all_unicst;
258*49ef7e06SGarrett D'Amore 	boolean_t		ep_mulcst;
259*49ef7e06SGarrett D'Amore 	boolean_t		ep_all_mulcst;
260*49ef7e06SGarrett D'Amore 	boolean_t		ep_brdcst;
261*49ef7e06SGarrett D'Amore 	unsigned int		ep_fcntl;
262*49ef7e06SGarrett D'Amore 	boolean_t		ep_fcntl_autoneg;
263*49ef7e06SGarrett D'Amore 	efx_oword_t		ep_multicst_hash[2];
264*49ef7e06SGarrett D'Amore 	uint8_t			ep_mulcst_addr_list[EFX_MAC_ADDR_LEN *
265*49ef7e06SGarrett D'Amore 						    EFX_MAC_MULTICAST_LIST_MAX];
266*49ef7e06SGarrett D'Amore 	uint32_t		ep_mulcst_addr_count;
267*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LOOPBACK
268*49ef7e06SGarrett D'Amore 	efx_loopback_type_t	ep_loopback_type;
269*49ef7e06SGarrett D'Amore 	efx_link_mode_t		ep_loopback_link_mode;
270*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_LOOPBACK */
271*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_FLAGS
272*49ef7e06SGarrett D'Amore 	uint32_t		ep_phy_flags;
273*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_FLAGS */
274*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_LED_CONTROL
275*49ef7e06SGarrett D'Amore 	efx_phy_led_mode_t	ep_phy_led_mode;
276*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_LED_CONTROL */
277*49ef7e06SGarrett D'Amore 	efx_phy_media_type_t	ep_fixed_port_type;
278*49ef7e06SGarrett D'Amore 	efx_phy_media_type_t	ep_module_type;
279*49ef7e06SGarrett D'Amore 	uint32_t		ep_adv_cap_mask;
280*49ef7e06SGarrett D'Amore 	uint32_t		ep_lp_cap_mask;
281*49ef7e06SGarrett D'Amore 	uint32_t		ep_default_adv_cap_mask;
282*49ef7e06SGarrett D'Amore 	uint32_t		ep_phy_cap_mask;
283*49ef7e06SGarrett D'Amore 	boolean_t		ep_mac_drain;
284*49ef7e06SGarrett D'Amore 	boolean_t		ep_mac_stats_pending;
285*49ef7e06SGarrett D'Amore #if EFSYS_OPT_BIST
286*49ef7e06SGarrett D'Amore 	efx_bist_type_t		ep_current_bist;
287*49ef7e06SGarrett D'Amore #endif
288*49ef7e06SGarrett D'Amore 	const efx_mac_ops_t	*ep_emop;
289*49ef7e06SGarrett D'Amore 	const efx_phy_ops_t	*ep_epop;
290*49ef7e06SGarrett D'Amore } efx_port_t;
291*49ef7e06SGarrett D'Amore 
292*49ef7e06SGarrett D'Amore typedef struct efx_mon_ops_s {
293*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MON_STATS
294*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
295*49ef7e06SGarrett D'Amore 					    efx_mon_stat_value_t *);
296*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MON_STATS */
297*49ef7e06SGarrett D'Amore } efx_mon_ops_t;
298*49ef7e06SGarrett D'Amore 
299*49ef7e06SGarrett D'Amore typedef struct efx_mon_s {
300*49ef7e06SGarrett D'Amore 	efx_mon_type_t		em_type;
301*49ef7e06SGarrett D'Amore 	const efx_mon_ops_t	*em_emop;
302*49ef7e06SGarrett D'Amore } efx_mon_t;
303*49ef7e06SGarrett D'Amore 
304*49ef7e06SGarrett D'Amore typedef struct efx_intr_ops_s {
305*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *);
306*49ef7e06SGarrett D'Amore 	void		(*eio_enable)(efx_nic_t *);
307*49ef7e06SGarrett D'Amore 	void		(*eio_disable)(efx_nic_t *);
308*49ef7e06SGarrett D'Amore 	void		(*eio_disable_unlocked)(efx_nic_t *);
309*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eio_trigger)(efx_nic_t *, unsigned int);
310*49ef7e06SGarrett D'Amore 	void		(*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *);
311*49ef7e06SGarrett D'Amore 	void		(*eio_status_message)(efx_nic_t *, unsigned int,
312*49ef7e06SGarrett D'Amore 				 boolean_t *);
313*49ef7e06SGarrett D'Amore 	void		(*eio_fatal)(efx_nic_t *);
314*49ef7e06SGarrett D'Amore 	void		(*eio_fini)(efx_nic_t *);
315*49ef7e06SGarrett D'Amore } efx_intr_ops_t;
316*49ef7e06SGarrett D'Amore 
317*49ef7e06SGarrett D'Amore typedef struct efx_intr_s {
318*49ef7e06SGarrett D'Amore 	const efx_intr_ops_t	*ei_eiop;
319*49ef7e06SGarrett D'Amore 	efsys_mem_t		*ei_esmp;
320*49ef7e06SGarrett D'Amore 	efx_intr_type_t		ei_type;
321*49ef7e06SGarrett D'Amore 	unsigned int		ei_level;
322*49ef7e06SGarrett D'Amore } efx_intr_t;
323*49ef7e06SGarrett D'Amore 
324*49ef7e06SGarrett D'Amore typedef struct efx_nic_ops_s {
325*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_probe)(efx_nic_t *);
326*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_board_cfg)(efx_nic_t *);
327*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*);
328*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_reset)(efx_nic_t *);
329*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_init)(efx_nic_t *);
330*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_get_vi_pool)(efx_nic_t *, uint32_t *);
331*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t,
332*49ef7e06SGarrett D'Amore 					uint32_t *, size_t *);
333*49ef7e06SGarrett D'Amore #if EFSYS_OPT_DIAG
334*49ef7e06SGarrett D'Amore 	efx_rc_t	(*eno_register_test)(efx_nic_t *);
335*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_DIAG */
336*49ef7e06SGarrett D'Amore 	void		(*eno_fini)(efx_nic_t *);
337*49ef7e06SGarrett D'Amore 	void		(*eno_unprobe)(efx_nic_t *);
338*49ef7e06SGarrett D'Amore } efx_nic_ops_t;
339*49ef7e06SGarrett D'Amore 
340*49ef7e06SGarrett D'Amore #ifndef EFX_TXQ_LIMIT_TARGET
341*49ef7e06SGarrett D'Amore #define	EFX_TXQ_LIMIT_TARGET 259
342*49ef7e06SGarrett D'Amore #endif
343*49ef7e06SGarrett D'Amore #ifndef EFX_RXQ_LIMIT_TARGET
344*49ef7e06SGarrett D'Amore #define	EFX_RXQ_LIMIT_TARGET 512
345*49ef7e06SGarrett D'Amore #endif
346*49ef7e06SGarrett D'Amore #ifndef EFX_TXQ_DC_SIZE
347*49ef7e06SGarrett D'Amore #define	EFX_TXQ_DC_SIZE 1 /* 16 descriptors */
348*49ef7e06SGarrett D'Amore #endif
349*49ef7e06SGarrett D'Amore #ifndef EFX_RXQ_DC_SIZE
350*49ef7e06SGarrett D'Amore #define	EFX_RXQ_DC_SIZE 3 /* 64 descriptors */
351*49ef7e06SGarrett D'Amore #endif
352*49ef7e06SGarrett D'Amore 
353*49ef7e06SGarrett D'Amore #if EFSYS_OPT_FILTER
354*49ef7e06SGarrett D'Amore 
355*49ef7e06SGarrett D'Amore typedef struct siena_filter_spec_s {
356*49ef7e06SGarrett D'Amore 	uint8_t		sfs_type;
357*49ef7e06SGarrett D'Amore 	uint32_t	sfs_flags;
358*49ef7e06SGarrett D'Amore 	uint32_t	sfs_dmaq_id;
359*49ef7e06SGarrett D'Amore 	uint32_t	sfs_dword[3];
360*49ef7e06SGarrett D'Amore } siena_filter_spec_t;
361*49ef7e06SGarrett D'Amore 
362*49ef7e06SGarrett D'Amore typedef enum siena_filter_type_e {
363*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_TCP_FULL,	/* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
364*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_TCP_WILD,	/* TCP/IPv4 {dIP,dTCP,  -,   -} */
365*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_UDP_FULL,	/* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
366*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_UDP_WILD,	/* UDP/IPv4 {dIP,dUDP,  -,   -} */
367*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_MAC_FULL,	/* Ethernet {dMAC,VLAN} */
368*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_RX_MAC_WILD,	/* Ethernet {dMAC,   -} */
369*49ef7e06SGarrett D'Amore 
370*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_TCP_FULL,	/* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
371*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_TCP_WILD,	/* TCP/IPv4 {  -,   -,sIP,sTCP} */
372*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_UDP_FULL,	/* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
373*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_UDP_WILD,	/* UDP/IPv4 {  -,   -,sIP,sUDP} */
374*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_MAC_FULL,	/* Ethernet {sMAC,VLAN} */
375*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TX_MAC_WILD,	/* Ethernet {sMAC,   -} */
376*49ef7e06SGarrett D'Amore 
377*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_NTYPES
378*49ef7e06SGarrett D'Amore } siena_filter_type_t;
379*49ef7e06SGarrett D'Amore 
380*49ef7e06SGarrett D'Amore typedef enum siena_filter_tbl_id_e {
381*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TBL_RX_IP = 0,
382*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TBL_RX_MAC,
383*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TBL_TX_IP,
384*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_TBL_TX_MAC,
385*49ef7e06SGarrett D'Amore 	EFX_SIENA_FILTER_NTBLS
386*49ef7e06SGarrett D'Amore } siena_filter_tbl_id_t;
387*49ef7e06SGarrett D'Amore 
388*49ef7e06SGarrett D'Amore typedef struct siena_filter_tbl_s {
389*49ef7e06SGarrett D'Amore 	int			sft_size;	/* number of entries */
390*49ef7e06SGarrett D'Amore 	int			sft_used;	/* active count */
391*49ef7e06SGarrett D'Amore 	uint32_t		*sft_bitmap;	/* active bitmap */
392*49ef7e06SGarrett D'Amore 	siena_filter_spec_t	*sft_spec;	/* array of saved specs */
393*49ef7e06SGarrett D'Amore } siena_filter_tbl_t;
394*49ef7e06SGarrett D'Amore 
395*49ef7e06SGarrett D'Amore typedef struct siena_filter_s {
396*49ef7e06SGarrett D'Amore 	siena_filter_tbl_t	sf_tbl[EFX_SIENA_FILTER_NTBLS];
397*49ef7e06SGarrett D'Amore 	unsigned int		sf_depth[EFX_SIENA_FILTER_NTYPES];
398*49ef7e06SGarrett D'Amore } siena_filter_t;
399*49ef7e06SGarrett D'Amore 
400*49ef7e06SGarrett D'Amore typedef struct efx_filter_s {
401*49ef7e06SGarrett D'Amore #if EFSYS_OPT_SIENA
402*49ef7e06SGarrett D'Amore 	siena_filter_t		*ef_siena_filter;
403*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_SIENA */
404*49ef7e06SGarrett D'Amore #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
405*49ef7e06SGarrett D'Amore 	ef10_filter_table_t	*ef_ef10_filter_table;
406*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
407*49ef7e06SGarrett D'Amore } efx_filter_t;
408*49ef7e06SGarrett D'Amore 
409*49ef7e06SGarrett D'Amore extern			void
410*49ef7e06SGarrett D'Amore siena_filter_tbl_clear(
411*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
412*49ef7e06SGarrett D'Amore 	__in		siena_filter_tbl_id_t tbl);
413*49ef7e06SGarrett D'Amore 
414*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_FILTER */
415*49ef7e06SGarrett D'Amore 
416*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI
417*49ef7e06SGarrett D'Amore 
418*49ef7e06SGarrett D'Amore typedef struct efx_mcdi_ops_s {
419*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
420*49ef7e06SGarrett D'Amore 	void		(*emco_send_request)(efx_nic_t *, void *, size_t,
421*49ef7e06SGarrett D'Amore 					void *, size_t);
422*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emco_poll_reboot)(efx_nic_t *);
423*49ef7e06SGarrett D'Amore 	boolean_t	(*emco_poll_response)(efx_nic_t *);
424*49ef7e06SGarrett D'Amore 	void		(*emco_read_response)(efx_nic_t *, void *, size_t, size_t);
425*49ef7e06SGarrett D'Amore 	void		(*emco_fini)(efx_nic_t *);
426*49ef7e06SGarrett D'Amore 	efx_rc_t	(*emco_feature_supported)(efx_nic_t *, efx_mcdi_feature_id_t, boolean_t *);
427*49ef7e06SGarrett D'Amore } efx_mcdi_ops_t;
428*49ef7e06SGarrett D'Amore 
429*49ef7e06SGarrett D'Amore typedef struct efx_mcdi_s {
430*49ef7e06SGarrett D'Amore 	const efx_mcdi_ops_t		*em_emcop;
431*49ef7e06SGarrett D'Amore 	const efx_mcdi_transport_t	*em_emtp;
432*49ef7e06SGarrett D'Amore 	efx_mcdi_iface_t		em_emip;
433*49ef7e06SGarrett D'Amore } efx_mcdi_t;
434*49ef7e06SGarrett D'Amore 
435*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_MCDI */
436*49ef7e06SGarrett D'Amore 
437*49ef7e06SGarrett D'Amore #if EFSYS_OPT_NVRAM
438*49ef7e06SGarrett D'Amore typedef struct efx_nvram_ops_s {
439*49ef7e06SGarrett D'Amore #if EFSYS_OPT_DIAG
440*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_test)(efx_nic_t *);
441*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_DIAG */
442*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
443*49ef7e06SGarrett D'Amore 					    uint32_t *);
444*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
445*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *);
446*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_read)(efx_nic_t *, uint32_t,
447*49ef7e06SGarrett D'Amore 					    unsigned int, caddr_t, size_t);
448*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_erase)(efx_nic_t *, uint32_t,
449*49ef7e06SGarrett D'Amore 					    unsigned int, size_t);
450*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_write)(efx_nic_t *, uint32_t,
451*49ef7e06SGarrett D'Amore 					    unsigned int, caddr_t, size_t);
452*49ef7e06SGarrett D'Amore 	void		(*envo_partn_rw_finish)(efx_nic_t *, uint32_t);
453*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_get_version)(efx_nic_t *, uint32_t,
454*49ef7e06SGarrett D'Amore 					    uint32_t *, uint16_t *);
455*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_partn_set_version)(efx_nic_t *, uint32_t,
456*49ef7e06SGarrett D'Amore 					    uint16_t *);
457*49ef7e06SGarrett D'Amore 	efx_rc_t	(*envo_buffer_validate)(efx_nic_t *, uint32_t,
458*49ef7e06SGarrett D'Amore 					    caddr_t, size_t);
459*49ef7e06SGarrett D'Amore } efx_nvram_ops_t;
460*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_NVRAM */
461*49ef7e06SGarrett D'Amore 
462*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
463*49ef7e06SGarrett D'Amore efx_nvram_tlv_validate(
464*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
465*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
466*49ef7e06SGarrett D'Amore 	__in_bcount(partn_size)	caddr_t partn_data,
467*49ef7e06SGarrett D'Amore 	__in			size_t partn_size);
468*49ef7e06SGarrett D'Amore 
469*49ef7e06SGarrett D'Amore 
470*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD
471*49ef7e06SGarrett D'Amore typedef struct efx_vpd_ops_s {
472*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_init)(efx_nic_t *);
473*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_size)(efx_nic_t *, size_t *);
474*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_read)(efx_nic_t *, caddr_t, size_t);
475*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_verify)(efx_nic_t *, caddr_t, size_t);
476*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_reinit)(efx_nic_t *, caddr_t, size_t);
477*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_get)(efx_nic_t *, caddr_t, size_t,
478*49ef7e06SGarrett D'Amore 					efx_vpd_value_t *);
479*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_set)(efx_nic_t *, caddr_t, size_t,
480*49ef7e06SGarrett D'Amore 					efx_vpd_value_t *);
481*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_next)(efx_nic_t *, caddr_t, size_t,
482*49ef7e06SGarrett D'Amore 					efx_vpd_value_t *, unsigned int *);
483*49ef7e06SGarrett D'Amore 	efx_rc_t	(*evpdo_write)(efx_nic_t *, caddr_t, size_t);
484*49ef7e06SGarrett D'Amore 	void		(*evpdo_fini)(efx_nic_t *);
485*49ef7e06SGarrett D'Amore } efx_vpd_ops_t;
486*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_VPD */
487*49ef7e06SGarrett D'Amore 
488*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM
489*49ef7e06SGarrett D'Amore 
490*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
491*49ef7e06SGarrett D'Amore efx_mcdi_nvram_partitions(
492*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
493*49ef7e06SGarrett D'Amore 	__out_bcount(size)	caddr_t data,
494*49ef7e06SGarrett D'Amore 	__in			size_t size,
495*49ef7e06SGarrett D'Amore 	__out			unsigned int *npartnp);
496*49ef7e06SGarrett D'Amore 
497*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
498*49ef7e06SGarrett D'Amore efx_mcdi_nvram_metadata(
499*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
500*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
501*49ef7e06SGarrett D'Amore 	__out			uint32_t *subtypep,
502*49ef7e06SGarrett D'Amore 	__out_ecount(4)		uint16_t version[4],
503*49ef7e06SGarrett D'Amore 	__out_bcount_opt(size)	char *descp,
504*49ef7e06SGarrett D'Amore 	__in			size_t size);
505*49ef7e06SGarrett D'Amore 
506*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
507*49ef7e06SGarrett D'Amore efx_mcdi_nvram_info(
508*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
509*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
510*49ef7e06SGarrett D'Amore 	__out_opt		size_t *sizep,
511*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *addressp,
512*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *erase_sizep,
513*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *write_sizep);
514*49ef7e06SGarrett D'Amore 
515*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
516*49ef7e06SGarrett D'Amore efx_mcdi_nvram_update_start(
517*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
518*49ef7e06SGarrett D'Amore 	__in			uint32_t partn);
519*49ef7e06SGarrett D'Amore 
520*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
521*49ef7e06SGarrett D'Amore efx_mcdi_nvram_read(
522*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
523*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
524*49ef7e06SGarrett D'Amore 	__in			uint32_t offset,
525*49ef7e06SGarrett D'Amore 	__out_bcount(size)	caddr_t data,
526*49ef7e06SGarrett D'Amore 	__in			size_t size,
527*49ef7e06SGarrett D'Amore 	__in			uint32_t mode);
528*49ef7e06SGarrett D'Amore 
529*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
530*49ef7e06SGarrett D'Amore efx_mcdi_nvram_erase(
531*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
532*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
533*49ef7e06SGarrett D'Amore 	__in			uint32_t offset,
534*49ef7e06SGarrett D'Amore 	__in			size_t size);
535*49ef7e06SGarrett D'Amore 
536*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
537*49ef7e06SGarrett D'Amore efx_mcdi_nvram_write(
538*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
539*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
540*49ef7e06SGarrett D'Amore 	__in			uint32_t offset,
541*49ef7e06SGarrett D'Amore 	__out_bcount(size)	caddr_t data,
542*49ef7e06SGarrett D'Amore 	__in			size_t size);
543*49ef7e06SGarrett D'Amore 
544*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
545*49ef7e06SGarrett D'Amore efx_mcdi_nvram_update_finish(
546*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
547*49ef7e06SGarrett D'Amore 	__in			uint32_t partn,
548*49ef7e06SGarrett D'Amore 	__in			boolean_t reboot);
549*49ef7e06SGarrett D'Amore 
550*49ef7e06SGarrett D'Amore #if EFSYS_OPT_DIAG
551*49ef7e06SGarrett D'Amore 
552*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
553*49ef7e06SGarrett D'Amore efx_mcdi_nvram_test(
554*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
555*49ef7e06SGarrett D'Amore 	__in			uint32_t partn);
556*49ef7e06SGarrett D'Amore 
557*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_DIAG */
558*49ef7e06SGarrett D'Amore 
559*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
560*49ef7e06SGarrett D'Amore 
561*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LICENSING
562*49ef7e06SGarrett D'Amore 
563*49ef7e06SGarrett D'Amore typedef struct efx_lic_ops_s {
564*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_update_licenses)(efx_nic_t *);
565*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
566*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
567*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
568*49ef7e06SGarrett D'Amore 				      size_t *, uint8_t *);
569*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_find_start)
570*49ef7e06SGarrett D'Amore 				(efx_nic_t *, caddr_t, size_t, uint32_t *);
571*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_find_end)(efx_nic_t *, caddr_t, size_t,
572*49ef7e06SGarrett D'Amore 				uint32_t , uint32_t *);
573*49ef7e06SGarrett D'Amore 	boolean_t	(*elo_find_key)(efx_nic_t *, caddr_t, size_t,
574*49ef7e06SGarrett D'Amore 				uint32_t, uint32_t *, uint32_t *);
575*49ef7e06SGarrett D'Amore 	boolean_t	(*elo_validate_key)(efx_nic_t *,
576*49ef7e06SGarrett D'Amore 				caddr_t, uint32_t);
577*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_read_key)(efx_nic_t *,
578*49ef7e06SGarrett D'Amore 				caddr_t, size_t, uint32_t, uint32_t,
579*49ef7e06SGarrett D'Amore 				caddr_t, size_t, uint32_t *);
580*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_write_key)(efx_nic_t *,
581*49ef7e06SGarrett D'Amore 				caddr_t, size_t, uint32_t,
582*49ef7e06SGarrett D'Amore 				caddr_t, uint32_t, uint32_t *);
583*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_delete_key)(efx_nic_t *,
584*49ef7e06SGarrett D'Amore 				caddr_t, size_t, uint32_t,
585*49ef7e06SGarrett D'Amore 				uint32_t, uint32_t, uint32_t *);
586*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_create_partition)(efx_nic_t *,
587*49ef7e06SGarrett D'Amore 				caddr_t, size_t);
588*49ef7e06SGarrett D'Amore 	efx_rc_t	(*elo_finish_partition)(efx_nic_t *,
589*49ef7e06SGarrett D'Amore 				caddr_t, size_t);
590*49ef7e06SGarrett D'Amore } efx_lic_ops_t;
591*49ef7e06SGarrett D'Amore 
592*49ef7e06SGarrett D'Amore #endif
593*49ef7e06SGarrett D'Amore 
594*49ef7e06SGarrett D'Amore typedef struct efx_drv_cfg_s {
595*49ef7e06SGarrett D'Amore 	uint32_t		edc_min_vi_count;
596*49ef7e06SGarrett D'Amore 	uint32_t		edc_max_vi_count;
597*49ef7e06SGarrett D'Amore 
598*49ef7e06SGarrett D'Amore 	uint32_t		edc_max_piobuf_count;
599*49ef7e06SGarrett D'Amore 	uint32_t		edc_pio_alloc_size;
600*49ef7e06SGarrett D'Amore } efx_drv_cfg_t;
601*49ef7e06SGarrett D'Amore 
602*49ef7e06SGarrett D'Amore struct efx_nic_s {
603*49ef7e06SGarrett D'Amore 	uint32_t		en_magic;
604*49ef7e06SGarrett D'Amore 	efx_family_t		en_family;
605*49ef7e06SGarrett D'Amore 	uint32_t		en_features;
606*49ef7e06SGarrett D'Amore 	efsys_identifier_t	*en_esip;
607*49ef7e06SGarrett D'Amore 	efsys_lock_t		*en_eslp;
608*49ef7e06SGarrett D'Amore 	efsys_bar_t 		*en_esbp;
609*49ef7e06SGarrett D'Amore 	unsigned int		en_mod_flags;
610*49ef7e06SGarrett D'Amore 	unsigned int		en_reset_flags;
611*49ef7e06SGarrett D'Amore 	efx_nic_cfg_t		en_nic_cfg;
612*49ef7e06SGarrett D'Amore 	efx_drv_cfg_t		en_drv_cfg;
613*49ef7e06SGarrett D'Amore 	efx_port_t		en_port;
614*49ef7e06SGarrett D'Amore 	efx_mon_t		en_mon;
615*49ef7e06SGarrett D'Amore 	efx_intr_t		en_intr;
616*49ef7e06SGarrett D'Amore 	uint32_t		en_ev_qcount;
617*49ef7e06SGarrett D'Amore 	uint32_t		en_rx_qcount;
618*49ef7e06SGarrett D'Amore 	uint32_t		en_tx_qcount;
619*49ef7e06SGarrett D'Amore 	const efx_nic_ops_t	*en_enop;
620*49ef7e06SGarrett D'Amore 	const efx_ev_ops_t	*en_eevop;
621*49ef7e06SGarrett D'Amore 	const efx_tx_ops_t	*en_etxop;
622*49ef7e06SGarrett D'Amore 	const efx_rx_ops_t	*en_erxop;
623*49ef7e06SGarrett D'Amore #if EFSYS_OPT_FILTER
624*49ef7e06SGarrett D'Amore 	efx_filter_t		en_filter;
625*49ef7e06SGarrett D'Amore 	const efx_filter_ops_t	*en_efop;
626*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_FILTER */
627*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI
628*49ef7e06SGarrett D'Amore 	efx_mcdi_t		en_mcdi;
629*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MCDI */
630*49ef7e06SGarrett D'Amore #if EFSYS_OPT_NVRAM
631*49ef7e06SGarrett D'Amore 	efx_nvram_type_t	en_nvram_locked;
632*49ef7e06SGarrett D'Amore 	const efx_nvram_ops_t	*en_envop;
633*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_NVRAM */
634*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD
635*49ef7e06SGarrett D'Amore 	const efx_vpd_ops_t	*en_evpdop;
636*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_VPD */
637*49ef7e06SGarrett D'Amore #if EFSYS_OPT_RX_SCALE
638*49ef7e06SGarrett D'Amore 	efx_rx_hash_support_t	en_hash_support;
639*49ef7e06SGarrett D'Amore 	efx_rx_scale_support_t	en_rss_support;
640*49ef7e06SGarrett D'Amore 	uint32_t		en_rss_context;
641*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_RX_SCALE */
642*49ef7e06SGarrett D'Amore 	uint32_t		en_vport_id;
643*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LICENSING
644*49ef7e06SGarrett D'Amore 	const efx_lic_ops_t	*en_elop;
645*49ef7e06SGarrett D'Amore #endif
646*49ef7e06SGarrett D'Amore 	union {
647*49ef7e06SGarrett D'Amore #if EFSYS_OPT_SIENA
648*49ef7e06SGarrett D'Amore 		struct {
649*49ef7e06SGarrett D'Amore #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
650*49ef7e06SGarrett D'Amore 			unsigned int		enu_partn_mask;
651*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
652*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD
653*49ef7e06SGarrett D'Amore 			caddr_t			enu_svpd;
654*49ef7e06SGarrett D'Amore 			size_t			enu_svpd_length;
655*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_VPD */
656*49ef7e06SGarrett D'Amore 			int			enu_unused;
657*49ef7e06SGarrett D'Amore 		} siena;
658*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_SIENA */
659*49ef7e06SGarrett D'Amore 		int	enu_unused;
660*49ef7e06SGarrett D'Amore 	} en_u;
661*49ef7e06SGarrett D'Amore #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
662*49ef7e06SGarrett D'Amore 	union en_arch {
663*49ef7e06SGarrett D'Amore 		struct {
664*49ef7e06SGarrett D'Amore 			int			ena_vi_base;
665*49ef7e06SGarrett D'Amore 			int			ena_vi_count;
666*49ef7e06SGarrett D'Amore 			int			ena_vi_shift;
667*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD
668*49ef7e06SGarrett D'Amore 			caddr_t			ena_svpd;
669*49ef7e06SGarrett D'Amore 			size_t			ena_svpd_length;
670*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_VPD */
671*49ef7e06SGarrett D'Amore 			efx_piobuf_handle_t	ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS];
672*49ef7e06SGarrett D'Amore 			uint32_t		ena_piobuf_count;
673*49ef7e06SGarrett D'Amore 			uint32_t		ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS];
674*49ef7e06SGarrett D'Amore 			uint32_t		ena_pio_write_vi_base;
675*49ef7e06SGarrett D'Amore 			/* Memory BAR mapping regions */
676*49ef7e06SGarrett D'Amore 			uint32_t		ena_uc_mem_map_offset;
677*49ef7e06SGarrett D'Amore 			size_t			ena_uc_mem_map_size;
678*49ef7e06SGarrett D'Amore 			uint32_t		ena_wc_mem_map_offset;
679*49ef7e06SGarrett D'Amore 			size_t			ena_wc_mem_map_size;
680*49ef7e06SGarrett D'Amore 		} ef10;
681*49ef7e06SGarrett D'Amore 	} en_arch;
682*49ef7e06SGarrett D'Amore #endif	/* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
683*49ef7e06SGarrett D'Amore };
684*49ef7e06SGarrett D'Amore 
685*49ef7e06SGarrett D'Amore 
686*49ef7e06SGarrett D'Amore #define	EFX_NIC_MAGIC	0x02121996
687*49ef7e06SGarrett D'Amore 
688*49ef7e06SGarrett D'Amore typedef	boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *,
689*49ef7e06SGarrett D'Amore     const efx_ev_callbacks_t *, void *);
690*49ef7e06SGarrett D'Amore 
691*49ef7e06SGarrett D'Amore typedef struct efx_evq_rxq_state_s {
692*49ef7e06SGarrett D'Amore 	unsigned int			eers_rx_read_ptr;
693*49ef7e06SGarrett D'Amore 	unsigned int			eers_rx_mask;
694*49ef7e06SGarrett D'Amore } efx_evq_rxq_state_t;
695*49ef7e06SGarrett D'Amore 
696*49ef7e06SGarrett D'Amore struct efx_evq_s {
697*49ef7e06SGarrett D'Amore 	uint32_t			ee_magic;
698*49ef7e06SGarrett D'Amore 	efx_nic_t			*ee_enp;
699*49ef7e06SGarrett D'Amore 	unsigned int			ee_index;
700*49ef7e06SGarrett D'Amore 	unsigned int			ee_mask;
701*49ef7e06SGarrett D'Amore 	efsys_mem_t			*ee_esmp;
702*49ef7e06SGarrett D'Amore #if EFSYS_OPT_QSTATS
703*49ef7e06SGarrett D'Amore 	uint32_t			ee_stat[EV_NQSTATS];
704*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_QSTATS */
705*49ef7e06SGarrett D'Amore 
706*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_rx;
707*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_tx;
708*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_driver;
709*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_global;
710*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_drv_gen;
711*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI
712*49ef7e06SGarrett D'Amore 	efx_ev_handler_t		ee_mcdi;
713*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MCDI */
714*49ef7e06SGarrett D'Amore 
715*49ef7e06SGarrett D'Amore 	efx_evq_rxq_state_t		ee_rxq_state[EFX_EV_RX_NLABELS];
716*49ef7e06SGarrett D'Amore };
717*49ef7e06SGarrett D'Amore 
718*49ef7e06SGarrett D'Amore #define	EFX_EVQ_MAGIC	0x08081997
719*49ef7e06SGarrett D'Amore 
720*49ef7e06SGarrett D'Amore #define	EFX_EVQ_SIENA_TIMER_QUANTUM_NS	6144 /* 768 cycles */
721*49ef7e06SGarrett D'Amore 
722*49ef7e06SGarrett D'Amore struct efx_rxq_s {
723*49ef7e06SGarrett D'Amore 	uint32_t			er_magic;
724*49ef7e06SGarrett D'Amore 	efx_nic_t			*er_enp;
725*49ef7e06SGarrett D'Amore 	efx_evq_t			*er_eep;
726*49ef7e06SGarrett D'Amore 	unsigned int			er_index;
727*49ef7e06SGarrett D'Amore 	unsigned int			er_label;
728*49ef7e06SGarrett D'Amore 	unsigned int			er_mask;
729*49ef7e06SGarrett D'Amore 	efsys_mem_t			*er_esmp;
730*49ef7e06SGarrett D'Amore };
731*49ef7e06SGarrett D'Amore 
732*49ef7e06SGarrett D'Amore #define	EFX_RXQ_MAGIC	0x15022005
733*49ef7e06SGarrett D'Amore 
734*49ef7e06SGarrett D'Amore struct efx_txq_s {
735*49ef7e06SGarrett D'Amore 	uint32_t			et_magic;
736*49ef7e06SGarrett D'Amore 	efx_nic_t			*et_enp;
737*49ef7e06SGarrett D'Amore 	unsigned int			et_index;
738*49ef7e06SGarrett D'Amore 	unsigned int			et_mask;
739*49ef7e06SGarrett D'Amore 	efsys_mem_t			*et_esmp;
740*49ef7e06SGarrett D'Amore #if EFSYS_OPT_HUNTINGTON
741*49ef7e06SGarrett D'Amore 	uint32_t			et_pio_bufnum;
742*49ef7e06SGarrett D'Amore 	uint32_t			et_pio_blknum;
743*49ef7e06SGarrett D'Amore 	uint32_t			et_pio_write_offset;
744*49ef7e06SGarrett D'Amore 	uint32_t			et_pio_offset;
745*49ef7e06SGarrett D'Amore 	size_t				et_pio_size;
746*49ef7e06SGarrett D'Amore #endif
747*49ef7e06SGarrett D'Amore #if EFSYS_OPT_QSTATS
748*49ef7e06SGarrett D'Amore 	uint32_t			et_stat[TX_NQSTATS];
749*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_QSTATS */
750*49ef7e06SGarrett D'Amore };
751*49ef7e06SGarrett D'Amore 
752*49ef7e06SGarrett D'Amore #define	EFX_TXQ_MAGIC	0x05092005
753*49ef7e06SGarrett D'Amore 
754*49ef7e06SGarrett D'Amore #define	EFX_MAC_ADDR_COPY(_dst, _src)					\
755*49ef7e06SGarrett D'Amore 	do {								\
756*49ef7e06SGarrett D'Amore 		(_dst)[0] = (_src)[0];					\
757*49ef7e06SGarrett D'Amore 		(_dst)[1] = (_src)[1];					\
758*49ef7e06SGarrett D'Amore 		(_dst)[2] = (_src)[2];					\
759*49ef7e06SGarrett D'Amore 		(_dst)[3] = (_src)[3];					\
760*49ef7e06SGarrett D'Amore 		(_dst)[4] = (_src)[4];					\
761*49ef7e06SGarrett D'Amore 		(_dst)[5] = (_src)[5];					\
762*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
763*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
764*49ef7e06SGarrett D'Amore 
765*49ef7e06SGarrett D'Amore #define	EFX_MAC_BROADCAST_ADDR_SET(_dst)				\
766*49ef7e06SGarrett D'Amore 	do {								\
767*49ef7e06SGarrett D'Amore 		uint16_t *_d = (void *)(_dst);			\
768*49ef7e06SGarrett D'Amore 		_d[0] = 0xffff;						\
769*49ef7e06SGarrett D'Amore 		_d[1] = 0xffff;						\
770*49ef7e06SGarrett D'Amore 		_d[2] = 0xffff;						\
771*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
772*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
773*49ef7e06SGarrett D'Amore 
774*49ef7e06SGarrett D'Amore #if EFSYS_OPT_CHECK_REG
775*49ef7e06SGarrett D'Amore #define	EFX_CHECK_REG(_enp, _reg)					\
776*49ef7e06SGarrett D'Amore 	do {								\
777*49ef7e06SGarrett D'Amore 		const char *name = #_reg;				\
778*49ef7e06SGarrett D'Amore 		char min = name[4];					\
779*49ef7e06SGarrett D'Amore 		char max = name[5];					\
780*49ef7e06SGarrett D'Amore 		char rev;						\
781*49ef7e06SGarrett D'Amore 									\
782*49ef7e06SGarrett D'Amore 		switch ((_enp)->en_family) {				\
783*49ef7e06SGarrett D'Amore 		case EFX_FAMILY_SIENA:					\
784*49ef7e06SGarrett D'Amore 			rev = 'C';					\
785*49ef7e06SGarrett D'Amore 			break;						\
786*49ef7e06SGarrett D'Amore 									\
787*49ef7e06SGarrett D'Amore 		case EFX_FAMILY_HUNTINGTON:				\
788*49ef7e06SGarrett D'Amore 			rev = 'D';					\
789*49ef7e06SGarrett D'Amore 			break;						\
790*49ef7e06SGarrett D'Amore 									\
791*49ef7e06SGarrett D'Amore 		case EFX_FAMILY_MEDFORD:				\
792*49ef7e06SGarrett D'Amore 			rev = 'E';					\
793*49ef7e06SGarrett D'Amore 			break;						\
794*49ef7e06SGarrett D'Amore 									\
795*49ef7e06SGarrett D'Amore 		default:						\
796*49ef7e06SGarrett D'Amore 			rev = '?';					\
797*49ef7e06SGarrett D'Amore 			break;						\
798*49ef7e06SGarrett D'Amore 		}							\
799*49ef7e06SGarrett D'Amore 									\
800*49ef7e06SGarrett D'Amore 		EFSYS_ASSERT3S(rev, >=, min);				\
801*49ef7e06SGarrett D'Amore 		EFSYS_ASSERT3S(rev, <=, max);				\
802*49ef7e06SGarrett D'Amore 									\
803*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
804*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
805*49ef7e06SGarrett D'Amore #else
806*49ef7e06SGarrett D'Amore #define	EFX_CHECK_REG(_enp, _reg) do {					\
807*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
808*49ef7e06SGarrett D'Amore 	} while(B_FALSE)
809*49ef7e06SGarrett D'Amore #endif
810*49ef7e06SGarrett D'Amore 
811*49ef7e06SGarrett D'Amore #define	EFX_BAR_READD(_enp, _reg, _edp, _lock)				\
812*49ef7e06SGarrett D'Amore 	do {								\
813*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
814*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST,		\
815*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
816*49ef7e06SGarrett D'Amore 		EFSYS_PROBE3(efx_bar_readd, const char *, #_reg,	\
817*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
818*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
819*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
820*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
821*49ef7e06SGarrett D'Amore 
822*49ef7e06SGarrett D'Amore #define	EFX_BAR_WRITED(_enp, _reg, _edp, _lock)				\
823*49ef7e06SGarrett D'Amore 	do {								\
824*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
825*49ef7e06SGarrett D'Amore 		EFSYS_PROBE3(efx_bar_writed, const char *, #_reg,	\
826*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
827*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
828*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST,	\
829*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
830*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
831*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
832*49ef7e06SGarrett D'Amore 
833*49ef7e06SGarrett D'Amore #define	EFX_BAR_READQ(_enp, _reg, _eqp)					\
834*49ef7e06SGarrett D'Amore 	do {								\
835*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
836*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST,		\
837*49ef7e06SGarrett D'Amore 		    (_eqp));						\
838*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_readq, const char *, #_reg,	\
839*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
840*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[1],			\
841*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[0]);			\
842*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
843*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
844*49ef7e06SGarrett D'Amore 
845*49ef7e06SGarrett D'Amore #define	EFX_BAR_WRITEQ(_enp, _reg, _eqp)				\
846*49ef7e06SGarrett D'Amore 	do {								\
847*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
848*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg,	\
849*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
850*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[1],			\
851*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[0]);			\
852*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST,	\
853*49ef7e06SGarrett D'Amore 		    (_eqp));						\
854*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
855*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
856*49ef7e06SGarrett D'Amore 
857*49ef7e06SGarrett D'Amore #define	EFX_BAR_READO(_enp, _reg, _eop)					\
858*49ef7e06SGarrett D'Amore 	do {								\
859*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
860*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST,		\
861*49ef7e06SGarrett D'Amore 		    (_eop), B_TRUE);					\
862*49ef7e06SGarrett D'Amore 		EFSYS_PROBE6(efx_bar_reado, const char *, #_reg,	\
863*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
864*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[3],			\
865*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[2],			\
866*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[1],			\
867*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[0]);			\
868*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
869*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
870*49ef7e06SGarrett D'Amore 
871*49ef7e06SGarrett D'Amore #define	EFX_BAR_WRITEO(_enp, _reg, _eop)				\
872*49ef7e06SGarrett D'Amore 	do {								\
873*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
874*49ef7e06SGarrett D'Amore 		EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg,	\
875*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
876*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[3],			\
877*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[2],			\
878*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[1],			\
879*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[0]);			\
880*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST,	\
881*49ef7e06SGarrett D'Amore 		    (_eop), B_TRUE);					\
882*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
883*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
884*49ef7e06SGarrett D'Amore 
885*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock)		\
886*49ef7e06SGarrett D'Amore 	do {								\
887*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
888*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READD((_enp)->en_esbp,			\
889*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
890*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
891*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg,	\
892*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
893*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
894*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
895*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
896*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
897*49ef7e06SGarrett D'Amore 
898*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock)		\
899*49ef7e06SGarrett D'Amore 	do {								\
900*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
901*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg,	\
902*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
903*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
904*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
905*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITED((_enp)->en_esbp,			\
906*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
907*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
908*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
909*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
910*49ef7e06SGarrett D'Amore 
911*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_WRITED2(_enp, _reg, _index, _edp, _lock)		\
912*49ef7e06SGarrett D'Amore 	do {								\
913*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
914*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg,	\
915*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
916*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
917*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
918*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITED((_enp)->en_esbp,			\
919*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST +					\
920*49ef7e06SGarrett D'Amore 		    (2 * sizeof (efx_dword_t)) + 			\
921*49ef7e06SGarrett D'Amore 		    ((_index) * _reg ## _STEP)),			\
922*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
923*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
924*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
925*49ef7e06SGarrett D'Amore 
926*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock)		\
927*49ef7e06SGarrett D'Amore 	do {								\
928*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
929*49ef7e06SGarrett D'Amore 		EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg,	\
930*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
931*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
932*49ef7e06SGarrett D'Amore 		    uint32_t, (_edp)->ed_u32[0]);			\
933*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITED((_enp)->en_esbp,			\
934*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST +					\
935*49ef7e06SGarrett D'Amore 		    (3 * sizeof (efx_dword_t)) + 			\
936*49ef7e06SGarrett D'Amore 		    ((_index) * _reg ## _STEP)),			\
937*49ef7e06SGarrett D'Amore 		    (_edp), (_lock));					\
938*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
939*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
940*49ef7e06SGarrett D'Amore 
941*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp)			\
942*49ef7e06SGarrett D'Amore 	do {								\
943*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
944*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READQ((_enp)->en_esbp,			\
945*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
946*49ef7e06SGarrett D'Amore 		    (_eqp));						\
947*49ef7e06SGarrett D'Amore 		EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg,	\
948*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
949*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
950*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[1],			\
951*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[0]);			\
952*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
953*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
954*49ef7e06SGarrett D'Amore 
955*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp)			\
956*49ef7e06SGarrett D'Amore 	do {								\
957*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
958*49ef7e06SGarrett D'Amore 		EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg,	\
959*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
960*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
961*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[1],			\
962*49ef7e06SGarrett D'Amore 		    uint32_t, (_eqp)->eq_u32[0]);			\
963*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITEQ((_enp)->en_esbp,			\
964*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
965*49ef7e06SGarrett D'Amore 		    (_eqp));						\
966*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
967*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
968*49ef7e06SGarrett D'Amore 
969*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock)		\
970*49ef7e06SGarrett D'Amore 	do {								\
971*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
972*49ef7e06SGarrett D'Amore 		EFSYS_BAR_READO((_enp)->en_esbp,			\
973*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
974*49ef7e06SGarrett D'Amore 		    (_eop), (_lock));					\
975*49ef7e06SGarrett D'Amore 		EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg,	\
976*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
977*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
978*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[3],			\
979*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[2],			\
980*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[1],			\
981*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[0]);			\
982*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
983*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
984*49ef7e06SGarrett D'Amore 
985*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock)		\
986*49ef7e06SGarrett D'Amore 	do {								\
987*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
988*49ef7e06SGarrett D'Amore 		EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg,	\
989*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
990*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
991*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[3],			\
992*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[2],			\
993*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[1],			\
994*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[0]);			\
995*49ef7e06SGarrett D'Amore 		EFSYS_BAR_WRITEO((_enp)->en_esbp,			\
996*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
997*49ef7e06SGarrett D'Amore 		    (_eop), (_lock));					\
998*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
999*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
1000*49ef7e06SGarrett D'Amore 
1001*49ef7e06SGarrett D'Amore /*
1002*49ef7e06SGarrett D'Amore  * Allow drivers to perform optimised 128-bit doorbell writes.
1003*49ef7e06SGarrett D'Amore  * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
1004*49ef7e06SGarrett D'Amore  * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid
1005*49ef7e06SGarrett D'Amore  * the need for locking in the host, and are the only ones known to be safe to
1006*49ef7e06SGarrett D'Amore  * use 128-bites write with.
1007*49ef7e06SGarrett D'Amore  */
1008*49ef7e06SGarrett D'Amore #define	EFX_BAR_TBL_DOORBELL_WRITEO(_enp, _reg, _index, _eop)		\
1009*49ef7e06SGarrett D'Amore 	do {								\
1010*49ef7e06SGarrett D'Amore 		EFX_CHECK_REG((_enp), (_reg));				\
1011*49ef7e06SGarrett D'Amore 		EFSYS_PROBE7(efx_bar_tbl_doorbell_writeo,		\
1012*49ef7e06SGarrett D'Amore 		    const char *,					\
1013*49ef7e06SGarrett D'Amore 		    #_reg,						\
1014*49ef7e06SGarrett D'Amore 		    uint32_t, (_index),					\
1015*49ef7e06SGarrett D'Amore 		    uint32_t, _reg ## _OFST,				\
1016*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[3],			\
1017*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[2],			\
1018*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[1],			\
1019*49ef7e06SGarrett D'Amore 		    uint32_t, (_eop)->eo_u32[0]);			\
1020*49ef7e06SGarrett D'Amore 		EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp,		\
1021*49ef7e06SGarrett D'Amore 		    (_reg ## _OFST + ((_index) * _reg ## _STEP)),	\
1022*49ef7e06SGarrett D'Amore 		    (_eop));						\
1023*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
1024*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
1025*49ef7e06SGarrett D'Amore 
1026*49ef7e06SGarrett D'Amore #define	EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr)	\
1027*49ef7e06SGarrett D'Amore 	do {								\
1028*49ef7e06SGarrett D'Amore 		unsigned int _new = (_wptr);				\
1029*49ef7e06SGarrett D'Amore 		unsigned int _old = (_owptr);				\
1030*49ef7e06SGarrett D'Amore 									\
1031*49ef7e06SGarrett D'Amore 		if ((_new) >= (_old))					\
1032*49ef7e06SGarrett D'Amore 			EFSYS_DMA_SYNC_FOR_DEVICE((_esmp),		\
1033*49ef7e06SGarrett D'Amore 			    (_old) * sizeof (efx_desc_t),		\
1034*49ef7e06SGarrett D'Amore 			    ((_new) - (_old)) * sizeof (efx_desc_t));	\
1035*49ef7e06SGarrett D'Amore 		else							\
1036*49ef7e06SGarrett D'Amore 			/*						\
1037*49ef7e06SGarrett D'Amore 			 * It is cheaper to sync entire map than sync	\
1038*49ef7e06SGarrett D'Amore 			 * two parts especially when offset/size are	\
1039*49ef7e06SGarrett D'Amore 			 * ignored and entire map is synced in any case.\
1040*49ef7e06SGarrett D'Amore 			 */						\
1041*49ef7e06SGarrett D'Amore 			EFSYS_DMA_SYNC_FOR_DEVICE((_esmp),		\
1042*49ef7e06SGarrett D'Amore 			    0,						\
1043*49ef7e06SGarrett D'Amore 			    (_entries) * sizeof (efx_desc_t));		\
1044*49ef7e06SGarrett D'Amore 	_NOTE(CONSTANTCONDITION)					\
1045*49ef7e06SGarrett D'Amore 	} while (B_FALSE)
1046*49ef7e06SGarrett D'Amore 
1047*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
1048*49ef7e06SGarrett D'Amore efx_nic_biu_test(
1049*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp);
1050*49ef7e06SGarrett D'Amore 
1051*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
1052*49ef7e06SGarrett D'Amore efx_mac_select(
1053*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp);
1054*49ef7e06SGarrett D'Amore 
1055*49ef7e06SGarrett D'Amore extern	void
1056*49ef7e06SGarrett D'Amore efx_mac_multicast_hash_compute(
1057*49ef7e06SGarrett D'Amore 	__in_ecount(6*count)		uint8_t const *addrs,
1058*49ef7e06SGarrett D'Amore 	__in				int count,
1059*49ef7e06SGarrett D'Amore 	__out				efx_oword_t *hash_low,
1060*49ef7e06SGarrett D'Amore 	__out				efx_oword_t *hash_high);
1061*49ef7e06SGarrett D'Amore 
1062*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
1063*49ef7e06SGarrett D'Amore efx_phy_probe(
1064*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp);
1065*49ef7e06SGarrett D'Amore 
1066*49ef7e06SGarrett D'Amore extern			void
1067*49ef7e06SGarrett D'Amore efx_phy_unprobe(
1068*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp);
1069*49ef7e06SGarrett D'Amore 
1070*49ef7e06SGarrett D'Amore #if EFSYS_OPT_VPD
1071*49ef7e06SGarrett D'Amore 
1072*49ef7e06SGarrett D'Amore /* VPD utility functions */
1073*49ef7e06SGarrett D'Amore 
1074*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1075*49ef7e06SGarrett D'Amore efx_vpd_hunk_length(
1076*49ef7e06SGarrett D'Amore 	__in_bcount(size)	caddr_t data,
1077*49ef7e06SGarrett D'Amore 	__in			size_t size,
1078*49ef7e06SGarrett D'Amore 	__out			size_t *lengthp);
1079*49ef7e06SGarrett D'Amore 
1080*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1081*49ef7e06SGarrett D'Amore efx_vpd_hunk_verify(
1082*49ef7e06SGarrett D'Amore 	__in_bcount(size)	caddr_t data,
1083*49ef7e06SGarrett D'Amore 	__in			size_t size,
1084*49ef7e06SGarrett D'Amore 	__out_opt		boolean_t *cksummedp);
1085*49ef7e06SGarrett D'Amore 
1086*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1087*49ef7e06SGarrett D'Amore efx_vpd_hunk_reinit(
1088*49ef7e06SGarrett D'Amore 	__in_bcount(size)	caddr_t data,
1089*49ef7e06SGarrett D'Amore 	__in			size_t size,
1090*49ef7e06SGarrett D'Amore 	__in			boolean_t wantpid);
1091*49ef7e06SGarrett D'Amore 
1092*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1093*49ef7e06SGarrett D'Amore efx_vpd_hunk_get(
1094*49ef7e06SGarrett D'Amore 	__in_bcount(size)	caddr_t data,
1095*49ef7e06SGarrett D'Amore 	__in			size_t size,
1096*49ef7e06SGarrett D'Amore 	__in			efx_vpd_tag_t tag,
1097*49ef7e06SGarrett D'Amore 	__in			efx_vpd_keyword_t keyword,
1098*49ef7e06SGarrett D'Amore 	__out			unsigned int *payloadp,
1099*49ef7e06SGarrett D'Amore 	__out			uint8_t *paylenp);
1100*49ef7e06SGarrett D'Amore 
1101*49ef7e06SGarrett D'Amore extern	__checkReturn			efx_rc_t
1102*49ef7e06SGarrett D'Amore efx_vpd_hunk_next(
1103*49ef7e06SGarrett D'Amore 	__in_bcount(size)		caddr_t data,
1104*49ef7e06SGarrett D'Amore 	__in				size_t size,
1105*49ef7e06SGarrett D'Amore 	__out				efx_vpd_tag_t *tagp,
1106*49ef7e06SGarrett D'Amore 	__out				efx_vpd_keyword_t *keyword,
1107*49ef7e06SGarrett D'Amore 	__out_opt			unsigned int *payloadp,
1108*49ef7e06SGarrett D'Amore 	__out_opt			uint8_t *paylenp,
1109*49ef7e06SGarrett D'Amore 	__inout				unsigned int *contp);
1110*49ef7e06SGarrett D'Amore 
1111*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1112*49ef7e06SGarrett D'Amore efx_vpd_hunk_set(
1113*49ef7e06SGarrett D'Amore 	__in_bcount(size)	caddr_t data,
1114*49ef7e06SGarrett D'Amore 	__in			size_t size,
1115*49ef7e06SGarrett D'Amore 	__in			efx_vpd_value_t *evvp);
1116*49ef7e06SGarrett D'Amore 
1117*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_VPD */
1118*49ef7e06SGarrett D'Amore 
1119*49ef7e06SGarrett D'Amore #if EFSYS_OPT_DIAG
1120*49ef7e06SGarrett D'Amore 
1121*49ef7e06SGarrett D'Amore extern	efx_sram_pattern_fn_t	__efx_sram_pattern_fns[];
1122*49ef7e06SGarrett D'Amore 
1123*49ef7e06SGarrett D'Amore typedef struct efx_register_set_s {
1124*49ef7e06SGarrett D'Amore 	unsigned int		address;
1125*49ef7e06SGarrett D'Amore 	unsigned int		step;
1126*49ef7e06SGarrett D'Amore 	unsigned int		rows;
1127*49ef7e06SGarrett D'Amore 	efx_oword_t		mask;
1128*49ef7e06SGarrett D'Amore } efx_register_set_t;
1129*49ef7e06SGarrett D'Amore 
1130*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
1131*49ef7e06SGarrett D'Amore efx_nic_test_registers(
1132*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
1133*49ef7e06SGarrett D'Amore 	__in		efx_register_set_t *rsp,
1134*49ef7e06SGarrett D'Amore 	__in		size_t count);
1135*49ef7e06SGarrett D'Amore 
1136*49ef7e06SGarrett D'Amore extern	__checkReturn	efx_rc_t
1137*49ef7e06SGarrett D'Amore efx_nic_test_tables(
1138*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
1139*49ef7e06SGarrett D'Amore 	__in		efx_register_set_t *rsp,
1140*49ef7e06SGarrett D'Amore 	__in		efx_pattern_type_t pattern,
1141*49ef7e06SGarrett D'Amore 	__in		size_t count);
1142*49ef7e06SGarrett D'Amore 
1143*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_DIAG */
1144*49ef7e06SGarrett D'Amore 
1145*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI
1146*49ef7e06SGarrett D'Amore 
1147*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1148*49ef7e06SGarrett D'Amore efx_mcdi_set_workaround(
1149*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
1150*49ef7e06SGarrett D'Amore 	__in			uint32_t type,
1151*49ef7e06SGarrett D'Amore 	__in			boolean_t enabled,
1152*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *flagsp);
1153*49ef7e06SGarrett D'Amore 
1154*49ef7e06SGarrett D'Amore extern	__checkReturn		efx_rc_t
1155*49ef7e06SGarrett D'Amore efx_mcdi_get_workarounds(
1156*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
1157*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *implementedp,
1158*49ef7e06SGarrett D'Amore 	__out_opt		uint32_t *enabledp);
1159*49ef7e06SGarrett D'Amore 
1160*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_MCDI */
1161*49ef7e06SGarrett D'Amore 
1162*49ef7e06SGarrett D'Amore #ifdef	__cplusplus
1163*49ef7e06SGarrett D'Amore }
1164*49ef7e06SGarrett D'Amore #endif
1165*49ef7e06SGarrett D'Amore 
1166*49ef7e06SGarrett D'Amore #endif	/* _SYS_EFX_IMPL_H */
1167