[U-Boot] [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.
Signed-off-by: Mike Frysinger vapier@gentoo.org --- include/asm-generic/unaligned.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/unaligned.h
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h new file mode 100644 index 0000000..fd02550 --- /dev/null +++ b/include/asm-generic/unaligned.h @@ -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

The new zlib code wants asm/unaligned.h, so have the Blackfin version pull in the asm-generic/unaligned.h.
Signed-off-by: Mike Frysinger vapier@gentoo.org --- include/asm-blackfin/unaligned.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 include/asm-blackfin/unaligned.h
diff --git a/include/asm-blackfin/unaligned.h b/include/asm-blackfin/unaligned.h new file mode 100644 index 0000000..6cecbbb --- /dev/null +++ b/include/asm-blackfin/unaligned.h @@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>

Dear Mike Frysinger,
In message 1264068076-4504-2-git-send-email-vapier@gentoo.org you wrote:
The new zlib code wants asm/unaligned.h, so have the Blackfin version pull in the asm-generic/unaligned.h.
Signed-off-by: Mike Frysinger vapier@gentoo.org
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

Signed-off-by: Mike Frysinger vapier@gentoo.org --- note: havent compile tested this, but it should be straight forward ...
include/asm-arm/unaligned.h | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h index 44593a8..6cecbbb 100644 --- a/include/asm-arm/unaligned.h +++ b/include/asm-arm/unaligned.h @@ -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>

Mike Frysinger wrote:
Signed-off-by: Mike Frysinger vapier@gentoo.org
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

On Saturday 23 January 2010 20:18:04 Tom wrote:
Mike Frysinger wrote:
Signed-off-by: Mike Frysinger vapier@gentoo.org
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
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

Mike Frysinger wrote:
On Saturday 23 January 2010 20:18:04 Tom wrote:
Mike Frysinger wrote:
Signed-off-by: Mike Frysinger vapier@gentoo.org
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.
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.
Signed-off-by: Remis Lima Baima remis.developer@googlemail.com Signed-off-by: Arnd Bergmann arnd@arndb.de
I would prefer to reuse the kernel source where possible. Tom

On Sunday 24 January 2010 11:07:10 Tom wrote:
Mike Frysinger wrote:
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.
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
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

Dear Mike Frysinger,
In message 1264068076-4504-1-git-send-email-vapier@gentoo.org 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.
Signed-off-by: Mike Frysinger vapier@gentoo.org
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
participants (3)
-
Mike Frysinger
-
Tom
-
Wolfgang Denk