162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
462306a36Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef _FNIC_IO_H_
762306a36Sopenharmony_ci#define _FNIC_IO_H_
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <scsi/fc/fc_fcp.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define FNIC_DFLT_SG_DESC_CNT  32
1262306a36Sopenharmony_ci#define FNIC_MAX_SG_DESC_CNT        256     /* Maximum descriptors per sgl */
1362306a36Sopenharmony_ci#define FNIC_SG_DESC_ALIGN          16      /* Descriptor address alignment */
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct host_sg_desc {
1662306a36Sopenharmony_ci	__le64 addr;
1762306a36Sopenharmony_ci	__le32 len;
1862306a36Sopenharmony_ci	u32 _resvd;
1962306a36Sopenharmony_ci};
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistruct fnic_dflt_sgl_list {
2262306a36Sopenharmony_ci	struct host_sg_desc sg_desc[FNIC_DFLT_SG_DESC_CNT];
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cistruct fnic_sgl_list {
2662306a36Sopenharmony_ci	struct host_sg_desc sg_desc[FNIC_MAX_SG_DESC_CNT];
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cienum fnic_sgl_list_type {
3062306a36Sopenharmony_ci	FNIC_SGL_CACHE_DFLT = 0,  /* cache with default size sgl */
3162306a36Sopenharmony_ci	FNIC_SGL_CACHE_MAX,       /* cache with max size sgl */
3262306a36Sopenharmony_ci	FNIC_SGL_NUM_CACHES       /* number of sgl caches */
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cienum fnic_ioreq_state {
3662306a36Sopenharmony_ci	FNIC_IOREQ_NOT_INITED = 0,
3762306a36Sopenharmony_ci	FNIC_IOREQ_CMD_PENDING,
3862306a36Sopenharmony_ci	FNIC_IOREQ_ABTS_PENDING,
3962306a36Sopenharmony_ci	FNIC_IOREQ_ABTS_COMPLETE,
4062306a36Sopenharmony_ci	FNIC_IOREQ_CMD_COMPLETE,
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistruct fnic_io_req {
4462306a36Sopenharmony_ci	struct host_sg_desc *sgl_list; /* sgl list */
4562306a36Sopenharmony_ci	void *sgl_list_alloc; /* sgl list address used for free */
4662306a36Sopenharmony_ci	dma_addr_t sense_buf_pa; /* dma address for sense buffer*/
4762306a36Sopenharmony_ci	dma_addr_t sgl_list_pa;	/* dma address for sgl list */
4862306a36Sopenharmony_ci	u16 sgl_cnt;
4962306a36Sopenharmony_ci	u8 sgl_type; /* device DMA descriptor list type */
5062306a36Sopenharmony_ci	u8 io_completed:1; /* set to 1 when fw completes IO */
5162306a36Sopenharmony_ci	u32 port_id; /* remote port DID */
5262306a36Sopenharmony_ci	unsigned long start_time; /* in jiffies */
5362306a36Sopenharmony_ci	struct completion *abts_done; /* completion for abts */
5462306a36Sopenharmony_ci	struct completion *dr_done; /* completion for device reset */
5562306a36Sopenharmony_ci	unsigned int tag;
5662306a36Sopenharmony_ci	struct scsi_cmnd *sc; /* midlayer's cmd pointer */
5762306a36Sopenharmony_ci};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cienum fnic_port_speeds {
6062306a36Sopenharmony_ci	DCEM_PORTSPEED_NONE = 0,
6162306a36Sopenharmony_ci	DCEM_PORTSPEED_1G    = 1000,
6262306a36Sopenharmony_ci	DCEM_PORTSPEED_10G   = 10000,
6362306a36Sopenharmony_ci	DCEM_PORTSPEED_20G   = 20000,
6462306a36Sopenharmony_ci	DCEM_PORTSPEED_25G   = 25000,
6562306a36Sopenharmony_ci	DCEM_PORTSPEED_40G   = 40000,
6662306a36Sopenharmony_ci	DCEM_PORTSPEED_4x10G = 41000,
6762306a36Sopenharmony_ci	DCEM_PORTSPEED_100G  = 100000,
6862306a36Sopenharmony_ci};
6962306a36Sopenharmony_ci#endif /* _FNIC_IO_H_ */
70