Project : madwifi
Revision : 2932
Author : proski (Pavel Roskin)
Date : 2007-11-23 10:28:21 +0100 (Fri, 23 Nov 2007)
Log Message :
Provide replacements for iowrite32be and ioread32be if needed
The architectures that don't set CONFIG_GENERIC_IOMAP are supposed to
provide replacements for functions in lib/iomap.c, but not all provide
iowrite32be() and ioread32be().
Only MIPS, PARISC and PowerPC implement iowrite32be and ioread32be as
functions, while SH and AVR32 provide macros. Other architectures, in
particular ARM, provide no replacement at all.
This should fix ticket #1539.
Affected Files:
* madwifi/trunk/ath_hal/ah_os.h updated
Modified: madwifi/trunk/ath_hal/ah_os.h
===================================================================
--- madwifi/trunk/ath_hal/ah_os.h 2007-11-23 07:50:33 UTC (rev 2931)
+++ madwifi/trunk/ath_hal/ah_os.h 2007-11-23 09:28:21 UTC (rev 2932)
@@ -157,6 +157,28 @@
#endif /* AH_BYTE_ORDER */
/*
+ * Some big-endian architectures don't set CONFIG_GENERIC_IOMAP, but fail to
+ * implement iowrite32be and ioread32be. Provide compatibility macros when
+ * it's needed.
+ *
+ * As of Linux 2.6.24, only MIPS, PARISC and PowerPC implement iowrite32be and
+ * ioread32be as functions.
+ *
+ * The downside or the replacement macros it that we may be byte-swapping data
+ * for the second time, so the native implementations should be preferred.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) && \
+ !defined(CONFIG_GENERIC_IOMAP) && (AH_BYTE_ORDER == AH_BIG_ENDIAN) && \
+ !defined(__mips__) && !defined(__hppa__) && !defined(__powerpc__)
+# ifndef iowrite32be
+# define iowrite32be(_val, _addr) iowrite32(swab32((_val)), (_addr))
+# endif
+# ifndef ioread32be
+# define ioread32be(_addr) swab32(ioread32((_addr)))
+# endif
+#endif
+
+/*
* The register accesses are done using target-specific functions when
* debugging is enabled (AH_DEBUG) or it's explicitly requested for the target.
*
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
|