Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * FUJITSU Extended Socket Network Device driver
4 * Copyright (c) 2015 FUJITSU LIMITED
5 */
6
7#ifndef FJES_HW_H_
8#define FJES_HW_H_
9
10#include <linux/netdevice.h>
11#include <linux/if_vlan.h>
12#include <linux/vmalloc.h>
13
14#include "fjes_regs.h"
15
16struct fjes_hw;
17
18#define EP_BUFFER_SUPPORT_VLAN_MAX 4
19#define EP_BUFFER_INFO_SIZE 4096
20
21#define FJES_DEBUG_PAGE_SIZE 4096
22#define FJES_DEBUG_BUFFER_SIZE (16 * FJES_DEBUG_PAGE_SIZE)
23
24#define FJES_DEVICE_RESET_TIMEOUT ((17 + 1) * 3 * 8) /* sec */
25#define FJES_COMMAND_REQ_TIMEOUT ((5 + 1) * 3 * 8) /* sec */
26#define FJES_COMMAND_REQ_BUFF_TIMEOUT (60 * 3) /* sec */
27#define FJES_COMMAND_EPSTOP_WAIT_TIMEOUT (1) /* sec */
28
29#define FJES_CMD_REQ_ERR_INFO_PARAM (0x0001)
30#define FJES_CMD_REQ_ERR_INFO_STATUS (0x0002)
31
32#define FJES_CMD_REQ_RES_CODE_NORMAL (0)
33#define FJES_CMD_REQ_RES_CODE_BUSY (1)
34
35#define FJES_ZONING_STATUS_DISABLE (0x00)
36#define FJES_ZONING_STATUS_ENABLE (0x01)
37#define FJES_ZONING_STATUS_INVALID (0xFF)
38
39#define FJES_ZONING_ZONE_TYPE_NONE (0xFF)
40
41#define FJES_TX_DELAY_SEND_NONE (0)
42#define FJES_TX_DELAY_SEND_PENDING (1)
43
44#define FJES_RX_STOP_REQ_NONE (0x0)
45#define FJES_RX_STOP_REQ_DONE (0x1)
46#define FJES_RX_STOP_REQ_REQUEST (0x2)
47#define FJES_RX_POLL_WORK (0x4)
48#define FJES_RX_MTU_CHANGING_DONE (0x8)
49
50#define EP_BUFFER_SIZE \
51 (((sizeof(union ep_buffer_info) + (128 * (64 * 1024))) \
52 / EP_BUFFER_INFO_SIZE) * EP_BUFFER_INFO_SIZE)
53
54#define EP_RING_NUM(buffer_size, frame_size) \
55 (u32)((buffer_size) / (frame_size))
56#define EP_RING_INDEX(_num, _max) (((_num) + (_max)) % (_max))
57#define EP_RING_INDEX_INC(_num, _max) \
58 ((_num) = EP_RING_INDEX((_num) + 1, (_max)))
59#define EP_RING_FULL(_head, _tail, _max) \
60 (0 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
61#define EP_RING_EMPTY(_head, _tail, _max) \
62 (1 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
63
64#define FJES_MTU_TO_BUFFER_SIZE(mtu) \
65 (ETH_HLEN + VLAN_HLEN + (mtu) + ETH_FCS_LEN)
66#define FJES_MTU_TO_FRAME_SIZE(mtu) \
67 (sizeof(struct esmem_frame) + FJES_MTU_TO_BUFFER_SIZE(mtu))
68#define FJES_MTU_DEFINE(size) \
69 ((size) - sizeof(struct esmem_frame) - \
70 (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
71
72#define FJES_DEV_COMMAND_INFO_REQ_LEN (4)
73#define FJES_DEV_COMMAND_INFO_RES_LEN(epnum) (8 + 2 * (epnum))
74#define FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(txb, rxb) \
75 (24 + (8 * ((txb) / EP_BUFFER_INFO_SIZE + (rxb) / EP_BUFFER_INFO_SIZE)))
76#define FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN (8)
77#define FJES_DEV_COMMAND_UNSHARE_BUFFER_REQ_LEN (8)
78#define FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN (8)
79
80#define FJES_DEV_REQ_BUF_SIZE(maxep) \
81 FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(EP_BUFFER_SIZE, EP_BUFFER_SIZE)
82#define FJES_DEV_RES_BUF_SIZE(maxep) \
83 FJES_DEV_COMMAND_INFO_RES_LEN(maxep)
84
85#define FJES_DEV_COMMAND_START_DBG_REQ_LEN(byte) \
86 (16 + (8 * (byte) / FJES_DEBUG_PAGE_SIZE))
87#define FJES_DEV_COMMAND_START_DBG_RES_LEN (8)
88#define FJES_DEV_COMMAND_STOP_DBG_REQ_LEN (4)
89#define FJES_DEV_COMMAND_STOP_DBG_RES_LEN (8)
90
91/* Frame & MTU */
92struct esmem_frame {
93 __le32 frame_size;
94 u8 frame_data[];
95};
96
97/* EP partner status */
98enum ep_partner_status {
99 EP_PARTNER_UNSHARE,
100 EP_PARTNER_SHARED,
101 EP_PARTNER_WAITING,
102 EP_PARTNER_COMPLETE,
103 EP_PARTNER_STATUS_MAX,
104};
105
106/* shared status region */
107struct fjes_device_shared_info {
108 int epnum;
109 u8 ep_status[];
110};
111
112/* structures for command control request data*/
113union fjes_device_command_req {
114 struct {
115 __le32 length;
116 } info;
117 struct {
118 __le32 length;
119 __le32 epid;
120 __le64 buffer[];
121 } share_buffer;
122 struct {
123 __le32 length;
124 __le32 epid;
125 } unshare_buffer;
126 struct {
127 __le32 length;
128 __le32 mode;
129 __le64 buffer_len;
130 __le64 buffer[];
131 } start_trace;
132 struct {
133 __le32 length;
134 } stop_trace;
135};
136
137/* structures for command control response data */
138union fjes_device_command_res {
139 struct {
140 __le32 length;
141 __le32 code;
142 struct {
143 u8 es_status;
144 u8 zone;
145 } info[];
146 } info;
147 struct {
148 __le32 length;
149 __le32 code;
150 } share_buffer;
151 struct {
152 __le32 length;
153 __le32 code;
154 } unshare_buffer;
155 struct {
156 __le32 length;
157 __le32 code;
158 } start_trace;
159 struct {
160 __le32 length;
161 __le32 code;
162 } stop_trace;
163};
164
165/* request command type */
166enum fjes_dev_command_request_type {
167 FJES_CMD_REQ_INFO = 0x0001,
168 FJES_CMD_REQ_SHARE_BUFFER = 0x0002,
169 FJES_CMD_REQ_UNSHARE_BUFFER = 0x0004,
170 FJES_CMD_REQ_START_DEBUG = 0x0100,
171 FJES_CMD_REQ_STOP_DEBUG = 0x0200,
172};
173
174/* parameter for command control */
175struct fjes_device_command_param {
176 u32 req_len;
177 phys_addr_t req_start;
178 u32 res_len;
179 phys_addr_t res_start;
180 phys_addr_t share_start;
181};
182
183/* error code for command control */
184enum fjes_dev_command_response_e {
185 FJES_CMD_STATUS_UNKNOWN,
186 FJES_CMD_STATUS_NORMAL,
187 FJES_CMD_STATUS_TIMEOUT,
188 FJES_CMD_STATUS_ERROR_PARAM,
189 FJES_CMD_STATUS_ERROR_STATUS,
190};
191
192/* EP buffer information */
193union ep_buffer_info {
194 u8 raw[EP_BUFFER_INFO_SIZE];
195
196 struct _ep_buffer_info_common_t {
197 u32 version;
198 } common;
199
200 struct _ep_buffer_info_v1_t {
201 u32 version;
202 u32 info_size;
203
204 u32 buffer_size;
205 u16 count_max;
206
207 u16 _rsv_1;
208
209 u32 frame_max;
210 u8 mac_addr[ETH_ALEN];
211
212 u16 _rsv_2;
213 u32 _rsv_3;
214
215 u16 tx_status;
216 u16 rx_status;
217
218 u32 head;
219 u32 tail;
220
221 u16 vlan_id[EP_BUFFER_SUPPORT_VLAN_MAX];
222
223 } v1i;
224
225};
226
227/* statistics of EP */
228struct fjes_drv_ep_stats {
229 u64 com_regist_buf_exec;
230 u64 com_unregist_buf_exec;
231 u64 send_intr_rx;
232 u64 send_intr_unshare;
233 u64 send_intr_zoneupdate;
234 u64 recv_intr_rx;
235 u64 recv_intr_unshare;
236 u64 recv_intr_stop;
237 u64 recv_intr_zoneupdate;
238 u64 tx_buffer_full;
239 u64 tx_dropped_not_shared;
240 u64 tx_dropped_ver_mismatch;
241 u64 tx_dropped_buf_size_mismatch;
242 u64 tx_dropped_vlanid_mismatch;
243};
244
245/* buffer pair for Extended Partition */
246struct ep_share_mem_info {
247 struct epbuf_handler {
248 void *buffer;
249 size_t size;
250 union ep_buffer_info *info;
251 u8 *ring;
252 } tx, rx;
253
254 struct rtnl_link_stats64 net_stats;
255 struct fjes_drv_ep_stats ep_stats;
256
257 u16 tx_status_work;
258
259 u8 es_status;
260 u8 zone;
261};
262
263struct es_device_trace {
264 u32 record_num;
265 u32 current_record;
266 u32 status_flag;
267 u32 _rsv;
268
269 struct {
270 u16 epid;
271 u16 dir_offset;
272 u32 data;
273 u64 tsc;
274 } record[];
275};
276
277struct fjes_hw_info {
278 struct fjes_device_shared_info *share;
279 union fjes_device_command_req *req_buf;
280 u64 req_buf_size;
281 union fjes_device_command_res *res_buf;
282 u64 res_buf_size;
283
284 int *my_epid;
285 int *max_epid;
286
287 struct es_device_trace *trace;
288 u64 trace_size;
289
290 struct mutex lock; /* buffer lock*/
291
292 unsigned long buffer_share_bit;
293 unsigned long buffer_unshare_reserve_bit;
294};
295
296struct fjes_hw {
297 void *back;
298
299 unsigned long txrx_stop_req_bit;
300 unsigned long epstop_req_bit;
301 struct work_struct update_zone_task;
302 struct work_struct epstop_task;
303
304 int my_epid;
305 int max_epid;
306
307 struct ep_share_mem_info *ep_shm_info;
308
309 struct fjes_hw_resource {
310 u64 start;
311 u64 size;
312 int irq;
313 } hw_res;
314
315 u8 *base;
316
317 struct fjes_hw_info hw_info;
318
319 spinlock_t rx_status_lock; /* spinlock for rx_status */
320
321 u32 debug_mode;
322};
323
324int fjes_hw_init(struct fjes_hw *);
325void fjes_hw_exit(struct fjes_hw *);
326int fjes_hw_reset(struct fjes_hw *);
327int fjes_hw_request_info(struct fjes_hw *);
328int fjes_hw_register_buff_addr(struct fjes_hw *, int,
329 struct ep_share_mem_info *);
330int fjes_hw_unregister_buff_addr(struct fjes_hw *, int);
331void fjes_hw_init_command_registers(struct fjes_hw *,
332 struct fjes_device_command_param *);
333void fjes_hw_setup_epbuf(struct epbuf_handler *, const u8 *, u32);
334int fjes_hw_raise_interrupt(struct fjes_hw *, int, enum REG_ICTL_MASK);
335void fjes_hw_set_irqmask(struct fjes_hw *, enum REG_ICTL_MASK, bool);
336u32 fjes_hw_capture_interrupt_status(struct fjes_hw *);
337void fjes_hw_raise_epstop(struct fjes_hw *);
338int fjes_hw_wait_epstop(struct fjes_hw *);
339enum ep_partner_status
340 fjes_hw_get_partner_ep_status(struct fjes_hw *, int);
341
342bool fjes_hw_epid_is_same_zone(struct fjes_hw *, int);
343int fjes_hw_epid_is_shared(struct fjes_device_shared_info *, int);
344bool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32);
345bool fjes_hw_check_mtu(struct epbuf_handler *, u32);
346bool fjes_hw_check_vlan_id(struct epbuf_handler *, u16);
347bool fjes_hw_set_vlan_id(struct epbuf_handler *, u16);
348void fjes_hw_del_vlan_id(struct epbuf_handler *, u16);
349bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *);
350void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *);
351void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *);
352int fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t);
353
354int fjes_hw_start_debug(struct fjes_hw *);
355int fjes_hw_stop_debug(struct fjes_hw *);
356#endif /* FJES_HW_H_ */
1/*
2 * FUJITSU Extended Socket Network Device driver
3 * Copyright (c) 2015 FUJITSU LIMITED
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * The full GNU General Public License is included in this distribution in
18 * the file called "COPYING".
19 *
20 */
21
22#ifndef FJES_HW_H_
23#define FJES_HW_H_
24
25#include <linux/netdevice.h>
26#include <linux/if_vlan.h>
27#include <linux/vmalloc.h>
28
29#include "fjes_regs.h"
30
31struct fjes_hw;
32
33#define EP_BUFFER_SUPPORT_VLAN_MAX 4
34#define EP_BUFFER_INFO_SIZE 4096
35
36#define FJES_DEBUG_PAGE_SIZE 4096
37#define FJES_DEBUG_BUFFER_SIZE (16 * FJES_DEBUG_PAGE_SIZE)
38
39#define FJES_DEVICE_RESET_TIMEOUT ((17 + 1) * 3 * 8) /* sec */
40#define FJES_COMMAND_REQ_TIMEOUT ((5 + 1) * 3 * 8) /* sec */
41#define FJES_COMMAND_REQ_BUFF_TIMEOUT (60 * 3) /* sec */
42#define FJES_COMMAND_EPSTOP_WAIT_TIMEOUT (1) /* sec */
43
44#define FJES_CMD_REQ_ERR_INFO_PARAM (0x0001)
45#define FJES_CMD_REQ_ERR_INFO_STATUS (0x0002)
46
47#define FJES_CMD_REQ_RES_CODE_NORMAL (0)
48#define FJES_CMD_REQ_RES_CODE_BUSY (1)
49
50#define FJES_ZONING_STATUS_DISABLE (0x00)
51#define FJES_ZONING_STATUS_ENABLE (0x01)
52#define FJES_ZONING_STATUS_INVALID (0xFF)
53
54#define FJES_ZONING_ZONE_TYPE_NONE (0xFF)
55
56#define FJES_TX_DELAY_SEND_NONE (0)
57#define FJES_TX_DELAY_SEND_PENDING (1)
58
59#define FJES_RX_STOP_REQ_NONE (0x0)
60#define FJES_RX_STOP_REQ_DONE (0x1)
61#define FJES_RX_STOP_REQ_REQUEST (0x2)
62#define FJES_RX_POLL_WORK (0x4)
63#define FJES_RX_MTU_CHANGING_DONE (0x8)
64
65#define EP_BUFFER_SIZE \
66 (((sizeof(union ep_buffer_info) + (128 * (64 * 1024))) \
67 / EP_BUFFER_INFO_SIZE) * EP_BUFFER_INFO_SIZE)
68
69#define EP_RING_NUM(buffer_size, frame_size) \
70 (u32)((buffer_size) / (frame_size))
71#define EP_RING_INDEX(_num, _max) (((_num) + (_max)) % (_max))
72#define EP_RING_INDEX_INC(_num, _max) \
73 ((_num) = EP_RING_INDEX((_num) + 1, (_max)))
74#define EP_RING_FULL(_head, _tail, _max) \
75 (0 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
76#define EP_RING_EMPTY(_head, _tail, _max) \
77 (1 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
78
79#define FJES_MTU_TO_BUFFER_SIZE(mtu) \
80 (ETH_HLEN + VLAN_HLEN + (mtu) + ETH_FCS_LEN)
81#define FJES_MTU_TO_FRAME_SIZE(mtu) \
82 (sizeof(struct esmem_frame) + FJES_MTU_TO_BUFFER_SIZE(mtu))
83#define FJES_MTU_DEFINE(size) \
84 ((size) - sizeof(struct esmem_frame) - \
85 (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
86
87#define FJES_DEV_COMMAND_INFO_REQ_LEN (4)
88#define FJES_DEV_COMMAND_INFO_RES_LEN(epnum) (8 + 2 * (epnum))
89#define FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(txb, rxb) \
90 (24 + (8 * ((txb) / EP_BUFFER_INFO_SIZE + (rxb) / EP_BUFFER_INFO_SIZE)))
91#define FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN (8)
92#define FJES_DEV_COMMAND_UNSHARE_BUFFER_REQ_LEN (8)
93#define FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN (8)
94
95#define FJES_DEV_REQ_BUF_SIZE(maxep) \
96 FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(EP_BUFFER_SIZE, EP_BUFFER_SIZE)
97#define FJES_DEV_RES_BUF_SIZE(maxep) \
98 FJES_DEV_COMMAND_INFO_RES_LEN(maxep)
99
100#define FJES_DEV_COMMAND_START_DBG_REQ_LEN(byte) \
101 (16 + (8 * (byte) / FJES_DEBUG_PAGE_SIZE))
102#define FJES_DEV_COMMAND_START_DBG_RES_LEN (8)
103#define FJES_DEV_COMMAND_STOP_DBG_REQ_LEN (4)
104#define FJES_DEV_COMMAND_STOP_DBG_RES_LEN (8)
105
106/* Frame & MTU */
107struct esmem_frame {
108 __le32 frame_size;
109 u8 frame_data[];
110};
111
112/* EP partner status */
113enum ep_partner_status {
114 EP_PARTNER_UNSHARE,
115 EP_PARTNER_SHARED,
116 EP_PARTNER_WAITING,
117 EP_PARTNER_COMPLETE,
118 EP_PARTNER_STATUS_MAX,
119};
120
121/* shared status region */
122struct fjes_device_shared_info {
123 int epnum;
124 u8 ep_status[];
125};
126
127/* structures for command control request data*/
128union fjes_device_command_req {
129 struct {
130 __le32 length;
131 } info;
132 struct {
133 __le32 length;
134 __le32 epid;
135 __le64 buffer[];
136 } share_buffer;
137 struct {
138 __le32 length;
139 __le32 epid;
140 } unshare_buffer;
141 struct {
142 __le32 length;
143 __le32 mode;
144 __le64 buffer_len;
145 __le64 buffer[];
146 } start_trace;
147 struct {
148 __le32 length;
149 } stop_trace;
150};
151
152/* structures for command control response data */
153union fjes_device_command_res {
154 struct {
155 __le32 length;
156 __le32 code;
157 struct {
158 u8 es_status;
159 u8 zone;
160 } info[];
161 } info;
162 struct {
163 __le32 length;
164 __le32 code;
165 } share_buffer;
166 struct {
167 __le32 length;
168 __le32 code;
169 } unshare_buffer;
170 struct {
171 __le32 length;
172 __le32 code;
173 } start_trace;
174 struct {
175 __le32 length;
176 __le32 code;
177 } stop_trace;
178};
179
180/* request command type */
181enum fjes_dev_command_request_type {
182 FJES_CMD_REQ_INFO = 0x0001,
183 FJES_CMD_REQ_SHARE_BUFFER = 0x0002,
184 FJES_CMD_REQ_UNSHARE_BUFFER = 0x0004,
185 FJES_CMD_REQ_START_DEBUG = 0x0100,
186 FJES_CMD_REQ_STOP_DEBUG = 0x0200,
187};
188
189/* parameter for command control */
190struct fjes_device_command_param {
191 u32 req_len;
192 phys_addr_t req_start;
193 u32 res_len;
194 phys_addr_t res_start;
195 phys_addr_t share_start;
196};
197
198/* error code for command control */
199enum fjes_dev_command_response_e {
200 FJES_CMD_STATUS_UNKNOWN,
201 FJES_CMD_STATUS_NORMAL,
202 FJES_CMD_STATUS_TIMEOUT,
203 FJES_CMD_STATUS_ERROR_PARAM,
204 FJES_CMD_STATUS_ERROR_STATUS,
205};
206
207/* EP buffer information */
208union ep_buffer_info {
209 u8 raw[EP_BUFFER_INFO_SIZE];
210
211 struct _ep_buffer_info_common_t {
212 u32 version;
213 } common;
214
215 struct _ep_buffer_info_v1_t {
216 u32 version;
217 u32 info_size;
218
219 u32 buffer_size;
220 u16 count_max;
221
222 u16 _rsv_1;
223
224 u32 frame_max;
225 u8 mac_addr[ETH_ALEN];
226
227 u16 _rsv_2;
228 u32 _rsv_3;
229
230 u16 tx_status;
231 u16 rx_status;
232
233 u32 head;
234 u32 tail;
235
236 u16 vlan_id[EP_BUFFER_SUPPORT_VLAN_MAX];
237
238 } v1i;
239
240};
241
242/* statistics of EP */
243struct fjes_drv_ep_stats {
244 u64 com_regist_buf_exec;
245 u64 com_unregist_buf_exec;
246 u64 send_intr_rx;
247 u64 send_intr_unshare;
248 u64 send_intr_zoneupdate;
249 u64 recv_intr_rx;
250 u64 recv_intr_unshare;
251 u64 recv_intr_stop;
252 u64 recv_intr_zoneupdate;
253 u64 tx_buffer_full;
254 u64 tx_dropped_not_shared;
255 u64 tx_dropped_ver_mismatch;
256 u64 tx_dropped_buf_size_mismatch;
257 u64 tx_dropped_vlanid_mismatch;
258};
259
260/* buffer pair for Extended Partition */
261struct ep_share_mem_info {
262 struct epbuf_handler {
263 void *buffer;
264 size_t size;
265 union ep_buffer_info *info;
266 u8 *ring;
267 } tx, rx;
268
269 struct rtnl_link_stats64 net_stats;
270 struct fjes_drv_ep_stats ep_stats;
271
272 u16 tx_status_work;
273
274 u8 es_status;
275 u8 zone;
276};
277
278struct es_device_trace {
279 u32 record_num;
280 u32 current_record;
281 u32 status_flag;
282 u32 _rsv;
283
284 struct {
285 u16 epid;
286 u16 dir_offset;
287 u32 data;
288 u64 tsc;
289 } record[];
290};
291
292struct fjes_hw_info {
293 struct fjes_device_shared_info *share;
294 union fjes_device_command_req *req_buf;
295 u64 req_buf_size;
296 union fjes_device_command_res *res_buf;
297 u64 res_buf_size;
298
299 int *my_epid;
300 int *max_epid;
301
302 struct es_device_trace *trace;
303 u64 trace_size;
304
305 struct mutex lock; /* buffer lock*/
306
307 unsigned long buffer_share_bit;
308 unsigned long buffer_unshare_reserve_bit;
309};
310
311struct fjes_hw {
312 void *back;
313
314 unsigned long txrx_stop_req_bit;
315 unsigned long epstop_req_bit;
316 struct work_struct update_zone_task;
317 struct work_struct epstop_task;
318
319 int my_epid;
320 int max_epid;
321
322 struct ep_share_mem_info *ep_shm_info;
323
324 struct fjes_hw_resource {
325 u64 start;
326 u64 size;
327 int irq;
328 } hw_res;
329
330 u8 *base;
331
332 struct fjes_hw_info hw_info;
333
334 spinlock_t rx_status_lock; /* spinlock for rx_status */
335
336 u32 debug_mode;
337};
338
339int fjes_hw_init(struct fjes_hw *);
340void fjes_hw_exit(struct fjes_hw *);
341int fjes_hw_reset(struct fjes_hw *);
342int fjes_hw_request_info(struct fjes_hw *);
343int fjes_hw_register_buff_addr(struct fjes_hw *, int,
344 struct ep_share_mem_info *);
345int fjes_hw_unregister_buff_addr(struct fjes_hw *, int);
346void fjes_hw_init_command_registers(struct fjes_hw *,
347 struct fjes_device_command_param *);
348void fjes_hw_setup_epbuf(struct epbuf_handler *, u8 *, u32);
349int fjes_hw_raise_interrupt(struct fjes_hw *, int, enum REG_ICTL_MASK);
350void fjes_hw_set_irqmask(struct fjes_hw *, enum REG_ICTL_MASK, bool);
351u32 fjes_hw_capture_interrupt_status(struct fjes_hw *);
352void fjes_hw_raise_epstop(struct fjes_hw *);
353int fjes_hw_wait_epstop(struct fjes_hw *);
354enum ep_partner_status
355 fjes_hw_get_partner_ep_status(struct fjes_hw *, int);
356
357bool fjes_hw_epid_is_same_zone(struct fjes_hw *, int);
358int fjes_hw_epid_is_shared(struct fjes_device_shared_info *, int);
359bool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32);
360bool fjes_hw_check_mtu(struct epbuf_handler *, u32);
361bool fjes_hw_check_vlan_id(struct epbuf_handler *, u16);
362bool fjes_hw_set_vlan_id(struct epbuf_handler *, u16);
363void fjes_hw_del_vlan_id(struct epbuf_handler *, u16);
364bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *);
365void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *);
366void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *);
367int fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t);
368
369int fjes_hw_start_debug(struct fjes_hw *);
370int fjes_hw_stop_debug(struct fjes_hw *);
371#endif /* FJES_HW_H_ */