History log of /arch/powerpc/kernel/prom.c
Revision Date Author Comments
3e47d1474c2b4099f0fadd12a6553fdb2e8feaae 17-Sep-2014 Anton Blanchard <anton@samba.org> powerpc: Remove powerpc specific cmd_line

There is no need for yet another copy of the command line, just
use boot_command_line like everyone else.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
ad72a279a2b874828d1b5070ef01cf6ee6b1d62c 28-Aug-2014 Michael Ellerman <mpe@ellerman.id.au> powerpc: Check flat device tree version at boot

In commit e6a6928c3ea1 "of/fdt: Convert FDT functions to use libfdt",
the kernel stopped supporting old flat device tree formats. The minimum
supported version is now 0x10.

There was a checking function added, early_init_dt_verify(), but it's
not called on powerpc.

The result is, if you boot with an old flat device tree, the kernel will
fail to parse it correctly, think you have no memory etc. and hilarity
ensues.

We can't really fix it, but we can at least catch the fact that the
device tree is in an unsupported format and panic(). We can't call
BUG(), it's too early.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
e51df2c170efaeadce4d416e1825b0830de0a795 20-Aug-2014 Anton Blanchard <anton@samba.org> powerpc: Make a bunch of things static

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
e16c8765533a155ebd3d7c36fc80440a03bbf46a 08-Dec-2011 Andy Fleming <afleming@freescale.com> powerpc/e6500: Add support for hardware threads

The general idea is that each core will release all of its
threads into the secondary thread startup code, which will
eventually wait in the secondary core holding area, for the
appropriate bit in the PACA to be set. The kick_cpu function
pointer will set that bit in the PACA, and thus "release"
the core/thread to boot. We also need to do a few things that
U-Boot normally does for CPUs (like enable branch prediction).

Signed-off-by: Andy Fleming <afleming@freescale.com>
[scottwood@freescale.com: various changes, including only enabling
threads if Linux wants to kick them]
Signed-off-by: Scott Wood <scottwood@freescale.com>
13b3d13b813ab834fac67dc05f8b86dbcc29c134 09-Jul-2014 Michael Ellerman <mpe@ellerman.id.au> powerpc: Remove MMU_FTR_SLB

We now only support cpus that use an SLB, so we don't need an MMU
feature to indicate that.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
a25095d451ece23b1fef34474f3230100db7aa05 16-Jul-2014 Grant Likely <grant.likely@linaro.org> of: Move dynamic node fixups out of powerpc and into common code

PowerPC does an odd thing with dynamic nodes. It uses a notifier to
catch new node additions and set some of the values like name and type.
This makes no sense since that same code can be put directly into
of_attach_node(). Besides, all dynamic node users need this, not just
powerpc. Fix this problem by moving the logic out of arch/powerpc and
into drivers/of/dynamic.c.

It is also important to remove this notifier because we want to move the
firing of notifiers from before the tree is modified to after so that
the receiver gets a consistent view of the tree, but that is
incompatible with notifiers that modify the node.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Nathan Fontenot <nfont@austin.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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>
060f78c2543a890626cab81796b0d6f7070bd989 31-Mar-2014 Rob Herring <robh@kernel.org> powerpc: use libfdt accessors for header data

With libfdt support, we can take advantage of helper accessors in libfdt
for accessing the FDT header data. This makes the code more readable and
makes the FDT blob structure more opaque to the kernel. This also
prepares for removing struct boot_param_header completely.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
d1552ce449eb0a8d2f0bd6599da3a8a3d7f77a84 02-Apr-2014 Rob Herring <robh@kernel.org> of/fdt: move memreserve and dtb memory reservations into core

Move the /memreserve/ processing and dtb memory reservations into
early_init_fdt_scan_reserved_mem. This converts arm, arm64, and powerpc
as they are the only users of early_init_fdt_scan_reserved_mem.

memblock_reserve is safe to call on the same region twice, so the
reservation check for the dtb in powerpc 32-bit reservations is safe to
remove.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
b0a6fb36a49f720c93c3da0b3f040e49e42435ad 02-Apr-2014 Rob Herring <robh@kernel.org> of/fdt: create common debugfs

Both powerpc and microblaze have the same FDT blob in debugfs feature.
Move this to common location and remove the powerpc and microblaze
implementations. This feature could become more useful when FDT
overlay support is added.

This changes the path of the blob from "$arch/flat-device-tree" to
"device-tree/flat-device-tree".

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 02-Apr-2014 Rob Herring <robh@kernel.org> of/fdt: update of_get_flat_dt_prop in prep for libfdt

Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop
call in preparation to convert FDT code to use libfdt. Make the return
value const and the property length ptr type an int.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
edba274cdeaa84e2cf8a9a34fe7583b0e01edbab 29-Apr-2014 Rob Herring <robh@kernel.org> powerpc: fix skipping call to early_init_fdt_scan_reserved_mem

The call to early_init_fdt_scan_reserved_mem will be skipped if
reserved-ranges is not found. Move the call earlier so that it is called
unconditionally.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Tested-by: Stephen Chivers <schivers@csc.com>
7222f779acf94a123557c7bbbfbcc19424589f52 28-Mar-2014 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/prom: early_init_dt_scan_cpus() updates cpu features only once

All our cpu feature updates were done for every CPU in the device-tree,
thus overwriting the cputable bits over and over again. Instead do them
only for the boot CPU.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
36ae37e3436b0c7731ae15a03d9215ff24bef9f2 28-Mar-2014 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Make boot_cpuid common between 32 and 64-bit

Move the definition to setup-common.c and set the init value
to -1 on both 32 and 64-bit (it was 0 on 64-bit).

Additionally add a check to prom.c to garantee that the init
value has been udpated after the DT scan.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
4a85b31d369b496c316d89b144ee9626073e5ef2 28-Mar-2014 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Adjust CPU_FTR_SMT on all platforms

For historical reasons that code was under #ifdef CONFIG_PPC_PSERIES
but it applies equally to all 64-bit platforms.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
708b7eef12f945a510ba5ac3b4007d7ae4796d55 28-Feb-2014 Marek Szyprowski <m.szyprowski@samsung.com> powerpc: add support for reserved memory defined by device tree

Enable reserved memory initialization from device tree.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
55672ecfa21f23616541c50e0e687f14f9ecf165 16-Dec-2013 Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> powerpc/book3s: Recover from MC in sapphire on SCOM read via MMIO.

Detect and recover from machine check when inside opal on a special
scom load instructions. On specific SCOM read via MMIO we may get a machine
check exception with SRR0 pointing inside opal. To recover from MC
in this scenario, get a recovery instruction address and return to it from
MC.

OPAL will export the machine check recoverable ranges through
device tree node mcheck-recoverable-ranges under ibm,opal:

# hexdump /proc/device-tree/ibm,opal/mcheck-recoverable-ranges
0000000 0000 0000 3000 2804 0000 000c 0000 0000
0000010 3000 2814 0000 0000 3000 27f0 0000 000c
0000020 0000 0000 3000 2814 xxxx xxxx xxxx xxxx
0000030 llll llll yyyy yyyy yyyy yyyy
...
...
#

where:
xxxx xxxx xxxx xxxx = Starting instruction address
llll llll = Length of the address range.
yyyy yyyy yyyy yyyy = recovery address

Each recoverable address range entry is (start address, len,
recovery address), 2 cells each for start and recovery address, 1 cell for
len, totalling 5 cells per entry. During kernel boot time, build up the
recovery table with the list of recovery ranges from device-tree node which
will be used during machine check exception to recover from MMIO SCOM UE.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
b27652dd2174df1a7e0a7c5f00d1c8e3ed9287a7 24-Dec-2013 Kevin Hao <haokexin@gmail.com> powerpc: introduce early_get_first_memblock_info

For a relocatable kernel since it can be loaded at any place, there
is no any relation between the kernel start addr and the memstart_addr.
So we can't calculate the memstart_addr from kernel start addr. And
also we can't wait to do the relocation after we get the real
memstart_addr from device tree because it is so late. So introduce
a new function we can use to get the first memblock address and size
in a very early stage (before machine_init).

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
3eb906c6b6c123513718e7742a96a4189f900382 20-Nov-2013 Michael Ellerman <mpe@ellerman.id.au> powerpc: Make cpu_to_chip_id() available when SMP=n

Up until now we have only used cpu_to_chip_id() in the topology code,
which is only used on SMP builds. However my recent commit a4da0d5
"Implement arch_get_random_long/int() for powernv" added a usage when
SMP=n, breaking the build.

Move cpu_to_chip_id() into prom.c so it is available for SMP=n builds.

We would move the extern to prom.h, but that breaks the include in
topology.h. Instead we leave it in smp.h, but move it out of the
CONFIG_SMP #ifdef. We also need to include asm/smp.h in rng.c, because
the linux version skips asm/smp.h on UP. What a mess.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
a3e31b4588443f37d82195096c6b30dff1c152c2 18-Sep-2013 Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> of: Move definition of of_find_next_cache_node into common code.

Since the definition of_find_next_cache_node is architecture independent,
the existing definition in powerpc can be moved to driver/of/base.c

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
afaf53985431bb295e4b723b08a55d0540cf8070 18-Sep-2013 Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> powerpc: Remove big endianness assumption in of_find_next_cache_node

Currently big endianness of the device tree data is assumed in
of_find_next_cache_node for 'handle' when calling of_find_node_by_phandle.

In preparation to move this function to common code, this patch fixes
the endianness using 'be32_to_cpup'

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
29eb45a9ab4839a1e9cef2bcf369b918c9c4fcad 31-Aug-2013 Rob Herring <rob.herring@calxeda.com> of: remove early_init_dt_setup_initrd_arch

All arches do essentially the same thing now for
early_init_dt_setup_initrd_arch, so it can now be removed.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
a1727da599ad030ccaf4073473fd235c8ee28219 28-Aug-2013 Grant Likely <grant.likely@linaro.org> of: consolidate definition of early_init_dt_alloc_memory_arch()

Most architectures use the same implementation. Collapse the common ones
into a single weak function that can be overridden.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
183912d352a242a276a7877852f107459a13aff9 15-Aug-2013 Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> of: move of_get_cpu_node implementation to DT core library

This patch moves the generalized implementation of of_get_cpu_node from
PowerPC to DT core library, thereby adding support for retrieving cpu
node for a given logical cpu index on any architecture.

The CPU subsystem can now use this function to assign of_node in the
cpu device while registering CPUs.

It is recommended to use these helper function only in pre-SMP/early
initialisation stages to retrieve CPU device node pointers in logical
ordering. Once the cpu devices are registered, it can be retrieved easily
from cpu device of_node which avoids unnecessary parsing and matching.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
819d596568d82ffb85b0b5989a1567810fe66098 15-Aug-2013 Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> powerpc: refactor of_get_cpu_node to support other architectures

Currently different drivers requiring to access cpu device node are
parsing the device tree themselves. Since the ordering in the DT need
not match the logical cpu ordering, the parsing logic needs to consider
that. However, this has resulted in lots of code duplication and in some
cases even incorrect logic.

It's better to consolidate them by adding support for getting cpu
device node for a given logical cpu index in DT core library. However
logical to physical index mapping can be architecture specific.

PowerPC has it's own implementation to get the cpu node for a given
logical index.

This patch refactors the current implementation of of_get_cpu_node.
This in preparation to move the implementation to DT core library.
It separates out the logical to physical mapping so that a default
matching of the physical id to the logical cpu index can be added
when moved to common code. Architecture specific code can override it.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Grant Likely <grant.likely@linaro.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
e91ae5bdc5f4cb77c3505f6e5b464385132ced4f 06-Aug-2013 Alistair Popple <alistair@popple.id.au> powerpc: More little endian fixes for prom.c

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
dc0e643afc505e7feeac5f86e8fe82183847ebe7 06-Aug-2013 Ian Munsie <imunsie@au1.ibm.com> powerpc: Make prom.c device tree accesses endian safe

On PowerPC the device tree is always big endian, but the CPU could be
either, so add be32_to_cpu where appropriate and change the types of
device tree data to __be32 etc to allow sparse to locate endian issues.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
b37193b71846858d816e152d3a5db010d7b73f5e 15-Jul-2013 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Add helper to get ibm,chip-id of a node

This includes walking the parent nodes if necessary.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
374d5c9964c10373ba39bbe934f4262eb87d7114 01-Jul-2013 Santosh Shilimkar <santosh.shilimkar@ti.com> of: Specify initrd location using 64-bit

On some PAE architectures, the entire range of physical memory could reside
outside the 32-bit limit. These systems need the ability to specify the
initrd location using 64-bit numbers.

This patch globally modifies the early_init_dt_setup_initrd_arch() function to
use 64-bit numbers instead of the current unsigned long.

There has been quite a bit of debate about whether to use u64 or phys_addr_t.
It was concluded to stick to u64 to be consistent with rest of the device
tree code. As summarized by Geert, "The address to load the initrd is decided
by the bootloader/user and set at that point later in time. The dtb should not
be tied to the kernel you are booting"

More details on the discussion can be found here:
https://lkml.org/lkml/2013/6/20/690
https://lkml.org/lkml/2012/9/13/544

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
c039e3a8ddd52139d0f81711ecd757772f868b22 02-Jul-2013 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Handle both new style and old style reserve maps

When Jeremy introduced the new device-tree based reserve map, he made
the code in early_reserve_mem_dt() bail out if it found one, thus not
reserving the initrd nor processing the old style map.

I hit problems with variants of kexec that didn't put the initrd in
the new style map either. While these could/will be fixed, I believe
we should be safe here and rather reserve more than not enough.

We could have a firmware passing stuff via the new style map, and
in the middle, a kexec that knows nothing about it and adding other
things to the old style map.

I don't see a big issue with processing both and reserving everything
that needs to be. memblock_reserve() supports overlaps fine these days.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
0962e8004e97409072bb6caee7b3ba948a5fb93a 24-Apr-2013 Jeremy Kerr <jk@ozlabs.org> powerpc/prom: Scan reserved-ranges node for memory reservations

Based on benh's proposal at
https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-September/101237.html,
this change provides support for reserving memory from the
reserved-ranges node at the root of the device tree.

We just call memblock_reserve on these ranges for now.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
0dc3289c797ef9558af566802429212e0b58a5d9 02-Oct-2012 Tony Breeds <tony@bakeyournoodle.com> powerpc: Add asm/debug.h to get powerpc_debugfs_root

Since the "Disintegrate asm/system.h for PowerPC"
(ae3a197e3d0bfe3f4bf1693723e82dc018c096f3) This has been failing when
DEBUG is #defined.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1cf3d8b3d24cd383ddfd5442c83ec5c355ffc2f7 02-Oct-2012 Nathan Fontenot <nfont@linux.vnet.ibm.com> powerpc+of: Add of node/property notification chain for adds and removes

This patch moves the notification chain for updates to the device tree
from the powerpc/pseries code to the base OF code. This makes this
functionality available to all architectures.

Additionally the notification chain is updated to allow notifications
for property add/remove/update. To make this work a pointer to a new
struct (of_prop_reconfig) is passed to the routines in the notification chain.
The of_prop_reconfig property contains a pointer to the node containing the
property and a pointer to the property itself. In the case of property
updates, the property pointer refers to the new property.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
a84fcd46870113e92523e1ebb9a0ec75f66e03a2 21-Aug-2012 Suzuki Poulose <suzuki@in.ibm.com> powerpc: Change memory_limit from phys_addr_t to unsigned long long

There are some device-tree nodes, whose values are of type phys_addr_t.
The phys_addr_t is variable sized based on the CONFIG_PHSY_T_64BIT.

Change these to a fixed unsigned long long for consistency.

This patch does the change only for memory_limit.

The following is a list of such variables which need the change:

1) kernel_end, crashk_size - in arch/powerpc/kernel/machine_kexec.c

2) (struct resource *)crashk_res.start - We could export a local static
variable from machine_kexec.c.

Changing the above values might break the kexec-tools. So, I will
fix kexec-tools first to handle the different sized values and then change
the above.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Suzuki K. Poulose <suzuki@in.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
12d9299241241200e4f34f3b02f206fa8384a923 16-Feb-2012 Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> fadump: Remove the phyp assisted dump code.

Remove the phyp assisted dump implementation which is not is use.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
eb39c8803d0e3d98fe74825f99287f63d55e6460 16-Feb-2012 Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> fadump: Reserve the memory for firmware assisted dump.

Reserve the memory during early boot to preserve CPU state data, HPTE region
and RMA (real mode area) region data in case of kernel crash. At the time of
crash, powerpc firmware will store CPU state data, HPTE region data and move
RMA region data to the reserved memory area.

If the firmware-assisted dump fails to reserve the memory, then fallback
to existing kexec-based kdump.

Most of the code implementation to reserve memory has been
adapted from phyp assisted dump implementation written by Linas Vepstas
and Manish Ahuja

This patch also introduces a config option CONFIG_FA_DUMP for firmware
assisted dump feature on Powerpc (ppc64) architecture.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1aadc0560f46530f8a0f11055285b876a8a31770 08-Dec-2011 Tejun Heo <tj@kernel.org> memblock: s/memblock_analyze()/memblock_allow_resize()/ and update users

The only function of memblock_analyze() is now allowing resize of
memblock region arrays. Rename it to memblock_allow_resize() and
update its users.

* The following users remain the same other than renaming.

arm/mm/init.c::arm_memblock_init()
microblaze/kernel/prom.c::early_init_devtree()
powerpc/kernel/prom.c::early_init_devtree()
openrisc/kernel/prom.c::early_init_devtree()
sh/mm/init.c::paging_init()
sparc/mm/init_64.c::paging_init()
unicore32/mm/init.c::uc32_memblock_init()

* In the following users, analyze was used to update total size which
is no longer necessary.

powerpc/kernel/machine_kexec.c::reserve_crashkernel()
powerpc/kernel/prom.c::early_init_devtree()
powerpc/mm/init_32.c::MMU_init()
powerpc/mm/tlb_nohash.c::__early_init_mmu()
powerpc/platforms/ps3/mm.c::ps3_mm_add_memory()
powerpc/platforms/embedded6xx/wii.c::wii_memory_fixups()
sh/kernel/machine_kexec.c::reserve_crashkernel()

* x86/kernel/e820.c::memblock_x86_fill() was directly setting
memblock_can_resize before populating memblock and calling analyze
afterwards. Call memblock_allow_resize() before start populating.

memblock_can_resize is now static inside memblock.c.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "H. Peter Anvin" <hpa@zytor.com>
6fbef13c4feaf0c5576e2315f4d2999c4b670c88 08-Dec-2011 Tejun Heo <tj@kernel.org> powerpc: Cleanup memblock usage

* early_init_devtree(): Total memory size is aligned to PAGE_SIZE;
however, alignment isn't enforced if memory_limit is explicitly
specified. Simplify the logic and always apply PAGE_SIZE alignment.

* MMU_init(): memblock regions is truncated by directly modifying
memblock.memory.cnt. This is incomplete (reserved array is not
truncated) and unnecessarily low level hindering further memblock
improvments. Use memblock_enforce_memory_limit() instead.

* wii_memory_fixups(): Unnecessarily low level direct manipulation of
memblock regions. The same result can be achieved using properly
abstracted operations. Reimplement using memblock API.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
fe091c208a40299fba40e62292a610fb91e44b4e 08-Dec-2011 Tejun Heo <tj@kernel.org> memblock: Kill memblock_init()

memblock_init() initializes arrays for regions and memblock itself;
however, all these can be done with struct initializers and
memblock_init() can be removed. This patch kills memblock_init() and
initializes memblock with struct initializer.

The only difference is that the first dummy entries don't have .nid
set to MAX_NUMNODES initially. This doesn't cause any behavior
difference.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "H. Peter Anvin" <hpa@zytor.com>
4b16f8e2d6d64249f0ed3ca7fe2a319d0dde2719 23-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com> powerpc: various straight conversions from module.h --> export.h

All these files were including module.h just for the basic
EXPORT_SYMBOL infrastructure. We can shift them off to the
export.h header which is a way smaller footprint and thus
realize some compile time gains.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
ba14f6491768acad5cf50a3c7dc8927b7614d692 16-Sep-2011 Kumar Gala <galak@kernel.crashing.org> powerpc: respect mem= setting for early memory limit setup

For those MMUs that have some form of bolt'd linear mapping (TLB)
required its rare that one ever sets mem= smaller than the size of that
mapping.

However, on Book-E 64 parts the initial linear mapping is quite large
(1G) so its quite reasonable that mem= is set smaller than that.

We need to parse the command line for mem= limit and constrain the
amount of memory we map initially by it if need be.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
14a43e69ed257a1fadadf9fea2c05adb1686419f 19-Sep-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc/powernv: Basic support for OPAL

Add definition of OPAL interfaces along with the wrappers to call
into OPAL runtime and the early device-tree parsing hook to locate
the OPAL runtime firmware.

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>
de2780a3d82372a6bfc7f474905e346c0f26dfa4 21-Jun-2011 Akinobu Mita <akinobu.mita@gmail.com> powerpc/pseries: Improve error code on reconfiguration notifier failure

Reconfiguration notifier call for device node may fail by several reasons,
but it always assumes kmalloc failures.

This enables reconfiguration notifier call chain to get the actual error
code rather than -ENOMEM by converting all reconfiguration notifier calls
to return encapsulate error code with notifier_from_errno().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7ac87abb8166b99584149fcfb2efef5773a078e9 25-May-2011 Matt Evans <matt@ozlabs.org> powerpc: Fix early boot accounting of CPUs

smp_release_cpus() waits for all cpus (including the bootcpu) due to an
off-by-one count on boot_cpu_count (which is all CPUs). This patch replaces
that with spinning_secondaries (which is all secondary CPUs).

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
307cfe715344e15eda12dad3bb14f794115ca823 09-Jun-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Force page alignment for initrd reserved memory

When using 64K pages with a separate cpio rootfs, U-Boot will align
the rootfs on a 4K page boundary. When the memory is reserved, and
subsequent early memblock_alloc is called, it will allocate memory
between the 64K page alignment and reserved memory. When the reserved
memory is subsequently freed, it is done so by pages, causing the
early memblock_alloc requests to be re-used, which in my case, caused
the device-tree to be clobbered.

This patch forces the reserved memory for initrd to be kernel page
aligned, and will move the device tree if it overlaps with the range
extension of initrd. This patch will also consolidate the identical
function free_initrd_mem() from mm/init_32.c, init_64.c to mm/mem.c,
and adds the same range extension when freeing initrd. free_initrd_mem()
is also moved to the __init section.

Many thanks to Milton Miller for his input on this patch.

[BenH: Fixed build without CONFIG_BLK_DEV_INITRD]

Signed-off-by: Dave Carroll <dcarroll@astekcorp.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
208b3a4c196e733b9cec006dc132cfc149b2810a 20-May-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Fix hard CPU IDs detection

commit 9d07bc841c9779b4d7902e417f4e509996ce805d
"powerpc: Properly handshake CPUs going out of boot spin loop"

Would cause a miscalculation of the hard CPU ID. It removes breaking
out of the loop when finding a match with a processor, thus the "i"
used as an index in the intserv array is always incorrect

This broke interrupt on my PowerMac laptop.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
03bf469add176afd8a1a4c493d9f4e0e520db12b 11-May-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Make early memory scan more resilient to out of order nodes

We keep track of the size of the lowest block of memory and call
setup_initial_memory_limit() only after we've parsed them all

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Milton Miller <miltonm@bga.com>
85f60ae4ee817174b0f78928bc7066f28c3551ab 29-Apr-2011 Grant Likely <grant.likely@secretlab.ca> dt/flattree: explicitly pass command line pointer to early_init_dt_scan_chosen

This patch drops the reference to a global 'cmd_line' variable from
early_init_dt_scan_chosen, and instead passes the pointer to the command
line string via the *data argument. Each architecture does something
slightly different with the initial command line, so it makes sense for
the architecture to be able to specify the variable name.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
44ae3ab3358e962039c36ad4ae461ae9fb29596c 06-Apr-2011 Matt Evans <matt@ozlabs.org> powerpc: Free up some CPU feature bits by moving out MMU-related features

Some of the 64bit PPC CPU features are MMU-related, so this patch moves
them to MMU_FTR_ bits. All cpu_has_feature()-style tests are moved to
mmu_has_feature(), and seven feature bits are freed as a result.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9d07bc841c9779b4d7902e417f4e509996ce805d 16-Mar-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Properly handshake CPUs going out of boot spin loop

We need to wait a bit for them to have done their CPU setup
or we might end up with translation and EE on with different
LPCR values between threads

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
6dd227002972be910c6191f38f8641e01796557f 27-Jan-2011 Scott Wood <scottwood@freescale.com> powerpc: Fix memory limits when starting at a non-zero address

memblock_enforce_memory_limit() takes the desired maximum quantity of memory
to end up with, not an address above which memory will not be used.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
672c54466d24994eb9633f993862c89539504a42 13-Jan-2011 Grant Likely <grant.likely@secretlab.ca> dt/flattree: Return virtual address from early_init_dt_alloc_memory_arch()

The physical address is never used by the device tree code when
allocating memory for unflattening. Change the architecture's alloc
hook to return the virutal address instead.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
32c97689c46b272302053778f1a6c2facb0e220c 20-Oct-2010 Grant Likely <grant.likely@secretlab.ca> of/flattree: Eliminate need to provide early_init_dt_scan_chosen_arch

This patch refactors the early init parsing of the chosen node so that
architectures aren't forced to provide an empty implementation of
early_init_dt_scan_chosen_arch. Instead, if an architecture wants to
do something different, it can either use a wrapper function around
early_init_dt_scan_chosen(), or it can replace it altogether.

This patch was written in preparation to adding device tree support to
both x86 ad MIPS.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: David Daney <ddaney@caviumnetworks.com>
cd3db0c4ca3d237e7ad20f7107216e575705d2b0 07-Jul-2010 Benjamin Herrenschmidt <benh@kernel.crashing.org> memblock: Remove rmo_size, burry it in arch/powerpc where it belongs

The RMA (RMO is a misnomer) is a concept specific to ppc64 (in fact
server ppc64 though I hijack it on embedded ppc64 for similar purposes)
and represents the area of memory that can be accessed in real mode
(aka with MMU off), or on embedded, from the exception vectors (which
is bolted in the TLB) which pretty much boils down to the same thing.

We take that out of the generic MEMBLOCK data structure and move it into
arch/powerpc where it belongs, renaming it to "RMA" while at it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
e63075a3c9377536d085bc013cd3fe6323162449 07-Jul-2010 Benjamin Herrenschmidt <benh@kernel.crashing.org> memblock: Introduce default allocation limit and use it to replace explicit ones

This introduce memblock.current_limit which is used to limit allocations
from memblock_alloc() or memblock_alloc_base(..., MEMBLOCK_ALLOC_ACCESSIBLE).

The old MEMBLOCK_ALLOC_ANYWHERE changes value from 0 to ~(u64)0 and can still
be used with memblock_alloc_base() to allocate really anywhere.

It is -no-longer- cropped to MEMBLOCK_REAL_LIMIT which disappears.

Note to archs: I'm leaving the default limit to MEMBLOCK_ALLOC_ANYWHERE. I
strongly recommend that you ensure that you set an appropriate limit
during boot in order to guarantee that an memblock_alloc() at any time
results in something that is accessible with a simple __va().

The reason is that a subsequent patch will introduce the ability for
the array to resize itself by reallocating itself. The MEMBLOCK core will
honor the current limit when performing those allocations.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
3fdfd99051fbc210464378cd44a4b8914282bac3 23-Jul-2010 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Fix erroneous lmb->memblock conversions

Oooops... we missed these. We incorrectly converted strings
used when parsing the device-tree on pseries, thus breaking
access to drconf memory and hotplug memory.

While at it, also revert some variable names that represent
something the FW calls "lmb" and thus don't need to be converted
to "memblock".

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
95f72d1ed41a66f1c1c29c24d479de81a0bea36f 12-Jul-2010 Yinghai Lu <yinghai@kernel.org> lmb: rename to memblock

via following scripts

FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')

sed -i \
-e 's/lmb/memblock/g' \
-e 's/LMB/MEMBLOCK/g' \
$FILES

for N in $(find . -name lmb.[ch]); do
M=$(echo $N | sed 's/lmb/memblock/g')
mv $N $M
done

and remove some wrong change like lmbench and dlmb etc.

also move memblock.c from lib/ to mm/

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1426d5a3bd07589534286375998c0c8c6fdc5260 28-Jan-2010 Michael Ellerman <michael@ellerman.id.au> powerpc: Dynamically allocate pacas

On 64-bit kernels we currently have a 512 byte struct paca_struct for
each cpu (usually just called "the paca"). Currently they are statically
allocated, which means a kernel built for a large number of cpus will
waste a lot of space if it's booted on a machine with few cpus.

We can avoid that by only allocating the number of pacas we need at
boot. However this is complicated by the fact that we need to access
the paca before we know how many cpus there are in the system.

The solution is to dynamically allocate enough space for NR_CPUS pacas,
but then later in boot when we know how many cpus we have, we free any
unused pacas.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fc0bdae49d810e4cb32d7b547bc6d4dfb08f9e2e 14-Feb-2010 Grant Likely <grant.likely@secretlab.ca> of: move definition of of_chosen into common code.

Rather than defining of_chosen in each arch, it can be defined for all
in driver/of/base.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michal Simek <monstr@monstr.eu>
22d5579e66101162fd1119f2e7f4f999ca8b48c7 14-Feb-2010 Grant Likely <grant.likely@secretlab.ca> of: remove unused extern reference to devtree_lock

Neither the powerpc nor the microblaze code use devtree_lock anymore.
Remove the extern reference.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michal Simek <monstr@monstr.eu>
4ef7b373df330bc0ff037dc4792d373c9346375f 14-Feb-2010 Jeremy Kerr <jeremy.kerr@canonical.com> of/flattree: Don't assume HAVE_LMB

We don't always have lmb available, so make arches provide an
early_init_dt_alloc_memory_arch() to handle the allocation of
memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michal Simek <monstr@monstr.eu>
087f79c48c090a2c0cd9ee45231d63290d2036d2 30-Jan-2010 Jeremy Kerr <jeremy.kerr@canonical.com> of/flattree: endian-convert members of boot_param_header

The boot_param_header has big-endian fields, so change the types to
__be32, and perform endian conversion when we access them.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
1406bc2f57787797d1f6a3675c019a7093769275 30-Jan-2010 Jeremy Kerr <jeremy.kerr@canonical.com> of/flattree: use callback to setup initrd from /chosen

At present, the fdt code sets the kernel-wide initrd_start and
initrd_end variables when parsing /chosen. On ARM, we only set these
once the bootmem has been reserved.

This change adds an arch hook to setup the initrd from the device
tree:

void early_init_dt_setup_initrd_arch(unsigned long start,
unsigned long end);

The arch-specific code can then setup the initrd however it likes.

Compiled on powerpc, with CONFIG_BLK_DEV_INITRD=y and =n.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
51975db0b7333cf389b64b5040c2a910341d241a 02-Feb-2010 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge early_init_dt_scan_memory() common code

Merge common code between PowerPC and Microblaze architectures.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Michal Simek <monstr@monstr.eu>
89751a7cb70a20f0d604dd7c4be29dd7b0011718 02-Feb-2010 Jeremy Kerr <jeremy.kerr@canonical.com> of: merge of_find_node_by_phandle

Merge common function between powerpc, sparc and microblaze. Code is
identical for powerpc and microblaze, but adds a lock (and release) of
the devtree_lock on sparc.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
fcdeb7fedf89f4bbc2e11959794968080cd8426e 29-Jan-2010 Grant Likely <grant.likely@secretlab.ca> of: merge of_attach_node() & of_detach_node()

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
6016a363f6b56b46b24655bcfc0499b715851cf3 28-Jan-2010 Grant Likely <grant.likely@secretlab.ca> of: unify phandle name in struct device_node

In struct device_node, the phandle is named 'linux_phandle' for PowerPC
and MicroBlaze, and 'node' for SPARC. There is no good reason for the
difference, it is just an artifact of the code diverging over a couple
of years. This patch renames both to simply .phandle.

Note: the .node also existed in PowerPC/MicroBlaze, but the only user
seems to be arch/powerpc/platforms/powermac/pfunc_core.c. It doesn't
look like the assignment between .linux_phandle and .node is
significantly different enough to warrant the separate code paths
unless ibm,phandle properties actually appear in Apple device trees.

I think it is safe to eliminate the old .node property and use
phandle everywhere.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
923f7e30b480438f1e86e01e5cde814248b59a39 28-Jan-2010 Grant Likely <grant.likely@secretlab.ca> of: Merge of_node_get() and of_node_put()

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1f43cfb9474d1c4f22598b6e3213ec035be6dd56 28-Jan-2010 Grant Likely <grant.likely@secretlab.ca> of: merge machine_is_compatible()

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
86e032213424958b45564d0cc96b3316641a49d3 11-Dec-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge early_init_dt_scan_chosen()

Merge common code between PowerPC and Microblaze. This patch
splits the arch-specific stuff out into a new function,
early_init_dt_scan_chosen_arch().

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
0f0b56c3f2df4a083fc9e934266e5bab1710e286 11-Dec-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: eliminate cell_t typedef

A cell is firmly established as a u32. No need to do an ugly typedef
to redefine it to cell_t. Eliminate the unnecessary typedef so that
it doesn't have to be added to the of_fdt header file

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
83f7a06eb479e2aeb83536e77a2cb14cc2285e32 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge dt_mem_next_cell

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
f00abd94918c9780f9d2d961fc0e419c11457922 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: Merge earlyinit_dt_scan_root()

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
f7b3a8355ba6cad251297844a0bdd08898ea36e0 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: Merge early_init_dt_check_for_initrd()

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
02af11b03fce3ddb264d7873d7a2e295e697938c 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of: merge prom_{add,remove,modify}_property

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
41f880091c15b039ffcc8b3d831656b81517a6d3 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: Merge unflatten_device_tree

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
bbd33931a08362f78266a4016211a35947b91041 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: Merge unflatten_dt_node

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
00e38efd90f27518ec96b37b1c7773e3ac529966 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: Merge of_flat_dt_is_compatible

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
ca900cfa2944448bdb76e1246f282e59bc65f472 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge of_get_flat_dt_prop

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
819d2819303654c6829d572e698e2d0021c08599 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge of_get_flat_dt_root

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
c8cb7a59842c0b512b44f6f818cdb0b5a3ddc89e 24-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge of_scan_flat_dt

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
e169cfbef46d62e042614ffafa8880eed1d894bb 23-Nov-2009 Grant Likely <grant.likely@secretlab.ca> of/flattree: merge find_flat_dt_string and initial_boot_params

Merge common code between Microblaze and PowerPC.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
e91edcf5a2940bb7f1f316c871dfe9e2aaf9d6d9 15-Oct-2009 Grant Likely <grant.likely@secretlab.ca> of: merge of_find_all_nodes() implementations

Merge common code between Microblaze and PowerPC, and make it available
to Sparc

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
944916858a430a0627e483657d4cfa2cd2dfb4f7 02-Jun-2009 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc: Shield code specific to 64-bit server processors

This is a random collection of added ifdef's around portions of
code that only mak sense on server processors. Using either
CONFIG_PPC_STD_MMU_64 or CONFIG_PPC_BOOK3S as seems appropriate.

This is meant to make the future merging of Book3E 64-bit support
easier.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
49a849652513235a244dfbf5e58c54f796bd1148 08-May-2009 Becky Bruce <beckyb@kernel.crashing.org> powerpc: Allow mem=x cmdline to work with 4G+

We're currently choking on mem=4g (and above) due to memory_limit
being specified as an unsigned long. Make memory_limit
phys_addr_t to fix this.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
059f134f844ec52772353c95693fcb5b86e80193 14-Jan-2009 Michael Ellerman <michael@ellerman.id.au> powerpc: Allow debugging of LMBs with lmb=debug

The lmb debugging can be turned on at boottime with lmb=debug on the
command line. However on powerpc that doesn't work, because we don't
necessarily call lmb_dump_all().

So always call lmb_dump_all() after lmb_analyze(), no output is
generated unless lmb=debug is found on the command line.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
b60c31d85a2a2f1a9c8623f1fb56e2688aa1e2b1 14-Jan-2009 Michael Neuling <mikey@neuling.org> powerpc: Get the number of SLBs from "slb-size" property

The PAPR says that the property for specifying the number of SLBs should
be called "slb-size". We currently only look for "ibm,slb-size" because
this is what firmware actually presents.

This patch makes us look for the "slb-size" property as well and in
preference to the "ibm,slb-size". This should future proof us if
firmware changes to match PAPR.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
63277161312dd42af7dd3968077b272d192dd6ba 06-Jan-2009 Stephen Rothwell <sfr@canb.auug.org.au> powerpc: Remove unnecessary casts

of_get_flat_dt_prop() returns a "void *", so we don't need to cast when
assigning its result to a pointer variable.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
6ca4f7494bde078b2b730e28e4ea1dc36a772f70 26-Nov-2008 Hollis Blanchard <hollisb@us.ibm.com> powerpc: Force memory size to be a multiple of PAGE_SIZE

Ensure that total memory size is page-aligned, because otherwise
mark_bootmem() gets upset.

This error case was triggered by using 64 KiB pages in the kernel
while arch/powerpc/boot/4xx.c arbitrarily reduced the amount of memory
by 4096 (to work around a chip bug that affects the last 256 bytes of
physical memory).

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e523f723d69cde44e10116d7f49b277da0c6702c 10-Dec-2008 Nathan Lynch <ntl@pobox.com> powerpc: Add of_find_next_cache_node()

We have more than one piece of code that looks up cache nodes manually
using the "l2-cache" property. Add a common helper routine which does
this and handles ePAPR's "next-level-cache" property as well as
powermac.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.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>
cf00085d8045cddd80a8aabad97de96fa8131793 29-Aug-2008 Chandru <chandru@in.ibm.com> powerpc: Add support for dynamic reconfiguration memory in kexec/kdump kernels

Kdump kernel needs to use only those memory regions that it is allowed
to use (crashkernel, rtas, tce, etc.). Each of these regions have
their own sizes and are currently added under 'linux,usable-memory'
property under each memory@xxx node of the device tree.

The ibm,dynamic-memory property of ibm,dynamic-reconfiguration-memory
node (on POWER6) now stores in it the representation for most of the
logical memory blocks with the size of each memory block being a
constant (lmb_size). If one or more or part of the above mentioned
regions lie under one of the lmb from ibm,dynamic-memory property,
there is a need to identify those regions within the given lmb.

This makes the kernel recognize a new 'linux,drconf-usable-memory'
property added by kexec-tools. Each entry in this property is of the
form of a count followed by that many (base, size) pairs for the above
mentioned regions. The number of cells in the count value is given by
the #size-cells property of the root node.

Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
b962ce9d26fd6677e6720949642420ceb029a102 25-Jun-2008 Michael Neuling <mikey@neuling.org> powerpc: Add VSX CPU feature

Add a VSX CPU feature. Also add code to detect if VSX is available
from the device tree.

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>
37dd2badcfcec35f5e21a0926968d77a404f03c3 21-Apr-2008 Kumar Gala <galak@kernel.crashing.org> [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero)

Added support to allow an 85xx kernel to be run from a non-zero physical
address (useful for cooperative asymmetric multiprocessing situations and
kdump). The support can be configured at compile time by setting
CONFIG_PAGE_OFFSET, CONFIG_KERNEL_START, and CONFIG_PHYSICAL_START as
desired.

Alternatively, the kernel build can set CONFIG_RELOCATABLE. Setting this
config option causes the kernel to determine at runtime the physical
addresses of CONFIG_PAGE_OFFSET and CONFIG_KERNEL_START. If
CONFIG_RELOCATABLE is set, then CONFIG_PHYSICAL_START has no meaning.
However, CONFIG_PHYSICAL_START will always be used to set the LOAD program
header physical address field in the resulting ELF image.

Currently we are limited to running at a physical address that is a
multiple of 256M. This is due to how we map TLBs to cover
lowmem. This should be fixed to allow 64M or maybe even 16M alignment
in the future. It is considered an error to try and run a kernel at a
non-aligned physical address.

All the magic for this support is accomplished by proper initialization
of the kernel memory subsystem and use of ARCH_PFN_OFFSET.

The use of ARCH_PFN_OFFSET only affects normal memory and not IO mappings.
ioremap uses map_page and isn't affected by ARCH_PFN_OFFSET.

/dev/mem continues to allow access to any physical address in the system
regardless of how CONFIG_PHYSICAL_START is set.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
f4ac7b5eb79ef15819c966b1f6b84bf443949123 09-Apr-2008 Benjamin Herrenschmidt <benh@ozlabs.org> [POWERPC] Fix device-tree locking vs. interrupts

Lockdep found out that we can occasionally take the device-tree
lock for reading from softirq time (from rtas_token called
by the rtas real time clock code called by the NTP code),
while we take it occasionally for writing without masking
interrupts. The combination of those two can thus deadlock.

While some of those cases of interrupt read lock could be fixed
(such as caching the RTAS tokens) I figured that taking the
lock for writing is so rare (device-tree modification) that we
may as well penalize that case and allow reading from interrupts.

Thus, this turns all the writers to take the lock with irqs
masked to avoid the situation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
37ddd5d053c57fee798d72fa9c18660f59a9299b 12-Apr-2008 Manish Ahuja <ahuja@austin.ibm.com> [POWERPC] pseries/phyp dump: Reserve a variable amount of space at boot

This changes the way we calculate how much space to reserve for the
pHyp dump. Currently we reserve 256MB only. With this change, the
code first checks to see if an amount has been specified on the boot
command line with the "phyp_dump_reserve_size" option, and if so, uses
that much.

Otherwise it computes 5% of total ram and rounds it down to a multiple
of 256MB, and uses the larger of that or 256MB.

This is for large systems with a lot of memory (10GB or more). The
aim is to have more space available for the kernel on reboot on
machines with more resources. Although the dump will be collected
pretty fast and the memory released really early on allowing the
machine to have the full memory available, this alleviates any issues
that can be caused by having way too little memory on very very large
systems during those few minutes.

Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
18f032cb51a6de7d9c875e1112650ecf975fee12 28-Mar-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> [POWERPC] move_device_tree() should be __init

WARNING: vmlinux.o(.text+0x1e4c0): Section mismatch in reference from the
function .move_device_tree() to the function .init.text:.lmb_alloc_base()
The function .move_device_tree() references
the function __init .lmb_alloc_base().
This is often because .move_device_tree lacks a __init
annotation or the annotation of .lmb_alloc_base is wrong.

move_device_tree() is called from early_init_devtree() only, which is __init

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
654f596da4a83a8d2734fba26c2a1257533e6d75 22-Mar-2008 Manish Ahuja <ahuja@austin.ibm.com> [POWERPC] pseries: phyp dump: Disable phyp-dump through boot-var

This adds a kernel command line option "phyp_dump", which takes a 0/1
value for disabling/ enabling phyp_dump at boot time. Kdump can use
this on cmdline (phyp_dump=0) to disable phyp-dump during boot when
enabling itself. This will ensure only one dumping mechanism is active
at any given time.

Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
6ac26c8a7eb149dbd669cc6cd9b77ffc9cd0d2fb 22-Mar-2008 Manish Ahuja <ahuja@austin.ibm.com> [POWERPC] pseries: phyp dump: Reserve and release memory

Initial patch for reserving memory in early boot, and freeing it
later. If the previous boot had ended with a crash, the reserved
memory would contain a copy of the crashed kernel data.

Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Linas Vepstas <linasvepstas@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
abe768858a54e96f0b2c0585db397107ed1bd213 15-Feb-2008 Becky Bruce <bgill@freescale.com> [POWERPC] Fix dt_mem_next_cell() to read the full address

dt_mem_next_cell() currently does of_read_ulong(). This does not
allow for the case where #size-cells and/or #address-cells = 2 on a
32-bit system, as it will end up reading 32 bits instead of the
expected 64. Change it to use of_read_number instead and always
return a u64.

Signed-off-by: Becky Bruce <becky.bruce at freescale.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
d9b2b2a277219d4812311d995054ce4f95067725 14-Feb-2008 David S. Miller <davem@davemloft.net> [LIB]: Make PowerPC LMB code generic so sparc64 can use it too.

Signed-off-by: David S. Miller <davem@davemloft.net>
14b3d926a22b89f779229f88ed16a76b6b641b1c 21-Dec-2007 Valentine Barshak <vbarshak@ru.mvista.com> [POWERPC] 4xx: update 440EP(x)/440GR(x) identical PVR issue workaround

Renaming the CPU nodes with generic names put the CPU model in
the "model" property and thus broke the PowerPC 440EP(x)/440GR(x)
identical PVR workaround. The updates it to use the new model property
for CPU identification.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
584f8b71a2e8abdaeb4b6f4fddaf542b61392453 06-Dec-2007 Michael Neuling <mikey@neuling.org> [POWERPC] Use SLB size from the device tree

Currently we hardwire the number of SLBs to 64, but PAPR says we
should use the ibm,slb-size property to obtain the number of SLB
entries. This uses this property instead of assuming 64. If no
property is found, we assume 64 entries as before.

This soft patches the SLB handler, so it shouldn't change performance
at all.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
d1dfc35d3a62122b85ca975b80dcbf4a0da0bebc 25-Oct-2007 Valentine Barshak <vbarshak@ru.mvista.com> [POWERPC] 4xx: Workaround for the 440EP(x)/GR(x) processors identical PVR issue.

PowerPC 440EP(x) 440GR(x) processors have the same PVR values, since
they have identical cores. However, FPU is not supported on GR(x) and
enabling APU instruction broadcast in the CCR0 register (to enable FPU)
may cause unpredictable results. There's no safe way to detect FPU
support at runtime. This patch provides a workarund for the issue.

We use a POWER6 "logical PVR approach". First, we identify all EP(x)
and GR(x) processors as GR(x) ones (which is safe). Then we check
the device tree cpu path. If we have a EP(x) processor entry,
we call identify_cpu again with PVR | 0x8. This bit is always 0
in the real PVR. This way we enable FPU only for 440EP(x).

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
84fdde5af1eca5ff170d1dff7e2681b0a50a9ecb 03-Oct-2007 Paul Mackerras <paulus@samba.org> [POWERPC] Use cache-inhibited large page bit from firmware

Discussions with firmware architects have confirmed that the bit in
the ibm,pa-features property that indicates support for
cache-inhibited large (>= 64kB) page mappings does in fact mean that
the hypervisor allows 64kB mappings to I/O devices.

Thus we can now enable the code that tests that bit and sets our
CPU_FTR_CI_LARGE_PAGE feature bit.

Signed-off-by: Paul Mackerras <paulus@samba.org>
3c607ce2a3213f33b8b6b854b5f7db876021e466 06-Sep-2007 Linas Vepstas <linas@austin.ibm.com> [POWERPC] setup_64.c and prom.c comment cleanup

Grammatical corrections to comments.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
70c6cc37db342d9f970884e12744ab5ee290d4ad 06-Sep-2007 Linas Vepstas <linas@austin.ibm.com> [POWERPC] prom.c whitespace cleanup

Whitespace cleanup: badly indented lines.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
9420dc65ff9e6b67c032286efde823aeb8684670 30-Jul-2007 Jesper Juhl <jesper.juhl@gmail.com> [POWERPC] Clean out a bunch of duplicate includes

This removes several duplicate includes from arch/powerpc/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
34f329db54e8154cf7faf0e7c45e7c16facfbbfe 20-Jul-2007 Segher Boessenkool <segher@kernel.crashing.org> [POWERPC] of_detach_node()'s device node argument cannot be const

...since it modifies it (when it sets the OF_DETACHED flag).

Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
1ef4d4242d9c494c49ae1ae66dc938fce0272816 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> Consolidate of_find_node_by routines

This consolidates the routines of_find_node_by_path, of_find_node_by_name,
of_find_node_by_type and of_find_compatible_device. Again, the comparison
of strings are done differently by Sparc and PowerPC and also these add
read_locks around the iterations.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
d1cd355a5e44dfe993efc0c0458ca9f99a28a9a3 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> Consolidate of_get_next_child

This adds a read_lock around the child/next accesses on Sparc.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
e679c5f445fe142940e0962de9c5c82f10d9357c 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> Consolidate of_get_parent

This requires creating dummy of_node_{get,put} routines for sparc and
sparc64. It also adds a read_lock around the parent accesses.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
581b605a83ec241a2aff8ef780e08b9414c8dfd8 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> Consolidate of_find_property

The only change here is that a readlock is taken while the property list
is being traversed on Sparc where it was not taken previously.

Also, Sparc uses strcasecmp to compare property names while PowerPC
uses strcmp.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
0081cbc3731de8ad4744ba433af51f17bf27eb9c 01-May-2007 Stephen Rothwell <sfr@canb.auug.org.au> Consolidate of_device_is_compatible

The only difference here is that Sparc uses strncmp to match compatibility
names while PowerPC uses strncasecmp.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
97e873e5c8ad8711ce4cca080cff4eb5d21b3aeb 01-May-2007 Stephen Rothwell <sfr@canb.auug.org.au> Start split out of common open firmware code

This creates drivers/of/base.c (depending on CONFIG_OF) and puts
the first trivially common bits from the prom.c files into it.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
1f945a86a8250b66fda47cf1fc8f3daf5d0f8969 09-Jul-2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> [POWERPC] Remove unnecessary #undef printk from prom.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
94a3807c2a547283bb2fb1728609ad51c09d5f79 20-Jun-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Make the debugfs "powerpc" dir globally accessible

The prom.c debugging code creates a "powerpc" directory in debugfs,
which is nice, but doesn't allow any other debugging code to stick things
under "powerpc" in debugfs. So make it global.

While we're there we should make the prom.c debugging code depend on
CONFIG_DEBUG_FS, because it doesn't work otherwise.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
6a281856c02d2291df2f7d9df5bfdee2e7bdd747 19-Jun-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Add a warning to help trackdown device_node refcounting bugs

When the refcount for a device node goes to 0, we call the
destructor - of_node_release(). This should only happen if we've
already detached the node from the device tree.

So add a flag OF_DETACHED which tracks detached-ness, and if we
find ourselves in of_node_release() without it set, issue a
warning and don't free the device_node. To avoid warning
continuously reinitialise the kref to a sane value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
d3b814bb1e8b0c63449a3430196c20cbe24a3e67 19-Jun-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Generalise device_node flag interface

The struct device_node currently has a _flags variable, although
it's only used for one flag - OF_DYNAMIC. Generalise the flag
accessors so we can use them with other flags in future.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
972d17c9dbad378da61baa17f4c3ea6e154b186a 19-Jun-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Check for the root node in of_detach_node()

It's not sensible to call of_detach_node() on the root node,
but we should check for it just to be safe.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
443481050168e98f91737a02b6428c93f1a1c652 16-Jun-2007 Geoff Levand <geoffrey.levand@am.sony.com> [POWERPC] Output params value in early_init_devtree

Add a printout of the params value to early_init_devtree.
This value is handy to have for comparison when debugging the
bootwrapper code.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
5169b8a1659fef9cc093ed3d889a854945a18177 23-May-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Update documentation for of_find_node_by_type()

The documentation for of_find_node_by_type() incorrectly refers to the
"name" parameter - it should be "type".

Also the behaviour when from == NULL is not really documented, fix that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
847f5976f90d5637a86a826c1c594091d08f3156 16-May-2007 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Make sure device node type/name is not NULL on hot-added nodes

Our device-tree unflattening code makes sure the name and type fields
of a device-node are not NULL. However, the code for dynamically
adding devices nodes which is used for pSeries hotplug for example
didn't do it, potentially causing crashes in some code that assume it
can always do things like strcmp on those.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
40472a55461a672c929a092e648f6c5d21c9c310 10-May-2007 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Split initrd logic out of early_init_dt_scan_chosen() to fix warning

If CONFIG_BLK_DEV_INITRD is not defined the prop variable in
early_init_dt_scan_chosen() is unused, causing a compiler warning.

So split the initrd logic into a separate function, allowing us to
declare prop only when we need it.

Built for both cases and booted with an initrd.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
30686ba6d56858657829d3eb524ed73e5dc98d2b 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Remove old interface find_devices

Replace uses with of_find_node_by_name and for_each_node_by_name.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
1658ab66781d918f604c6069c5cf9a94b6f52f84 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Remove old interface find_type_devices

Replaced by of_find_node_by_type.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
8c8dc322486d5394dc981bef9276dd0ce6c8d1ce 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Remove old interface find_path_device

Replaced by of_find_node_by_path.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
112466b4d0036b3244509d01dbbf3c8caec52a23 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Remove find_all_nodes

This old interface has no more users.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
4bf56e1725a298fb430977cf143ad3a36c91b46a 24-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Remove find_compatible_devices

This is an old interface and is replaced by of_find_compatible_node.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
1a38147ed0737a9c01dbf5f2ca47fd2a0aa5cb55 03-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Make struct property's value a void *

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
9213feea6e197f8507ec855337798cc3388f5570 03-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Rename prom_n_size_cells to of_n_size_cells

This is more consistent and gets us closer to the Sparc code.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
a8bda5dd4f99d6469f3c0dc362db3cce8a4d6416 03-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Rename prom_n_addr_cells to of_n_addr_cells

This is more consistent and gets us closer to the Sparc code.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
7a92f74f98bde8498c98aad6cac5da5a87dd0bf4 03-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Rename device_is_compatible to of_device_is_compatible

This is more consistent and gets us closer to the Sparc code.

We add a device_is_compatible define for compatibility during the
change over.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
0e56efc7dcd1eb5004363e52bdbe801783245638 03-Apr-2007 Stephen Rothwell <sfr@canb.auug.org.au> [POWERPC] Rename get_property to of_get_property

This is more consistent and gets us closer to the Sparc code.

We add a get_property define for compatibility during the change over.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
30437b3e743f33e9b68f813ca24e547aa9fcf7d7 28-Feb-2007 David Gibson <david@gibson.dropbear.id.au> [POWERPC] Automatically lmb_reserve() initrd

At present, when an initrd is passed to the kernel used flat device
tree properties, the memory the initrd occupies must also be reserved
in the flat tree's reserve map, or the kernel may overwrite it. That
makes life more complicated than it could be for the bootwrapper.

This patch makes the kernel automatically reserve the initrd's space.
That in turn requires parsing the initrd parameters earlier than they
are currently, in early_init_dt_scan_chosen() instead of
check_for_initrd().

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
eb6de2863750e696201780283e4c9ada19b4728e 28-Feb-2007 David Gibson <david@gibson.dropbear.id.au> [POWERPC] Allow duplicate lmb_reserve() calls

At present calling lmb_reserve() (and hence lmb_add_region()) twice
for exactly the same memory region will cause strange behaviour.

This makes life difficult when booting from a flat device tree with
memory reserve map. Which regions are automatically reserved by the
kernel has changed over time, so it's quite possible a newer kernel
could attempt to auto-reserve a region which is also explicitly listed
in the device tree's reserve map, leading to trouble.

This patch avoids the problem by making lmb_reserve() ignore a call to
reserve a previously reserved region. It also removes a now redundant
test designed to avoid one specific case of the problem noted above.

At present, this patch deals only with duplicate reservations of an
identical region. Attempting to reserve two different, but
overlapping regions will still cause problems. I might post another
patch later dealing with this case, but I'm avoiding it now since it
is substantially more complicated to deal with, less likely to occur
and more likely to indicate a genuine bug elsewhere if it does occur.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
ae50517ef16bd264c0d68f7b81c143fd9f01a40a 14-Feb-2007 Dave Jones <davej@redhat.com> [POWERPC] Export of_find_property

Without this, building drivers/serial/of_serial.c as a module fails.

WARNING: ".of_find_property" [drivers/serial/of_serial.ko] undefined!

Signed-off-by: Dave Jones <davej@redhat.com>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
b8757b21f7628c57cb20e55be324fdef283a56e9 12-Feb-2007 Alon Bar-Lev <alon.barlev@gmail.com> [PATCH] Dynamic kernel command-line: powerpc

Rename saved_command_line into boot_command_line.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b1374051433cc252540058e8a90107c90fa23eb4 02-Jan-2007 Mariusz Kozlowski <m.kozlowski@tuxland.pl> [POWERPC] arch/ppc/kernel/prom.c of_node_(get|put) cleanup

Remove redundant argument checks for of_node_get() and of_node_put().

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
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>
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>
36ca4ba4b9728f3c420a589a3322c2fbd7ec88b7 24-Oct-2006 Christian Krafft <krafft@de.ibm.com> [POWERPC] cell: add cpufreq driver for Cell BE processor

This patch adds a cpufreq backend driver to enable frequency scaling on cell.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
e2100efb266c9335925191afe79f81f8d0a5807e 20-Oct-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Fix device_is_compatible() const warning

Fix a const'ification related warning with device_is_compatible()
and friends related to get_property() not properly having const
on it's input device node argument.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
c1ce464d29e5bbf5819b2d7527b7d3030a6d65f1 05-Oct-2006 Geoff Levand <geoffrey.levand@am.sony.com> [POWERPC] Minor fix for bootargs property

Avoid the use of an uninitialized stack variable when the powerpc device tree
bootargs property is either missing or incorrectly defined. This also makes
CONFIG_CMDLINE work properly under these conditions. This change adds a test
for the existence of the bootargs property.

early_init_dt_scan_chosen() tests for a zero length bootargs property in its
CONFIG_CMDLINE processing, but the current implementation of
of_get_flat_dt_prop() doesn't assign a value to the length when no property is
found. Since an automatic variable is used, a stale value from the stack will
be used in the test.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
a4dc7ff08915a2035aa6d6decc53fa1deaa410bb 19-Sep-2006 Paul Mackerras <paulus@samba.org> [POWERPC] Define of_read_ulong helper

There are various places where we want to extract an unsigned long
value from a device-tree property that can be 1 or 2 cells in length.
This replaces some open-coded calculations, and one place where we
assumed without checking that properties were the length we wanted,
with a little of_read_ulong() helper.

Signed-off-by: Paul Mackerras <paulus@samba.org>
931b261f442e779b0656d9b04c7ffe4939ef8c0a 12-Jul-2006 Jeremy Kerr <jk@ozlabs.org> [POWERPC] Make get_property() return a const void *

Previous changes have treated the return values of get_property as
const, so now we can make the actual change to get_property(). There
shouldn't be a need to cast the return values anymore.

We will now get compiler warnings when property values are assigned to
a non-const variable.

If properties need to be updated, there's still the of_find_property
function.

Built for cell_defconfig, chrp32_defconfig, g5_defconfig,
iseries_defconfig, maple_defconfig, pmac32_defconfig, ppc64_defconfig
and pseries_defconfig.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
a7f67bdf2c9f24509b8e81e0f35573b611987c80 12-Jul-2006 Jeremy Kerr <jk@ozlabs.org> [POWERPC] Constify & voidify get_property()

Now that get_property() returns a void *, there's no need to cast its
return value. Also, treat the return value as const, so we can
constify get_property later.

powerpc core changes.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
0ebfff1491ef85d41ddf9c633834838be144f69f 03-Jul-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] Add new interrupt mapping core and change platforms to use it

This adds the new irq remapper core and removes the old one. Because
there are some fundamental conflicts with the old code, like the value
of NO_IRQ which I'm now setting to 0 (as per discussions with Linus),
etc..., this commit also changes the relevant platform and driver code
over to use the new remapper (so as not to cause difficulties later
in bisecting).

This patch removes the old pre-parsing of the open firmware interrupt
tree along with all the bogus assumptions it made to try to renumber
interrupts according to the platform. This is all to be handled by the
new code now.

For the pSeries XICS interrupt controller, a single remapper host is
created for the whole machine regardless of how many interrupt
presentation and source controllers are found, and it's set to match
any device node that isn't a 8259. That works fine on pSeries and
avoids having to deal with some of the complexities of split source
controllers vs. presentation controllers in the pSeries device trees.

The powerpc i8259 PIC driver now always requests the legacy interrupt
range. It also has the feature of being able to match any device node
(including NULL) if passed no device node as an input. That will help
porting over platforms with broken device-trees like Pegasos who don't
have a proper interrupt tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
a1af5b2fd49eb24ab8c024da5d853b09841d1f8f 29-Jun-2006 Jeremy Kerr <jk@ozlabs.org> [POWERPC] change get_property to return void *

Change the get_property() function to return a void *. This allows us
to later remove the cast done in the majority of callers.

Built for pseries, iseries, pmac32, cell, cbesim, g5, systemsim, maple,
and mpc* defconfigs

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Acked-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>
339d76c54336443f5050b00172beb675f35e3be0 29-Jun-2006 Paul Mackerras <paulus@samba.org> [POWERPC] Use little-endian bit from firmware ibm,pa-features property

Signed-off-by: Paul Mackerras <paulus@samba.org>
458148c00b97864a27ecf528a1d45a8e5ebd9bbc 23-Jun-2006 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Setup RTAS values earlier, to enable rtas_call() earlier

Althought RTAS is instantiated when we enter the kernel, we can't actually
call into it until we know its entry point address. Currently we grab that
in rtas_initialize(), however that's quite late in the boot sequence.

To enable rtas_call() earlier, we can grab the RTAS entry etc. values while
we're scanning the flattened device tree. There's existing code to retrieve
the values from /chosen, however we don't store them there anymore, so remove
that code.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
7a4571ae553e2972b7958306fd796a2fd24fd7d1 23-Jun-2006 Michael Ellerman <michael@ellerman.id.au> [POWERPC] Export flat device tree via debugfs for debugging

If DEBUG is turned on in prom.c, export the flat device tree via debugfs.
This has been handy on several occasions.

To look at it:
# mount -t debugfs none /sys/kernel/debug
# od -a /sys/kernel/debug/powerpc/flat-device-tree
and/or
# dtc -fI dtb /sys/kernel/debug/powerpc/flat-device-tree -O dts

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
acf7d76827a577059636e949079021e6af6dd702 19-Jun-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> [POWERPC] cell: add RAS support

This is a first version of support for the Cell BE "Reliability,
Availability and Serviceability" features.

It doesn't yet handle some of the RAS interrupts (the ones described in
iic_is/iic_irr), I'm still working on a proper way to expose these. They
are essentially a cascaded controller by themselves (sic !) though I may
just handle them locally to the iic driver. I need also to sync with
David Erb on the way he hooked in the performance monitor interrupt.

So that's all for 2.6.17 and I'll do more work on that with my rework of
the powerpc interrupt layer that I'm hacking on at the moment.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
8a30088794ff426cd3e21557db8f3d2687ac6695 18-Jun-2006 Jon Loeliger <jdl@jdl.com> [POWERPC] Prevent duplicate lmb reservations for Device Tree blob.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
bf72aeba2ffef599d1d386425c9e46b82be657cd 15-Jun-2006 Paul Mackerras <paulus@samba.org> powerpc: Use 64k pages without needing cache-inhibited large pages

Some POWER5+ machines can do 64k hardware pages for normal memory but
not for cache-inhibited pages. This patch lets us use 64k hardware
pages for most user processes on such machines (assuming the kernel
has been configured with CONFIG_PPC_64K_PAGES=y). User processes
start out using 64k pages and get switched to 4k pages if they use any
non-cacheable mappings.

With this, we use 64k pages for the vmalloc region and 4k pages for
the imalloc region. If anything creates a non-cacheable mapping in
the vmalloc region, the vmalloc region will get switched to 4k pages.
I don't know of any driver other than the DRM that would do this,
though, and these machines don't have AGP.

When a region gets switched from 64k pages to 4k pages, we do not have
to clear out all the 64k HPTEs from the hash table immediately. We
use the _PAGE_COMBO bit in the Linux PTE to indicate whether the page
was hashed in as a 64k page or a set of 4k pages. If hash_page is
trying to insert a 4k page for a Linux PTE and it sees that it has
already been inserted as a 64k page, it first invalidates the 64k HPTE
before inserting the 4k HPTE. The hash invalidation routines also use
the _PAGE_COMBO bit, to determine whether to look for a 64k HPTE or a
set of 4k HPTEs to remove. With those two changes, we can tolerate a
mix of 4k and 64k HPTEs in the hash table, and they will all get
removed when the address space is torn down.

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>
473104134b35ce1c3ca77b738c561d6c215adc1b 17-May-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Kdump header cleanup

We need to know the base address of the kdump kernel even when we're not a
kdump kernel, so add a #define for it. Move the logic that sets the kdump
kernelbase into kdump.h instead of page.h.

Rename kdump_setup() to setup_kdump_trampoline() to make it clearer what it's
doing, and add an empty definition for the !CRASH_DUMP case to avoid a

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
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>
846f77b08c8301682ded5ce127c56397327a60d0 17-May-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Parse early parameters earlier

Currently we have call parse_early_param() earliyish, but not really very
early. In particular, it's not early enough to do things like mem=x or
crashkernel=blah, which is annoying.

So do it earlier. I've checked all the early param handlers, and none of them
look like they should have any trouble with this. I haven't tested the
booke_wdt ones though.

On 32-bit we were doing the CONFIG_CMDLINE logic twice, so don't.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
d205819e2346d20fee41297ea6cf789c591abccf 03-May-2006 Paul Mackerras <paulus@samba.org> [PATCH] powerpc: Use the ibm,pa-features property if available

Forthcoming IBM machines will have a "ibm,pa-features" property on CPU
nodes, that contains bits indicating which optional architecture
features are implemented by the CPU. This adds code to use the
property, if present, to update our CPU feature bitmaps. Note that
this means we can both set and clear feature bits based on what
the firmware tells us.

This is based on a patch by Will Schmidt <willschm@us.ibm.com>.

Signed-off-by: Paul Mackerras <paulus@samba.org>
28897731318dc8f63f683eed9091e446916ad706 13-Apr-2006 Olof Johansson <olof@lixom.net> [PATCH] powerpc: Lower threshold for DART enablement to 1GB

Turn on the DART already at 1GB. This is needed because of crippled
devices in some systems, i.e. Airport Extreme cards, only supporting
30-bit DMA addresses.

Otherwise, users with between 1 and 2GB of memory will need to manually
enable it with iommu=force, and that's no good.

Some simple performance tests show that there's a slight impact of
enabling DART, but it's in the 1-3% range (kernel build with disk I/O
as well as over NFS).

iommu=off can still be used for those who don't want to deal with the
overhead (and don't need it for any devices).

Signed-off-by: Olof Johansson <olof@lixom.net>
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>
4d177fbfdadb011f1bac96f9ccba0cc9f21da8de 28-Mar-2006 Stephen Rothwell <sfr@canb.auug.org.au> [PATCH] powerpc: a couple of trivial compile warning fixes

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
10d713aef238b02a774766b2622027361630e28d 28-Mar-2006 Kumar Gala <galak@kernel.crashing.org> powerpc: use memparse() for mem= command line parsing

Use memparse() instead of our own code for handling the parsing of mem=

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
4df20460a3ff0d60280738b094945c56cb5567a5 25-Mar-2006 Anton Blanchard <anton@samba.org> [PATCH] powerpc: Allow non zero boot cpuids

We currently have a hack to flip the boot cpu and its secondary thread
to logical cpuid 0 and 1. This means the logical - physical mapping will
differ depending on which cpu is boot cpu. This is most apparent on
kexec, where we might kexec on any cpu and therefore change the mapping
from boot to boot.

The patch below does a first pass early on to work out the logical cpuid
of the boot thread. We then fix up some paca structures to match.

Ive also removed the boot_cpuid_phys variable for ppc64, to be
consistent we use get_hard_smp_processor_id(boot_cpuid) everywhere.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
329dda083e496bc5ffbb4b1973243bd8a9420e24 24-Feb-2006 Kumar Gala <galak@kernel.crashing.org> [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM

mem= command line option was being ignored in arch/powerpc if we were not
a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The initial
command line extraction and parsing needed to be moved earlier in the boot
process and have code to actual parse mem= and do something about it.

Also, fixed a compile warning in the file.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
d7a5b2ffa1352f0310630934a56aecbdfb617b72 25-Jan-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Always panic if lmb_alloc() fails

Currently most callers of lmb_alloc() don't check if it worked or not, if it
ever does weird bad things will probably happen. The few callers who do check
just panic or BUG_ON.

So make lmb_alloc() panic internally, to catch bugs at the source. The few
callers who did check the result no longer need to.

The only caller that did anything interesting with the return result was
careful_allocation(). For it we create __lmb_alloc_base() which _doesn't_ panic
automatically, a little messy, but passable.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
090db7c86d5df0161135793063e75bc1abddaa6f 04-Feb-2006 Olaf Hering <olh@suse.de> [PATCH] powerpc: remove pointer/integer confusion in of_find_node_by_name

remove pointer/integer confusion

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
b68239ee746760bd99a68692f4c97a28f08a5d01 03-Feb-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Don't overwrite flat device tree with kdump kernel

It's possible for prom_init to allocate the flat device tree inside the
kdump crash kernel region. If this happens, when we load the kdump kernel we
overwrite the flattened device tree, which is bad.

We could make prom_init try and avoid allocating inside the crash kernel
region, but then we run into issues if the crash kernel region uses all the
space inside the RMO. The easiest solution is to move the flat device tree
once we're running in the kernel.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
fa93895329b87112cb1fd784db969e60b5b46af6 25-Jan-2006 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Don't allocate zero bytes in finish_device_tree()

In prom.c we run finish_node() on allnodes twice. The first time we just
calculate how much memory we'll need, the second time we do the actual work.

If the calculation stage determines that we need 0 bytes, then we should skip
the lmb allocation. Although an alloc of zero will work, it has been seen to
lead to a BUG_ON() in reserve_bootmem() on at least one machine.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
ecaa8b0ff326920c8a89d748382e1c1d8812676c 12-Jan-2006 Dave C Boutcher <sleddog@us.ibm.com> [PATCH] powerpc: Add of_find_property function

Add an of_find_property function that returns a struct property
given a property name. Then change the get_property function to
use that routine internally.

Signed-off-by: Dave Boutcher <sleddog@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
088186ded490ced80758200cf8f906ed741df306 12-Jan-2006 Dave C Boutcher <sleddog@us.ibm.com> [PATCH] powerpc: Add/remove/update properties in firmware device tree

Add support for updating and removing device tree
properties. Since we hand out pointers to properties with gay
abandon, we can't just free the property storage. Instead we
move deleted, or the old copy of an updated property, to a
"dead properties" list.

Also note, its not feasable to kref device tree properties.
we call get_property() all over the kernel in a wild variety
of contexts.

One consequence of this change is that we now take a
read_lock(&devtree_lock) when doing get_property().

Signed-off-by: Dave Boutcher <sleddog@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>
943ffb587cfdf3b2adfe52a6db08573f4ecf3284 10-Jan-2006 Adrian Bunk <bunk@stusta.de> spelling: s/retreive/retrieve/

Signed-off-by: Adrian Bunk <bunk@stusta.de>
1beb6a7d6cbed3ac03500ce9b5b9bb632c512039 14-Dec-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] powerpc: Experimental support for new G5 Macs (#2)

This adds some very basic support for the new machines, including the
Quad G5 (tested), and other new dual core based machines and iMac G5
iSight (untested). This is still experimental ! There is no thermal
control yet, there is no proper handing of MSIs, etc.. but it
boots, I have all 4 cores up on my machine. Compared to the previous
version of this patch, this one adds DART IOMMU support for the U4
chipset and thus should work fine on setups with more than 2Gb of RAM.

Signed-off-by: Benjamin Herrenschmidt <benh@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>
ba7594852f4e7121b3f037d59f983637b795f0dd 04-Dec-2005 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Add support for "linux,usable-memory" on memory nodes

Milton has proposed that we should support a "linux,usable-memory" property
on memory nodes which describes, in preference to "reg", the regions of memory
Linux should use.

This facility is required for kdump to inform the second kernel which memory
it should use.

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>
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>
0cc4746cadda16826a1b3214c042a2f75445b71c 04-Dec-2005 Michael Ellerman <michael@ellerman.id.au> [PATCH] powerpc: Reroute interrupts from 0 + offset to PHYSICAL_START + offset

Regardless of where the kernel's linked we always get interrupts at low
addresses. This patch creates a trampoline in the first 3 pages of memory,
where interrupts land, and patches those addresses to jump into the real
kernel code at PHYSICAL_START.

We also need to reserve the trampoline code and a bit more in prom.c

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
1dfc6772097ef4eadd39a10ce44557c782d5058e 14-Nov-2005 Paul Mackerras <paulus@samba.org> powerpc: Export a couple of prom functions

These are needed by the TPM driver, apparently.

Signed-off-by: Paul Mackerras <paulus@samba.org>
49b09853df1a303876b82a6480efb2f7b45ef041 10-Nov-2005 Paul Mackerras <paulus@samba.org> powerpc: Move some extern declarations from C code into headers

This also make klimit have the same type on 32-bit as on 64-bit,
namely unsigned long, and defines and initializes it in one place.

Signed-off-by: Paul Mackerras <paulus@samba.org>
676e2497f87501fb190a5b06103d396ca9147373 10-Nov-2005 Stephen Rothwell <sfr@canb.auug.org.au> powerpc: remove some warnings when building iSeries

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
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>
183d020258dfd08178a05c6793dae10409db8abb 07-Nov-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] ppc64: SMU partition recovery

This patch adds the ability to the SMU driver to recover missing
calibration partitions from the SMU chip itself. It also adds some
dynamic mecanism to /proc/device-tree so that new properties are visible
to userland.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
3c726f8dee6f55e96475574e9f645327e461884c 07-Nov-2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> [PATCH] ppc64: support 64k pages

Adds a new CONFIG_PPC_64K_PAGES which, when enabled, changes the kernel
base page size to 64K. The resulting kernel still boots on any
hardware. On current machines with 4K pages support only, the kernel
will maintain 16 "subpages" for each 64K page transparently.

Note that while real 64K capable HW has been tested, the current patch
will not enable it yet as such hardware is not released yet, and I'm
still verifying with the firmware architects the proper to get the
information from the newer hypervisors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
358c86fda080a5e7c66dcaad3707061f32fff7cc 03-Nov-2005 Michael Ellerman <michael@ellerman.id.au> powerpc: Make early debugging fit on 80 character terminal

There's some debugging in prom.c that wraps nastly on 80 character
terminals, reformat it to fit.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
cf00a8d18b9a1c2d55b2728e89125c234e821db5 31-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Fix bug arising from having multiple memory_limit variables

We had a static memory_limit in prom.c, and then another one defined
in setup_64.c and used in numa.c, which resulted in the kernel crashing
when mem=xxx was given on the command line. This puts the declaration
in system.h and the definition in mem.c. This also moves the
definition of tce_alloc_start/end out of setup_64.c.

Signed-off-by: Paul Mackerras <paulus@samba.org>
80579e1f4a6b5f5dec92faa6c3e0645961c99091 27-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: 32-bit CHRP SMP fixes

Untested, but "should" work... at least this way it compiles.

Signed-off-by: Paul Mackerras <paulus@samba.org>
6d0124fc06be40deafca043c73a8203c78bbfe45 26-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Fix interrupt-tree parsing

The interrupt-tree parsing code wasn't offsetting interrupt numbers
by 16 on 32-bit platforms with an i8259 interrupt controller, and
it was confused about the encoding of interrupt sense and level
(which is different for i8259 and openpic interrupt controllers,
just to make things interesting).

Signed-off-by: Paul Mackerras <paulus@samba.org>
033ef338b6e007dc081c6282a4f2a9dd761f8cd2 26-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Merge rtas.c into arch/powerpc/kernel

This splits arch/ppc64/kernel/rtas.c into arch/powerpc/kernel/rtas.c,
which contains generic RTAS functions useful on any CHRP platform,
and arch/powerpc/platforms/pseries/rtas-fw.[ch], which contain
some pSeries-specific firmware flashing bits. The parts of rtas.c
that are to do with pSeries-specific error logging are protected
by a new CONFIG_RTAS_ERROR_LOGGING symbol. The inclusion of rtas.o
is controlled by the CONFIG_PPC_RTAS symbol, and the relevant
platforms select that.

Signed-off-by: Paul Mackerras <paulus@samba.org>
60dda2565bbf31bbe662fd143a41c861b7a190cf 20-Oct-2005 Kumar Gala <galak@freescale.com> [PATCH] powerpc: some prom.c cleanups

On !CONFIG_PPC_MULTIPLATFORM _machine is defined as 0. This is ok, but
we can't assign a value to _machine then.

We may not have CONFIG_PCI available, so only build in support for
find_parent_pci_resource(), request_OF_resource(), release_OF_resource()
if PCI is enabled. This is probably not the long term fix but works out
for now.

Make reg_property64 contain 64-bit elements on a 32-bit machine.

Mark the deprecated prom.c functions as __deprecated.

Signed-off-by: Kumar K. Gala <kumar.gala@freescale.com>
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>
3eac8c69d1ac1266327f4e29deb23716a12c6d30 12-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Move default hash table size calculation to hash_utils_64.c

We weren't computing the size of the hash table correctly on iSeries
because the relevant code in prom.c was #ifdef CONFIG_PPC_PSERIES.
This moves the code to hash_utils_64.c, makes it unconditional, and
cleans it up a bit.

Signed-off-by: Paul Mackerras <paulus@samba.org>
40ef8cbc6d360e564573eb19582249c35d8ba330 10-Oct-2005 Paul Mackerras <paulus@samba.org> powerpc: Get 64-bit configs to compile with ARCH=powerpc

This is a bunch of mostly small fixes that are needed to get
ARCH=powerpc to compile for 64-bit. This adds setup_64.c from
arch/ppc64/kernel/setup.c and locks.c from arch/ppc64/lib/locks.c.

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>