[openib-general] [Patch ofed1.2 2/3]libehca: cleanup and adjust mmap
Stefan Roscher
ossrosch at linux.vnet.ibm.com
Fri Jan 26 08:47:54 PST 2007
Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com>
---
diff -Nurp libehca_old/src/ehca_utools.h libehca_new/src/ehca_utools.h
--- libehca_old/src/ehca_utools.h 2007-01-26 14:27:03.000000000 +0100
+++ libehca_new/src/ehca_utools.h 2007-01-26 14:27:43.000000000 +0100
@@ -1,53 +1,53 @@
-/*
+/*
* IBM eServer eHCA Infiniband device driver for Linux on POWER
- *
+ *
* Userspace functions
*
* Authors: Khadija Souissi <souissik at de.ibm.com>
* Christoph Raisch <raisch at de.ibm.com>
*
* Copyright (c) 2005 IBM Corporation
- *
+ *
* All rights reserved.
*
- * This source code is distributed under a dual license of GPL v2.0 and OpenIB
- * BSD.
+ * This source code is distributed under a dual license of GPL v2.0 and OpenIB
+ * BSD.
*
* OpenIB BSD License
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
*
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
* and/or other materials
- * provided with the distribution.
+ * provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: ehca_utools.h,v 1.2 2006/02/21 17:15:47 nguyen Exp $
*/
-
+
#ifndef __EHCA_UTOOL_H__
#define __EHCA_UTOOL_H__
#include <stdio.h>
+#include <unistd.h>
#include <linux/types.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#define u64 __u64
#define u32 __u32
#define u16 __u16
@@ -55,41 +55,38 @@
#define unlikely(x) __builtin_expect(!!(x), 0)
-/* defines for EDEBs */
-extern int libehca_trlevel;
-extern FILE *libehca_fh;
+/* defines for EHCA traces */
+extern int libehca_trace_on;
/* checks if debug is on for the given level
- * caller's module must have this decl: extern int libehca_trlevel;
+ * caller's module must have this decl: extern int libehca_trace_on;
*/
-#ifdef EDEB_NO_TRACE
-#define IS_EDEB_ON(level) (1==0)
-#define EDEB_GENERIC(level,idstring,format,args...) \
-while (1==0) { \
- \
- fprintf(libehca_fh,"%s " idstring "%p "format "\n", __func__, ##args); \
-}
-#else /* EDEB_NO_TRACE */
-#define IS_EDEB_ON(level) (level<=libehca_trlevel)
+#define ehca_dbg(ibv_dev, format, arg...) \
+ do { \
+ if (unlikely(libehca_trace_on)) \
+ fprintf(stderr, "PID%04x %s EHCA_DBG:%s " format "\n", \
+ getpid(), (ibv_dev)->name, __func__, ##arg); \
+ } while (0)
+
+#define ehca_err(ibv_dev, format, arg...) \
+ fprintf(stderr, "PID%04x %s EHCA_ERR:%s " format "\n", \
+ getpid(), (ibv_dev)->name, __func__, ##arg)
+
+/* use this one only if no ibv_dev available */
+#define ehca_gen_dbg(format, arg...) \
+ do { \
+ if (unlikely(libehca_trace_on)) \
+ fprintf(stderr, "PID%04x EHCA_DBG:%s " format "\n", \
+ getpid(), __func__, ##arg); \
+ } while (0)
+
+#define ehca_gen_err(format, arg...) \
+ fprintf(stderr, "PID%04x EHCA_ERR:%s " format "\n", \
+ getpid(), __func__, ##arg)
-#define EDEB_GENERIC(level,idstring,format,args...) \
-do { \
- if (unlikely(level<=libehca_trlevel))\
- fprintf(libehca_fh,"%s " idstring " "format "\n", __func__, ##args); \
-} while (1==0)
-#endif /* EDEB_NO_TRACE */
-
-#define EDEB(level,format,args...) \
- EDEB_GENERIC(level,"",format,##args)
-#define EDEB_EN(level,format,args...) \
- EDEB_GENERIC(level,">>>",format,##args)
-#define EDEB_EX(level,format,args...) \
- EDEB_GENERIC(level,"<<<",format,##args)
-#define EDEB_ERR(level,format,args...) \
- EDEB_GENERIC(level,"HCAD_ERROR ",format,##args)
/**
- * EDEB macro to dump a memory block, whose length is n*8 bytes.
+ * EHCA macro to dump a memory block, whose length is n*8 bytes.
* Each line has the following layout:
* <format string> adr=X ofs=Y <8 bytes hex> <8 bytes hex>
*/
@@ -98,92 +95,56 @@ do { \
#else
#define FORMAT_2U64 "%016lx %016lx"
#endif
-#define EDEB_DMP(level,adr,len,format,args...) \
- do { \
+#define ehca_dmp_dbg(adr, len, format, args...) \
+do { \
+ if (unlikely(libehca_trace_on)) { \
+ unsigned int x; \
+ unsigned int l = (unsigned int)(len); \
+ unsigned char *deb = (unsigned char*)(adr); \
+ for (x = 0; x < l; x += 16) { \
+ ehca_gen_dbg(format " adr=%p ofs=%04x " FORMAT_2U64, \
+ ##args, deb, x, \
+ *((u64 *)&deb[0]), *((u64 *)&deb[8])); \
+ deb += 16; \
+ } \
+ } \
+} while (0)
+
+#define ehca_dmp_err(adr, len, format, args...) \
+ do { \
unsigned int x; \
unsigned int l = (unsigned int)(len); \
unsigned char *deb = (unsigned char*)(adr); \
for (x = 0; x < l; x += 16) { \
- EDEB(level, format " adr=%p ofs=%04x " FORMAT_2U64, \
+ ehca_gen_err(format " adr=%p ofs=%04x " FORMAT_2U64, \
##args, deb, x, \
*((u64 *)&deb[0]), *((u64 *)&deb[8])); \
deb += 16; \
} \
- } while (0)
+ } while (0)
-/* define a bitmask, little endian version */
-#define EHCA_BMASK(pos,length) (((pos)<<16)+(length))
/* define a bitmask, the ibm way... */
-#define EHCA_BMASK_IBM(from,to) (((63-to)<<16)+((to)-(from)+1))
+#define EHCA_BMASK_IBM(from, to) (((63-to)<<16)+((to)-(from)+1))
/* internal function, don't use */
#define EHCA_BMASK_SHIFTPOS(mask) (((mask)>>16)&0xffff)
/* internal function, don't use */
#define EHCA_BMASK_MASK(mask) (0xffffffffffffffffULL >> ((64-(mask))&0xffff))
-/** return value shifted and masked by mask\n
- variable|=HCA_BMASK_SET(MY_MASK,0x4711) ORs the bits in variable\n
- variable&=~HCA_BMASK_SET(MY_MASK,-1) clears the bits from the mask
+/** return value shifted and masked by mask
+ variable|=HCA_BMASK_SET(MY_MASK,0x4711) ORs the bits in variable
+ variable&=~HCA_BMASK_SET(MY_MASK,-1) clears the bits from the mask
in variable
*/
-#define EHCA_BMASK_SET(mask,value) \
+#define EHCA_BMASK_SET(mask, value) \
((EHCA_BMASK_MASK(mask) & ((u64)(value)))<<EHCA_BMASK_SHIFTPOS(mask))
-
-#include "ehca_qes.h"
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
-#define PARANOIA_MODE
-#ifdef PARANOIA_MODE
-#define EHCA_CHECK_ADR_P(adr) \
- if (adr==0) {\
- EDEB_ERR(4, "adr=%p check failed line %i", adr,__LINE__); \
- return ERR_PTR(-EFAULT); }
-
-#define EHCA_CHECK_ADR(adr) \
- if (adr==0) {\
- EDEB_ERR(4, "adr=%p check failed line %i", adr,__LINE__); \
- return -EFAULT; }
-
-#define EHCA_CHECK_CQ(cq) \
- if (cq==0) {\
- EDEB_ERR(4, "cq=%p check failed", cq); \
- return -EFAULT; }
-
-#define EHCA_CHECK_CQ_P(cq) \
- if (cq==0) {\
- EDEB_ERR(4, "cq=%p check failed", cq); \
- return ERR_PTR(-EFAULT); }
-
-#define EHCA_CHECK_QP(qp) \
- if (qp==0) {\
- EDEB_ERR(4, "qp=%p check failed", qp); \
- return -EFAULT; }
-
-#define EHCA_CHECK_QP_P(qp) \
- if (qp==0) {\
- EDEB_ERR(4, "qp=%p check failed", qp); \
- return ERR_PTR(-EFAULT); }
-
-#else
-#define EHCA_CHECK_ADR_P(adr)
-
-#define EHCA_CHECK_ADR(adr)
+ const typeof(((type *)0)->member) *__mptr = (ptr); \
+ (type *)((char *)__mptr - offsetof(type, member));})
-#define EHCA_CHECK_CQ(cq)
-
-#define EHCA_CHECK_CQ_P(cq)
-
-#define EHCA_CHECK_QP(qp)
-
-#define EHCA_CHECK_QP_P(qp)
-#endif
#define be64_to_cpu(x) (x)
-#define mftb() ({ unsigned long rval; \
- asm volatile("mftb %0" : "=r" (rval)); rval; })
-
-#define asm_sync_mem() __asm__ __volatile__ ("sync" : : : "memory")
-
#endif /* __EHCA_UTOOL_H__ */
diff -Nurp libehca_old/src/hcp_phyp.c libehca_new/src/hcp_phyp.c
--- libehca_old/src/hcp_phyp.c 2007-01-26 14:27:03.000000000 +0100
+++ libehca_new/src/hcp_phyp.c 2007-01-26 14:27:43.000000000 +0100
@@ -1,74 +1,60 @@
-/*
+/*
* IBM eServer eHCA Infiniband device driver for Linux on POWER
- *
+ *
* load store abstraction for ehca register access
*
- * Authors: Christoph Raisch <raisch at de.ibm.com>
+ * Authors: Christoph Raisch <raisch at de.ibm.com>
*
* Copyright (c) 2005 IBM Corporation
- *
+ *
* All rights reserved.
*
- * This source code is distributed under a dual license of GPL v2.0 and OpenIB
- * BSD.
+ * This source code is distributed under a dual license of GPL v2.0 and OpenIB
+ * BSD.
*
* OpenIB BSD License
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
*
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
* and/or other materials
- * provided with the distribution.
+ * provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: hcp_phyp.c,v 1.1 2006/02/22 12:26:55 nguyen Exp $
*/
-
-#define DEB_PREFIX "PHYP"
-#ifdef __KERNEL__
-#include "ehca_kernel.h"
-#include "hipz_hw.h"
-/* #include "hipz_structs.h" / * TODO: still necessary */
-#include "ehca_classes_pSeries.h"
-#else /* !__KERNEL__ */
#include "ehca_utools.h"
#include "ehca_galpa.h"
-#endif
-
-#ifndef EHCA_USERDRIVER /* TODO: is this correct */
#ifdef __PPC64__
u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)
{
u64 addr = galpa.fw_handle + offset;
- EDEB_EN(7, "addr=%lx offset=%x ", addr, offset);
+ ehca_gen_dbg("addr=%lx offset=%x ", addr, offset);
u64 out = *(u64 *) addr;
- EDEB_EX(7, "addr=%lx value=%lx", addr, out);
+ ehca_gen_dbg("addr=%lx value=%lx", addr, out);
return out;
};
void hipz_galpa_store(struct h_galpa galpa, u32 offset, u64 value)
{
u64 addr = galpa.fw_handle + offset;
- EDEB(7, "addr=%lx offset=%x value=%lx", addr,
- offset, value);
+ ehca_gen_dbg("addr=%lx offset=%x value=%lx", addr, offset, value);
*(u64 *) addr = value;
#ifdef EHCA_USE_HCALL
/* hipz_galpa_load(galpa, offset);*/
@@ -76,9 +62,9 @@ void hipz_galpa_store(struct h_galpa gal
};
#else /* ___PPC64__ the only way to do 8 byte store in 32 bit mode ?*/
-inline static void load64(u64 * from, u64 *to)
+inline static void load64(u64 *from, u64 *to)
{
- unsigned long temp=0;
+ unsigned long temp = 0;
asm("ld %2,0(%0)\n\t"
"std %2,0(%1)":/*no output*/:"r"(from),"r"(to),"r" (temp):"r0");
}
@@ -86,34 +72,34 @@ inline static void load64(u64 * from, u6
u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)
{
void * addr = ((void*)(unsigned long)galpa.fw_handle) + offset;
- EDEB_EN(7, "addr=%p offset=%x ", addr, offset);
+ ehca_gen_dbg("addr=%p offset=%x ", addr, offset);
u32 temp[4];
- u64 *outadr=(u64*)((((u32)&temp)+7)&~7);/* 8 byte align the stack adress*/
+ /* 8 byte align the stack adress*/
+ u64 *outadr=(u64*)((((u32)&temp) + 7) & ~7);
load64(addr, outadr);
- EDEB_EX(7, "addr=%p value=%Lx", addr, *outadr);
+ ehca_gen_dbg("addr=%p value=%Lx", addr, *outadr);
return *outadr;
};
-inline static void store64(void * adr,unsigned int datal, unsigned int datah)
+inline static void store64(void *adr, unsigned int datal, unsigned int datah)
{
unsigned long temp=0;
asm("sldi %3,%1,32\n\t"
"or 0,%3,%0\n\t"
- "std 0,0(%2)\n" :/* no output */: "r" (datal), "r" (datah), "r" (adr), "r" (temp):"r0");
+ "std 0,0(%2)\n" :/* no output */: "r" (datal), "r" (datah),
+ "r" (adr), "r" (temp):"r0");
}
void hipz_galpa_store(struct h_galpa galpa, u32 offset, u64 value)
{
void * addr = ((void*)(unsigned long)galpa.fw_handle) + offset;
- EDEB(7, "addr=%p offset=%x value=%Lx", addr,
- offset, value);
- store64(addr,value&0xffffffffULL,value >>32ULL);
+ ehca_gen_dbg("addr=%p offset=%x value=%Lx", addr, offset, value);
+ store64(addr, value&0xffffffffULL, value >>32ULL);
#ifdef EHCA_USE_HCALL
- /* hipz_galpa_load(galpa, offset); */
- /* synchronize explicitly */
+ /* hipz_galpa_load(galpa, offset);
+ * synchronize explicitly
+ */
#endif
};
#endif /* ___PPC64__*/
-
-#endif /* EHCA_USERDRIVER */
diff -Nurp libehca_old/src/hipz_fns_core.h libehca_new/src/hipz_fns_core.h
--- libehca_old/src/hipz_fns_core.h 2007-01-26 14:27:03.000000000 +0100
+++ libehca_new/src/hipz_fns_core.h 2007-01-26 14:27:43.000000000 +0100
@@ -38,8 +38,6 @@
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: hipz_fns_core.h,v 1.2 2006/03/26 21:27:27 nguyen Exp $
*/
#ifndef __HIPZ_FNS_CORE_H__
@@ -48,76 +46,71 @@
#include "ehca_galpa.h"
#include "hipz_hw.h"
-#define hipz_galpa_store_cq(gal,offset,value)\
- hipz_galpa_store(gal,CQTEMM_OFFSET(offset),value)
-#define hipz_galpa_load_cq(gal,offset)\
- hipz_galpa_load(gal,CQTEMM_OFFSET(offset))
-
-#define hipz_galpa_store_qp(gal,offset,value)\
- hipz_galpa_store(gal,QPTEMM_OFFSET(offset),value)
-#define hipz_galpa_load_qp(gal,offset)\
- hipz_galpa_load(gal,QPTEMM_OFFSET(offset))
+#define hipz_galpa_store_cq(gal, offset, value) \
+ hipz_galpa_store(gal, CQTEMM_OFFSET(offset), value)
+#define hipz_galpa_load_cq(gal, offset) \
+ hipz_galpa_load(gal, CQTEMM_OFFSET(offset))
+
+#define hipz_galpa_store_qp(gal, offset, value) \
+ hipz_galpa_store(gal, QPTEMM_OFFSET(offset), value)
+#define hipz_galpa_load_qp(gal, offset) \
+ hipz_galpa_load(gal, QPTEMM_OFFSET(offset))
inline static void hipz_update_SQA(struct ehcau_qp *qp, u16 nr_wqes)
{
struct h_galpa gal;
- EDEB_EN(7, "qp=%p", qp);
gal = qp->galpas.kernel;
/* ringing doorbell :-) */
hipz_galpa_store_qp(gal, QPx_SQA, EHCA_BMASK_SET(QPx_SQAdder, nr_wqes));
- EDEB_EX(7, "qp=%p QPx_SQA = %i", qp, nr_wqes);
+ ehca_gen_dbg("qp=%p QPx_SQA = %i", qp, nr_wqes);
}
inline static void hipz_update_RQA(struct ehcau_qp *qp, u16 nr_wqes)
{
struct h_galpa gal;
- EDEB_EN(7, "qp=%p", qp);
gal = qp->galpas.kernel;
/* ringing doorbell :-) */
hipz_galpa_store_qp(gal, QPx_RQA, EHCA_BMASK_SET(QPx_RQAdder, nr_wqes));
- EDEB_EX(7, "qp=%p QPx_RQA = %i", qp, nr_wqes);
+ ehca_gen_dbg("qp=%p QPx_RQA = %i", qp, nr_wqes);
}
inline static void hipz_update_FECA(struct ehcau_cq *cq, u32 nr_cqes)
{
struct h_galpa gal;
- EDEB_EN(7, "cq=%p", cq);
gal = cq->galpas.kernel;
hipz_galpa_store_cq(gal, CQx_FECA,
EHCA_BMASK_SET(CQx_FECAdder, nr_cqes));
- EDEB_EX(7, "cq=%p CQx_FECA = %i", cq, nr_cqes);
+ ehca_gen_dbg("cq=%p CQx_FECA = %i", cq, nr_cqes);
}
inline static void hipz_set_CQx_N0(struct ehcau_cq *cq, u32 value)
{
struct h_galpa gal;
- u64 CQx_N0_reg = 0;
+ u64 CQx_N0_reg;
- EDEB_EN(7, "cq=%p event on solicited completion -- write CQx_N0",
- cq);
+ ehca_gen_dbg("cq=%p event on solicited completion -- write CQx_N0", cq);
gal = cq->galpas.kernel;
hipz_galpa_store_cq(gal, CQx_N0,
EHCA_BMASK_SET(CQx_N0_generate_solicited_comp_event,
value));
CQx_N0_reg = hipz_galpa_load_cq(gal, CQx_N0);
- EDEB_EX(7, "cq=%p loaded CQx_N0=%lx", cq,(unsigned long)CQx_N0_reg);
+ ehca_gen_dbg("cq=%p loaded CQx_N0=%lx", cq, (unsigned long)CQx_N0_reg);
}
inline static void hipz_set_CQx_N1(struct ehcau_cq *cq, u32 value)
{
struct h_galpa gal;
- u64 CQx_N1_reg = 0;
+ u64 CQx_N1_reg;
- EDEB_EN(7, "cq=%p event on completion -- write CQx_N1",
- cq);
+ ehca_gen_dbg("cq=%p event on completion -- write CQx_N1", cq);
gal = cq->galpas.kernel;
hipz_galpa_store_cq(gal, CQx_N1,
EHCA_BMASK_SET(CQx_N1_generate_comp_event, value));
CQx_N1_reg = hipz_galpa_load_cq(gal, CQx_N1);
- EDEB_EX(7, "cq=%p loaded CQx_N1=%lx", cq,(unsigned long)CQx_N1_reg);
+ ehca_gen_dbg("cq=%p loaded CQx_N1=%lx", cq, (unsigned long)CQx_N1_reg);
}
#endif /* __HIPZ_FNC_CORE_H__ */
diff -Nurp libehca_old/src/hipz_hw.h libehca_new/src/hipz_hw.h
--- libehca_old/src/hipz_hw.h 2007-01-26 14:27:03.000000000 +0100
+++ libehca_new/src/hipz_hw.h 2007-01-26 14:27:43.000000000 +0100
@@ -38,8 +38,6 @@
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: hipz_hw.h,v 1.1 2006/02/22 12:26:55 nguyen Exp $
*/
#ifndef __HIPZ_HW_H__
@@ -52,191 +50,189 @@
#include "ehca_utools.h"
#endif
-/** @brief Queue Pair Table Memory
- */
+#define EHCA_MAX_MTU 4
+
+/* Queue Pair Table Memory */
struct hipz_QPTEMM {
u64 QPx_HCR;
-#define QPx_HCR_PKEY_Mode EHCA_BMASK_IBM(1,2)
-#define QPx_HCR_Special_QP_Mode EHCA_BMASK_IBM(6,7)
+#define QPx_HCR_PKEY_Mode EHCA_BMASK_IBM(1, 2)
+#define QPx_HCR_Special_QP_Mode EHCA_BMASK_IBM(6, 7)
u64 QPx_C;
-#define QPx_C_Enabled EHCA_BMASK_IBM(0,0)
-#define QPx_C_Disabled EHCA_BMASK_IBM(1,1)
-#define QPx_C_Req_State EHCA_BMASK_IBM(16,23)
-#define QPx_C_Res_State EHCA_BMASK_IBM(25,31)
-#define QPx_C_disable_ETE_check EHCA_BMASK_IBM(7,7)
+#define QPx_C_Enabled EHCA_BMASK_IBM(0, 0)
+#define QPx_C_Disabled EHCA_BMASK_IBM(1, 1)
+#define QPx_C_Req_State EHCA_BMASK_IBM(16, 23)
+#define QPx_C_Res_State EHCA_BMASK_IBM(25, 31)
+#define QPx_C_disable_ETE_check EHCA_BMASK_IBM(7, 7)
u64 QPx_HERR;
u64 QPx_AER;
-/* 0x20*/
+ /* 0x20*/
u64 QPx_SQA;
-#define QPx_SQAdder EHCA_BMASK_IBM(48,63)
+#define QPx_SQAdder EHCA_BMASK_IBM(48, 63)
u64 QPx_SQC;
u64 QPx_RQA;
-#define QPx_RQAdder EHCA_BMASK_IBM(48,63)
+#define QPx_RQAdder EHCA_BMASK_IBM(48, 63)
u64 QPx_RQC;
-/* 0x40*/
+ /* 0x40*/
u64 QPx_ST;
u64 QPx_PMSTATE;
-#define QPx_PMSTATE_BITS EHCA_BMASK_IBM(30,31)
+#define QPx_PMSTATE_BITS EHCA_BMASK_IBM(30, 31)
u64 QPx_PMFA;
u64 QPx_PKEY;
-#define QPx_PKEY_value EHCA_BMASK_IBM(48,63)
-/* 0x60*/
+#define QPx_PKEY_value EHCA_BMASK_IBM(48, 63)
+ /* 0x60*/
u64 QPx_PKEYA;
-#define QPx_PKEYA_index0 EHCA_BMASK_IBM(0,15)
-#define QPx_PKEYA_index1 EHCA_BMASK_IBM(16,31)
-#define QPx_PKEYA_index2 EHCA_BMASK_IBM(32,47)
-#define QPx_PKEYA_index3 EHCA_BMASK_IBM(48,63)
+#define QPx_PKEYA_index0 EHCA_BMASK_IBM(0, 15)
+#define QPx_PKEYA_index1 EHCA_BMASK_IBM(16, 31)
+#define QPx_PKEYA_index2 EHCA_BMASK_IBM(32, 47)
+#define QPx_PKEYA_index3 EHCA_BMASK_IBM(48, 63)
u64 QPx_PKEYB;
-#define QPx_PKEYB_index4 EHCA_BMASK_IBM(0,15)
-#define QPx_PKEYB_index5 EHCA_BMASK_IBM(16,31)
-#define QPx_PKEYB_index6 EHCA_BMASK_IBM(32,47)
-#define QPx_PKEYB_index7 EHCA_BMASK_IBM(48,63)
+#define QPx_PKEYB_index4 EHCA_BMASK_IBM(0, 15)
+#define QPx_PKEYB_index5 EHCA_BMASK_IBM(16, 31)
+#define QPx_PKEYB_index6 EHCA_BMASK_IBM(32, 47)
+#define QPx_PKEYB_index7 EHCA_BMASK_IBM(48, 63)
u64 QPx_PKEYC;
-#define QPx_PKEYC_index8 EHCA_BMASK_IBM(0,15)
-#define QPx_PKEYC_index9 EHCA_BMASK_IBM(16,31)
-#define QPx_PKEYC_index10 EHCA_BMASK_IBM(32,47)
-#define QPx_PKEYC_index11 EHCA_BMASK_IBM(48,63)
+#define QPx_PKEYC_index8 EHCA_BMASK_IBM(0, 15)
+#define QPx_PKEYC_index9 EHCA_BMASK_IBM(16, 31)
+#define QPx_PKEYC_index10 EHCA_BMASK_IBM(32, 47)
+#define QPx_PKEYC_index11 EHCA_BMASK_IBM(48, 63)
u64 QPx_PKEYD;
-#define QPx_PKEYD_index12 EHCA_BMASK_IBM(0,15)
-#define QPx_PKEYD_index13 EHCA_BMASK_IBM(16,31)
-#define QPx_PKEYD_index14 EHCA_BMASK_IBM(32,47)
-#define QPx_PKEYD_index15 EHCA_BMASK_IBM(48,63)
-/* 0x80*/
+#define QPx_PKEYD_index12 EHCA_BMASK_IBM(0, 15)
+#define QPx_PKEYD_index13 EHCA_BMASK_IBM(16, 31)
+#define QPx_PKEYD_index14 EHCA_BMASK_IBM(32, 47)
+#define QPx_PKEYD_index15 EHCA_BMASK_IBM(48, 63)
+ /* 0x80*/
u64 QPx_QKEY;
-#define QPx_QKEY_value EHCA_BMASK_IBM(32,63)
+#define QPx_QKEY_value EHCA_BMASK_IBM(32, 63)
u64 QPx_DQP;
-#define QPx_DQP_number EHCA_BMASK_IBM(40,63)
+#define QPx_DQP_number EHCA_BMASK_IBM(40, 63)
u64 QPx_DLIDP;
-#define QPx_DLID_PRIMARY EHCA_BMASK_IBM(48,63)
-#define QPx_DLIDP_GRH EHCA_BMASK_IBM(31,31)
+#define QPx_DLID_PRIMARY EHCA_BMASK_IBM(48, 63)
+#define QPx_DLIDP_GRH EHCA_BMASK_IBM(31, 31)
u64 QPx_PORTP;
-#define QPx_PORT_Primary EHCA_BMASK_IBM(57,63)
-/* 0xa0*/
+#define QPx_PORT_Primary EHCA_BMASK_IBM(57, 63)
+ /* 0xa0*/
u64 QPx_SLIDP;
-#define QPx_SLIDP_p_path EHCA_BMASK_IBM(48,63)
-#define QPx_SLIDP_lmc EHCA_BMASK_IBM(37,39)
+#define QPx_SLIDP_p_path EHCA_BMASK_IBM(48, 63)
+#define QPx_SLIDP_lmc EHCA_BMASK_IBM(37, 39)
u64 QPx_SLIDPP;
-#define QPx_SLID_PRIM_PATH EHCA_BMASK_IBM(57,63)
+#define QPx_SLID_PRIM_PATH EHCA_BMASK_IBM(57, 63)
u64 QPx_DLIDA;
-#define QPx_DLIDA_GRH EHCA_BMASK_IBM(31,31)
+#define QPx_DLIDA_GRH EHCA_BMASK_IBM(31, 31)
u64 QPx_PORTA;
-#define QPx_PORT_Alternate EHCA_BMASK_IBM(57,63)
-/* 0xc0*/
+#define QPx_PORT_Alternate EHCA_BMASK_IBM(57, 63)
+ /* 0xc0*/
u64 QPx_SLIDA;
u64 QPx_SLIDPA;
u64 QPx_SLVL;
-#define QPx_SLVL_BITS EHCA_BMASK_IBM(56,59)
-#define QPx_SLVL_VL EHCA_BMASK_IBM(60,63)
+#define QPx_SLVL_BITS EHCA_BMASK_IBM(56, 59)
+#define QPx_SLVL_VL EHCA_BMASK_IBM(60, 63)
u64 QPx_IPD;
-#define QPx_IPD_max_static_rate EHCA_BMASK_IBM(56,63)
-/* 0xe0*/
+#define QPx_IPD_max_static_rate EHCA_BMASK_IBM(56, 63)
+ /* 0xe0*/
u64 QPx_MTU;
-#define QPx_MTU_size EHCA_BMASK_IBM(56,63)
+#define QPx_MTU_size EHCA_BMASK_IBM(56, 63)
u64 QPx_LATO;
-#define QPx_LATO_BITS EHCA_BMASK_IBM(59,63)
+#define QPx_LATO_BITS EHCA_BMASK_IBM(59, 63)
u64 QPx_RLIMIT;
-#define QPx_RETRY_COUNT EHCA_BMASK_IBM(61,63)
+#define QPx_RETRY_COUNT EHCA_BMASK_IBM(61, 63)
u64 QPx_RNRLIMIT;
-#define QPx_RNR_RETRY_COUNT EHCA_BMASK_IBM(61,63)
-/* 0x100*/
+#define QPx_RNR_RETRY_COUNT EHCA_BMASK_IBM(61, 63)
+ /* 0x100*/
u64 QPx_T;
u64 QPx_SQHP;
u64 QPx_SQPTP;
u64 QPx_NSPSN;
-#define QPx_NSPSN_value EHCA_BMASK_IBM(40,63)
-/* 0x120*/
+#define QPx_NSPSN_value EHCA_BMASK_IBM(40, 63)
+ /* 0x120*/
u64 QPx_NSPSNHWM;
-#define QPx_NSPSNHWM_value EHCA_BMASK_IBM(40,63)
+#define QPx_NSPSNHWM_value EHCA_BMASK_IBM(40, 63)
u64 reserved1;
u64 QPx_SDSI;
u64 QPx_SDSBC;
-/* 0x140*/
+ /* 0x140*/
u64 QPx_SQWSIZE;
-#define QPx_SQWSIZE_value EHCA_BMASK_IBM(61,63)
+#define QPx_SQWSIZE_value EHCA_BMASK_IBM(61, 63)
u64 QPx_SQWTS;
u64 QPx_LSN;
u64 QPx_NSSN;
-/* 0x160 */
+ /* 0x160 */
u64 QPx_MOR;
-#define QPx_MOR_value EHCA_BMASK_IBM(48,63)
+#define QPx_MOR_value EHCA_BMASK_IBM(48, 63)
u64 QPx_COR;
u64 QPx_SQSIZE;
-#define QPx_SQSIZE_value EHCA_BMASK_IBM(60,63)
+#define QPx_SQSIZE_value EHCA_BMASK_IBM(60, 63)
u64 QPx_ERC;
-/* 0x180*/
+ /* 0x180*/
u64 QPx_RNRRC;
-#define QPx_RNRRESP_value EHCA_BMASK_IBM(59,63)
+#define QPx_RNRRESP_value EHCA_BMASK_IBM(59, 63)
u64 QPx_ERNRWT;
u64 QPx_RNRRESP;
-#define QPx_RNRRESP_WTR EHCA_BMASK_IBM(59,63)
+#define QPx_RNRRESP_WTR EHCA_BMASK_IBM(59, 63)
u64 QPx_LMSNA;
-/* 0x1a0 */
+ /* 0x1a0 */
u64 QPx_SQHPC;
u64 QPx_SQCPTP;
u64 QPx_SIGT;
u64 QPx_WQECNT;
-/* 0x1c0*/
-
+ /* 0x1c0*/
u64 QPx_RQHP;
u64 QPx_RQPTP;
u64 QPx_RQSIZE;
-#define QPx_RQSIZE_value EHCA_BMASK_IBM(60,63)
+#define QPx_RQSIZE_value EHCA_BMASK_IBM(60, 63)
u64 QPx_NRR;
-#define QPx_NRR_value EHCA_BMASK_IBM(61,63)
-/* 0x1e0*/
+#define QPx_NRR_value EHCA_BMASK_IBM(61, 63)
+ /* 0x1e0*/
u64 QPx_RDMAC;
-#define QPx_RDMAC_value EHCA_BMASK_IBM(61,63)
+#define QPx_RDMAC_value EHCA_BMASK_IBM(61, 63)
u64 QPx_NRPSN;
-#define QPx_NRPSN_value EHCA_BMASK_IBM(40,63)
+#define QPx_NRPSN_value EHCA_BMASK_IBM(40, 63)
u64 QPx_LAPSN;
-#define QPx_LAPSN_value EHCA_BMASK_IBM(40,63)
+#define QPx_LAPSN_value EHCA_BMASK_IBM(40, 63)
u64 QPx_LCR;
-/* 0x200*/
+ /* 0x200*/
u64 QPx_RWC;
u64 QPx_RWVA;
u64 QPx_RDSI;
u64 QPx_RDSBC;
-/* 0x220*/
+ /* 0x220*/
u64 QPx_RQWSIZE;
-#define QPx_RQWSIZE_value EHCA_BMASK_IBM(61,63)
+#define QPx_RQWSIZE_value EHCA_BMASK_IBM(61, 63)
u64 QPx_CRMSN;
u64 QPx_RDD;
-#define QPx_RDD_VALUE EHCA_BMASK_IBM(32,63)
+#define QPx_RDD_VALUE EHCA_BMASK_IBM(32, 63)
u64 QPx_LARPSN;
-#define QPx_LARPSN_value EHCA_BMASK_IBM(40,63)
-/* 0x240*/
+#define QPx_LARPSN_value EHCA_BMASK_IBM(40, 63)
+ /* 0x240*/
u64 QPx_PD;
u64 QPx_SCQN;
u64 QPx_RCQN;
u64 QPx_AEQN;
-/* 0x260*/
+ /* 0x260*/
u64 QPx_AAELOG;
u64 QPx_RAM;
u64 QPx_RDMAQE0;
u64 QPx_RDMAQE1;
-/* 0x280*/
+ /* 0x280*/
u64 QPx_RDMAQE2;
u64 QPx_RDMAQE3;
u64 QPx_NRPSNHWM;
-#define QPx_NRPSNHWM_value EHCA_BMASK_IBM(40,63)
-/* 0x298*/
+#define QPx_NRPSNHWM_value EHCA_BMASK_IBM(40, 63)
+ /* 0x298*/
u64 reserved[(0x400 - 0x298) / 8];
-/* 0x400 extended data */
+ /* 0x400 extended data */
u64 reserved_ext[(0x500 - 0x400) / 8];
-/* 0x500 */
+ /* 0x500 */
u64 reserved2[(0x1000 - 0x500) / 8];
-/* 0x1000 */
+ /* 0x1000 */
};
-#define QPTEMM_OFFSET(x) offsetof(struct hipz_QPTEMM,x)
+#define QPTEMM_OFFSET(x) offsetof(struct hipz_QPTEMM, x)
-/** @brief MRMWPT Entry Memory Map
- */
+/* MRMWPT Entry Memory Map */
struct hipz_MRMWMM {
/* 0x00 */
u64 MRx_HCR;
-#define MRx_HCR_LPARID_VALID EHCA_BMASK_IBM(0,0)
-
+#define MRx_HCR_LPARID_VALID EHCA_BMASK_IBM(0, 0)
u64 MRx_C;
u64 MRx_HERR;
u64 MRx_AER;
@@ -249,26 +245,24 @@ struct hipz_MRMWMM {
u64 reserved4[(0x200 - 0x40) / 8];
/* 0x200 */
u64 MRx_CTL[64];
-
};
-#define MRMWMM_OFFSET(x) offsetof(struct hipz_MRMWMM,x)
+#define MRMWMM_OFFSET(x) offsetof(struct hipz_MRMWMM, x)
-/** @brief QPEDMM
- */
+/* QPEDMM */
struct hipz_QPEDMM {
/* 0x00 */
u64 reserved0[(0x400) / 8];
/* 0x400 */
u64 QPEDx_PHH;
-#define QPEDx_PHH_TClass EHCA_BMASK_IBM(4,11)
-#define QPEDx_PHH_HopLimit EHCA_BMASK_IBM(56,63)
-#define QPEDx_PHH_FlowLevel EHCA_BMASK_IBM(12,31)
+#define QPEDx_PHH_TClass EHCA_BMASK_IBM(4, 11)
+#define QPEDx_PHH_HopLimit EHCA_BMASK_IBM(56, 63)
+#define QPEDx_PHH_FlowLevel EHCA_BMASK_IBM(12, 31)
u64 QPEDx_PPSGP;
-#define QPEDx_PPSGP_PPPidx EHCA_BMASK_IBM(0,63)
+#define QPEDx_PPSGP_PPPidx EHCA_BMASK_IBM(0, 63)
/* 0x410 */
u64 QPEDx_PPSGU;
-#define QPEDx_PPSGU_PPPSGID EHCA_BMASK_IBM(0,63)
+#define QPEDx_PPSGU_PPPSGID EHCA_BMASK_IBM(0, 63)
u64 QPEDx_PPDGP;
/* 0x420 */
u64 QPEDx_PPDGU;
@@ -310,73 +304,71 @@ struct hipz_QPEDMM {
u64 QPEDx_RRVA3;
};
-#define QPEDMM_OFFSET(x) offsetof(struct hipz_QPEDMM,x)
+#define QPEDMM_OFFSET(x) offsetof(struct hipz_QPEDMM, x)
-/** @brief CQ Table Entry Memory Map
- */
+/* CQ Table Entry Memory Map */
struct hipz_CQTEMM {
u64 CQx_HCR;
-#define CQx_HCR_LPARID_valid EHCA_BMASK_IBM(0,0)
+#define CQx_HCR_LPARID_valid EHCA_BMASK_IBM(0, 0)
u64 CQx_C;
-#define CQx_C_Enable EHCA_BMASK_IBM(0,0)
-#define CQx_C_Disable_Complete EHCA_BMASK_IBM(1,1)
-#define CQx_C_Error_Reset EHCA_BMASK_IBM(23,23)
+#define CQx_C_Enable EHCA_BMASK_IBM(0, 0)
+#define CQx_C_Disable_Complete EHCA_BMASK_IBM(1, 1)
+#define CQx_C_Error_Reset EHCA_BMASK_IBM(23, 23)
u64 CQx_HERR;
u64 CQx_AER;
-/* 0x20 */
+ /* 0x20 */
u64 CQx_PTP;
u64 CQx_TP;
-#define CQx_FEC_CQE_cnt EHCA_BMASK_IBM(32,63)
+#define CQx_FEC_CQE_cnt EHCA_BMASK_IBM(32, 63)
u64 CQx_FEC;
u64 CQx_FECA;
-#define CQx_FECAdder EHCA_BMASK_IBM(32,63)
-/* 0x40 */
+#define CQx_FECAdder EHCA_BMASK_IBM(32, 63)
+ /* 0x40 */
u64 CQx_EP;
-#define CQx_EP_Event_Pending EHCA_BMASK_IBM(0,0)
-#define CQx_EQ_number EHCA_BMASK_IBM(0,15)
-#define CQx_EQ_CQtoken EHCA_BMASK_IBM(32,63)
+#define CQx_EP_Event_Pending EHCA_BMASK_IBM(0, 0)
+#define CQx_EQ_number EHCA_BMASK_IBM(0, 15)
+#define CQx_EQ_CQtoken EHCA_BMASK_IBM(32, 63)
u64 CQx_EQ;
-/* 0x50 */
+ /* 0x50 */
u64 reserved1;
u64 CQx_N0;
-#define CQx_N0_generate_solicited_comp_event EHCA_BMASK_IBM(0,0)
-/* 0x60 */
+#define CQx_N0_generate_solicited_comp_event EHCA_BMASK_IBM(0, 0)
+ /* 0x60 */
u64 CQx_N1;
-#define CQx_N1_generate_comp_event EHCA_BMASK_IBM(0,0)
+#define CQx_N1_generate_comp_event EHCA_BMASK_IBM(0, 0)
u64 reserved2[(0x1000 - 0x60) / 8];
-/* 0x1000 */
+ /* 0x1000 */
};
-#define CQTEMM_OFFSET(x) offsetof(struct hipz_CQTEMM,x)
+#define CQTEMM_OFFSET(x) offsetof(struct hipz_CQTEMM, x)
-/** @brief EQ Table Entry Memory Map
- */
+/* EQ Table Entry Memory Map */
struct hipz_EQTEMM {
u64 EQx_HCR;
-#define EQx_HCR_LPARID_valid EHCA_BMASK_IBM(0,0)
-#define EQx_HCR_ENABLE_PSB EHCA_BMASK_IBM(8,8)
+#define EQx_HCR_LPARID_valid EHCA_BMASK_IBM(0, 0)
+#define EQx_HCR_ENABLE_PSB EHCA_BMASK_IBM(8, 8)
u64 EQx_C;
-#define EQx_C_Enable EHCA_BMASK_IBM(0,0)
-#define EQx_C_Error_Reset EHCA_BMASK_IBM(23,23)
-#define EQx_C_Comp_Event EHCA_BMASK_IBM(17,17)
+#define EQx_C_Enable EHCA_BMASK_IBM(0, 0)
+#define EQx_C_Error_Reset EHCA_BMASK_IBM(23, 23)
+#define EQx_C_Comp_Event EHCA_BMASK_IBM(17, 17)
u64 EQx_HERR;
u64 EQx_AER;
-/* 0x20 */
+ /* 0x20 */
u64 EQx_PTP;
u64 EQx_TP;
u64 EQx_SSBA;
u64 EQx_PSBA;
-/* 0x40 */
+ /* 0x40 */
u64 EQx_CEC;
u64 EQx_MEQL;
u64 EQx_XISBI;
u64 EQx_XISC;
-/* 0x60 */
+ /* 0x60 */
u64 EQx_IT;
};
-#define EQTEMM_OFFSET(x) offsetof(struct hipz_EQTEMM,x)
+#define EQTEMM_OFFSET(x) offsetof(struct hipz_EQTEMM, x)
#endif
diff -Nurp libehca_old/src/ipzu_pt_fn.h libehca_new/src/ipzu_pt_fn.h
--- libehca_old/src/ipzu_pt_fn.h 2007-01-26 14:27:03.000000000 +0100
+++ libehca_new/src/ipzu_pt_fn.h 2007-01-26 14:27:43.000000000 +0100
@@ -39,8 +39,6 @@
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: ipzu_pt_fn.h,v 1.1 2006/03/26 22:34:11 nguyen Exp $
*/
#ifndef __IPZU_PT_FN_H__
@@ -60,33 +58,32 @@ struct ipzu_queue {
u32 dummy3; /* 64 bit alignment*/
};
-/** return current Queue Entry
- @returns address of current Queue Entry
- */
+/* returns address of current Queue Entry */
static inline void *ipzu_qeit_get(struct ipzu_queue *queue)
{
- return (queue->current_q_addr);
+ return queue->current_q_addr;
}
-/** return current Queue Page , increment Queue Page iterator from
- page to page in struct ipzu_queue, last increment will return 0! and
- NOT wrap
- @returns address of current Queue Page
- @warning don't use in parallel with ipzu_qeit_get_inc()
+/*
+ * return current Queue Page , increment Queue Page iterator from
+ * page to page in struct ipzu_queue, last increment will return 0! and
+ * NOT wrap
+ * warning: don't use in parallel with ipzu_qeit_get_inc()
*/
void *ipzu_qpageit_get_inc(struct ipzu_queue *queue);
-/** return current Queue Entry, increment Queue Entry iterator by one
- step in struct ipzu_queue, will wrap in ringbuffer
- @returns address of current Queue Entry BEFORE increment
- @warning don't use in parallel with ipzu_qpageit_get_inc()
- @warning unpredictable results may occur if steps>act_nr_of_queue_entries
+/*
+ * return current Queue Entry, increment Queue Entry iterator by one
+ * step in struct ipzu_queue, will wrap in ringbuffer
+ * (returns address of current Queue Entry BEFORE increment)
+ * warning: don't use in parallel with ipzu_qpageit_get_inc()
+ * warning: unpredictable results may occur if steps>act_nr_of_queue_entries
*/
static inline void *ipzu_qeit_get_inc(struct ipzu_queue *queue)
{
- void *retvalue = 0;
+ void *retvalue;
u8 *last_entry_in_q = queue->queue + queue->queue_length
- - queue->qe_size;
+ - queue->qe_size;
retvalue = queue->current_q_addr;
queue->current_q_addr += queue->qe_size;
@@ -96,38 +93,37 @@ static inline void *ipzu_qeit_get_inc(st
queue->toggle_state = (~queue->toggle_state) & 1;
}
- EDEB(7, "queue=%p retvalue=%p new current_q_addr=%p qe_size=%x",
- queue, retvalue, queue->current_q_addr, queue->qe_size);
-
- return (retvalue);
+ ehca_gen_dbg("queue=%p retvalue=%p new current_q_addr=%p qe_size=%x",
+ queue, retvalue, queue->current_q_addr, queue->qe_size);
+ return retvalue;
}
-/** return current Queue Entry, increment Queue Entry iterator by one
- step in struct ipzu_queue, will wrap in ringbuffer
- @returns address of current Queue Entry BEFORE increment
- @returns 0 and does not increment, if wrong valid state
- @warning don't use in parallel with ipzu_qpageit_get_inc()
- @warning unpredictable results may occur if steps>act_nr_of_queue_entries
+/* return current Queue Entry, increment Queue Entry iterator by one
+ * step in struct ipzu_queue, will wrap in ringbuffer
+ * (returns address of current Queue Entry BEFORE increment)
+ * (returns 0 and does not increment, if wrong valid state)
+ * warning: don't use in parallel with ipzu_qpageit_get_inc()
+ * warning: unpredictable results may occur if steps>act_nr_of_queue_entries
*/
inline static void *ipzu_qeit_get_inc_valid(struct ipzu_queue *queue)
{
void *retvalue = ipzu_qeit_get(queue);
u32 qe = ((struct ehca_cqe *)retvalue)->cqe_flags;
- if ((qe >> 7) == (queue->toggle_state & 1)) {
- /* this is a good one */
- ipzu_qeit_get_inc(queue);
- } else
- retvalue = 0;
- return (retvalue);
+ if ((qe >> 7) != (queue->toggle_state & 1))
+ return NULL;
+ /* this is a good one */
+ ipzu_qeit_get_inc(queue);
+ return retvalue;
}
-/** returns and resets Queue Entry iterator
- @returns address (kv) of first Queue Entry
+/*
+ * returns and resets Queue Entry iterator
+ * (returns address (kv) of first Queue Entry)
*/
static inline void *ipzu_qeit_reset(struct ipzu_queue *queue)
{
queue->current_q_addr = queue->queue;
- return (queue->queue);
+ return queue->queue;
}
#endif /* __IPZU_PT_FN_H__ */
More information about the general
mailing list