From 9a8cf27ead5f9054809582484f825c6b4ed5b56a Mon Sep 17 00:00:00 2001 From: proski Date: Fri, 23 Nov 2007 09:28:21 +0000 Subject: [PATCH] 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. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@2932 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath_hal/ah_os.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ath_hal/ah_os.h b/ath_hal/ah_os.h index 1d68631..e49b1c9 100644 --- a/ath_hal/ah_os.h +++ b/ath_hal/ah_os.h @@ -156,6 +156,28 @@ extern u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *); #endif #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. -- 2.35.1