[openib-general] PPC64 2.6 kernel support

Roland Dreier
Mon Mar 29 06:21:20 PST 2004


The openib site isn't archiving attachments yet.  In case someone
reading the archive wants the ppc64 patch, I'm resending it inline
now...

 - Roland

diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/Kconfig infiniband/Kconfig
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/Kconfig    2004-02-22 23:03:09.000000000 -0800
+++ infiniband/Kconfig  2004-03-28 09:31:17.000000000 -0800
@@ -2,7 +2,7 @@ menu "InfiniBand support"
 
 config INFINIBAND
        tristate "InfiniBand support"
-       depends on X86 || X86_64 || IA64
+       depends on X86 || X86_64 || IA64 || PPC64
        default n
        ---help---
          Core support for InfiniBand (IB).  Make sure to also select
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/mosal_timer_imp.h infiniband/hw/mellanox-hca/include/mosal_timer_imp.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/mosal_timer_imp.h  2004-03-05 12:11:11.000000000 -0800
+++ infiniband/hw/mellanox-hca/include/mosal_timer_imp.h        2004-03-28 13:22:23.000000000 -0800
@@ -109,7 +109,7 @@ struct MOSAL_timer {
 
 #endif /* __KERNEL__ */
 
-#if defined(powerpc) || defined(__powerpc__) 
+#if (defined(powerpc) || defined(__powerpc__)) && !defined(__PPC64__) 
 static __inline__ unsigned int mftbu(void)
 {
         unsigned int re;
@@ -139,5 +139,9 @@ static __inline__  u_int64_t  MOSAL_ppc_
 
 #endif /* __powerpc__ */
 
+#if defined(__PPC64__)
+#define MOSAL_ppc_cputime_get(x) mftb()
+#endif
+
 #endif /* H_MOSAL_TIMER_IMP_H */
 
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/sys/mtl_ppc64_types.h infiniband/hw/mellanox-hca/include/sys/mtl_ppc64_types.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/sys/mtl_ppc64_types.h      1969-12-31 16:00:00.000000000 -0800
+++ infiniband/hw/mellanox-hca/include/sys/mtl_ppc64_types.h    2004-03-28 14:06:54.000000000 -0800
@@ -0,0 +1,58 @@
+/*
+  This software is available to you under a choice of one of two
+  licenses.  You may choose to be licensed under the terms of the GNU
+  General Public License (GPL) Version 2, available at
+  <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
+  license, available in the LICENSE.TXT file accompanying this
+  software.  These details are also available at
+  <https://openib.org/license.html>.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+
+  Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
+*/
+
+#ifndef H_MTL_ARCH_TYPES_H
+#define H_MTL_ARCH_TYPES_H
+
+
+
+/*
+ * Memory sizes
+ *
+ */
+
+#define PAGESHIFT PAGE_SHIFT
+#define PAGESIZE  PAGE_SIZE
+
+
+/*
+ * Mosal memory managment types
+ */
+
+#define SIZE_T_FMT    "0x%lX"
+#define SIZE_T_XFMT    "0x%lX"
+#define SIZE_T_DFMT    "%lu"
+#define OFF_T_FMT     "0x%lX"
+#define VIRT_ADDR_FMT "0x%lX"
+#define PHYS_ADDR_FMT "0x%lX"
+#define U64_FMT       "0x%lX"
+#define MT_ULONG_PTR_FMT "0x%lX"
+#define MT_PID_FMT "%lu"
+typedef u_int64_t MT_phys_addr_t;
+typedef u_int64_t MT_virt_addr_t;
+typedef u_int64_t MT_offset_t;
+typedef u_int64_t MT_size_t;
+typedef int32_t MT_half_ptr_t;
+typedef int64_t MT_long_ptr_t;
+typedef u_int32_t MT_uhalf_ptr_t;
+typedef u_int64_t MT_ulong_ptr_t;
+
+#endif /* H_MTL_ARCH_TYPES_H */
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/sys/mtl_sys_types.h infiniband/hw/mellanox-hca/include/sys/mtl_sys_types.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/include/sys/mtl_sys_types.h        2004-03-05 12:11:11.000000000 -0800
+++ infiniband/hw/mellanox-hca/include/sys/mtl_sys_types.h      2004-03-28 14:06:43.000000000 -0800
@@ -40,6 +40,8 @@
 #undef MT_64BIT
 #ifdef __i386__
 #   include "mtl_x86_types.h"
+#elif defined(__PPC64__)
+#   include "mtl_ppc64_types.h"
 #elif defined(powerpc) || defined(__powerpc__)
 #   include "mtl_powerpc_types.h"
 #elif defined __ia64__
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/mosal/mosal_timer_imp.h infiniband/hw/mellanox-hca/mosal/mosal_timer_imp.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/hw/mellanox-hca/mosal/mosal_timer_imp.h    2004-03-05 12:11:11.000000000 -0800
+++ infiniband/hw/mellanox-hca/mosal/mosal_timer_imp.h  1969-12-31 16:00:00.000000000 -0800
@@ -1,143 +0,0 @@
-/*
-  This software is available to you under a choice of one of two
-  licenses.  You may choose to be licensed under the terms of the GNU
-  General Public License (GPL) Version 2, available at
-  <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
-  license, available in the LICENSE.TXT file accompanying this
-  software.  These details are also available at
-  <https://openib.org/license.html>.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  SOFTWARE.
-
-  Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
-*/
-
-#ifndef H_MOSAL_TIMER_IMP_H
-#define H_MOSAL_TIMER_IMP_H
-
-typedef u_int8_t  MOSAL_IRQ_ID_t;
-
-#ifdef __KERNEL__
-
-#if LINUX_KERNEL_2_4 || LINUX_KERNEL_2_6
-/* This code is only for kernel 2.4 or 2.6 */
-
-#include 
-#include 
-#include 
-
-//
-// ISRs
-//
-
-/* IRQ back compat. */
-#ifndef IRQ_HANDLED
-  typedef void irqreturn_t;
-  #define IRQ_HANDLED
-#endif
-
-
-
-typedef struct pt_regs         MOSAL_intr_regs_t;
-typedef irqreturn_t (*intr_handler_t)(int irq, void *dev_id, MOSAL_intr_regs_t* regs_p);
-
-// user ISR function prototype
-typedef irqreturn_t (*MOSAL_ISR_func_t)(MT_ulong_ptr_t func_ctx, void * isr_ctx1, void * isr_ctx2 );
-
-
-struct MOSAL_ISR {
-       MOSAL_ISR_func_t        func;
-    MOSAL_IRQ_ID_t             irq;
-    char *                             name;
-    MT_ulong_ptr_t             ctx;
-    void *                             isr_ctx1;
-    void *                             isr_ctx2;
-};
-
-
-
-//
-// DPCs
-//
-
-// types of DPC (if doesn't need to relay info from ISR to DPC - use MOSAL_NO_CTX value)
-typedef enum { MOSAL_NO_CTX, MOSAL_SINGLE_CTX, MOSAL_MULTIPLE_CTX } MOSAL_DPC_type_t;
-
-
-// 
-// the structure contains the context, relayed to user DPC 
-//
-struct DPC_CONTEXT {
-       MT_ulong_ptr_t  func_ctx;               // DPC ("static") context
-       void *                          isr_ctx1;               // "dynamic" context, relayed by ISR
-       void *                          isr_ctx2;               // "dynamic" context, relayed by ISR
-};  
-
-// user DPC function prototype
-typedef void (*MOSAL_DPC_func_t)(struct DPC_CONTEXT * func_ctx);
-
-// MOSAL DPC object
-struct MOSAL_DPC {
-       struct tasklet_struct   tasklet;
-       MOSAL_DPC_type_t                type;                   // type of DPC
-       MOSAL_DPC_func_t                func;                   // user DPC to be called
-       struct DPC_CONTEXT              dpc_ctx;                // user DPC context
-       MOSAL_spinlock_t                lock;                   // spinlock
-};
-
-// Macros 
-#define MOSAL_DPC_enable(MOSAL_DPC_p)          tasklet_enable(&MOSAL_DPC_p->tasklet)
-#define MOSAL_DPC_disable(MOSAL_DPC_p)  tasklet_disable(&MOSAL_DPC_p->tasklet)
-
-//
-// TIMERs
-//
-
-// MOSAL timer object
-struct MOSAL_timer {
-       struct timer_list       timer;                  // OS DPC object
-};
-
-#endif /* LINUX_KERNEL_2_4 */
-
-#endif /* __KERNEL__ */
-
-#if defined(powerpc) || defined(__powerpc__) 
-static __inline__ unsigned int mftbu(void)
-{
-        unsigned int re;
-        asm volatile ("mftbu %0":"=r"(re));
-        return re;
-}
-static __inline__ unsigned int mftb(void)
-{
-        unsigned int re;
-        asm volatile ("mftb %0":"=r"(re));
-        return re;
-}
-
-static __inline__  u_int64_t  MOSAL_ppc_cputime_get(void)
-{
-
-        u_int64_t upper, lower, temp;
-        do
-        {
-                upper = mftbu();
-                lower = mftb();
-                temp  = mftbu(); // (?? bypass Possible bug from ~0x0 to 0x0)
-        } while (temp != upper);
-        return (upper << 32)| lower;
-
-} // gilboa_cputime_get
-
-#endif /* __powerpc__ */
-
-#endif /* H_MOSAL_TIMER_IMP_H */
-
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/include/ts_kernel_cache.h infiniband/include/ts_kernel_cache.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/include/ts_kernel_cache.h  2004-03-05 12:11:10.000000000 -0800
+++ infiniband/include/ts_kernel_cache.h        2004-03-28 16:30:39.000000000 -0800
@@ -45,7 +45,7 @@ typedef enum {
 #  define tsKernelCacheSync(start, size, direction) \
     consistent_sync(start, size, \
                     (direction == TS_DMA_TO_DEVICE) ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE)
-#elif defined(i386) || defined(__ia64__) || defined(__x86_64__)
+#elif defined(i386) || defined(__ia64__) || defined(__x86_64__) || defined(__PPC64__)
 #  define tsKernelCacheSync(start, size, direction) do { } while(0)
 #else
 #  error tsKernelCacheSync not defined for this architecture
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/include/ts_kernel_trace.h infiniband/include/ts_kernel_trace.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/include/ts_kernel_trace.h  2004-03-05 12:11:10.000000000 -0800
+++ infiniband/include/ts_kernel_trace.h        2004-03-28 10:12:23.000000000 -0800
@@ -32,7 +32,7 @@
 #  define TS_U64_FMT "I64"
 #elif defined(i386) || defined(PPC) || defined(__x86_64__)
 #  define TS_U64_FMT "ll"
-#elif defined(__ia64__)
+#elif defined(__ia64__) || defined(__PPC64__)
 #  define TS_U64_FMT "l"
 #else
 #  error TS_U64_FMT not defined for this architecture
diff -I'\:' --exclude=CVS --exclude=.svn -Nrup /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/ulp/ipoib/ip2pr_priv.h infiniband/ulp/ipoib/ip2pr_priv.h
--- /data/home/roland/Openib/infiniband-kernel-2004-03-16/infiniband/ulp/ipoib/ip2pr_priv.h     2004-03-05 12:11:08.000000000 -0800
+++ infiniband/ulp/ipoib/ip2pr_priv.h   2004-03-28 17:43:38.000000000 -0800
@@ -328,10 +328,13 @@ typedef struct tIP2PR_LINK_ROOT_STRUCT t
 #define TS_IP2PR_INVALID_ASYNC_HANDLE (NULL)
 
 #ifdef __LITTLE_ENDIAN
-
 #define TS_GW_SWAP_64(x) swab64((x))
 #define TS_GW_SWAP_32(x) swab32((x))
 #define TS_GW_SWAP_16(x) swab16((x))
+#else
+#define TS_GW_SWAP_64(x) (x)
+#define TS_GW_SWAP_32(x) (x)
+#define TS_GW_SWAP_16(x) (x)
 #endif  /* __LITTLE_ENDIAN */
 
 #define IP2PR_DEVNAME   "ts_ip2pr"

-- 
To unsubscribe send an email with subject unsubscribe to openib-general at openib.org.
Please contact moderator at openib.org for questions.




More information about the openib-general mailing list