Skip to contentSkip to conversation

asm-generic/unaligned.h: dynamic default unaligned accesses

PATCH New Mike Frysinger 3 participants 9 messages Jan 21, 2010 – Mar 13, 2010 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 asm-generic/unaligned.h: dynamic default unaligned accesses

This is based on the asm-arm/unaligned.h, but made generic so all arches that cannot do unaligned accesses can utilize it.

---
 include/asm-generic/unaligned.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/unaligned.h
include/asm-generic/unaligned.h new file +23 -0
new file mode 100644
index 0000000..fd02550
@@ -0,0 +1,23 @@
+#ifndef _GENERIC_UNALIGNED_H
+#define _GENERIC_UNALIGNED_H
+
+#include <asm/byteorder.h>
+
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+
+/*
+ * Select endianness
+ */
+#if defined(__LITTLE_ENDIAN)
+#define get_unaligned	__get_unaligned_le
+#define put_unaligned	__put_unaligned_le
+#elif defined(__BIG_ENDIAN)
+#define get_unaligned	__get_unaligned_be
+#define put_unaligned	__put_unaligned_be
+#else
+#error invalid endian
+#endif
+
+#endif
Signature · 1 line
1.6.6
#1 lore raw

PATCH 2/3 asm-blackfin/unaligned.h: add for zlib code

The new zlib code wants asm/unaligned.h, so have the Blackfin version pull in the asm-generic/unaligned.h.

---
 include/asm-blackfin/unaligned.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-blackfin/unaligned.h
include/asm-blackfin/unaligned.h new file +1 -0
new file mode 100644
index 0000000..6cecbbb
@@ -0,0 +1 @@
+#include <asm-generic/unaligned.h>
Signature · 1 line
1.6.6
#2 lore raw

PATCH 2/3 asm-blackfin/unaligned.h: add for zlib code

Dear Mike Frysinger,

Quoted 8 lines · In message <[email protected]> you wrote:

The new zlib code wants asm/unaligned.h, so have the Blackfin version pull in the asm-generic/unaligned.h.

---
 include/asm-blackfin/unaligned.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-blackfin/unaligned.h

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The greatest warriors are the ones who fight for peace."
- Holly Near
#3 lore raw

PATCH 3/3 asm-arm/unaligned.h: switch to asm-generic/unaligned.h

In reply to Mike Frysinger

---
note: havent compile tested this, but it should be straight forward ...

 include/asm-arm/unaligned.h |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)
include/asm-arm/unaligned.h +1 -19
index 44593a8..6cecbbb 100644
@@ -1,19 +1 @@
-#ifndef _ASM_ARM_UNALIGNED_H
-#define _ASM_ARM_UNALIGNED_H
-
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-/*
- * Select endianness
- */
-#ifndef __ARMEB__
-#define get_unaligned	__get_unaligned_le
-#define put_unaligned	__put_unaligned_le
-#else
-#define get_unaligned	__get_unaligned_be
-#define put_unaligned	__put_unaligned_be
-#endif
-
-#endif /* _ASM_ARM_UNALIGNED_H */
+#include <asm-generic/unaligned.h>
Signature · 1 line
1.6.6
#4 lore raw

PATCH 3/3 asm-arm/unaligned.h: switch to asm-generic/unaligned.h

Quoted 3 lines · Mike Frysinger

---
note: havent compile tested this, but it should be straight forward ...

I have compile tested this.
It is fine.

Was this run tested ?

I see this was imported from the kernel.
Please include the version of the kernel this came from.

Tom

#5 lore raw

PATCH 3/3 asm-arm/unaligned.h: switch to asm-generic/unaligned.h

Quoted 9 lines · On Saturday 23 January 2010 20:18:04 Tom wrote:
Quoted 3 lines · Mike Frysinger

---
note: havent compile tested this, but it should be straight forward ...

I have compile tested this.
It is fine.

Was this run tested ?

if i cant compile. i cant run

Quoted 1 line

I see this was imported from the kernel.

if that's true, that isnt "my problem". i modified files that existed in u- boot already; i did not myself copy directly from the linux kernel. feel free to add any comments/etc... you find appropriate.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100123/027620c9/attachment.pgp

#6 lore raw

PATCH 3/3 asm-arm/unaligned.h: switch to asm-generic/unaligned.h

Quoted 11 lines · Mike Frysinger
Quoted 8 lines · On Saturday 23 January 2010 20:18:04 Tom wrote:
Quoted 3 lines · Mike Frysinger

---
note: havent compile tested this, but it should be straight forward ...

I have compile tested this.
It is fine.

Was this run tested ?

if i cant compile. i cant run

In some case people do a runtime test without doing a full compile test with MAKEALL arm. I was hoping this was the case.

Quoted 7 lines
Quoted 2 lines

I see this was imported from the kernel.

if that's true, that isnt "my problem". i modified files that existed in u- boot already; i did not myself copy directly from the linux kernel. feel free to add any comments/etc... you find appropriate.
-mike

On reviewing 1/3 closer against the linux kernel

diff .../linux-2.6-arm/include/asm-generic/unaligned.h .../u-boot-arm/include/asm-generic/unaligned.h

It looks like the version from the kernel could be used without modifications. It looks very similar to your patch.

This is the commit from the kernel

aafe4dbed0bf6cbdb2e9f03e1d42f8a540d8541d

asm-generic: add generic versions of common headers

These are all kernel internal interfaces that get copied around a lot. In most cases, architectures can provide their own optimized versions, but these generic versions can work as well.

I have tried to use the most common contents of each header to allow existing architectures to migrate easily.

Thanks to Remis for suggesting a number of cleanups.

I would prefer to reuse the kernel source where possible. Tom

#7 lore raw

PATCH 3/3 asm-arm/unaligned.h: switch to asm-generic/unaligned.h

Quoted 8 lines · On Sunday 24 January 2010 11:07:10 Tom wrote:
Quoted 6 lines · Mike Frysinger
Quoted 1 line · On Saturday 23 January 2010 20:18:04 Tom wrote:

I see this was imported from the kernel.

if that's true, that isnt "my problem". i modified files that existed in u- boot already; i did not myself copy directly from the linux kernel. feel free to add any comments/etc... you find appropriate.

Quoted 7 lines

On reviewing 1/3 closer against the linux kernel

diff .../linux-2.6-arm/include/asm-generic/unaligned.h .../u-boot-arm/include/asm-generic/unaligned.h

It looks like the version from the kernel could be used without modifications.

the kernel has more headers which u-boot lacks

Quoted 1 line

I would prefer to reuse the kernel source where possible.

if you feel like doing the license review to make sure this is OK, then have at it. i dont which is why i tweaked existing u-boot files.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100124/38b23e47/attachment.pgp

#8 lore raw

PATCH 1/3 asm-generic/unaligned.h: dynamic default unaligned accesses

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 8 lines · In message <[email protected]> you wrote:

This is based on the asm-arm/unaligned.h, but made generic so all arches that cannot do unaligned accesses can utilize it.

---
 include/asm-generic/unaligned.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/unaligned.h

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"You're just jealous." "What, of an overgrown puppy  with  a  single-
figure IQ?"                      - Terry Pratchett, _Moving Pictures_