[2.6.19 PATCH 2/7] ehea: pHYP interface

2006-09-06 Thread Jan-Bernd Themann
Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]> 


 drivers/net/ehea/ehea_hcall.h |   51 +++
 drivers/net/ehea/ehea_phyp.c  |  705 ++
 drivers/net/ehea/ehea_phyp.h  |  454 +++
 3 files changed, 1210 insertions(+)



--- linux-2.6.18-rc6-orig/drivers/net/ehea/ehea_phyp.c  1970-01-01 
01:00:00.0 +0100
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-09-06 15:53:42.0 +0200
@@ -0,0 +1,705 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   while (((1U << ld) - 1) < queue_entries)
+   ld++;
+   return ld - 1;
+}
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+static long ehea_hcall_9arg_9ret(unsigned long opcode,
+unsigned long arg1, unsigned long arg2,
+unsigned long arg3, unsigned long arg4,
+unsigned long arg5, unsigned long arg6,
+unsigned long arg7, unsigned long arg8,
+unsigned long arg9, unsigned long *out1,
+unsigned long *out2,unsigned long *out3,
+unsigned long *out4,unsigned long *out5,
+unsigned long *out6,unsigned long *out7,
+unsigned long *out8,unsigned long *out9)
+{
+   long hret;
+   int i, sleep_msecs;
+
+   for (i = 0; i < 5; i++) {
+   hret = plpar_hcall_9arg_9ret(opcode,arg1, arg2, arg3, arg4,
+arg5, arg6, arg7, arg8, arg9, out1,
+out2, out3, out4, out5, out6, out7,
+out8, out9);
+   if (H_IS_LONG_BUSY(hret)) {
+   sleep_msecs = get_longbusy_msecs(hret);
+   msleep_interruptible(sleep_msecs);
+   continue;
+   }
+
+   if (hret < H_SUCCESS)
+   ehea_error("op=%lx hret=%lx "
+  "i1=%lx i2=%lx i3=%lx i4=%lx i5=%lx i6=%lx "
+  "i7=%lx i8=%lx i9=%lx "
+  "o1=%lx o2=%lx o3=%lx o4=%lx o5=%lx o6=%lx "
+  "o7=%lx o8=%lx o9=%lx",
+  opcode, hret, arg1, arg2, arg3, arg4, arg5,
+  arg6, arg7, arg8, arg9, *out1, *out2, *out3,
+  *out4, *out5, *out6, *out7, *out8, *out9);
+   return hret;
+   }
+   return H_BUSY;
+}
+
+u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 dummy;
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0) {
+   ehea_error("not on pageboundary");
+   return H_PARAMETER;
+   }
+
+   return ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
+   adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0, 0, 0, /* R9-R12 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy, /* R6

[2.6.19 PATCH 2/7] ehea: pHYP interface

2006-09-04 Thread Jan-Bernd Themann
Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]> 


 drivers/net/ehea/ehea_hcall.h |   51 +++
 drivers/net/ehea/ehea_phyp.c  |  705 ++
 drivers/net/ehea/ehea_phyp.h  |  454 +++
 3 files changed, 1210 insertions(+)



--- linux-2.6.18-rc6-orig/drivers/net/ehea/ehea_phyp.c  1970-01-01 
01:00:00.0 +0100
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-09-04 11:41:17.0 +0200
@@ -0,0 +1,705 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   while (((1U << ld) - 1) < queue_entries)
+   ld++;
+   return ld - 1;
+}
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+static long ehea_hcall_9arg_9ret(unsigned long opcode,
+unsigned long arg1, unsigned long arg2,
+unsigned long arg3, unsigned long arg4,
+unsigned long arg5, unsigned long arg6,
+unsigned long arg7, unsigned long arg8,
+unsigned long arg9, unsigned long *out1,
+unsigned long *out2,unsigned long *out3,
+unsigned long *out4,unsigned long *out5,
+unsigned long *out6,unsigned long *out7,
+unsigned long *out8,unsigned long *out9)
+{
+   long hret;
+   int i, sleep_msecs;
+
+   for (i = 0; i < 5; i++) {
+   hret = plpar_hcall_9arg_9ret(opcode,arg1, arg2, arg3, arg4,
+arg5, arg6, arg7, arg8, arg9, out1,
+out2, out3, out4, out5, out6, out7,
+out8, out9);
+   if (H_IS_LONG_BUSY(hret)) {
+   sleep_msecs = get_longbusy_msecs(hret);
+   msleep_interruptible(sleep_msecs);
+   continue;
+   }
+
+   if (hret < H_SUCCESS)
+   ehea_error("op=%lx hret=%lx "
+  "i1=%lx i2=%lx i3=%lx i4=%lx i5=%lx i6=%lx "
+  "i7=%lx i8=%lx i9=%lx "
+  "o1=%lx o2=%lx o3=%lx o4=%lx o5=%lx o6=%lx "
+  "o7=%lx o8=%lx o9=%lx",
+  opcode, hret, arg1, arg2, arg3, arg4, arg5,
+  arg6, arg7, arg8, arg9, *out1, *out2, *out3,
+  *out4, *out5, *out6, *out7, *out8, *out9);
+   return hret;
+   }
+   return H_BUSY;
+}
+
+u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 dummy;
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0) {
+   ehea_error("not on pageboundary");
+   return H_PARAMETER;
+   }
+
+   return ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
+   adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0, 0, 0, /* R9-R12 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy, /* R6

[2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-23 Thread Jan-Bernd Themann
Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]> 


 drivers/net/ehea/ehea_hcall.h |   51 ++
 drivers/net/ehea/ehea_phyp.c  |  784 ++
 drivers/net/ehea/ehea_phyp.h  |  463 
 3 files changed, 1298 insertions(+)



--- linux-2.6.18-rc4-git1-orig/drivers/net/ehea/ehea_phyp.c 1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-08-23 02:01:00.086227795 -0700
@@ -0,0 +1,784 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   while (((1U << ld) - 1) < queue_entries)
+   ld++;
+   return ld - 1;
+}
+
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+static long ehea_hcall_9arg_9ret(unsigned long opcode,
+unsigned long arg1, unsigned long arg2,
+unsigned long arg3, unsigned long arg4,
+unsigned long arg5, unsigned long arg6,
+unsigned long arg7, unsigned long arg8,
+unsigned long arg9, unsigned long *out1,
+unsigned long *out2,unsigned long *out3,
+unsigned long *out4,unsigned long *out5,
+unsigned long *out6,unsigned long *out7,
+unsigned long *out8,unsigned long *out9)
+{
+   long hret;
+   int i, sleep_msecs;
+
+   for (i = 0; i < 5; i++) {
+   hret = plpar_hcall_9arg_9ret(opcode,arg1, arg2, arg3, arg4,
+arg5, arg6, arg7, arg8, arg9, out1,
+out2, out3, out4, out5, out6, out7,
+out8, out9);
+   if (H_IS_LONG_BUSY(hret)) {
+   sleep_msecs = get_longbusy_msecs(hret);
+   msleep_interruptible(sleep_msecs);
+   continue;
+   }
+
+   if (hret < H_SUCCESS)
+   ehea_error("op=%lx hret=%lx "
+  "i1=%lx i2=%lx i3=%lx i4=%lx i5=%lx i6=%lx "
+  "i7=%lx i8=%lx i9=%lx "
+  "o1=%lx o2=%lx o3=%lx o4=%lx o5=%lx o6=%lx "
+  "o7=%lx o8=%lx o9=%lx",
+  opcode, hret, arg1, arg2, arg3, arg4, arg5,
+  arg6, arg7, arg8, arg9, *out1, *out2, *out3,
+  *out4, *out5, *out6, *out7, *out8, *out9);
+   return hret;
+   }
+   return H_BUSY;
+}
+
+u64 ehea_h_query_ehea_qp(const u64 hcp_adapter_handle, const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 dummy;
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0) {
+   ehea_error("not on pageboundary");
+   return H_PARAMETER;
+   }
+
+   return ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
+   hcp_adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0, 0, 0, /* R9-R12 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy,

[2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-22 Thread Jan-Bernd Themann
Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]> 


 drivers/net/ehea/ehea_hcall.h |   51 ++
 drivers/net/ehea/ehea_phyp.c  |  834 ++
 drivers/net/ehea/ehea_phyp.h  |  479 
 3 files changed, 1364 insertions(+)



--- linux-2.6.18-rc4-git1-orig/drivers/net/ehea/ehea_phyp.c 1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-08-22 06:05:28.920371128 -0700
@@ -0,0 +1,834 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   while (((1U << ld) - 1) < queue_entries)
+   ld++;
+   return ld - 1;
+}
+
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+static long ehea_hcall_9arg_9ret(unsigned long opcode,
+unsigned long arg1, unsigned long arg2,
+unsigned long arg3, unsigned long arg4,
+unsigned long arg5, unsigned long arg6,
+unsigned long arg7, unsigned long arg8,
+unsigned long arg9, unsigned long *out1,
+unsigned long *out2,unsigned long *out3,
+unsigned long *out4,unsigned long *out5,
+unsigned long *out6,unsigned long *out7,
+unsigned long *out8,unsigned long *out9)
+{
+   long hret = H_HARDWARE;
+   int i, sleep_msecs;
+
+   for (i = 0; i < 5; i++) {
+   hret = plpar_hcall_9arg_9ret(opcode,arg1, arg2, arg3, arg4,
+arg5, arg6, arg7, arg8, arg9, out1,
+out2, out3, out4, out5, out6, out7,
+out8, out9);
+   if (H_IS_LONG_BUSY(hret)) {
+   sleep_msecs = get_longbusy_msecs(hret);
+   msleep_interruptible(sleep_msecs);
+   continue;
+   }
+
+   if (hret < H_SUCCESS)
+   ehea_error("op=%lx hret=%lx "
+  "i1=%lx i2=%lx i3=%lx i4=%lx i5=%lx i6=%lx "
+  "i7=%lx i8=%lx i9=%lx "
+  "o1=%lx o2=%lx o3=%lx o4=%lx o5=%lx o6=%lx "
+  "o7=%lx o8=%lx o9=%lx",
+  opcode, hret, arg1, arg2, arg3, arg4, arg5,
+  arg6, arg7, arg8, arg9, *out1, *out2, *out3,
+  *out4, *out5, *out6, *out7, *out8, *out9);
+   return hret;
+   }
+   return H_BUSY;
+}
+
+u64 ehea_h_query_ehea_qp(const u64 hcp_adapter_handle, const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 dummy;
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0) {
+   ehea_error("not on pageboundary");
+   return H_PARAMETER;
+   }
+
+   return ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
+   hcp_adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0, 0, 0, /* R9-R12 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy,   

Re: [2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-21 Thread Thomas Klein

Alexey Dobriyan wrote:

On Fri, Aug 18, 2006 at 01:30:21PM +0200, Jan-Bernd Themann wrote:

--- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_phyp.c
+++ kernel/drivers/net/ehea/ehea_phyp.c



+   hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
+eq_handle, log_pageaddr, count);
+   return hret;


Just
return ehea_h_register_rpage(...);


+   hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
+cq_handle, log_pageaddr, count);
+   return hret;


Ditto.


+   hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
+qp_handle, log_pageaddr, count);
+   return hret;
+}


Ditto.


Returncode handling was reworked throughout the whole driver. Those assignments
were modified according to your suggestion.


+static inline int hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel,
+   u64 paddr_user)
+{
+   epas->kernel.fw_handle = (u64) ioremap(paddr_kernel, PAGE_SIZE);
+   epas->user.fw_handle = paddr_user;
+   return 0;
+}
+
+static inline int hcp_epas_dtor(struct h_epas *epas)
+{
+
+   if (epas->kernel.fw_handle)
+   iounmap((void *)epas->kernel.fw_handle);
+   epas->user.fw_handle = epas->kernel.fw_handle = 0;
+   return 0;
+}


Always returns 0;


Correct. They're returning void now.

Thanks
Thomas
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-18 Thread Christoph Raisch

>
> Hi,
>
> > I asked SO to recount arguments and we've come to a conclusion that
> > there're in fact 19 args not 18 as the name suggests. 19 args is
> > I-N-S-A-N-E.
>
> It will be partially cleaned up by:
>
> http://ozlabs.org/pipermail/linuxppc-dev/2006-July/024556.html
>
> However it doesnt fix the fact someone has architected such a crazy
> interface :(
>
> Anton


well, just as background info, this is the wrapper around
a single assembly instruction which calls system firmware and takes
9 CPU registers for input and 9 CPU registers for output parameters.
This definition by platform architecture won't change in the near future,
but the good news is with Antons change the wrapper will look much nicer.

Gruss / Regards . . . Christoph R

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-18 Thread Anton Blanchard
 
Hi,

> I asked SO to recount arguments and we've come to a conclusion that
> there're in fact 19 args not 18 as the name suggests. 19 args is
> I-N-S-A-N-E.

It will be partially cleaned up by:

http://ozlabs.org/pipermail/linuxppc-dev/2006-July/024556.html

However it doesnt fix the fact someone has architected such a crazy
interface :(

Anton
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-18 Thread Alexey Dobriyan
On Fri, Aug 18, 2006 at 01:30:21PM +0200, Jan-Bernd Themann wrote:
> --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_phyp.c
> +++ kernel/drivers/net/ehea/ehea_phyp.c

> + hret = ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
> + hcp_adapter_handle, /* R4 */
> + qp_category,/* R5 */
> + qp_handle,  /* R6 */
> + sel_mask,   /* R7 */
> + virt_to_abs(cb_addr),   /* R8 */
> + 0, 0, 0, 0, /* R9-R12 */
> + &dummy, /* R4 */
> + &dummy, /* R5 */
> + &dummy, /* R6 */
> + &dummy, /* R7 */
> + &dummy, /* R8 */
> + &dummy, /* R9 */
> + &dummy, /* R10 */
> + &dummy, /* R11 */
> + &dummy);/* R12 */

I asked SO to recount arguments and we've come to a conclusion that
there're in fact 19 args not 18 as the name suggests. 19 args is
I-N-S-A-N-E.

> +u64 ehea_h_register_rpage_eq(const u64 hcp_adapter_handle,
> +  const u64 eq_handle,
> +  const u8 pagesize,
> +  const u8 queue_type,
> +  const u64 log_pageaddr, const u64 count)
> +{
> + u64 hret = H_ADAPTER_PARM;
> +
> + if (count != 1)
> + return H_PARAMETER;
> +
> + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
> +  eq_handle, log_pageaddr, count);
> + return hret;

Just

return ehea_h_register_rpage(...);

> +u64 ehea_h_register_rpage_cq(const u64 hcp_adapter_handle,
> +  const u64 cq_handle,
> +  const u8 pagesize,
> +  const u8 queue_type,
> +  const u64 log_pageaddr,
> +  const u64 count, const struct h_epa epa)
> +{
> + u64 hret = H_ADAPTER_PARM;
> +
> + if (count != 1)
> + return H_PARAMETER;
> +
> + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
> +  cq_handle, log_pageaddr, count);
> + return hret;

Ditto.

> +u64 ehea_h_register_rpage_qp(const u64 hcp_adapter_handle,
> +  const u64 qp_handle,
> +  const u8 pagesize,
> +  const u8 queue_type,
> +  const u64 log_pageaddr,
> +  const u64 count, struct h_epa epa)
> +{
> + u64 hret = H_ADAPTER_PARM;
> +
> + if (count != 1)
> + return H_PARAMETER;
> +
> + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type,
> +  qp_handle, log_pageaddr, count);
> + return hret;
> +}

Ditto.

> +static inline int hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel,
> + u64 paddr_user)
> +{
> + epas->kernel.fw_handle = (u64) ioremap(paddr_kernel, PAGE_SIZE);
> + epas->user.fw_handle = paddr_user;
> + return 0;
> +}
> +
> +static inline int hcp_epas_dtor(struct h_epas *epas)
> +{
> +
> + if (epas->kernel.fw_handle)
> + iounmap((void *)epas->kernel.fw_handle);
> + epas->user.fw_handle = epas->kernel.fw_handle = 0;
> + return 0;
> +}

Always returns 0;

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[2.6.19 PATCH 2/7] ehea: pHYP interface

2006-08-18 Thread Jan-Bernd Themann
Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]> 


 drivers/net/ehea/ehea_hcall.h |   51 ++
 drivers/net/ehea/ehea_phyp.c  |  884 ++
 drivers/net/ehea/ehea_phyp.h  |  523 
 3 files changed, 1458 insertions(+)



--- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_phyp.c  1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-08-18 00:01:02.556365279 -0700
@@ -0,0 +1,884 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   while (((1U << ld) - 1) < queue_entries)
+   ld++;
+   return ld - 1;
+}
+
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+u64 ehea_h_query_ehea_qp(const u64 hcp_adapter_handle,
+const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 hret = H_ADAPTER_PARM;
+   u64 dummy = 0;
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0)
+   panic("query_ehea_qp: cb_addr not on page boundary!!!");
+
+   hret = ehea_hcall_9arg_9ret(H_QUERY_HEA_QP,
+   hcp_adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0, 0, 0, /* R9-R12 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy, /* R6 */
+   &dummy, /* R7 */
+   &dummy, /* R8 */
+   &dummy, /* R9 */
+   &dummy, /* R10 */
+   &dummy, /* R11 */
+   &dummy);/* R12 */
+   return hret;
+}
+
+/* input param R5 */
+#define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11)
+#define H_ALL_RES_QP_QPP  EHEA_BMASK_IBM(12, 12)
+#define H_ALL_RES_QP_RQR  EHEA_BMASK_IBM(13, 15)
+#define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16)
+#define H_ALL_RES_QP_LL_QPEHEA_BMASK_IBM(17, 17)
+#define H_ALL_RES_QP_DMA128   EHEA_BMASK_IBM(19, 19)
+#define H_ALL_RES_QP_HSM  EHEA_BMASK_IBM(20, 21)
+#define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23)
+#define H_ALL_RES_QP_TENURE   EHEA_BMASK_IBM(48, 55)
+#define H_ALL_RES_QP_RES_TYP  EHEA_BMASK_IBM(56, 63)
+
+/* input param R9  */
+#define H_ALL_RES_QP_TOKENEHEA_BMASK_IBM(0, 31)
+#define H_ALL_RES_QP_PD   EHEA_BMASK_IBM(32,63)
+
+/* input param R10 */
+#define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7)
+#define H_ALL_RES_QP_MAX_R1WQEEHEA_BMASK_IBM(12, 15)
+#define H_ALL_RES_QP_MAX_R2WQEEHEA_BMASK_IBM(20, 23)
+#define H_ALL_RES_QP_MAX_R3WQEEHEA_BMASK_IBM(28, 31)
+/* Max Send Scatter Gather Elements */
+#define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39)
+#define H_ALL_RES_QP_MAX_R1SGEEHEA_BMASK_IBM(45, 47)
+/* Max Receive SG Elements RQ1 */
+#define H_ALL_RES_QP_MAX_R2SGEEHEA_BMASK_IBM(53, 55)
+#define H_ALL_RES_QP_MAX_R3SGEEHEA_BMASK_IBM(61, 63)
+
+/* input param R11 */
+#define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7)
+/* max swqe immediate data length */
+#define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63)
+
+/*