[GFS2] Fix up merge of Linus' kernel into GFS2
[pandora-kernel.git] / drivers / infiniband / hw / ehca / ehca_mrmw.h
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
42 #ifndef _EHCA_MRMW_H_
43 #define _EHCA_MRMW_H_
44
45 int ehca_reg_mr(struct ehca_shca *shca,
46                 struct ehca_mr *e_mr,
47                 u64 *iova_start,
48                 u64 size,
49                 int acl,
50                 struct ehca_pd *e_pd,
51                 struct ehca_mr_pginfo *pginfo,
52                 u32 *lkey,
53                 u32 *rkey);
54
55 int ehca_reg_mr_rpages(struct ehca_shca *shca,
56                        struct ehca_mr *e_mr,
57                        struct ehca_mr_pginfo *pginfo);
58
59 int ehca_rereg_mr(struct ehca_shca *shca,
60                   struct ehca_mr *e_mr,
61                   u64 *iova_start,
62                   u64 size,
63                   int mr_access_flags,
64                   struct ehca_pd *e_pd,
65                   struct ehca_mr_pginfo *pginfo,
66                   u32 *lkey,
67                   u32 *rkey);
68
69 int ehca_unmap_one_fmr(struct ehca_shca *shca,
70                        struct ehca_mr *e_fmr);
71
72 int ehca_reg_smr(struct ehca_shca *shca,
73                  struct ehca_mr *e_origmr,
74                  struct ehca_mr *e_newmr,
75                  u64 *iova_start,
76                  int acl,
77                  struct ehca_pd *e_pd,
78                  u32 *lkey,
79                  u32 *rkey);
80
81 int ehca_reg_internal_maxmr(struct ehca_shca *shca,
82                             struct ehca_pd *e_pd,
83                             struct ehca_mr **maxmr);
84
85 int ehca_reg_maxmr(struct ehca_shca *shca,
86                    struct ehca_mr *e_newmr,
87                    u64 *iova_start,
88                    int acl,
89                    struct ehca_pd *e_pd,
90                    u32 *lkey,
91                    u32 *rkey);
92
93 int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
94
95 int ehca_mr_chk_buf_and_calc_size(struct ib_phys_buf *phys_buf_array,
96                                   int num_phys_buf,
97                                   u64 *iova_start,
98                                   u64 *size);
99
100 int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
101                              u64 *page_list,
102                              int list_len);
103
104 int ehca_set_pagebuf(struct ehca_mr *e_mr,
105                      struct ehca_mr_pginfo *pginfo,
106                      u32 number,
107                      u64 *kpage);
108
109 int ehca_set_pagebuf_1(struct ehca_mr *e_mr,
110                        struct ehca_mr_pginfo *pginfo,
111                        u64 *rpage);
112
113 int ehca_mr_is_maxmr(u64 size,
114                      u64 *iova_start);
115
116 void ehca_mrmw_map_acl(int ib_acl,
117                        u32 *hipz_acl);
118
119 void ehca_mrmw_set_pgsize_hipz_acl(u32 *hipz_acl);
120
121 void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl,
122                                int *ib_acl);
123
124 int ehca_mrmw_map_hrc_alloc(const u64 hipz_rc);
125
126 int ehca_mrmw_map_hrc_rrpg_last(const u64 hipz_rc);
127
128 int ehca_mrmw_map_hrc_rrpg_notlast(const u64 hipz_rc);
129
130 int ehca_mrmw_map_hrc_query_mr(const u64 hipz_rc);
131
132 int ehca_mrmw_map_hrc_free_mr(const u64 hipz_rc);
133
134 int ehca_mrmw_map_hrc_free_mw(const u64 hipz_rc);
135
136 int ehca_mrmw_map_hrc_reg_smr(const u64 hipz_rc);
137
138 void ehca_mr_deletenew(struct ehca_mr *mr);
139
140 #endif  /*_EHCA_MRMW_H_*/