viosrp.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. u8 valid; /* used by RPA */
  67. u8 format; /* SCSI vs out-of-band */
  68. u8 reserved;
  69. u8 status; /* non-scsi failure? (e.g. DMA failure) */
  70. __be16 timeout; /* in seconds */
  71. __be16 IU_length; /* in bytes */
  72. __be64 IU_data_ptr; /* the TCE for transferring data */
  73. };
  74. /* MADs are Management requests above and beyond the IUs defined in the SRP
  75. * standard.
  76. */
  77. enum viosrp_mad_types {
  78. VIOSRP_EMPTY_IU_TYPE = 0x01,
  79. VIOSRP_ERROR_LOG_TYPE = 0x02,
  80. VIOSRP_ADAPTER_INFO_TYPE = 0x03,
  81. VIOSRP_CAPABILITIES_TYPE = 0x05,
  82. VIOSRP_ENABLE_FAST_FAIL = 0x08,
  83. };
  84. enum viosrp_mad_status {
  85. VIOSRP_MAD_SUCCESS = 0x00,
  86. VIOSRP_MAD_NOT_SUPPORTED = 0xF1,
  87. VIOSRP_MAD_FAILED = 0xF7,
  88. };
  89. enum viosrp_capability_type {
  90. MIGRATION_CAPABILITIES = 0x01,
  91. RESERVATION_CAPABILITIES = 0x02,
  92. };
  93. enum viosrp_capability_support {
  94. SERVER_DOES_NOT_SUPPORTS_CAP = 0x0,
  95. SERVER_SUPPORTS_CAP = 0x01,
  96. SERVER_CAP_DATA = 0x02,
  97. };
  98. enum viosrp_reserve_type {
  99. CLIENT_RESERVE_SCSI_2 = 0x01,
  100. };
  101. enum viosrp_capability_flag {
  102. CLIENT_MIGRATED = 0x01,
  103. CLIENT_RECONNECT = 0x02,
  104. CAP_LIST_SUPPORTED = 0x04,
  105. CAP_LIST_DATA = 0x08,
  106. };
  107. /*
  108. * Common MAD header
  109. */
  110. struct mad_common {
  111. __be32 type;
  112. __be16 status;
  113. __be16 length;
  114. __be64 tag;
  115. };
  116. /*
  117. * All SRP (and MAD) requests normally flow from the
  118. * client to the server. There is no way for the server to send
  119. * an asynchronous message back to the client. The Empty IU is used
  120. * to hang out a meaningless request to the server so that it can respond
  121. * asynchrouously with something like a SCSI AER
  122. */
  123. struct viosrp_empty_iu {
  124. struct mad_common common;
  125. __be64 buffer;
  126. __be32 port;
  127. };
  128. struct viosrp_error_log {
  129. struct mad_common common;
  130. __be64 buffer;
  131. };
  132. struct viosrp_adapter_info {
  133. struct mad_common common;
  134. __be64 buffer;
  135. };
  136. struct viosrp_fast_fail {
  137. struct mad_common common;
  138. };
  139. struct viosrp_capabilities {
  140. struct mad_common common;
  141. __be64 buffer;
  142. };
  143. struct mad_capability_common {
  144. __be32 cap_type;
  145. __be16 length;
  146. __be16 server_support;
  147. };
  148. struct mad_reserve_cap {
  149. struct mad_capability_common common;
  150. __be32 type;
  151. };
  152. struct mad_migration_cap {
  153. struct mad_capability_common common;
  154. __be32 ecl;
  155. };
  156. struct capabilities {
  157. __be32 flags;
  158. char name[SRP_MAX_LOC_LEN];
  159. char loc[SRP_MAX_LOC_LEN];
  160. struct mad_migration_cap migration;
  161. struct mad_reserve_cap reserve;
  162. };
  163. union mad_iu {
  164. struct viosrp_empty_iu empty_iu;
  165. struct viosrp_error_log error_log;
  166. struct viosrp_adapter_info adapter_info;
  167. struct viosrp_fast_fail fast_fail;
  168. struct viosrp_capabilities capabilities;
  169. };
  170. union viosrp_iu {
  171. union srp_iu srp;
  172. union mad_iu mad;
  173. };
  174. struct mad_adapter_info_data {
  175. char srp_version[8];
  176. char partition_name[96];
  177. __be32 partition_number;
  178. #define SRP_MAD_VERSION_1 1
  179. __be32 mad_version;
  180. #define SRP_MAD_OS_LINUX 2
  181. #define SRP_MAD_OS_AIX 3
  182. __be32 os_type;
  183. __be32 port_max_txu[8]; /* per-port maximum transfer */
  184. };
  185. #endif