^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_FWINT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define __SNIC_FWINT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define SNIC_CDB_LEN 32 /* SCSI CDB size 32, can be used for 16 bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define LUN_ADDR_LEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Command entry type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) enum snic_io_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * Initiator request types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) SNIC_REQ_REPORT_TGTS = 0x2, /* Report Targets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) SNIC_REQ_ICMND, /* Initiator command for SCSI IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) SNIC_REQ_ITMF, /* Initiator command for Task Mgmt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) SNIC_REQ_HBA_RESET, /* SNIC Reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) SNIC_REQ_EXCH_VER, /* Exchange Version Information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) SNIC_REQ_TGT_INFO, /* Backend/Target Information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) SNIC_REQ_BOOT_LUNS,
^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) * Response type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) SNIC_RSP_REPORT_TGTS_CMPL = 0x12,/* Report Targets Completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) SNIC_RSP_ICMND_CMPL, /* SCSI IO Completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) SNIC_RSP_ITMF_CMPL, /* Task Management Completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) SNIC_RSP_HBA_RESET_CMPL, /* SNIC Reset Completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) SNIC_RSP_EXCH_VER_CMPL, /* Exchange Version Completion*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) SNIC_RSP_BOOT_LUNS_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) * Misc Request types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) SNIC_MSG_ACK = 0x80, /* Ack: snic_notify_msg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) SNIC_MSG_ASYNC_EVNOTIFY, /* Asynchronous Event Notification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }; /* end of enum snic_io_type */
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * Header status codes from firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) enum snic_io_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) SNIC_STAT_IO_SUCCESS = 0, /* request was successful */
^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) * If a request to the fw is rejected, the original request header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * will be returned with the status set to one of the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) SNIC_STAT_INVALID_HDR, /* header contains invalid data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) SNIC_STAT_OUT_OF_RES, /* out of resources to complete request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) SNIC_STAT_INVALID_PARM, /* some parameter in request is not valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) SNIC_STAT_REQ_NOT_SUP, /* req type is not supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) SNIC_STAT_IO_NOT_FOUND, /* requested IO was not found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * Once a request is processed, the fw will usually return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * a cmpl message type. In cases where errors occurred,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * the header status would be filled in with one of the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) SNIC_STAT_ABORTED, /* req was aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) SNIC_STAT_TIMEOUT, /* req was timed out */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) SNIC_STAT_SGL_INVALID, /* req was aborted due to sgl error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) SNIC_STAT_DATA_CNT_MISMATCH, /*recv/sent more/less data than expec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) SNIC_STAT_FW_ERR, /* req was terminated due to fw error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) SNIC_STAT_ITMF_REJECT, /* itmf req was rejected by target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) SNIC_STAT_ITMF_FAIL, /* itmf req was failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) SNIC_STAT_ITMF_INCORRECT_LUN, /* itmf req has incorrect LUN id*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) SNIC_STAT_CMND_REJECT, /* req was invalid and rejected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) SNIC_STAT_DEV_OFFLINE, /* req sent to offline device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) SNIC_STAT_NO_BOOTLUN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) SNIC_STAT_SCSI_ERR, /* SCSI error returned by Target. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) SNIC_STAT_NOT_READY, /* sNIC Subsystem is not ready */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) SNIC_STAT_FATAL_ERROR, /* sNIC is in unrecoverable state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }; /* end of enum snic_io_status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * snic_io_hdr : host <--> firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * for any other message that will be queued to firmware should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * have the following request header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct snic_io_hdr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) __le32 hid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __le32 cmnd_id; /* tag here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) ulong init_ctx; /* initiator context */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) u8 type; /* request/response type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u8 status; /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) u8 protocol; /* Protocol specific, may needed for RoCE*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __le16 sg_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) u16 resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* auxillary funciton for encoding the snic_io_hdr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) snic_io_hdr_enc(struct snic_io_hdr *hdr, u8 typ, u8 status, u32 id, u32 hid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) u16 sg_cnt, ulong ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) hdr->type = typ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) hdr->status = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) hdr->protocol = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) hdr->hid = cpu_to_le32(hid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) hdr->cmnd_id = cpu_to_le32(id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) hdr->sg_cnt = cpu_to_le16(sg_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) hdr->init_ctx = ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) hdr->flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /* auxillary funciton for decoding the snic_io_hdr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) snic_io_hdr_dec(struct snic_io_hdr *hdr, u8 *typ, u8 *stat, u32 *cmnd_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) u32 *hid, ulong *ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) *typ = hdr->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) *stat = hdr->status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) *hid = le32_to_cpu(hdr->hid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) *cmnd_id = le32_to_cpu(hdr->cmnd_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) *ctx = hdr->init_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * snic_host_info: host -> firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * Used for sending host information to firmware, and request fw version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct snic_exch_ver_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) __le32 drvr_ver; /* for debugging, when fw dump captured */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __le32 os_type; /* for OS specific features */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * os_type flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * Bit 0-7 : OS information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * Bit 8-31: Feature/Capability Information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #define SNIC_OS_LINUX 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define SNIC_OS_WIN 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define SNIC_OS_ESX 0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * HBA Capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * Bit 1: Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * Bit 2: Dynamic Discovery of LUNs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * Bit 3: Async event notifications on on tgt online/offline events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * Bit 4: IO timeout support in FW.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * Bit 5-31: Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define SNIC_HBA_CAP_DDL 0x02 /* Supports Dynamic Discovery of LUNs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #define SNIC_HBA_CAP_AEN 0x04 /* Supports Async Event Noitifcation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define SNIC_HBA_CAP_TMO 0x08 /* Supports IO timeout in FW */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * snic_exch_ver_rsp : firmware -> host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * Used by firmware to send response to version request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) struct snic_exch_ver_rsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) __le32 version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) __le32 hid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) __le32 max_concur_ios; /* max concurrent ios */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) __le32 max_sgs_per_cmd; /* max sgls per IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) __le32 max_io_sz; /* max io size supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __le32 hba_cap; /* hba capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) __le32 max_tgts; /* max tgts supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) __le16 io_timeout; /* FW extended timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) u16 rsvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * snic_report_tgts : host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * Used by the host to request list of targets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct snic_report_tgts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __le16 sg_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) __le16 flags; /* specific flags from fw */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) u8 _resvd[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) __le64 sg_addr; /* Points to SGL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) __le64 sense_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) enum snic_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) SNIC_NONE = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) SNIC_DAS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) SNIC_SAN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /* Report Target Response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) enum snic_tgt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) SNIC_TGT_NONE = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) SNIC_TGT_DAS, /* DAS Target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) SNIC_TGT_SAN, /* SAN Target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) /* target id format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) struct snic_tgt_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) __le32 tgt_id; /* target id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) __le16 tgt_type; /* tgt type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) __le16 vnic_id; /* corresponding vnic id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) * snic_report_tgts_cmpl : firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) * Used by firmware to send response to Report Targets request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct snic_report_tgts_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) __le32 tgt_cnt; /* Number of Targets accessible */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) u32 _resvd;
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * Command flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * Bit 0: Read flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * Bit 1: Write flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * Bit 2: ESGL - sg/esg array contains extended sg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * ESGE - is a host buffer contains sg elements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * Bit 3-4: Task Attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * 00b - simple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) * 01b - head of queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) * 10b - ordered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) * Bit 5-7: Priority - future use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) * Bit 8-15: Reserved
^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) #define SNIC_ICMND_WR 0x01 /* write command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #define SNIC_ICMND_RD 0x02 /* read command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #define SNIC_ICMND_ESGL 0x04 /* SGE/ESGE array contains valid data*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * Priority/Task Attribute settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define SNIC_ICMND_TSK_SHIFT 2 /* task attr starts at bit 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) #define SNIC_ICMND_TSK_MASK(x) ((x>>SNIC_ICMND_TSK_SHIFT) & ~(0xffff))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define SNIC_ICMND_TSK_SIMPLE 0 /* simple task attr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define SNIC_ICMND_TSK_HEAD_OF_QUEUE 1 /* head of qeuue task attr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #define SNIC_ICMND_TSK_ORDERED 2 /* ordered task attr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #define SNIC_ICMND_PRI_SHIFT 5 /* prio val starts at bit 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * snic_icmnd : host-> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * used for sending out an initiator SCSI 16/32-byte command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) struct snic_icmnd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) __le16 sg_cnt; /* Number of SG Elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) __le16 flags; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __le32 sense_len; /* Sense buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __le64 tgt_id; /* Destination Target ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __le64 lun_id; /* Destination LUN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) u8 cdb_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) u8 _resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) __le16 time_out; /* ms time for Res allocations fw to handle io*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) __le32 data_len; /* Total number of bytes to be transferred */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) u8 cdb[SNIC_CDB_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) __le64 sg_addr; /* Points to SG List */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) __le64 sense_addr; /* Sense buffer address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) /* Response flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /* Bit 0: Under run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * Bit 1: Over Run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * Bit 2-7: Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) #define SNIC_ICMND_CMPL_UNDR_RUN 0x01 /* resid under and valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define SNIC_ICMND_CMPL_OVER_RUN 0x02 /* resid over and valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * snic_icmnd_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * Used for sending the host a response to an icmnd (initiator command)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct snic_icmnd_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) u8 scsi_status; /* value as per SAM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) __le16 sense_len; /* Sense Length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) __le32 resid; /* Residue : # bytes under or over run */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) * snic_itmf: host->firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) * used for requesting the firmware to abort a request and/or send out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * a task management function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * the req_id field is valid in case of abort task and clear task
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) struct snic_itmf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) u8 tm_type; /* SCSI Task Management request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) u8 resvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) __le16 flags; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) __le32 req_id; /* Command id of snic req to be aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) __le64 tgt_id; /* Target ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) __le64 lun_id; /* Destination LUN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) __le16 timeout; /* in sec */
^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) * Task Management Request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) enum snic_itmf_tm_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) SNIC_ITMF_ABTS_TASK = 0x01, /* Abort Task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) SNIC_ITMF_ABTS_TASK_SET, /* Abort Task Set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) SNIC_ITMF_CLR_TASK, /* Clear Task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) SNIC_ITMF_CLR_TASKSET, /* Clear Task Set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) SNIC_ITMF_LUN_RESET, /* Lun Reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) SNIC_ITMF_ABTS_TASK_TERM, /* Supported for SAN Targets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) * snic_itmf_cmpl: firmware -> host resposne
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * used for sending the host a response for a itmf request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct snic_itmf_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) __le32 nterminated; /* # IOs terminated as a result of tmf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) u8 flags; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) u8 _resvd[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * itmfl_cmpl flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * Bit 0 : 1 - Num terminated field valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * Bit 1 - 7 : Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) #define SNIC_NUM_TERM_VALID 0x01 /* Number of IOs terminated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * snic_hba_reset: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) * used for requesting firmware to reset snic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) struct snic_hba_reset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) __le16 flags; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) u8 _resvd[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) * snic_hba_reset_cmpl: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) * Used by firmware to respond to the host's hba reset request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) struct snic_hba_reset_cmpl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) u8 flags; /* flags : more info needs to be added*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) u8 _resvd[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * snic_notify_msg: firmware -> host response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) * Used by firmware to notify host of the last work queue entry received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) struct snic_notify_msg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) __le32 wqe_num; /* wq entry number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) u8 flags; /* flags, macros */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) u8 _resvd[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) #define SNIC_EVDATA_LEN 24 /* in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /* snic_async_evnotify: firmware -> host notification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) * Used by firmware to notify the host about configuration/state changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) struct snic_async_evnotify {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) u8 FLS_EVENT_DESC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) u8 vnic; /* vnic id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) u8 _resvd[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) __le32 ev_id; /* Event ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) u8 ev_data[SNIC_EVDATA_LEN]; /* Event Data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) u8 _resvd2[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) /* async event flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) enum snic_ev_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) SNIC_EV_TGT_OFFLINE = 0x01, /* Target Offline, PL contains TGT ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) SNIC_EV_TGT_ONLINE, /* Target Online, PL contains TGT ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) SNIC_EV_LUN_OFFLINE, /* LUN Offline, PL contains LUN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) SNIC_EV_LUN_ONLINE, /* LUN Online, PL contains LUN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) SNIC_EV_CONF_CHG, /* Dev Config/Attr Change Event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) SNIC_EV_TGT_ADDED, /* Target Added */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) SNIC_EV_TGT_DELTD, /* Target Del'd, PL contains TGT ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) SNIC_EV_LUN_ADDED, /* LUN Added */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) SNIC_EV_LUN_DELTD, /* LUN Del'd, PL cont. TGT & LUN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) SNIC_EV_DISC_CMPL = 0x10, /* Discovery Completed Event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) #define SNIC_HOST_REQ_LEN 128 /*Exp length of host req, wq desc sz*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) /* Payload 88 bytes = 128 - 24 - 16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) #define SNIC_HOST_REQ_PAYLOAD ((int)(SNIC_HOST_REQ_LEN - \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) sizeof(struct snic_io_hdr) - \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) (2 * sizeof(u64)) - sizeof(ulong)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * snic_host_req: host -> firmware request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * Basic structure for all snic requests that are sent from the host to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) * firmware. They are 128 bytes in size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) struct snic_host_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) u64 ctrl_data[2]; /*16 bytes - Control Data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) struct snic_io_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * Entry specific space, last byte contains color
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) u8 buf[SNIC_HOST_REQ_PAYLOAD];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * Exchange firmware version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) struct snic_exch_ver_req exch_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) /* report targets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct snic_report_tgts rpt_tgts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /* io request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) struct snic_icmnd icmnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) /* task management request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) struct snic_itmf itmf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) /* hba reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) struct snic_hba_reset reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) ulong req_pa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }; /* end of snic_host_req structure */
^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) #define SNIC_FW_REQ_LEN 64 /* Expected length of fw req */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) struct snic_fw_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) struct snic_io_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) * Entry specific space, last byte contains color
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) u8 buf[SNIC_FW_REQ_LEN - sizeof(struct snic_io_hdr)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /* Exchange Version Response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) struct snic_exch_ver_rsp exch_ver_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) /* Report Targets Response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) struct snic_report_tgts_cmpl rpt_tgts_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) /* scsi response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) struct snic_icmnd_cmpl icmnd_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) /* task management response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) struct snic_itmf_cmpl itmf_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) /* hba reset response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) struct snic_hba_reset_cmpl reset_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /* notify message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) struct snic_notify_msg ack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /* async notification event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) struct snic_async_evnotify async_ev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) }; /* end of snic_fw_req structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * Auxillary macro to verify specific snic req/cmpl structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * to ensure that it will be aligned to 64 bit, and not using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * color bit field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) #define VERIFY_REQ_SZ(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) #define VERIFY_CMPL_SZ(x)
^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) * Access routines to encode and decode the color bit, which is the most
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) * significant bit of the structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) snic_color_enc(struct snic_fw_req *req, u8 color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) u8 *c = ((u8 *) req) + sizeof(struct snic_fw_req) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) if (color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) *c |= 0x80;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) *c &= ~0x80;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) snic_color_dec(struct snic_fw_req *req, u8 *color)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) u8 *c = ((u8 *) req) + sizeof(struct snic_fw_req) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) *color = *c >> 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) /* Make sure color bit is read from desc *before* other fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) * are read from desc. Hardware guarantees color bit is last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) * bit (byte) written. Adding the rmb() prevents the compiler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) * and/or CPU from reordering the reads which would potentially
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) * result in reading stale values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) rmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) #endif /* end of __SNIC_FWINT_H */