Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / infiniband / hw / ehca / hcp_if.h
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
44 #ifndef __HCP_IF_H__
45 #define __HCP_IF_H__
46
47 #include "ehca_classes.h"
48 #include "ehca_tools.h"
49 #include "hipz_hw.h"
50
51 /*
52  * hipz_h_alloc_resource_eq allocates EQ resources in HW and FW, initalize
53  * resources, create the empty EQPT (ring).
54  */
55 u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
56                              struct ehca_pfeq *pfeq,
57                              const u32 neq_control,
58                              const u32 number_of_entries,
59                              struct ipz_eq_handle *eq_handle,
60                              u32 * act_nr_of_entries,
61                              u32 * act_pages,
62                              u32 * eq_ist);
63
64 u64 hipz_h_reset_event(const struct ipz_adapter_handle adapter_handle,
65                        struct ipz_eq_handle eq_handle,
66                        const u64 event_mask);
67 /*
68  * hipz_h_allocate_resource_cq allocates CQ resources in HW and FW, initialize
69  * resources, create the empty CQPT (ring).
70  */
71 u64 hipz_h_alloc_resource_cq(const struct ipz_adapter_handle adapter_handle,
72                              struct ehca_cq *cq,
73                              struct ehca_alloc_cq_parms *param);
74
75
76 /*
77  * hipz_h_alloc_resource_qp allocates QP resources in HW and FW,
78  * initialize resources, create empty QPPTs (2 rings).
79  */
80 u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
81                              struct ehca_qp *qp,
82                              struct ehca_alloc_qp_parms *parms);
83
84 u64 hipz_h_query_port(const struct ipz_adapter_handle adapter_handle,
85                       const u8 port_id,
86                       struct hipz_query_port *query_port_response_block);
87
88 u64 hipz_h_query_hca(const struct ipz_adapter_handle adapter_handle,
89                      struct hipz_query_hca *query_hca_rblock);
90
91 /*
92  * hipz_h_register_rpage internal function in hcp_if.h for all
93  * hcp_H_REGISTER_RPAGE calls.
94  */
95 u64 hipz_h_register_rpage(const struct ipz_adapter_handle adapter_handle,
96                           const u8 pagesize,
97                           const u8 queue_type,
98                           const u64 resource_handle,
99                           const u64 logical_address_of_page,
100                           u64 count);
101
102 u64 hipz_h_register_rpage_eq(const struct ipz_adapter_handle adapter_handle,
103                              const struct ipz_eq_handle eq_handle,
104                              struct ehca_pfeq *pfeq,
105                              const u8 pagesize,
106                              const u8 queue_type,
107                              const u64 logical_address_of_page,
108                              const u64 count);
109
110 u64 hipz_h_query_int_state(const struct ipz_adapter_handle
111                            hcp_adapter_handle,
112                            u32 ist);
113
114 u64 hipz_h_register_rpage_cq(const struct ipz_adapter_handle adapter_handle,
115                              const struct ipz_cq_handle cq_handle,
116                              struct ehca_pfcq *pfcq,
117                              const u8 pagesize,
118                              const u8 queue_type,
119                              const u64 logical_address_of_page,
120                              const u64 count,
121                              const struct h_galpa gal);
122
123 u64 hipz_h_register_rpage_qp(const struct ipz_adapter_handle adapter_handle,
124                              const struct ipz_qp_handle qp_handle,
125                              struct ehca_pfqp *pfqp,
126                              const u8 pagesize,
127                              const u8 queue_type,
128                              const u64 logical_address_of_page,
129                              const u64 count,
130                              const struct h_galpa galpa);
131
132 u64 hipz_h_disable_and_get_wqe(const struct ipz_adapter_handle adapter_handle,
133                                const struct ipz_qp_handle qp_handle,
134                                struct ehca_pfqp *pfqp,
135                                void **log_addr_next_sq_wqe_tb_processed,
136                                void **log_addr_next_rq_wqe_tb_processed,
137                                int dis_and_get_function_code);
138 enum hcall_sigt {
139         HCALL_SIGT_NO_CQE = 0,
140         HCALL_SIGT_BY_WQE = 1,
141         HCALL_SIGT_EVERY = 2
142 };
143
144 u64 hipz_h_modify_qp(const struct ipz_adapter_handle adapter_handle,
145                      const struct ipz_qp_handle qp_handle,
146                      struct ehca_pfqp *pfqp,
147                      const u64 update_mask,
148                      struct hcp_modify_qp_control_block *mqpcb,
149                      struct h_galpa gal);
150
151 u64 hipz_h_query_qp(const struct ipz_adapter_handle adapter_handle,
152                     const struct ipz_qp_handle qp_handle,
153                     struct ehca_pfqp *pfqp,
154                     struct hcp_modify_qp_control_block *qqpcb,
155                     struct h_galpa gal);
156
157 u64 hipz_h_destroy_qp(const struct ipz_adapter_handle adapter_handle,
158                       struct ehca_qp *qp);
159
160 u64 hipz_h_define_aqp0(const struct ipz_adapter_handle adapter_handle,
161                        const struct ipz_qp_handle qp_handle,
162                        struct h_galpa gal,
163                        u32 port);
164
165 u64 hipz_h_define_aqp1(const struct ipz_adapter_handle adapter_handle,
166                        const struct ipz_qp_handle qp_handle,
167                        struct h_galpa gal,
168                        u32 port, u32 * pma_qp_nr,
169                        u32 * bma_qp_nr);
170
171 u64 hipz_h_attach_mcqp(const struct ipz_adapter_handle adapter_handle,
172                        const struct ipz_qp_handle qp_handle,
173                        struct h_galpa gal,
174                        u16 mcg_dlid,
175                        u64 subnet_prefix, u64 interface_id);
176
177 u64 hipz_h_detach_mcqp(const struct ipz_adapter_handle adapter_handle,
178                        const struct ipz_qp_handle qp_handle,
179                        struct h_galpa gal,
180                        u16 mcg_dlid,
181                        u64 subnet_prefix, u64 interface_id);
182
183 u64 hipz_h_destroy_cq(const struct ipz_adapter_handle adapter_handle,
184                       struct ehca_cq *cq,
185                       u8 force_flag);
186
187 u64 hipz_h_destroy_eq(const struct ipz_adapter_handle adapter_handle,
188                       struct ehca_eq *eq);
189
190 /*
191  * hipz_h_alloc_resource_mr allocates MR resources in HW and FW, initialize
192  * resources.
193  */
194 u64 hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
195                              const struct ehca_mr *mr,
196                              const u64 vaddr,
197                              const u64 length,
198                              const u32 access_ctrl,
199                              const struct ipz_pd pd,
200                              struct ehca_mr_hipzout_parms *outparms);
201
202 /* hipz_h_register_rpage_mr registers MR resource pages in HW and FW */
203 u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle,
204                              const struct ehca_mr *mr,
205                              const u8 pagesize,
206                              const u8 queue_type,
207                              const u64 logical_address_of_page,
208                              const u64 count);
209
210 /* hipz_h_query_mr queries MR in HW and FW */
211 u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,
212                     const struct ehca_mr *mr,
213                     struct ehca_mr_hipzout_parms *outparms);
214
215 /* hipz_h_free_resource_mr frees MR resources in HW and FW */
216 u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle,
217                             const struct ehca_mr *mr);
218
219 /* hipz_h_reregister_pmr reregisters MR in HW and FW */
220 u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
221                           const struct ehca_mr *mr,
222                           const u64 vaddr_in,
223                           const u64 length,
224                           const u32 access_ctrl,
225                           const struct ipz_pd pd,
226                           const u64 mr_addr_cb,
227                           struct ehca_mr_hipzout_parms *outparms);
228
229 /* hipz_h_register_smr register shared MR in HW and FW */
230 u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
231                         const struct ehca_mr *mr,
232                         const struct ehca_mr *orig_mr,
233                         const u64 vaddr_in,
234                         const u32 access_ctrl,
235                         const struct ipz_pd pd,
236                         struct ehca_mr_hipzout_parms *outparms);
237
238 /*
239  * hipz_h_alloc_resource_mw allocates MW resources in HW and FW, initialize
240  * resources.
241  */
242 u64 hipz_h_alloc_resource_mw(const struct ipz_adapter_handle adapter_handle,
243                              const struct ehca_mw *mw,
244                              const struct ipz_pd pd,
245                              struct ehca_mw_hipzout_parms *outparms);
246
247 /* hipz_h_query_mw queries MW in HW and FW */
248 u64 hipz_h_query_mw(const struct ipz_adapter_handle adapter_handle,
249                     const struct ehca_mw *mw,
250                     struct ehca_mw_hipzout_parms *outparms);
251
252 /* hipz_h_free_resource_mw frees MW resources in HW and FW */
253 u64 hipz_h_free_resource_mw(const struct ipz_adapter_handle adapter_handle,
254                             const struct ehca_mw *mw);
255
256 u64 hipz_h_error_data(const struct ipz_adapter_handle adapter_handle,
257                       const u64 ressource_handle,
258                       void *rblock,
259                       unsigned long *byte_count);
260
261 #endif /* __HCP_IF_H__ */