public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type
@ 2008-05-18 17:09 Jean-Christophe PLAGNIOL-VILLARD
  2008-05-18 17:09 ` [U-Boot-Users] [PATCH 01/17] example/82559_eeprom: Fix multiple warnings and errors Jean-Christophe PLAGNIOL-VILLARD
  2008-05-18 22:18 ` [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type Wolfgang Denk
  0 siblings, 2 replies; 44+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-05-18 17:09 UTC (permalink / raw)
  To: u-boot

by sync asm/byteorder.h with linux

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/asm-i386/byteorder.h |  125 +++++++++++++++++++++++++++--------------
 1 files changed, 82 insertions(+), 43 deletions(-)
 rewrite include/asm-i386/byteorder.h (65%)

diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h
dissimilarity index 65%
index a9c69d5..545ff75 100644
--- a/include/asm-i386/byteorder.h
+++ b/include/asm-i386/byteorder.h
@@ -1,43 +1,82 @@
-#ifndef _I386_BYTEORDER_H
-#define _I386_BYTEORDER_H
-
-#include <asm/types.h>
-
-#ifdef __GNUC__
-
-
-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
-{
-#ifdef CONFIG_X86_BSWAP
-	__asm__("bswap %0" : "=r" (x) : "0" (x));
-#else
-	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
-		"rorl $16,%0\n\t"	/* swap words		*/
-		"xchgb %b0,%h0"		/* swap higher bytes	*/
-		:"=q" (x)
-		: "0" (x));
-#endif
-	return x;
-}
-
-static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
-{
-	__asm__("xchgb %b0,%h0"		/* swap bytes		*/ \
-		: "=q" (x) \
-		:  "0" (x)); \
-		return x;
-}
-
-#define __arch__swab32(x) ___arch__swab32(x)
-#define __arch__swab16(x) ___arch__swab16(x)
-
-#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
-#  define __BYTEORDER_HAS_U64__
-#  define __SWAB_64_THRU_32__
-#endif
-
-#endif /* __GNUC__ */
-
-#include <linux/byteorder/little_endian.h>
-
-#endif /* _I386_BYTEORDER_H */
+#ifndef _I386_BYTEORDER_H
+#define _I386_BYTEORDER_H
+
+#include <asm/types.h>
+
+#ifdef __GNUC__
+
+#define __attribute_const__ __attribute__((__const__))
+
+#ifdef __i386__
+
+static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+{
+#ifdef CONFIG_X86_BSWAP
+	asm("bswap %0" : "=r" (x) : "0" (x));
+#else
+	asm("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
+	    "rorl $16,%0\n\t"	/* swap words		*/
+	    "xchgb %b0,%h0"	/* swap higher bytes	*/
+	    : "=q" (x)
+	    : "0" (x));
+#endif
+	return x;
+}
+
+static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
+{
+	union {
+		struct {
+			__u32 a;
+			__u32 b;
+		} s;
+		__u64 u;
+	} v;
+	v.u = val;
+#ifdef CONFIG_X86_BSWAP
+	asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
+	    : "=r" (v.s.a), "=r" (v.s.b)
+	    : "0" (v.s.a), "1" (v.s.b));
+#else
+	v.s.a = ___arch__swab32(v.s.a);
+	v.s.b = ___arch__swab32(v.s.b);
+	asm("xchgl %0,%1"
+	    : "=r" (v.s.a), "=r" (v.s.b)
+	    : "0" (v.s.a), "1" (v.s.b));
+#endif
+	return v.u;
+}
+
+#else /* __i386__ */
+
+static inline __attribute_const__ __u64 ___arch__swab64(__u64 x)
+{
+	asm("bswapq %0"
+	    : "=r" (x)
+	    : "0" (x));
+	return x;
+}
+
+static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
+{
+	asm("bswapl %0"
+	    : "=r" (x)
+	    : "0" (x));
+	return x;
+}
+
+#endif
+
+/* Do not define swab16.  Gcc is smart enough to recognize "C" version and
+   convert it into rotation or exhange.  */
+
+#define __arch__swab64(x) ___arch__swab64(x)
+#define __arch__swab32(x) ___arch__swab32(x)
+
+#define __BYTEORDER_HAS_U64__
+
+#endif /* __GNUC__ */
+
+#include <linux/byteorder/little_endian.h>
+
+#endif /* _I386_BYTEORDER_H */
-- 
1.5.5.1

^ permalink raw reply related	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2008-07-05 22:32 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-18 17:09 [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09 ` [U-Boot-Users] [PATCH 01/17] example/82559_eeprom: Fix multiple warnings and errors Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09   ` [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix memcpy to return destination pointer Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09     ` [U-Boot-Users] [PATCH 03/17] example/gitignore: update with all generated examples Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09       ` [U-Boot-Users] [PATCH 04/17] i386: Fix global_data declaration Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09         ` [U-Boot-Users] [PATCH 05/17] i386/bootm: remove unused var Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09           ` [U-Boot-Users] [PATCH 06/17] ds1722: Fix mutliple warnings and errors and active the ssi for SC520 boards Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09             ` [U-Boot-Users] [PATCH 07/17] drivers/pcmcia: add missing i82365 Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09               ` [U-Boot-Users] [PATCH 08/17] marabun_pcmcia: Move compile condition to the Makefile Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                 ` [U-Boot-Users] [PATCH 09/17] pxa_pcmcia: " Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                   ` [U-Boot-Users] [PATCH 10/17] pcmcia/ti_pci1410a: " Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                     ` [U-Boot-Users] [PATCH 11/17] Include pcmcia.h only when the drivers is used Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                       ` [U-Boot-Users] [PATCH 12/17] ti_pci1410a: Fix multiple warnings and errors Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                         ` [U-Boot-Users] [PATCH 13/17] sc520_spunk: Fix multiple warnings Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                           ` [U-Boot-Users] [PATCH 14/17] sc520_spunk: Fix flash Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                             ` [U-Boot-Users] [PATCH 15/17] sc530_spunk: add missing SOBJS entry Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                               ` [U-Boot-Users] [PATCH 16/17] i386: Fix multipple definition of __show_boot_progress Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                                 ` [U-Boot-Users] [PATCH 17/17] sc520_cdp: Fix multiple warnings Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 23:00                                   ` Wolfgang Denk
2008-05-18 22:59                                 ` [U-Boot-Users] [PATCH 16/17] i386: Fix multipple definition of __show_boot_progress Wolfgang Denk
2008-05-18 22:57                               ` [U-Boot-Users] [PATCH 15/17] sc530_spunk: add missing SOBJS entry Wolfgang Denk
2008-05-18 22:57                             ` [U-Boot-Users] [PATCH 14/17] sc520_spunk: Fix flash Wolfgang Denk
2008-05-18 22:55                           ` [U-Boot-Users] [PATCH 13/17] sc520_spunk: Fix multiple warnings Wolfgang Denk
2008-05-18 22:51                         ` [U-Boot-Users] [PATCH 12/17] ti_pci1410a: Fix multiple warnings and errors Wolfgang Denk
2008-05-18 22:44                       ` [U-Boot-Users] [PATCH 11/17] Include pcmcia.h only when the drivers is used Wolfgang Denk
2008-07-05 22:32                     ` [U-Boot-Users] [PATCH 10/17] pcmcia/ti_pci1410a: Move compile condition to the Makefile Wolfgang Denk
2008-07-05 22:32                   ` [U-Boot-Users] [PATCH 09/17] pxa_pcmcia: " Wolfgang Denk
2008-05-18 23:04                 ` [U-Boot-Users] [PATCH 08/17] marabun_pcmcia: " Wolfgang Denk
2008-07-05 22:32                 ` Wolfgang Denk
2008-05-18 22:40               ` [U-Boot-Users] [PATCH 07/17] drivers/pcmcia: add missing i82365 Wolfgang Denk
2008-05-18 22:39             ` [U-Boot-Users] [PATCH 06/17] ds1722: Fix mutliple warnings and errors and active the ssi for SC520 boards Wolfgang Denk
2008-05-18 22:37           ` [U-Boot-Users] [PATCH 05/17] i386/bootm: remove unused var Wolfgang Denk
2008-05-18 22:36         ` [U-Boot-Users] [PATCH 04/17] i386: Fix global_data declaration Wolfgang Denk
2008-05-18 22:30       ` [U-Boot-Users] [PATCH 03/17] example/gitignore: update with all generated examples Wolfgang Denk
2008-05-18 22:28     ` [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix memcpy to return destination pointer Wolfgang Denk
2008-05-18 22:20       ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 23:03         ` Wolfgang Denk
2008-05-19  1:22           ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-19  2:38             ` Jerry Van Baren
2008-05-19  7:51               ` Markus Klotzbücher
2008-05-18 22:21   ` [U-Boot-Users] [PATCH 01/17] example/82559_eeprom: Fix multiple warnings and errors Wolfgang Denk
2008-05-18 22:18 ` [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type Wolfgang Denk
2008-05-18 22:10   ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 23:01     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox