* [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers @ 2015-02-10 12:15 Jeremy Kerr 2015-02-10 12:15 ` [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr Jeremy Kerr ` (3 more replies) 0 siblings, 4 replies; 12+ messages in thread From: Jeremy Kerr @ 2015-02-10 12:15 UTC (permalink / raw) To: linuxppc-dev For epapr-style boot, we may be little-endian. This change implements the proper conversion for fdt*_to_cpu and cpu_to_fdt*. We also need the full cpu_to_* and *_to_cpu macros for this. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- arch/powerpc/boot/libfdt_env.h | 14 ++++++++------ arch/powerpc/boot/of.h | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index c89fdb1..8dcd744 100644 --- a/arch/powerpc/boot/libfdt_env.h +++ b/arch/powerpc/boot/libfdt_env.h @@ -4,15 +4,17 @@ #include <types.h> #include <string.h> +#include "of.h" + typedef u32 uint32_t; typedef u64 uint64_t; typedef unsigned long uintptr_t; -#define fdt16_to_cpu(x) (x) -#define cpu_to_fdt16(x) (x) -#define fdt32_to_cpu(x) (x) -#define cpu_to_fdt32(x) (x) -#define fdt64_to_cpu(x) (x) -#define cpu_to_fdt64(x) (x) +#define fdt16_to_cpu(x) be16_to_cpu(x) +#define cpu_to_fdt16(x) cpu_to_be16(x) +#define fdt32_to_cpu(x) be32_to_cpu(x) +#define cpu_to_fdt32(x) cpu_to_be32(x) +#define fdt64_to_cpu(x) be64_to_cpu(x) +#define cpu_to_fdt64(x) cpu_to_be64(x) #endif /* _ARCH_POWERPC_BOOT_LIBFDT_ENV_H */ diff --git a/arch/powerpc/boot/of.h b/arch/powerpc/boot/of.h index c8c1750..5603320 100644 --- a/arch/powerpc/boot/of.h +++ b/arch/powerpc/boot/of.h @@ -24,11 +24,19 @@ void of_console_init(void); typedef u32 __be32; #ifdef __LITTLE_ENDIAN__ +#define cpu_to_be16(x) swab16(x) +#define be16_to_cpu(x) swab16(x) #define cpu_to_be32(x) swab32(x) #define be32_to_cpu(x) swab32(x) +#define cpu_to_be64(x) swab64(x) +#define be64_to_cpu(x) swab64(x) #else +#define cpu_to_be16(x) (x) +#define be16_to_cpu(x) (x) #define cpu_to_be32(x) (x) #define be32_to_cpu(x) (x) +#define cpu_to_be64(x) (x) +#define be64_to_cpu(x) (x) #endif #define PROM_ERROR (-1u) ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr 2015-02-10 12:15 [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Jeremy Kerr @ 2015-02-10 12:15 ` Jeremy Kerr 2015-02-11 2:12 ` Benjamin Herrenschmidt 2015-02-10 12:15 ` [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point Jeremy Kerr ` (2 subsequent siblings) 3 siblings, 1 reply; 12+ messages in thread From: Jeremy Kerr @ 2015-02-10 12:15 UTC (permalink / raw) To: linuxppc-dev We'll likely be entering the zImage.epapr as BE, so include the pseries implementation of _zimage_start, which adds the endian fixup magic. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index ae0f88e..3f50c27 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper @@ -277,7 +277,7 @@ treeboot-iss4xx-mpic) platformo="$object/treeboot-iss4xx.o" ;; epapr) - platformo="$object/epapr.o $object/epapr-wrapper.o" + platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o" link_address='0x20000000' pie=-pie ;; ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr 2015-02-10 12:15 ` [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr Jeremy Kerr @ 2015-02-11 2:12 ` Benjamin Herrenschmidt 2015-02-11 2:16 ` Jeremy Kerr 0 siblings, 1 reply; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 2:12 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Tue, 2015-02-10 at 20:15 +0800, Jeremy Kerr wrote: > We'll likely be entering the zImage.epapr as BE, so include the pseries > implementation of _zimage_start, which adds the endian fixup magic. Wont that break embedded epapr stuff ? > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> > > --- > arch/powerpc/boot/wrapper | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper > index ae0f88e..3f50c27 100755 > --- a/arch/powerpc/boot/wrapper > +++ b/arch/powerpc/boot/wrapper > @@ -277,7 +277,7 @@ treeboot-iss4xx-mpic) > platformo="$object/treeboot-iss4xx.o" > ;; > epapr) > - platformo="$object/epapr.o $object/epapr-wrapper.o" > + platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o" > link_address='0x20000000' > pie=-pie > ;; > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr 2015-02-11 2:12 ` Benjamin Herrenschmidt @ 2015-02-11 2:16 ` Jeremy Kerr 2015-02-11 2:20 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 12+ messages in thread From: Jeremy Kerr @ 2015-02-11 2:16 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: linuxppc-dev Hi Ben, >> We'll likely be entering the zImage.epapr as BE, so include the pseries >> implementation of _zimage_start, which adds the endian fixup magic. > > Wont that break embedded epapr stuff ? How so? This will just give us the endian fixup trampoline (followed by a branch to _zimage_start_lib) as the entry point, rather than directly entering _zimage_start_lib. Will that not work on embedded? Cheers, Jeremy ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr 2015-02-11 2:16 ` Jeremy Kerr @ 2015-02-11 2:20 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 2:20 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Wed, 2015-02-11 at 10:16 +0800, Jeremy Kerr wrote: > Hi Ben, > > >> We'll likely be entering the zImage.epapr as BE, so include the pseries > >> implementation of _zimage_start, which adds the endian fixup magic. > > > > Wont that break embedded epapr stuff ? > > How so? This will just give us the endian fixup trampoline (followed by > a branch to _zimage_start_lib) as the entry point, rather than directly > entering _zimage_start_lib. Will that not work on embedded? Hrm, the trampoline only works on server, so it would have a weird effect if booting embedded with the wrong endian, but ok. Ben. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point 2015-02-10 12:15 [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Jeremy Kerr 2015-02-10 12:15 ` [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr Jeremy Kerr @ 2015-02-10 12:15 ` Jeremy Kerr 2015-02-11 2:11 ` Benjamin Herrenschmidt 2015-02-10 12:15 ` [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot Jeremy Kerr 2015-02-11 2:11 ` [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Benjamin Herrenschmidt 3 siblings, 1 reply; 12+ messages in thread From: Jeremy Kerr @ 2015-02-10 12:15 UTC (permalink / raw) To: linuxppc-dev Currently, a 64-bit little-endian zImage.epapr won't boot in epapr mode, as as we never return from platform_init. Before entering C, we initialise our stack by setting r1 16 bytes below the end of the _bss_stack: stwu r0,-16(r1) /* establish a stack frame */ However, the called function will save the caller's lr in the caller's frame's lr save area, at -16(r1) to -32(r1). This means that writes to the fdt variable corrupt the saved link register: 0000000020c06018 l O .bss 0000000000001000 _bss_stack 0000000020c07018 l O .bss 0000000000000008 fdt This change allocates the minimum of 32 bytes for the base of the stack instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- arch/powerpc/boot/crt0.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index 14de4f8..bf8eeee 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S @@ -218,7 +218,7 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ beq 6f ld r1,0(r8) li r0,0 - stdu r0,-16(r1) /* establish a stack frame */ + stdu r0,-32(r1) /* establish a stack frame */ 6: #endif /* __powerpc64__ */ /* Call platform_init() */ ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point 2015-02-10 12:15 ` [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point Jeremy Kerr @ 2015-02-11 2:11 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 2:11 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Tue, 2015-02-10 at 20:15 +0800, Jeremy Kerr wrote: > Currently, a 64-bit little-endian zImage.epapr won't boot in epapr mode, > as as we never return from platform_init. > > Before entering C, we initialise our stack by setting r1 16 bytes below > the end of the _bss_stack: > > stwu r0,-16(r1) /* establish a stack frame */ > > However, the called function will save the caller's lr in the caller's > frame's lr save area, at -16(r1) to -32(r1). > > This means that writes to the fdt variable corrupt the saved link > register: > > 0000000020c06018 l O .bss 0000000000001000 _bss_stack > 0000000020c07018 l O .bss 0000000000000008 fdt > > This change allocates the minimum of 32 bytes for the base of the stack > instead. Is that sufficient for ABI v1 ? It feels like it's broken for BE as well... Ben. > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> > > --- > arch/powerpc/boot/crt0.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S > index 14de4f8..bf8eeee 100644 > --- a/arch/powerpc/boot/crt0.S > +++ b/arch/powerpc/boot/crt0.S > @@ -218,7 +218,7 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ > beq 6f > ld r1,0(r8) > li r0,0 > - stdu r0,-16(r1) /* establish a stack frame */ > + stdu r0,-32(r1) /* establish a stack frame */ > 6: > #endif /* __powerpc64__ */ > /* Call platform_init() */ > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot 2015-02-10 12:15 [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Jeremy Kerr 2015-02-10 12:15 ` [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr Jeremy Kerr 2015-02-10 12:15 ` [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point Jeremy Kerr @ 2015-02-10 12:15 ` Jeremy Kerr 2015-02-11 2:09 ` Benjamin Herrenschmidt 2015-02-11 2:11 ` [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Benjamin Herrenschmidt 3 siblings, 1 reply; 12+ messages in thread From: Jeremy Kerr @ 2015-02-10 12:15 UTC (permalink / raw) To: linuxppc-dev We use r6 and r7 for epapr boot, but the current pre-C init will clobber both of these. This change does a simple replacement, of r6 -> r12 and r7 -> r13, so that we hit platform init with these registers intact. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- arch/powerpc/boot/crt0.S | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index bf8eeee..7e50211 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S @@ -155,29 +155,29 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ ld r9,(p_rela-p_base)(r10) add r9,r9,r10 - li r7,0 + li r13,0 li r8,0 -9: ld r6,0(r11) /* get tag */ - cmpdi r6,0 +9: ld r12,0(r11) /* get tag */ + cmpdi r12,0 beq 12f /* end of list */ - cmpdi r6,RELA + cmpdi r12,RELA bne 10f - ld r7,8(r11) /* get RELA pointer in r7 */ + ld r13,8(r11) /* get RELA pointer in r13 */ b 11f -10: addis r6,r6,(-RELACOUNT)@ha - cmpdi r6,RELACOUNT@l +10: addis r12,r12,(-RELACOUNT)@ha + cmpdi r12,RELACOUNT@l bne 11f ld r8,8(r11) /* get RELACOUNT value in r8 */ 11: addi r11,r11,16 b 9b 12: - cmpdi r7,0 /* check we have both RELA and RELACOUNT */ + cmpdi r13,0 /* check we have both RELA and RELACOUNT */ cmpdi cr1,r8,0 beq 3f beq cr1,3f /* Calcuate the runtime offset. */ - subf r7,r7,r9 + subf r13,r13,r9 /* Run through the list of relocations and process the * R_PPC64_RELATIVE ones. */ @@ -185,10 +185,10 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ 13: ld r0,8(r9) /* ELF64_R_TYPE(reloc->r_info) */ cmpdi r0,22 /* R_PPC64_RELATIVE */ bne 3f - ld r6,0(r9) /* reloc->r_offset */ + ld r12,0(r9) /* reloc->r_offset */ ld r0,16(r9) /* reloc->r_addend */ - add r0,r0,r7 - stdx r0,r7,r6 + add r0,r0,r13 + stdx r0,r13,r12 addi r9,r9,24 bdnz 13b ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot 2015-02-10 12:15 ` [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot Jeremy Kerr @ 2015-02-11 2:09 ` Benjamin Herrenschmidt 2015-02-11 4:27 ` Jeremy Kerr 0 siblings, 1 reply; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 2:09 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Tue, 2015-02-10 at 20:15 +0800, Jeremy Kerr wrote: > We use r6 and r7 for epapr boot, but the current pre-C init will clobber > both of these. > > This change does a simple replacement, of r6 -> r12 and r7 -> r13, so > that we hit platform init with these registers intact. > > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> You might want to also remove the use of r8 and r9 which are supposed to contain the OPAL entry and base for debugging purposes. We would also have to restore them before booting the kernel. [ Note: kexec is also missing that ] Ben. > --- > arch/powerpc/boot/crt0.S | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S > index bf8eeee..7e50211 100644 > --- a/arch/powerpc/boot/crt0.S > +++ b/arch/powerpc/boot/crt0.S > @@ -155,29 +155,29 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ > ld r9,(p_rela-p_base)(r10) > add r9,r9,r10 > > - li r7,0 > + li r13,0 > li r8,0 > -9: ld r6,0(r11) /* get tag */ > - cmpdi r6,0 > +9: ld r12,0(r11) /* get tag */ > + cmpdi r12,0 > beq 12f /* end of list */ > - cmpdi r6,RELA > + cmpdi r12,RELA > bne 10f > - ld r7,8(r11) /* get RELA pointer in r7 */ > + ld r13,8(r11) /* get RELA pointer in r13 */ > b 11f > -10: addis r6,r6,(-RELACOUNT)@ha > - cmpdi r6,RELACOUNT@l > +10: addis r12,r12,(-RELACOUNT)@ha > + cmpdi r12,RELACOUNT@l > bne 11f > ld r8,8(r11) /* get RELACOUNT value in r8 */ > 11: addi r11,r11,16 > b 9b > 12: > - cmpdi r7,0 /* check we have both RELA and RELACOUNT */ > + cmpdi r13,0 /* check we have both RELA and RELACOUNT */ > cmpdi cr1,r8,0 > beq 3f > beq cr1,3f > > /* Calcuate the runtime offset. */ > - subf r7,r7,r9 > + subf r13,r13,r9 > > /* Run through the list of relocations and process the > * R_PPC64_RELATIVE ones. */ > @@ -185,10 +185,10 @@ p_base: mflr r10 /* r10 now points to runtime addr of p_base */ > 13: ld r0,8(r9) /* ELF64_R_TYPE(reloc->r_info) */ > cmpdi r0,22 /* R_PPC64_RELATIVE */ > bne 3f > - ld r6,0(r9) /* reloc->r_offset */ > + ld r12,0(r9) /* reloc->r_offset */ > ld r0,16(r9) /* reloc->r_addend */ > - add r0,r0,r7 > - stdx r0,r7,r6 > + add r0,r0,r13 > + stdx r0,r13,r12 > addi r9,r9,24 > bdnz 13b > > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot 2015-02-11 2:09 ` Benjamin Herrenschmidt @ 2015-02-11 4:27 ` Jeremy Kerr 2015-02-11 4:50 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 12+ messages in thread From: Jeremy Kerr @ 2015-02-11 4:27 UTC (permalink / raw) To: Benjamin Herrenschmidt, linuxppc-dev Hi Ben, > You might want to also remove the use of r8 and r9 which are supposed > to contain the OPAL entry and base for debugging purposes. We would also > have to restore them before booting the kernel. I'd prefer that to be a separate change, if that's okay - it'd require us to change the kentry prototype, and would percolate to epapr_platform init too. Cheers, Jeremy ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot 2015-02-11 4:27 ` Jeremy Kerr @ 2015-02-11 4:50 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 4:50 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Wed, 2015-02-11 at 12:27 +0800, Jeremy Kerr wrote: > Hi Ben, > > > You might want to also remove the use of r8 and r9 which are supposed > > to contain the OPAL entry and base for debugging purposes. We would also > > have to restore them before booting the kernel. > > I'd prefer that to be a separate change, if that's okay - it'd require > us to change the kentry prototype, and would percolate to epapr_platform > init too. Ok. Ben. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers 2015-02-10 12:15 [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Jeremy Kerr ` (2 preceding siblings ...) 2015-02-10 12:15 ` [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot Jeremy Kerr @ 2015-02-11 2:11 ` Benjamin Herrenschmidt 3 siblings, 0 replies; 12+ messages in thread From: Benjamin Herrenschmidt @ 2015-02-11 2:11 UTC (permalink / raw) To: Jeremy Kerr; +Cc: linuxppc-dev On Tue, 2015-02-10 at 20:15 +0800, Jeremy Kerr wrote: > For epapr-style boot, we may be little-endian. This change implements > the proper conversion for fdt*_to_cpu and cpu_to_fdt*. We also need the > full cpu_to_* and *_to_cpu macros for this. > > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > arch/powerpc/boot/libfdt_env.h | 14 ++++++++------ > arch/powerpc/boot/of.h | 8 ++++++++ > 2 files changed, 16 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h > index c89fdb1..8dcd744 100644 > --- a/arch/powerpc/boot/libfdt_env.h > +++ b/arch/powerpc/boot/libfdt_env.h > @@ -4,15 +4,17 @@ > #include <types.h> > #include <string.h> > > +#include "of.h" > + > typedef u32 uint32_t; > typedef u64 uint64_t; > typedef unsigned long uintptr_t; > > -#define fdt16_to_cpu(x) (x) > -#define cpu_to_fdt16(x) (x) > -#define fdt32_to_cpu(x) (x) > -#define cpu_to_fdt32(x) (x) > -#define fdt64_to_cpu(x) (x) > -#define cpu_to_fdt64(x) (x) > +#define fdt16_to_cpu(x) be16_to_cpu(x) > +#define cpu_to_fdt16(x) cpu_to_be16(x) > +#define fdt32_to_cpu(x) be32_to_cpu(x) > +#define cpu_to_fdt32(x) cpu_to_be32(x) > +#define fdt64_to_cpu(x) be64_to_cpu(x) > +#define cpu_to_fdt64(x) cpu_to_be64(x) > > #endif /* _ARCH_POWERPC_BOOT_LIBFDT_ENV_H */ > diff --git a/arch/powerpc/boot/of.h b/arch/powerpc/boot/of.h > index c8c1750..5603320 100644 > --- a/arch/powerpc/boot/of.h > +++ b/arch/powerpc/boot/of.h > @@ -24,11 +24,19 @@ void of_console_init(void); > typedef u32 __be32; > > #ifdef __LITTLE_ENDIAN__ > +#define cpu_to_be16(x) swab16(x) > +#define be16_to_cpu(x) swab16(x) > #define cpu_to_be32(x) swab32(x) > #define be32_to_cpu(x) swab32(x) > +#define cpu_to_be64(x) swab64(x) > +#define be64_to_cpu(x) swab64(x) > #else > +#define cpu_to_be16(x) (x) > +#define be16_to_cpu(x) (x) > #define cpu_to_be32(x) (x) > #define be32_to_cpu(x) (x) > +#define cpu_to_be64(x) (x) > +#define be64_to_cpu(x) (x) > #endif > > #define PROM_ERROR (-1u) > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-02-11 4:50 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-02-10 12:15 [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Jeremy Kerr 2015-02-10 12:15 ` [PATCH 2/4] powerpc/boot/wrapper: use the pseries wrapper for zImage.epapr Jeremy Kerr 2015-02-11 2:12 ` Benjamin Herrenschmidt 2015-02-11 2:16 ` Jeremy Kerr 2015-02-11 2:20 ` Benjamin Herrenschmidt 2015-02-10 12:15 ` [PATCH 3/4] powerpc/boot: Fix stack corruption in epapr entry point Jeremy Kerr 2015-02-11 2:11 ` Benjamin Herrenschmidt 2015-02-10 12:15 ` [PATCH 4/4] powerpc/boot: don't clobber r6 and r7 in epapr boot Jeremy Kerr 2015-02-11 2:09 ` Benjamin Herrenschmidt 2015-02-11 4:27 ` Jeremy Kerr 2015-02-11 4:50 ` Benjamin Herrenschmidt 2015-02-11 2:11 ` [PATCH 1/4] powerpc/boot/fdt: Add little-endian support to libfdt wrappers Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).