Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. #ifndef _IPXE_FCNS_H
  2. #define _IPXE_FCNS_H
  3. /**
  4. * @file
  5. *
  6. * Fibre Channel name server lookups
  7. *
  8. */
  9. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  10. #include <stdint.h>
  11. #include <ipxe/fc.h>
  12. /** A Fibre Channel Common Transport header */
  13. struct fc_ct_header {
  14. /** Revision */
  15. uint8_t revision;
  16. /** Original requestor ID */
  17. struct fc_port_id in_id;
  18. /** Generic service type */
  19. uint8_t type;
  20. /** Generic service subtype */
  21. uint8_t subtype;
  22. /** Options */
  23. uint8_t options;
  24. /** Reserved */
  25. uint8_t reserved;
  26. /** Command/response code */
  27. uint16_t code;
  28. /** Maximum/residual size */
  29. uint16_t size;
  30. /** Fragment ID */
  31. uint8_t fragment;
  32. /** Reason code */
  33. uint8_t reason;
  34. /** Reason code explanation */
  35. uint8_t explanation;
  36. /** Vendor specific */
  37. uint8_t vendor;
  38. } __attribute__ (( packed ));
  39. /** Fibre Channel Common Transport revision */
  40. #define FC_CT_REVISION 1
  41. /** Fibre Channel generic service type */
  42. enum fc_gs_type {
  43. /** Directory service */
  44. FC_GS_TYPE_DS = 0xfc,
  45. };
  46. /** Fibre Channel generic service response codes */
  47. enum fc_gs_response_code {
  48. /** Accepted */
  49. FC_GS_ACCEPT = 0x8002,
  50. /** Rejected */
  51. FC_GS_REJECT = 0x8001,
  52. };
  53. /** Fibre Channel generic service rejection reason codes */
  54. enum fc_gs_reason_code {
  55. /** Invalid command code */
  56. FC_GS_BAD_COMMAND = 0x01,
  57. /** Invalid version level */
  58. FC_GS_BAD_VERSION = 0x02,
  59. /** Logical error */
  60. FC_GS_ERROR = 0x03,
  61. /** Invalid CT_IU size */
  62. FC_GS_BAD_SIZE = 0x04,
  63. /** Logical busy */
  64. FC_GS_BUSY = 0x05,
  65. /** Protocol error */
  66. FC_GS_EPROTO = 0x07,
  67. /** Unable to perform command request */
  68. FC_GS_UNABLE = 0x09,
  69. /** Command not supported */
  70. FC_GS_ENOTSUP = 0x0b,
  71. /** Server not available */
  72. FC_GS_UNAVAILABLE = 0x0d,
  73. /** Session could not be established */
  74. FC_GS_SESSION = 0x0e,
  75. };
  76. /** Fibre Channel directory service subtype */
  77. enum fc_ds_subtype {
  78. /** Name server */
  79. FC_DS_SUBTYPE_NAME = 0x02,
  80. };
  81. /** Fibre Channel name server commands */
  82. enum fc_ns_command_nibble {
  83. /** Get */
  84. FC_NS_GET = 0x1,
  85. /** Register */
  86. FC_NS_REGISTER = 0x2,
  87. /** De-register */
  88. FC_NS_DEREGISTER = 0x3,
  89. };
  90. /** Fibre Channel name server objects */
  91. enum fc_ns_object_nibble {
  92. /** Port ID */
  93. FC_NS_PORT_ID = 0x1,
  94. /** Port name */
  95. FC_NS_PORT_NAME = 0x2,
  96. /** Node name */
  97. FC_NS_NODE_NAME = 0x3,
  98. /** FC-4 types */
  99. FC_NS_FC4_TYPES = 0x7,
  100. /** Symbolic port name */
  101. FC_NS_SYM_PORT_NAME = 0x8,
  102. /** Symbolic node name */
  103. FC_NS_SYM_NODE_NAME = 0x9,
  104. /** FC-4 features */
  105. FC_NS_FC4_FEATURES = 0xf,
  106. };
  107. /** Construct Fibre Channel name server command code
  108. *
  109. * @v command Name server command
  110. * @v key Name server key
  111. * @v value Name server value
  112. * @ret code Name server command code
  113. */
  114. #define FC_NS_CODE( command, key, value ) \
  115. ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )
  116. /** Construct Fibre Channel name server "get" command code
  117. *
  118. * @v key Name server key
  119. * @v value Name server value to get
  120. * @ret code Name server command code
  121. */
  122. #define FC_NS_GET( key, value ) FC_NS_CODE ( FC_NS_GET, key, value )
  123. /** Construct Fibre Channel name server "register" command code
  124. *
  125. * @v key Name server key
  126. * @v value Name server value to register
  127. * @ret code Name server command code
  128. */
  129. #define FC_NS_REGISTER( key, value ) FC_NS_CODE ( FC_NS_REGISTER, key, value )
  130. /** Extract Fibre Channel name server command
  131. *
  132. * @v code Name server command code
  133. * @ret command Name server command
  134. */
  135. #define FC_NS_COMMAND( code ) ( ( (code) >> 8 ) & 0xf )
  136. /** Extract Fibre Channel name server key
  137. *
  138. * @v code Name server command code
  139. * @ret key Name server key
  140. */
  141. #define FC_NS_KEY( code ) ( ( (code) >> 4 ) & 0xf )
  142. /** Extract Fibre Channel name server value
  143. *
  144. * @v code Name server command code
  145. * @ret value NAme server value
  146. */
  147. #define FC_NS_VALUE( code ) ( ( (code) >> 0 ) & 0xf )
  148. /** A Fibre Channel name server port ID */
  149. struct fc_ns_port_id {
  150. /** Reserved */
  151. uint8_t reserved;
  152. /** Port ID */
  153. struct fc_port_id port_id;
  154. } __attribute__ (( packed ));
  155. /** A Fibre Channel name server GID_PN request */
  156. struct fc_ns_gid_pn_request {
  157. /** Common Transport header */
  158. struct fc_ct_header ct;
  159. /** Port name */
  160. struct fc_name port_wwn;
  161. } __attribute__ (( packed ));
  162. /** A Fibre Channel name server request */
  163. union fc_ns_request {
  164. /** Get ID by port name */
  165. struct fc_ns_gid_pn_request gid_pn;
  166. };
  167. /** A Fibre Channel name server rejection response */
  168. struct fc_ns_reject_response {
  169. /** Common Transport header */
  170. struct fc_ct_header ct;
  171. } __attribute__ (( packed ));
  172. /** A Fibre Channel name server GID_PN response */
  173. struct fc_ns_gid_pn_response {
  174. /** Common Transport header */
  175. struct fc_ct_header ct;
  176. /** Port ID */
  177. struct fc_ns_port_id port_id;
  178. } __attribute__ (( packed ));
  179. /** A Fibre Channel name server response */
  180. union fc_ns_response {
  181. /** Common Transport header */
  182. struct fc_ct_header ct;
  183. /** Rejection */
  184. struct fc_ns_reject_response reject;
  185. /** Get ID by port name */
  186. struct fc_ns_gid_pn_response gid_pn;
  187. };
  188. extern int fc_ns_query ( struct fc_peer *peer, struct fc_port *port,
  189. int ( * done ) ( struct fc_peer *peer,
  190. struct fc_port *port,
  191. struct fc_port_id *peer_port_id ) );
  192. #endif /* _IPXE_FCNS_H */