viosrp.h 6.1 KB

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