/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright 2008 Cisco Systems, Inc. All rights reserved. * Copyright 2007 Nuova Systems, Inc. All rights reserved. */ #ifndef _FCPIO_H_ #define _FCPIO_H_ #include <linux/if_ether.h> /* * This header file includes all of the data structures used for * communication by the host driver to the fcp firmware. */ /* * Exchange and sequence id space allocated to the host driver */ #define FCPIO_HOST_EXCH_RANGE_START … #define FCPIO_HOST_EXCH_RANGE_END … #define FCPIO_HOST_SEQ_ID_RANGE_START … #define FCPIO_HOST_SEQ_ID_RANGE_END … /* * Command entry type */ enum fcpio_type { … }; /* * Header status codes from the firmware */ enum fcpio_status { … }; /* * The header command tag. All host requests will use the "tag" field * to mark commands with a unique tag. When the firmware responds to * a host request, it will copy the tag field into the response. * * The only firmware requests that will use the rx_id/ox_id fields instead * of the tag field will be the target command and target task management * requests. These two requests do not have corresponding host requests * since they come directly from the FC initiator on the network. */ struct fcpio_tag { … }; static inline void fcpio_tag_id_enc(struct fcpio_tag *tag, u32 id) { … } static inline void fcpio_tag_id_dec(struct fcpio_tag *tag, u32 *id) { … } static inline void fcpio_tag_exid_enc(struct fcpio_tag *tag, u16 ox_id, u16 rx_id) { … } static inline void fcpio_tag_exid_dec(struct fcpio_tag *tag, u16 *ox_id, u16 *rx_id) { … } /* * The header for an fcpio request, whether from the firmware or from the * host driver */ struct fcpio_header { … }; static inline void fcpio_header_enc(struct fcpio_header *hdr, u8 type, u8 status, struct fcpio_tag tag) { … } static inline void fcpio_header_dec(struct fcpio_header *hdr, u8 *type, u8 *status, struct fcpio_tag *tag) { … } #define CDB_16 … #define CDB_32 … #define LUN_ADDRESS … /* * fcpio_icmnd_16: host -> firmware request * * used for sending out an initiator SCSI 16-byte command */ struct fcpio_icmnd_16 { … }; /* * Special request flags */ #define FCPIO_ICMND_SRFLAG_RETRY … /* * Priority/Task Attribute settings */ #define FCPIO_ICMND_PTA_SIMPLE … #define FCPIO_ICMND_PTA_HEADQ … #define FCPIO_ICMND_PTA_ORDERED … #define FCPIO_ICMND_PTA_ACA … #define FCPIO_ICMND_PRI_SHIFT … /* * Command flags */ #define FCPIO_ICMND_RDDATA … #define FCPIO_ICMND_WRDATA … /* * fcpio_icmnd_32: host -> firmware request * * used for sending out an initiator SCSI 32-byte command */ struct fcpio_icmnd_32 { … }; /* * fcpio_itmf: host -> firmware request * * used for requesting the firmware to abort a request and/or send out * a task management function * * The t_tag field is only needed when the request type is ABT_TASK. */ struct fcpio_itmf { … }; /* * Task Management request */ enum fcpio_itmf_tm_req_type { … }; /* * fcpio_tdata: host -> firmware request * * used for requesting the firmware to send out a read data transfer for a * target command */ struct fcpio_tdata { … }; /* * Command flags */ #define FCPIO_TDATA_SCSI_RSP … /* * fcpio_txrdy: host -> firmware request * * used for requesting the firmware to send out a write data transfer for a * target command */ struct fcpio_txrdy { … }; /* * fcpio_trsp: host -> firmware request * * used for requesting the firmware to send out a response for a target * command */ struct fcpio_trsp { … }; /* * resposnse request flags */ #define FCPIO_TRSP_RESID_UNDER … #define FCPIO_TRSP_RESID_OVER … /* * fcpio_ttmf_ack: host -> firmware response * * used by the host to indicate to the firmware it has received and processed * the target tmf request */ struct fcpio_ttmf_ack { … }; /* * fcpio_tabort: host -> firmware request * * used by the host to request the firmware to abort a target request that was * received by the firmware */ struct fcpio_tabort { … }; /* * fcpio_reset: host -> firmware request * * used by the host to signal a reset of the driver to the firmware * and to request firmware to clean up all outstanding I/O */ struct fcpio_reset { … }; enum fcpio_flogi_reg_format_type { … }; /* * fcpio_flogi_reg: host -> firmware request * * fc vnic only * used by the host to notify the firmware of the lif's s_id * and destination mac address format */ struct fcpio_flogi_reg { … }; /* * fcpio_echo: host -> firmware request * * sends a heartbeat echo request to the firmware */ struct fcpio_echo { … }; /* * fcpio_lunmap_req: host -> firmware request * * scsi vnic only * sends a request to retrieve the lunmap table for scsi vnics */ struct fcpio_lunmap_req { … }; /* * fcpio_flogi_fip_reg: host -> firmware request * * fc vnic only * used by the host to notify the firmware of the lif's s_id * and destination mac address format */ struct fcpio_flogi_fip_reg { … }; /* * Basic structure for all fcpio structures that are sent from the host to the * firmware. They are 128 bytes per structure. */ #define FCPIO_HOST_REQ_LEN … struct fcpio_host_req { … }; /* * fcpio_icmnd_cmpl: firmware -> host response * * used for sending the host a response to an initiator command */ struct fcpio_icmnd_cmpl { … }; /* * response flags */ #define FCPIO_ICMND_CMPL_RESID_UNDER … #define FCPIO_ICMND_CMPL_RESID_OVER … /* * fcpio_itmf_cmpl: firmware -> host response * * used for sending the host a response for a itmf request */ struct fcpio_itmf_cmpl { … }; /* * fcpio_tcmnd_16: firmware -> host request * * used by the firmware to notify the host of an incoming target SCSI 16-Byte * request */ struct fcpio_tcmnd_16 { … }; /* * Priority/Task Attribute settings */ #define FCPIO_TCMND_PTA_SIMPLE … #define FCPIO_TCMND_PTA_HEADQ … #define FCPIO_TCMND_PTA_ORDERED … #define FCPIO_TCMND_PTA_ACA … #define FCPIO_TCMND_PRI_SHIFT … /* * Command flags */ #define FCPIO_TCMND_RDDATA … #define FCPIO_TCMND_WRDATA … /* * fcpio_tcmnd_32: firmware -> host request * * used by the firmware to notify the host of an incoming target SCSI 32-Byte * request */ struct fcpio_tcmnd_32 { … }; /* * fcpio_tdrsp_cmpl: firmware -> host response * * used by the firmware to notify the host of a response to a host target * command */ struct fcpio_tdrsp_cmpl { … }; /* * fcpio_ttmf: firmware -> host request * * used by the firmware to notify the host of an incoming task management * function request */ struct fcpio_ttmf { … }; /* * Task Management request */ #define FCPIO_TTMF_CLR_ACA … #define FCPIO_TTMF_LUN_RESET … #define FCPIO_TTMF_CLR_TASK_SET … #define FCPIO_TTMF_ABT_TASK_SET … #define FCPIO_TTMF_ABT_TASK … /* * fcpio_tabort_cmpl: firmware -> host response * * used by the firmware to respond to a host's tabort request */ struct fcpio_tabort_cmpl { … }; /* * fcpio_ack: firmware -> host response * * used by firmware to notify the host of the last work request received */ struct fcpio_ack { … }; /* * fcpio_reset_cmpl: firmware -> host response * * use by firmware to respond to the host's reset request */ struct fcpio_reset_cmpl { … }; /* * fcpio_flogi_reg_cmpl: firmware -> host response * * fc vnic only * response to the fcpio_flogi_reg request */ struct fcpio_flogi_reg_cmpl { … }; /* * fcpio_echo_cmpl: firmware -> host response * * response to the fcpio_echo request */ struct fcpio_echo_cmpl { … }; /* * fcpio_lunmap_chng: firmware -> host notification * * scsi vnic only * notifies the host that the lunmap tables have changed */ struct fcpio_lunmap_chng { … }; /* * fcpio_lunmap_req_cmpl: firmware -> host response * * scsi vnic only * response for lunmap table request from the host */ struct fcpio_lunmap_req_cmpl { … }; /* * Basic structure for all fcpio structures that are sent from the firmware to * the host. They are 64 bytes per structure. */ #define FCPIO_FW_REQ_LEN … struct fcpio_fw_req { … }; /* * Access routines to encode and decode the color bit, which is the most * significant bit of the MSB of the structure */ static inline void fcpio_color_enc(struct fcpio_fw_req *fw_req, u8 color) { … } static inline void fcpio_color_dec(struct fcpio_fw_req *fw_req, u8 *color) { … } /* * Lunmap table entry for scsi vnics */ #define FCPIO_LUNMAP_TABLE_SIZE … #define FCPIO_FLAGS_LUNMAP_VALID … #define FCPIO_FLAGS_BOOT … struct fcpio_lunmap_entry { … }; struct fcpio_lunmap_tbl { … }; #endif /* _FCPIO_H_ */