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 2008 Cisco Systems, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * This program is free software; you may redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * the Free Software Foundation; version 2 of the License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #ifndef _FCPIO_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define _FCPIO_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/if_ether.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * This header file includes all of the data structures used for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * communication by the host driver to the fcp firmware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * Exchange and sequence id space allocated to the host driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define FCPIO_HOST_EXCH_RANGE_START         0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define FCPIO_HOST_EXCH_RANGE_END           0x1fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define FCPIO_HOST_SEQ_ID_RANGE_START       0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define FCPIO_HOST_SEQ_ID_RANGE_END         0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * Command entry type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) enum fcpio_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	 * Initiator request types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	FCPIO_ICMND_16 = 0x1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	FCPIO_ICMND_32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	FCPIO_ICMND_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	FCPIO_ITMF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	FCPIO_ITMF_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	 * Target request types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	FCPIO_TCMND_16 = 0x11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	FCPIO_TCMND_32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	FCPIO_TDATA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	FCPIO_TXRDY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	FCPIO_TRSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	FCPIO_TDRSP_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	FCPIO_TTMF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	FCPIO_TTMF_ACK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	FCPIO_TABORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	FCPIO_TABORT_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	 * Misc request types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	FCPIO_ACK = 0x20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	FCPIO_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	FCPIO_RESET_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	FCPIO_FLOGI_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	FCPIO_FLOGI_REG_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	FCPIO_ECHO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	FCPIO_ECHO_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	FCPIO_LUNMAP_CHNG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	FCPIO_LUNMAP_REQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	FCPIO_LUNMAP_REQ_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	FCPIO_FLOGI_FIP_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	FCPIO_FLOGI_FIP_REG_CMPL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * Header status codes from the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) enum fcpio_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	FCPIO_SUCCESS = 0,              /* request was successful */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	 * If a request to the firmware is rejected, the original request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	 * header will be returned with the status set to one of the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	FCPIO_INVALID_HEADER,    /* header contains invalid data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	FCPIO_OUT_OF_RESOURCE,   /* out of resources to complete request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	FCPIO_INVALID_PARAM,     /* some parameter in request is invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	FCPIO_REQ_NOT_SUPPORTED, /* request type is not supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	FCPIO_IO_NOT_FOUND,      /* requested I/O was not found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 * Once a request is processed, the firmware will usually return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 * a cmpl message type.  In cases where errors occurred,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	 * the header status field would be filled in with one of the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	FCPIO_ABORTED = 0x41,     /* request was aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	FCPIO_TIMEOUT,            /* request was timed out */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	FCPIO_SGL_INVALID,        /* request was aborted due to sgl error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	FCPIO_MSS_INVALID,        /* request was aborted due to mss error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	FCPIO_DATA_CNT_MISMATCH,  /* recv/sent more/less data than exp. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	FCPIO_FW_ERR,             /* request was terminated due to fw error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	FCPIO_ITMF_REJECTED,      /* itmf req was rejected by remote node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	FCPIO_ITMF_FAILED,        /* itmf req was failed by remote node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	FCPIO_ITMF_INCORRECT_LUN, /* itmf req targeted incorrect LUN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	FCPIO_CMND_REJECTED,      /* request was invalid and rejected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	FCPIO_NO_PATH_AVAIL,      /* no paths to the lun was available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	FCPIO_PATH_FAILED,        /* i/o sent to current path failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	FCPIO_LUNMAP_CHNG_PEND,   /* i/o rejected due to lunmap change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * The header command tag.  All host requests will use the "tag" field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * to mark commands with a unique tag.  When the firmware responds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * a host request, it will copy the tag field into the response.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * The only firmware requests that will use the rx_id/ox_id fields instead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * of the tag field will be the target command and target task management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * requests.  These two requests do not have corresponding host requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * since they come directly from the FC initiator on the network.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct fcpio_tag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			u16 rx_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			u16 ox_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		} ex_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	} u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) fcpio_tag_id_enc(struct fcpio_tag *tag, u32 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	tag->u.req_id = id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) fcpio_tag_id_dec(struct fcpio_tag *tag, u32 *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	*id = tag->u.req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) fcpio_tag_exid_enc(struct fcpio_tag *tag, u16 ox_id, u16 rx_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	tag->u.ex_id.rx_id = rx_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	tag->u.ex_id.ox_id = ox_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) fcpio_tag_exid_dec(struct fcpio_tag *tag, u16 *ox_id, u16 *rx_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	*rx_id = tag->u.ex_id.rx_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	*ox_id = tag->u.ex_id.ox_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * The header for an fcpio request, whether from the firmware or from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * host driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) struct fcpio_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	u8            type;           /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	u8            status;         /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	u16           _resvd;         /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	struct fcpio_tag    tag;      /* header tag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) fcpio_header_enc(struct fcpio_header *hdr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		 u8 type, u8 status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		 struct fcpio_tag tag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	hdr->type = type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	hdr->status = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	hdr->_resvd = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	hdr->tag = tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) fcpio_header_dec(struct fcpio_header *hdr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		 u8 *type, u8 *status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		 struct fcpio_tag *tag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	*type = hdr->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	*status = hdr->status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	*tag = hdr->tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define CDB_16      16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #define CDB_32      32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #define LUN_ADDRESS 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * fcpio_icmnd_16: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * used for sending out an initiator SCSI 16-byte command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct fcpio_icmnd_16 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	u32	  lunmap_id;		/* index into lunmap table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	u8	  special_req_flags;	/* special exchange request flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	u8	  _resvd0[3];	        /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	u32	  sgl_cnt;		/* scatter-gather list count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	u32	  sense_len;		/* sense buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	u64	  sgl_addr;		/* scatter-gather list addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	u64	  sense_addr;		/* sense buffer address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	u8	  crn;			/* SCSI Command Reference No. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	u8	  pri_ta;		/* SCSI Priority and Task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	u8	  _resvd1;		/* reserved: should be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	u8	  flags;		/* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	u8	  scsi_cdb[CDB_16];	/* SCSI Cmnd Descriptor Block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	u32	  data_len;		/* length of data expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	u8	  lun[LUN_ADDRESS];	/* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	u8	  _resvd2;		/* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	u8	  d_id[3];		/* FC vNIC only: Target D_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	u16	  mss;			/* FC vNIC only: max burst */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	u16	  _resvd3;		/* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	u32	  r_a_tov;		/* FC vNIC only: Res. Alloc Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	u32	  e_d_tov;	        /* FC vNIC only: Err Detect Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  * Special request flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #define FCPIO_ICMND_SRFLAG_RETRY 0x01   /* Enable Retry handling on exchange */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * Priority/Task Attribute settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) #define FCPIO_ICMND_PTA_SIMPLE      0   /* simple task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) #define FCPIO_ICMND_PTA_HEADQ       1   /* head of queue task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #define FCPIO_ICMND_PTA_ORDERED     2   /* ordered task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #define FCPIO_ICMND_PTA_ACA         4   /* auto contingent allegiance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #define FCPIO_ICMND_PRI_SHIFT       3   /* priority field starts in bit 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * Command flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #define FCPIO_ICMND_RDDATA      0x02    /* read data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #define FCPIO_ICMND_WRDATA      0x01    /* write data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  * fcpio_icmnd_32: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  * used for sending out an initiator SCSI 32-byte command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct fcpio_icmnd_32 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	u32   lunmap_id;              /* index into lunmap table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	u8    special_req_flags;      /* special exchange request flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	u8    _resvd0[3];             /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	u32   sgl_cnt;                /* scatter-gather list count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	u32   sense_len;              /* sense buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	u64   sgl_addr;               /* scatter-gather list addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	u64   sense_addr;             /* sense buffer address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	u8    crn;                    /* SCSI Command Reference No. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	u8    pri_ta;                 /* SCSI Priority and Task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	u8    _resvd1;                /* reserved: should be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	u8    flags;                  /* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	u8    scsi_cdb[CDB_32];       /* SCSI Cmnd Descriptor Block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	u32   data_len;               /* length of data expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	u8    lun[LUN_ADDRESS];       /* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	u8    _resvd2;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	u8    d_id[3];		      /* FC vNIC only: Target D_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	u16   mss;                    /* FC vNIC only: max burst */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	u16   _resvd3;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	u32   r_a_tov;                /* FC vNIC only: Res. Alloc Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	u32   e_d_tov;                /* FC vNIC only: Error Detect Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * fcpio_itmf: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * used for requesting the firmware to abort a request and/or send out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  * a task management function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * The t_tag field is only needed when the request type is ABT_TASK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) struct fcpio_itmf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	u32   lunmap_id;              /* index into lunmap table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	u32   tm_req;                 /* SCSI Task Management request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	u32   t_tag;                  /* header tag of fcpio to be aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	u32   _resvd;                 /* _reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	u8    lun[LUN_ADDRESS];       /* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	u8    _resvd1;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	u8    d_id[3];		      /* FC vNIC only: Target D_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	u32   r_a_tov;                /* FC vNIC only: R_A_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	u32   e_d_tov;                /* FC vNIC only: E_D_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * Task Management request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) enum fcpio_itmf_tm_req_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	FCPIO_ITMF_ABT_TASK_TERM = 0x01,    /* abort task and terminate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	FCPIO_ITMF_ABT_TASK,                /* abort task and issue abts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	FCPIO_ITMF_ABT_TASK_SET,            /* abort task set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	FCPIO_ITMF_CLR_TASK_SET,            /* clear task set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	FCPIO_ITMF_LUN_RESET,               /* logical unit reset task mgmt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	FCPIO_ITMF_CLR_ACA,                 /* Clear ACA condition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * fcpio_tdata: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * used for requesting the firmware to send out a read data transfer for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  * target command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) struct fcpio_tdata {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	u16   rx_id;                  /* FC rx_id of target command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	u16   flags;                  /* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	u32   rel_offset;             /* data sequence relative offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	u32   sgl_cnt;                /* scatter-gather list count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	u32   data_len;               /* length of data expected to send */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	u64   sgl_addr;               /* scatter-gather list address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * Command flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #define FCPIO_TDATA_SCSI_RSP    0x01    /* send a scsi resp. after last frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * fcpio_txrdy: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  * used for requesting the firmware to send out a write data transfer for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  * target command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) struct fcpio_txrdy {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	u16   rx_id;                  /* FC rx_id of target command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	u16   _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	u32   rel_offset;             /* data sequence relative offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	u32   sgl_cnt;                /* scatter-gather list count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	u32   data_len;               /* length of data expected to send */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	u64   sgl_addr;               /* scatter-gather list address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * fcpio_trsp: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * used for requesting the firmware to send out a response for a target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  * command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) struct fcpio_trsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	u16   rx_id;                  /* FC rx_id of target command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	u16   _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	u32   sense_len;              /* sense data buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	u64   sense_addr;             /* sense data buffer address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	u16   _resvd1;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	u8    flags;                  /* response request flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	u8    scsi_status;            /* SCSI status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	u32   residual;               /* SCSI data residual value of I/O */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  * resposnse request flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) #define FCPIO_TRSP_RESID_UNDER  0x08   /* residual is valid and is underflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) #define FCPIO_TRSP_RESID_OVER   0x04   /* residual is valid and is overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * fcpio_ttmf_ack: host -> firmware response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * used by the host to indicate to the firmware it has received and processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  * the target tmf request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) struct fcpio_ttmf_ack {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	u16   rx_id;                  /* FC rx_id of target command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	u16   _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	u32   tmf_status;             /* SCSI task management status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  * fcpio_tabort: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)  * used by the host to request the firmware to abort a target request that was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  * received by the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) struct fcpio_tabort {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	u16   rx_id;                  /* rx_id of the target request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)  * fcpio_reset: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)  * used by the host to signal a reset of the driver to the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)  * and to request firmware to clean up all outstanding I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) struct fcpio_reset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	u32   _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) enum fcpio_flogi_reg_format_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	FCPIO_FLOGI_REG_DEF_DEST = 0,    /* Use the oui | s_id mac format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	FCPIO_FLOGI_REG_GW_DEST,         /* Use the fixed gateway mac */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)  * fcpio_flogi_reg: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)  * fc vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)  * used by the host to notify the firmware of the lif's s_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  * and destination mac address format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) struct fcpio_flogi_reg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	u8 format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	u8 s_id[3];			/* FC vNIC only: Source S_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	u8 gateway_mac[ETH_ALEN];	/* Destination gateway mac */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	u16 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	u32 r_a_tov;			/* R_A_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	u32 e_d_tov;			/* E_D_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  * fcpio_echo: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)  * sends a heartbeat echo request to the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) struct fcpio_echo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  * fcpio_lunmap_req: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  * scsi vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  * sends a request to retrieve the lunmap table for scsi vnics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) struct fcpio_lunmap_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	u64 addr;                     /* address of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	u32 len;                      /* len of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)  * fcpio_flogi_fip_reg: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)  * fc vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)  * used by the host to notify the firmware of the lif's s_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)  * and destination mac address format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) struct fcpio_flogi_fip_reg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	u8    _resvd0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	u8     s_id[3];               /* FC vNIC only: Source S_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	u8     fcf_mac[ETH_ALEN];     /* FCF Target destination mac */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	u16   _resvd1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	u32   r_a_tov;                /* R_A_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	u32   e_d_tov;                /* E_D_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	u8    ha_mac[ETH_ALEN];       /* Host adapter source mac */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	u16   _resvd2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)  * Basic structure for all fcpio structures that are sent from the host to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)  * firmware.  They are 128 bytes per structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) #define FCPIO_HOST_REQ_LEN      128     /* expected length of host requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) struct fcpio_host_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	struct fcpio_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 		 * Defines space needed for request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 		u8 buf[FCPIO_HOST_REQ_LEN - sizeof(struct fcpio_header)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 		 * Initiator host requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 		struct fcpio_icmnd_16               icmnd_16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 		struct fcpio_icmnd_32               icmnd_32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 		struct fcpio_itmf                   itmf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 		 * Target host requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 		struct fcpio_tdata                  tdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 		struct fcpio_txrdy                  txrdy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 		struct fcpio_trsp                   trsp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 		struct fcpio_ttmf_ack               ttmf_ack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 		struct fcpio_tabort                 tabort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 		 * Misc requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 		struct fcpio_reset                  reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 		struct fcpio_flogi_reg              flogi_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 		struct fcpio_echo                   echo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 		struct fcpio_lunmap_req             lunmap_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 		struct fcpio_flogi_fip_reg          flogi_fip_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	} u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)  * fcpio_icmnd_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)  * used for sending the host a response to an initiator command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) struct fcpio_icmnd_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	u8    _resvd0[6];             /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	u8    flags;                  /* response flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	u8    scsi_status;            /* SCSI status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	u32   residual;               /* SCSI data residual length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	u32   sense_len;              /* SCSI sense length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)  * response flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) #define FCPIO_ICMND_CMPL_RESID_UNDER    0x08    /* resid under and valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) #define FCPIO_ICMND_CMPL_RESID_OVER     0x04    /* resid over and valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)  * fcpio_itmf_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)  * used for sending the host a response for a itmf request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) struct fcpio_itmf_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	u32    _resvd;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)  * fcpio_tcmnd_16: firmware -> host request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)  * used by the firmware to notify the host of an incoming target SCSI 16-Byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)  * request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) struct fcpio_tcmnd_16 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	u8    lun[LUN_ADDRESS];       /* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	u8    crn;                    /* SCSI Command Reference No. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	u8    pri_ta;                 /* SCSI Priority and Task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	u8    _resvd2;                /* reserved: should be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	u8    flags;                  /* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	u8    scsi_cdb[CDB_16];       /* SCSI Cmnd Descriptor Block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	u32   data_len;               /* length of data expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	u8    _resvd1;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	u8    s_id[3];		      /* FC vNIC only: Source S_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)  * Priority/Task Attribute settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) #define FCPIO_TCMND_PTA_SIMPLE      0   /* simple task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) #define FCPIO_TCMND_PTA_HEADQ       1   /* head of queue task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) #define FCPIO_TCMND_PTA_ORDERED     2   /* ordered task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) #define FCPIO_TCMND_PTA_ACA         4   /* auto contingent allegiance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) #define FCPIO_TCMND_PRI_SHIFT       3   /* priority field starts in bit 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)  * Command flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) #define FCPIO_TCMND_RDDATA      0x02    /* read data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) #define FCPIO_TCMND_WRDATA      0x01    /* write data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)  * fcpio_tcmnd_32: firmware -> host request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)  * used by the firmware to notify the host of an incoming target SCSI 32-Byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)  * request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) struct fcpio_tcmnd_32 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	u8    lun[LUN_ADDRESS];       /* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	u8    crn;                    /* SCSI Command Reference No. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	u8    pri_ta;                 /* SCSI Priority and Task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	u8    _resvd2;                /* reserved: should be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	u8    flags;                  /* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	u8    scsi_cdb[CDB_32];       /* SCSI Cmnd Descriptor Block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	u32   data_len;               /* length of data expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	u8    _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	u8    s_id[3];		      /* FC vNIC only: Source S_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)  * fcpio_tdrsp_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)  * used by the firmware to notify the host of a response to a host target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)  * command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) struct fcpio_tdrsp_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	u16   rx_id;                  /* rx_id of the target request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	u16   _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588)  * fcpio_ttmf: firmware -> host request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)  * used by the firmware to notify the host of an incoming task management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)  * function request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) struct fcpio_ttmf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	u8    _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	u8    s_id[3];		      /* FC vNIC only: Source S_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	u8    lun[LUN_ADDRESS];       /* FC vNIC only: LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	u8    crn;                    /* SCSI Command Reference No. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	u8    _resvd2[3];             /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	u32   tmf_type;               /* task management request type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)  * Task Management request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) #define FCPIO_TTMF_CLR_ACA      0x40    /* Clear ACA condition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) #define FCPIO_TTMF_LUN_RESET    0x10    /* logical unit reset task mgmt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) #define FCPIO_TTMF_CLR_TASK_SET 0x04    /* clear task set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) #define FCPIO_TTMF_ABT_TASK_SET 0x02    /* abort task set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) #define FCPIO_TTMF_ABT_TASK     0x01    /* abort task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)  * fcpio_tabort_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)  * used by the firmware to respond to a host's tabort request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) struct fcpio_tabort_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	u16   rx_id;                  /* rx_id of the target request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	u16   _resvd0;                /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)  * fcpio_ack: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)  * used by firmware to notify the host of the last work request received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) struct fcpio_ack {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	u16  request_out;             /* last host entry received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	u16  _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)  * fcpio_reset_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)  * use by firmware to respond to the host's reset request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) struct fcpio_reset_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	u16   vnic_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)  * fcpio_flogi_reg_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)  * fc vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)  * response to the fcpio_flogi_reg request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) struct fcpio_flogi_reg_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)  * fcpio_echo_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)  * response to the fcpio_echo request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) struct fcpio_echo_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)  * fcpio_lunmap_chng: firmware -> host notification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)  * scsi vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663)  * notifies the host that the lunmap tables have changed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) struct fcpio_lunmap_chng {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670)  * fcpio_lunmap_req_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)  * scsi vnic only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)  * response for lunmap table request from the host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) struct fcpio_lunmap_req_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	u32 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)  * Basic structure for all fcpio structures that are sent from the firmware to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681)  * the host.  They are 64 bytes per structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) #define FCPIO_FW_REQ_LEN        64      /* expected length of fw requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) struct fcpio_fw_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 	struct fcpio_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) 		 * Defines space needed for request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) 		u8 buf[FCPIO_FW_REQ_LEN - sizeof(struct fcpio_header)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 		 * Initiator firmware responses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 		struct fcpio_icmnd_cmpl         icmnd_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 		struct fcpio_itmf_cmpl          itmf_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 		 * Target firmware new requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) 		struct fcpio_tcmnd_16           tcmnd_16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 		struct fcpio_tcmnd_32           tcmnd_32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) 		 * Target firmware responses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) 		struct fcpio_tdrsp_cmpl         tdrsp_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 		struct fcpio_ttmf               ttmf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) 		struct fcpio_tabort_cmpl        tabort_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 		 * Firmware response to work received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 		struct fcpio_ack                ack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 		 * Misc requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 		struct fcpio_reset_cmpl         reset_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 		struct fcpio_flogi_reg_cmpl     flogi_reg_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 		struct fcpio_echo_cmpl          echo_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 		struct fcpio_lunmap_chng        lunmap_chng;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 		struct fcpio_lunmap_req_cmpl    lunmap_req_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 	} u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729)  * Access routines to encode and decode the color bit, which is the most
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730)  * significant bit of the MSB of the structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) static inline void fcpio_color_enc(struct fcpio_fw_req *fw_req, u8 color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 	u8 *c = ((u8 *) fw_req) + sizeof(struct fcpio_fw_req) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 	if (color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 		*c |= 0x80;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 		*c &= ~0x80;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) static inline void fcpio_color_dec(struct fcpio_fw_req *fw_req, u8 *color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) 	u8 *c = ((u8 *) fw_req) + sizeof(struct fcpio_fw_req) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) 	*color = *c >> 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 	 * Make sure color bit is read from desc *before* other fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) 	 * are read from desc.  Hardware guarantees color bit is last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) 	 * bit (byte) written.  Adding the rmb() prevents the compiler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) 	 * and/or CPU from reordering the reads which would potentially
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) 	 * result in reading stale values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) 	rmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)  * Lunmap table entry for scsi vnics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) #define FCPIO_LUNMAP_TABLE_SIZE     256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) #define FCPIO_FLAGS_LUNMAP_VALID    0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) #define FCPIO_FLAGS_BOOT            0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) struct fcpio_lunmap_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) 	u8    bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 	u8    target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) 	u8    lun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 	u8    path_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) 	u16   flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) 	u16   update_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) struct fcpio_lunmap_tbl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) 	u32                   update_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) 	struct fcpio_lunmap_entry   lunmaps[FCPIO_LUNMAP_TABLE_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) #endif /* _FCPIO_H_ */