linux/drivers/net/fjes/fjes_hw.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  FUJITSU Extended Socket Network Device driver
 *  Copyright (c) 2015 FUJITSU LIMITED
 */

#ifndef FJES_HW_H_
#define FJES_HW_H_

#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/vmalloc.h>

#include "fjes_regs.h"

struct fjes_hw;

#define EP_BUFFER_SUPPORT_VLAN_MAX
#define EP_BUFFER_INFO_SIZE

#define FJES_DEBUG_PAGE_SIZE
#define FJES_DEBUG_BUFFER_SIZE

#define FJES_DEVICE_RESET_TIMEOUT
#define FJES_COMMAND_REQ_TIMEOUT
#define FJES_COMMAND_REQ_BUFF_TIMEOUT
#define FJES_COMMAND_EPSTOP_WAIT_TIMEOUT

#define FJES_CMD_REQ_ERR_INFO_PARAM
#define FJES_CMD_REQ_ERR_INFO_STATUS

#define FJES_CMD_REQ_RES_CODE_NORMAL
#define FJES_CMD_REQ_RES_CODE_BUSY

#define FJES_ZONING_STATUS_DISABLE
#define FJES_ZONING_STATUS_ENABLE
#define FJES_ZONING_STATUS_INVALID

#define FJES_ZONING_ZONE_TYPE_NONE

#define FJES_TX_DELAY_SEND_NONE
#define FJES_TX_DELAY_SEND_PENDING

#define FJES_RX_STOP_REQ_NONE
#define FJES_RX_STOP_REQ_DONE
#define FJES_RX_STOP_REQ_REQUEST
#define FJES_RX_POLL_WORK
#define FJES_RX_MTU_CHANGING_DONE

#define EP_BUFFER_SIZE

#define EP_RING_NUM(buffer_size, frame_size)
#define EP_RING_INDEX(_num, _max)
#define EP_RING_INDEX_INC(_num, _max)
#define EP_RING_FULL(_head, _tail, _max)
#define EP_RING_EMPTY(_head, _tail, _max)

#define FJES_MTU_TO_BUFFER_SIZE(mtu)
#define FJES_MTU_TO_FRAME_SIZE(mtu)
#define FJES_MTU_DEFINE(size)

#define FJES_DEV_COMMAND_INFO_REQ_LEN
#define FJES_DEV_COMMAND_INFO_RES_LEN(epnum)
#define FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(txb, rxb)
#define FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN
#define FJES_DEV_COMMAND_UNSHARE_BUFFER_REQ_LEN
#define FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN

#define FJES_DEV_REQ_BUF_SIZE(maxep)
#define FJES_DEV_RES_BUF_SIZE(maxep)

#define FJES_DEV_COMMAND_START_DBG_REQ_LEN(byte)
#define FJES_DEV_COMMAND_START_DBG_RES_LEN
#define FJES_DEV_COMMAND_STOP_DBG_REQ_LEN
#define FJES_DEV_COMMAND_STOP_DBG_RES_LEN

/* Frame & MTU */
struct esmem_frame {};

/* EP partner status */
enum ep_partner_status {};

/* shared status region */
struct fjes_device_shared_info {};

/* structures for command control request data*/
fjes_device_command_req;

/* structures for command control response data */
fjes_device_command_res;

/* request command type */
enum fjes_dev_command_request_type {};

/* parameter for command control */
struct fjes_device_command_param {};

/* error code for command control */
enum fjes_dev_command_response_e {};

/* EP buffer information */
ep_buffer_info;

/* statistics of EP */
struct fjes_drv_ep_stats {};

/* buffer pair for Extended Partition */
struct ep_share_mem_info {};

struct es_device_trace {};

struct fjes_hw_info {};

struct fjes_hw {};

int fjes_hw_init(struct fjes_hw *);
void fjes_hw_exit(struct fjes_hw *);
int fjes_hw_reset(struct fjes_hw *);
int fjes_hw_request_info(struct fjes_hw *);
int fjes_hw_register_buff_addr(struct fjes_hw *, int,
			       struct ep_share_mem_info *);
int fjes_hw_unregister_buff_addr(struct fjes_hw *, int);
void fjes_hw_init_command_registers(struct fjes_hw *,
				    struct fjes_device_command_param *);
void fjes_hw_setup_epbuf(struct epbuf_handler *, const u8 *, u32);
int fjes_hw_raise_interrupt(struct fjes_hw *, int, enum REG_ICTL_MASK);
void fjes_hw_set_irqmask(struct fjes_hw *, enum REG_ICTL_MASK, bool);
u32 fjes_hw_capture_interrupt_status(struct fjes_hw *);
void fjes_hw_raise_epstop(struct fjes_hw *);
int fjes_hw_wait_epstop(struct fjes_hw *);
enum ep_partner_status
	fjes_hw_get_partner_ep_status(struct fjes_hw *, int);

bool fjes_hw_epid_is_same_zone(struct fjes_hw *, int);
int fjes_hw_epid_is_shared(struct fjes_device_shared_info *, int);
bool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32);
bool fjes_hw_check_mtu(struct epbuf_handler *, u32);
bool fjes_hw_check_vlan_id(struct epbuf_handler *, u16);
bool fjes_hw_set_vlan_id(struct epbuf_handler *, u16);
void fjes_hw_del_vlan_id(struct epbuf_handler *, u16);
bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *);
void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *);
void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *);
int fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t);

int fjes_hw_start_debug(struct fjes_hw *);
int fjes_hw_stop_debug(struct fjes_hw *);
#endif /* FJES_HW_H_ */