hcp_if.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * Firmware Infiniband Interface code for POWER
  5. *
  6. * Authors: Christoph Raisch <raisch@de.ibm.com>
  7. * Hoang-Nam Nguyen <hnguyen@de.ibm.com>
  8. * Gerd Bayer <gerd.bayer@de.ibm.com>
  9. * Waleri Fomin <fomin@de.ibm.com>
  10. *
  11. * Copyright (c) 2005 IBM Corporation
  12. *
  13. * All rights reserved.
  14. *
  15. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  16. * BSD.
  17. *
  18. * OpenIB BSD License
  19. *
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions are met:
  22. *
  23. * Redistributions of source code must retain the above copyright notice, this
  24. * list of conditions and the following disclaimer.
  25. *
  26. * Redistributions in binary form must reproduce the above copyright notice,
  27. * this list of conditions and the following disclaimer in the documentation
  28. * and/or other materials
  29. * provided with the distribution.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  35. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  38. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  39. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGE.
  42. */
  43. #ifndef __HCP_IF_H__
  44. #define __HCP_IF_H__
  45. #include "ehca_classes.h"
  46. #include "ehca_tools.h"
  47. #include "hipz_hw.h"
  48. /*
  49. * hipz_h_alloc_resource_eq allocates EQ resources in HW and FW, initalize
  50. * resources, create the empty EQPT (ring).
  51. */
  52. u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
  53. struct ehca_pfeq *pfeq,
  54. const u32 neq_control,
  55. const u32 number_of_entries,
  56. struct ipz_eq_handle *eq_handle,
  57. u32 * act_nr_of_entries,
  58. u32 * act_pages,
  59. u32 * eq_ist);
  60. u64 hipz_h_reset_event(const struct ipz_adapter_handle adapter_handle,
  61. struct ipz_eq_handle eq_handle,
  62. const u64 event_mask);
  63. /*
  64. * hipz_h_allocate_resource_cq allocates CQ resources in HW and FW, initialize
  65. * resources, create the empty CQPT (ring).
  66. */
  67. u64 hipz_h_alloc_resource_cq(const struct ipz_adapter_handle adapter_handle,
  68. struct ehca_cq *cq,
  69. struct ehca_alloc_cq_parms *param);
  70. /*
  71. * hipz_h_alloc_resource_qp allocates QP resources in HW and FW,
  72. * initialize resources, create empty QPPTs (2 rings).
  73. */
  74. u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
  75. struct ehca_qp *qp,
  76. struct ehca_alloc_qp_parms *parms);
  77. u64 hipz_h_query_port(const struct ipz_adapter_handle adapter_handle,
  78. const u8 port_id,
  79. struct hipz_query_port *query_port_response_block);
  80. u64 hipz_h_query_hca(const struct ipz_adapter_handle adapter_handle,
  81. struct hipz_query_hca *query_hca_rblock);
  82. /*
  83. * hipz_h_register_rpage internal function in hcp_if.h for all
  84. * hcp_H_REGISTER_RPAGE calls.
  85. */
  86. u64 hipz_h_register_rpage(const struct ipz_adapter_handle adapter_handle,
  87. const u8 pagesize,
  88. const u8 queue_type,
  89. const u64 resource_handle,
  90. const u64 logical_address_of_page,
  91. u64 count);
  92. u64 hipz_h_register_rpage_eq(const struct ipz_adapter_handle adapter_handle,
  93. const struct ipz_eq_handle eq_handle,
  94. struct ehca_pfeq *pfeq,
  95. const u8 pagesize,
  96. const u8 queue_type,
  97. const u64 logical_address_of_page,
  98. const u64 count);
  99. u64 hipz_h_query_int_state(const struct ipz_adapter_handle
  100. hcp_adapter_handle,
  101. u32 ist);
  102. u64 hipz_h_register_rpage_cq(const struct ipz_adapter_handle adapter_handle,
  103. const struct ipz_cq_handle cq_handle,
  104. struct ehca_pfcq *pfcq,
  105. const u8 pagesize,
  106. const u8 queue_type,
  107. const u64 logical_address_of_page,
  108. const u64 count,
  109. const struct h_galpa gal);
  110. u64 hipz_h_register_rpage_qp(const struct ipz_adapter_handle adapter_handle,
  111. const struct ipz_qp_handle qp_handle,
  112. struct ehca_pfqp *pfqp,
  113. const u8 pagesize,
  114. const u8 queue_type,
  115. const u64 logical_address_of_page,
  116. const u64 count,
  117. const struct h_galpa galpa);
  118. u64 hipz_h_disable_and_get_wqe(const struct ipz_adapter_handle adapter_handle,
  119. const struct ipz_qp_handle qp_handle,
  120. struct ehca_pfqp *pfqp,
  121. void **log_addr_next_sq_wqe_tb_processed,
  122. void **log_addr_next_rq_wqe_tb_processed,
  123. int dis_and_get_function_code);
  124. enum hcall_sigt {
  125. HCALL_SIGT_NO_CQE = 0,
  126. HCALL_SIGT_BY_WQE = 1,
  127. HCALL_SIGT_EVERY = 2
  128. };
  129. u64 hipz_h_modify_qp(const struct ipz_adapter_handle adapter_handle,
  130. const struct ipz_qp_handle qp_handle,
  131. struct ehca_pfqp *pfqp,
  132. const u64 update_mask,
  133. struct hcp_modify_qp_control_block *mqpcb,
  134. struct h_galpa gal);
  135. u64 hipz_h_query_qp(const struct ipz_adapter_handle adapter_handle,
  136. const struct ipz_qp_handle qp_handle,
  137. struct ehca_pfqp *pfqp,
  138. struct hcp_modify_qp_control_block *qqpcb,
  139. struct h_galpa gal);
  140. u64 hipz_h_destroy_qp(const struct ipz_adapter_handle adapter_handle,
  141. struct ehca_qp *qp);
  142. u64 hipz_h_define_aqp0(const struct ipz_adapter_handle adapter_handle,
  143. const struct ipz_qp_handle qp_handle,
  144. struct h_galpa gal,
  145. u32 port);
  146. u64 hipz_h_define_aqp1(const struct ipz_adapter_handle adapter_handle,
  147. const struct ipz_qp_handle qp_handle,
  148. struct h_galpa gal,
  149. u32 port, u32 * pma_qp_nr,
  150. u32 * bma_qp_nr);
  151. u64 hipz_h_attach_mcqp(const struct ipz_adapter_handle adapter_handle,
  152. const struct ipz_qp_handle qp_handle,
  153. struct h_galpa gal,
  154. u16 mcg_dlid,
  155. u64 subnet_prefix, u64 interface_id);
  156. u64 hipz_h_detach_mcqp(const struct ipz_adapter_handle adapter_handle,
  157. const struct ipz_qp_handle qp_handle,
  158. struct h_galpa gal,
  159. u16 mcg_dlid,
  160. u64 subnet_prefix, u64 interface_id);
  161. u64 hipz_h_destroy_cq(const struct ipz_adapter_handle adapter_handle,
  162. struct ehca_cq *cq,
  163. u8 force_flag);
  164. u64 hipz_h_destroy_eq(const struct ipz_adapter_handle adapter_handle,
  165. struct ehca_eq *eq);
  166. /*
  167. * hipz_h_alloc_resource_mr allocates MR resources in HW and FW, initialize
  168. * resources.
  169. */
  170. u64 hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
  171. const struct ehca_mr *mr,
  172. const u64 vaddr,
  173. const u64 length,
  174. const u32 access_ctrl,
  175. const struct ipz_pd pd,
  176. struct ehca_mr_hipzout_parms *outparms);
  177. /* hipz_h_register_rpage_mr registers MR resource pages in HW and FW */
  178. u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle,
  179. const struct ehca_mr *mr,
  180. const u8 pagesize,
  181. const u8 queue_type,
  182. const u64 logical_address_of_page,
  183. const u64 count);
  184. /* hipz_h_query_mr queries MR in HW and FW */
  185. u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,
  186. const struct ehca_mr *mr,
  187. struct ehca_mr_hipzout_parms *outparms);
  188. /* hipz_h_free_resource_mr frees MR resources in HW and FW */
  189. u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle,
  190. const struct ehca_mr *mr);
  191. /* hipz_h_reregister_pmr reregisters MR in HW and FW */
  192. u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
  193. const struct ehca_mr *mr,
  194. const u64 vaddr_in,
  195. const u64 length,
  196. const u32 access_ctrl,
  197. const struct ipz_pd pd,
  198. const u64 mr_addr_cb,
  199. struct ehca_mr_hipzout_parms *outparms);
  200. /* hipz_h_register_smr register shared MR in HW and FW */
  201. u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
  202. const struct ehca_mr *mr,
  203. const struct ehca_mr *orig_mr,
  204. const u64 vaddr_in,
  205. const u32 access_ctrl,
  206. const struct ipz_pd pd,
  207. struct ehca_mr_hipzout_parms *outparms);
  208. /*
  209. * hipz_h_alloc_resource_mw allocates MW resources in HW and FW, initialize
  210. * resources.
  211. */
  212. u64 hipz_h_alloc_resource_mw(const struct ipz_adapter_handle adapter_handle,
  213. const struct ehca_mw *mw,
  214. const struct ipz_pd pd,
  215. struct ehca_mw_hipzout_parms *outparms);
  216. /* hipz_h_query_mw queries MW in HW and FW */
  217. u64 hipz_h_query_mw(const struct ipz_adapter_handle adapter_handle,
  218. const struct ehca_mw *mw,
  219. struct ehca_mw_hipzout_parms *outparms);
  220. /* hipz_h_free_resource_mw frees MW resources in HW and FW */
  221. u64 hipz_h_free_resource_mw(const struct ipz_adapter_handle adapter_handle,
  222. const struct ehca_mw *mw);
  223. u64 hipz_h_error_data(const struct ipz_adapter_handle adapter_handle,
  224. const u64 ressource_handle,
  225. void *rblock,
  226. unsigned long *byte_count);
  227. #endif /* __HCP_IF_H__ */