hcp_if.h 9.2 KB

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