viosrp.h 6.6 KB

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