blob: 974e07bd8e5927697cdc11f16a4fdc029785e637 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*****************************************************************************/
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/* */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018/* This file contains structures and definitions for IBM RPA (RS/6000 */
19/* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */
20/* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */
21/* commands between logical partitions. */
22/* */
23/* SRP Information Units (IUs) are sent on a "Command/Response Queue" (CRQ) */
24/* between partitions. The definitions in this file are architected, */
25/* and cannot be changed without breaking compatibility with other versions */
26/* of Linux and other operating systems (AIX, OS/400) that talk this protocol*/
27/* between logical partitions */
28/*****************************************************************************/
29#ifndef VIOSRP_H
30#define VIOSRP_H
FUJITA Tomonorief265672006-03-26 03:57:14 +090031#include <scsi/srp.h>
32
33#define SRP_VERSION "16.a"
34#define SRP_MAX_IU_LEN 256
Brian King126c5cc2009-06-08 16:19:08 -050035#define SRP_MAX_LOC_LEN 32
FUJITA Tomonorief265672006-03-26 03:57:14 +090036
37union srp_iu {
38 struct srp_login_req login_req;
39 struct srp_login_rsp login_rsp;
40 struct srp_login_rej login_rej;
41 struct srp_i_logout i_logout;
42 struct srp_t_logout t_logout;
43 struct srp_tsk_mgmt tsk_mgmt;
44 struct srp_cmd cmd;
45 struct srp_rsp rsp;
46 u8 reserved[SRP_MAX_IU_LEN];
47};
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
Tyrel Datwyler55c9b1e2016-02-10 19:32:23 -060049enum viosrp_crq_headers {
50 VIOSRP_CRQ_FREE = 0x00,
51 VIOSRP_CRQ_CMD_RSP = 0x80,
52 VIOSRP_CRQ_INIT_RSP = 0xC0,
53 VIOSRP_CRQ_XPORT_EVENT = 0xFF
54};
55
56enum viosrp_crq_init_formats {
57 VIOSRP_CRQ_INIT = 0x01,
58 VIOSRP_CRQ_INIT_COMPLETE = 0x02
59};
60
Linus Torvalds1da177e2005-04-16 15:20:36 -070061enum viosrp_crq_formats {
62 VIOSRP_SRP_FORMAT = 0x01,
63 VIOSRP_MAD_FORMAT = 0x02,
64 VIOSRP_OS400_FORMAT = 0x03,
65 VIOSRP_AIX_FORMAT = 0x04,
Tyrel Datwyler5de5f1f2016-02-10 19:32:22 -060066 VIOSRP_LINUX_FORMAT = 0x05,
67 VIOSRP_INLINE_FORMAT = 0x06
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
Brian Kingc3a3b552008-04-25 16:58:29 -050070enum viosrp_crq_status {
71 VIOSRP_OK = 0x0,
72 VIOSRP_NONRECOVERABLE_ERR = 0x1,
73 VIOSRP_VIOLATES_MAX_XFER = 0x2,
74 VIOSRP_PARTNER_PANIC = 0x3,
75 VIOSRP_DEVICE_BUSY = 0x8,
Brian Kingca616682008-05-19 10:27:56 -050076 VIOSRP_ADAPTER_FAIL = 0x10,
77 VIOSRP_OK2 = 0x99,
Brian Kingc3a3b552008-04-25 16:58:29 -050078};
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080struct viosrp_crq {
81 u8 valid; /* used by RPA */
82 u8 format; /* SCSI vs out-of-band */
83 u8 reserved;
84 u8 status; /* non-scsi failure? (e.g. DMA failure) */
Anton Blanchard72264eb2013-09-03 10:04:47 +100085 __be16 timeout; /* in seconds */
86 __be16 IU_length; /* in bytes */
87 __be64 IU_data_ptr; /* the TCE for transferring data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070088};
89
90/* MADs are Management requests above and beyond the IUs defined in the SRP
Bryant G. Ly88a678b2016-06-28 17:05:35 -050091 * standard.
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 */
93enum viosrp_mad_types {
94 VIOSRP_EMPTY_IU_TYPE = 0x01,
95 VIOSRP_ERROR_LOG_TYPE = 0x02,
96 VIOSRP_ADAPTER_INFO_TYPE = 0x03,
Brian King126c5cc2009-06-08 16:19:08 -050097 VIOSRP_CAPABILITIES_TYPE = 0x05,
Robert Jenningsc1988e312009-06-08 16:19:07 -050098 VIOSRP_ENABLE_FAST_FAIL = 0x08,
99};
100
101enum viosrp_mad_status {
102 VIOSRP_MAD_SUCCESS = 0x00,
103 VIOSRP_MAD_NOT_SUPPORTED = 0xF1,
104 VIOSRP_MAD_FAILED = 0xF7,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105};
106
Brian King126c5cc2009-06-08 16:19:08 -0500107enum viosrp_capability_type {
108 MIGRATION_CAPABILITIES = 0x01,
109 RESERVATION_CAPABILITIES = 0x02,
110};
111
112enum viosrp_capability_support {
113 SERVER_DOES_NOT_SUPPORTS_CAP = 0x0,
114 SERVER_SUPPORTS_CAP = 0x01,
115 SERVER_CAP_DATA = 0x02,
116};
117
118enum viosrp_reserve_type {
119 CLIENT_RESERVE_SCSI_2 = 0x01,
120};
121
122enum viosrp_capability_flag {
123 CLIENT_MIGRATED = 0x01,
124 CLIENT_RECONNECT = 0x02,
125 CAP_LIST_SUPPORTED = 0x04,
126 CAP_LIST_DATA = 0x08,
127};
128
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500129/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 * Common MAD header
131 */
132struct mad_common {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000133 __be32 type;
134 __be16 status;
135 __be16 length;
136 __be64 tag;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137};
138
139/*
140 * All SRP (and MAD) requests normally flow from the
141 * client to the server. There is no way for the server to send
142 * an asynchronous message back to the client. The Empty IU is used
143 * to hang out a meaningless request to the server so that it can respond
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500144 * asynchrouously with something like a SCSI AER
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 */
146struct viosrp_empty_iu {
147 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000148 __be64 buffer;
149 __be32 port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150};
151
152struct viosrp_error_log {
153 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000154 __be64 buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155};
156
157struct viosrp_adapter_info {
158 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000159 __be64 buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160};
161
Robert Jenningsc1988e312009-06-08 16:19:07 -0500162struct viosrp_fast_fail {
163 struct mad_common common;
164};
165
Brian King126c5cc2009-06-08 16:19:08 -0500166struct viosrp_capabilities {
167 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000168 __be64 buffer;
Brian King126c5cc2009-06-08 16:19:08 -0500169};
170
171struct mad_capability_common {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000172 __be32 cap_type;
173 __be16 length;
174 __be16 server_support;
Brian King126c5cc2009-06-08 16:19:08 -0500175};
176
177struct mad_reserve_cap {
178 struct mad_capability_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000179 __be32 type;
Brian King126c5cc2009-06-08 16:19:08 -0500180};
181
182struct mad_migration_cap {
183 struct mad_capability_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000184 __be32 ecl;
Brian King126c5cc2009-06-08 16:19:08 -0500185};
186
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500187struct capabilities {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000188 __be32 flags;
Brian King126c5cc2009-06-08 16:19:08 -0500189 char name[SRP_MAX_LOC_LEN];
190 char loc[SRP_MAX_LOC_LEN];
191 struct mad_migration_cap migration;
192 struct mad_reserve_cap reserve;
193};
194
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195union mad_iu {
196 struct viosrp_empty_iu empty_iu;
197 struct viosrp_error_log error_log;
198 struct viosrp_adapter_info adapter_info;
Robert Jenningsc1988e312009-06-08 16:19:07 -0500199 struct viosrp_fast_fail fast_fail;
Brian King126c5cc2009-06-08 16:19:08 -0500200 struct viosrp_capabilities capabilities;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201};
202
203union viosrp_iu {
204 union srp_iu srp;
205 union mad_iu mad;
206};
207
208struct mad_adapter_info_data {
209 char srp_version[8];
210 char partition_name[96];
Anton Blanchard72264eb2013-09-03 10:04:47 +1000211 __be32 partition_number;
Tyrel Datwyler45d8c302016-02-10 19:32:24 -0600212#define SRP_MAD_VERSION_1 1
Anton Blanchard72264eb2013-09-03 10:04:47 +1000213 __be32 mad_version;
Tyrel Datwyler45d8c302016-02-10 19:32:24 -0600214#define SRP_MAD_OS_LINUX 2
215#define SRP_MAD_OS_AIX 3
Anton Blanchard72264eb2013-09-03 10:04:47 +1000216 __be32 os_type;
217 __be32 port_max_txu[8]; /* per-port maximum transfer */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218};
219
220#endif