History log of /arch/powerpc/kernel/prom_init.c
Revision Date Author Comments
e2500be2b801f4e95d6a1efbc50af3bf14eeb940 24-Jun-2014 Michael Ellerman <mpe@ellerman.id.au> powerpc/powernv: Remove OPAL v1 takeover

In commit 27f4488872d9 "Add OPAL takeover from PowerVM" we added support
for "takeover" on OPAL v1 machines.

This was a mode of operation where we would boot under pHyp, and query
for the presence of OPAL. If detected we would then do a special
sequence to take over the machine, and the kernel would end up running
in hypervisor mode.

OPAL v1 was never a supported product, and was never shipped outside
IBM. As far as we know no one is still using it.

Newer versions of OPAL do not use the takeover mechanism. Although the
query for OPAL should be harmless on machines with newer OPAL, we have
seen a machine where it causes a crash in Open Firmware.

The code in early_init_devtree() to copy boot_command_line into cmd_line
was added in commit 817c21ad9a1f "Get kernel command line accross OPAL
takeover", and AFAIK is only used by takeover, so should also be
removed.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10348f5976830e5d8f74e8abb04a9a057a5e8478 12-Jan-2014 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Check return value of instance-to-package OF call

On PA-Semi firmware, the instance-to-package callback doesn't seem
to be implemented. We didn't check for error, however, thus
subsequently passed the -1 value returned into stdout_node to
thins like prom_getprop etc...

Thus caused the firmware to load values around 0 (physical) internally
as node structures. It somewhat "worked" as long as we had a NULL in the
right place (address 8) at the beginning of the kernel, we didn't "see"
the bug. But commit 5c0484e25ec03243d4c2f2d4416d4a13efc77f6a
"powerpc: Endian safe trampoline" changed the kernel entry point causing
that old bug to now cause a crash early during boot.

This fixes booting on PA-Semi board by properly checking the return
value from instance-to-package.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Olof Johansson <olof@lixom.net>
---
dbd0c5d5296f291a5c3affee4fbdde254632ffca 17-Sep-2013 Laurent Dufour <ldufour@linux.vnet.ibm.com> powerpc: prom_init exception when updating core value

Since the CPU is generating an exception when accessing unaligned word, and
as this exception is not yet handled when running prom_init, data should be
copied from the architecture vector byte per byte.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
dbe78b40118636f2d5d276144239dd4bfd5f04f9 25-Sep-2013 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/pseries: Do not start secondaries in Open Firmware

Starting secondary CPUs early on from Open Firmware and placing them
in a holding spin loop slows down the boot process significantly under
some hypervisors such as KVM.

This is also unnecessary when RTAS supports querying the CPU state

So let's not do it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
620e5050827008ab207a8dfcc44cb79f07f1942c 10-Sep-2013 Vladimir Murzin <murzin.v@gmail.com> powerpc: Fix section mismatch warning for prom_rtas_call

While cross-building for PPC64 I've got

WARNING: vmlinux.o(.text.unlikely+0x1ba): Section mismatch in
reference from the function .prom_rtas_call() to the variable
.init.data:dt_string_start The function .prom_rtas_call() references
the variable __initdata dt_string_start. This is often because
.prom_rtas_call lacks a __initdata annotation or the annotation of
dt_string_start is wrong.

WARNING: vmlinux.o(.meminit.text+0xeb0): Section mismatch in reference
from the function .free_area_init_core.isra.47() to the function
.init.text:.set_pageblock_order() The function __meminit
.free_area_init_core.isra.47() references a function __init
.set_pageblock_order(). If .set_pageblock_order is only used by
.free_area_init_core.isra.47 then annotate .set_pageblock_order with a
matching annotation.

Fix it by proper annotation of prom_rtas_call.

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
493adffcb43ffd9f8f2d5485603574502fd9e01d 06-Aug-2013 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Make prom_init.c endian safe

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7191b615759ec10cab9eea43be5ecc42cda82364 24-Jul-2013 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/pmac: Early debug output on screen on 64-bit macs

We have a bunch of CONFIG_PPC_EARLY_DEBUG_* options that are intended
for bringup/debug only. They hard wire a machine specific udbg backend
very early on (before we even probe the platform), and use whatever
tricks are available on each machine/cpu to be able to get some kind
of output out there early on.

So far, on powermac with no serial ports, we have CONFIG_PPC_EARLY_DEBUG_BOOTX
to use the low-level btext engine on the screen, but it doesn't do much, at
least on 64-bit. It only really gets enabled after the platform has been
probed and the MMU enabled.

This adds a way to enable it much earlier. From prom_init.c (while still
running with Open Firmware), we grab the screen details and set things up
using the physical address of the frame buffer.

Then btext itself uses the "rm_ci" feature of the 970 processor (Real
Mode Cache Inhibited) to access it while in real mode.

We need to do a little bit of reorg of the btext code to inline things
better, in order to limit how much we touch memory while in this mode as
the consequences might be ... interesting.

This successfully allowed me to debug problems early on with the G5
(related to gold being broken vs. ppc64 kernels).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
33959f88fce9b8d3346d8000b3425814cbc6d6c0 18-Jul-2013 Michael Neuling <mikey@neuling.org> powerpc: Add second POWER8 PVR entry

POWER8 comes with two different PVRs. This patch enables the additional
PVR in the cputable.

The existing entry (PVR=0x4b) is renamed to POWER8E and the new entry
(PVR=0x4d) is given POWER8.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1b1218d32efdc81134eeb908935a18659cb3d9d7 24-Apr-2013 Nathan Fontenot <nfont@linux.vnet.ibm.com> powerpc/pseries: Enable PRRN handling

The Linux kernel and platform firmware negotiate their mutual support
of the PRRN option via the ibm,client-architecture-support interface.
This patch simply sets the appropriate fields in the client architecture
vector to indicate Linux support for PRRN and will allow the firmware to
report PRRN events via the RTAS event-scan mechanism.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
f0ff7eb483b4c9b24b83aa682c4f42db256f9bdb 24-Apr-2013 Nathan Fontenot <nfont@linux.vnet.ibm.com> powerpc/pseries: Update firmware_has_feature() to check architecture vector 5 bits

The firmware_has_feature() function makes it easy to check for supported
features of the hypervisor. This patch extends the capability of
firmware_has_feature() to include checking for specified bits
in vector 5 of the architecture vector as reported in the device tree.

As part of this the #defines used for the architecture vector are re-defined
such that each option has the index into vector 5 and the feature bit encoded
into it. This makes checking for architecture bits when initiating data
for firmware_has_feature much easier.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
530b5e1475e5bab5d5e5d03438004ad609068146 24-Apr-2013 Nathan Fontenot <nfont@linux.vnet.ibm.com> powerpc/pseries: Move architecture vector definitions to prom.h

As part of handling of PRRN events we need to check vector 5 of the
architecture vector bits reported in the device tree to ensure PRRN event
handling is enabled. To do this firmware_has_feature() is updated (in a
subsequent patch) to make this check vector 5 bits. To avoid having to
re-define bits in the architecture vector the bit definitions are moved
to prom.h.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1674400aaee5b466c595a8fc310488263ce888c7 12-Mar-2013 Anton Blanchard <anton@samba.org> powerpc: Fix -mcmodel=medium breakage in prom_init.c

Commit 5ac47f7a6efb (powerpc: Relocate prom_init.c on 64bit) made
prom_init.c position independent by manually relocating its entries
in the TOC.

We get the address of the TOC entries with the __prom_init_toc_start
linker symbol. If __prom_init_toc_start ends up as an entry in the
TOC then we need to add an offset to get the current address. This is
the case for older toolchains.

On the other hand, if we have a newer toolchain that supports
-mcmodel=medium then __prom_init_toc_start will be created by a
relative offset from r2 (the TOC pointer). Since r2 has already been
relocated, nothing more needs to be done. Adding an offset in this
case is wrong and Aaro Koskinen and Alexander Graf have noticed noticed
G5 and OpenBIOS breakage.

Alan Modra suggested we just use r2 to get at the TOC which is simpler
and works with both old and new toolchains.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5827d4165ac608d7c26fa68701391e80824ee5c9 26-Nov-2012 Anton Blanchard <anton@samba.org> powerpc: Remove RELOC() macro

Now we relocate prom_init.c on 64bit we can finally remove the
nasty RELOC() macro.

Finally a patch that I can claim has a net positive effect on
the kernel. It doesn't happen very often.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5ac47f7a6efbd4fa9141c249e8af3f74e7944eb7 26-Nov-2012 Anton Blanchard <anton@samba.org> powerpc: Relocate prom_init.c on 64bit

The ppc64 kernel can get loaded at any address which means
our very early init code in prom_init.c must be relocatable. We do
this with a pretty nasty RELOC() macro that we wrap accesses of
variables with. It is very fragile and sometimes we forget to add a
RELOC() to an uncommon path or sometimes a compiler change breaks it.

32bit has a much more elegant solution where we build prom_init.c
with -mrelocatable and then process the relocations manually.
Unfortunately we can't do the equivalent on 64bit and we would
have to build the entire kernel relocatable (-pie), resulting in a
large increase in kernel footprint (megabytes of relocation data).
The relocation data will be marked __initdata but it still creates
more pressure on our already tight memory layout at boot.

Alan Modra pointed out that the 64bit ABI is relocatable even
if we don't build with -pie, we just need to relocate the TOC.
This patch implements that idea and relocates the TOC entries of
prom_init.c. An added bonus is there are very few relocations to
process which helps keep boot times on simulators down.

gcc does not put 64bit integer constants into the TOC but to be
safe we may want a build time script which passes through the
prom_init.c TOC entries to make sure everything looks reasonable.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
df77c79920292673b2ce9a338c0da80fe2538b42 08-Nov-2012 Michael Neuling <mikey@neuling.org> powerpc/pseries: Update ibm,architecture.vec for PAPR 2.7/POWER8

Update ibm,architecture.vec for POWER8 and allows us to support more
than one parition per core.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
d3dbeef657fdc9e870e0b01f811bbb906af052f8 19-Aug-2012 Michael Ellerman <michael@ellerman.id.au> powerpc: Rename 64-bit PVR constants to PVR_foo

We have an old FIXME in reg.h which points out that we should standardise
on PVR_foo for our PVR #defines. Currently we use PVR_ on 32-bit and PV_
on 64-bit.

So do that rename and remove the FIXME.

Seeing as we're touching all but one usage of __is_processor(), rename it
to something less ugly and more indicative of what it does, which is
simply to check the PVR version.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
4a727429abec31c4f5d9607cebb4fb1cc21e1167 15-Aug-2012 Ashley Lai <adlai@linux.vnet.ibm.com> PPC64: Add support for instantiating SML from Open Firmware

This patch instantiate Stored Measurement Log (SML) and put the
log address and size in the device tree.

Signed-off-by: Ashley Lai <adlai@us.ibm.com>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
da29aa8f2ab178903a1ac23ce19442f92be4f09c 19-Jul-2012 Seth Jennings <sjenning@linux.vnet.ibm.com> powerpc/crypto: add compression support to arch vec

This patch enables compression engine support in the
architecture vector. This causes the Power hypervisor
to allow access to the nx comrpession accelerator.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2cb387ae758d97ee7396a82528c824b8dc510b8a 07-Jun-2012 Li Zhong <zhong@linux.vnet.ibm.com> powerpc: Fix Section mismatch warnings in prom_init.c

This patches tries to fix a couple of Section mismatch warnings like
following one:

WARNING: arch/powerpc/kernel/built-in.o(.text+0x2923c): Section mismatch
in reference from the function .prom_query_opal() to the
function .init.text:.call_prom()
The function .prom_query_opal() references
the function __init .call_prom().
This is often because .prom_query_opal lacks a __init
annotation or the annotation of .call_prom is wrong.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7e3a4fa160387a72d42e3f8c4b887bb0a9c50d7e 12-Apr-2012 Kent Yoder <key@linux.vnet.ibm.com> powerpc/crypto: Enable the PFO-based encryption device

This patch adds the cas bits to advertise support for the Platform
Facilities Option (PFO) based encryption accelerator device. The nx
device driver provides support for this hardware feature.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
828d2b59717380149bae1e56e2820c8f9c00e211 12-Apr-2012 Kent Yoder <key@linux.vnet.ibm.com> powerpc/pseries: Enable the PFO-based RNG accelerator

This patch adds the cas bits to advertise support for the Platform
Facilities Option (PFO) based random number generator accerator.
The pseries-rng driver provides support for this hardware feature.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
404e32e4a8f68d218b73b7db7bb831d887ab6046 10-May-2012 Robert Jennings <rcj@linux.vnet.ibm.com> powerpc/pseries: Support lower minimum entitlement for virtual processors

This patch changes the architecture vector to advertise support for a
lower minimum virtual processor entitled capacity. The default
minimum without this patch is 10%, this patch specifies 1%.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ae3a197e3d0bfe3f4bf1693723e82dc018c096f3 28-Mar-2012 David Howells <dhowells@redhat.com> Disintegrate asm/system.h for PowerPC

Disintegrate asm/system.h for PowerPC.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
cc: linuxppc-dev@lists.ozlabs.org
1d9a47315042606b4217691bcea36cfa6ccbde66 21-Mar-2012 Stephen Rothwell <sfr@canb.auug.org.au> powerpc: Random little legacy iSeries removal tidy ups

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
e9daf2ad7f603f173d7cd7ee3673b326414f82f4 27-Feb-2012 Nishanth Aravamudan <nacc@linux.vnet.ibm.com> powerpc/prom: Remove limit on maximum size of properties

On a 16TB system (using AMS/CMO), I get:

WARNING: ignoring large property [/ibm,dynamic-reconfiguration-memory] ibm,dynamic-memory length 0x000000000017ffec

and significantly less memory is thus shown to the partition. As far as
I can tell, the constant used is arbitrary. Ben Herrenschmidt provided
additional background that

> The limit was originally set because of Apple machines carrying ROM
> images in the device-tree, at a time where we were much more memory
> constrained than we are now.

and that it is likely not very useful any longer.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
0f890c8d205e47f7cb0d381ffba582a170fd4f72 14-Dec-2011 Suzuki Poulose <suzuki@in.ibm.com> powerpc: Rename mapping based RELOCATABLE to DYNAMIC_MEMSTART for BookE

The current implementation of CONFIG_RELOCATABLE in BookE is based
on mapping the page aligned kernel load address to KERNELBASE. This
approach however is not enough for platforms, where the TLB page size
is large (e.g, 256M on 44x). So we are renaming the RELOCATABLE used
currently in BookE to DYNAMIC_MEMSTART to reflect the actual method.

The CONFIG_RELOCATABLE for PPC32(BookE) based on processing of the
dynamic relocations will be introduced in the later in the patch series.

This change would allow the use of the old method of RELOCATABLE for
platforms which can afford to enforce the page alignment (platforms with
smaller TLB size).

Changes since v3:

* Introduced a new config, NONSTATIC_KERNEL, to denote a kernel which is
either a RELOCATABLE or DYNAMIC_MEMSTART(Suggested by: Josh Boyer)

Suggested-by: Scott Wood <scottwood@freescale.com>
Tested-by: Scott Wood <scottwood@freescale.com>

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Josh Boyer <jwboyer@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux ppc dev <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
3f53638c805f75989f4b4be07efcfd173cdd5e2d 14-Dec-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Fix old bug in prom_init setting of the color

We have an array of 16 entries and a loop of 32 iterations... oops.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
64968f60e73d7b3f9fca1ca5cd985d75b2cbca44 13-Dec-2011 Paul Mackerras <paulus@samba.org> powerpc: Only use initrd_end as the limit for alloc_bottom if it's inside the RMO.

As the kernels and initrd's get bigger boot-loaders and possibly
kexec-tools will need to place the initrd outside the RMO. When this
happens we end up with no lowmem and the boot doesn't get very far.

Only use initrd_end as the limit for alloc_bottom if it's inside the
RMO.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
33392640424ff775e7d82eab4a51af7b8cc9384d 04-Dec-2011 Anton Blanchard <anton@samba.org> powerpc/pseries: Increase minimum RMO size from 64MB to 256MB

The minimum RMO size field in ibm,client-architecture is currently
ignored, but a future firmware version will rectify that. Since we
always get at least 128MB of RMO right now, asking for 64MB is
likely to result in boot failures.

We should bump it to at least 128MB, but considering all the boot
issues we have on 128MB RMO boxes and all new machines have virtual
RMO, we may as well set our minimum to 256MB.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
40dfef66a9e3d4a308c3ed7355c9a89e68c08ffc 29-Nov-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Workaround OFW issues in prom_init.c

Open Firmware on OPAL machines seems to have issues if we close
stdin and/or we try to print things after calling "quiesce" so
we avoid doing both.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
6d1e2c6c1a0b800473db4df8595c95745be548ea 14-Nov-2011 Anton Blanchard <anton@samba.org> powerpc: panic if we can't instantiate RTAS

I had to debug a strange situation where all manner of things were
failing. SMT threads, storage and network were all completely broken.

The root cause was we couldn't find enough memory to instantiate RTAS -
this was a network install so the initrd was huge.

Instead of limping along and failing in mysterious ways we should just
panic up front if RTAS exists and we can't allocate space for it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7680057cc4c7d9caada12767831bfd9738dd7b43 28-Sep-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Don't try OPAL takeover on old 970 blades

The firmware on old 970 blades supports some kind of takeover called
"TNK takeover" which will crash if we try to probe for OPAL takeover,
so don't do it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
6e35d5dac0c83ebb616ff3b9c2d6155c9a9ccb86 19-Sep-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware

OPAL v2 is instantiated in a way similar to RTAS using Open Firmware
client interface calls, and the resulting address and entry point are
put in the device-tree

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
817c21ad9a1f00926f080265493923ada3458c63 19-Sep-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Get kernel command line accross OPAL takeover

We stash it in boot_command_line which isn't in BSS and so won't
be overwritten. We then use that as a default cmd_line before
we walk the device-tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
27f4488872d9ef2a4b9aa2be58fb0789d6c0ba84 19-Sep-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Add OPAL takeover from PowerVM

On machines supporting the OPAL firmware version 1, the system
is initially booted under pHyp. We then use a special hypercall
to verify if OPAL is available and if it is, we then trigger
a "takeover" which disables pHyp and loads the OPAL runtime
firmware, giving control to the kernel in hypervisor mode.

This patch add the necessary code to detect that the OPAL takeover
capability is present when running under PowerVM (aka pHyp) and
perform said takeover to get hypervisor control of the processor.

To perform the takeover, we must first use RTAS (within Open
Firmware runtime environment) to start all processors & threads,
in order to give control to OPAL on all of them. We then call
the takeover hypercall on everybody, OPAL will re-enter the kernel
main entry point passing it a flat device-tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fbafd728151ccc8665584bde78deb03dbb9ef055 25-Jul-2011 Anton Blanchard <anton@samba.org> powerpc: Clean up some panic messages in prom_init

Add a newline to the panic messages in make_room. Also fix a
comment that suggested our chunk size is 4Mb. It's 1MB.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
966728dd88b4026ec58fee169ccceaeaf56ef120 25-Jul-2011 Anton Blanchard <anton@samba.org> powerpc: Fix device tree claim code

I have a box that fails in OF during boot with:

DEFAULT CATCH!, exception-handler=fff00400
at %SRR0: 49424d2c4c6f6768 %SRR1: 800000004000b002

ie "IBM,Logh". OF got corrupted with a device tree string.

Looking at make_room and alloc_up, we claim the first chunk (1 MB)
but we never claim any more. mem_end is always set to alloc_top
which is the top of our available address space, guaranteeing we will
never call alloc_up and claim more memory.

Also alloc_up wasn't setting alloc_bottom to the bottom of the
available address space.

This doesn't help the box to boot, but we at least fail with
an obvious error. We could relocate the device tree in a future
patch.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9ee820fa005254dfc816330f6654f14dcb2beee1 04-May-2011 Brian King <brking@linux.vnet.ibm.com> powerpc/pseries: Add page coalescing support

Adds support for page coalescing, which is a feature on IBM Power servers
which allows for coalescing identical pages between logical partitions.
Hint text pages as coalesce candidates, since they are the most likely
pages to be able to be coalesced between partitions. This patch also
exports some page coalescing statistics available from firmware via
lparcfg.

[BenH: Moved a couple of things around to fix compile problems]

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
af2771493a1bf79cd9a1ab4f30327c428b5bd67c 06-Apr-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Improve prom_printf()

Adds the ability to print decimal numbers and adds some more
format string variants

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2c48a7d615b82e030196e8b61ab0c7933be16dff 27-Jul-2010 Michael Neuling <mikey@neuling.org> powerpc: Print decimal values in prom_init.c

Currently we look pretty stupid when printing out a bunch of things in
prom_init.c. eg.

Max number of cores passed to firmware: 0x0000000000000080

So I've change this to print in decimal:

Max number of cores passed to firmware: 128 (NR_CPUS = 256)

This required adding a prom_print_dec() function and changing some
prom_printk() calls from %x to %lu.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
33ad5e4b6cab3ad8cf3afda49b66393f1833150e 17-Jun-2010 Anton Blanchard <anton@samba.org> powerpc: Linux cannot run with 0 cores

If we configure with CONFIG_SMP=n or set NR_CPUS less than the number of
SMT threads we will set the max cores property to 0 in the
ibm,client-architecture-support structure. On new versions of firmware that
understand this property it obliges and terminates our partition.

Use DIV_ROUND_UP so we handle not only the CONFIG_SMP=n case but also the
case where NR_CPUS isn't a multiple of the number of SMT threads.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
4b83c330b4d38e869111bda6e9077d4f61ed974a 07-Apr-2010 Anton Blanchard <anton@samba.org> powerpc/numa: Add form 1 NUMA affinity

Firmware changed the way it represents memory and cpu affinity on POWER7.
Unfortunately the old method now caps the topology to work around issues
with legacy operating systems. For Linux to get the correct topology we
need to use the new form 1 affinity information.

We set the form 1 field in the client architecture, and if we see "1" in the
ibm,associativity-form property firmware supports form 1 affinity and
we should look at the first field in the ibm,associativity-reference-points
array. If not we use the second field as we always have.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
efec959f63de850fbd2442189f7dfc9c38efe251 04-Feb-2010 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/pseries: Pass more accurate number of supported cores to firmware

Updated variant of a patch by Joel Schopp.

The field containing the number of supported cores which we pass to
firmware via the ibm,client-architecture call was set by a previous
patch statically as high as is possible (NR_CPUS).

However, that value isn't quite right for a system that supports
multiple threads per core, thus permitting the firmware to assign
more cores to a Linux partition than it can really cope with.

This patch improves it by using the device-tree to determine the
number of threads supported by the processors in order to adjust
the value passed to firmware.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
28bb9ee13aa0ee4c57dc3568f539cc84920b43aa 01-Feb-2010 jschopp@austin.ibm.com <jschopp@austin.ibm.com> powerpc: Add static fields to ibm,client-architecture call

This patch adds 2 fields to the ibm_architecture_vec array.

The first of these fields indicates the number of cores which Linux can
boot. It does not account for SMT, so it may result in cpus assigned to
Linux which cannot be booted. A second patch follows that dynamically
updates this for SMT.

The second field just indicates that our OS is Linux, and not another
OS. The system may or may not use this hint to performance tune
settings for Linux.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
049d0497060bc8db944f7b4984271327448b3603 21-Sep-2009 Anton Blanchard <anton@samba.org> powerpc: Fix ibm,client-architecture-support printout

On machines without the ibm,client-architecture-support call we were missing a
newline. We may as well print the full name in all its glory too - its
ibm,client-architecture-support, not ibm,client-architecture as I mistakenly
wrote (a name only an IBM architect could love).

For my penance I will write out ibm,client-architecture-support 100 times.

Before:

Calling ibm,client-architecture...command line: root=/dev/sda6 console=hvc0 quiet

After:

Calling ibm,client-architecture-support... not implemented
command line: root=/dev/sda6 console=hvc0

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
cf68787b68a2011664f1670a827c8f202ddb7c3d 28-Jul-2009 Benjamin Krill <ben@codiert.org> powerpc/prom_init: Evaluate mem kernel parameter for early allocation

Evaluate mem kernel parameter for early memory allocations. If mem is set
no allocation in the region above the given boundary is allowed. The current
code doesn't take care about this and allocate memory above the given mem
boundary.

Signed-off-by: Benjamin Krill <ben@codiert.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
cf54dc7cd4f9aab55cd3e1794b0b74c3c88cd1a0 24-Jul-2009 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Move definitions of secondary CPU spinloop to header file

Those definitions are currently declared extern in the .c file where
they are used, move them to a header file instead.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
8f101a051ef054c33186abcd54b30a88afea47ef 18-Jun-2009 Harry Ciao <qingtao.cao@windriver.com> edac: cpc925 MC platform device setup

Fix up the number of cells for the values of CPC925 Memory Controller,
and setup related platform device during system booting up, against
which CPC925 Memory Controller EDAC driver would be matched.

Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ae52bb2384f721562f15f719de1acb8e934733cb 17-Jun-2009 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> fbdev: move logo externs to header file

Now we have __initconst, we can finally move the external declarations for
the various Linux logo structures to <linux/linux_logo.h>.

James' ack dates back to the previous submission (way to long ago), when the
logos were still __initdata, which caused failures on some platforms with some
toolchain versions.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
856cc2f0bea673b5fcd1500533ee8ffd6c0749bd 31-Mar-2009 Anton Blanchard <anton@samba.org> powerpc/pseries: Fix ibm,client-architecture comment

We specify a 64MB RMO, but the comment says 128MB.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
1f8737aab39e15684bf6b6b53586b7c89a269f79 31-Mar-2009 Anton Blanchard <anton@samba.org> powerpc: Clean up some prom printouts

Make all messages consistent, some have spaces before the "...", some do not.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
4da727ae2aa62f134c79d38c41d15f50d912745f 31-Mar-2009 Anton Blanchard <anton@samba.org> powerpc: Print progress of ibm,client-architecture method

The ibm,client-architecture method will often cause a reconfiguration reboot.
When this happens the last thing we see is:

Hypertas detected, assuming LPAR !

Which doesn't explain what just happened. Wrap the ibm,client-architecture
so it's clear what is going on:

Calling ibm,client-architecture... done

In order to maintain the law of conservation of screen real estate, downgrade
two other messages to debug.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
151a9f4aef53fb9cc1e192c7d321c1d820232f4a 22-Mar-2009 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Fix prom_init on 32-bit OF machines

Commit e7943fbbfdb6eef03c003b374de1f802cc14f02a broke ppc32 using
Open Firmware client interface due to using the wrong relocation
macro when accessing the variable "linux_banner".

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
e7943fbbfdb6eef03c003b374de1f802cc14f02a 04-Mar-2009 Michael Ellerman <michael@ellerman.id.au> powerpc: Print linux_banner in prom_init

So at least you can see what kernel you're booting if you die
before the kernel prints it mid-way through start_kernel().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2b931fb67e10d6eb99d9928fa3afe83cdeeb7354 06-Jan-2009 Ingo Molnar <mingo@elte.hu> powerpc: Use correct type in prom_init.c

tce_entryp is a "u64 *" not an "unsigned long *".

[Split from a large patch -sfr]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5663a1232bd557b4b2141ad345dd56785fa51c2a 31-Oct-2008 Paul Mackerras <paulus@samba.org> Revert "powerpc: Sync RPA note in zImage with kernel's RPA note"

This reverts commit 91a00302959545a9ae423e99732b1e46eb19e877, plus
commit 0dcd440120ef12879ff34fc78d7e4abf171c79e4 ("powerpc: Revert CHRP
boot wrapper to real-base = 12MB on 32-bit") which depended on it.

Commit 91a00302 was causing NVRAM corruption on some pSeries machines,
for as-yet unknown reasons, so this reverts it until the cause is
identified.

Signed-off-by: Paul Mackerras <paulus@samba.org>
34d81f858a3bdec568bf08c4feb997ccd3d40b94 20-Oct-2008 Milton Miller <miltonm@bga.com> powerpc: Delete unused prom_strtoul and prom_memparse

These functions should have been static, and inspection shows they
are no longer used. (We used to parse mem= but we now defer that
to early_param).

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
91a00302959545a9ae423e99732b1e46eb19e877 08-Oct-2008 Paul Mackerras <paulus@samba.org> powerpc: Sync RPA note in zImage with kernel's RPA note

Commit 9b09c6d909dfd8de96b99b9b9c808b94b0a71614 ("powerpc: Change the
default link address for pSeries zImage kernels") changed the
real-base value in the CHRP note added by the addnote program from
12MB to 32MB to give more space for Open Firmware to load the zImage.
(The real-base value says where we want OF to position itself in
memory.) However, this change was ineffective on most pSeries
machines, because the RPA note added by addnote has the "ignore me"
flag set to 1. This was intended to tell OF to ignore just the RPA
note, but has the side effect of also making OF ignore the CHRP note
(at least on most pSeries machines).

To solve this we have to set the "ignore me" flag to 0 in the RPA
note. (We can't just omit the RPA note because that is equivalent to
having an RPA note with default values, and the default values are not
what we want.) However, then we have to make sure the values in the
zImage's RPA note match up with the values that the kernel supplies
later in prom_init.c with either the ibm,client-architecture-support
call or the process-elf-header call in prom_send_capabilities().

So this sets the "ignore me" flag in the RPA note in addnote to 0, and
adjusts the RPA note values in addnote.c and in prom_init.c to be
consistent with each other and with the values in ibm_architecture_vec.

However, since the wrapper is independent of the kernel, this doesn't
ensure that the notes will stay consistent. To ensure that, this adds
code to addnote.c so that it can extract the kernel's RPA note from
the kernel binary and put that in the zImage. To that end, we put the
kernel's fake ELF header (which contains the kernel's RPA note) into
its own section, and arrange for wrapper to pull out that section with
objcopy and pass it to addnote, which then extracts the RPA note from
it and transfers it to the zImage.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
549e8152de8039506f69c677a4546e5427aa6ae7 30-Aug-2008 Paul Mackerras <paulus@samba.org> powerpc: Make the 64-bit kernel as a position-independent executable

This implements CONFIG_RELOCATABLE for 64-bit by making the kernel as
a position-independent executable (PIE) when it is set. This involves
processing the dynamic relocations in the image in the early stages of
booting, even if the kernel is being run at the address it is linked at,
since the linker does not necessarily fill in words in the image for
which there are dynamic relocations. (In fact the linker does fill in
such words for 64-bit executables, though not for 32-bit executables,
so in principle we could avoid calling relocate() entirely when we're
running a 64-bit kernel at the linked address.)

The dynamic relocations are processed by a new function relocate(addr),
where the addr parameter is the virtual address where the image will be
run. In fact we call it twice; once before calling prom_init, and again
when starting the main kernel. This means that reloc_offset() returns
0 in prom_init (since it has been relocated to the address it is running
at), which necessitated a few adjustments.

This also changes __va and __pa to use an equivalent definition that is
simpler. With the relocatable kernel, PAGE_OFFSET and MEMORY_START are
constants (for 64-bit) whereas PHYSICAL_START is a variable (and
KERNELBASE ideally should be too, but isn't yet).

With this, relocatable kernels still copy themselves down to physical
address 0 and run there.

Signed-off-by: Paul Mackerras <paulus@samba.org>
1f6a93e4c35e75d547b51f56ba8139ab1a91628c 30-Aug-2008 Paul Mackerras <paulus@samba.org> powerpc: Make it possible to move the interrupt handlers away from the kernel

This changes the way that the exception prologs transfer control to
the handlers in 64-bit kernels with the aim of making it possible to
have the prologs separate from the main body of the kernel. Now,
instead of computing the address of the handler by taking the top
32 bits of the paca address (to get the 0xc0000000........ part) and
ORing in something in the bottom 16 bits, we get the base address of
the kernel by doing a load from the paca and add an offset.

This also replaces an mfmsr and an ori to compute the MSR value for
the handler with a load from the paca. That makes it unnecessary to
have a separate version of EXCEPTION_PROLOG_PSERIES that forces 64-bit
mode.

We can no longer use a direct branches in the exception prolog code,
which means that the SLB miss handlers can't branch directly to
.slb_miss_realmode any more. Instead we have to compute the address
and do an indirect branch. This is conditional on CONFIG_RELOCATABLE;
for non-relocatable kernels we use a direct branch as before. (A later
change will allow CONFIG_RELOCATABLE to be set on 64-bit powerpc.)

Since the secondary CPUs on pSeries start execution in the first 0x100
bytes of real memory and then have to get to wherever the kernel is,
we can't use a direct branch to get there. Instead this changes
__secondary_hold_spinloop from a flag to a function pointer. When it
is set to a non-NULL value, the secondary CPUs jump to the function
pointed to by that value.

Finally this eliminates one code difference between 32-bit and 64-bit
by making __secondary_hold be the text address of the secondary CPU
spinloop rather than a function descriptor for it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
7d2f6075f992d33c7be829c3638b8cb72b782b19 27-Jul-2008 Nathan Lynch <ntl@pobox.com> powerpc: kill useless SMT code in prom_hold_cpus

This piece of code is broken for >2 threads, and possibly in some
other subtle ways (such as comparing a value obtained from an
"ibm,ppc-interrupt-server#s" property to a value obtained from a
"reg" property) and doesn't seem to have any useful purpose in the
first place other than a dubious warning in case NR_CPUS is too
small, which probably isn't the right place to do so.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
8391e42a5c1f3d757faa5e7f46a4a68f9aa6cb12 23-Jul-2008 Nathan Fontenot <nfont@austin.ibm.com> powerpc/pseries: Update arch vector to indicate support for CMO

Update the architecture vector to indicate that Cooperative Memory
Overcommitment is supported if CONFIG_PPC_SMLPAR is set.

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
0cb99013775f75a7b2cc72a26f48827601cf7cee 18-Jun-2008 Joel Schopp <jschopp@austin.ibm.com> powerpc: Tell firmware we support architecture V2.06

Add the bits to the architecture-vec so that ibm,client-architecture
lets the firmware know we support the 2.06 architecture.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e952e6c4d6635b36c212c056a9427bd93460178c 18-Jun-2008 Michael Neuling <mikey@neuling.org> powerpc: Add cputable entry for POWER7

Add a cputable entry for the POWER7 processor.

Also tell firmware that we know about POWER7.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
7f4392cdcc63fea72fc77d14497059267d77d5d0 13-Apr-2008 David Woodhouse <dwmw2@infradead.org> [POWERPC] Efika: Really, don't pretend to be CHRP

Fedora 9 works on Efika without the separate 'device-tree supplement',
thanks to the kernel's own fixups. With one exception -- because 'CHRP'
still appears on the 'machine:' line in /proc/cpuinfo, the installer
misdetects the platform and misconfigures yaboot, putting it into a PReP
boot partition instead of in the /boot filesystem where the Efika's
firmware could find it.

The kernel's fixups for Efika already correct one instance of 'chrp', in
the 'device_type' property. This fixes it in the 'CODEGEN,description'
property too, since that's what's exposed to userspace in /proc/cpuinfo.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
94d2dde738a50124d1f1b1b40bd5b9d0ed22e2e2 25-Jan-2008 Grant Likely <grant.likely@secretlab.ca> [POWERPC] Efika: prune fixups and make them more carefull

Prune back Efika fixups to only include changes that are actually required
to get a working system. Most of the drivers can accept the compatible
properties, even if they don't match the what is recommented in the generic
names recommended practice document.

This patch also adds extra checks so that fixups are not performed blindly.
Instead, the code first verifies that the device tree is faulty before
making any changes. This way, if the Efika firmware is updated to fix
these issues, then the fixups will no longer get applied.

At this point; here is the list of fixups needed for the efika:
1. If the device_type property on the root node is 'chrp', then Linux won't
boot. Change device_type to 'efika' to avoid this condition
2. Add full interrupt list to the bestcomm node. In actual fact, the
bestcomm interrupts property is technically correct, it just doesn't
expose the same granularity as the device driver expects. All other
5200 device trees provide a separate irq number for each bestcomm
channel. Rather than hack the driver, it's simpler to fix it up
3. /builtin/sound node is missing an interrupts property
4. /builtin/ethernet node is missing a phy-handle property and the
device driver doesn't know what to do without one.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
6f4347c969674ed45de7d08d4b26d6326a95b959 09-Jan-2008 Olaf Hering <olaf@aepfle.de> [POWERPC] efika: add phy-handle property for fec_mpc52xx

The new network driver fec_mpc52xx will not work on efika because the
firmware does not provide all required properties.
http://www.powerdeveloper.org/asset/by-id/46 has a Forth script to
create more properties. But only the phy stuff is required to get a
working network.

This should go into the kernel because its appearently
impossible to boot the script via tftp and then load the real boot
binary (yaboot or zimage).

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
aca71ef8827d11de243e30f170cfc126376803b4 05-Nov-2007 Li Zefan <lizf@cn.fujitsu.com> [POWERPC] ] Fix memset size error

The size passing to memset is wrong.

Signed-off-by Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Signed-off-by: Paul Mackerras <paulus@samba.org>
e788ff13be03c2cc4055d5569b7b218dc3f2cb7b 06-Sep-2007 Linas Vepstas <linas@austin.ibm.com> [POWERPC] prom_init whitespace cleanup, typo fix

Whitespace cleanup: badly indented lines.
Typo in comment.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
556ecf9be66f4d493e19bc71a7ce84366d512b71 17-Aug-2007 Olaf Hering <olaf@aepfle.de> [POWERPC] Advertise correct IDE mode on Pegasos2

The built-in IDE controller is configured in legacy mode, but the PCI
registers advertise native mode. Force the PCI class into legacy
mode. This allows pata_via to access two drives.

The Pegasos specific irq enforcement in the via82cxxx driver must stay
because there is apparently no generic way to setup irq per channel.

Tested on Pegasos2 with firmware version 20040810, and two IDE disks.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
d8c391a5593aca5bea002bcaaec16c7bbd6ec853 07-Jun-2007 Jake Moilanen <moilanen@austin.ibm.com> [POWERPC] Donate idle CPU cycles on dedicated partitions

A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
shared CPU) to other shared processors if the administrator asks for it
(via the HMC).

This enables that to work properly on P6.

This just involves setting a bit in the CAS structure as well as the
VPA. To donate cycles, a CPU has to have all SMT threads idle and
have the donate bit set in the VPA. Then call H_CEDE.

The reason why shared processors just aren't used is because dedicated
CPUs are guaranteed an actual processor, yet the system is still able to
increase the capacity of the shared CPU pool.

Also rename the VPA's cpuctls_task_attrs field to a more accurate name.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
014dad902aad6f5efbd65d0524b2e99304d2b07e 07-May-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Tell Phyp we support MSI

Tell Phyp we support MSI via the client architecture support mechanism.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
0108d3fe3c44f01de224f39347b95f6a94181687 07-May-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Add __init annotations to reserve_mem() and stabs_alloc()

reserve_mem() and stabs_alloc() are both called only from other __init
routines, so can be marked __init.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
3a5cc44268d9c3eee301f366801005e331b1e871 06-May-2007 Domen Puncer <domen.puncer@telargo.com> [POWERPC] Set efika's device_type to "soc"

Device type should be "soc" (as in lite5200.dts), compatible is
already set to "mpc5200".

Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e48059225c2edc6f1e5a2008261f1efdf606f247 04-Apr-2007 Olaf Hering <olaf@aepfle.de> [POWERPC] Add correct interrupt property for pegasos ide

The firmware assigns irq 20/21 to the VIA IDE device on Pegasos.
But the required interrupt is 14/15.
Maybe someone confused decimal vs. hexadecimal values.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
88fd2a9d681f261ebd55a6843a03ea2a1bb9eb39 12-Feb-2007 Sylvain Munaut <tnt@246tNt.com> [POWERPC] Add device tree fixups for the EFIKA

We make the efika device tree compliant with the defined bindings
(at least compliant enough). This is mostly done by mangling
the device_type and compatible properties, but also adding
some missing bits.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
0204568a088fecd5478153504f9476ee2c46d5bf 29-Nov-2006 Paul Mackerras <paulus@samba.org> [POWERPC] Support ibm,dynamic-reconfiguration-memory nodes

For PAPR partitions with large amounts of memory, the firmware has an
alternative, more compact representation for the information about the
memory in the partition and its NUMA associativity information. This
adds the code to the kernel to parse this alternative representation.

The other part of this patch is telling the firmware that we can
handle the alternative representation. There is however a subtlety
here, because the firmware will invoke a reboot if the memory
representation we request is different from the representation that
firmware is currently using. This is because firmware can't change
the representation on the fly. Further, some firmware versions used
on POWER5+ machines have a bug where this reboot leaves the machine
with an altered value of load-base, which will prevent any kernel
booting until it is reset to the normal value (0x4000). Because of
this bug, we do NOT set fake_elf.rpanote.new_mem_def = 1, and thus we
do not request the new representation on POWER5+ and earlier machines.
We do request the new representation on POWER6, which uses the
ibm,client-architecture-support call.

Signed-off-by: Paul Mackerras <paulus@samba.org>
0efbc18a753f7d6dbe832e014bc80e2b4c12bece 29-Nov-2006 Paul Mackerras <paulus@samba.org> [POWERPC] Tell firmware we can handle POWER6 compatible mode

This adds the "logical" PVR value used by POWER6 in "compatible" mode
to the list of PVR values that the kernel tells firmware it is able to
handle.

Signed-off-by: Paul Mackerras <paulus@samba.org>
974a76f51355d22f4f63d83d6bb1ccecd019ec58 10-Nov-2006 Paul Mackerras <paulus@samba.org> [POWERPC] Distinguish POWER6 partition modes and tell userspace

This adds code to look at the properties firmware puts in the device
tree to determine what compatibility mode the partition is in on
POWER6 machines, and set the ELF aux vector AT_HWCAP and AT_PLATFORM
entries appropriately.

Specifically, we look at the cpu-version property in the cpu node(s).
If that contains a "logical" PVR value (of the form 0x0f00000x), we
call identify_cpu again with this PVR value. A value of 0x0f000001
indicates the partition is in POWER5+ compatibility mode, and a value
of 0x0f000002 indicates "POWER6 architected" mode, with various
extensions disabled. We also look for various other properties:
ibm,dfp, ibm,purr and ibm,spurr.

Signed-off-by: Paul Mackerras <paulus@samba.org>
165785e5c0be3ad43e8b8eadfbd25e92c2cd002a 11-Nov-2006 Jeremy Kerr <jk@ozlabs.org> [POWERPC] Cell iommu support

This patch adds full cell iommu support (and iommu disabled mode).

It implements mapping/unmapping of iommu pages on demand using the
standard powerpc iommu framework. It also supports running with
iommu disabled for machines with less than 2GB of memory. (The
default is off in that case, though it can be forced on with the
kernel command line option iommu=force).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
11e9ed43ca8a741c2858c33d12120cf8817d3bff 25-Aug-2006 Will Schmidt <will_schmidt@vnet.ibm.com> [POWERPC] Fix up ibm_architecture_vec definition

This problem was noticed by one of the Phyp firmware folks.
Our ibm,client-architecture-support call was failing.
This corrects the vector length parameters being passed in.

Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
21bd2e6696bb5c8b32b00a0ea597f49bfda0ddc6 04-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Fix 32 bits warning in prom_init.c

A warning is hurting my eyes when building 32 bits kernels

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
f0ca330bc4ce00377f940b786d7ec7d848dc4102 04-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Workaround Pegasos incorrect ISA "ranges"

The Pegasos firmware doesn't create a valid "ranges" property for the
ISA bridge, thus causing translation of ISA addresses and IO ports to
fail. This fixes it, thus re-enabling proper early serial console to
work on Pegasos.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
26c5032eaa64090b2a01973b0c6ea9e7f6a80fa7 04-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Add briq support to CHRP

The support for Briq machines has been floating around as patches for
ages. This cleans it up and adds it once for all.

Some of this is based on initial code provided by Karsten Jeppesen
<karsten@jeppesens.com> and mostly rewritten from scratch by me.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
470407a88e549135dce5fba7d86fb9910f500e56 04-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Fix 32 bits warning in prom_init.c

A warning is hurting my eyes when building 32 bits kernels

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e8c0acf9a4fe3b2b6847541bf5cc3c86c18272ec 04-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Workaround Pegasos incorrect ISA "ranges"

The Pegasos firmware doesn't create a valid "ranges" property for the
ISA bridge, thus causing translation of ISA addresses and IO ports to
fail. This fixes it, thus re-enabling proper early serial console to
work on Pegasos.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
980a65136569b841cebaad524a34482b0b1627a9 03-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Fix booting on Momentum "Apache" board (a Maple derivative)

This extends the maple device-tree workarounds to work on the
Apache board as well, and extends the maple platform probing code
to recognize the Apache board.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
b3c2ffd5343645fc9b46f67e8c0eaac1e2dde7b4 30-Jun-2006 Adrian Bunk <bunk@stusta.de> typo fixes: mecanism -> mechanism

Signed-off-by: Adrian Bunk <bunk@stusta.de>
0e4aa9c2009187fff1c999fe0aaa134c1a84f48a 13-Jun-2006 Amos Waterland <apw@us.ibm.com> [POWERPC] Fix builtin command line interaction with firmware

It seems that prom_init's early_cmdline_parse is broken on at least
Apple 970 xserves and IBM JS20 blades with SLOF. The firmware of these
machines returns -1 and 1 respectively when getprop is called for the
bootargs property of /chosen, causing Linux to ignore its builtin
command line in favor of a null string. This patch makes Linux use its
builtin command line if getprop returns an error or a null string.

Signed-off-by: Amos Waterland <apw@us.ibm.com>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
133dda1e4f757e036fa838cba6804d0344931c4a 06-Jun-2006 Arnd Bergmann <arnd@arndb.de> [PATCH] powerpc: Fix cell blade detection

The IBM Cell blade firmware might confuse the kernel to think it's a
pSeries machine. This fixes it for now. With a bit of luck, the firmware
will be updated to avoid that in the future but currently that patch is
needed.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
33b7497794424181dca87f18e43ecbc07f86bba5 06-Jun-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] powerpc: Fix call to ibm,client-architecture-support

The code in prom_init.c calling the firmware
ibm,client-architecture-support method on pSeries has a bug where it
fails to properly pass the instance handle of the firmware object when
trying to call a method. Result ranges from the call doing nothing to
the firmware crashing. (Found by Segher, thanks !)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
54f4ee183aea859eb09f141dad3fc3c6f4fe0446 25-May-2006 Hollis Blanchard <hollisb@us.ibm.com> [PATCH] powerpc: fix RTC/NVRAM accesses on Maple

Due to a firmware device tree bug, RTC and NVRAM accesses (including
halt/reboot) on Maple have been broken since January, when an untested
build fix went in. This code patches the device tree in Linux.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
4d1f3f25d9c303d1ce63b42cc94c54ac0ab2e950 19-May-2006 Jimi Xenidis <jimix@watson.ibm.com> [PATCH] powerpc: Auto reserve of device tree blob

A devtree compiler (dtc) generated devtree blob is "relocatable" and so
does not contain a reserved_map entry for the blob itself. This means
that if passed to Linux, Linux will not get lmb_reserve() the blob and
it could be over. The following patch will explicitly reserve the
"blob" as it was given to us and stops prom_init.c from creating a
reserved mapping for the blob.

NOTE: that the dtc/kexec should not generate the blob reservation entry.
Although if they do, LMB reserver handles overlaps.

Signed-off-by: <jimix@watson.ibm.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
35dd54326e857f1648c7cc1028e8d5e1dbe04992 18-May-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Move crashkernel= handling into the kernel.

This was missing a quilt ref.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2babf5c2ec2f2d5de3e38d20f7df7fd815fd10c9 17-May-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Unify mem= handling

We currently do mem= handling in three seperate places. And as benh pointed out
I wrote two of them. Now that we parse command line parameters earlier we can
clean this mess up.

Moving the parsing out of prom_init means the device tree might be allocated
above the memory limit. If that happens we'd have to move it. As it happens
we already have logic to do that for kdump, so just genericise it.

This also means we might have reserved regions above the memory limit, if we
do the bootmem allocator will blow up, so we have to modify
lmb_enforce_memory_limit() to truncate the reserves as well.

Tested on P5 LPAR, iSeries, F50, 44p. Tested moving device tree on P5 and
44p and F50.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
cb6b2eb9bcf2f61e84dc0b55ef7e3d4923842313 15-May-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] Fix pSeries identification in prom_init.c

The OF trampoline code prom_init.c still needs to identify IBM pSeries
(PAPR) machines in order to run some platform specific code on them like
instanciating the TCE tables. The code doing that detection was changed
recently in 2.6.17 early stages but was done slightly incorrectly. It
should be testing for an exact match of "chrp" and it currently tests
for anything that begins with "chrp". That means it will incorrectly
match with platforms using Maple-like device-trees and have open
firmware. This fixes it by using strcmp instead of strncmp to match what
the actual platform detection code does.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
03054d51a70e8c273df5d9bc31fea6c843eaa1c3 29-Apr-2006 Anton Blanchard <anton@samba.org> [PATCH] powerpc: Add cputable entry for POWER6

Add a cputable entry for the POWER6 processor.

The SIHV and SIPR bits in the mmcra have moved in POWER6, so disable
support for that until oprofile is fixed.

Also tell firmware that we know about POWER6.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
f709bfac48492e289ba78ea1e8c0b3daab264e90 28-Apr-2006 Paul Mackerras <paulus@samba.org> powerpc/pseries: Tell firmware our capabilities on new machines

This adds code to call a new firmware method to tell the firmware
what machines and capabilities (such as VMX/Altivec) we support.
This will be needed on POWER5+ and POWER6 machines, and it has no
effect on past and current machines.

Signed-off-by: Paul Mackerras <paulus@samba.org>
6f806ceed53776ae5e04c8b334dc9daa0932ad1e 07-Apr-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Fix machine detection in prom_init.c

In e8222502ee6157e2713da9e0792c21f4ad458d50 the detection of machine types
in prom_init broke for some machines. We should be checking /device_type
instead of /model. This should make Power3 and Power4 boot again. Haven't
been able to test this. We also need to relocate before comparing.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e8222502ee6157e2713da9e0792c21f4ad458d50 28-Mar-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] powerpc: Kill _machine and hard-coded platform numbers

This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism. With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.

We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants. This commit also
changes various drivers to use the new macro instead of looking at
_machine.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
add60ef303809087999412209d24d400a1c96670 23-Mar-2006 Olaf Hering <olh@suse.de> [PATCH] powerpc: return to OF via trap, not exit

Do not call prom exit prom_panic. It clears the screen and the exit
message is lost.

On some (or all?) pmacs it causes another crash when OF tries to print
the date and time in its banner.

Set of_platform earlier to catch more prom_panic() calls.

Signed-off-by: Olaf Hering <olh@suse.de>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
ab1b55e21f6977e420341727e9f4a50691057b5e 03-Mar-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] powerpc: incorrect rmo_top handling in prom_init

On Thu, 2006-03-02 at 19:55 +0100, Olaf Hering wrote:

> My iBook1 has 2 memory regions in reg. Depending on how I boot it
> (vmlinux+initrd) or zImage.initrd, it will not boot with current Linus
> tree.
> rmo_top should be 160MB instead of 32MB.

On logically-partitioned machines the first element of the reg
property in the memory node is defined to be the "RMO" region,
i.e. the memory that the processor can access in real mode. On other
machines the first element has no special meaning, so only take it to
be the RMO region on LPAR machines.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
f1870f772c5e884862b4dd8f1ec2147247dda0ef 13-Feb-2006 Anton Blanchard <anton@samba.org> [PATCH] powerpc64: remove broken/bitrotted HMT support

HMT support is currently broken and needs to be reworked to play nicely
with the SMT scheduler. Remove the bit rotten bits for the time being.

I also updated an incorrect comment, we enter __secondary_hold with the
physical cpu id in r3.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
cdc3ee8f2061bafe7593bab0096a0e711408b0f9 25-Jan-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Refuse to boot a kdump kernel via OF

You can't boot a kdump kernel via OF, not reliably anyway, the kernel being at
32 MB conflicts with the zImage wrapper etc. and it blows up.

It's trivial to check in prom_init though, and this is early enough that we can
actually drop back to OF where a reset-all will get you going again, which is
kinda nice. I think this should go in for 2.6.16.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
8385a6a3acfbb4b68150c25cfe9084b6c4f501cf 14-Jan-2006 Haren Myneni <haren@us.ibm.com> [PATCH] powerpc: Fix kdump copy regs and dynamic allocate per-cpu crash notes

- This contains the arch specific changes for the following the
kdump generic fixes which were already accepted in the upstream.
. Capturing CPU registers (for the case of 'panic' and invoking
the dump using 'sysrq-trigger') from a function (stack frame) which will
be not be available during the kdump boot. Hence, might result in
invalid stack trace.
. Dynamically allocating per cpu ELF notes section instead of
statically for NR_CPUS.

- Fix the compiler warning in prom_init.c.

Signed-off-by: Haren Myneni <haren@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
cbbcf3401173f11f7e4c03c7ec8955ea29cd83b5 12-Jan-2006 Kumar Gala <galak@gate.crashing.org> [PATCH] powerpc: Fixed memory reserve map layout

powerpc: Fixed memory reserve map layout

The memory reserve map is suppose to be a pair of 64-bit integers
to represent each region. On ppc32 the code was treating the
pair as two 32-bit integers. Additional the prom_init code was
producing the wrong layout on ppc32.

Added a simple check to try to provide backwards compatibility.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
cc5d0189b9ba95260857a5018a1c2fef90008507 13-Dec-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] powerpc: Remove device_node addrs/n_addr

The pre-parsed addrs/n_addrs fields in struct device_node are finally
gone. Remove the dodgy heuristics that did that parsing at boot and
remove the fields themselves since we now have a good replacement with
the new OF parsing code. This patch also fixes a bunch of drivers to use
the new code instead, so that at least pmac32, pseries, iseries and g5
defconfigs build.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
dad482c25698134b79c80694c81f0495019e0842 06-Dec-2005 Arnd Bergmann <arnd@arndb.de> [PATCH] cell: add platform detection code

I can't really get a conclusive answer from the firmware
people what to check for, so I just try scanning for
anything that starts with "IBM,CPB", which should be
correct for all hardware produced so far and for
systemsim.

Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
dcee30361d25ea83499a99f921f9a56b4a1a79e7 04-Dec-2005 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Parse crashkernel= parameter in first kernel

This patch adds code to parse and setup the crash kernel resource in the
first kernel. PPC64 ignores the @x part, we always run at 32 MB.

Signed-off-by: Haren Myneni <haren@us.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
51fae6de24da57bc6cdaa1b253595c3513ecbf2d 04-Dec-2005 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Add a is_kernel_addr() macro

There's a bunch of code that compares an address with KERNELBASE to see if
it's a "kernel address", ie. >= KERNELBASE. The proper test is actually to
compare with PAGE_OFFSET, since we're going to change KERNELBASE soon.

So replace all of them with an is_kernel_addr() macro that does that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
ed1189b7e8cd8144f0b232c220aed4ee26d89463 29-Nov-2005 Olaf Hering <olh@suse.de> [PATCH] powerpc: prevent stack corruption in call_prom_ret

Use the correct pointer to clear the memory of the return values,
to prevent stack corruption in the callers stackframe.

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
799d6046d3fb557006e6d7c9767fdb96479b0e0a 10-Nov-2005 Paul Mackerras <paulus@samba.org> [PATCH] powerpc: merge code values for identifying platforms

This patch merges platform codes. systemcfg->platform is no longer used,
systemcfg use in general is deprecated as much as possible (and renamed
_systemcfg before it gets completely moved elsewhere in a future patch),
_machine is now used on ppc64 along as ppc32. Platform codes aren't gone
yet but we are getting a step closer. A bunch of asm code in head[_64].S
is also turned into C code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
a23414beb6607dfd40d3245f7df9dd97a4e2c82b 09-Nov-2005 Paul Mackerras <paulus@samba.org> ppc/powerpc: workarounds for old Open Firmware versions

This adds code to work around some problems with old versions of
Open Firmware, such as on the early powermacs (7500 etc.) and the
"Longtrail" CHRP machine. On these machines we have to claim
the physical and virtual address ranges explicitly when claiming
memory and then set up a V->P mapping.

The Longtrail has more problems: setprop doesn't work, and we have
to set an "allow-reclaim" variable to 0 in order to get claim on
physical memory ranges to fail if the memory is already claimed.

Signed-off-by: Paul Mackerras <paulus@samba.org>
3825ac0ee66b50cb0208ee74796fe65f3040e67c 08-Nov-2005 Paul Mackerras <paulus@samba.org> powerpc: Fix crash in early boot on some powermacs

Some powermac machines were crashing in the quiesce firmware call
in prom_init.c because we have just closed the OF stdin device;
notably my 1999 G3 powerbook does this. To avoid this, don't
close the OF stdin device on powermacs.

Signed-off-by: Paul Mackerras <paulus@samba.org>
21fe3301f11a93c4f18e8480ed08522559bf0a50 07-Nov-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] ppc: fix a bunch of warnings

Building a PowerMac kernel with ARCH=powerpc causes a bunch of warnings,
this fixes some of them

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
7d49697ef92bd2cf84ab53bd4cea82fefb197fb9 07-Nov-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] ppc64: More U3 device-tree fixes

Some more U3 revisions have the missing "interrupts" property in U3,
this adds them to the fixup code in prom_init.c

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
f3f66f599db131ea57dc567ffd931d269dbc690e 01-Nov-2005 Arnd Bergmann <arndb@de.ibm.com> [PATCH] powerpc: Rename BPA to Cell

The official name for BPA is now CBEA (Cell Broadband
Engine Architecture). This patch renames all occurences
of the term BPA to 'Cell' for easier recognition.

Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e37bc5df8e96c72f27ec3579499726b656e4e641 24-Oct-2005 David Gibson <david@gibson.dropbear.id.au> [PATCH] powerpc: Purge bootinfo.h

With ARCH=powerpc we assume the presence of a device tree, so we don't
require any support for the old bi_recs method of passing boot
parameters. Likewise, we've never needed it for ppc64, but we still
had an include/asm-ppc64/bootinfo.h from which nothing was used. This
patch removes that file, and all references to it in arch/ppc64 and
arch/powerpc. A related, unused variable 'boot_mem_size' is also
removed from setup_32.c. The bootinfo stuff remains in ARCH=ppc for
the time being.

Built and booted on Power5 (ARCH=ppc64 and ARCH=powerpc), built for
32-bit powermac (ARCH=powerpc and ARCH=ppc).

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
c49888203d7a316cb947bb8a1cf2ae191f28bcd3 26-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Fixes to get the Longtrail CHRP a bit further

Talk about buggy firmware... the OF on the Longtrail returns 0
from the claim client service rather than -1 when the claim fails.
It also has no device_type on the /memory node and blows up if
the output buffer for package-to-path is too big.

This also fixes a bug with calling alloc_up with align == 0, where
we did _ALIGN_UP(alloc_bottom, 0) which will end up as 0.

Lastly, we now check the return value (in r3) from calling the
prom, and return -1 from call_prom if we get a negative value back.
That is supposed to indicate that the requested client service
doesn't exist.

Signed-off-by: Paul Mackerras <paulus@samba.org>
bbd0abda9cc689a54df509aae00000bbb2a1a7d1 26-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Merge 32-bit CHRP support.

SMP still needs more work but UP gets as far as starting userspace
at least. This uses the 64-bit-style code for spinning up the cpus.

Signed-off-by: Paul Mackerras <paulus@samba.org>
a575b807172ca7d8850e6e979c8e83d4258e8c43 23-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Run on old powermacs.

Old powermacs have a number of differences from current machines:
- there is no interrupt tree in the device tree, just interrupt
or AAPL,interrupt properties
- the chosen node in the device tree is called /chosen@0
- the OF claim method doesn't map the memory, so we have to do
an explicit map call as well
- there is no /chosen/cpu property on SMP machines
- the NVRAM isn't structured as a set of partitions.

This adapts the merged powermac support code to cope with these
issues.

Signed-off-by: Paul Mackerras <paulus@samba.org>
35499c0195e46f479cf6ac16ad8d3f394b5fcc10 22-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Merge in 64-bit powermac support.

This brings in a lot of changes from arch/ppc64/kernel/pmac_*.c to
arch/powerpc/platforms/powermac/*.c and makes various minor tweaks
elsewhere. On the powermac we now initialize ppc_md by copying
the whole pmac_md structure into it, which required some changes in
the ordering of initializations of individual fields of it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
55d363397f1bdfa4fe861f0e2fadb058c79dafea 13-Oct-2005 David Gibson <david@gibson.dropbear.id.au> [PATCH] powerpc: Another maple merge tree fix

With ARCH=powerpc, a spurious ifdef in prom_init prevented the
seconday hold loop being correctly copied down on Maple. With this
patch, Maple boots with ARCH=powerpc

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
30cd4a4e9c25e154ba087848a839bd0c6d024092 17-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Initialize btext subsystem later, after prom_init

We were initializing the btext stuff from prom_init(), thus breaking
the rule that all communication between prom_init() and the rest of
the kernel has to be via the flattened device tree. This removes
the btext initialization calls from prom_init() and initializes it
instead after the device tree is unflattened. It would be nice to
do it earlier, but that needs some more infrastructure to find the
properties we need in the flattened device tree.

Signed-off-by: Paul Mackerras <paulus@samba.org>
c5200c90db3823a6e2f529acf202c4aed04966ae 10-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Fix off-by-one error in prom_init.c

This was preventing us from recognizing that we did actually
instantiate RTAS successfully on pSeries.

Signed-off-by: Paul Mackerras <paulus@samba.org>
5a408329ed19cf2a80e831d28cbd93d2e36155a6 10-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Fix bug caused by negation of 64-bit reloc_offset value

Although both ppc32 and ppc64 have a reloc_offset function, the ppc64
one produced the opposite sign to the ppc32 one. This standardizes
on the ppc32 sign and fixes the merged 64-bit code to account for that.

Signed-off-by: Paul Mackerras <paulus@samba.org>
b42b661745c8d78cd3483752fb22cc7420c67f74 10-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Make prom_init.c suitable for both 32-bit and 64-bit

Signed-off-by: Paul Mackerras <paulus@samba.org>
9b6b563c0d2d25ecc3111916031aa7255543fbfb 05-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Merge in the ppc64 version of the prom code.

This brings in the ppc64 version of prom_init.c, prom.c and btext.c
and makes them work for ppc32. This also brings in the new calling
convention, where the first entry to the kernel (with r5 != 0) goes
to the prom_init code, which then restarts from the beginning (with
r5 == 0) after it has done its stuff.

For now this also brings in the ppc32 version of setup.c. It also
merges lmb.h.

Signed-off-by: Paul Mackerras <paulus@samba.org>