blob: c978133c83e37d8ee48e53c4596e21026b2e962b [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*****************************************************************************/
3/* srp.h -- SCSI RDMA Protocol definitions */
4/* */
5/* Written By: Colin Devilbis, IBM Corporation */
6/* */
7/* Copyright (C) 2003 IBM Corporation */
8/* */
Linus Torvalds1da177e2005-04-16 15:20:36 -07009/* */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010/* This file contains structures and definitions for IBM RPA (RS/6000 */
11/* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */
12/* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */
13/* commands between logical partitions. */
14/* */
15/* SRP Information Units (IUs) are sent on a "Command/Response Queue" (CRQ) */
16/* between partitions. The definitions in this file are architected, */
17/* and cannot be changed without breaking compatibility with other versions */
18/* of Linux and other operating systems (AIX, OS/400) that talk this protocol*/
19/* between logical partitions */
20/*****************************************************************************/
21#ifndef VIOSRP_H
22#define VIOSRP_H
FUJITA Tomonorief265672006-03-26 03:57:14 +090023#include <scsi/srp.h>
24
25#define SRP_VERSION "16.a"
26#define SRP_MAX_IU_LEN 256
Brian King126c5cc2009-06-08 16:19:08 -050027#define SRP_MAX_LOC_LEN 32
FUJITA Tomonorief265672006-03-26 03:57:14 +090028
29union srp_iu {
30 struct srp_login_req login_req;
31 struct srp_login_rsp login_rsp;
32 struct srp_login_rej login_rej;
33 struct srp_i_logout i_logout;
34 struct srp_t_logout t_logout;
35 struct srp_tsk_mgmt tsk_mgmt;
36 struct srp_cmd cmd;
37 struct srp_rsp rsp;
38 u8 reserved[SRP_MAX_IU_LEN];
39};
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Tyrel Datwyler55c9b1e2016-02-10 19:32:23 -060041enum viosrp_crq_headers {
42 VIOSRP_CRQ_FREE = 0x00,
43 VIOSRP_CRQ_CMD_RSP = 0x80,
44 VIOSRP_CRQ_INIT_RSP = 0xC0,
45 VIOSRP_CRQ_XPORT_EVENT = 0xFF
46};
47
48enum viosrp_crq_init_formats {
49 VIOSRP_CRQ_INIT = 0x01,
50 VIOSRP_CRQ_INIT_COMPLETE = 0x02
51};
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053enum viosrp_crq_formats {
54 VIOSRP_SRP_FORMAT = 0x01,
55 VIOSRP_MAD_FORMAT = 0x02,
56 VIOSRP_OS400_FORMAT = 0x03,
57 VIOSRP_AIX_FORMAT = 0x04,
Tyrel Datwyler5de5f1f2016-02-10 19:32:22 -060058 VIOSRP_LINUX_FORMAT = 0x05,
59 VIOSRP_INLINE_FORMAT = 0x06
Linus Torvalds1da177e2005-04-16 15:20:36 -070060};
61
Brian Kingc3a3b552008-04-25 16:58:29 -050062enum viosrp_crq_status {
63 VIOSRP_OK = 0x0,
64 VIOSRP_NONRECOVERABLE_ERR = 0x1,
65 VIOSRP_VIOLATES_MAX_XFER = 0x2,
66 VIOSRP_PARTNER_PANIC = 0x3,
67 VIOSRP_DEVICE_BUSY = 0x8,
Brian Kingca616682008-05-19 10:27:56 -050068 VIOSRP_ADAPTER_FAIL = 0x10,
69 VIOSRP_OK2 = 0x99,
Brian Kingc3a3b552008-04-25 16:58:29 -050070};
71
Linus Torvalds1da177e2005-04-16 15:20:36 -070072struct viosrp_crq {
73 u8 valid; /* used by RPA */
74 u8 format; /* SCSI vs out-of-band */
75 u8 reserved;
76 u8 status; /* non-scsi failure? (e.g. DMA failure) */
Anton Blanchard72264eb2013-09-03 10:04:47 +100077 __be16 timeout; /* in seconds */
78 __be16 IU_length; /* in bytes */
79 __be64 IU_data_ptr; /* the TCE for transferring data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070080};
81
82/* MADs are Management requests above and beyond the IUs defined in the SRP
Bryant G. Ly88a678b2016-06-28 17:05:35 -050083 * standard.
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 */
85enum viosrp_mad_types {
86 VIOSRP_EMPTY_IU_TYPE = 0x01,
87 VIOSRP_ERROR_LOG_TYPE = 0x02,
88 VIOSRP_ADAPTER_INFO_TYPE = 0x03,
Brian King126c5cc2009-06-08 16:19:08 -050089 VIOSRP_CAPABILITIES_TYPE = 0x05,
Robert Jenningsc1988e312009-06-08 16:19:07 -050090 VIOSRP_ENABLE_FAST_FAIL = 0x08,
91};
92
93enum viosrp_mad_status {
94 VIOSRP_MAD_SUCCESS = 0x00,
95 VIOSRP_MAD_NOT_SUPPORTED = 0xF1,
96 VIOSRP_MAD_FAILED = 0xF7,
Linus Torvalds1da177e2005-04-16 15:20:36 -070097};
98
Brian King126c5cc2009-06-08 16:19:08 -050099enum viosrp_capability_type {
100 MIGRATION_CAPABILITIES = 0x01,
101 RESERVATION_CAPABILITIES = 0x02,
102};
103
104enum viosrp_capability_support {
105 SERVER_DOES_NOT_SUPPORTS_CAP = 0x0,
106 SERVER_SUPPORTS_CAP = 0x01,
107 SERVER_CAP_DATA = 0x02,
108};
109
110enum viosrp_reserve_type {
111 CLIENT_RESERVE_SCSI_2 = 0x01,
112};
113
114enum viosrp_capability_flag {
115 CLIENT_MIGRATED = 0x01,
116 CLIENT_RECONNECT = 0x02,
117 CAP_LIST_SUPPORTED = 0x04,
118 CAP_LIST_DATA = 0x08,
119};
120
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500121/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 * Common MAD header
123 */
124struct mad_common {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000125 __be32 type;
126 __be16 status;
127 __be16 length;
128 __be64 tag;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129};
130
131/*
132 * All SRP (and MAD) requests normally flow from the
133 * client to the server. There is no way for the server to send
134 * an asynchronous message back to the client. The Empty IU is used
135 * to hang out a meaningless request to the server so that it can respond
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500136 * asynchrouously with something like a SCSI AER
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 */
138struct viosrp_empty_iu {
139 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000140 __be64 buffer;
141 __be32 port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142};
143
144struct viosrp_error_log {
145 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000146 __be64 buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147};
148
149struct viosrp_adapter_info {
150 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000151 __be64 buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152};
153
Robert Jenningsc1988e312009-06-08 16:19:07 -0500154struct viosrp_fast_fail {
155 struct mad_common common;
156};
157
Brian King126c5cc2009-06-08 16:19:08 -0500158struct viosrp_capabilities {
159 struct mad_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000160 __be64 buffer;
Brian King126c5cc2009-06-08 16:19:08 -0500161};
162
163struct mad_capability_common {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000164 __be32 cap_type;
165 __be16 length;
166 __be16 server_support;
Brian King126c5cc2009-06-08 16:19:08 -0500167};
168
169struct mad_reserve_cap {
170 struct mad_capability_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000171 __be32 type;
Brian King126c5cc2009-06-08 16:19:08 -0500172};
173
174struct mad_migration_cap {
175 struct mad_capability_common common;
Anton Blanchard72264eb2013-09-03 10:04:47 +1000176 __be32 ecl;
Brian King126c5cc2009-06-08 16:19:08 -0500177};
178
Bryant G. Ly88a678b2016-06-28 17:05:35 -0500179struct capabilities {
Anton Blanchard72264eb2013-09-03 10:04:47 +1000180 __be32 flags;
Brian King126c5cc2009-06-08 16:19:08 -0500181 char name[SRP_MAX_LOC_LEN];
182 char loc[SRP_MAX_LOC_LEN];
183 struct mad_migration_cap migration;
184 struct mad_reserve_cap reserve;
185};
186
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187union mad_iu {
188 struct viosrp_empty_iu empty_iu;
189 struct viosrp_error_log error_log;
190 struct viosrp_adapter_info adapter_info;
Robert Jenningsc1988e312009-06-08 16:19:07 -0500191 struct viosrp_fast_fail fast_fail;
Brian King126c5cc2009-06-08 16:19:08 -0500192 struct viosrp_capabilities capabilities;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193};
194
195union viosrp_iu {
196 union srp_iu srp;
197 union mad_iu mad;
198};
199
200struct mad_adapter_info_data {
201 char srp_version[8];
202 char partition_name[96];
Anton Blanchard72264eb2013-09-03 10:04:47 +1000203 __be32 partition_number;
Tyrel Datwyler45d8c302016-02-10 19:32:24 -0600204#define SRP_MAD_VERSION_1 1
Anton Blanchard72264eb2013-09-03 10:04:47 +1000205 __be32 mad_version;
Tyrel Datwyler45d8c302016-02-10 19:32:24 -0600206#define SRP_MAD_OS_LINUX 2
207#define SRP_MAD_OS_AIX 3
Anton Blanchard72264eb2013-09-03 10:04:47 +1000208 __be32 os_type;
209 __be32 port_max_txu[8]; /* per-port maximum transfer */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210};
211
212#endif