Re: [PATCH 14/20] parisc: use the new byteorder headers

Previous thread: [PATCH 13/20] mn10300: use the new byteorder headers by Harvey Harrison on Thursday, July 17, 2008 - 5:09 pm. (1 message)

Next thread: [PATCH 16/20] s390: use the new byteorder headers by Harvey Harrison on Thursday, July 17, 2008 - 5:09 pm. (1 message)
From: Harvey Harrison
Date: Thursday, July 17, 2008 - 5:09 pm

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 include/asm-parisc/byteorder.h |   37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/include/asm-parisc/byteorder.h b/include/asm-parisc/byteorder.h
index db14831..5e56b1b 100644
--- a/include/asm-parisc/byteorder.h
+++ b/include/asm-parisc/byteorder.h
@@ -4,9 +4,10 @@
 #include <asm/types.h>
 #include <linux/compiler.h>
 
-#ifdef __GNUC__
+#define __LITTLE_ENDIAN
+#define __SWAB_64_THRU_32__
 
-static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
+static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
 {
 	__asm__("dep %0, 15, 8, %0\n\t"		/* deposit 00ab -> 0bab */
 		"shd %%r0, %0, 8, %0"		/* shift 000000ab -> 00ba */
@@ -14,8 +15,9 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
 		: "0" (x));
 	return x;
 }
+#define HAVE_ARCH_SWAB16
 
-static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
+static inline __attribute_const__ __u32 __arch_swab24(__u32 x)
 {
 	__asm__("shd %0, %0, 8, %0\n\t"		/* shift xabcxabc -> cxab */
 		"dep %0, 15, 8, %0\n\t"		/* deposit cxab -> cbab */
@@ -25,7 +27,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
 	return x;
 }
 
-static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 {
 	unsigned int temp;
 	__asm__("shd %0, %0, 16, %1\n\t"	/* shift abcdabcd -> cdab */
@@ -35,7 +37,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
 		: "0" (x));
 	return x;
 }
-
+#define HAVE_ARCH_SWAB32
 
 #if BITS_PER_LONG > 32
 /*
@@ -48,7 +50,8 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
 **      HSHR    67452301 -> *6*4*2*0 into %0
 **      OR      %0 | %1  -> 76543210 into %0 (all done!)
 */
-static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {
+static inline __attribute_const__ __u64 ...
From: Grant Grundler
Date: Friday, August 1, 2008 - 9:06 am

Should this only be defined if BITS_PER_LONG is <=32  ?

thanks,
--

From: Harvey Harrison
Date: Friday, August 1, 2008 - 2:23 pm

The new byteorder headers only uses this if no __arch_swab64 is defined.

Further down in the parisc version, an __arch_swab64 is defined in the

static inline __attribute_const__ __u64 ___swab64(__u64 val)
{
#ifdef __arch_swab64
	return __arch_swab64(val);
#elif defined(__arch_swab64p)
	return __arch_swab64p(&val);
#elif defined(__SWAB_64_THRU_32__)
	__u32 h = val >> 32;
	__u32 l = val & ((1ULL << 32) - 1);
	return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h)));
#else
	return __const_swab64(val);
#endif
}

Other than the endianness, any other concerns?

Harvey

--

From: Grant Grundler
Date: Friday, August 1, 2008 - 4:18 pm

On Fri, Aug 01, 2008 at 02:23:37PM -0700, Harvey Harrison wrote:

Ok.


Have you had a chance to test this?
Or can you point me at another big endian arch that has similar 
use of header files that has been successfully tested?

I can arrange for access to parisc HW if you have time/interest
in testing this yourself.

thanks,
--

From: Harvey Harrison
Date: Saturday, August 2, 2008 - 11:03 am

My reply yesterday didn't seem to make it out.

On Fri, Aug 1, 2008 at 4:18 PM, Grant Grundler


AVR32 got a maintainer ack, I'm assuming that was tested.  It's not
functionally any different than the existing code really, other
than allowing compile-time folding in the cpu_to_{endian} helpers.


Sure, drop me a note.

I'll have intermittant connection for the next week, so there might be
a few days before I can reply.

Harvey
--

From: Harvey Harrison
Date: Friday, August 1, 2008 - 10:52 pm

AVR32 got a maintainer ack, I'm assuming that was tested.  It's not
functionally any different than the existing code really, other
than allowing compile-time folding in the cpu_to_{endian} helpers.


Sure, drop me a note.

Harvey

--

Previous thread: [PATCH 13/20] mn10300: use the new byteorder headers by Harvey Harrison on Thursday, July 17, 2008 - 5:09 pm. (1 message)

Next thread: [PATCH 16/20] s390: use the new byteorder headers by Harvey Harrison on Thursday, July 17, 2008 - 5:09 pm. (1 message)