1 /*-
2 * Copyright 2007-2013 Solarflare Communications Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26 #ifndef _SYS_SFX7101_H
27 #define _SYS_SFX7101_H
28
29 #include "efx.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #if EFSYS_OPT_PHY_SFX7101
36
37 #define SFX7101_LOOPBACK_MASK \
38 ((1 << EFX_LOOPBACK_PHY_XS) | \
39 (1 << EFX_LOOPBACK_PCS) | \
40 (1 << EFX_LOOPBACK_PMA_PMD) | \
41 FALCON_XMAC_LOOPBACK_MASK)
42
43 #define SFX7101_LED_MASK \
44 ((1 << EFX_PHY_LED_OFF) | \
45 (1 << EFX_PHY_LED_ON) | \
46 (1 << EFX_PHY_LED_FLASH))
47
48 #define SFX7101_NPROPS 0
49
50 #define SFX7101_ADV_CAP_MASK \
51 ((1 << EFX_PHY_CAP_AN) | \
52 (1 << EFX_PHY_CAP_10000FDX) | \
53 (1 << EFX_PHY_CAP_ASYM) | \
54 (1 << EFX_PHY_CAP_PAUSE))
55
56 #define SFX7101_ADV_CAP_PERM 0
57
58 #define SFX7101_BIST_MASK 0
59
60 extern __checkReturn int
61 sfx7101_power(
62 __in efx_nic_t *enp,
63 __in boolean_t on);
64
65 extern __checkReturn int
66 sfx7101_reset(
67 __in efx_nic_t *enp);
68
69 extern __checkReturn int
70 sfx7101_reconfigure(
71 __in efx_nic_t *enp);
72
73 extern __checkReturn int
74 sfx7101_verify(
75 __in efx_nic_t *enp);
76
77 extern __checkReturn int
78 sfx7101_uplink_check(
79 __in efx_nic_t *enp,
80 __out boolean_t *upp);
81
82 extern void
83 sfx7101_uplink_reset(
84 __in efx_nic_t *enp);
85
86 extern __checkReturn int
87 sfx7101_downlink_check(
88 __in efx_nic_t *enp,
89 __out efx_link_mode_t *modep,
90 __out unsigned int *fcntlp,
91 __out uint32_t *lp_cap_maskp);
92
93 extern __checkReturn int
94 sfx7101_oui_get(
95 __in efx_nic_t *enp,
96 __out uint32_t *ouip);
97
98 #if EFSYS_OPT_PHY_STATS
99
100 /* START MKCONFIG GENERATED Sfx7101PhyHeaderStatsMask edaf3cd6dfd8b815 */
101 #define SFX7101_STAT_MASK \
102 (1ULL << EFX_PHY_STAT_OUI) | \
103 (1ULL << EFX_PHY_STAT_PMA_PMD_LINK_UP) | \
104 (1ULL << EFX_PHY_STAT_PMA_PMD_RX_FAULT) | \
105 (1ULL << EFX_PHY_STAT_PMA_PMD_TX_FAULT) | \
106 (1ULL << EFX_PHY_STAT_PMA_PMD_REV_MAJOR) | \
107 (1ULL << EFX_PHY_STAT_PMA_PMD_REV_MINOR) | \
108 (1ULL << EFX_PHY_STAT_PMA_PMD_REV_MICRO) | \
109 (1ULL << EFX_PHY_STAT_PCS_LINK_UP) | \
110 (1ULL << EFX_PHY_STAT_PCS_RX_FAULT) | \
111 (1ULL << EFX_PHY_STAT_PCS_TX_FAULT) | \
112 (1ULL << EFX_PHY_STAT_PCS_BER) | \
113 (1ULL << EFX_PHY_STAT_PCS_BLOCK_ERRORS) | \
114 (1ULL << EFX_PHY_STAT_PHY_XS_LINK_UP) | \
115 (1ULL << EFX_PHY_STAT_PHY_XS_RX_FAULT) | \
116 (1ULL << EFX_PHY_STAT_PHY_XS_TX_FAULT) | \
117 (1ULL << EFX_PHY_STAT_PHY_XS_ALIGN) | \
118 (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_A) | \
119 (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_B) | \
120 (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_C) | \
121 (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_D) | \
122 (1ULL << EFX_PHY_STAT_AN_LINK_UP) | \
123 (1ULL << EFX_PHY_STAT_AN_MASTER) | \
124 (1ULL << EFX_PHY_STAT_AN_LOCAL_RX_OK) | \
125 (1ULL << EFX_PHY_STAT_AN_REMOTE_RX_OK) | \
126 (1ULL << EFX_PHY_STAT_SNR_A) | \
127 (1ULL << EFX_PHY_STAT_SNR_B) | \
128 (1ULL << EFX_PHY_STAT_SNR_C) | \
129 (1ULL << EFX_PHY_STAT_SNR_D)
130
131 /* END MKCONFIG GENERATED Sfx7101PhyHeaderStatsMask */
132
133 extern __checkReturn int
134 sfx7101_stats_update(
135 __in efx_nic_t *enp,
136 __in efsys_mem_t *esmp,
137 __out_ecount(EFX_PHY_NSTATS) uint32_t *stat);
138
139 #endif /* EFSYS_OPT_PHY_STATS */
140
141 #if EFSYS_OPT_PHY_PROPS
142
143 #if EFSYS_OPT_NAMES
144
145 extern const char __cs *
146 sfx7101_prop_name(
147 __in efx_nic_t *enp,
148 __in unsigned int id);
149
150 #endif
151
152 extern __checkReturn int
153 sfx7101_prop_get(
154 __in efx_nic_t *enp,
155 __in unsigned int id,
156 __in uint32_t flags,
157 __out uint32_t *valp);
158
159 extern __checkReturn int
160 sfx7101_prop_set(
161 __in efx_nic_t *enp,
162 __in unsigned int id,
163 __in uint32_t val);
164
165 #endif /* EFSYS_OPT_PHY_PROPS */
166
167 #if EFSYS_OPT_NVRAM_SFX7101
168
169 extern __checkReturn int
170 sfx7101_nvram_size(
171 __in efx_nic_t *enp,
172 __out size_t *sizep);
173
174 extern __checkReturn int
175 sfx7101_nvram_get_version(
176 __in efx_nic_t *enp,
177 __out uint32_t *subtypep,
178 __out_ecount(4) uint16_t version[4]);
179
180 extern __checkReturn int
181 sfx7101_nvram_rw_start(
182 __in efx_nic_t *enp,
183 __out size_t *block_sizep);
184
185 extern __checkReturn int
186 sfx7101_nvram_read_chunk(
187 __in efx_nic_t *enp,
188 __in unsigned int offset,
189 __out_bcount(size) caddr_t data,
190 __in size_t size);
191
192 extern __checkReturn int
193 sfx7101_nvram_erase(
194 __in efx_nic_t *enp);
195
196 extern __checkReturn int
197 sfx7101_nvram_write_chunk(
198 __in efx_nic_t *enp,
199 __in unsigned int offset,
200 __in_bcount(size) caddr_t data,
201 __in size_t size);
202
203 extern void
204 sfx7101_nvram_rw_finish(
205 __in efx_nic_t *enp);
206
207 extern const uint8_t * const sfx7101_loader;
208 extern const size_t sfx7101_loader_size;
209
210 #pragma pack(1)
211
212 typedef struct sfx7001_firmware_header_s {
213 efx_dword_t code_length;
214 efx_dword_t destination_address;
215 efx_word_t code_checksum;
216 efx_word_t boot_config;
217 efx_word_t header_csum;
218 efx_byte_t reserved[18];
219 } sfx7101_firmware_header_t;
220
221 #pragma pack()
222
223 #endif /* EFSYS_OPT_NVRAM_SFX7101 */
224
225 #endif /* EFSYS_OPT_PHY_SFX7101 */
226
227 #ifdef __cplusplus
228 }
229 #endif
230
231 #endif /* _SYS_SFX7101_H */