Introduce support for little endian PowerPC

Ian Munsie
2010-10-01T07:06:23Z

Some PowerPC processors can be run in either big or little endian modes, some
others can map selected pages of memory as little endian, which allows the same
thing. Until now we have only supported the default big endian mode in Linux.
This patch set introduces little endian support for the 44x family of PowerPC
processors.

This patch set in combination with a patched GCC, binutils, uClibc and
buildroot has allowed for a full proof of concept little endian environment on
a 440 Taishan board, which was able to successfully run busybox, OpenSSH and a
handful of other userspace programs without problems.

I am not currently in a position to release my patches for the toolchain, but
in the meantime I thought I would send my patches on the kernel side for review
and feedback.

While my toolchain patches are necessary to support the powerpcle-linux target,
the kernel can still be built with an unpatched toolchain using the
powerpcle-elf target instead. Userspace programs, however, do require the
patched toolchain to build.

Since the processor still starts as big endian, the boot wrapper must still be
compiled with a big endian 32bit toolchain. This can be passed into the build
as CROSSBE_COMPILE in the same manner as the CROSS_COMPILE variable. When the
boot wrapper is finished it runs some platform specific assembly to switch to
little endian and execute the kernel.

This is not yet complete support for little endian PowerPC, some outstanding
issues that I am aware of are:
* We only support 32bit PowerPC for now (and indeed, only 44x)
* The vdso has not been fixed to be endian agnostic - any userspace program
accessing it will get an unexpected result.
* I have not touched PCI at all
* Remaining device tree accesses still need to be examined to ensure they are
correctly handling the endianess of the device tree.
* Any other driver that uses the device tree is likely be broken for the same reason.
* I've included a patch for the alignment handler, however it is as yet
completely untested due to a property of the hardware I've been using for
testing.