Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /*****************************************************************************/ |
| 2 | /* srp.h -- SCSI RDMA Protocol definitions */ |
| 3 | /* */ |
| 4 | /* Written By: Colin Devilbis, IBM Corporation */ |
| 5 | /* */ |
| 6 | /* Copyright (C) 2003 IBM Corporation */ |
| 7 | /* */ |
| 8 | /* This program is free software; you can redistribute it and/or modify */ |
| 9 | /* it under the terms of the GNU General Public License as published by */ |
| 10 | /* the Free Software Foundation; either version 2 of the License, or */ |
| 11 | /* (at your option) any later version. */ |
| 12 | /* */ |
| 13 | /* This program is distributed in the hope that it will be useful, */ |
| 14 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 | /* GNU General Public License for more details. */ |
| 17 | /* */ |
| 18 | /* You should have received a copy of the GNU General Public License */ |
| 19 | /* along with this program; if not, write to the Free Software */ |
| 20 | /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
| 21 | /* */ |
| 22 | /* */ |
| 23 | /* This file contains structures and definitions for IBM RPA (RS/6000 */ |
| 24 | /* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */ |
| 25 | /* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */ |
| 26 | /* commands between logical partitions. */ |
| 27 | /* */ |
| 28 | /* SRP Information Units (IUs) are sent on a "Command/Response Queue" (CRQ) */ |
| 29 | /* between partitions. The definitions in this file are architected, */ |
| 30 | /* and cannot be changed without breaking compatibility with other versions */ |
| 31 | /* of Linux and other operating systems (AIX, OS/400) that talk this protocol*/ |
| 32 | /* between logical partitions */ |
| 33 | /*****************************************************************************/ |
| 34 | #ifndef VIOSRP_H |
| 35 | #define VIOSRP_H |
FUJITA Tomonori | ef26567 | 2006-03-26 03:57:14 +0900 | [diff] [blame] | 36 | #include <scsi/srp.h> |
| 37 | |
| 38 | #define SRP_VERSION "16.a" |
| 39 | #define SRP_MAX_IU_LEN 256 |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 40 | #define SRP_MAX_LOC_LEN 32 |
FUJITA Tomonori | ef26567 | 2006-03-26 03:57:14 +0900 | [diff] [blame] | 41 | |
| 42 | union srp_iu { |
| 43 | struct srp_login_req login_req; |
| 44 | struct srp_login_rsp login_rsp; |
| 45 | struct srp_login_rej login_rej; |
| 46 | struct srp_i_logout i_logout; |
| 47 | struct srp_t_logout t_logout; |
| 48 | struct srp_tsk_mgmt tsk_mgmt; |
| 49 | struct srp_cmd cmd; |
| 50 | struct srp_rsp rsp; |
| 51 | u8 reserved[SRP_MAX_IU_LEN]; |
| 52 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Tyrel Datwyler | 55c9b1e | 2016-02-10 19:32:23 -0600 | [diff] [blame] | 54 | enum viosrp_crq_headers { |
| 55 | VIOSRP_CRQ_FREE = 0x00, |
| 56 | VIOSRP_CRQ_CMD_RSP = 0x80, |
| 57 | VIOSRP_CRQ_INIT_RSP = 0xC0, |
| 58 | VIOSRP_CRQ_XPORT_EVENT = 0xFF |
| 59 | }; |
| 60 | |
| 61 | enum viosrp_crq_init_formats { |
| 62 | VIOSRP_CRQ_INIT = 0x01, |
| 63 | VIOSRP_CRQ_INIT_COMPLETE = 0x02 |
| 64 | }; |
| 65 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | enum viosrp_crq_formats { |
| 67 | VIOSRP_SRP_FORMAT = 0x01, |
| 68 | VIOSRP_MAD_FORMAT = 0x02, |
| 69 | VIOSRP_OS400_FORMAT = 0x03, |
| 70 | VIOSRP_AIX_FORMAT = 0x04, |
Tyrel Datwyler | 5de5f1f | 2016-02-10 19:32:22 -0600 | [diff] [blame] | 71 | VIOSRP_LINUX_FORMAT = 0x05, |
| 72 | VIOSRP_INLINE_FORMAT = 0x06 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
Brian King | c3a3b55 | 2008-04-25 16:58:29 -0500 | [diff] [blame] | 75 | enum viosrp_crq_status { |
| 76 | VIOSRP_OK = 0x0, |
| 77 | VIOSRP_NONRECOVERABLE_ERR = 0x1, |
| 78 | VIOSRP_VIOLATES_MAX_XFER = 0x2, |
| 79 | VIOSRP_PARTNER_PANIC = 0x3, |
| 80 | VIOSRP_DEVICE_BUSY = 0x8, |
Brian King | ca61668 | 2008-05-19 10:27:56 -0500 | [diff] [blame] | 81 | VIOSRP_ADAPTER_FAIL = 0x10, |
| 82 | VIOSRP_OK2 = 0x99, |
Brian King | c3a3b55 | 2008-04-25 16:58:29 -0500 | [diff] [blame] | 83 | }; |
| 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | struct viosrp_crq { |
| 86 | u8 valid; /* used by RPA */ |
| 87 | u8 format; /* SCSI vs out-of-band */ |
| 88 | u8 reserved; |
| 89 | u8 status; /* non-scsi failure? (e.g. DMA failure) */ |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 90 | __be16 timeout; /* in seconds */ |
| 91 | __be16 IU_length; /* in bytes */ |
| 92 | __be64 IU_data_ptr; /* the TCE for transferring data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | /* MADs are Management requests above and beyond the IUs defined in the SRP |
| 96 | * standard. |
| 97 | */ |
| 98 | enum viosrp_mad_types { |
| 99 | VIOSRP_EMPTY_IU_TYPE = 0x01, |
| 100 | VIOSRP_ERROR_LOG_TYPE = 0x02, |
| 101 | VIOSRP_ADAPTER_INFO_TYPE = 0x03, |
Robert Jennings | c1988e31 | 2009-06-08 16:19:07 -0500 | [diff] [blame] | 102 | VIOSRP_HOST_CONFIG_TYPE = 0x04, |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 103 | VIOSRP_CAPABILITIES_TYPE = 0x05, |
Robert Jennings | c1988e31 | 2009-06-08 16:19:07 -0500 | [diff] [blame] | 104 | VIOSRP_ENABLE_FAST_FAIL = 0x08, |
| 105 | }; |
| 106 | |
| 107 | enum viosrp_mad_status { |
| 108 | VIOSRP_MAD_SUCCESS = 0x00, |
| 109 | VIOSRP_MAD_NOT_SUPPORTED = 0xF1, |
| 110 | VIOSRP_MAD_FAILED = 0xF7, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | }; |
| 112 | |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 113 | enum viosrp_capability_type { |
| 114 | MIGRATION_CAPABILITIES = 0x01, |
| 115 | RESERVATION_CAPABILITIES = 0x02, |
| 116 | }; |
| 117 | |
| 118 | enum viosrp_capability_support { |
| 119 | SERVER_DOES_NOT_SUPPORTS_CAP = 0x0, |
| 120 | SERVER_SUPPORTS_CAP = 0x01, |
| 121 | SERVER_CAP_DATA = 0x02, |
| 122 | }; |
| 123 | |
| 124 | enum viosrp_reserve_type { |
| 125 | CLIENT_RESERVE_SCSI_2 = 0x01, |
| 126 | }; |
| 127 | |
| 128 | enum viosrp_capability_flag { |
| 129 | CLIENT_MIGRATED = 0x01, |
| 130 | CLIENT_RECONNECT = 0x02, |
| 131 | CAP_LIST_SUPPORTED = 0x04, |
| 132 | CAP_LIST_DATA = 0x08, |
| 133 | }; |
| 134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | /* |
| 136 | * Common MAD header |
| 137 | */ |
| 138 | struct mad_common { |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 139 | __be32 type; |
| 140 | __be16 status; |
| 141 | __be16 length; |
| 142 | __be64 tag; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | }; |
| 144 | |
| 145 | /* |
| 146 | * All SRP (and MAD) requests normally flow from the |
| 147 | * client to the server. There is no way for the server to send |
| 148 | * an asynchronous message back to the client. The Empty IU is used |
| 149 | * to hang out a meaningless request to the server so that it can respond |
| 150 | * asynchrouously with something like a SCSI AER |
| 151 | */ |
| 152 | struct viosrp_empty_iu { |
| 153 | struct mad_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 154 | __be64 buffer; |
| 155 | __be32 port; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | }; |
| 157 | |
| 158 | struct viosrp_error_log { |
| 159 | struct mad_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 160 | __be64 buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | struct viosrp_adapter_info { |
| 164 | struct mad_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 165 | __be64 buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | struct viosrp_host_config { |
| 169 | struct mad_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 170 | __be64 buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
Robert Jennings | c1988e31 | 2009-06-08 16:19:07 -0500 | [diff] [blame] | 173 | struct viosrp_fast_fail { |
| 174 | struct mad_common common; |
| 175 | }; |
| 176 | |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 177 | struct viosrp_capabilities { |
| 178 | struct mad_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 179 | __be64 buffer; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | struct mad_capability_common { |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 183 | __be32 cap_type; |
| 184 | __be16 length; |
| 185 | __be16 server_support; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | struct mad_reserve_cap { |
| 189 | struct mad_capability_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 190 | __be32 type; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | struct mad_migration_cap { |
| 194 | struct mad_capability_common common; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 195 | __be32 ecl; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | struct capabilities{ |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 199 | __be32 flags; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 200 | char name[SRP_MAX_LOC_LEN]; |
| 201 | char loc[SRP_MAX_LOC_LEN]; |
| 202 | struct mad_migration_cap migration; |
| 203 | struct mad_reserve_cap reserve; |
| 204 | }; |
| 205 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | union mad_iu { |
| 207 | struct viosrp_empty_iu empty_iu; |
| 208 | struct viosrp_error_log error_log; |
| 209 | struct viosrp_adapter_info adapter_info; |
| 210 | struct viosrp_host_config host_config; |
Robert Jennings | c1988e31 | 2009-06-08 16:19:07 -0500 | [diff] [blame] | 211 | struct viosrp_fast_fail fast_fail; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 212 | struct viosrp_capabilities capabilities; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | }; |
| 214 | |
| 215 | union viosrp_iu { |
| 216 | union srp_iu srp; |
| 217 | union mad_iu mad; |
| 218 | }; |
| 219 | |
| 220 | struct mad_adapter_info_data { |
| 221 | char srp_version[8]; |
| 222 | char partition_name[96]; |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 223 | __be32 partition_number; |
Tyrel Datwyler | 45d8c30 | 2016-02-10 19:32:24 -0600 | [diff] [blame^] | 224 | #define SRP_MAD_VERSION_1 1 |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 225 | __be32 mad_version; |
Tyrel Datwyler | 45d8c30 | 2016-02-10 19:32:24 -0600 | [diff] [blame^] | 226 | #define SRP_MAD_OS_LINUX 2 |
| 227 | #define SRP_MAD_OS_AIX 3 |
Anton Blanchard | 72264eb | 2013-09-03 10:04:47 +1000 | [diff] [blame] | 228 | __be32 os_type; |
| 229 | __be32 port_max_txu[8]; /* per-port maximum transfer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | #endif |