Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / scsi / lpfc / lpfc_compat.h
index 43531b5..a11f1ae 100644 (file)
@@ -1,34 +1,28 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
- * Enterprise Fibre Channel Host Bus Adapters.                     *
- * Refer to the README file included with this package for         *
- * driver version and adapter support.                             *
- * Copyright (C) 2004 Emulex Corporation.                          *
+ * Fibre Channel Host Bus Adapters.                                *
+ * Copyright (C) 2004-2005 Emulex.  All rights reserved.           *
+ * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
  * 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  *
- * of the License, 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, a copy of which    *
- * can be found in the file COPYING included with this package.    *
+ * modify it under the terms of version 2 of the GNU General       *
+ * Public License as published by the Free Software Foundation.    *
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package.                                     *
  *******************************************************************/
 
 /*
- * $Id: lpfc_compat.h 1.28 2004/11/09 14:49:24EST sf_support Exp  $
- *
  * This file provides macros to aid compilation in the Linux 2.4 kernel
  * over various platform architectures.
  */
 
-#ifndef _H_LPFC_COMPAT
-#define  _H_LPFC_COMPAT
-
-
 /*******************************************************************
 Note: HBA's SLI memory contains little-endian LW.
 Thus to access it from a little-endian host,
@@ -36,18 +30,19 @@ memcpy_toio() and memcpy_fromio() can be used.
 However on a big-endian host, copy 4 bytes at a time,
 using writel() and readl().
  *******************************************************************/
+#include <asm/byteorder.h>
 
-#if __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
 
 static inline void
-lpfc_memcpy_to_slim( void *dest, void *src, unsigned int bytes)
+lpfc_memcpy_to_slim(void __iomem *dest, void *src, unsigned int bytes)
 {
-       uint32_t *dest32;
+       uint32_t __iomem *dest32;
        uint32_t *src32;
        unsigned int four_bytes;
 
 
-       dest32  = (uint32_t *) dest;
+       dest32  = (uint32_t __iomem *) dest;
        src32  = (uint32_t *) src;
 
        /* write input bytes, 4 bytes at a time */
@@ -62,15 +57,15 @@ lpfc_memcpy_to_slim( void *dest, void *src, unsigned int bytes)
 }
 
 static inline void
-lpfc_memcpy_from_slim( void *dest, void *src, unsigned int bytes)
+lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
 {
        uint32_t *dest32;
-       uint32_t *src32;
+       uint32_t __iomem *src32;
        unsigned int four_bytes;
 
 
        dest32  = (uint32_t *) dest;
-       src32  = (uint32_t *) src;
+       src32  = (uint32_t __iomem *) src;
 
        /* read input bytes, 4 bytes at a time */
        for (four_bytes = bytes /4; four_bytes > 0; four_bytes--) {
@@ -85,36 +80,17 @@ lpfc_memcpy_from_slim( void *dest, void *src, unsigned int bytes)
 #else
 
 static inline void
-lpfc_memcpy_to_slim( void *dest, void *src, unsigned int bytes)
+lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes)
 {
        /* actually returns 1 byte past dest */
        memcpy_toio( dest, src, bytes);
 }
 
 static inline void
-lpfc_memcpy_from_slim( void *dest, void *src, unsigned int bytes)
+lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
 {
        /* actually returns 1 byte past dest */
        memcpy_fromio( dest, src, bytes);
 }
 
-#endif /* __BIG_ENDIAN */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6)
-#define msleep(x) do { \
-                       set_current_state(TASK_UNINTERRUPTIBLE); \
-                       schedule_timeout((x)); \
-               } while (0);
-/* Provide local msecs_to_jiffies call for earlier kernels */
-static inline unsigned long msecs_to_jiffies(const unsigned int m)
-{
-#if HZ <= 1000 && !(1000 % HZ)
-       return (m + (1000 / HZ) - 1) / (1000 / HZ);
-#elif HZ > 1000 && !(HZ % 1000)
-       return m * (HZ / 1000);
-#else
-       return (m * HZ + 999) / 1000;
-#endif
-}
-#endif
-#endif                         /*  _H_LPFC_COMPAT */
+#endif /* __BIG_ENDIAN */