ehca_mrmw.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * MR/MW declarations and inline functions
  5. *
  6. * Authors: Dietmar Decker <ddecker@de.ibm.com>
  7. * Christoph Raisch <raisch@de.ibm.com>
  8. *
  9. * Copyright (c) 2005 IBM Corporation
  10. *
  11. * All rights reserved.
  12. *
  13. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  14. * BSD.
  15. *
  16. * OpenIB BSD License
  17. *
  18. * Redistribution and use in source and binary forms, with or without
  19. * modification, are permitted provided that the following conditions are met:
  20. *
  21. * Redistributions of source code must retain the above copyright notice, this
  22. * list of conditions and the following disclaimer.
  23. *
  24. * Redistributions in binary form must reproduce the above copyright notice,
  25. * this list of conditions and the following disclaimer in the documentation
  26. * and/or other materials
  27. * provided with the distribution.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  30. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  33. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  34. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  35. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  36. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  37. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  38. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  39. * POSSIBILITY OF SUCH DAMAGE.
  40. */
  41. #ifndef _EHCA_MRMW_H_
  42. #define _EHCA_MRMW_H_
  43. enum ehca_reg_type {
  44. EHCA_REG_MR,
  45. EHCA_REG_BUSMAP_MR
  46. };
  47. int ehca_reg_mr(struct ehca_shca *shca,
  48. struct ehca_mr *e_mr,
  49. u64 *iova_start,
  50. u64 size,
  51. int acl,
  52. struct ehca_pd *e_pd,
  53. struct ehca_mr_pginfo *pginfo,
  54. u32 *lkey,
  55. u32 *rkey,
  56. enum ehca_reg_type reg_type);
  57. int ehca_reg_mr_rpages(struct ehca_shca *shca,
  58. struct ehca_mr *e_mr,
  59. struct ehca_mr_pginfo *pginfo);
  60. int ehca_rereg_mr(struct ehca_shca *shca,
  61. struct ehca_mr *e_mr,
  62. u64 *iova_start,
  63. u64 size,
  64. int mr_access_flags,
  65. struct ehca_pd *e_pd,
  66. struct ehca_mr_pginfo *pginfo,
  67. u32 *lkey,
  68. u32 *rkey);
  69. int ehca_unmap_one_fmr(struct ehca_shca *shca,
  70. struct ehca_mr *e_fmr);
  71. int ehca_reg_smr(struct ehca_shca *shca,
  72. struct ehca_mr *e_origmr,
  73. struct ehca_mr *e_newmr,
  74. u64 *iova_start,
  75. int acl,
  76. struct ehca_pd *e_pd,
  77. u32 *lkey,
  78. u32 *rkey);
  79. int ehca_reg_internal_maxmr(struct ehca_shca *shca,
  80. struct ehca_pd *e_pd,
  81. struct ehca_mr **maxmr);
  82. int ehca_reg_maxmr(struct ehca_shca *shca,
  83. struct ehca_mr *e_newmr,
  84. u64 *iova_start,
  85. int acl,
  86. struct ehca_pd *e_pd,
  87. u32 *lkey,
  88. u32 *rkey);
  89. int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
  90. int ehca_mr_chk_buf_and_calc_size(struct ib_phys_buf *phys_buf_array,
  91. int num_phys_buf,
  92. u64 *iova_start,
  93. u64 *size);
  94. int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
  95. u64 *page_list,
  96. int list_len);
  97. int ehca_set_pagebuf(struct ehca_mr_pginfo *pginfo,
  98. u32 number,
  99. u64 *kpage);
  100. int ehca_mr_is_maxmr(u64 size,
  101. u64 *iova_start);
  102. void ehca_mrmw_map_acl(int ib_acl,
  103. u32 *hipz_acl);
  104. void ehca_mrmw_set_pgsize_hipz_acl(u32 pgsize, u32 *hipz_acl);
  105. void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl,
  106. int *ib_acl);
  107. void ehca_mr_deletenew(struct ehca_mr *mr);
  108. int ehca_create_busmap(void);
  109. void ehca_destroy_busmap(void);
  110. extern struct ib_dma_mapping_ops ehca_dma_mapping_ops;
  111. #endif /*_EHCA_MRMW_H_*/