diff mbox

[RFC,1/3] ARM: move ICEDCC uncompress.h to common location

Message ID 1348613212-21897-2-git-send-email-swarren@wwwdotorg.org (mailing list archive)
State New, archived
Headers show

Commit Message

Stephen Warren Sept. 25, 2012, 10:46 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Create a common location for uncompress.h, and select the included debug
macro file using config option.

This does the same for uncompress.h as a recent patch for debug-macro.S,
which was based on a suggestion by Russell King and implemented by Rob
Herring.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/Kconfig.debug                     |   10 ++++
 arch/arm/boot/compressed/misc.c            |   64 +---------------------------
 arch/arm/include/debug/icedcc-uncompress.h |   61 ++++++++++++++++++++++++++
 arch/arm/include/debug/none-uncompress.h   |    3 +
 4 files changed, 75 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/include/debug/icedcc-uncompress.h
 create mode 100644 arch/arm/include/debug/none-uncompress.h

Comments

Domenico Andreoli Sept. 26, 2012, 9:56 p.m. UTC | #1
On Tue, Sep 25, 2012 at 04:46:50PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Create a common location for uncompress.h, and select the included debug
> macro file using config option.
> 
> This does the same for uncompress.h as a recent patch for debug-macro.S,
> which was based on a suggestion by Russell King and implemented by Rob
> Herring.
> 
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  arch/arm/Kconfig.debug                     |   10 ++++
>  arch/arm/boot/compressed/misc.c            |   64 +---------------------------
>  arch/arm/include/debug/icedcc-uncompress.h |   61 ++++++++++++++++++++++++++
>  arch/arm/include/debug/none-uncompress.h   |    3 +
>  4 files changed, 75 insertions(+), 63 deletions(-)
>  create mode 100644 arch/arm/include/debug/icedcc-uncompress.h
>  create mode 100644 arch/arm/include/debug/none-uncompress.h
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index b0f3857..0daec3d 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -420,6 +420,16 @@ config DEBUG_LL_INCLUDE
>  		DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
>  	default "mach/debug-macro.S"
>  
> +config UNCOMPRESS_INCLUDE
> +	string
> +	default "debug/icedcc-uncompress.h" if DEBUG_ICEDCC
> +	default "debug/none-uncompress.h" if ARCH_MULTIPLATFORM || \
> +		DEBUG_HIGHBANK_UART || DEBUG_MVEBU_UART || \
> +		DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
> +		DEBUG_VEXPRESS_UART0_DETECT || DEBUG_VEXPRESS_UART0_CA9 || \
> +		DEBUG_VEXPRESS_UART0_RS1

I would ask to add DEBUG_LL_UART_NONE to the or-ed list, which fixes the
build of platforms without mach/uncompress.h and mach/debug-macro.S in
case NONE is selected, but I'm not sure.

If I got the point of Russel right, uncompress.h is not a debug trace and
maybe should not depend on any DEBUG_LL* option?

Regards,
Domenico
Stephen Warren Sept. 27, 2012, 5:19 a.m. UTC | #2
On 09/26/2012 03:56 PM, Domenico Andreoli wrote:
> On Tue, Sep 25, 2012 at 04:46:50PM -0600, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> Create a common location for uncompress.h, and select the included debug
>> macro file using config option.
>>
>> This does the same for uncompress.h as a recent patch for debug-macro.S,
>> which was based on a suggestion by Russell King and implemented by Rob
>> Herring.

>> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug

>> +config UNCOMPRESS_INCLUDE
>> +	string
>> +	default "debug/icedcc-uncompress.h" if DEBUG_ICEDCC
>> +	default "debug/none-uncompress.h" if ARCH_MULTIPLATFORM || \
>> +		DEBUG_HIGHBANK_UART || DEBUG_MVEBU_UART || \
>> +		DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
>> +		DEBUG_VEXPRESS_UART0_DETECT || DEBUG_VEXPRESS_UART0_CA9 || \
>> +		DEBUG_VEXPRESS_UART0_RS1
> 
> I would ask to add DEBUG_LL_UART_NONE to the or-ed list, which fixes the
> build of platforms without mach/uncompress.h and mach/debug-macro.S in
> case NONE is selected, but I'm not sure.

Yes, I just noticed that it (UART_NONE) depends on !MULTIPLATFORM, and
with this patch it probably shouldn't any more; it should be the default
uncompress type for MULTIPLATFORM.

> If I got the point of Russel right, uncompress.h is not a debug trace and
> maybe should not depend on any DEBUG_LL* option?

The only way a multi-platform zImage can work (at the moment anyway) is
to have no serial/debug/... output from the uncompressor, nor
earlyprintk. Once the DT is parsed and the real platform-specific
console driver is registered, console output can commence. If the kernel
experiences problems before that point, you might want to turn on
earlyprintk or even output from the uncompressor. Once you've done that,
you've tied the kernel image to a single platform. This is likely only
something you'd do when debugging a problem, otherwise it would defeat
the point of single zImage. Hence, classifying this as a debug option
seems reasonable.
diff mbox

Patch

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index b0f3857..0daec3d 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -420,6 +420,16 @@  config DEBUG_LL_INCLUDE
 		DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
 	default "mach/debug-macro.S"
 
+config UNCOMPRESS_INCLUDE
+	string
+	default "debug/icedcc-uncompress.h" if DEBUG_ICEDCC
+	default "debug/none-uncompress.h" if ARCH_MULTIPLATFORM || \
+		DEBUG_HIGHBANK_UART || DEBUG_MVEBU_UART || \
+		DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
+		DEBUG_VEXPRESS_UART0_DETECT || DEBUG_VEXPRESS_UART0_CA9 || \
+		DEBUG_VEXPRESS_UART0_RS1
+	default "mach/uncompress.h"
+
 config EARLY_PRINTK
 	bool "Early printk"
 	depends on DEBUG_LL
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index df89983..afbdb3f 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -25,69 +25,7 @@  unsigned int __machine_arch_type;
 static void putstr(const char *ptr);
 extern void error(char *x);
 
-#ifdef CONFIG_ARCH_MULTIPLATFORM
-static inline void putc(int c) {}
-static inline void flush(void) {}
-static inline void arch_decomp_setup(void) {}
-#else
-#include <mach/uncompress.h>
-#endif
-
-#ifdef CONFIG_DEBUG_ICEDCC
-
-#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
-
-static void icedcc_putc(int ch)
-{
-	int status, i = 0x4000000;
-
-	do {
-		if (--i < 0)
-			return;
-
-		asm volatile ("mrc p14, 0, %0, c0, c1, 0" : "=r" (status));
-	} while (status & (1 << 29));
-
-	asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch));
-}
-
-
-#elif defined(CONFIG_CPU_XSCALE)
-
-static void icedcc_putc(int ch)
-{
-	int status, i = 0x4000000;
-
-	do {
-		if (--i < 0)
-			return;
-
-		asm volatile ("mrc p14, 0, %0, c14, c0, 0" : "=r" (status));
-	} while (status & (1 << 28));
-
-	asm("mcr p14, 0, %0, c8, c0, 0" : : "r" (ch));
-}
-
-#else
-
-static void icedcc_putc(int ch)
-{
-	int status, i = 0x4000000;
-
-	do {
-		if (--i < 0)
-			return;
-
-		asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
-	} while (status & 2);
-
-	asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch));
-}
-
-#endif
-
-#define putc(ch)	icedcc_putc(ch)
-#endif
+#include CONFIG_UNCOMPRESS_INCLUDE
 
 static void putstr(const char *ptr)
 {
diff --git a/arch/arm/include/debug/icedcc-uncompress.h b/arch/arm/include/debug/icedcc-uncompress.h
new file mode 100644
index 0000000..b505241
--- /dev/null
+++ b/arch/arm/include/debug/icedcc-uncompress.h
@@ -0,0 +1,61 @@ 
+/*
+ * Decompressor debug output routines for ICEDCC
+ *
+ * Extracted from misc.c, which is by:
+ * Modified for ARM Linux by Russell King
+ * Nicolas Pitre <nico@visuaide.com>
+ */
+
+#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
+
+static void putc(int ch)
+{
+	int status, i = 0x4000000;
+
+	do {
+		if (--i < 0)
+			return;
+
+		asm volatile ("mrc p14, 0, %0, c0, c1, 0" : "=r" (status));
+	} while (status & (1 << 29));
+
+	asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch));
+}
+
+
+#elif defined(CONFIG_CPU_XSCALE)
+
+static void putc(int ch)
+{
+	int status, i = 0x4000000;
+
+	do {
+		if (--i < 0)
+			return;
+
+		asm volatile ("mrc p14, 0, %0, c14, c0, 0" : "=r" (status));
+	} while (status & (1 << 28));
+
+	asm("mcr p14, 0, %0, c8, c0, 0" : : "r" (ch));
+}
+
+#else
+
+static void putc(int ch)
+{
+	int status, i = 0x4000000;
+
+	do {
+		if (--i < 0)
+			return;
+
+		asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
+	} while (status & 2);
+
+	asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch));
+}
+
+#endif
+
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
diff --git a/arch/arm/include/debug/none-uncompress.h b/arch/arm/include/debug/none-uncompress.h
new file mode 100644
index 0000000..e19955d
--- /dev/null
+++ b/arch/arm/include/debug/none-uncompress.h
@@ -0,0 +1,3 @@ 
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}