• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/infiniband/hw/ehca/
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
45enum ehca_reg_type {
46	EHCA_REG_MR,
47	EHCA_REG_BUSMAP_MR
48};
49
50int 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
61int ehca_reg_mr_rpages(struct ehca_shca *shca,
62		       struct ehca_mr *e_mr,
63		       struct ehca_mr_pginfo *pginfo);
64
65int 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
75int ehca_unmap_one_fmr(struct ehca_shca *shca,
76		       struct ehca_mr *e_fmr);
77
78int 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
87int ehca_reg_internal_maxmr(struct ehca_shca *shca,
88			    struct ehca_pd *e_pd,
89			    struct ehca_mr **maxmr);
90
91int 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
99int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
100
101int 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
106int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
107			     u64 *page_list,
108			     int list_len);
109
110int ehca_set_pagebuf(struct ehca_mr_pginfo *pginfo,
111		     u32 number,
112		     u64 *kpage);
113
114int ehca_mr_is_maxmr(u64 size,
115		     u64 *iova_start);
116
117void ehca_mrmw_map_acl(int ib_acl,
118		       u32 *hipz_acl);
119
120void ehca_mrmw_set_pgsize_hipz_acl(u32 pgsize, u32 *hipz_acl);
121
122void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl,
123			       int *ib_acl);
124
125void ehca_mr_deletenew(struct ehca_mr *mr);
126
127int ehca_create_busmap(void);
128
129void ehca_destroy_busmap(void);
130
131extern struct ib_dma_mapping_ops ehca_dma_mapping_ops;
132#endif  /*_EHCA_MRMW_H_*/
133