Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright 2014 Cisco Systems, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This program is free software; you may redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * the Free Software Foundation; version 2 of the License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #ifndef _SNIC_IO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define _SNIC_IO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define SNIC_DFLT_SG_DESC_CNT	32	/* Default descriptors for sgl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define SNIC_MAX_SG_DESC_CNT	60	/* Max descriptor for sgl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define SNIC_SG_DESC_ALIGN	16	/* Descriptor address alignment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /* SG descriptor for snic */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) struct snic_sg_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	__le64 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	__le32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) struct snic_dflt_sgl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct snic_sg_desc sg_desc[SNIC_DFLT_SG_DESC_CNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) struct snic_max_sgl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	struct snic_sg_desc sg_desc[SNIC_MAX_SG_DESC_CNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) enum snic_req_cache_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	SNIC_REQ_CACHE_DFLT_SGL = 0,	/* cache with default size sgl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	SNIC_REQ_CACHE_MAX_SGL,		/* cache with max size sgl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	SNIC_REQ_TM_CACHE,		/* cache for task mgmt reqs contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 					   snic_host_req objects only*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	SNIC_REQ_MAX_CACHES		/* number of sgl caches */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) /* Per IO internal state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct snic_internal_io_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	char	*rqi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u64	flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u32	state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u32	abts_status;	/* Abort completion status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u32	lr_status;	/* device reset completion status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /* IO state machine */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) enum snic_ioreq_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	SNIC_IOREQ_NOT_INITED = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	SNIC_IOREQ_PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	SNIC_IOREQ_ABTS_PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	SNIC_IOREQ_ABTS_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	SNIC_IOREQ_LR_PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	SNIC_IOREQ_LR_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	SNIC_IOREQ_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) struct snic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) struct snic_host_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * snic_req_info : Contains info about IO, one per scsi command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * Notes: Make sure that the structure is aligned to 16 B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * this helps in easy access to snic_req_info from snic_host_req
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) struct snic_req_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct snic_host_req *req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u64	start_time;		/* start time in jiffies */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	u16	rq_pool_type;		/* noticion of request pool type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	u16	req_len;		/* buf len passing to fw (req + sgl)*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	u32	tgt_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	u32	tm_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	u8	io_cmpl:1;		/* sets to 1 when fw completes IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	u8	resvd[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	struct scsi_cmnd *sc;		/* Associated scsi cmd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	struct snic	*snic;		/* Associated snic */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	ulong	sge_va;			/* Pointer to Resp Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	u64	snsbuf_va;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	struct snic_host_req *abort_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	struct completion *abts_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	struct snic_host_req *dr_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	struct completion *dr_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define rqi_to_req(rqi)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	((struct snic_host_req *) (((struct snic_req_info *)rqi)->req))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define req_to_rqi(req)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	((struct snic_req_info *) (((struct snic_host_req *)req)->hdr.init_ctx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define req_to_sgl(req)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	((struct snic_sg_desc *) (((struct snic_host_req *)req)+1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct snic_req_info *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) snic_req_init(struct snic *, int sg_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) void snic_req_free(struct snic *, struct snic_req_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) void snic_calc_io_process_time(struct snic *, struct snic_req_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) void snic_pci_unmap_rsp_buf(struct snic *, struct snic_req_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct snic_host_req *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) snic_abort_req_init(struct snic *, struct snic_req_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct snic_host_req *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) snic_dr_req_init(struct snic *, struct snic_req_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #endif /* _SNIC_IO_H */