Skip to contentSkip to conversation

ARM: Add default system.h and uncompress.h

RFC PATCH New Rob Herring 3 participants 9 messages Jul 28, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover ARM: Add default system.h and uncompress.h

From: Rob Herring <[email protected]>

This is a relatively simple way to remove the platform requirement for some header files without making changes in every existing platform. It's perhaps not a solution for the difficult cases, but can get the simple cases out of the way making it clear what remains to be fixed. I've done this for system.h and uncompress.h so far. timex.h and io.h may be additional candidates.

One downside is you lose print capability in the decompressor. However, I don't think the complexity that adds is worth the 1 line print. Perhaps the include path ordering could be conditionalized on a config setting for multi-platform kernels such that the platform's headers are used on single machine kernels. There's already such a limitation on LL_DEBUG.

Rob

Rob Herring (3):
ARM: include mach headers before common arm headers
ARM: add a default mach/uncompress.h header
ARM: add a default mach/system.h header

 arch/arm/Makefile                  |    4 ++--
 arch/arm/include/mach/system.h     |   13 +++++++++++++
 arch/arm/include/mach/uncompress.h |    9 +++++++++
 arch/arm/kernel/process.c          |    5 ++++-
 4 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/mach/system.h
 create mode 100644 arch/arm/include/mach/uncompress.h
Signature · 1 line
1.7.4.1
#1 lore raw

RFC PATCH 1/3 ARM: include mach headers before common arm headers

From: Rob Herring <[email protected]>

In preparation to add an arch/arm/include/mach directory for default mach headers, make arch/arm/mach-*/include path be searched before arch/arm/include. This allows platforms to override default header implementation.

---
 arch/arm/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/Makefile +2 -2
index 30a19b6..1c41a2e 100644
@@ -234,9 +234,9 @@ machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
 platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
 
 ifeq ($(KBUILD_SRC),)
-KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
+LINUXINCLUDE := $(patsubst %,-I%include,$(machdirs) $(platdirs)) $(LINUXINCLUDE)
 else
-KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
+LINUXINCLUDE := $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs)) $(LINUXINCLUDE)
 endif
 
 export	TEXT_OFFSET GZFLAGS MMUEXT
Signature · 1 line
1.7.4.1
#2 lore raw

RFC PATCH 2/3 ARM: add a default mach/uncompress.h header

In reply to Rob Herring

From: Rob Herring <[email protected]>

Add default empty functions to allow platforms to use a default uncompress.h header. This helps enable support of multi-platform kernels, you lose serial output in the decompressor. Only a couple of platforms need arch_decomp_setup and/or arch_decomp_wdog.

---
 arch/arm/include/mach/uncompress.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/mach/uncompress.h
arch/arm/include/mach/uncompress.h new file +9 -0
new file mode 100644
index 0000000..9277c85
@@ -0,0 +1,9 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+static inline void putc(char) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
+static inline void arch_decomp_wdog(void) {}
+
+#endif
Signature · 1 line
1.7.4.1
#3 lore raw

RFC PATCH 3/3 ARM: add a default mach/system.h header

In reply to Rob Herring

From: Rob Herring <[email protected]>

This adds default implementations of arch_idle and arch_reset. Any platform with a system.h will pickup their version of the functions.

Platforms needing custom idle and reset functions can set pm_idle and machine_reset, respectively, to custom implementations at boot time.

---
 arch/arm/include/mach/system.h |   13 +++++++++++++
 arch/arm/kernel/process.c      |    5 ++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/mach/system.h
arch/arm/include/mach/system.h new file +13 -0
new file mode 100644
index 0000000..9ab0684
@@ -0,0 +1,13 @@
+#ifndef __MACH_SYSTEM_H
+#define __MACH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+	cpu_do_idle();
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
+
+#endif
arch/arm/kernel/process.c +4 -1
index 5e1e541..b3b10bc 100644
@@ -91,6 +91,9 @@ static int __init hlt_setup(char *__unused)
 __setup("nohlt", nohlt_setup);
 __setup("hlt", hlt_setup);
 
+void (*machine_reset)(char mode, const char *cmd) = arch_reset;
+EXPORT_SYMBOL(machine_reset);
+
 void arm_machine_restart(char mode, const char *cmd)
 {
 	/* Disable interrupts first */
@@ -116,7 +119,7 @@ void arm_machine_restart(char mode, const char *cmd)
 	/*
 	 * Now call the architecture specific reboot code.
 	 */
-	arch_reset(mode, cmd);
+	machine_reset(mode, cmd);
 
 	/*
 	 * Whoops - the architecture was unable to reboot.
Signature · 1 line
1.7.4.1
#4 lore raw

cover ARM: Add default system.h and uncompress.h

In reply to Rob Herring
Quoted 8 lines · Rob Herring

From: Rob Herring <[email protected]>

This is a relatively simple way to remove the platform requirement for some header files without making changes in every existing platform. It's perhaps not a solution for the difficult cases, but can get the simple cases out of the way making it clear what remains to be fixed. I've done this for system.h and uncompress.h so far. timex.h and io.h may be additional candidates.

I'm of two minds about this. It is true that this makes things easy and would avoid some of the #ifdef'ery that is otherwise necessary. On the other hand this gives us more opportunity for procrastinating and not really do a complete and thorough job. It would also be easier for some platform to sneak in some of those header files to work around some shortcomings in the generic version which is not helping maintainers keeping a good discipline. AS we are working on this, I might prefer that mistakes do break the build rather than silently causing a fallback with a dummy generic version to be picked up which might only cause problems at run time much later.

A Linaro event is taking place next week in England where a focused effort will be deployed to work on this. Let's see how much we'll be able to clean up.

Nicolas

#5 lore raw

cover ARM: Add default system.h and uncompress.h

Nicolas,

Quoted 11 lines · Nicolas Pitre
Quoted 8 lines · Rob Herring

From: Rob Herring <[email protected]>

This is a relatively simple way to remove the platform requirement for some header files without making changes in every existing platform. It's perhaps not a solution for the difficult cases, but can get the simple cases out of the way making it clear what remains to be fixed. I've done this for system.h and uncompress.h so far. timex.h and io.h may be additional candidates.

Quoted 11 lines

I'm of two minds about this. It is true that this makes things easy and would avoid some of the #ifdef'ery that is otherwise necessary. On the other hand this gives us more opportunity for procrastinating and not really do a complete and thorough job. It would also be easier for some platform to sneak in some of those header files to work around some shortcomings in the generic version which is not helping maintainers keeping a good discipline. AS we are working on this, I might prefer that mistakes do break the build rather than silently causing a fallback with a dummy generic version to be picked up which might only cause problems at run time much later.

I just threw this out as an option.

I certainly view this as somewhat temporary, but just longer lived than a single patch series and simpler that a bunch of temporary HAVE_FOO_HEADER defines. Ultimately, the headers could just get rolled into their parent asm header once all the platforms are converted over. I don't view it as procrastinating, but allows platforms to be cleaned up independently and spreads the work to others. The decision to move gpio code into drivers/gpio is a good example. There was clear path and it all went very quickly. It also allows focusing on the harder problems while people are F2F.

Quoted 4 lines

A Linaro event is taking place next week in England where a focused effort will be deployed to work on this. Let's see how much we'll be able to clean up.

Yes, I'm well aware of that. I'll participate remotely as much as I can. Let me know how I can help.

Rob

#6 lore raw

cover ARM: Add default system.h and uncompress.h

In reply to Rob Herring
Quoted 2 lines · Rob Herring

One downside is you lose print capability in the decompressor. However, I don't think the complexity that adds is worth the 1 line print.

You're wrong there - it's very very useful to have that from the decompressor. It's saved many people (including us) a lot of wasted time caused by faulty hardware implementation.

Normally, if the design of the SDRAM connections is poor, the first thing which catches it is the decompressor, and so its that which we really want error information from.

So no, losing that ability is not an option. Really.

#7 lore raw

cover ARM: Add default system.h and uncompress.h

Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Rob Herring

One downside is you lose print capability in the decompressor. However, I don't think the complexity that adds is worth the 1 line print.

Quoted 8 lines

You're wrong there - it's very very useful to have that from the decompressor. It's saved many people (including us) a lot of wasted time caused by faulty hardware implementation.

Normally, if the design of the SDRAM connections is poor, the first thing which catches it is the decompressor, and so its that which we really want error information from.

Agreed. I have seen that case as well, but generally only very early on in board/chip bringup. Really, bootloaders need a decent memory test or ability to load one.

Quoted 1 line

So no, losing that ability is not an option. Really.

If a platform has an uncompress.h, then you don't lose anything. Is it something that has to *always* be available? Are you opposed to a config option here? It can be available only for single arch/machine builds similar to DEBUG_LL.

Rob

#8 lore raw

cover ARM: Add default system.h and uncompress.h

Quoted 7 lines · Rob Herring
Quoted 1 line · Russell King - ARM Linux

So no, losing that ability is not an option. Really.

If a platform has an uncompress.h, then you don't lose anything. Is it something that has to *always* be available? Are you opposed to a config option here? It can be available only for single arch/machine builds similar to DEBUG_LL.