hcp_if.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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_modify_port(const struct ipz_adapter_handle adapter_handle,
  81. const u8 port_id, const u32 port_cap,
  82. const u8 init_type, const int modify_mask);
  83. u64 hipz_h_query_hca(const struct ipz_adapter_handle adapter_handle,
  84. struct hipz_query_hca *query_hca_rblock);
  85. /*
  86. * hipz_h_register_rpage internal function in hcp_if.h for all
  87. * hcp_H_REGISTER_RPAGE calls.
  88. */
  89. u64 hipz_h_register_rpage(const struct ipz_adapter_handle adapter_handle,
  90. const u8 pagesize,
  91. const u8 queue_type,
  92. const u64 resource_handle,
  93. const u64 logical_address_of_page,
  94. u64 count);
  95. u64 hipz_h_register_rpage_eq(const struct ipz_adapter_handle adapter_handle,
  96. const struct ipz_eq_handle eq_handle,
  97. struct ehca_pfeq *pfeq,
  98. const u8 pagesize,
  99. const u8 queue_type,
  100. const u64 logical_address_of_page,
  101. const u64 count);
  102. u64 hipz_h_query_int_state(const struct ipz_adapter_handle
  103. hcp_adapter_handle,
  104. u32 ist);
  105. u64 hipz_h_register_rpage_cq(const struct ipz_adapter_handle adapter_handle,
  106. const struct ipz_cq_handle cq_handle,
  107. struct ehca_pfcq *pfcq,
  108. const u8 pagesize,
  109. const u8 queue_type,
  110. const u64 logical_address_of_page,
  111. const u64 count,
  112. const struct h_galpa gal);
  113. u64 hipz_h_register_rpage_qp(const struct ipz_adapter_handle adapter_handle,
  114. const struct ipz_qp_handle qp_handle,
  115. struct ehca_pfqp *pfqp,
  116. const u8 pagesize,
  117. const u8 queue_type,
  118. const u64 logical_address_of_page,
  119. const u64 count,
  120. const struct h_galpa galpa);
  121. u64 hipz_h_disable_and_get_wqe(const struct ipz_adapter_handle adapter_handle,
  122. const struct ipz_qp_handle qp_handle,
  123. struct ehca_pfqp *pfqp,
  124. void **log_addr_next_sq_wqe_tb_processed,
  125. void **log_addr_next_rq_wqe_tb_processed,
  126. int dis_and_get_function_code);
  127. enum hcall_sigt {
  128. HCALL_SIGT_NO_CQE = 0,
  129. HCALL_SIGT_BY_WQE = 1,
  130. HCALL_SIGT_EVERY = 2
  131. };
  132. u64 hipz_h_modify_qp(const struct ipz_adapter_handle adapter_handle,
  133. const struct ipz_qp_handle qp_handle,
  134. struct ehca_pfqp *pfqp,
  135. const u64 update_mask,
  136. struct hcp_modify_qp_control_block *mqpcb,
  137. struct h_galpa gal);
  138. u64 hipz_h_query_qp(const struct ipz_adapter_handle adapter_handle,
  139. const struct ipz_qp_handle qp_handle,
  140. struct ehca_pfqp *pfqp,
  141. struct hcp_modify_qp_control_block *qqpcb,
  142. struct h_galpa gal);
  143. u64 hipz_h_destroy_qp(const struct ipz_adapter_handle adapter_handle,
  144. struct ehca_qp *qp);
  145. u64 hipz_h_define_aqp0(const struct ipz_adapter_handle adapter_handle,
  146. const struct ipz_qp_handle qp_handle,
  147. struct h_galpa gal,
  148. u32 port);
  149. u64 hipz_h_define_aqp1(const struct ipz_adapter_handle adapter_handle,
  150. const struct ipz_qp_handle qp_handle,
  151. struct h_galpa gal,
  152. u32 port, u32 * pma_qp_nr,
  153. u32 * bma_qp_nr);
  154. u64 hipz_h_attach_mcqp(const struct ipz_adapter_handle adapter_handle,
  155. const struct ipz_qp_handle qp_handle,
  156. struct h_galpa gal,
  157. u16 mcg_dlid,
  158. u64 subnet_prefix, u64 interface_id);
  159. u64 hipz_h_detach_mcqp(const struct ipz_adapter_handle adapter_handle,
  160. const struct ipz_qp_handle qp_handle,
  161. struct h_galpa gal,
  162. u16 mcg_dlid,
  163. u64 subnet_prefix, u64 interface_id);
  164. u64 hipz_h_destroy_cq(const struct ipz_adapter_handle adapter_handle,
  165. struct ehca_cq *cq,
  166. u8 force_flag);
  167. u64 hipz_h_destroy_eq(const struct ipz_adapter_handle adapter_handle,
  168. struct ehca_eq *eq);
  169. /*
  170. * hipz_h_alloc_resource_mr allocates MR resources in HW and FW, initialize
  171. * resources.
  172. */
  173. u64 hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
  174. const struct ehca_mr *mr,
  175. const u64 vaddr,
  176. const u64 length,
  177. const u32 access_ctrl,
  178. const struct ipz_pd pd,
  179. struct ehca_mr_hipzout_parms *outparms);
  180. /* hipz_h_register_rpage_mr registers MR resource pages in HW and FW */
  181. u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle,
  182. const struct ehca_mr *mr,
  183. const u8 pagesize,
  184. const u8 queue_type,
  185. const u64 logical_address_of_page,
  186. const u64 count);
  187. /* hipz_h_query_mr queries MR in HW and FW */
  188. u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,
  189. const struct ehca_mr *mr,
  190. struct ehca_mr_hipzout_parms *outparms);
  191. /* hipz_h_free_resource_mr frees MR resources in HW and FW */
  192. u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle,
  193. const struct ehca_mr *mr);
  194. /* hipz_h_reregister_pmr reregisters MR in HW and FW */
  195. u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
  196. const struct ehca_mr *mr,
  197. const u64 vaddr_in,
  198. const u64 length,
  199. const u32 access_ctrl,
  200. const struct ipz_pd pd,
  201. const u64 mr_addr_cb,
  202. struct ehca_mr_hipzout_parms *outparms);
  203. /* hipz_h_register_smr register shared MR in HW and FW */
  204. u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
  205. const struct ehca_mr *mr,
  206. const struct ehca_mr *orig_mr,
  207. const u64 vaddr_in,
  208. const u32 access_ctrl,
  209. const struct ipz_pd pd,
  210. struct ehca_mr_hipzout_parms *outparms);
  211. /*
  212. * hipz_h_alloc_resource_mw allocates MW resources in HW and FW, initialize
  213. * resources.
  214. */
  215. u64 hipz_h_alloc_resource_mw(const struct ipz_adapter_handle adapter_handle,
  216. const struct ehca_mw *mw,
  217. const struct ipz_pd pd,
  218. struct ehca_mw_hipzout_parms *outparms);
  219. /* hipz_h_query_mw queries MW in HW and FW */
  220. u64 hipz_h_query_mw(const struct ipz_adapter_handle adapter_handle,
  221. const struct ehca_mw *mw,
  222. struct ehca_mw_hipzout_parms *outparms);
  223. /* hipz_h_free_resource_mw frees MW resources in HW and FW */
  224. u64 hipz_h_free_resource_mw(const struct ipz_adapter_handle adapter_handle,
  225. const struct ehca_mw *mw);
  226. u64 hipz_h_error_data(const struct ipz_adapter_handle adapter_handle,
  227. const u64 ressource_handle,
  228. void *rblock,
  229. unsigned long *byte_count);
  230. #endif /* __HCP_IF_H__ */