xref: /openbmc/linux/drivers/s390/scsi/zfcp_fsf.h (revision 45633fdc)
11da177e4SLinus Torvalds /*
24a9d2d8bSAndreas Herrmann  * This file is part of the zfcp device driver for
34a9d2d8bSAndreas Herrmann  * FCP adapters for IBM System z9 and zSeries.
41da177e4SLinus Torvalds  *
54a9d2d8bSAndreas Herrmann  * (C) Copyright IBM Corp. 2002, 2006
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds  * it under the terms of the GNU General Public License as published by
91da177e4SLinus Torvalds  * the Free Software Foundation; either version 2, or (at your option)
101da177e4SLinus Torvalds  * any later version.
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  * This program is distributed in the hope that it will be useful,
131da177e4SLinus Torvalds  * but WITHOUT ANY WARRANTY; without even the implied warranty of
141da177e4SLinus Torvalds  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151da177e4SLinus Torvalds  * GNU General Public License for more details.
161da177e4SLinus Torvalds  *
171da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License
181da177e4SLinus Torvalds  * along with this program; if not, write to the Free Software
191da177e4SLinus Torvalds  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
201da177e4SLinus Torvalds  */
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds #ifndef FSF_H
231da177e4SLinus Torvalds #define FSF_H
241da177e4SLinus Torvalds 
2545633fdcSChristof Schmitt #include <linux/pfn.h>
2645633fdcSChristof Schmitt 
2706506d00SAndreas Herrmann #define FSF_QTCB_CURRENT_VERSION		0x00000001
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds /* FSF commands */
301da177e4SLinus Torvalds #define	FSF_QTCB_FCP_CMND			0x00000001
311da177e4SLinus Torvalds #define	FSF_QTCB_ABORT_FCP_CMND			0x00000002
321da177e4SLinus Torvalds #define	FSF_QTCB_OPEN_PORT_WITH_DID		0x00000005
331da177e4SLinus Torvalds #define	FSF_QTCB_OPEN_LUN			0x00000006
341da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_LUN			0x00000007
351da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_PORT			0x00000008
361da177e4SLinus Torvalds #define	FSF_QTCB_CLOSE_PHYSICAL_PORT		0x00000009
371da177e4SLinus Torvalds #define	FSF_QTCB_SEND_ELS			0x0000000B
381da177e4SLinus Torvalds #define	FSF_QTCB_SEND_GENERIC			0x0000000C
391da177e4SLinus Torvalds #define	FSF_QTCB_EXCHANGE_CONFIG_DATA		0x0000000D
401da177e4SLinus Torvalds #define	FSF_QTCB_EXCHANGE_PORT_DATA		0x0000000E
411da177e4SLinus Torvalds #define FSF_QTCB_DOWNLOAD_CONTROL_FILE		0x00000012
421da177e4SLinus Torvalds #define FSF_QTCB_UPLOAD_CONTROL_FILE		0x00000013
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds /* FSF QTCB types */
451da177e4SLinus Torvalds #define FSF_IO_COMMAND				0x00000001
461da177e4SLinus Torvalds #define FSF_SUPPORT_COMMAND			0x00000002
471da177e4SLinus Torvalds #define FSF_CONFIG_COMMAND			0x00000003
481da177e4SLinus Torvalds #define FSF_PORT_COMMAND			0x00000004
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds /* FSF control file upload/download operations' subtype and options */
511da177e4SLinus Torvalds #define FSF_CFDC_OPERATION_SUBTYPE		0x00020001
521da177e4SLinus Torvalds #define FSF_CFDC_OPTION_NORMAL_MODE		0x00000000
531da177e4SLinus Torvalds #define FSF_CFDC_OPTION_FORCE			0x00000001
541da177e4SLinus Torvalds #define FSF_CFDC_OPTION_FULL_ACCESS		0x00000002
551da177e4SLinus Torvalds #define FSF_CFDC_OPTION_RESTRICTED_ACCESS	0x00000004
561da177e4SLinus Torvalds 
5706506d00SAndreas Herrmann /* FSF protocol states */
581da177e4SLinus Torvalds #define FSF_PROT_GOOD				0x00000001
591da177e4SLinus Torvalds #define FSF_PROT_QTCB_VERSION_ERROR		0x00000010
601da177e4SLinus Torvalds #define FSF_PROT_SEQ_NUMB_ERROR			0x00000020
611da177e4SLinus Torvalds #define FSF_PROT_UNSUPP_QTCB_TYPE		0x00000040
621da177e4SLinus Torvalds #define FSF_PROT_HOST_CONNECTION_INITIALIZING	0x00000080
631da177e4SLinus Torvalds #define FSF_PROT_FSF_STATUS_PRESENTED		0x00000100
641da177e4SLinus Torvalds #define FSF_PROT_DUPLICATE_REQUEST_ID		0x00000200
651da177e4SLinus Torvalds #define FSF_PROT_LINK_DOWN                      0x00000400
661da177e4SLinus Torvalds #define FSF_PROT_REEST_QUEUE                    0x00000800
671da177e4SLinus Torvalds #define FSF_PROT_ERROR_STATE			0x01000000
681da177e4SLinus Torvalds 
6906506d00SAndreas Herrmann /* FSF states */
701da177e4SLinus Torvalds #define FSF_GOOD				0x00000000
711da177e4SLinus Torvalds #define FSF_PORT_ALREADY_OPEN			0x00000001
721da177e4SLinus Torvalds #define FSF_LUN_ALREADY_OPEN			0x00000002
731da177e4SLinus Torvalds #define FSF_PORT_HANDLE_NOT_VALID		0x00000003
741da177e4SLinus Torvalds #define FSF_LUN_HANDLE_NOT_VALID		0x00000004
751da177e4SLinus Torvalds #define FSF_HANDLE_MISMATCH			0x00000005
761da177e4SLinus Torvalds #define FSF_SERVICE_CLASS_NOT_SUPPORTED		0x00000006
771da177e4SLinus Torvalds #define FSF_FCPLUN_NOT_VALID			0x00000009
781da177e4SLinus Torvalds #define FSF_ACCESS_DENIED			0x00000010
791da177e4SLinus Torvalds #define FSF_LUN_SHARING_VIOLATION               0x00000012
801da177e4SLinus Torvalds #define FSF_FCP_COMMAND_DOES_NOT_EXIST		0x00000022
811da177e4SLinus Torvalds #define FSF_DIRECTION_INDICATOR_NOT_VALID	0x00000030
821da177e4SLinus Torvalds #define FSF_CMND_LENGTH_NOT_VALID		0x00000033
831da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED	0x00000040
841da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED	0x00000041
851da177e4SLinus Torvalds #define FSF_ELS_COMMAND_REJECTED		0x00000050
861da177e4SLinus Torvalds #define FSF_GENERIC_COMMAND_REJECTED		0x00000051
871da177e4SLinus Torvalds #define FSF_OPERATION_PARTIALLY_SUCCESSFUL	0x00000052
881da177e4SLinus Torvalds #define FSF_AUTHORIZATION_FAILURE		0x00000053
891da177e4SLinus Torvalds #define FSF_CFDC_ERROR_DETECTED			0x00000054
901da177e4SLinus Torvalds #define FSF_CONTROL_FILE_UPDATE_ERROR		0x00000055
911da177e4SLinus Torvalds #define FSF_CONTROL_FILE_TOO_LARGE		0x00000056
921da177e4SLinus Torvalds #define FSF_ACCESS_CONFLICT_DETECTED		0x00000057
931da177e4SLinus Torvalds #define FSF_CONFLICTS_OVERRULED			0x00000058
941da177e4SLinus Torvalds #define FSF_PORT_BOXED				0x00000059
951da177e4SLinus Torvalds #define FSF_LUN_BOXED				0x0000005A
961da177e4SLinus Torvalds #define FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE	0x0000005B
971da177e4SLinus Torvalds #define FSF_PAYLOAD_SIZE_MISMATCH		0x00000060
981da177e4SLinus Torvalds #define FSF_REQUEST_SIZE_TOO_LARGE		0x00000061
991da177e4SLinus Torvalds #define FSF_RESPONSE_SIZE_TOO_LARGE		0x00000062
1001da177e4SLinus Torvalds #define FSF_SBAL_MISMATCH			0x00000063
1011da177e4SLinus Torvalds #define FSF_OPEN_PORT_WITHOUT_PRLI		0x00000064
1021da177e4SLinus Torvalds #define FSF_ADAPTER_STATUS_AVAILABLE		0x000000AD
1031da177e4SLinus Torvalds #define FSF_FCP_RSP_AVAILABLE			0x000000AF
1041da177e4SLinus Torvalds #define FSF_UNKNOWN_COMMAND			0x000000E2
1051da177e4SLinus Torvalds #define FSF_UNKNOWN_OP_SUBTYPE                  0x000000E3
1061da177e4SLinus Torvalds #define FSF_INVALID_COMMAND_OPTION              0x000000E5
1071da177e4SLinus Torvalds /* #define FSF_ERROR                             0x000000FF  */
1081da177e4SLinus Torvalds 
1098a36e453SMaxim Shchetynin #define FSF_PROT_STATUS_QUAL_SIZE		16
1101da177e4SLinus Torvalds #define FSF_STATUS_QUALIFIER_SIZE		16
1111da177e4SLinus Torvalds 
1121da177e4SLinus Torvalds /* FSF status qualifier, recommendations */
1131da177e4SLinus Torvalds #define FSF_SQ_NO_RECOM				0x00
1141da177e4SLinus Torvalds #define FSF_SQ_FCP_RSP_AVAILABLE		0x01
1151da177e4SLinus Torvalds #define FSF_SQ_RETRY_IF_POSSIBLE		0x02
1161da177e4SLinus Torvalds #define FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED	0x03
1171da177e4SLinus Torvalds #define FSF_SQ_INVOKE_LINK_TEST_PROCEDURE	0x04
1181da177e4SLinus Torvalds #define FSF_SQ_ULP_PROGRAMMING_ERROR		0x05
1191da177e4SLinus Torvalds #define FSF_SQ_COMMAND_ABORTED			0x06
1201da177e4SLinus Torvalds #define FSF_SQ_NO_RETRY_POSSIBLE		0x07
1211da177e4SLinus Torvalds 
1221da177e4SLinus Torvalds /* FSF status qualifier for CFDC commands */
1236f71d9bcS #define FSF_SQ_CFDC_HARDENED_ON_SE		0x00000000
1241da177e4SLinus Torvalds #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE	0x00000001
1251da177e4SLinus Torvalds #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE2	0x00000002
1261da177e4SLinus Torvalds /* CFDC subtable codes */
1271da177e4SLinus Torvalds #define FSF_SQ_CFDC_SUBTABLE_OS			0x0001
1281da177e4SLinus Torvalds #define FSF_SQ_CFDC_SUBTABLE_PORT_WWPN		0x0002
1291da177e4SLinus Torvalds #define FSF_SQ_CFDC_SUBTABLE_PORT_DID		0x0003
1301da177e4SLinus Torvalds #define FSF_SQ_CFDC_SUBTABLE_LUN		0x0004
1311da177e4SLinus Torvalds 
1321da177e4SLinus Torvalds /* FSF status qualifier (most significant 4 bytes), local link down */
133aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_LIGHT			0x00000004
134aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WRAP_PLUG			0x00000008
135aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP			0x00000010
136aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FIRMWARE_UPDATE		0x00000020
137aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_INVALID_WWPN		0x00000100
138aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_NPIV_SUPPORT		0x00000200
139aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP_RESOURCES		0x00000400
140aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FABRIC_RESOURCES	0x00000800
141aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE	0x00001000
142aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED	0x00002000
143aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_MODE_TABLE_CURRUPTED	0x00004000
144aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT		0x00008000
1451da177e4SLinus Torvalds 
1461da177e4SLinus Torvalds /* payload size in status read buffer */
1471da177e4SLinus Torvalds #define FSF_STATUS_READ_PAYLOAD_SIZE		4032
1481da177e4SLinus Torvalds 
1491da177e4SLinus Torvalds /* number of status read buffers that should be sent by ULP */
1501da177e4SLinus Torvalds #define FSF_STATUS_READS_RECOM			16
1511da177e4SLinus Torvalds 
1521da177e4SLinus Torvalds /* status types in status read buffer */
1531da177e4SLinus Torvalds #define FSF_STATUS_READ_PORT_CLOSED		0x00000001
1541da177e4SLinus Torvalds #define FSF_STATUS_READ_INCOMING_ELS		0x00000002
1551da177e4SLinus Torvalds #define FSF_STATUS_READ_SENSE_DATA_AVAIL        0x00000003
1561da177e4SLinus Torvalds #define FSF_STATUS_READ_BIT_ERROR_THRESHOLD	0x00000004
157aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_LINK_DOWN		0x00000005
1581da177e4SLinus Torvalds #define FSF_STATUS_READ_LINK_UP          	0x00000006
1599eb69affSMaxim Shchetynin #define FSF_STATUS_READ_NOTIFICATION_LOST	0x00000009
1601da177e4SLinus Torvalds #define FSF_STATUS_READ_CFDC_UPDATED		0x0000000A
1611da177e4SLinus Torvalds #define FSF_STATUS_READ_CFDC_HARDENED		0x0000000B
162aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_FEATURE_UPDATE_ALERT	0x0000000C
1631da177e4SLinus Torvalds 
1641da177e4SLinus Torvalds /* status subtypes in status read buffer */
1651da177e4SLinus Torvalds #define FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT	0x00000001
1661da177e4SLinus Torvalds #define FSF_STATUS_READ_SUB_ERROR_PORT		0x00000002
1671da177e4SLinus Torvalds 
168aef4a983SMaxim Shchetynin /* status subtypes for link down */
169aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK	0x00000000
170aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FDISC_FAILED	0x00000001
171aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FIRMWARE_UPDATE	0x00000002
172aef4a983SMaxim Shchetynin 
1739eb69affSMaxim Shchetynin /* status subtypes for unsolicited status notification lost */
1749eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_INCOMING_ELS	0x00000001
1759eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_SENSE_DATA		0x00000002
1769eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_LINK_STATUS		0x00000004
1779eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_PORT_CLOSED		0x00000008
1789eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_BIT_ERROR_THRESHOLD	0x00000010
1799eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_ACT_UPDATED		0x00000020
1809eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_ACT_HARDENED	0x00000040
1819eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_FEATURE_UPDATE_ALERT 0x00000080
1829eb69affSMaxim Shchetynin 
1831da177e4SLinus Torvalds /* status subtypes for CFDC */
1841da177e4SLinus Torvalds #define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE	0x00000002
1851da177e4SLinus Torvalds #define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2 0x0000000F
1861da177e4SLinus Torvalds 
1871da177e4SLinus Torvalds /* topologie that is detected by the adapter */
1881da177e4SLinus Torvalds #define FSF_TOPO_ERROR				0x00000000
1891da177e4SLinus Torvalds #define FSF_TOPO_P2P				0x00000001
1901da177e4SLinus Torvalds #define FSF_TOPO_FABRIC				0x00000002
1911da177e4SLinus Torvalds #define FSF_TOPO_AL				0x00000003
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds /* data direction for FCP commands */
1941da177e4SLinus Torvalds #define FSF_DATADIR_WRITE			0x00000001
1951da177e4SLinus Torvalds #define FSF_DATADIR_READ			0x00000002
1961da177e4SLinus Torvalds #define FSF_DATADIR_READ_WRITE			0x00000003
1971da177e4SLinus Torvalds #define FSF_DATADIR_CMND			0x00000004
1981da177e4SLinus Torvalds 
1991da177e4SLinus Torvalds /* fc service class */
2001da177e4SLinus Torvalds #define FSF_CLASS_1				0x00000001
2011da177e4SLinus Torvalds #define FSF_CLASS_2				0x00000002
2021da177e4SLinus Torvalds #define FSF_CLASS_3				0x00000003
2031da177e4SLinus Torvalds 
2041da177e4SLinus Torvalds /* SBAL chaining */
2051da177e4SLinus Torvalds #define FSF_MAX_SBALS_PER_REQ			36
2061da177e4SLinus Torvalds #define FSF_MAX_SBALS_PER_ELS_REQ		2
2071da177e4SLinus Torvalds 
2081da177e4SLinus Torvalds /* logging space behind QTCB */
2091da177e4SLinus Torvalds #define FSF_QTCB_LOG_SIZE			1024
2101da177e4SLinus Torvalds 
2111da177e4SLinus Torvalds /* channel features */
2121da177e4SLinus Torvalds #define FSF_FEATURE_CFDC			0x00000002
2131da177e4SLinus Torvalds #define FSF_FEATURE_LUN_SHARING			0x00000004
2149eb69affSMaxim Shchetynin #define FSF_FEATURE_NOTIFICATION_LOST		0x00000008
2151da177e4SLinus Torvalds #define FSF_FEATURE_HBAAPI_MANAGEMENT           0x00000010
2161da177e4SLinus Torvalds #define FSF_FEATURE_ELS_CT_CHAINED_SBALS        0x00000020
217aef4a983SMaxim Shchetynin #define FSF_FEATURE_UPDATE_ALERT		0x00000100
2186d9d63b9SSwen Schillig #define FSF_FEATURE_MEASUREMENT_DATA		0x00000200
219aef4a983SMaxim Shchetynin 
220aef4a983SMaxim Shchetynin /* host connection features */
221aef4a983SMaxim Shchetynin #define FSF_FEATURE_NPIV_MODE			0x00000001
222aef4a983SMaxim Shchetynin #define FSF_FEATURE_VM_ASSIGNED_WWPN		0x00000002
2231da177e4SLinus Torvalds 
2241da177e4SLinus Torvalds /* option */
2251da177e4SLinus Torvalds #define FSF_OPEN_LUN_SUPPRESS_BOXING		0x00000001
2261da177e4SLinus Torvalds #define FSF_OPEN_LUN_REPLICATE_SENSE		0x00000002
2271da177e4SLinus Torvalds 
2281da177e4SLinus Torvalds /* adapter types */
2291da177e4SLinus Torvalds #define FSF_ADAPTER_TYPE_FICON                  0x00000001
2301da177e4SLinus Torvalds #define FSF_ADAPTER_TYPE_FICON_EXPRESS          0x00000002
2311da177e4SLinus Torvalds 
2321da177e4SLinus Torvalds /* port types */
2331da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_UNKNOWN		0x00000001
2341da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_NOTPRESENT		0x00000003
2351da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_NPORT			0x00000005
2361da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_PTP			0x00000021
2371da177e4SLinus Torvalds /* following are not defined and used by FSF Spec
2381da177e4SLinus Torvalds    but are additionally defined by FC-HBA */
2391da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_OTHER			0x00000002
2401da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_NOTPRESENT		0x00000003
2411da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_NLPORT			0x00000006
2421da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_FLPORT			0x00000007
2431da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_FPORT			0x00000008
2441da177e4SLinus Torvalds #define FSF_HBA_PORTTYPE_LPORT			0x00000020
2451da177e4SLinus Torvalds 
2461da177e4SLinus Torvalds /* port states */
2471da177e4SLinus Torvalds #define FSF_HBA_PORTSTATE_UNKNOWN		0x00000001
2481da177e4SLinus Torvalds #define FSF_HBA_PORTSTATE_ONLINE		0x00000002
2491da177e4SLinus Torvalds #define FSF_HBA_PORTSTATE_OFFLINE		0x00000003
2501da177e4SLinus Torvalds #define FSF_HBA_PORTSTATE_LINKDOWN		0x00000006
2511da177e4SLinus Torvalds #define FSF_HBA_PORTSTATE_ERROR			0x00000007
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds /* IO states of adapter */
2541da177e4SLinus Torvalds #define FSF_IOSTAT_NPORT_RJT			0x00000004
2551da177e4SLinus Torvalds #define FSF_IOSTAT_FABRIC_RJT			0x00000005
2561da177e4SLinus Torvalds #define FSF_IOSTAT_LS_RJT			0x00000009
2571da177e4SLinus Torvalds 
2581da177e4SLinus Torvalds /* open LUN access flags*/
2591da177e4SLinus Torvalds #define FSF_UNIT_ACCESS_OPEN_LUN_ALLOWED	0x01000000
2601da177e4SLinus Torvalds #define FSF_UNIT_ACCESS_EXCLUSIVE		0x02000000
2611da177e4SLinus Torvalds #define FSF_UNIT_ACCESS_OUTBOUND_TRANSFER	0x10000000
2621da177e4SLinus Torvalds 
26345633fdcSChristof Schmitt /* FSF interface for CFDC */
26445633fdcSChristof Schmitt #define ZFCP_CFDC_MAX_SIZE		127 * 1024
26545633fdcSChristof Schmitt #define ZFCP_CFDC_PAGES 		PFN_UP(ZFCP_CFDC_MAX_SIZE)
26645633fdcSChristof Schmitt 
26745633fdcSChristof Schmitt struct zfcp_fsf_cfdc {
26845633fdcSChristof Schmitt 	struct scatterlist sg[ZFCP_CFDC_PAGES];
26945633fdcSChristof Schmitt 	u32 command;
27045633fdcSChristof Schmitt 	u32 option;
27145633fdcSChristof Schmitt };
27245633fdcSChristof Schmitt 
2731da177e4SLinus Torvalds struct fsf_queue_designator {
2741da177e4SLinus Torvalds 	u8  cssid;
2751da177e4SLinus Torvalds 	u8  chpid;
2761da177e4SLinus Torvalds 	u8  hla;
2771da177e4SLinus Torvalds 	u8  ua;
2781da177e4SLinus Torvalds 	u32 res1;
2791da177e4SLinus Torvalds } __attribute__ ((packed));
2801da177e4SLinus Torvalds 
2811da177e4SLinus Torvalds struct fsf_port_closed_payload {
2821da177e4SLinus Torvalds 	struct fsf_queue_designator queue_designator;
2831da177e4SLinus Torvalds 	u32                         port_handle;
2841da177e4SLinus Torvalds } __attribute__ ((packed));
2851da177e4SLinus Torvalds 
2861da177e4SLinus Torvalds struct fsf_bit_error_payload {
2871da177e4SLinus Torvalds 	u32 res1;
2881da177e4SLinus Torvalds 	u32 link_failure_error_count;
2891da177e4SLinus Torvalds 	u32 loss_of_sync_error_count;
2901da177e4SLinus Torvalds 	u32 loss_of_signal_error_count;
2911da177e4SLinus Torvalds 	u32 primitive_sequence_error_count;
2921da177e4SLinus Torvalds 	u32 invalid_transmission_word_error_count;
2931da177e4SLinus Torvalds 	u32 crc_error_count;
2941da177e4SLinus Torvalds 	u32 primitive_sequence_event_timeout_count;
2951da177e4SLinus Torvalds 	u32 elastic_buffer_overrun_error_count;
2961da177e4SLinus Torvalds 	u32 fcal_arbitration_timeout_count;
2971da177e4SLinus Torvalds 	u32 advertised_receive_b2b_credit;
2981da177e4SLinus Torvalds 	u32 current_receive_b2b_credit;
2991da177e4SLinus Torvalds 	u32 advertised_transmit_b2b_credit;
3001da177e4SLinus Torvalds 	u32 current_transmit_b2b_credit;
3011da177e4SLinus Torvalds } __attribute__ ((packed));
3021da177e4SLinus Torvalds 
3031da177e4SLinus Torvalds struct fsf_status_read_buffer {
3041da177e4SLinus Torvalds 	u32 status_type;
3051da177e4SLinus Torvalds 	u32 status_subtype;
3061da177e4SLinus Torvalds 	u32 length;
3071da177e4SLinus Torvalds 	u32 res1;
3081da177e4SLinus Torvalds 	struct fsf_queue_designator queue_designator;
3091da177e4SLinus Torvalds 	u32 d_id;
3101da177e4SLinus Torvalds 	u32 class;
3111da177e4SLinus Torvalds 	u64 fcp_lun;
3121da177e4SLinus Torvalds 	u8  res3[24];
3131da177e4SLinus Torvalds 	u8  payload[FSF_STATUS_READ_PAYLOAD_SIZE];
3141da177e4SLinus Torvalds } __attribute__ ((packed));
3151da177e4SLinus Torvalds 
3161da177e4SLinus Torvalds struct fsf_qual_version_error {
3171da177e4SLinus Torvalds 	u32 fsf_version;
3181da177e4SLinus Torvalds 	u32 res1[3];
3191da177e4SLinus Torvalds } __attribute__ ((packed));
3201da177e4SLinus Torvalds 
3211da177e4SLinus Torvalds struct fsf_qual_sequence_error {
3221da177e4SLinus Torvalds 	u32 exp_req_seq_no;
3231da177e4SLinus Torvalds 	u32 res1[3];
3241da177e4SLinus Torvalds } __attribute__ ((packed));
3251da177e4SLinus Torvalds 
326aef4a983SMaxim Shchetynin struct fsf_link_down_info {
327aef4a983SMaxim Shchetynin 	u32 error_code;
328aef4a983SMaxim Shchetynin 	u32 res1;
329aef4a983SMaxim Shchetynin 	u8 res2[2];
330aef4a983SMaxim Shchetynin 	u8 primary_status;
331aef4a983SMaxim Shchetynin 	u8 ioerr_code;
332aef4a983SMaxim Shchetynin 	u8 action_code;
333aef4a983SMaxim Shchetynin 	u8 reason_code;
334aef4a983SMaxim Shchetynin 	u8 explanation_code;
335aef4a983SMaxim Shchetynin 	u8 vendor_specific_code;
3361da177e4SLinus Torvalds } __attribute__ ((packed));
3371da177e4SLinus Torvalds 
338c9615858SChristof Schmitt struct fsf_qual_latency_info {
339c9615858SChristof Schmitt 	u32 channel_lat;
340c9615858SChristof Schmitt 	u32 fabric_lat;
341c9615858SChristof Schmitt 	u8 res1[8];
342c9615858SChristof Schmitt } __attribute__ ((packed));
343c9615858SChristof Schmitt 
3441da177e4SLinus Torvalds union fsf_prot_status_qual {
3458a36e453SMaxim Shchetynin 	u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)];
3461da177e4SLinus Torvalds 	struct fsf_qual_version_error   version_error;
3471da177e4SLinus Torvalds 	struct fsf_qual_sequence_error  sequence_error;
348aef4a983SMaxim Shchetynin 	struct fsf_link_down_info link_down_info;
349c9615858SChristof Schmitt 	struct fsf_qual_latency_info latency_info;
3501da177e4SLinus Torvalds } __attribute__ ((packed));
3511da177e4SLinus Torvalds 
3521da177e4SLinus Torvalds struct fsf_qtcb_prefix {
3531da177e4SLinus Torvalds 	u64 req_id;
3541da177e4SLinus Torvalds 	u32 qtcb_version;
3551da177e4SLinus Torvalds 	u32 ulp_info;
3561da177e4SLinus Torvalds 	u32 qtcb_type;
3571da177e4SLinus Torvalds 	u32 req_seq_no;
3581da177e4SLinus Torvalds 	u32 prot_status;
3591da177e4SLinus Torvalds 	union fsf_prot_status_qual prot_status_qual;
3601da177e4SLinus Torvalds 	u8  res1[20];
3611da177e4SLinus Torvalds } __attribute__ ((packed));
3621da177e4SLinus Torvalds 
3636d9d63b9SSwen Schillig struct fsf_statistics_info {
3646d9d63b9SSwen Schillig 	u64 input_req;
3656d9d63b9SSwen Schillig 	u64 output_req;
3666d9d63b9SSwen Schillig 	u64 control_req;
3676d9d63b9SSwen Schillig 	u64 input_mb;
3686d9d63b9SSwen Schillig 	u64 output_mb;
3696d9d63b9SSwen Schillig 	u64 seconds_act;
3706d9d63b9SSwen Schillig } __attribute__ ((packed));
3716d9d63b9SSwen Schillig 
3721da177e4SLinus Torvalds union fsf_status_qual {
3731da177e4SLinus Torvalds 	u8  byte[FSF_STATUS_QUALIFIER_SIZE];
3741da177e4SLinus Torvalds 	u16 halfword[FSF_STATUS_QUALIFIER_SIZE / sizeof (u16)];
3751da177e4SLinus Torvalds 	u32 word[FSF_STATUS_QUALIFIER_SIZE / sizeof (u32)];
3768a36e453SMaxim Shchetynin 	u64 doubleword[FSF_STATUS_QUALIFIER_SIZE / sizeof(u64)];
3771da177e4SLinus Torvalds 	struct fsf_queue_designator fsf_queue_designator;
378aef4a983SMaxim Shchetynin 	struct fsf_link_down_info link_down_info;
3791da177e4SLinus Torvalds } __attribute__ ((packed));
3801da177e4SLinus Torvalds 
3811da177e4SLinus Torvalds struct fsf_qtcb_header {
3821da177e4SLinus Torvalds 	u64 req_handle;
3831da177e4SLinus Torvalds 	u32 fsf_command;
3841da177e4SLinus Torvalds 	u32 res1;
3851da177e4SLinus Torvalds 	u32 port_handle;
3861da177e4SLinus Torvalds 	u32 lun_handle;
3871da177e4SLinus Torvalds 	u32 res2;
3881da177e4SLinus Torvalds 	u32 fsf_status;
3891da177e4SLinus Torvalds 	union fsf_status_qual fsf_status_qual;
3901da177e4SLinus Torvalds 	u8  res3[28];
3911da177e4SLinus Torvalds 	u16 log_start;
3921da177e4SLinus Torvalds 	u16 log_length;
3931da177e4SLinus Torvalds 	u8  res4[16];
3941da177e4SLinus Torvalds } __attribute__ ((packed));
3951da177e4SLinus Torvalds 
3961da177e4SLinus Torvalds struct fsf_nport_serv_param {
3971da177e4SLinus Torvalds 	u8  common_serv_param[16];
3981da177e4SLinus Torvalds 	u64 wwpn;
3991da177e4SLinus Torvalds 	u64 wwnn;
4001da177e4SLinus Torvalds 	u8  class1_serv_param[16];
4011da177e4SLinus Torvalds 	u8  class2_serv_param[16];
4021da177e4SLinus Torvalds 	u8  class3_serv_param[16];
4031da177e4SLinus Torvalds 	u8  class4_serv_param[16];
4041da177e4SLinus Torvalds 	u8  vendor_version_level[16];
4051da177e4SLinus Torvalds } __attribute__ ((packed));
4061da177e4SLinus Torvalds 
4071da177e4SLinus Torvalds struct fsf_plogi {
4081da177e4SLinus Torvalds 	u32    code;
4091da177e4SLinus Torvalds 	struct fsf_nport_serv_param serv_param;
4101da177e4SLinus Torvalds } __attribute__ ((packed));
4111da177e4SLinus Torvalds 
4121da177e4SLinus Torvalds #define FSF_FCP_CMND_SIZE	288
4131da177e4SLinus Torvalds #define FSF_FCP_RSP_SIZE	128
4141da177e4SLinus Torvalds 
4151da177e4SLinus Torvalds struct fsf_qtcb_bottom_io {
4161da177e4SLinus Torvalds 	u32 data_direction;
4171da177e4SLinus Torvalds 	u32 service_class;
4181da177e4SLinus Torvalds 	u8  res1[8];
4191da177e4SLinus Torvalds 	u32 fcp_cmnd_length;
4201da177e4SLinus Torvalds 	u8  res2[12];
4211da177e4SLinus Torvalds 	u8  fcp_cmnd[FSF_FCP_CMND_SIZE];
4221da177e4SLinus Torvalds 	u8  fcp_rsp[FSF_FCP_RSP_SIZE];
4231da177e4SLinus Torvalds 	u8  res3[64];
4241da177e4SLinus Torvalds } __attribute__ ((packed));
4251da177e4SLinus Torvalds 
4261da177e4SLinus Torvalds struct fsf_qtcb_bottom_support {
4271da177e4SLinus Torvalds 	u32 operation_subtype;
4281da177e4SLinus Torvalds 	u8  res1[12];
4291da177e4SLinus Torvalds 	u32 d_id;
4301da177e4SLinus Torvalds 	u32 option;
4311da177e4SLinus Torvalds 	u64 fcp_lun;
4321da177e4SLinus Torvalds 	u64 res2;
4331da177e4SLinus Torvalds 	u64 req_handle;
4341da177e4SLinus Torvalds 	u32 service_class;
4351da177e4SLinus Torvalds 	u8  res3[3];
4361da177e4SLinus Torvalds 	u8  timeout;
4371da177e4SLinus Torvalds         u32 lun_access_info;
4381da177e4SLinus Torvalds         u8  res4[180];
4391da177e4SLinus Torvalds 	u32 els1_length;
4401da177e4SLinus Torvalds 	u32 els2_length;
4411da177e4SLinus Torvalds 	u32 req_buf_length;
4421da177e4SLinus Torvalds 	u32 resp_buf_length;
4431da177e4SLinus Torvalds 	u8  els[256];
4441da177e4SLinus Torvalds } __attribute__ ((packed));
4451da177e4SLinus Torvalds 
4461da177e4SLinus Torvalds struct fsf_qtcb_bottom_config {
4471da177e4SLinus Torvalds 	u32 lic_version;
4481da177e4SLinus Torvalds 	u32 feature_selection;
4491da177e4SLinus Torvalds 	u32 high_qtcb_version;
4501da177e4SLinus Torvalds 	u32 low_qtcb_version;
4511da177e4SLinus Torvalds 	u32 max_qtcb_size;
4521da177e4SLinus Torvalds 	u32 max_data_transfer_size;
453aef4a983SMaxim Shchetynin 	u32 adapter_features;
454aef4a983SMaxim Shchetynin 	u32 connection_features;
4551da177e4SLinus Torvalds 	u32 fc_topology;
4561da177e4SLinus Torvalds 	u32 fc_link_speed;
4571da177e4SLinus Torvalds 	u32 adapter_type;
4581da177e4SLinus Torvalds 	u32 peer_d_id;
459c9615858SChristof Schmitt 	u8 res1[2];
460c9615858SChristof Schmitt 	u16 timer_interval;
461c9615858SChristof Schmitt 	u8 res2[8];
4621da177e4SLinus Torvalds 	u32 s_id;
4631da177e4SLinus Torvalds 	struct fsf_nport_serv_param nport_serv_param;
4646f71d9bcS 	u8 reserved_nport_serv_param[16];
4651da177e4SLinus Torvalds 	u8 res3[8];
4661da177e4SLinus Torvalds 	u32 adapter_ports;
4671da177e4SLinus Torvalds 	u32 hardware_version;
4681da177e4SLinus Torvalds 	u8 serial_number[32];
4696f71d9bcS 	struct fsf_nport_serv_param plogi_payload;
4706d9d63b9SSwen Schillig 	struct fsf_statistics_info stat_info;
4716d9d63b9SSwen Schillig 	u8 res4[112];
4721da177e4SLinus Torvalds } __attribute__ ((packed));
4731da177e4SLinus Torvalds 
4741da177e4SLinus Torvalds struct fsf_qtcb_bottom_port {
475aef4a983SMaxim Shchetynin 	u64 wwpn;
4761da177e4SLinus Torvalds 	u32 fc_port_id;
4771da177e4SLinus Torvalds 	u32 port_type;
4781da177e4SLinus Torvalds 	u32 port_state;
4791da177e4SLinus Torvalds 	u32 class_of_service;	/* should be 0x00000006 for class 2 and 3 */
4801da177e4SLinus Torvalds 	u8 supported_fc4_types[32]; /* should be 0x00000100 for scsi fcp */
4811da177e4SLinus Torvalds 	u8 active_fc4_types[32];
4821da177e4SLinus Torvalds 	u32 supported_speed;	/* 0x0001 for 1 GBit/s or 0x0002 for 2 GBit/s */
4831da177e4SLinus Torvalds 	u32 maximum_frame_size;	/* fixed value of 2112 */
4841da177e4SLinus Torvalds 	u64 seconds_since_last_reset;
4851da177e4SLinus Torvalds 	u64 tx_frames;
4861da177e4SLinus Torvalds 	u64 tx_words;
4871da177e4SLinus Torvalds 	u64 rx_frames;
4881da177e4SLinus Torvalds 	u64 rx_words;
4891da177e4SLinus Torvalds 	u64 lip;		/* 0 */
4901da177e4SLinus Torvalds 	u64 nos;		/* currently 0 */
4911da177e4SLinus Torvalds 	u64 error_frames;	/* currently 0 */
4921da177e4SLinus Torvalds 	u64 dumped_frames;	/* currently 0 */
4931da177e4SLinus Torvalds 	u64 link_failure;
4941da177e4SLinus Torvalds 	u64 loss_of_sync;
4951da177e4SLinus Torvalds 	u64 loss_of_signal;
4961da177e4SLinus Torvalds 	u64 psp_error_counts;
4971da177e4SLinus Torvalds 	u64 invalid_tx_words;
4981da177e4SLinus Torvalds 	u64 invalid_crcs;
4991da177e4SLinus Torvalds 	u64 input_requests;
5001da177e4SLinus Torvalds 	u64 output_requests;
5011da177e4SLinus Torvalds 	u64 control_requests;
5021da177e4SLinus Torvalds 	u64 input_mb;		/* where 1 MByte == 1.000.000 Bytes */
5031da177e4SLinus Torvalds 	u64 output_mb;		/* where 1 MByte == 1.000.000 Bytes */
5046d9d63b9SSwen Schillig 	u8 cp_util;
5056d9d63b9SSwen Schillig 	u8 cb_util;
5066d9d63b9SSwen Schillig 	u8 a_util;
5076d9d63b9SSwen Schillig 	u8 res2[253];
5081da177e4SLinus Torvalds } __attribute__ ((packed));
5091da177e4SLinus Torvalds 
5101da177e4SLinus Torvalds union fsf_qtcb_bottom {
5111da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_io      io;
5121da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_support support;
5131da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_config  config;
5141da177e4SLinus Torvalds 	struct fsf_qtcb_bottom_port port;
5151da177e4SLinus Torvalds };
5161da177e4SLinus Torvalds 
5171da177e4SLinus Torvalds struct fsf_qtcb {
5181da177e4SLinus Torvalds 	struct fsf_qtcb_prefix prefix;
5191da177e4SLinus Torvalds 	struct fsf_qtcb_header header;
5201da177e4SLinus Torvalds 	union  fsf_qtcb_bottom bottom;
5211da177e4SLinus Torvalds 	u8 log[FSF_QTCB_LOG_SIZE];
5221da177e4SLinus Torvalds } __attribute__ ((packed));
5231da177e4SLinus Torvalds 
5241da177e4SLinus Torvalds #endif				/* FSF_H */
525