kexec/ppc64 fix device tree endianess issues for memory attributes

All the attributes exposed in the device tree are in Big Endian format.

This patch add the byte swap operation for some entries which were not yet
processed, including those fixed by the following kernel's patch :

https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-January/114720.html

To work on PPC64 Little Endian mode, kexec now requires that the kernel's
patch mentioned above is applied on the kexecing kernel.

Tested on ppc64 LPAR (kexec/dump) and ppc64le in a Qemu/KVM guest (kexec)

Changes from v1 :
 * add processing of the following entries :
   - ibm,dynamic-reconfiguration-memory
   - chosen/linux,kernel-end
   - chosen/linux,crashkernel-base & size
   - chosen/linux,memory-limit
   - chosen/linux,htab-base & size
   - linux,tce-base & size
   - memory@/reg
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
ppc64/kexec/purgatory Fix RTAS calls in Little Endian mode.

RTAS is expecting parameters in Big Endian order so we have to byte swap
them in LE mode.

In the purgatory RTAS calls are only made for debug output.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
kexec/ppc64 ELF ABIv2 ABI support

When building in PPC64 little endian mode, the compiler is now using the
new ABI v2. Among other changes, this new ABI removes the function
descriptors and changes the way the TOC address is computed when entering a
C function.

The purgatory assembly part where the dot symbols are removed, and ELF
relocation code are impacted in this patch.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
kexec/ppc64 Enable early kernel's OPAL calls

When the kernel is built with CONFIG_PPC_EARLY_DEBUG_OPAL set, it is
expecting to get r8 and r9 filled respectively with OPAL base address and
OPAL entry address (arc/power/head_64.S).

On the new powernv platform, having these 2 registers set allows the kernel
to perform OPAL calls before it parse the device tree.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Avoid buffer overflow on strncat usage

strncat() does not want the total size but the maximum length
(without trailing NUL) that can still be added. Switch over
to snprintf which is both more readable and avoids this issue.

Signed-off-by: Dirk Mueller <dmueller@suse.com>
Signed-off-by: Simon Horman <horms@verge.net.au>