bfi.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFI_H__
  18. #define __BFI_H__
  19. #include <bfa_os_inc.h>
  20. #include <defs/bfa_defs_status.h>
  21. #pragma pack(1)
  22. /**
  23. * Msg header common to all msgs
  24. */
  25. struct bfi_mhdr_s {
  26. u8 msg_class; /* @ref bfi_mclass_t */
  27. u8 msg_id; /* msg opcode with in the class */
  28. union {
  29. struct {
  30. u8 rsvd;
  31. u8 lpu_id; /* msg destination */
  32. } h2i;
  33. u16 i2htok; /* token in msgs to host */
  34. } mtag;
  35. };
  36. #define bfi_h2i_set(_mh, _mc, _op, _lpuid) do { \
  37. (_mh).msg_class = (_mc); \
  38. (_mh).msg_id = (_op); \
  39. (_mh).mtag.h2i.lpu_id = (_lpuid); \
  40. } while (0)
  41. #define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
  42. (_mh).msg_class = (_mc); \
  43. (_mh).msg_id = (_op); \
  44. (_mh).mtag.i2htok = (_i2htok); \
  45. } while (0)
  46. /*
  47. * Message opcodes: 0-127 to firmware, 128-255 to host
  48. */
  49. #define BFI_I2H_OPCODE_BASE 128
  50. #define BFA_I2HM(_x) ((_x) + BFI_I2H_OPCODE_BASE)
  51. /**
  52. ****************************************************************************
  53. *
  54. * Scatter Gather Element and Page definition
  55. *
  56. ****************************************************************************
  57. */
  58. #define BFI_SGE_INLINE 1
  59. #define BFI_SGE_INLINE_MAX (BFI_SGE_INLINE + 1)
  60. /**
  61. * SG Flags
  62. */
  63. enum {
  64. BFI_SGE_DATA = 0, /* data address, not last */
  65. BFI_SGE_DATA_CPL = 1, /* data addr, last in current page */
  66. BFI_SGE_DATA_LAST = 3, /* data address, last */
  67. BFI_SGE_LINK = 2, /* link address */
  68. BFI_SGE_PGDLEN = 2, /* cumulative data length for page */
  69. };
  70. /**
  71. * DMA addresses
  72. */
  73. union bfi_addr_u {
  74. struct {
  75. u32 addr_lo;
  76. u32 addr_hi;
  77. } a32;
  78. };
  79. /**
  80. * Scatter Gather Element
  81. */
  82. struct bfi_sge_s {
  83. #ifdef __BIGENDIAN
  84. u32 flags:2,
  85. rsvd:2,
  86. sg_len:28;
  87. #else
  88. u32 sg_len:28,
  89. rsvd:2,
  90. flags:2;
  91. #endif
  92. union bfi_addr_u sga;
  93. };
  94. /**
  95. * Scatter Gather Page
  96. */
  97. #define BFI_SGPG_DATA_SGES 7
  98. #define BFI_SGPG_SGES_MAX (BFI_SGPG_DATA_SGES + 1)
  99. #define BFI_SGPG_RSVD_WD_LEN 8
  100. struct bfi_sgpg_s {
  101. struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
  102. u32 rsvd[BFI_SGPG_RSVD_WD_LEN];
  103. };
  104. /*
  105. * Large Message structure - 128 Bytes size Msgs
  106. */
  107. #define BFI_LMSG_SZ 128
  108. #define BFI_LMSG_PL_WSZ \
  109. ((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
  110. struct bfi_msg_s {
  111. struct bfi_mhdr_s mhdr;
  112. u32 pl[BFI_LMSG_PL_WSZ];
  113. };
  114. /**
  115. * Mailbox message structure
  116. */
  117. #define BFI_MBMSG_SZ 7
  118. struct bfi_mbmsg_s {
  119. struct bfi_mhdr_s mh;
  120. u32 pl[BFI_MBMSG_SZ];
  121. };
  122. /**
  123. * Message Classes
  124. */
  125. enum bfi_mclass {
  126. BFI_MC_IOC = 1, /* IO Controller (IOC) */
  127. BFI_MC_DIAG = 2, /* Diagnostic Msgs */
  128. BFI_MC_FLASH = 3, /* Flash message class */
  129. BFI_MC_CEE = 4,
  130. BFI_MC_FC_PORT = 5, /* FC port */
  131. BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
  132. BFI_MC_LL = 7, /* Link Layer */
  133. BFI_MC_UF = 8, /* Unsolicited frame receive */
  134. BFI_MC_FCXP = 9, /* FC Transport */
  135. BFI_MC_LPS = 10, /* lport fc login services */
  136. BFI_MC_RPORT = 11, /* Remote port */
  137. BFI_MC_ITNIM = 12, /* I-T nexus (Initiator mode) */
  138. BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */
  139. BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */
  140. BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */
  141. BFI_MC_IOIM = 16, /* IO (Initiator mode) */
  142. BFI_MC_IOIM_IOCOM = 17, /* good IO completion */
  143. BFI_MC_TSKIM = 18, /* Initiator Task management */
  144. BFI_MC_SBOOT = 19, /* SAN boot services */
  145. BFI_MC_IPFC = 20, /* IP over FC Msgs */
  146. BFI_MC_PORT = 21, /* Physical port */
  147. BFI_MC_MAX = 32
  148. };
  149. #define BFI_IOC_MAX_CQS 4
  150. #define BFI_IOC_MAX_CQS_ASIC 8
  151. #define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
  152. #pragma pack()
  153. #endif /* __BFI_H__ */