aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea/ehea_phyp.c
diff options
context:
space:
mode:
authorJan-Bernd Themann <ossthema@de.ibm.com>2006-10-05 10:53:12 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-11 03:58:26 -0400
commit08093c8fd66ef7a8c2f887812cc98c54f5f12703 (patch)
treeca97d7e2123c29647d32291b32345742a05ed5dd /drivers/net/ehea/ehea_phyp.c
parent5f77113c01d8a9f8193769d2ca73763047af39ef (diff)
[PATCH] ehea: firmware (hvcall) interface changes
This eHEA patch covers required changes related to Anton Blanchard's new hvcall interface. Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ehea/ehea_phyp.c')
-rw-r--r--drivers/net/ehea/ehea_phyp.c573
1 files changed, 238 insertions, 335 deletions
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c
index 4a85aca4c7e9..0b51a8cea077 100644
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -44,71 +44,99 @@ static inline u16 get_order_of_qentries(u16 queue_entries)
44#define H_ALL_RES_TYPE_MR 5 44#define H_ALL_RES_TYPE_MR 5
45#define H_ALL_RES_TYPE_MW 6 45#define H_ALL_RES_TYPE_MW 6
46 46
47static long ehea_hcall_9arg_9ret(unsigned long opcode, 47static long ehea_plpar_hcall_norets(unsigned long opcode,
48 unsigned long arg1, unsigned long arg2, 48 unsigned long arg1,
49 unsigned long arg3, unsigned long arg4, 49 unsigned long arg2,
50 unsigned long arg5, unsigned long arg6, 50 unsigned long arg3,
51 unsigned long arg7, unsigned long arg8, 51 unsigned long arg4,
52 unsigned long arg9, unsigned long *out1, 52 unsigned long arg5,
53 unsigned long *out2,unsigned long *out3, 53 unsigned long arg6,
54 unsigned long *out4,unsigned long *out5, 54 unsigned long arg7)
55 unsigned long *out6,unsigned long *out7,
56 unsigned long *out8,unsigned long *out9)
57{ 55{
58 long hret; 56 long ret;
59 int i, sleep_msecs; 57 int i, sleep_msecs;
60 58
61 for (i = 0; i < 5; i++) { 59 for (i = 0; i < 5; i++) {
62 hret = plpar_hcall_9arg_9ret(opcode,arg1, arg2, arg3, arg4, 60 ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4,
63 arg5, arg6, arg7, arg8, arg9, out1, 61 arg5, arg6, arg7);
64 out2, out3, out4, out5, out6, out7, 62
65 out8, out9); 63 if (H_IS_LONG_BUSY(ret)) {
66 if (H_IS_LONG_BUSY(hret)) { 64 sleep_msecs = get_longbusy_msecs(ret);
67 sleep_msecs = get_longbusy_msecs(hret);
68 msleep_interruptible(sleep_msecs); 65 msleep_interruptible(sleep_msecs);
69 continue; 66 continue;
70 } 67 }
71 68
72 if (hret < H_SUCCESS) 69 if (ret < H_SUCCESS)
73 ehea_error("op=%lx hret=%lx " 70 ehea_error("opcode=%lx ret=%lx"
74 "i1=%lx i2=%lx i3=%lx i4=%lx i5=%lx i6=%lx " 71 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx"
75 "i7=%lx i8=%lx i9=%lx " 72 " arg5=%lx arg6=%lx arg7=%lx ",
76 "o1=%lx o2=%lx o3=%lx o4=%lx o5=%lx o6=%lx " 73 opcode, ret,
77 "o7=%lx o8=%lx o9=%lx", 74 arg1, arg2, arg3, arg4, arg5,
78 opcode, hret, arg1, arg2, arg3, arg4, arg5, 75 arg6, arg7);
79 arg6, arg7, arg8, arg9, *out1, *out2, *out3, 76
80 *out4, *out5, *out6, *out7, *out8, *out9); 77 return ret;
81 return hret;
82 } 78 }
79
83 return H_BUSY; 80 return H_BUSY;
84} 81}
85 82
86u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category, 83static long ehea_plpar_hcall9(unsigned long opcode,
87 const u64 qp_handle, const u64 sel_mask, void *cb_addr) 84 unsigned long *outs, /* array of 9 outputs */
85 unsigned long arg1,
86 unsigned long arg2,
87 unsigned long arg3,
88 unsigned long arg4,
89 unsigned long arg5,
90 unsigned long arg6,
91 unsigned long arg7,
92 unsigned long arg8,
93 unsigned long arg9)
88{ 94{
89 u64 dummy; 95 long ret;
96 int i, sleep_msecs;
90 97
91 if ((((u64)cb_addr) & (PAGE_SIZE - 1)) != 0) { 98 for (i = 0; i < 5; i++) {
92 ehea_error("not on pageboundary"); 99 ret = plpar_hcall9(opcode, outs,
93 return H_PARAMETER; 100 arg1, arg2, arg3, arg4, arg5,
101 arg6, arg7, arg8, arg9);
102
103 if (H_IS_LONG_BUSY(ret)) {
104 sleep_msecs = get_longbusy_msecs(ret);
105 msleep_interruptible(sleep_msecs);
106 continue;
107 }
108
109 if (ret < H_SUCCESS)
110 ehea_error("opcode=%lx ret=%lx"
111 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx"
112 " arg5=%lx arg6=%lx arg7=%lx arg8=%lx"
113 " arg9=%lx"
114 " out1=%lx out2=%lx out3=%lx out4=%lx"
115 " out5=%lx out6=%lx out7=%lx out8=%lx"
116 " out9=%lx",
117 opcode, ret,
118 arg1, arg2, arg3, arg4, arg5,
119 arg6, arg7, arg8, arg9,
120 outs[0], outs[1], outs[2], outs[3],
121 outs[4], outs[5], outs[6], outs[7],
122 outs[8]);
123
124 return ret;
94 } 125 }
95 126
96 return ehea_hcall_9arg_9ret(H_QUERY_HEA_QP, 127 return H_BUSY;
97 adapter_handle, /* R4 */ 128}
98 qp_category, /* R5 */ 129
99 qp_handle, /* R6 */ 130u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category,
100 sel_mask, /* R7 */ 131 const u64 qp_handle, const u64 sel_mask, void *cb_addr)
101 virt_to_abs(cb_addr), /* R8 */ 132{
102 0, 0, 0, 0, /* R9-R12 */ 133 return ehea_plpar_hcall_norets(H_QUERY_HEA_QP,
103 &dummy, /* R4 */ 134 adapter_handle, /* R4 */
104 &dummy, /* R5 */ 135 qp_category, /* R5 */
105 &dummy, /* R6 */ 136 qp_handle, /* R6 */
106 &dummy, /* R7 */ 137 sel_mask, /* R7 */
107 &dummy, /* R8 */ 138 virt_to_abs(cb_addr), /* R8 */
108 &dummy, /* R9 */ 139 0, 0);
109 &dummy, /* R10 */
110 &dummy, /* R11 */
111 &dummy); /* R12 */
112} 140}
113 141
114/* input param R5 */ 142/* input param R5 */
@@ -180,6 +208,7 @@ u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
180 u64 *qp_handle, struct h_epas *h_epas) 208 u64 *qp_handle, struct h_epas *h_epas)
181{ 209{
182 u64 hret; 210 u64 hret;
211 u64 outs[PLPAR_HCALL9_BUFSIZE];
183 212
184 u64 allocate_controls = 213 u64 allocate_controls =
185 EHEA_BMASK_SET(H_ALL_RES_QP_EQPO, init_attr->low_lat_rq1 ? 1 : 0) 214 EHEA_BMASK_SET(H_ALL_RES_QP_EQPO, init_attr->low_lat_rq1 ? 1 : 0)
@@ -219,45 +248,29 @@ u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
219 EHEA_BMASK_SET(H_ALL_RES_QP_TH_RQ2, init_attr->rq2_threshold) 248 EHEA_BMASK_SET(H_ALL_RES_QP_TH_RQ2, init_attr->rq2_threshold)
220 | EHEA_BMASK_SET(H_ALL_RES_QP_TH_RQ3, init_attr->rq3_threshold); 249 | EHEA_BMASK_SET(H_ALL_RES_QP_TH_RQ3, init_attr->rq3_threshold);
221 250
222 u64 r5_out = 0; 251 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
223 u64 r6_out = 0; 252 outs,
224 u64 r7_out = 0; 253 adapter_handle, /* R4 */
225 u64 r8_out = 0; 254 allocate_controls, /* R5 */
226 u64 r9_out = 0; 255 init_attr->send_cq_handle, /* R6 */
227 u64 g_la_user_out = 0; 256 init_attr->recv_cq_handle, /* R7 */
228 u64 r11_out = 0; 257 init_attr->aff_eq_handle, /* R8 */
229 u64 r12_out = 0; 258 r9_reg, /* R9 */
230 259 max_r10_reg, /* R10 */
231 hret = ehea_hcall_9arg_9ret(H_ALLOC_HEA_RESOURCE, 260 r11_in, /* R11 */
232 adapter_handle, /* R4 */ 261 threshold); /* R12 */
233 allocate_controls, /* R5 */ 262
234 init_attr->send_cq_handle, /* R6 */ 263 *qp_handle = outs[0];
235 init_attr->recv_cq_handle, /* R7 */ 264 init_attr->qp_nr = (u32)outs[1];
236 init_attr->aff_eq_handle, /* R8 */
237 r9_reg, /* R9 */
238 max_r10_reg, /* R10 */
239 r11_in, /* R11 */
240 threshold, /* R12 */
241 qp_handle, /* R4 */
242 &r5_out, /* R5 */
243 &r6_out, /* R6 */
244 &r7_out, /* R7 */
245 &r8_out, /* R8 */
246 &r9_out, /* R9 */
247 &g_la_user_out, /* R10 */
248 &r11_out, /* R11 */
249 &r12_out); /* R12 */
250
251 init_attr->qp_nr = (u32)r5_out;
252 265
253 init_attr->act_nr_send_wqes = 266 init_attr->act_nr_send_wqes =
254 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_SWQE, r6_out); 267 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_SWQE, outs[2]);
255 init_attr->act_nr_rwqes_rq1 = 268 init_attr->act_nr_rwqes_rq1 =
256 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R1WQE, r6_out); 269 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R1WQE, outs[2]);
257 init_attr->act_nr_rwqes_rq2 = 270 init_attr->act_nr_rwqes_rq2 =
258 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R2WQE, r6_out); 271 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R2WQE, outs[2]);
259 init_attr->act_nr_rwqes_rq3 = 272 init_attr->act_nr_rwqes_rq3 =
260 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R3WQE, r6_out); 273 (u16)EHEA_BMASK_GET(H_ALL_RES_QP_ACT_R3WQE, outs[2]);
261 274
262 init_attr->act_wqe_size_enc_sq = init_attr->wqe_size_enc_sq; 275 init_attr->act_wqe_size_enc_sq = init_attr->wqe_size_enc_sq;
263 init_attr->act_wqe_size_enc_rq1 = init_attr->wqe_size_enc_rq1; 276 init_attr->act_wqe_size_enc_rq1 = init_attr->wqe_size_enc_rq1;
@@ -265,25 +278,25 @@ u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
265 init_attr->act_wqe_size_enc_rq3 = init_attr->wqe_size_enc_rq3; 278 init_attr->act_wqe_size_enc_rq3 = init_attr->wqe_size_enc_rq3;
266 279
267 init_attr->nr_sq_pages = 280 init_attr->nr_sq_pages =
268 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_SQ, r8_out); 281 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_SQ, outs[4]);
269 init_attr->nr_rq1_pages = 282 init_attr->nr_rq1_pages =
270 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ1, r8_out); 283 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ1, outs[4]);
271 init_attr->nr_rq2_pages = 284 init_attr->nr_rq2_pages =
272 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ2, r9_out); 285 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ2, outs[5]);
273 init_attr->nr_rq3_pages = 286 init_attr->nr_rq3_pages =
274 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ3, r9_out); 287 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_SIZE_RQ3, outs[5]);
275 288
276 init_attr->liobn_sq = 289 init_attr->liobn_sq =
277 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_SQ, r11_out); 290 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_SQ, outs[7]);
278 init_attr->liobn_rq1 = 291 init_attr->liobn_rq1 =
279 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ1, r11_out); 292 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ1, outs[7]);
280 init_attr->liobn_rq2 = 293 init_attr->liobn_rq2 =
281 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ2, r12_out); 294 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ2, outs[8]);
282 init_attr->liobn_rq3 = 295 init_attr->liobn_rq3 =
283 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ3, r12_out); 296 (u32)EHEA_BMASK_GET(H_ALL_RES_QP_LIOBN_RQ3, outs[8]);
284 297
285 if (!hret) 298 if (!hret)
286 hcp_epas_ctor(h_epas, g_la_user_out, g_la_user_out); 299 hcp_epas_ctor(h_epas, outs[6], outs[6]);
287 300
288 return hret; 301 return hret;
289} 302}
@@ -292,31 +305,24 @@ u64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
292 struct ehea_cq_attr *cq_attr, 305 struct ehea_cq_attr *cq_attr,
293 u64 *cq_handle, struct h_epas *epas) 306 u64 *cq_handle, struct h_epas *epas)
294{ 307{
295 u64 hret, dummy, act_nr_of_cqes_out, act_pages_out; 308 u64 hret;
296 u64 g_la_privileged_out, g_la_user_out; 309 u64 outs[PLPAR_HCALL9_BUFSIZE];
297 310
298 hret = ehea_hcall_9arg_9ret(H_ALLOC_HEA_RESOURCE, 311 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
299 adapter_handle, /* R4 */ 312 outs,
300 H_ALL_RES_TYPE_CQ, /* R5 */ 313 adapter_handle, /* R4 */
301 cq_attr->eq_handle, /* R6 */ 314 H_ALL_RES_TYPE_CQ, /* R5 */
302 cq_attr->cq_token, /* R7 */ 315 cq_attr->eq_handle, /* R6 */
303 cq_attr->max_nr_of_cqes, /* R8 */ 316 cq_attr->cq_token, /* R7 */
304 0, 0, 0, 0, /* R9-R12 */ 317 cq_attr->max_nr_of_cqes, /* R8 */
305 cq_handle, /* R4 */ 318 0, 0, 0, 0); /* R9-R12 */
306 &dummy, /* R5 */ 319
307 &dummy, /* R6 */ 320 *cq_handle = outs[0];
308 &act_nr_of_cqes_out, /* R7 */ 321 cq_attr->act_nr_of_cqes = outs[3];
309 &act_pages_out, /* R8 */ 322 cq_attr->nr_pages = outs[4];
310 &g_la_privileged_out, /* R9 */
311 &g_la_user_out, /* R10 */
312 &dummy, /* R11 */
313 &dummy); /* R12 */
314
315 cq_attr->act_nr_of_cqes = act_nr_of_cqes_out;
316 cq_attr->nr_pages = act_pages_out;
317 323
318 if (!hret) 324 if (!hret)
319 hcp_epas_ctor(epas, g_la_privileged_out, g_la_user_out); 325 hcp_epas_ctor(epas, outs[5], outs[6]);
320 326
321 return hret; 327 return hret;
322} 328}
@@ -361,9 +367,8 @@ u64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
361u64 ehea_h_alloc_resource_eq(const u64 adapter_handle, 367u64 ehea_h_alloc_resource_eq(const u64 adapter_handle,
362 struct ehea_eq_attr *eq_attr, u64 *eq_handle) 368 struct ehea_eq_attr *eq_attr, u64 *eq_handle)
363{ 369{
364 u64 hret, dummy, eq_liobn, allocate_controls; 370 u64 hret, allocate_controls;
365 u64 ist1_out, ist2_out, ist3_out, ist4_out; 371 u64 outs[PLPAR_HCALL9_BUFSIZE];
366 u64 act_nr_of_eqes_out, act_pages_out;
367 372
368 /* resource type */ 373 /* resource type */
369 allocate_controls = 374 allocate_controls =
@@ -372,27 +377,20 @@ u64 ehea_h_alloc_resource_eq(const u64 adapter_handle,
372 | EHEA_BMASK_SET(H_ALL_RES_EQ_INH_EQE_GEN, !eq_attr->eqe_gen) 377 | EHEA_BMASK_SET(H_ALL_RES_EQ_INH_EQE_GEN, !eq_attr->eqe_gen)
373 | EHEA_BMASK_SET(H_ALL_RES_EQ_NON_NEQ_ISN, 1); 378 | EHEA_BMASK_SET(H_ALL_RES_EQ_NON_NEQ_ISN, 1);
374 379
375 hret = ehea_hcall_9arg_9ret(H_ALLOC_HEA_RESOURCE, 380 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
376 adapter_handle, /* R4 */ 381 outs,
377 allocate_controls, /* R5 */ 382 adapter_handle, /* R4 */
378 eq_attr->max_nr_of_eqes, /* R6 */ 383 allocate_controls, /* R5 */
379 0, 0, 0, 0, 0, 0, /* R7-R10 */ 384 eq_attr->max_nr_of_eqes, /* R6 */
380 eq_handle, /* R4 */ 385 0, 0, 0, 0, 0, 0); /* R7-R10 */
381 &dummy, /* R5 */ 386
382 &eq_liobn, /* R6 */ 387 *eq_handle = outs[0];
383 &act_nr_of_eqes_out, /* R7 */ 388 eq_attr->act_nr_of_eqes = outs[3];
384 &act_pages_out, /* R8 */ 389 eq_attr->nr_pages = outs[4];
385 &ist1_out, /* R9 */ 390 eq_attr->ist1 = outs[5];
386 &ist2_out, /* R10 */ 391 eq_attr->ist2 = outs[6];
387 &ist3_out, /* R11 */ 392 eq_attr->ist3 = outs[7];
388 &ist4_out); /* R12 */ 393 eq_attr->ist4 = outs[8];
389
390 eq_attr->act_nr_of_eqes = act_nr_of_eqes_out;
391 eq_attr->nr_pages = act_pages_out;
392 eq_attr->ist1 = ist1_out;
393 eq_attr->ist2 = ist2_out;
394 eq_attr->ist3 = ist3_out;
395 eq_attr->ist4 = ist4_out;
396 394
397 return hret; 395 return hret;
398} 396}
@@ -402,31 +400,22 @@ u64 ehea_h_modify_ehea_qp(const u64 adapter_handle, const u8 cat,
402 void *cb_addr, u64 *inv_attr_id, u64 *proc_mask, 400 void *cb_addr, u64 *inv_attr_id, u64 *proc_mask,
403 u16 *out_swr, u16 *out_rwr) 401 u16 *out_swr, u16 *out_rwr)
404{ 402{
405 u64 hret, dummy, act_out_swr, act_out_rwr; 403 u64 hret;
406 404 u64 outs[PLPAR_HCALL9_BUFSIZE];
407 if ((((u64)cb_addr) & (PAGE_SIZE - 1)) != 0) { 405
408 ehea_error("not on page boundary"); 406 hret = ehea_plpar_hcall9(H_MODIFY_HEA_QP,
409 return H_PARAMETER; 407 outs,
410 } 408 adapter_handle, /* R4 */
411 409 (u64) cat, /* R5 */
412 hret = ehea_hcall_9arg_9ret(H_MODIFY_HEA_QP, 410 qp_handle, /* R6 */
413 adapter_handle, /* R4 */ 411 sel_mask, /* R7 */
414 (u64) cat, /* R5 */ 412 virt_to_abs(cb_addr), /* R8 */
415 qp_handle, /* R6 */ 413 0, 0, 0, 0); /* R9-R12 */
416 sel_mask, /* R7 */ 414
417 virt_to_abs(cb_addr), /* R8 */ 415 *inv_attr_id = outs[0];
418 0, 0, 0, 0, /* R9-R12 */ 416 *out_swr = outs[3];
419 inv_attr_id, /* R4 */ 417 *out_rwr = outs[4];
420 &dummy, /* R5 */ 418 *proc_mask = outs[5];
421 &dummy, /* R6 */
422 &act_out_swr, /* R7 */
423 &act_out_rwr, /* R8 */
424 proc_mask, /* R9 */
425 &dummy, /* R10 */
426 &dummy, /* R11 */
427 &dummy); /* R12 */
428 *out_swr = act_out_swr;
429 *out_rwr = act_out_rwr;
430 419
431 return hret; 420 return hret;
432} 421}
@@ -435,122 +424,81 @@ u64 ehea_h_register_rpage(const u64 adapter_handle, const u8 pagesize,
435 const u8 queue_type, const u64 resource_handle, 424 const u8 queue_type, const u64 resource_handle,
436 const u64 log_pageaddr, u64 count) 425 const u64 log_pageaddr, u64 count)
437{ 426{
438 u64 dummy, reg_control; 427 u64 reg_control;
439 428
440 reg_control = EHEA_BMASK_SET(H_REG_RPAGE_PAGE_SIZE, pagesize) 429 reg_control = EHEA_BMASK_SET(H_REG_RPAGE_PAGE_SIZE, pagesize)
441 | EHEA_BMASK_SET(H_REG_RPAGE_QT, queue_type); 430 | EHEA_BMASK_SET(H_REG_RPAGE_QT, queue_type);
442 431
443 return ehea_hcall_9arg_9ret(H_REGISTER_HEA_RPAGES, 432 return ehea_plpar_hcall_norets(H_REGISTER_HEA_RPAGES,
444 adapter_handle, /* R4 */ 433 adapter_handle, /* R4 */
445 reg_control, /* R5 */ 434 reg_control, /* R5 */
446 resource_handle, /* R6 */ 435 resource_handle, /* R6 */
447 log_pageaddr, /* R7 */ 436 log_pageaddr, /* R7 */
448 count, /* R8 */ 437 count, /* R8 */
449 0, 0, 0, 0, /* R9-R12 */ 438 0, 0); /* R9-R10 */
450 &dummy, /* R4 */
451 &dummy, /* R5 */
452 &dummy, /* R6 */
453 &dummy, /* R7 */
454 &dummy, /* R8 */
455 &dummy, /* R9 */
456 &dummy, /* R10 */
457 &dummy, /* R11 */
458 &dummy); /* R12 */
459} 439}
460 440
461u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle, 441u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
462 const u64 vaddr_in, const u32 access_ctrl, const u32 pd, 442 const u64 vaddr_in, const u32 access_ctrl, const u32 pd,
463 struct ehea_mr *mr) 443 struct ehea_mr *mr)
464{ 444{
465 u64 hret, dummy, lkey_out; 445 u64 hret;
466 446 u64 outs[PLPAR_HCALL9_BUFSIZE];
467 hret = ehea_hcall_9arg_9ret(H_REGISTER_SMR, 447
468 adapter_handle , /* R4 */ 448 hret = ehea_plpar_hcall9(H_REGISTER_SMR,
469 orig_mr_handle, /* R5 */ 449 outs,
470 vaddr_in, /* R6 */ 450 adapter_handle , /* R4 */
471 (((u64)access_ctrl) << 32ULL), /* R7 */ 451 orig_mr_handle, /* R5 */
472 pd, /* R8 */ 452 vaddr_in, /* R6 */
473 0, 0, 0, 0, /* R9-R12 */ 453 (((u64)access_ctrl) << 32ULL), /* R7 */
474 &mr->handle, /* R4 */ 454 pd, /* R8 */
475 &dummy, /* R5 */ 455 0, 0, 0, 0); /* R9-R12 */
476 &lkey_out, /* R6 */ 456
477 &dummy, /* R7 */ 457 mr->handle = outs[0];
478 &dummy, /* R8 */ 458 mr->lkey = (u32)outs[2];
479 &dummy, /* R9 */
480 &dummy, /* R10 */
481 &dummy, /* R11 */
482 &dummy); /* R12 */
483 mr->lkey = (u32)lkey_out;
484 459
485 return hret; 460 return hret;
486} 461}
487 462
488u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle) 463u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle)
489{ 464{
490 u64 hret, dummy, ladr_next_sq_wqe_out; 465 u64 outs[PLPAR_HCALL9_BUFSIZE];
491 u64 ladr_next_rq1_wqe_out, ladr_next_rq2_wqe_out, ladr_next_rq3_wqe_out; 466
492 467 return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA,
493 hret = ehea_hcall_9arg_9ret(H_DISABLE_AND_GET_HEA, 468 outs,
494 adapter_handle, /* R4 */ 469 adapter_handle, /* R4 */
495 H_DISABLE_GET_EHEA_WQE_P, /* R5 */ 470 H_DISABLE_GET_EHEA_WQE_P, /* R5 */
496 qp_handle, /* R6 */ 471 qp_handle, /* R6 */
497 0, 0, 0, 0, 0, 0, /* R7-R12 */ 472 0, 0, 0, 0, 0, 0); /* R7-R12 */
498 &ladr_next_sq_wqe_out, /* R4 */
499 &ladr_next_rq1_wqe_out, /* R5 */
500 &ladr_next_rq2_wqe_out, /* R6 */
501 &ladr_next_rq3_wqe_out, /* R7 */
502 &dummy, /* R8 */
503 &dummy, /* R9 */
504 &dummy, /* R10 */
505 &dummy, /* R11 */
506 &dummy); /* R12 */
507 return hret;
508} 473}
509 474
510u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle) 475u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle)
511{ 476{
512 u64 dummy; 477 return ehea_plpar_hcall_norets(H_FREE_RESOURCE,
513 478 adapter_handle, /* R4 */
514 return ehea_hcall_9arg_9ret(H_FREE_RESOURCE, 479 res_handle, /* R5 */
515 adapter_handle, /* R4 */ 480 0, 0, 0, 0, 0); /* R6-R10 */
516 res_handle, /* R5 */
517 0, 0, 0, 0, 0, 0, 0, /* R6-R12 */
518 &dummy, /* R4 */
519 &dummy, /* R5 */
520 &dummy, /* R6 */
521 &dummy, /* R7 */
522 &dummy, /* R8 */
523 &dummy, /* R9 */
524 &dummy, /* R10 */
525 &dummy, /* R11 */
526 &dummy); /* R12 */
527} 481}
528 482
529u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, 483u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
530 const u64 length, const u32 access_ctrl, 484 const u64 length, const u32 access_ctrl,
531 const u32 pd, u64 *mr_handle, u32 *lkey) 485 const u32 pd, u64 *mr_handle, u32 *lkey)
532{ 486{
533 u64 hret, dummy, lkey_out; 487 u64 hret;
534 488 u64 outs[PLPAR_HCALL9_BUFSIZE];
535 hret = ehea_hcall_9arg_9ret(H_ALLOC_HEA_RESOURCE, 489
536 adapter_handle, /* R4 */ 490 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
537 5, /* R5 */ 491 outs,
538 vaddr, /* R6 */ 492 adapter_handle, /* R4 */
539 length, /* R7 */ 493 5, /* R5 */
540 (((u64) access_ctrl) << 32ULL),/* R8 */ 494 vaddr, /* R6 */
541 pd, /* R9 */ 495 length, /* R7 */
542 0, 0, 0, /* R10-R12 */ 496 (((u64) access_ctrl) << 32ULL), /* R8 */
543 mr_handle, /* R4 */ 497 pd, /* R9 */
544 &dummy, /* R5 */ 498 0, 0, 0); /* R10-R12 */
545 &lkey_out, /* R6 */ 499
546 &dummy, /* R7 */ 500 *mr_handle = outs[0];
547 &dummy, /* R8 */ 501 *lkey = (u32)outs[2];
548 &dummy, /* R9 */
549 &dummy, /* R10 */
550 &dummy, /* R11 */
551 &dummy); /* R12 */
552 *lkey = (u32) lkey_out;
553
554 return hret; 502 return hret;
555} 503}
556 504
@@ -570,23 +518,14 @@ u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle,
570 518
571u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr) 519u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr)
572{ 520{
573 u64 hret, dummy, cb_logaddr; 521 u64 hret, cb_logaddr;
574 522
575 cb_logaddr = virt_to_abs(cb_addr); 523 cb_logaddr = virt_to_abs(cb_addr);
576 524
577 hret = ehea_hcall_9arg_9ret(H_QUERY_HEA, 525 hret = ehea_plpar_hcall_norets(H_QUERY_HEA,
578 adapter_handle, /* R4 */ 526 adapter_handle, /* R4 */
579 cb_logaddr, /* R5 */ 527 cb_logaddr, /* R5 */
580 0, 0, 0, 0, 0, 0, 0, /* R6-R12 */ 528 0, 0, 0, 0, 0); /* R6-R10 */
581 &dummy, /* R4 */
582 &dummy, /* R5 */
583 &dummy, /* R6 */
584 &dummy, /* R7 */
585 &dummy, /* R8 */
586 &dummy, /* R9 */
587 &dummy, /* R10 */
588 &dummy, /* R11 */
589 &dummy); /* R12 */
590#ifdef DEBUG 529#ifdef DEBUG
591 ehea_dmp(cb_addr, sizeof(struct hcp_query_ehea), "hcp_query_ehea"); 530 ehea_dmp(cb_addr, sizeof(struct hcp_query_ehea), "hcp_query_ehea");
592#endif 531#endif
@@ -597,36 +536,28 @@ u64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num,
597 const u8 cb_cat, const u64 select_mask, 536 const u8 cb_cat, const u64 select_mask,
598 void *cb_addr) 537 void *cb_addr)
599{ 538{
600 u64 port_info, dummy; 539 u64 port_info;
601 u64 cb_logaddr = virt_to_abs(cb_addr); 540 u64 cb_logaddr = virt_to_abs(cb_addr);
602 u64 arr_index = 0; 541 u64 arr_index = 0;
603 542
604 port_info = EHEA_BMASK_SET(H_MEHEAPORT_CAT, cb_cat) 543 port_info = EHEA_BMASK_SET(H_MEHEAPORT_CAT, cb_cat)
605 | EHEA_BMASK_SET(H_MEHEAPORT_PN, port_num); 544 | EHEA_BMASK_SET(H_MEHEAPORT_PN, port_num);
606 545
607 return ehea_hcall_9arg_9ret(H_QUERY_HEA_PORT, 546 return ehea_plpar_hcall_norets(H_QUERY_HEA_PORT,
608 adapter_handle, /* R4 */ 547 adapter_handle, /* R4 */
609 port_info, /* R5 */ 548 port_info, /* R5 */
610 select_mask, /* R6 */ 549 select_mask, /* R6 */
611 arr_index, /* R7 */ 550 arr_index, /* R7 */
612 cb_logaddr, /* R8 */ 551 cb_logaddr, /* R8 */
613 0, 0, 0, 0, /* R9-R12 */ 552 0, 0); /* R9-R10 */
614 &dummy, /* R4 */
615 &dummy, /* R5 */
616 &dummy, /* R6 */
617 &dummy, /* R7 */
618 &dummy, /* R8 */
619 &dummy, /* R9 */
620 &dummy, /* R10 */
621 &dummy, /* R11 */
622 &dummy); /* R12 */
623} 553}
624 554
625u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num, 555u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num,
626 const u8 cb_cat, const u64 select_mask, 556 const u8 cb_cat, const u64 select_mask,
627 void *cb_addr) 557 void *cb_addr)
628{ 558{
629 u64 port_info, dummy, inv_attr_ident, proc_mask; 559 u64 outs[PLPAR_HCALL9_BUFSIZE];
560 u64 port_info;
630 u64 arr_index = 0; 561 u64 arr_index = 0;
631 u64 cb_logaddr = virt_to_abs(cb_addr); 562 u64 cb_logaddr = virt_to_abs(cb_addr);
632 563
@@ -635,29 +566,21 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num,
635#ifdef DEBUG 566#ifdef DEBUG
636 ehea_dump(cb_addr, sizeof(struct hcp_ehea_port_cb0), "Before HCALL"); 567 ehea_dump(cb_addr, sizeof(struct hcp_ehea_port_cb0), "Before HCALL");
637#endif 568#endif
638 return ehea_hcall_9arg_9ret(H_MODIFY_HEA_PORT, 569 return ehea_plpar_hcall9(H_MODIFY_HEA_PORT,
639 adapter_handle, /* R4 */ 570 outs,
640 port_info, /* R5 */ 571 adapter_handle, /* R4 */
641 select_mask, /* R6 */ 572 port_info, /* R5 */
642 arr_index, /* R7 */ 573 select_mask, /* R6 */
643 cb_logaddr, /* R8 */ 574 arr_index, /* R7 */
644 0, 0, 0, 0, /* R9-R12 */ 575 cb_logaddr, /* R8 */
645 &inv_attr_ident, /* R4 */ 576 0, 0, 0, 0); /* R9-R12 */
646 &proc_mask, /* R5 */
647 &dummy, /* R6 */
648 &dummy, /* R7 */
649 &dummy, /* R8 */
650 &dummy, /* R9 */
651 &dummy, /* R10 */
652 &dummy, /* R11 */
653 &dummy); /* R12 */
654} 577}
655 578
656u64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num, 579u64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num,
657 const u8 reg_type, const u64 mc_mac_addr, 580 const u8 reg_type, const u64 mc_mac_addr,
658 const u16 vlan_id, const u32 hcall_id) 581 const u16 vlan_id, const u32 hcall_id)
659{ 582{
660 u64 r5_port_num, r6_reg_type, r7_mc_mac_addr, r8_vlan_id, dummy; 583 u64 r5_port_num, r6_reg_type, r7_mc_mac_addr, r8_vlan_id;
661 u64 mac_addr = mc_mac_addr >> 16; 584 u64 mac_addr = mc_mac_addr >> 16;
662 585
663 r5_port_num = EHEA_BMASK_SET(H_REGBCMC_PN, port_num); 586 r5_port_num = EHEA_BMASK_SET(H_REGBCMC_PN, port_num);
@@ -665,41 +588,21 @@ u64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num,
665 r7_mc_mac_addr = EHEA_BMASK_SET(H_REGBCMC_MACADDR, mac_addr); 588 r7_mc_mac_addr = EHEA_BMASK_SET(H_REGBCMC_MACADDR, mac_addr);
666 r8_vlan_id = EHEA_BMASK_SET(H_REGBCMC_VLANID, vlan_id); 589 r8_vlan_id = EHEA_BMASK_SET(H_REGBCMC_VLANID, vlan_id);
667 590
668 return ehea_hcall_9arg_9ret(hcall_id, 591 return ehea_plpar_hcall_norets(hcall_id,
669 adapter_handle, /* R4 */ 592 adapter_handle, /* R4 */
670 r5_port_num, /* R5 */ 593 r5_port_num, /* R5 */
671 r6_reg_type, /* R6 */ 594 r6_reg_type, /* R6 */
672 r7_mc_mac_addr, /* R7 */ 595 r7_mc_mac_addr, /* R7 */
673 r8_vlan_id, /* R8 */ 596 r8_vlan_id, /* R8 */
674 0, 0, 0, 0, /* R9-R12 */ 597 0, 0); /* R9-R12 */
675 &dummy, /* R4 */
676 &dummy, /* R5 */
677 &dummy, /* R6 */
678 &dummy, /* R7 */
679 &dummy, /* R8 */
680 &dummy, /* R9 */
681 &dummy, /* R10 */
682 &dummy, /* R11 */
683 &dummy); /* R12 */
684} 598}
685 599
686u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle, 600u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
687 const u64 event_mask) 601 const u64 event_mask)
688{ 602{
689 u64 dummy; 603 return ehea_plpar_hcall_norets(H_RESET_EVENTS,
690 604 adapter_handle, /* R4 */
691 return ehea_hcall_9arg_9ret(H_RESET_EVENTS, 605 neq_handle, /* R5 */
692 adapter_handle, /* R4 */ 606 event_mask, /* R6 */
693 neq_handle, /* R5 */ 607 0, 0, 0, 0); /* R7-R12 */
694 event_mask, /* R6 */
695 0, 0, 0, 0, 0, 0, /* R7-R12 */
696 &dummy, /* R4 */
697 &dummy, /* R5 */
698 &dummy, /* R6 */
699 &dummy, /* R7 */
700 &dummy, /* R8 */
701 &dummy, /* R9 */
702 &dummy, /* R10 */
703 &dummy, /* R11 */
704 &dummy); /* R12 */
705} 608}