
From: Paul Mackerras <paulus@samba.org>

This patch is from Arnd Bergmann <arndb@de.ibm.com>.

RTAS is not actually pSeries specific, but some PPC64 code that relies on RTAS
is currently protected by CONFIG_PPC_PSERIES.

This introduces a generic configuration option PPC_RTAS that can be used by
other subarchitectures as well.  The existing option with the same name is
renamed to the more specific RTAS_PROC.

Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ppc64/Kconfig                    |   11 ++++++++---
 25-akpm/arch/ppc64/kernel/Makefile            |    2 +-
 25-akpm/arch/ppc64/kernel/entry.S             |    4 ++--
 25-akpm/arch/ppc64/kernel/misc.S              |    2 +-
 25-akpm/arch/ppc64/kernel/prom.c              |    4 ++--
 25-akpm/arch/ppc64/kernel/rtc.c               |    2 +-
 25-akpm/arch/ppc64/kernel/setup.c             |    4 ++--
 25-akpm/arch/ppc64/oprofile/op_model_power4.c |    2 +-
 8 files changed, 18 insertions(+), 13 deletions(-)

diff -puN arch/ppc64/Kconfig~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/Kconfig
--- 25/arch/ppc64/Kconfig~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/Kconfig	Mon Mar 14 16:17:14 2005
@@ -255,16 +255,21 @@ config MSCHUNKS
 
 
 config PPC_RTAS
-	bool "Proc interface to RTAS"
+	bool
 	depends on PPC_PSERIES
+	default y
+
+config RTAS_PROC
+	bool "Proc interface to RTAS"
+	depends on PPC_RTAS
 
 config RTAS_FLASH
 	tristate "Firmware flash interface"
-	depends on PPC_RTAS
+	depends on RTAS_PROC
 
 config SCANLOG
 	tristate "Scanlog dump interface"
-	depends on PPC_RTAS
+	depends on RTAS_PROC && PPC_PSERIES
 
 config LPARCFG
 	tristate "LPAR Configuration Data"
diff -puN arch/ppc64/kernel/entry.S~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/entry.S
--- 25/arch/ppc64/kernel/entry.S~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/entry.S	Mon Mar 14 16:17:14 2005
@@ -616,7 +616,7 @@ unrecov_restore:
 	bl	.unrecoverable_exception
 	b	unrecov_restore
 
-#ifdef CONFIG_PPC_PSERIES
+#ifdef CONFIG_PPC_RTAS
 /*
  * On CHRP, the Run-Time Abstraction Services (RTAS) have to be
  * called with the MMU off.
@@ -753,7 +753,7 @@ _STATIC(rtas_restore_regs)
 	mtlr    r0
         blr				/* return to caller */
 
-#endif /* CONFIG_PPC_PSERIES */
+#endif /* CONFIG_PPC_RTAS */
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
 
diff -puN arch/ppc64/kernel/Makefile~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/Makefile
--- 25/arch/ppc64/kernel/Makefile~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/Makefile	Mon Mar 14 16:17:14 2005
@@ -39,7 +39,7 @@ obj-$(CONFIG_PROC_FS)		+= proc_ppc64.o
 obj-$(CONFIG_RTAS_FLASH)	+= rtas_flash.o
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_MODULES)		+= module.o ppc_ksyms.o
-obj-$(CONFIG_PPC_RTAS)		+= rtas-proc.o
+obj-$(CONFIG_RTAS_PROC)		+= rtas-proc.o
 obj-$(CONFIG_SCANLOG)		+= scanlog.o
 obj-$(CONFIG_VIOPATH)		+= viopath.o
 obj-$(CONFIG_LPARCFG)		+= lparcfg.o
diff -puN arch/ppc64/kernel/misc.S~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/misc.S
--- 25/arch/ppc64/kernel/misc.S~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/misc.S	Mon Mar 14 16:17:14 2005
@@ -680,7 +680,7 @@ _GLOBAL(kernel_thread)
 	ld	r30,-16(r1)
 	blr
 
-#ifndef CONFIG_PPC_PSERIES	/* hack hack hack */
+#ifdef CONFIG_PPC_RTAS /* hack hack hack */
 #define ppc_rtas	sys_ni_syscall
 #endif
 
diff -puN arch/ppc64/kernel/prom.c~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/prom.c
--- 25/arch/ppc64/kernel/prom.c~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/prom.c	Mon Mar 14 16:17:14 2005
@@ -894,7 +894,7 @@ static int __init early_init_dt_scan_cho
 	if (get_flat_dt_prop(node, "linux,iommu-force-on", NULL) != NULL)
 		iommu_force_on = 1;
 
-#ifdef CONFIG_PPC_PSERIES
+#ifdef CONFIG_PPC_RTAS
 	/* To help early debugging via the front panel, we retreive a minimal
 	 * set of RTAS infos now if available
 	 */
@@ -910,7 +910,7 @@ static int __init early_init_dt_scan_cho
 			rtas.size = *prop;
 		}
 	}
-#endif /* CONFIG_PPC_PSERIES */
+#endif /* CONFIG_PPC_RTAS */
 
 	/* break now */
 	return 1;
diff -puN arch/ppc64/kernel/rtc.c~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/rtc.c
--- 25/arch/ppc64/kernel/rtc.c~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/rtc.c	Mon Mar 14 16:17:14 2005
@@ -337,7 +337,7 @@ void iSeries_get_boot_time(struct rtc_ti
 }
 #endif
 
-#ifdef CONFIG_PPC_PSERIES
+#ifdef CONFIG_PPC_RTAS
 #define MAX_RTC_WAIT 5000	/* 5 sec */
 #define RTAS_CLOCK_BUSY (-2)
 void pSeries_get_boot_time(struct rtc_time *rtc_tm)
diff -puN arch/ppc64/kernel/setup.c~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/kernel/setup.c
--- 25/arch/ppc64/kernel/setup.c~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/kernel/setup.c	Mon Mar 14 16:17:14 2005
@@ -605,12 +605,12 @@ void __init setup_system(void)
 	 */
 	initialize_cache_info();
 
-#ifdef CONFIG_PPC_PSERIES
+#ifdef CONFIG_PPC_RTAS
 	/*
 	 * Initialize RTAS if available
 	 */
 	rtas_initialize();
-#endif /* CONFIG_PPC_PSERIES */
+#endif /* CONFIG_PPC_RTAS */
 
 	/*
 	 * Check if we have an initrd provided via the device-tree
diff -puN arch/ppc64/oprofile/op_model_power4.c~ppc64-make-rtas-code-usable-on-non-pseries-machines arch/ppc64/oprofile/op_model_power4.c
--- 25/arch/ppc64/oprofile/op_model_power4.c~ppc64-make-rtas-code-usable-on-non-pseries-machines	Mon Mar 14 16:17:14 2005
+++ 25-akpm/arch/ppc64/oprofile/op_model_power4.c	Mon Mar 14 16:17:14 2005
@@ -224,7 +224,7 @@ static unsigned long get_pc(struct pt_re
 	if (mmcra & MMCRA_SIPR)
 		return pc;
 
-#ifdef CONFIG_PPC_PSERIES
+#ifdef CONFIG_PPC_RTAS
 	/* Were we in RTAS? */
 	if (pc >= rtas.base && pc < (rtas.base + rtas.size))
 		/* function descriptor madness */
_
