18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
38c2ecf20Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This program is free software; you may redistribute it and/or modify
68c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by
78c2ecf20Sopenharmony_ci * the Free Software Foundation; version 2 of the License.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
108c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
118c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
128c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
138c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
148c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
158c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
168c2ecf20Sopenharmony_ci * SOFTWARE.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci#ifndef _FNIC_IO_H_
198c2ecf20Sopenharmony_ci#define _FNIC_IO_H_
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <scsi/fc/fc_fcp.h>
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define FNIC_DFLT_SG_DESC_CNT  32
248c2ecf20Sopenharmony_ci#define FNIC_MAX_SG_DESC_CNT        256     /* Maximum descriptors per sgl */
258c2ecf20Sopenharmony_ci#define FNIC_SG_DESC_ALIGN          16      /* Descriptor address alignment */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct host_sg_desc {
288c2ecf20Sopenharmony_ci	__le64 addr;
298c2ecf20Sopenharmony_ci	__le32 len;
308c2ecf20Sopenharmony_ci	u32 _resvd;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct fnic_dflt_sgl_list {
348c2ecf20Sopenharmony_ci	struct host_sg_desc sg_desc[FNIC_DFLT_SG_DESC_CNT];
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct fnic_sgl_list {
388c2ecf20Sopenharmony_ci	struct host_sg_desc sg_desc[FNIC_MAX_SG_DESC_CNT];
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cienum fnic_sgl_list_type {
428c2ecf20Sopenharmony_ci	FNIC_SGL_CACHE_DFLT = 0,  /* cache with default size sgl */
438c2ecf20Sopenharmony_ci	FNIC_SGL_CACHE_MAX,       /* cache with max size sgl */
448c2ecf20Sopenharmony_ci	FNIC_SGL_NUM_CACHES       /* number of sgl caches */
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cienum fnic_ioreq_state {
488c2ecf20Sopenharmony_ci	FNIC_IOREQ_NOT_INITED = 0,
498c2ecf20Sopenharmony_ci	FNIC_IOREQ_CMD_PENDING,
508c2ecf20Sopenharmony_ci	FNIC_IOREQ_ABTS_PENDING,
518c2ecf20Sopenharmony_ci	FNIC_IOREQ_ABTS_COMPLETE,
528c2ecf20Sopenharmony_ci	FNIC_IOREQ_CMD_COMPLETE,
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct fnic_io_req {
568c2ecf20Sopenharmony_ci	struct host_sg_desc *sgl_list; /* sgl list */
578c2ecf20Sopenharmony_ci	void *sgl_list_alloc; /* sgl list address used for free */
588c2ecf20Sopenharmony_ci	dma_addr_t sense_buf_pa; /* dma address for sense buffer*/
598c2ecf20Sopenharmony_ci	dma_addr_t sgl_list_pa;	/* dma address for sgl list */
608c2ecf20Sopenharmony_ci	u16 sgl_cnt;
618c2ecf20Sopenharmony_ci	u8 sgl_type; /* device DMA descriptor list type */
628c2ecf20Sopenharmony_ci	u8 io_completed:1; /* set to 1 when fw completes IO */
638c2ecf20Sopenharmony_ci	u32 port_id; /* remote port DID */
648c2ecf20Sopenharmony_ci	unsigned long start_time; /* in jiffies */
658c2ecf20Sopenharmony_ci	struct completion *abts_done; /* completion for abts */
668c2ecf20Sopenharmony_ci	struct completion *dr_done; /* completion for device reset */
678c2ecf20Sopenharmony_ci};
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cienum fnic_port_speeds {
708c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_NONE = 0,
718c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_1G    = 1000,
728c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_10G   = 10000,
738c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_20G   = 20000,
748c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_25G   = 25000,
758c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_40G   = 40000,
768c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_4x10G = 41000,
778c2ecf20Sopenharmony_ci	DCEM_PORTSPEED_100G  = 100000,
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci#endif /* _FNIC_IO_H_ */
80