xref: /openbmc/linux/drivers/s390/scsi/zfcp_fsf.h (revision faf4cd85)
11da177e4SLinus Torvalds /*
2553448f6SChristof Schmitt  * zfcp device driver
31da177e4SLinus Torvalds  *
4553448f6SChristof Schmitt  * Interface to the FSF support functions.
51da177e4SLinus Torvalds  *
61674b405SChristof Schmitt  * Copyright IBM Corporation 2002, 2010
71da177e4SLinus Torvalds  */
81da177e4SLinus Torvalds 
91da177e4SLinus Torvalds #ifndef FSF_H
101da177e4SLinus Torvalds #define FSF_H
111da177e4SLinus Torvalds 
1245633fdcSChristof Schmitt #include <linux/pfn.h>
13d46f384aSChristof Schmitt #include <linux/scatterlist.h>
14800c0cadSChristof Schmitt #include <scsi/libfc.h>
1545633fdcSChristof Schmitt 
1606506d00SAndreas Herrmann #define FSF_QTCB_CURRENT_VERSION		0x00000001
171da177e4SLinus Torvalds 
181da177e4SLinus Torvalds /* FSF commands */
191da177e4SLinus Torvalds #define	FSF_QTCB_FCP_CMND			0x00000001
201da177e4SLinus Torvalds #define	FSF_QTCB_ABORT_FCP_CMND			0x00000002
211da177e4SLinus Torvalds #define	FSF_QTCB_OPEN_PORT_WITH_DID		0x00000005
221da177e4SLinus Torvalds #define	FSF_QTCB_OPEN_LUN			0x00000006
231da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_LUN			0x00000007
241da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_PORT			0x00000008
251da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_PHYSICAL_PORT		0x00000009
261da177e4SLinus Torvalds #define	FSF_QTCB_SEND_ELS			0x0000000B
271da177e4SLinus Torvalds #define	FSF_QTCB_SEND_GENERIC			0x0000000C
281da177e4SLinus Torvalds #define	FSF_QTCB_EXCHANGE_CONFIG_DATA		0x0000000D
291da177e4SLinus Torvalds #define	FSF_QTCB_EXCHANGE_PORT_DATA		0x0000000E
301da177e4SLinus Torvalds #define FSF_QTCB_DOWNLOAD_CONTROL_FILE		0x00000012
311da177e4SLinus Torvalds #define FSF_QTCB_UPLOAD_CONTROL_FILE		0x00000013
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds /* FSF QTCB types */
341da177e4SLinus Torvalds #define FSF_IO_COMMAND				0x00000001
351da177e4SLinus Torvalds #define FSF_SUPPORT_COMMAND			0x00000002
361da177e4SLinus Torvalds #define FSF_CONFIG_COMMAND			0x00000003
371da177e4SLinus Torvalds #define FSF_PORT_COMMAND			0x00000004
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds /* FSF control file upload/download operations' subtype and options */
401da177e4SLinus Torvalds #define FSF_CFDC_OPERATION_SUBTYPE		0x00020001
411da177e4SLinus Torvalds #define FSF_CFDC_OPTION_NORMAL_MODE		0x00000000
421da177e4SLinus Torvalds #define FSF_CFDC_OPTION_FORCE			0x00000001
431da177e4SLinus Torvalds #define FSF_CFDC_OPTION_FULL_ACCESS		0x00000002
441da177e4SLinus Torvalds #define FSF_CFDC_OPTION_RESTRICTED_ACCESS	0x00000004
451da177e4SLinus Torvalds 
4606506d00SAndreas Herrmann /* FSF protocol states */
471da177e4SLinus Torvalds #define FSF_PROT_GOOD				0x00000001
481da177e4SLinus Torvalds #define FSF_PROT_QTCB_VERSION_ERROR		0x00000010
491da177e4SLinus Torvalds #define FSF_PROT_SEQ_NUMB_ERROR			0x00000020
501da177e4SLinus Torvalds #define FSF_PROT_UNSUPP_QTCB_TYPE		0x00000040
511da177e4SLinus Torvalds #define FSF_PROT_HOST_CONNECTION_INITIALIZING	0x00000080
521da177e4SLinus Torvalds #define FSF_PROT_FSF_STATUS_PRESENTED		0x00000100
531da177e4SLinus Torvalds #define FSF_PROT_DUPLICATE_REQUEST_ID		0x00000200
541da177e4SLinus Torvalds #define FSF_PROT_LINK_DOWN                      0x00000400
551da177e4SLinus Torvalds #define FSF_PROT_REEST_QUEUE                    0x00000800
561da177e4SLinus Torvalds #define FSF_PROT_ERROR_STATE			0x01000000
571da177e4SLinus Torvalds 
5806506d00SAndreas Herrmann /* FSF states */
591da177e4SLinus Torvalds #define FSF_GOOD				0x00000000
601da177e4SLinus Torvalds #define FSF_PORT_ALREADY_OPEN			0x00000001
611da177e4SLinus Torvalds #define FSF_LUN_ALREADY_OPEN			0x00000002
621da177e4SLinus Torvalds #define FSF_PORT_HANDLE_NOT_VALID		0x00000003
631da177e4SLinus Torvalds #define FSF_LUN_HANDLE_NOT_VALID		0x00000004
641da177e4SLinus Torvalds #define FSF_HANDLE_MISMATCH			0x00000005
651da177e4SLinus Torvalds #define FSF_SERVICE_CLASS_NOT_SUPPORTED		0x00000006
661da177e4SLinus Torvalds #define FSF_FCPLUN_NOT_VALID			0x00000009
671da177e4SLinus Torvalds #define FSF_ACCESS_DENIED			0x00000010
681da177e4SLinus Torvalds #define FSF_LUN_SHARING_VIOLATION               0x00000012
691da177e4SLinus Torvalds #define FSF_FCP_COMMAND_DOES_NOT_EXIST		0x00000022
701da177e4SLinus Torvalds #define FSF_DIRECTION_INDICATOR_NOT_VALID	0x00000030
711da177e4SLinus Torvalds #define FSF_CMND_LENGTH_NOT_VALID		0x00000033
721da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED	0x00000040
731da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED	0x00000041
741da177e4SLinus Torvalds #define FSF_ELS_COMMAND_REJECTED		0x00000050
751da177e4SLinus Torvalds #define FSF_GENERIC_COMMAND_REJECTED		0x00000051
761da177e4SLinus Torvalds #define FSF_PORT_BOXED				0x00000059
771da177e4SLinus Torvalds #define FSF_LUN_BOXED				0x0000005A
781da177e4SLinus Torvalds #define FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE	0x0000005B
791da177e4SLinus Torvalds #define FSF_PAYLOAD_SIZE_MISMATCH		0x00000060
801da177e4SLinus Torvalds #define FSF_REQUEST_SIZE_TOO_LARGE		0x00000061
811da177e4SLinus Torvalds #define FSF_RESPONSE_SIZE_TOO_LARGE		0x00000062
821da177e4SLinus Torvalds #define FSF_SBAL_MISMATCH			0x00000063
831da177e4SLinus Torvalds #define FSF_ADAPTER_STATUS_AVAILABLE		0x000000AD
841da177e4SLinus Torvalds #define FSF_UNKNOWN_COMMAND			0x000000E2
851da177e4SLinus Torvalds #define FSF_UNKNOWN_OP_SUBTYPE                  0x000000E3
861da177e4SLinus Torvalds #define FSF_INVALID_COMMAND_OPTION              0x000000E5
871da177e4SLinus Torvalds /* #define FSF_ERROR                             0x000000FF  */
881da177e4SLinus Torvalds 
898a36e453SMaxim Shchetynin #define FSF_PROT_STATUS_QUAL_SIZE		16
901da177e4SLinus Torvalds #define FSF_STATUS_QUALIFIER_SIZE		16
911da177e4SLinus Torvalds 
921da177e4SLinus Torvalds /* FSF status qualifier, recommendations */
931da177e4SLinus Torvalds #define FSF_SQ_NO_RECOM				0x00
941da177e4SLinus Torvalds #define FSF_SQ_FCP_RSP_AVAILABLE		0x01
951da177e4SLinus Torvalds #define FSF_SQ_RETRY_IF_POSSIBLE		0x02
961da177e4SLinus Torvalds #define FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED	0x03
971da177e4SLinus Torvalds #define FSF_SQ_INVOKE_LINK_TEST_PROCEDURE	0x04
981da177e4SLinus Torvalds #define FSF_SQ_COMMAND_ABORTED			0x06
991da177e4SLinus Torvalds #define FSF_SQ_NO_RETRY_POSSIBLE		0x07
1001da177e4SLinus Torvalds 
1011da177e4SLinus Torvalds /* FSF status qualifier (most significant 4 bytes), local link down */
102aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_LIGHT			0x00000004
103aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WRAP_PLUG			0x00000008
104aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP			0x00000010
105aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FIRMWARE_UPDATE		0x00000020
106aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_INVALID_WWPN		0x00000100
107aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_NPIV_SUPPORT		0x00000200
108aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP_RESOURCES		0x00000400
109aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FABRIC_RESOURCES	0x00000800
110aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE	0x00001000
111aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED	0x00002000
112aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_MODE_TABLE_CURRUPTED	0x00004000
113aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT		0x00008000
1141da177e4SLinus Torvalds 
1151da177e4SLinus Torvalds /* payload size in status read buffer */
1161da177e4SLinus Torvalds #define FSF_STATUS_READ_PAYLOAD_SIZE		4032
1171da177e4SLinus Torvalds 
1181da177e4SLinus Torvalds /* number of status read buffers that should be sent by ULP */
1191da177e4SLinus Torvalds #define FSF_STATUS_READS_RECOM			16
1201da177e4SLinus Torvalds 
1211da177e4SLinus Torvalds /* status types in status read buffer */
1221da177e4SLinus Torvalds #define FSF_STATUS_READ_PORT_CLOSED		0x00000001
1231da177e4SLinus Torvalds #define FSF_STATUS_READ_INCOMING_ELS		0x00000002
1241da177e4SLinus Torvalds #define FSF_STATUS_READ_SENSE_DATA_AVAIL        0x00000003
1251da177e4SLinus Torvalds #define FSF_STATUS_READ_BIT_ERROR_THRESHOLD	0x00000004
126aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_LINK_DOWN		0x00000005
1271da177e4SLinus Torvalds #define FSF_STATUS_READ_LINK_UP          	0x00000006
1289eb69affSMaxim Shchetynin #define FSF_STATUS_READ_NOTIFICATION_LOST	0x00000009
1291da177e4SLinus Torvalds #define FSF_STATUS_READ_CFDC_UPDATED		0x0000000A
130aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_FEATURE_UPDATE_ALERT	0x0000000C
1311da177e4SLinus Torvalds 
132aef4a983SMaxim Shchetynin /* status subtypes for link down */
133aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK	0x00000000
134aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FDISC_FAILED	0x00000001
135aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FIRMWARE_UPDATE	0x00000002
136aef4a983SMaxim Shchetynin 
1379eb69affSMaxim Shchetynin /* status subtypes for unsolicited status notification lost */
1389eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_INCOMING_ELS	0x00000001
1399eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_ACT_UPDATED		0x00000020
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds /* topologie that is detected by the adapter */
1421da177e4SLinus Torvalds #define FSF_TOPO_P2P				0x00000001
1431da177e4SLinus Torvalds #define FSF_TOPO_FABRIC				0x00000002
1441da177e4SLinus Torvalds #define FSF_TOPO_AL				0x00000003
1451da177e4SLinus Torvalds 
1461da177e4SLinus Torvalds /* data direction for FCP commands */
1471da177e4SLinus Torvalds #define FSF_DATADIR_WRITE			0x00000001
1481da177e4SLinus Torvalds #define FSF_DATADIR_READ			0x00000002
1491da177e4SLinus Torvalds #define FSF_DATADIR_CMND			0x00000004
1501da177e4SLinus Torvalds 
1511da177e4SLinus Torvalds /* fc service class */
1521da177e4SLinus Torvalds #define FSF_CLASS_3				0x00000003
1531da177e4SLinus Torvalds 
1541da177e4SLinus Torvalds /* SBAL chaining */
1551674b405SChristof Schmitt #define ZFCP_FSF_MAX_SBALS_PER_REQ		36
1561674b405SChristof Schmitt 
1571674b405SChristof Schmitt /* max. number of (data buffer) SBALEs in largest SBAL chain
1581674b405SChristof Schmitt  * request ID + QTCB in SBALE 0 + 1 of first SBAL in chain   */
1591674b405SChristof Schmitt #define ZFCP_FSF_MAX_SBALES_PER_REQ	\
1601674b405SChristof Schmitt 	(ZFCP_FSF_MAX_SBALS_PER_REQ * ZFCP_QDIO_MAX_SBALES_PER_SBAL - 2)
1611da177e4SLinus Torvalds 
1621da177e4SLinus Torvalds /* logging space behind QTCB */
1631da177e4SLinus Torvalds #define FSF_QTCB_LOG_SIZE			1024
1641da177e4SLinus Torvalds 
1651da177e4SLinus Torvalds /* channel features */
1661da177e4SLinus Torvalds #define FSF_FEATURE_CFDC			0x00000002
1671da177e4SLinus Torvalds #define FSF_FEATURE_LUN_SHARING			0x00000004
1689eb69affSMaxim Shchetynin #define FSF_FEATURE_NOTIFICATION_LOST		0x00000008
1691da177e4SLinus Torvalds #define FSF_FEATURE_HBAAPI_MANAGEMENT           0x00000010
17039eb7e9aSChristof Schmitt #define FSF_FEATURE_ELS_CT_CHAINED_SBALS	0x00000020
171aef4a983SMaxim Shchetynin #define FSF_FEATURE_UPDATE_ALERT		0x00000100
1726d9d63b9SSwen Schillig #define FSF_FEATURE_MEASUREMENT_DATA		0x00000200
173aef4a983SMaxim Shchetynin 
174aef4a983SMaxim Shchetynin /* host connection features */
175aef4a983SMaxim Shchetynin #define FSF_FEATURE_NPIV_MODE			0x00000001
1761da177e4SLinus Torvalds 
1771da177e4SLinus Torvalds /* option */
1781da177e4SLinus Torvalds #define FSF_OPEN_LUN_SUPPRESS_BOXING		0x00000001
1791da177e4SLinus Torvalds 
1801da177e4SLinus Torvalds /* open LUN access flags*/
1811da177e4SLinus Torvalds #define FSF_UNIT_ACCESS_EXCLUSIVE		0x02000000
1821da177e4SLinus Torvalds #define FSF_UNIT_ACCESS_OUTBOUND_TRANSFER	0x10000000
1831da177e4SLinus Torvalds 
18445633fdcSChristof Schmitt /* FSF interface for CFDC */
18545633fdcSChristof Schmitt #define ZFCP_CFDC_MAX_SIZE		127 * 1024
18645633fdcSChristof Schmitt #define ZFCP_CFDC_PAGES 		PFN_UP(ZFCP_CFDC_MAX_SIZE)
18745633fdcSChristof Schmitt 
18845633fdcSChristof Schmitt struct zfcp_fsf_cfdc {
18945633fdcSChristof Schmitt 	struct scatterlist sg[ZFCP_CFDC_PAGES];
19045633fdcSChristof Schmitt 	u32 command;
19145633fdcSChristof Schmitt 	u32 option;
19245633fdcSChristof Schmitt };
19345633fdcSChristof Schmitt 
1941da177e4SLinus Torvalds struct fsf_queue_designator {
1951da177e4SLinus Torvalds 	u8  cssid;
1961da177e4SLinus Torvalds 	u8  chpid;
1971da177e4SLinus Torvalds 	u8  hla;
1981da177e4SLinus Torvalds 	u8  ua;
1991da177e4SLinus Torvalds 	u32 res1;
2001da177e4SLinus Torvalds } __attribute__ ((packed));
2011da177e4SLinus Torvalds 
2021da177e4SLinus Torvalds struct fsf_bit_error_payload {
2031da177e4SLinus Torvalds 	u32 res1;
2041da177e4SLinus Torvalds 	u32 link_failure_error_count;
2051da177e4SLinus Torvalds 	u32 loss_of_sync_error_count;
2061da177e4SLinus Torvalds 	u32 loss_of_signal_error_count;
2071da177e4SLinus Torvalds 	u32 primitive_sequence_error_count;
2081da177e4SLinus Torvalds 	u32 invalid_transmission_word_error_count;
2091da177e4SLinus Torvalds 	u32 crc_error_count;
2101da177e4SLinus Torvalds 	u32 primitive_sequence_event_timeout_count;
2111da177e4SLinus Torvalds 	u32 elastic_buffer_overrun_error_count;
2121da177e4SLinus Torvalds 	u32 fcal_arbitration_timeout_count;
2131da177e4SLinus Torvalds 	u32 advertised_receive_b2b_credit;
2141da177e4SLinus Torvalds 	u32 current_receive_b2b_credit;
2151da177e4SLinus Torvalds 	u32 advertised_transmit_b2b_credit;
2161da177e4SLinus Torvalds 	u32 current_transmit_b2b_credit;
2171da177e4SLinus Torvalds } __attribute__ ((packed));
2181da177e4SLinus Torvalds 
219aef4a983SMaxim Shchetynin struct fsf_link_down_info {
220aef4a983SMaxim Shchetynin 	u32 error_code;
221aef4a983SMaxim Shchetynin 	u32 res1;
222aef4a983SMaxim Shchetynin 	u8 res2[2];
223aef4a983SMaxim Shchetynin 	u8 primary_status;
224aef4a983SMaxim Shchetynin 	u8 ioerr_code;
225aef4a983SMaxim Shchetynin 	u8 action_code;
226aef4a983SMaxim Shchetynin 	u8 reason_code;
227aef4a983SMaxim Shchetynin 	u8 explanation_code;
228aef4a983SMaxim Shchetynin 	u8 vendor_specific_code;
2291da177e4SLinus Torvalds } __attribute__ ((packed));
2301da177e4SLinus Torvalds 
231c41f8cbdSSwen Schillig struct fsf_status_read_buffer {
232c41f8cbdSSwen Schillig 	u32 status_type;
233c41f8cbdSSwen Schillig 	u32 status_subtype;
234c41f8cbdSSwen Schillig 	u32 length;
235c41f8cbdSSwen Schillig 	u32 res1;
236c41f8cbdSSwen Schillig 	struct fsf_queue_designator queue_designator;
237800c0cadSChristof Schmitt 	u8 res2;
238800c0cadSChristof Schmitt 	u8 d_id[3];
239c41f8cbdSSwen Schillig 	u32 class;
240c41f8cbdSSwen Schillig 	u64 fcp_lun;
241c41f8cbdSSwen Schillig 	u8  res3[24];
242c41f8cbdSSwen Schillig 	union {
243c41f8cbdSSwen Schillig 		u8  data[FSF_STATUS_READ_PAYLOAD_SIZE];
244c41f8cbdSSwen Schillig 		u32 word[FSF_STATUS_READ_PAYLOAD_SIZE/sizeof(u32)];
245c41f8cbdSSwen Schillig 		struct fsf_link_down_info link_down_info;
246c41f8cbdSSwen Schillig 		struct fsf_bit_error_payload bit_error;
247c41f8cbdSSwen Schillig 	} payload;
248c41f8cbdSSwen Schillig } __attribute__ ((packed));
249c41f8cbdSSwen Schillig 
250c41f8cbdSSwen Schillig struct fsf_qual_version_error {
251c41f8cbdSSwen Schillig 	u32 fsf_version;
252c41f8cbdSSwen Schillig 	u32 res1[3];
253c41f8cbdSSwen Schillig } __attribute__ ((packed));
254c41f8cbdSSwen Schillig 
255c41f8cbdSSwen Schillig struct fsf_qual_sequence_error {
256c41f8cbdSSwen Schillig 	u32 exp_req_seq_no;
257c41f8cbdSSwen Schillig 	u32 res1[3];
258c41f8cbdSSwen Schillig } __attribute__ ((packed));
259c41f8cbdSSwen Schillig 
260c9615858SChristof Schmitt struct fsf_qual_latency_info {
261c9615858SChristof Schmitt 	u32 channel_lat;
262c9615858SChristof Schmitt 	u32 fabric_lat;
263c9615858SChristof Schmitt 	u8 res1[8];
264c9615858SChristof Schmitt } __attribute__ ((packed));
265c9615858SChristof Schmitt 
2661da177e4SLinus Torvalds union fsf_prot_status_qual {
267553448f6SChristof Schmitt 	u32 word[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u32)];
2688a36e453SMaxim Shchetynin 	u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)];
2691da177e4SLinus Torvalds 	struct fsf_qual_version_error   version_error;
2701da177e4SLinus Torvalds 	struct fsf_qual_sequence_error  sequence_error;
271aef4a983SMaxim Shchetynin 	struct fsf_link_down_info link_down_info;
272c9615858SChristof Schmitt 	struct fsf_qual_latency_info latency_info;
2731da177e4SLinus Torvalds } __attribute__ ((packed));
2741da177e4SLinus Torvalds 
2751da177e4SLinus Torvalds struct fsf_qtcb_prefix {
2761da177e4SLinus Torvalds 	u64 req_id;
2771da177e4SLinus Torvalds 	u32 qtcb_version;
2781da177e4SLinus Torvalds 	u32 ulp_info;
2791da177e4SLinus Torvalds 	u32 qtcb_type;
2801da177e4SLinus Torvalds 	u32 req_seq_no;
2811da177e4SLinus Torvalds 	u32 prot_status;
2821da177e4SLinus Torvalds 	union fsf_prot_status_qual prot_status_qual;
2831da177e4SLinus Torvalds 	u8  res1[20];
2841da177e4SLinus Torvalds } __attribute__ ((packed));
2851da177e4SLinus Torvalds 
2866d9d63b9SSwen Schillig struct fsf_statistics_info {
2876d9d63b9SSwen Schillig 	u64 input_req;
2886d9d63b9SSwen Schillig 	u64 output_req;
2896d9d63b9SSwen Schillig 	u64 control_req;
2906d9d63b9SSwen Schillig 	u64 input_mb;
2916d9d63b9SSwen Schillig 	u64 output_mb;
2926d9d63b9SSwen Schillig 	u64 seconds_act;
2936d9d63b9SSwen Schillig } __attribute__ ((packed));
2946d9d63b9SSwen Schillig 
2951da177e4SLinus Torvalds union fsf_status_qual {
2961da177e4SLinus Torvalds 	u8  byte[FSF_STATUS_QUALIFIER_SIZE];
2971da177e4SLinus Torvalds 	u16 halfword[FSF_STATUS_QUALIFIER_SIZE / sizeof (u16)];
2981da177e4SLinus Torvalds 	u32 word[FSF_STATUS_QUALIFIER_SIZE / sizeof (u32)];
2998a36e453SMaxim Shchetynin 	u64 doubleword[FSF_STATUS_QUALIFIER_SIZE / sizeof(u64)];
3001da177e4SLinus Torvalds 	struct fsf_queue_designator fsf_queue_designator;
301aef4a983SMaxim Shchetynin 	struct fsf_link_down_info link_down_info;
3021da177e4SLinus Torvalds } __attribute__ ((packed));
3031da177e4SLinus Torvalds 
3041da177e4SLinus Torvalds struct fsf_qtcb_header {
3051da177e4SLinus Torvalds 	u64 req_handle;
3061da177e4SLinus Torvalds 	u32 fsf_command;
3071da177e4SLinus Torvalds 	u32 res1;
3081da177e4SLinus Torvalds 	u32 port_handle;
3091da177e4SLinus Torvalds 	u32 lun_handle;
3101da177e4SLinus Torvalds 	u32 res2;
3111da177e4SLinus Torvalds 	u32 fsf_status;
3121da177e4SLinus Torvalds 	union fsf_status_qual fsf_status_qual;
3131da177e4SLinus Torvalds 	u8  res3[28];
3141da177e4SLinus Torvalds 	u16 log_start;
3151da177e4SLinus Torvalds 	u16 log_length;
3161da177e4SLinus Torvalds 	u8  res4[16];
3171da177e4SLinus Torvalds } __attribute__ ((packed));
3181da177e4SLinus Torvalds 
31939eb7e9aSChristof Schmitt #define FSF_PLOGI_MIN_LEN	112
3201da177e4SLinus Torvalds 
3211da177e4SLinus Torvalds #define FSF_FCP_CMND_SIZE	288
3221da177e4SLinus Torvalds #define FSF_FCP_RSP_SIZE	128
3231da177e4SLinus Torvalds 
3241da177e4SLinus Torvalds struct fsf_qtcb_bottom_io {
3251da177e4SLinus Torvalds 	u32 data_direction;
3261da177e4SLinus Torvalds 	u32 service_class;
3271da177e4SLinus Torvalds 	u8  res1[8];
3281da177e4SLinus Torvalds 	u32 fcp_cmnd_length;
3291da177e4SLinus Torvalds 	u8  res2[12];
3301da177e4SLinus Torvalds 	u8  fcp_cmnd[FSF_FCP_CMND_SIZE];
3311da177e4SLinus Torvalds 	u8  fcp_rsp[FSF_FCP_RSP_SIZE];
3321da177e4SLinus Torvalds 	u8  res3[64];
3331da177e4SLinus Torvalds } __attribute__ ((packed));
3341da177e4SLinus Torvalds 
3351da177e4SLinus Torvalds struct fsf_qtcb_bottom_support {
3361da177e4SLinus Torvalds 	u32 operation_subtype;
337800c0cadSChristof Schmitt 	u8  res1[13];
338800c0cadSChristof Schmitt 	u8 d_id[3];
3391da177e4SLinus Torvalds 	u32 option;
3401da177e4SLinus Torvalds 	u64 fcp_lun;
3411da177e4SLinus Torvalds 	u64 res2;
3421da177e4SLinus Torvalds 	u64 req_handle;
3431da177e4SLinus Torvalds 	u32 service_class;
3441da177e4SLinus Torvalds 	u8  res3[3];
3451da177e4SLinus Torvalds 	u8  timeout;
3461da177e4SLinus Torvalds         u32 lun_access_info;
3471da177e4SLinus Torvalds         u8  res4[180];
3481da177e4SLinus Torvalds 	u32 els1_length;
3491da177e4SLinus Torvalds 	u32 els2_length;
3501da177e4SLinus Torvalds 	u32 req_buf_length;
3511da177e4SLinus Torvalds 	u32 resp_buf_length;
3521da177e4SLinus Torvalds 	u8  els[256];
3531da177e4SLinus Torvalds } __attribute__ ((packed));
3541da177e4SLinus Torvalds 
355faf4cd85SChristof Schmitt #define ZFCP_FSF_TIMER_INT_MASK	0x3FFF
356faf4cd85SChristof Schmitt 
3571da177e4SLinus Torvalds struct fsf_qtcb_bottom_config {
3581da177e4SLinus Torvalds 	u32 lic_version;
3591da177e4SLinus Torvalds 	u32 feature_selection;
3601da177e4SLinus Torvalds 	u32 high_qtcb_version;
3611da177e4SLinus Torvalds 	u32 low_qtcb_version;
3621da177e4SLinus Torvalds 	u32 max_qtcb_size;
3631da177e4SLinus Torvalds 	u32 max_data_transfer_size;
364aef4a983SMaxim Shchetynin 	u32 adapter_features;
365aef4a983SMaxim Shchetynin 	u32 connection_features;
3661da177e4SLinus Torvalds 	u32 fc_topology;
3671da177e4SLinus Torvalds 	u32 fc_link_speed;
3681da177e4SLinus Torvalds 	u32 adapter_type;
369800c0cadSChristof Schmitt 	u8 res0;
370800c0cadSChristof Schmitt 	u8 peer_d_id[3];
37164deb6efSChristof Schmitt 	u16 status_read_buf_num;
372c9615858SChristof Schmitt 	u16 timer_interval;
373800c0cadSChristof Schmitt 	u8 res2[9];
374800c0cadSChristof Schmitt 	u8 s_id[3];
3759d05ce2cSChristof Schmitt 	u8 nport_serv_param[128];
3761da177e4SLinus Torvalds 	u8 res3[8];
3771da177e4SLinus Torvalds 	u32 adapter_ports;
3781da177e4SLinus Torvalds 	u32 hardware_version;
3791da177e4SLinus Torvalds 	u8 serial_number[32];
3809d05ce2cSChristof Schmitt 	u8 plogi_payload[112];
3816d9d63b9SSwen Schillig 	struct fsf_statistics_info stat_info;
3826d9d63b9SSwen Schillig 	u8 res4[112];
3831da177e4SLinus Torvalds } __attribute__ ((packed));
3841da177e4SLinus Torvalds 
3851da177e4SLinus Torvalds struct fsf_qtcb_bottom_port {
386aef4a983SMaxim Shchetynin 	u64 wwpn;
3871da177e4SLinus Torvalds 	u32 fc_port_id;
3881da177e4SLinus Torvalds 	u32 port_type;
3891da177e4SLinus Torvalds 	u32 port_state;
3901da177e4SLinus Torvalds 	u32 class_of_service;	/* should be 0x00000006 for class 2 and 3 */
3911da177e4SLinus Torvalds 	u8 supported_fc4_types[32]; /* should be 0x00000100 for scsi fcp */
3921da177e4SLinus Torvalds 	u8 active_fc4_types[32];
3931da177e4SLinus Torvalds 	u32 supported_speed;	/* 0x0001 for 1 GBit/s or 0x0002 for 2 GBit/s */
3941da177e4SLinus Torvalds 	u32 maximum_frame_size;	/* fixed value of 2112 */
3951da177e4SLinus Torvalds 	u64 seconds_since_last_reset;
3961da177e4SLinus Torvalds 	u64 tx_frames;
3971da177e4SLinus Torvalds 	u64 tx_words;
3981da177e4SLinus Torvalds 	u64 rx_frames;
3991da177e4SLinus Torvalds 	u64 rx_words;
4001da177e4SLinus Torvalds 	u64 lip;		/* 0 */
4011da177e4SLinus Torvalds 	u64 nos;		/* currently 0 */
4021da177e4SLinus Torvalds 	u64 error_frames;	/* currently 0 */
4031da177e4SLinus Torvalds 	u64 dumped_frames;	/* currently 0 */
4041da177e4SLinus Torvalds 	u64 link_failure;
4051da177e4SLinus Torvalds 	u64 loss_of_sync;
4061da177e4SLinus Torvalds 	u64 loss_of_signal;
4071da177e4SLinus Torvalds 	u64 psp_error_counts;
4081da177e4SLinus Torvalds 	u64 invalid_tx_words;
4091da177e4SLinus Torvalds 	u64 invalid_crcs;
4101da177e4SLinus Torvalds 	u64 input_requests;
4111da177e4SLinus Torvalds 	u64 output_requests;
4121da177e4SLinus Torvalds 	u64 control_requests;
4131da177e4SLinus Torvalds 	u64 input_mb;		/* where 1 MByte == 1.000.000 Bytes */
4141da177e4SLinus Torvalds 	u64 output_mb;		/* where 1 MByte == 1.000.000 Bytes */
4156d9d63b9SSwen Schillig 	u8 cp_util;
4166d9d63b9SSwen Schillig 	u8 cb_util;
4176d9d63b9SSwen Schillig 	u8 a_util;
4186d9d63b9SSwen Schillig 	u8 res2[253];
4191da177e4SLinus Torvalds } __attribute__ ((packed));
4201da177e4SLinus Torvalds 
4211da177e4SLinus Torvalds union fsf_qtcb_bottom {
4221da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_io      io;
4231da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_support support;
4241da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_config  config;
4251da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_port port;
4261da177e4SLinus Torvalds };
4271da177e4SLinus Torvalds 
4281da177e4SLinus Torvalds struct fsf_qtcb {
4291da177e4SLinus Torvalds 	struct fsf_qtcb_prefix prefix;
4301da177e4SLinus Torvalds 	struct fsf_qtcb_header header;
4311da177e4SLinus Torvalds 	union  fsf_qtcb_bottom bottom;
4321da177e4SLinus Torvalds 	u8 log[FSF_QTCB_LOG_SIZE];
4331da177e4SLinus Torvalds } __attribute__ ((packed));
4341da177e4SLinus Torvalds 
4350997f1c5SStefan Raspl struct zfcp_blk_drv_data {
4360997f1c5SStefan Raspl #define ZFCP_BLK_DRV_DATA_MAGIC			0x1
4370997f1c5SStefan Raspl 	u32 magic;
4380997f1c5SStefan Raspl #define ZFCP_BLK_LAT_VALID			0x1
4390997f1c5SStefan Raspl #define ZFCP_BLK_REQ_ERROR			0x2
4400997f1c5SStefan Raspl 	u16 flags;
4410997f1c5SStefan Raspl 	u8 inb_usage;
4420997f1c5SStefan Raspl 	u8 outb_usage;
4430997f1c5SStefan Raspl 	u64 channel_lat;
4440997f1c5SStefan Raspl 	u64 fabric_lat;
4450997f1c5SStefan Raspl } __attribute__ ((packed));
4460997f1c5SStefan Raspl 
4477c7dc196SChristof Schmitt /**
4487c7dc196SChristof Schmitt  * struct zfcp_fsf_ct_els - zfcp data for ct or els request
4497c7dc196SChristof Schmitt  * @req: scatter-gather list for request
4507c7dc196SChristof Schmitt  * @resp: scatter-gather list for response
4517c7dc196SChristof Schmitt  * @handler: handler function (called for response to the request)
4527c7dc196SChristof Schmitt  * @handler_data: data passed to handler function
4537c7dc196SChristof Schmitt  * @port: Optional pointer to port for zfcp internal ELS (only test link ADISC)
4547c7dc196SChristof Schmitt  * @status: used to pass error status to calling function
4557c7dc196SChristof Schmitt  */
4567c7dc196SChristof Schmitt struct zfcp_fsf_ct_els {
4577c7dc196SChristof Schmitt 	struct scatterlist *req;
4587c7dc196SChristof Schmitt 	struct scatterlist *resp;
4597c7dc196SChristof Schmitt 	void (*handler)(void *);
4607c7dc196SChristof Schmitt 	void *handler_data;
4617c7dc196SChristof Schmitt 	struct zfcp_port *port;
4627c7dc196SChristof Schmitt 	int status;
4637c7dc196SChristof Schmitt };
4647c7dc196SChristof Schmitt 
4651da177e4SLinus Torvalds #endif				/* FSF_H */
466