ASoC: wm8962: balance pm_runtime_enable
[linux-drm-fsl-dcu.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 enum ehca_reg_type {
46         EHCA_REG_MR,
47         EHCA_REG_BUSMAP_MR
48 };
49
50 int ehca_reg_mr(struct ehca_shca *shca,
51                 struct ehca_mr *e_mr,
52                 u64 *iova_start,
53                 u64 size,
54                 int acl,
55                 struct ehca_pd *e_pd,
56                 struct ehca_mr_pginfo *pginfo,
57                 u32 *lkey,
58                 u32 *rkey,
59                 enum ehca_reg_type reg_type);
60
61 int ehca_reg_mr_rpages(struct ehca_shca *shca,
62                        struct ehca_mr *e_mr,
63                        struct ehca_mr_pginfo *pginfo);
64
65 int ehca_rereg_mr(struct ehca_shca *shca,
66                   struct ehca_mr *e_mr,
67                   u64 *iova_start,
68                   u64 size,
69                   int mr_access_flags,
70                   struct ehca_pd *e_pd,
71                   struct ehca_mr_pginfo *pginfo,
72                   u32 *lkey,
73                   u32 *rkey);
74
75 int ehca_unmap_one_fmr(struct ehca_shca *shca,
76                        struct ehca_mr *e_fmr);
77
78 int ehca_reg_smr(struct ehca_shca *shca,
79                  struct ehca_mr *e_origmr,
80                  struct ehca_mr *e_newmr,
81                  u64 *iova_start,
82                  int acl,
83                  struct ehca_pd *e_pd,
84                  u32 *lkey,
85                  u32 *rkey);
86
87 int ehca_reg_internal_maxmr(struct ehca_shca *shca,
88                             struct ehca_pd *e_pd,
89                             struct ehca_mr **maxmr);
90
91 int ehca_reg_maxmr(struct ehca_shca *shca,
92                    struct ehca_mr *e_newmr,
93                    u64 *iova_start,
94                    int acl,
95                    struct ehca_pd *e_pd,
96                    u32 *lkey,
97                    u32 *rkey);
98
99 int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
100
101 int ehca_mr_chk_buf_and_calc_size(struct ib_phys_buf *phys_buf_array,
102                                   int num_phys_buf,
103                                   u64 *iova_start,
104                                   u64 *size);
105
106 int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
107                              u64 *page_list,
108                              int list_len);
109
110 int ehca_set_pagebuf(struct ehca_mr_pginfo *pginfo,
111                      u32 number,
112                      u64 *kpage);
113
114 int ehca_mr_is_maxmr(u64 size,
115                      u64 *iova_start);
116
117 void ehca_mrmw_map_acl(int ib_acl,
118                        u32 *hipz_acl);
119
120 void ehca_mrmw_set_pgsize_hipz_acl(u32 pgsize, u32 *hipz_acl);
121
122 void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl,
123                                int *ib_acl);
124
125 void ehca_mr_deletenew(struct ehca_mr *mr);
126
127 int ehca_create_busmap(void);
128
129 void ehca_destroy_busmap(void);
130
131 extern struct ib_dma_mapping_ops ehca_dma_mapping_ops;
132 #endif  /*_EHCA_MRMW_H_*/