net/sfc/base: import 5xxx/6xxx family support
[dpdk.git] / drivers / net / sfc / base / siena_impl.h
1 /*
2  * Copyright (c) 2009-2016 Solarflare Communications Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
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.
13  *
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.
25  *
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.
29  */
30
31 #ifndef _SYS_SIENA_IMPL_H
32 #define _SYS_SIENA_IMPL_H
33
34 #include "efx.h"
35 #include "efx_regs.h"
36 #include "efx_mcdi.h"
37 #include "siena_flash.h"
38
39 #ifdef  __cplusplus
40 extern "C" {
41 #endif
42
43 #define SIENA_NVRAM_CHUNK 0x80
44
45 extern  __checkReturn   efx_rc_t
46 siena_nic_probe(
47         __in            efx_nic_t *enp);
48
49 extern  __checkReturn   efx_rc_t
50 siena_nic_reset(
51         __in            efx_nic_t *enp);
52
53 extern  __checkReturn   efx_rc_t
54 siena_nic_init(
55         __in            efx_nic_t *enp);
56
57 extern                  void
58 siena_nic_fini(
59         __in            efx_nic_t *enp);
60
61 extern                  void
62 siena_nic_unprobe(
63         __in            efx_nic_t *enp);
64
65 #define SIENA_SRAM_ROWS 0x12000
66
67 extern                  void
68 siena_sram_init(
69         __in            efx_nic_t *enp);
70
71 #if EFSYS_OPT_MCDI
72
73 extern  __checkReturn   efx_rc_t
74 siena_mcdi_init(
75         __in            efx_nic_t *enp,
76         __in            const efx_mcdi_transport_t *mtp);
77
78 extern                  void
79 siena_mcdi_send_request(
80         __in                    efx_nic_t *enp,
81         __in_bcount(hdr_len)    void *hdrp,
82         __in                    size_t hdr_len,
83         __in_bcount(sdu_len)    void *sdup,
84         __in                    size_t sdu_len);
85
86 extern  __checkReturn   boolean_t
87 siena_mcdi_poll_response(
88         __in            efx_nic_t *enp);
89
90 extern                  void
91 siena_mcdi_read_response(
92         __in                    efx_nic_t *enp,
93         __out_bcount(length)    void *bufferp,
94         __in                    size_t offset,
95         __in                    size_t length);
96
97 extern                  efx_rc_t
98 siena_mcdi_poll_reboot(
99         __in            efx_nic_t *enp);
100
101 extern                  void
102 siena_mcdi_fini(
103         __in            efx_nic_t *enp);
104
105 extern  __checkReturn   efx_rc_t
106 siena_mcdi_feature_supported(
107         __in            efx_nic_t *enp,
108         __in            efx_mcdi_feature_id_t id,
109         __out           boolean_t *supportedp);
110
111 extern                  void
112 siena_mcdi_get_timeout(
113         __in            efx_nic_t *enp,
114         __in            efx_mcdi_req_t *emrp,
115         __out           uint32_t *timeoutp);
116
117 #endif /* EFSYS_OPT_MCDI */
118
119 typedef struct siena_link_state_s {
120         uint32_t                sls_adv_cap_mask;
121         uint32_t                sls_lp_cap_mask;
122         unsigned int            sls_fcntl;
123         efx_link_mode_t         sls_link_mode;
124         boolean_t               sls_mac_up;
125 } siena_link_state_t;
126
127 extern                  void
128 siena_phy_link_ev(
129         __in            efx_nic_t *enp,
130         __in            efx_qword_t *eqp,
131         __out           efx_link_mode_t *link_modep);
132
133 extern  __checkReturn   efx_rc_t
134 siena_phy_get_link(
135         __in            efx_nic_t *enp,
136         __out           siena_link_state_t *slsp);
137
138 extern  __checkReturn   efx_rc_t
139 siena_phy_power(
140         __in            efx_nic_t *enp,
141         __in            boolean_t on);
142
143 extern  __checkReturn   efx_rc_t
144 siena_phy_reconfigure(
145         __in            efx_nic_t *enp);
146
147 extern  __checkReturn   efx_rc_t
148 siena_phy_verify(
149         __in            efx_nic_t *enp);
150
151 extern  __checkReturn   efx_rc_t
152 siena_phy_oui_get(
153         __in            efx_nic_t *enp,
154         __out           uint32_t *ouip);
155
156 extern  __checkReturn   efx_rc_t
157 siena_mac_poll(
158         __in            efx_nic_t *enp,
159         __out           efx_link_mode_t *link_modep);
160
161 extern  __checkReturn   efx_rc_t
162 siena_mac_up(
163         __in            efx_nic_t *enp,
164         __out           boolean_t *mac_upp);
165
166 extern  __checkReturn   efx_rc_t
167 siena_mac_reconfigure(
168         __in    efx_nic_t *enp);
169
170 extern  __checkReturn   efx_rc_t
171 siena_mac_pdu_get(
172         __in    efx_nic_t *enp,
173         __out   size_t *pdu);
174
175 #ifdef  __cplusplus
176 }
177 #endif
178
179 #endif  /* _SYS_SIENA_IMPL_H */