18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  FUJITSU Extended Socket Network Device driver
48c2ecf20Sopenharmony_ci *  Copyright (c) 2015 FUJITSU LIMITED
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef FJES_HW_H_
88c2ecf20Sopenharmony_ci#define FJES_HW_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
118c2ecf20Sopenharmony_ci#include <linux/if_vlan.h>
128c2ecf20Sopenharmony_ci#include <linux/vmalloc.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "fjes_regs.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct fjes_hw;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define EP_BUFFER_SUPPORT_VLAN_MAX 4
198c2ecf20Sopenharmony_ci#define EP_BUFFER_INFO_SIZE 4096
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define FJES_DEBUG_PAGE_SIZE 4096
228c2ecf20Sopenharmony_ci#define FJES_DEBUG_BUFFER_SIZE	(16 * FJES_DEBUG_PAGE_SIZE)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define FJES_DEVICE_RESET_TIMEOUT  ((17 + 1) * 3 * 8) /* sec */
258c2ecf20Sopenharmony_ci#define FJES_COMMAND_REQ_TIMEOUT  ((5 + 1) * 3 * 8) /* sec */
268c2ecf20Sopenharmony_ci#define FJES_COMMAND_REQ_BUFF_TIMEOUT	(60 * 3) /* sec */
278c2ecf20Sopenharmony_ci#define FJES_COMMAND_EPSTOP_WAIT_TIMEOUT	(1) /* sec */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define FJES_CMD_REQ_ERR_INFO_PARAM  (0x0001)
308c2ecf20Sopenharmony_ci#define FJES_CMD_REQ_ERR_INFO_STATUS (0x0002)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define FJES_CMD_REQ_RES_CODE_NORMAL (0)
338c2ecf20Sopenharmony_ci#define FJES_CMD_REQ_RES_CODE_BUSY   (1)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define FJES_ZONING_STATUS_DISABLE	(0x00)
368c2ecf20Sopenharmony_ci#define FJES_ZONING_STATUS_ENABLE	(0x01)
378c2ecf20Sopenharmony_ci#define FJES_ZONING_STATUS_INVALID	(0xFF)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define FJES_ZONING_ZONE_TYPE_NONE (0xFF)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define FJES_TX_DELAY_SEND_NONE		(0)
428c2ecf20Sopenharmony_ci#define FJES_TX_DELAY_SEND_PENDING	(1)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define FJES_RX_STOP_REQ_NONE		(0x0)
458c2ecf20Sopenharmony_ci#define FJES_RX_STOP_REQ_DONE		(0x1)
468c2ecf20Sopenharmony_ci#define FJES_RX_STOP_REQ_REQUEST	(0x2)
478c2ecf20Sopenharmony_ci#define FJES_RX_POLL_WORK		(0x4)
488c2ecf20Sopenharmony_ci#define FJES_RX_MTU_CHANGING_DONE	(0x8)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define EP_BUFFER_SIZE \
518c2ecf20Sopenharmony_ci	(((sizeof(union ep_buffer_info) + (128 * (64 * 1024))) \
528c2ecf20Sopenharmony_ci		/ EP_BUFFER_INFO_SIZE) * EP_BUFFER_INFO_SIZE)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define EP_RING_NUM(buffer_size, frame_size) \
558c2ecf20Sopenharmony_ci		(u32)((buffer_size) / (frame_size))
568c2ecf20Sopenharmony_ci#define EP_RING_INDEX(_num, _max) (((_num) + (_max)) % (_max))
578c2ecf20Sopenharmony_ci#define EP_RING_INDEX_INC(_num, _max) \
588c2ecf20Sopenharmony_ci	((_num) = EP_RING_INDEX((_num) + 1, (_max)))
598c2ecf20Sopenharmony_ci#define EP_RING_FULL(_head, _tail, _max)				\
608c2ecf20Sopenharmony_ci	(0 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
618c2ecf20Sopenharmony_ci#define EP_RING_EMPTY(_head, _tail, _max) \
628c2ecf20Sopenharmony_ci	(1 == EP_RING_INDEX(((_tail) - (_head)), (_max)))
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define FJES_MTU_TO_BUFFER_SIZE(mtu) \
658c2ecf20Sopenharmony_ci	(ETH_HLEN + VLAN_HLEN + (mtu) + ETH_FCS_LEN)
668c2ecf20Sopenharmony_ci#define FJES_MTU_TO_FRAME_SIZE(mtu) \
678c2ecf20Sopenharmony_ci	(sizeof(struct esmem_frame) + FJES_MTU_TO_BUFFER_SIZE(mtu))
688c2ecf20Sopenharmony_ci#define FJES_MTU_DEFINE(size) \
698c2ecf20Sopenharmony_ci	((size) - sizeof(struct esmem_frame) - \
708c2ecf20Sopenharmony_ci	(ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_INFO_REQ_LEN	(4)
738c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_INFO_RES_LEN(epnum) (8 + 2 * (epnum))
748c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(txb, rxb) \
758c2ecf20Sopenharmony_ci	(24 + (8 * ((txb) / EP_BUFFER_INFO_SIZE + (rxb) / EP_BUFFER_INFO_SIZE)))
768c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN	(8)
778c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_UNSHARE_BUFFER_REQ_LEN	(8)
788c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN	(8)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define FJES_DEV_REQ_BUF_SIZE(maxep) \
818c2ecf20Sopenharmony_ci	FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(EP_BUFFER_SIZE, EP_BUFFER_SIZE)
828c2ecf20Sopenharmony_ci#define FJES_DEV_RES_BUF_SIZE(maxep) \
838c2ecf20Sopenharmony_ci	FJES_DEV_COMMAND_INFO_RES_LEN(maxep)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_START_DBG_REQ_LEN(byte) \
868c2ecf20Sopenharmony_ci	(16 + (8 * (byte) / FJES_DEBUG_PAGE_SIZE))
878c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_START_DBG_RES_LEN (8)
888c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_STOP_DBG_REQ_LEN (4)
898c2ecf20Sopenharmony_ci#define FJES_DEV_COMMAND_STOP_DBG_RES_LEN (8)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* Frame & MTU */
928c2ecf20Sopenharmony_cistruct esmem_frame {
938c2ecf20Sopenharmony_ci	__le32 frame_size;
948c2ecf20Sopenharmony_ci	u8 frame_data[];
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/* EP partner status */
988c2ecf20Sopenharmony_cienum ep_partner_status {
998c2ecf20Sopenharmony_ci	EP_PARTNER_UNSHARE,
1008c2ecf20Sopenharmony_ci	EP_PARTNER_SHARED,
1018c2ecf20Sopenharmony_ci	EP_PARTNER_WAITING,
1028c2ecf20Sopenharmony_ci	EP_PARTNER_COMPLETE,
1038c2ecf20Sopenharmony_ci	EP_PARTNER_STATUS_MAX,
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* shared status region */
1078c2ecf20Sopenharmony_cistruct fjes_device_shared_info {
1088c2ecf20Sopenharmony_ci	int epnum;
1098c2ecf20Sopenharmony_ci	u8 ep_status[];
1108c2ecf20Sopenharmony_ci};
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* structures for command control request data*/
1138c2ecf20Sopenharmony_ciunion fjes_device_command_req {
1148c2ecf20Sopenharmony_ci	struct {
1158c2ecf20Sopenharmony_ci		__le32 length;
1168c2ecf20Sopenharmony_ci	} info;
1178c2ecf20Sopenharmony_ci	struct {
1188c2ecf20Sopenharmony_ci		__le32 length;
1198c2ecf20Sopenharmony_ci		__le32 epid;
1208c2ecf20Sopenharmony_ci		__le64 buffer[];
1218c2ecf20Sopenharmony_ci	} share_buffer;
1228c2ecf20Sopenharmony_ci	struct {
1238c2ecf20Sopenharmony_ci		__le32 length;
1248c2ecf20Sopenharmony_ci		__le32 epid;
1258c2ecf20Sopenharmony_ci	} unshare_buffer;
1268c2ecf20Sopenharmony_ci	struct {
1278c2ecf20Sopenharmony_ci		__le32 length;
1288c2ecf20Sopenharmony_ci		__le32 mode;
1298c2ecf20Sopenharmony_ci		__le64 buffer_len;
1308c2ecf20Sopenharmony_ci		__le64 buffer[];
1318c2ecf20Sopenharmony_ci	} start_trace;
1328c2ecf20Sopenharmony_ci	struct {
1338c2ecf20Sopenharmony_ci		__le32 length;
1348c2ecf20Sopenharmony_ci	} stop_trace;
1358c2ecf20Sopenharmony_ci};
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* structures for command control response data */
1388c2ecf20Sopenharmony_ciunion fjes_device_command_res {
1398c2ecf20Sopenharmony_ci	struct {
1408c2ecf20Sopenharmony_ci		__le32 length;
1418c2ecf20Sopenharmony_ci		__le32 code;
1428c2ecf20Sopenharmony_ci		struct {
1438c2ecf20Sopenharmony_ci			u8 es_status;
1448c2ecf20Sopenharmony_ci			u8 zone;
1458c2ecf20Sopenharmony_ci		} info[];
1468c2ecf20Sopenharmony_ci	} info;
1478c2ecf20Sopenharmony_ci	struct {
1488c2ecf20Sopenharmony_ci		__le32 length;
1498c2ecf20Sopenharmony_ci		__le32 code;
1508c2ecf20Sopenharmony_ci	} share_buffer;
1518c2ecf20Sopenharmony_ci	struct {
1528c2ecf20Sopenharmony_ci		__le32 length;
1538c2ecf20Sopenharmony_ci		__le32 code;
1548c2ecf20Sopenharmony_ci	} unshare_buffer;
1558c2ecf20Sopenharmony_ci	struct {
1568c2ecf20Sopenharmony_ci		__le32 length;
1578c2ecf20Sopenharmony_ci		__le32 code;
1588c2ecf20Sopenharmony_ci	} start_trace;
1598c2ecf20Sopenharmony_ci	struct {
1608c2ecf20Sopenharmony_ci		__le32 length;
1618c2ecf20Sopenharmony_ci		__le32 code;
1628c2ecf20Sopenharmony_ci	} stop_trace;
1638c2ecf20Sopenharmony_ci};
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* request command type */
1668c2ecf20Sopenharmony_cienum fjes_dev_command_request_type {
1678c2ecf20Sopenharmony_ci	FJES_CMD_REQ_INFO		= 0x0001,
1688c2ecf20Sopenharmony_ci	FJES_CMD_REQ_SHARE_BUFFER	= 0x0002,
1698c2ecf20Sopenharmony_ci	FJES_CMD_REQ_UNSHARE_BUFFER	= 0x0004,
1708c2ecf20Sopenharmony_ci	FJES_CMD_REQ_START_DEBUG	= 0x0100,
1718c2ecf20Sopenharmony_ci	FJES_CMD_REQ_STOP_DEBUG		= 0x0200,
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* parameter for command control */
1758c2ecf20Sopenharmony_cistruct fjes_device_command_param {
1768c2ecf20Sopenharmony_ci	u32 req_len;
1778c2ecf20Sopenharmony_ci	phys_addr_t req_start;
1788c2ecf20Sopenharmony_ci	u32 res_len;
1798c2ecf20Sopenharmony_ci	phys_addr_t res_start;
1808c2ecf20Sopenharmony_ci	phys_addr_t share_start;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* error code for command control */
1848c2ecf20Sopenharmony_cienum fjes_dev_command_response_e {
1858c2ecf20Sopenharmony_ci	FJES_CMD_STATUS_UNKNOWN,
1868c2ecf20Sopenharmony_ci	FJES_CMD_STATUS_NORMAL,
1878c2ecf20Sopenharmony_ci	FJES_CMD_STATUS_TIMEOUT,
1888c2ecf20Sopenharmony_ci	FJES_CMD_STATUS_ERROR_PARAM,
1898c2ecf20Sopenharmony_ci	FJES_CMD_STATUS_ERROR_STATUS,
1908c2ecf20Sopenharmony_ci};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* EP buffer information */
1938c2ecf20Sopenharmony_ciunion ep_buffer_info {
1948c2ecf20Sopenharmony_ci	u8 raw[EP_BUFFER_INFO_SIZE];
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	struct _ep_buffer_info_common_t {
1978c2ecf20Sopenharmony_ci		u32 version;
1988c2ecf20Sopenharmony_ci	} common;
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	struct _ep_buffer_info_v1_t {
2018c2ecf20Sopenharmony_ci		u32 version;
2028c2ecf20Sopenharmony_ci		u32 info_size;
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci		u32 buffer_size;
2058c2ecf20Sopenharmony_ci		u16 count_max;
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci		u16 _rsv_1;
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci		u32 frame_max;
2108c2ecf20Sopenharmony_ci		u8 mac_addr[ETH_ALEN];
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci		u16 _rsv_2;
2138c2ecf20Sopenharmony_ci		u32 _rsv_3;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci		u16 tx_status;
2168c2ecf20Sopenharmony_ci		u16 rx_status;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci		u32 head;
2198c2ecf20Sopenharmony_ci		u32 tail;
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci		u16 vlan_id[EP_BUFFER_SUPPORT_VLAN_MAX];
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	} v1i;
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci};
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/* statistics of EP */
2288c2ecf20Sopenharmony_cistruct fjes_drv_ep_stats {
2298c2ecf20Sopenharmony_ci	u64 com_regist_buf_exec;
2308c2ecf20Sopenharmony_ci	u64 com_unregist_buf_exec;
2318c2ecf20Sopenharmony_ci	u64 send_intr_rx;
2328c2ecf20Sopenharmony_ci	u64 send_intr_unshare;
2338c2ecf20Sopenharmony_ci	u64 send_intr_zoneupdate;
2348c2ecf20Sopenharmony_ci	u64 recv_intr_rx;
2358c2ecf20Sopenharmony_ci	u64 recv_intr_unshare;
2368c2ecf20Sopenharmony_ci	u64 recv_intr_stop;
2378c2ecf20Sopenharmony_ci	u64 recv_intr_zoneupdate;
2388c2ecf20Sopenharmony_ci	u64 tx_buffer_full;
2398c2ecf20Sopenharmony_ci	u64 tx_dropped_not_shared;
2408c2ecf20Sopenharmony_ci	u64 tx_dropped_ver_mismatch;
2418c2ecf20Sopenharmony_ci	u64 tx_dropped_buf_size_mismatch;
2428c2ecf20Sopenharmony_ci	u64 tx_dropped_vlanid_mismatch;
2438c2ecf20Sopenharmony_ci};
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/* buffer pair for Extended Partition */
2468c2ecf20Sopenharmony_cistruct ep_share_mem_info {
2478c2ecf20Sopenharmony_ci	struct epbuf_handler {
2488c2ecf20Sopenharmony_ci		void *buffer;
2498c2ecf20Sopenharmony_ci		size_t size;
2508c2ecf20Sopenharmony_ci		union ep_buffer_info *info;
2518c2ecf20Sopenharmony_ci		u8 *ring;
2528c2ecf20Sopenharmony_ci	} tx, rx;
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 net_stats;
2558c2ecf20Sopenharmony_ci	struct fjes_drv_ep_stats ep_stats;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	u16 tx_status_work;
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	u8 es_status;
2608c2ecf20Sopenharmony_ci	u8 zone;
2618c2ecf20Sopenharmony_ci};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct es_device_trace {
2648c2ecf20Sopenharmony_ci	u32 record_num;
2658c2ecf20Sopenharmony_ci	u32 current_record;
2668c2ecf20Sopenharmony_ci	u32 status_flag;
2678c2ecf20Sopenharmony_ci	u32 _rsv;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	struct {
2708c2ecf20Sopenharmony_ci			u16 epid;
2718c2ecf20Sopenharmony_ci			u16 dir_offset;
2728c2ecf20Sopenharmony_ci			u32 data;
2738c2ecf20Sopenharmony_ci			u64 tsc;
2748c2ecf20Sopenharmony_ci	} record[];
2758c2ecf20Sopenharmony_ci};
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_cistruct fjes_hw_info {
2788c2ecf20Sopenharmony_ci	struct fjes_device_shared_info *share;
2798c2ecf20Sopenharmony_ci	union fjes_device_command_req *req_buf;
2808c2ecf20Sopenharmony_ci	u64 req_buf_size;
2818c2ecf20Sopenharmony_ci	union fjes_device_command_res *res_buf;
2828c2ecf20Sopenharmony_ci	u64 res_buf_size;
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	int *my_epid;
2858c2ecf20Sopenharmony_ci	int *max_epid;
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	struct es_device_trace *trace;
2888c2ecf20Sopenharmony_ci	u64 trace_size;
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	struct mutex lock; /* buffer lock*/
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci	unsigned long buffer_share_bit;
2938c2ecf20Sopenharmony_ci	unsigned long buffer_unshare_reserve_bit;
2948c2ecf20Sopenharmony_ci};
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_cistruct fjes_hw {
2978c2ecf20Sopenharmony_ci	void *back;
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci	unsigned long txrx_stop_req_bit;
3008c2ecf20Sopenharmony_ci	unsigned long epstop_req_bit;
3018c2ecf20Sopenharmony_ci	struct work_struct update_zone_task;
3028c2ecf20Sopenharmony_ci	struct work_struct epstop_task;
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	int my_epid;
3058c2ecf20Sopenharmony_ci	int max_epid;
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	struct ep_share_mem_info *ep_shm_info;
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci	struct fjes_hw_resource {
3108c2ecf20Sopenharmony_ci		u64 start;
3118c2ecf20Sopenharmony_ci		u64 size;
3128c2ecf20Sopenharmony_ci		int irq;
3138c2ecf20Sopenharmony_ci	} hw_res;
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci	u8 *base;
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	struct fjes_hw_info hw_info;
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	spinlock_t rx_status_lock; /* spinlock for rx_status */
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	u32 debug_mode;
3228c2ecf20Sopenharmony_ci};
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ciint fjes_hw_init(struct fjes_hw *);
3258c2ecf20Sopenharmony_civoid fjes_hw_exit(struct fjes_hw *);
3268c2ecf20Sopenharmony_ciint fjes_hw_reset(struct fjes_hw *);
3278c2ecf20Sopenharmony_ciint fjes_hw_request_info(struct fjes_hw *);
3288c2ecf20Sopenharmony_ciint fjes_hw_register_buff_addr(struct fjes_hw *, int,
3298c2ecf20Sopenharmony_ci			       struct ep_share_mem_info *);
3308c2ecf20Sopenharmony_ciint fjes_hw_unregister_buff_addr(struct fjes_hw *, int);
3318c2ecf20Sopenharmony_civoid fjes_hw_init_command_registers(struct fjes_hw *,
3328c2ecf20Sopenharmony_ci				    struct fjes_device_command_param *);
3338c2ecf20Sopenharmony_civoid fjes_hw_setup_epbuf(struct epbuf_handler *, u8 *, u32);
3348c2ecf20Sopenharmony_ciint fjes_hw_raise_interrupt(struct fjes_hw *, int, enum REG_ICTL_MASK);
3358c2ecf20Sopenharmony_civoid fjes_hw_set_irqmask(struct fjes_hw *, enum REG_ICTL_MASK, bool);
3368c2ecf20Sopenharmony_ciu32 fjes_hw_capture_interrupt_status(struct fjes_hw *);
3378c2ecf20Sopenharmony_civoid fjes_hw_raise_epstop(struct fjes_hw *);
3388c2ecf20Sopenharmony_ciint fjes_hw_wait_epstop(struct fjes_hw *);
3398c2ecf20Sopenharmony_cienum ep_partner_status
3408c2ecf20Sopenharmony_ci	fjes_hw_get_partner_ep_status(struct fjes_hw *, int);
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_cibool fjes_hw_epid_is_same_zone(struct fjes_hw *, int);
3438c2ecf20Sopenharmony_ciint fjes_hw_epid_is_shared(struct fjes_device_shared_info *, int);
3448c2ecf20Sopenharmony_cibool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32);
3458c2ecf20Sopenharmony_cibool fjes_hw_check_mtu(struct epbuf_handler *, u32);
3468c2ecf20Sopenharmony_cibool fjes_hw_check_vlan_id(struct epbuf_handler *, u16);
3478c2ecf20Sopenharmony_cibool fjes_hw_set_vlan_id(struct epbuf_handler *, u16);
3488c2ecf20Sopenharmony_civoid fjes_hw_del_vlan_id(struct epbuf_handler *, u16);
3498c2ecf20Sopenharmony_cibool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *);
3508c2ecf20Sopenharmony_civoid *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *);
3518c2ecf20Sopenharmony_civoid fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *);
3528c2ecf20Sopenharmony_ciint fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t);
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ciint fjes_hw_start_debug(struct fjes_hw *);
3558c2ecf20Sopenharmony_ciint fjes_hw_stop_debug(struct fjes_hw *);
3568c2ecf20Sopenharmony_ci#endif /* FJES_HW_H_ */
357