blob: f5a9c26d1da84dd5e2be1266240929400beb981b [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/* */
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 Tomonorief265672006-03-26 03:57:14 +090036#include <scsi/srp.h>
37
38#define SRP_VERSION "16.a"
39#define SRP_MAX_IU_LEN 256
40
41union srp_iu {
42 struct srp_login_req login_req;
43 struct srp_login_rsp login_rsp;
44 struct srp_login_rej login_rej;
45 struct srp_i_logout i_logout;
46 struct srp_t_logout t_logout;
47 struct srp_tsk_mgmt tsk_mgmt;
48 struct srp_cmd cmd;
49 struct srp_rsp rsp;
50 u8 reserved[SRP_MAX_IU_LEN];
51};
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53enum viosrp_crq_formats {
54 VIOSRP_SRP_FORMAT = 0x01,
55 VIOSRP_MAD_FORMAT = 0x02,
56 VIOSRP_OS400_FORMAT = 0x03,
57 VIOSRP_AIX_FORMAT = 0x04,
58 VIOSRP_LINUX_FORMAT = 0x06,
59 VIOSRP_INLINE_FORMAT = 0x07
60};
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) */
77 u16 timeout; /* in seconds */
78 u16 IU_length; /* in bytes */
79 u64 IU_data_ptr; /* the TCE for transferring data */
80};
81
82/* MADs are Management requests above and beyond the IUs defined in the SRP
83 * standard.
84 */
85enum viosrp_mad_types {
86 VIOSRP_EMPTY_IU_TYPE = 0x01,
87 VIOSRP_ERROR_LOG_TYPE = 0x02,
88 VIOSRP_ADAPTER_INFO_TYPE = 0x03,
Robert Jenningsc1988e32009-06-08 16:19:07 -050089 VIOSRP_HOST_CONFIG_TYPE = 0x04,
90 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
99/*
100 * Common MAD header
101 */
102struct mad_common {
103 u32 type;
104 u16 status;
105 u16 length;
106 u64 tag;
107};
108
109/*
110 * All SRP (and MAD) requests normally flow from the
111 * client to the server. There is no way for the server to send
112 * an asynchronous message back to the client. The Empty IU is used
113 * to hang out a meaningless request to the server so that it can respond
114 * asynchrouously with something like a SCSI AER
115 */
116struct viosrp_empty_iu {
117 struct mad_common common;
118 u64 buffer;
119 u32 port;
120};
121
122struct viosrp_error_log {
123 struct mad_common common;
124 u64 buffer;
125};
126
127struct viosrp_adapter_info {
128 struct mad_common common;
129 u64 buffer;
130};
131
132struct viosrp_host_config {
133 struct mad_common common;
134 u64 buffer;
135};
136
Robert Jenningsc1988e32009-06-08 16:19:07 -0500137struct viosrp_fast_fail {
138 struct mad_common common;
139};
140
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141union mad_iu {
142 struct viosrp_empty_iu empty_iu;
143 struct viosrp_error_log error_log;
144 struct viosrp_adapter_info adapter_info;
145 struct viosrp_host_config host_config;
Robert Jenningsc1988e32009-06-08 16:19:07 -0500146 struct viosrp_fast_fail fast_fail;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147};
148
149union viosrp_iu {
150 union srp_iu srp;
151 union mad_iu mad;
152};
153
154struct mad_adapter_info_data {
155 char srp_version[8];
156 char partition_name[96];
157 u32 partition_number;
158 u32 mad_version;
159 u32 os_type;
160 u32 port_max_txu[8]; /* per-port maximum transfer */
161};
162
163#endif