viosrp.h 5.5 KB

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