viosrp.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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
  36. #include <scsi/srp.h>
  37. #define SRP_VERSION "16.a"
  38. #define SRP_MAX_IU_LEN 256
  39. #define SRP_MAX_LOC_LEN 32
  40. union srp_iu {
  41. struct srp_login_req login_req;
  42. struct srp_login_rsp login_rsp;
  43. struct srp_login_rej login_rej;
  44. struct srp_i_logout i_logout;
  45. struct srp_t_logout t_logout;
  46. struct srp_tsk_mgmt tsk_mgmt;
  47. struct srp_cmd cmd;
  48. struct srp_rsp rsp;
  49. u8 reserved[SRP_MAX_IU_LEN];
  50. };
  51. enum viosrp_crq_formats {
  52. VIOSRP_SRP_FORMAT = 0x01,
  53. VIOSRP_MAD_FORMAT = 0x02,
  54. VIOSRP_OS400_FORMAT = 0x03,
  55. VIOSRP_AIX_FORMAT = 0x04,
  56. VIOSRP_LINUX_FORMAT = 0x06,
  57. VIOSRP_INLINE_FORMAT = 0x07
  58. };
  59. enum viosrp_crq_status {
  60. VIOSRP_OK = 0x0,
  61. VIOSRP_NONRECOVERABLE_ERR = 0x1,
  62. VIOSRP_VIOLATES_MAX_XFER = 0x2,
  63. VIOSRP_PARTNER_PANIC = 0x3,
  64. VIOSRP_DEVICE_BUSY = 0x8,
  65. VIOSRP_ADAPTER_FAIL = 0x10,
  66. VIOSRP_OK2 = 0x99,
  67. };
  68. struct viosrp_crq {
  69. u8 valid; /* used by RPA */
  70. u8 format; /* SCSI vs out-of-band */
  71. u8 reserved;
  72. u8 status; /* non-scsi failure? (e.g. DMA failure) */
  73. __be16 timeout; /* in seconds */
  74. __be16 IU_length; /* in bytes */
  75. __be64 IU_data_ptr; /* the TCE for transferring data */
  76. };
  77. /* MADs are Management requests above and beyond the IUs defined in the SRP
  78. * standard.
  79. */
  80. enum viosrp_mad_types {
  81. VIOSRP_EMPTY_IU_TYPE = 0x01,
  82. VIOSRP_ERROR_LOG_TYPE = 0x02,
  83. VIOSRP_ADAPTER_INFO_TYPE = 0x03,
  84. VIOSRP_HOST_CONFIG_TYPE = 0x04,
  85. VIOSRP_CAPABILITIES_TYPE = 0x05,
  86. VIOSRP_ENABLE_FAST_FAIL = 0x08,
  87. };
  88. enum viosrp_mad_status {
  89. VIOSRP_MAD_SUCCESS = 0x00,
  90. VIOSRP_MAD_NOT_SUPPORTED = 0xF1,
  91. VIOSRP_MAD_FAILED = 0xF7,
  92. };
  93. enum viosrp_capability_type {
  94. MIGRATION_CAPABILITIES = 0x01,
  95. RESERVATION_CAPABILITIES = 0x02,
  96. };
  97. enum viosrp_capability_support {
  98. SERVER_DOES_NOT_SUPPORTS_CAP = 0x0,
  99. SERVER_SUPPORTS_CAP = 0x01,
  100. SERVER_CAP_DATA = 0x02,
  101. };
  102. enum viosrp_reserve_type {
  103. CLIENT_RESERVE_SCSI_2 = 0x01,
  104. };
  105. enum viosrp_capability_flag {
  106. CLIENT_MIGRATED = 0x01,
  107. CLIENT_RECONNECT = 0x02,
  108. CAP_LIST_SUPPORTED = 0x04,
  109. CAP_LIST_DATA = 0x08,
  110. };
  111. /*
  112. * Common MAD header
  113. */
  114. struct mad_common {
  115. __be32 type;
  116. __be16 status;
  117. __be16 length;
  118. __be64 tag;
  119. };
  120. /*
  121. * All SRP (and MAD) requests normally flow from the
  122. * client to the server. There is no way for the server to send
  123. * an asynchronous message back to the client. The Empty IU is used
  124. * to hang out a meaningless request to the server so that it can respond
  125. * asynchrouously with something like a SCSI AER
  126. */
  127. struct viosrp_empty_iu {
  128. struct mad_common common;
  129. __be64 buffer;
  130. __be32 port;
  131. };
  132. struct viosrp_error_log {
  133. struct mad_common common;
  134. __be64 buffer;
  135. };
  136. struct viosrp_adapter_info {
  137. struct mad_common common;
  138. __be64 buffer;
  139. };
  140. struct viosrp_host_config {
  141. struct mad_common common;
  142. __be64 buffer;
  143. };
  144. struct viosrp_fast_fail {
  145. struct mad_common common;
  146. };
  147. struct viosrp_capabilities {
  148. struct mad_common common;
  149. __be64 buffer;
  150. };
  151. struct mad_capability_common {
  152. __be32 cap_type;
  153. __be16 length;
  154. __be16 server_support;
  155. };
  156. struct mad_reserve_cap {
  157. struct mad_capability_common common;
  158. __be32 type;
  159. };
  160. struct mad_migration_cap {
  161. struct mad_capability_common common;
  162. __be32 ecl;
  163. };
  164. struct capabilities{
  165. __be32 flags;
  166. char name[SRP_MAX_LOC_LEN];
  167. char loc[SRP_MAX_LOC_LEN];
  168. struct mad_migration_cap migration;
  169. struct mad_reserve_cap reserve;
  170. };
  171. union mad_iu {
  172. struct viosrp_empty_iu empty_iu;
  173. struct viosrp_error_log error_log;
  174. struct viosrp_adapter_info adapter_info;
  175. struct viosrp_host_config host_config;
  176. struct viosrp_fast_fail fast_fail;
  177. struct viosrp_capabilities capabilities;
  178. };
  179. union viosrp_iu {
  180. union srp_iu srp;
  181. union mad_iu mad;
  182. };
  183. struct mad_adapter_info_data {
  184. char srp_version[8];
  185. char partition_name[96];
  186. __be32 partition_number;
  187. __be32 mad_version;
  188. __be32 os_type;
  189. __be32 port_max_txu[8]; /* per-port maximum transfer */
  190. };
  191. #endif