/* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright 2014 Cisco Systems, Inc. All rights reserved. */ #ifndef __SNIC_FWINT_H #define __SNIC_FWINT_H #define SNIC_CDB_LEN … #define LUN_ADDR_LEN … /* * Command entry type */ enum snic_io_type { … }; /* end of enum snic_io_type */ /* * Header status codes from firmware */ enum snic_io_status { … }; /* end of enum snic_io_status */ /* * snic_io_hdr : host <--> firmware * * for any other message that will be queued to firmware should * have the following request header */ struct snic_io_hdr { … }; /* auxillary funciton for encoding the snic_io_hdr */ static inline void snic_io_hdr_enc(struct snic_io_hdr *hdr, u8 typ, u8 status, u32 id, u32 hid, u16 sg_cnt, ulong ctx) { … } /* auxillary funciton for decoding the snic_io_hdr */ static inline void snic_io_hdr_dec(struct snic_io_hdr *hdr, u8 *typ, u8 *stat, u32 *cmnd_id, u32 *hid, ulong *ctx) { … } /* * snic_host_info: host -> firmware * * Used for sending host information to firmware, and request fw version */ struct snic_exch_ver_req { … }; /* * os_type flags * Bit 0-7 : OS information * Bit 8-31: Feature/Capability Information */ #define SNIC_OS_LINUX … #define SNIC_OS_WIN … #define SNIC_OS_ESX … /* * HBA Capabilities * Bit 1: Reserved. * Bit 2: Dynamic Discovery of LUNs. * Bit 3: Async event notifications on tgt online/offline events. * Bit 4: IO timeout support in FW. * Bit 5-31: Reserved. */ #define SNIC_HBA_CAP_DDL … #define SNIC_HBA_CAP_AEN … #define SNIC_HBA_CAP_TMO … /* * snic_exch_ver_rsp : firmware -> host * * Used by firmware to send response to version request */ struct snic_exch_ver_rsp { … }; /* * snic_report_tgts : host -> firmware request * * Used by the host to request list of targets */ struct snic_report_tgts { … }; enum snic_type { … }; /* Report Target Response */ enum snic_tgt_type { … }; /* target id format */ struct snic_tgt_id { … }; /* * snic_report_tgts_cmpl : firmware -> host response * * Used by firmware to send response to Report Targets request */ struct snic_report_tgts_cmpl { … }; /* * Command flags * * Bit 0: Read flags * Bit 1: Write flag * Bit 2: ESGL - sg/esg array contains extended sg * ESGE - is a host buffer contains sg elements * Bit 3-4: Task Attributes * 00b - simple * 01b - head of queue * 10b - ordered * Bit 5-7: Priority - future use * Bit 8-15: Reserved */ #define SNIC_ICMND_WR … #define SNIC_ICMND_RD … #define SNIC_ICMND_ESGL … /* * Priority/Task Attribute settings */ #define SNIC_ICMND_TSK_SHIFT … #define SNIC_ICMND_TSK_MASK(x) … #define SNIC_ICMND_TSK_SIMPLE … #define SNIC_ICMND_TSK_HEAD_OF_QUEUE … #define SNIC_ICMND_TSK_ORDERED … #define SNIC_ICMND_PRI_SHIFT … /* * snic_icmnd : host-> firmware request * * used for sending out an initiator SCSI 16/32-byte command */ struct snic_icmnd { … }; /* Response flags */ /* Bit 0: Under run * Bit 1: Over Run * Bit 2-7: Reserved */ #define SNIC_ICMND_CMPL_UNDR_RUN … #define SNIC_ICMND_CMPL_OVER_RUN … /* * snic_icmnd_cmpl: firmware -> host response * * Used for sending the host a response to an icmnd (initiator command) */ struct snic_icmnd_cmpl { … }; /* * snic_itmf: host->firmware request * * used for requesting the firmware to abort a request and/or send out * a task management function * * the req_id field is valid in case of abort task and clear task */ struct snic_itmf { … }; /* * Task Management Request */ enum snic_itmf_tm_type { … }; /* * snic_itmf_cmpl: firmware -> host resposne * * used for sending the host a response for a itmf request */ struct snic_itmf_cmpl { … }; /* * itmfl_cmpl flags * Bit 0 : 1 - Num terminated field valid * Bit 1 - 7 : Reserved */ #define SNIC_NUM_TERM_VALID … /* * snic_hba_reset: host -> firmware request * * used for requesting firmware to reset snic */ struct snic_hba_reset { … }; /* * snic_hba_reset_cmpl: firmware -> host response * * Used by firmware to respond to the host's hba reset request */ struct snic_hba_reset_cmpl { … }; /* * snic_notify_msg: firmware -> host response * * Used by firmware to notify host of the last work queue entry received */ struct snic_notify_msg { … }; #define SNIC_EVDATA_LEN … /* snic_async_evnotify: firmware -> host notification * * Used by firmware to notify the host about configuration/state changes */ struct snic_async_evnotify { … }; /* async event flags */ enum snic_ev_type { … }; #define SNIC_HOST_REQ_LEN … /* Payload 88 bytes = 128 - 24 - 16 */ #define SNIC_HOST_REQ_PAYLOAD … /* * snic_host_req: host -> firmware request * * Basic structure for all snic requests that are sent from the host to * firmware. They are 128 bytes in size. */ struct snic_host_req { … }; /* end of snic_host_req structure */ #define SNIC_FW_REQ_LEN … struct snic_fw_req { … }; /* end of snic_fw_req structure */ /* * Auxillary macro to verify specific snic req/cmpl structures * to ensure that it will be aligned to 64 bit, and not using * color bit field */ #define VERIFY_REQ_SZ(x) … #define VERIFY_CMPL_SZ(x) … /* * Access routines to encode and decode the color bit, which is the most * significant bit of the structure. */ static inline void snic_color_enc(struct snic_fw_req *req, u8 color) { … } static inline void snic_color_dec(struct snic_fw_req *req, u8 *color) { … } #endif /* end of __SNIC_FWINT_H */