Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*****************************************************************************/
0003 /* srp.h -- SCSI RDMA Protocol definitions                                   */
0004 /*                                                                           */
0005 /* Written By: Colin Devilbis, IBM Corporation                               */
0006 /*                                                                           */
0007 /* Copyright (C) 2003 IBM Corporation                                        */
0008 /*                                                                           */
0009 /*                                                                           */
0010 /* This file contains structures and definitions for IBM RPA (RS/6000        */
0011 /* platform architecture) implementation of the SRP (SCSI RDMA Protocol)     */
0012 /* standard.  SRP is used on IBM iSeries and pSeries platforms to send SCSI  */
0013 /* commands between logical partitions.                                      */
0014 /*                                                                           */
0015 /* SRP Information Units (IUs) are sent on a "Command/Response Queue" (CRQ)  */
0016 /* between partitions.  The definitions in this file are architected,        */
0017 /* and cannot be changed without breaking compatibility with other versions  */
0018 /* of Linux and other operating systems (AIX, OS/400) that talk this protocol*/
0019 /* between logical partitions                                                */
0020 /*****************************************************************************/
0021 #ifndef VIOSRP_H
0022 #define VIOSRP_H
0023 #include <scsi/srp.h>
0024 
0025 #define SRP_VERSION "16.a"
0026 #define SRP_MAX_IU_LEN  256
0027 #define SRP_MAX_LOC_LEN 32
0028 
0029 union srp_iu {
0030     struct srp_login_req login_req;
0031     struct srp_login_rsp login_rsp;
0032     struct srp_login_rej login_rej;
0033     struct srp_i_logout i_logout;
0034     struct srp_t_logout t_logout;
0035     struct srp_tsk_mgmt tsk_mgmt;
0036     struct srp_cmd cmd;
0037     struct srp_rsp rsp;
0038     u8 reserved[SRP_MAX_IU_LEN];
0039 };
0040 
0041 enum viosrp_crq_headers {
0042     VIOSRP_CRQ_FREE = 0x00,
0043     VIOSRP_CRQ_CMD_RSP = 0x80,
0044     VIOSRP_CRQ_INIT_RSP = 0xC0,
0045     VIOSRP_CRQ_XPORT_EVENT = 0xFF
0046 };
0047 
0048 enum viosrp_crq_init_formats {
0049     VIOSRP_CRQ_INIT = 0x01,
0050     VIOSRP_CRQ_INIT_COMPLETE = 0x02
0051 };
0052 
0053 enum viosrp_crq_formats {
0054     VIOSRP_SRP_FORMAT = 0x01,
0055     VIOSRP_MAD_FORMAT = 0x02,
0056     VIOSRP_OS400_FORMAT = 0x03,
0057     VIOSRP_AIX_FORMAT = 0x04,
0058     VIOSRP_LINUX_FORMAT = 0x05,
0059     VIOSRP_INLINE_FORMAT = 0x06
0060 };
0061 
0062 enum viosrp_crq_status {
0063     VIOSRP_OK = 0x0,
0064     VIOSRP_NONRECOVERABLE_ERR = 0x1,
0065     VIOSRP_VIOLATES_MAX_XFER = 0x2,
0066     VIOSRP_PARTNER_PANIC = 0x3,
0067     VIOSRP_DEVICE_BUSY = 0x8,
0068     VIOSRP_ADAPTER_FAIL = 0x10,
0069     VIOSRP_OK2 = 0x99,
0070 };
0071 
0072 struct viosrp_crq {
0073     union {
0074         __be64 high;            /* High 64 bits */
0075         struct {
0076             u8 valid;       /* used by RPA */
0077             u8 format;      /* SCSI vs out-of-band */
0078             u8 reserved;
0079             u8 status;      /* non-scsi failure? (e.g. DMA failure) */
0080             __be16 timeout;     /* in seconds */
0081             __be16 IU_length;   /* in bytes */
0082         };
0083     };
0084     __be64 IU_data_ptr; /* the TCE for transferring data */
0085 };
0086 
0087 /* MADs are Management requests above and beyond the IUs defined in the SRP
0088  * standard.
0089  */
0090 enum viosrp_mad_types {
0091     VIOSRP_EMPTY_IU_TYPE = 0x01,
0092     VIOSRP_ERROR_LOG_TYPE = 0x02,
0093     VIOSRP_ADAPTER_INFO_TYPE = 0x03,
0094     VIOSRP_CAPABILITIES_TYPE = 0x05,
0095     VIOSRP_ENABLE_FAST_FAIL = 0x08,
0096 };
0097 
0098 enum viosrp_mad_status {
0099     VIOSRP_MAD_SUCCESS = 0x00,
0100     VIOSRP_MAD_NOT_SUPPORTED = 0xF1,
0101     VIOSRP_MAD_FAILED = 0xF7,
0102 };
0103 
0104 enum viosrp_capability_type {
0105     MIGRATION_CAPABILITIES = 0x01,
0106     RESERVATION_CAPABILITIES = 0x02,
0107 };
0108 
0109 enum viosrp_capability_support {
0110     SERVER_DOES_NOT_SUPPORTS_CAP = 0x0,
0111     SERVER_SUPPORTS_CAP = 0x01,
0112     SERVER_CAP_DATA = 0x02,
0113 };
0114 
0115 enum viosrp_reserve_type {
0116     CLIENT_RESERVE_SCSI_2 = 0x01,
0117 };
0118 
0119 enum viosrp_capability_flag {
0120     CLIENT_MIGRATED = 0x01,
0121     CLIENT_RECONNECT = 0x02,
0122     CAP_LIST_SUPPORTED = 0x04,
0123     CAP_LIST_DATA = 0x08,
0124 };
0125 
0126 /*
0127  * Common MAD header
0128  */
0129 struct mad_common {
0130     __be32 type;
0131     __be16 status;
0132     __be16 length;
0133     __be64 tag;
0134 };
0135 
0136 /*
0137  * All SRP (and MAD) requests normally flow from the
0138  * client to the server.  There is no way for the server to send
0139  * an asynchronous message back to the client.  The Empty IU is used
0140  * to hang out a meaningless request to the server so that it can respond
0141  * asynchrouously with something like a SCSI AER
0142  */
0143 struct viosrp_empty_iu {
0144     struct mad_common common;
0145     __be64 buffer;
0146     __be32 port;
0147 };
0148 
0149 struct viosrp_error_log {
0150     struct mad_common common;
0151     __be64 buffer;
0152 };
0153 
0154 struct viosrp_adapter_info {
0155     struct mad_common common;
0156     __be64 buffer;
0157 };
0158 
0159 struct viosrp_fast_fail {
0160     struct mad_common common;
0161 };
0162 
0163 struct viosrp_capabilities {
0164     struct mad_common common;
0165     __be64 buffer;
0166 };
0167 
0168 struct mad_capability_common {
0169     __be32 cap_type;
0170     __be16 length;
0171     __be16 server_support;
0172 };
0173 
0174 struct mad_reserve_cap {
0175     struct mad_capability_common common;
0176     __be32 type;
0177 };
0178 
0179 struct mad_migration_cap {
0180     struct mad_capability_common common;
0181     __be32 ecl;
0182 };
0183 
0184 struct capabilities {
0185     __be32 flags;
0186     char name[SRP_MAX_LOC_LEN];
0187     char loc[SRP_MAX_LOC_LEN];
0188     struct mad_migration_cap migration;
0189     struct mad_reserve_cap reserve;
0190 };
0191 
0192 union mad_iu {
0193     struct viosrp_empty_iu empty_iu;
0194     struct viosrp_error_log error_log;
0195     struct viosrp_adapter_info adapter_info;
0196     struct viosrp_fast_fail fast_fail;
0197     struct viosrp_capabilities capabilities;
0198 };
0199 
0200 union viosrp_iu {
0201     union srp_iu srp;
0202     union mad_iu mad;
0203 };
0204 
0205 struct mad_adapter_info_data {
0206     char srp_version[8];
0207     char partition_name[96];
0208     __be32 partition_number;
0209 #define SRP_MAD_VERSION_1 1
0210     __be32 mad_version;
0211 #define SRP_MAD_OS_LINUX 2
0212 #define SRP_MAD_OS_AIX 3
0213     __be32 os_type;
0214     __be32 port_max_txu[8]; /* per-port maximum transfer */
0215 };
0216 
0217 #endif