2 * Copyright (c) 2009-2016 Solarflare Communications Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * The views and conclusions contained in the software and documentation are
27 * those of the authors and should not be interpreted as representing official
28 * policies, either expressed or implied, of the FreeBSD Project.
31 #ifndef _SYS_SIENA_IMPL_H
32 #define _SYS_SIENA_IMPL_H
37 #include "siena_flash.h"
43 #define SIENA_NVRAM_CHUNK 0x80
45 extern __checkReturn efx_rc_t
49 extern __checkReturn efx_rc_t
53 extern __checkReturn efx_rc_t
59 extern __checkReturn efx_rc_t
60 siena_nic_register_test(
63 #endif /* EFSYS_OPT_DIAG */
73 #define SIENA_SRAM_ROWS 0x12000
81 extern __checkReturn efx_rc_t
84 __in efx_sram_pattern_fn_t func);
86 #endif /* EFSYS_OPT_DIAG */
90 extern __checkReturn efx_rc_t
93 __in const efx_mcdi_transport_t *mtp);
96 siena_mcdi_send_request(
98 __in_bcount(hdr_len) void *hdrp,
100 __in_bcount(sdu_len) void *sdup,
101 __in size_t sdu_len);
103 extern __checkReturn boolean_t
104 siena_mcdi_poll_response(
105 __in efx_nic_t *enp);
108 siena_mcdi_read_response(
110 __out_bcount(length) void *bufferp,
115 siena_mcdi_poll_reboot(
116 __in efx_nic_t *enp);
120 __in efx_nic_t *enp);
122 extern __checkReturn efx_rc_t
123 siena_mcdi_feature_supported(
125 __in efx_mcdi_feature_id_t id,
126 __out boolean_t *supportedp);
129 siena_mcdi_get_timeout(
131 __in efx_mcdi_req_t *emrp,
132 __out uint32_t *timeoutp);
134 #endif /* EFSYS_OPT_MCDI */
136 #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
138 extern __checkReturn efx_rc_t
139 siena_nvram_partn_lock(
141 __in uint32_t partn);
143 extern __checkReturn efx_rc_t
144 siena_nvram_partn_unlock(
147 __out_opt uint32_t *verify_resultp);
149 extern __checkReturn efx_rc_t
150 siena_nvram_get_dynamic_cfg(
154 __out siena_mc_dynamic_config_hdr_t **dcfgp,
155 __out size_t *sizep);
157 #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
163 extern __checkReturn efx_rc_t
165 __in efx_nic_t *enp);
167 #endif /* EFSYS_OPT_DIAG */
169 extern __checkReturn efx_rc_t
170 siena_nvram_get_subtype(
173 __out uint32_t *subtypep);
175 extern __checkReturn efx_rc_t
176 siena_nvram_type_to_partn(
178 __in efx_nvram_type_t type,
179 __out uint32_t *partnp);
181 extern __checkReturn efx_rc_t
182 siena_nvram_partn_size(
185 __out size_t *sizep);
187 extern __checkReturn efx_rc_t
188 siena_nvram_partn_rw_start(
191 __out size_t *chunk_sizep);
193 extern __checkReturn efx_rc_t
194 siena_nvram_partn_read(
197 __in unsigned int offset,
198 __out_bcount(size) caddr_t data,
201 extern __checkReturn efx_rc_t
202 siena_nvram_partn_erase(
205 __in unsigned int offset,
208 extern __checkReturn efx_rc_t
209 siena_nvram_partn_write(
212 __in unsigned int offset,
213 __out_bcount(size) caddr_t data,
216 extern __checkReturn efx_rc_t
217 siena_nvram_partn_rw_finish(
220 __out_opt uint32_t *verify_resultp);
222 extern __checkReturn efx_rc_t
223 siena_nvram_partn_get_version(
226 __out uint32_t *subtypep,
227 __out_ecount(4) uint16_t version[4]);
229 extern __checkReturn efx_rc_t
230 siena_nvram_partn_set_version(
233 __in_ecount(4) uint16_t version[4]);
235 #endif /* EFSYS_OPT_NVRAM */
239 extern __checkReturn efx_rc_t
241 __in efx_nic_t *enp);
243 extern __checkReturn efx_rc_t
246 __out size_t *sizep);
248 extern __checkReturn efx_rc_t
251 __out_bcount(size) caddr_t data,
254 extern __checkReturn efx_rc_t
257 __in_bcount(size) caddr_t data,
260 extern __checkReturn efx_rc_t
263 __in_bcount(size) caddr_t data,
266 extern __checkReturn efx_rc_t
269 __in_bcount(size) caddr_t data,
271 __inout efx_vpd_value_t *evvp);
273 extern __checkReturn efx_rc_t
276 __in_bcount(size) caddr_t data,
278 __in efx_vpd_value_t *evvp);
280 extern __checkReturn efx_rc_t
283 __in_bcount(size) caddr_t data,
285 __out efx_vpd_value_t *evvp,
286 __inout unsigned int *contp);
288 extern __checkReturn efx_rc_t
291 __in_bcount(size) caddr_t data,
296 __in efx_nic_t *enp);
298 #endif /* EFSYS_OPT_VPD */
300 typedef struct siena_link_state_s {
301 uint32_t sls_adv_cap_mask;
302 uint32_t sls_lp_cap_mask;
303 unsigned int sls_fcntl;
304 efx_link_mode_t sls_link_mode;
305 #if EFSYS_OPT_LOOPBACK
306 efx_loopback_type_t sls_loopback;
308 boolean_t sls_mac_up;
309 } siena_link_state_t;
314 __in efx_qword_t *eqp,
315 __out efx_link_mode_t *link_modep);
317 extern __checkReturn efx_rc_t
320 __out siena_link_state_t *slsp);
322 extern __checkReturn efx_rc_t
327 extern __checkReturn efx_rc_t
328 siena_phy_reconfigure(
329 __in efx_nic_t *enp);
331 extern __checkReturn efx_rc_t
333 __in efx_nic_t *enp);
335 extern __checkReturn efx_rc_t
338 __out uint32_t *ouip);
340 #if EFSYS_OPT_PHY_STATS
343 siena_phy_decode_stats(
346 __in_opt efsys_mem_t *esmp,
347 __out_opt uint64_t *smaskp,
348 __inout_ecount_opt(EFX_PHY_NSTATS) uint32_t *stat);
350 extern __checkReturn efx_rc_t
351 siena_phy_stats_update(
353 __in efsys_mem_t *esmp,
354 __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat);
356 #endif /* EFSYS_OPT_PHY_STATS */
360 extern __checkReturn efx_rc_t
361 siena_phy_bist_start(
363 __in efx_bist_type_t type);
365 extern __checkReturn efx_rc_t
368 __in efx_bist_type_t type,
369 __out efx_bist_result_t *resultp,
370 __out_opt __drv_when(count > 0, __notnull)
371 uint32_t *value_maskp,
372 __out_ecount_opt(count) __drv_when(count > 0, __notnull)
373 unsigned long *valuesp,
379 __in efx_bist_type_t type);
381 #endif /* EFSYS_OPT_BIST */
383 extern __checkReturn efx_rc_t
386 __out efx_link_mode_t *link_modep);
388 extern __checkReturn efx_rc_t
391 __out boolean_t *mac_upp);
393 extern __checkReturn efx_rc_t
394 siena_mac_reconfigure(
395 __in efx_nic_t *enp);
397 extern __checkReturn efx_rc_t
402 #if EFSYS_OPT_LOOPBACK
404 extern __checkReturn efx_rc_t
405 siena_mac_loopback_set(
407 __in efx_link_mode_t link_mode,
408 __in efx_loopback_type_t loopback_type);
410 #endif /* EFSYS_OPT_LOOPBACK */
412 #if EFSYS_OPT_MAC_STATS
414 extern __checkReturn efx_rc_t
415 siena_mac_stats_get_mask(
417 __inout_bcount(mask_size) uint32_t *maskp,
418 __in size_t mask_size);
420 extern __checkReturn efx_rc_t
421 siena_mac_stats_update(
423 __in efsys_mem_t *esmp,
424 __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat,
425 __inout_opt uint32_t *generationp);
427 #endif /* EFSYS_OPT_MAC_STATS */
433 #endif /* _SYS_SIENA_IMPL_H */