diff options
author | Cédric Le Goater <clg@fr.ibm.com> | 2014-04-24 11:23:33 +0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-04-28 11:35:56 +0400 |
commit | 98fd433aa6b02ba1612f9a9b73b8eb2f7e9d3419 (patch) | |
tree | 0d6771a0ddc11bd0ce1d22eab04566896185fdc9 /arch/powerpc/boot/of.h | |
parent | b636031a7b0622ffdc5689ff36fb13669f00e160 (diff) | |
download | linux-98fd433aa6b02ba1612f9a9b73b8eb2f7e9d3419.tar.xz |
powerpc/boot: Define byteswapping routines for little endian
These are not the most efficient versions of swab but the wrapper does
not do much byte swapping. On a big endian cpu, these routines are
a no-op.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot/of.h')
-rw-r--r-- | arch/powerpc/boot/of.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/boot/of.h b/arch/powerpc/boot/of.h index e1ef620082f7..c8c1750aba0c 100644 --- a/arch/powerpc/boot/of.h +++ b/arch/powerpc/boot/of.h @@ -1,6 +1,8 @@ #ifndef _PPC_BOOT_OF_H_ #define _PPC_BOOT_OF_H_ +#include "swab.h" + typedef void *phandle; typedef u32 ihandle; @@ -21,8 +23,13 @@ void of_console_init(void); typedef u32 __be32; +#ifdef __LITTLE_ENDIAN__ +#define cpu_to_be32(x) swab32(x) +#define be32_to_cpu(x) swab32(x) +#else #define cpu_to_be32(x) (x) #define be32_to_cpu(x) (x) +#endif #define PROM_ERROR (-1u) |