From 4762713a93fa8706c31b0897c1340e7dc282d8fb Mon Sep 17 00:00:00 2001
From: Michael Ellerman <michael@ellerman.id.au>
Date: Fri, 23 Sep 2005 14:59:04 +1000
Subject: ppc64 iSeries: Call early_setup() on iSeries

Misc steps to incorporate the flat device tree on iSeries.

- define iseries_probe()
- call build_iSeries_Memory_Map() earlier
- return __pa() of the flat device tree from iSeries_early_setup()
- actually call early_setup() for iSeries
- add iseries_md to machdep_calls
- build prom.o for iSeries
- enable /proc/device-tree for iSeries

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/ppc64/Kconfig                |  1 -
 arch/ppc64/kernel/Makefile        |  4 ++--
 arch/ppc64/kernel/head.S          |  1 +
 arch/ppc64/kernel/iSeries_setup.c | 22 +++++++++++++++-------
 arch/ppc64/kernel/setup.c         |  9 ++++-----
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index 32951bfc7f65..246212115a48 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -357,7 +357,6 @@ config HOTPLUG_CPU
 
 config PROC_DEVICETREE
 	bool "Support for Open Firmware device tree in /proc"
-	depends on !PPC_ISERIES
 	help
 	  This option adds a device-tree directory under /proc which contains
 	  an image of the device tree that the kernel copies from Open
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index 813718df4f82..afadb6e4a6dc 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y               :=	setup.o entry.o traps.o irq.o idle.o dma.o \
 			udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \
 			ptrace32.o signal32.o rtc.o init_task.o \
 			lmb.o cputable.o cpu_setup_power4.o idle_power4.o \
-			iommu.o sysfs.o vdso.o pmc.o firmware.o
+			iommu.o sysfs.o vdso.o pmc.o firmware.o prom.o
 obj-y += vdso32/ vdso64/
 
 obj-$(CONFIG_PPC_OF) +=	of_device.o
@@ -27,7 +27,7 @@ obj-$(CONFIG_PPC_ISERIES) += HvCall.o HvLpConfig.o LparData.o \
 			     mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \
 			     iSeries_iommu.o
 
-obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o prom.o
+obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o
 
 obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \
 			     pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index b1d0edff0c04..eb526c480b6c 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -1364,6 +1364,7 @@ _STATIC(__start_initialization_iSeries)
 	addi	r2,r2,0x4000
 
 	bl	.iSeries_early_setup
+	bl	.early_setup
 
 	/* relocation is on at this point */
 
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
index 99e4307affd6..27faf4f0967a 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -359,12 +359,6 @@ static void __init iSeries_init_early(void)
 	 */
 	iommu_init_early_iSeries();
 
-	/*
-	 * Initialize the table which translate Linux physical addresses to
-	 * AS/400 absolute addresses
-	 */
-	build_iSeries_Memory_Map();
-
 	iSeries_get_cmdline();
 
 	/* Save unparsed command line copy for /proc/cmdline */
@@ -894,6 +888,11 @@ static int iseries_dedicated_idle(void)
 void __init iSeries_init_IRQ(void) { }
 #endif
 
+static int __init iseries_probe(int platform)
+{
+	return PLATFORM_ISERIES_LPAR == platform;
+}
+
 struct machdep_calls __initdata iseries_md = {
 	.setup_arch	= iSeries_setup_arch,
 	.get_cpuinfo	= iSeries_get_cpuinfo,
@@ -909,6 +908,7 @@ struct machdep_calls __initdata iseries_md = {
 	.get_rtc_time	= iSeries_get_rtc_time,
 	.calibrate_decr	= iSeries_calibrate_decr,
 	.progress	= iSeries_progress,
+	.probe		= iseries_probe,
 	/* XXX Implement enable_pmcs for iSeries */
 };
 
@@ -1047,9 +1047,17 @@ void build_flat_dt(struct iseries_flat_dt *dt)
 	dt_push_u32(dt, OF_DT_END);
 }
 
-void __init iSeries_early_setup(void)
+void * __init iSeries_early_setup(void)
 {
 	iSeries_fixup_klimit();
 
+	/*
+	 * Initialize the table which translate Linux physical addresses to
+	 * AS/400 absolute addresses
+	 */
+	build_iSeries_Memory_Map();
+
 	build_flat_dt(&iseries_dt);
+
+	return (void *) __pa(&iseries_dt);
 }
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index acf826043e39..6c1cd3bab28e 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -309,13 +309,11 @@ static void __init setup_cpu_maps(void)
 }
 #endif /* CONFIG_SMP */
 
-
-#ifdef CONFIG_PPC_MULTIPLATFORM
-
 extern struct machdep_calls pSeries_md;
 extern struct machdep_calls pmac_md;
 extern struct machdep_calls maple_md;
 extern struct machdep_calls bpa_md;
+extern struct machdep_calls iseries_md;
 
 /* Ultimately, stuff them in an elf section like initcalls... */
 static struct machdep_calls __initdata *machines[] = {
@@ -330,6 +328,9 @@ static struct machdep_calls __initdata *machines[] = {
 #endif /* CONFIG_PPC_MAPLE */
 #ifdef CONFIG_PPC_BPA
 	&bpa_md,
+#endif
+#ifdef CONFIG_PPC_ISERIES
+	&iseries_md,
 #endif
 	NULL
 };
@@ -534,8 +535,6 @@ static void __init check_for_initrd(void)
 #endif /* CONFIG_BLK_DEV_INITRD */
 }
 
-#endif /* CONFIG_PPC_MULTIPLATFORM */
-
 /*
  * Do some initial setup of the system.  The parameters are those which 
  * were passed in from the bootloader.
-- 
cgit v1.2.2