Patchwork [U-Boot,1/2] DEBUG: fix relocation address

login
register
mail settings
Submitter Tetsuyuki Kobayashi
Date Nov. 21, 2012, 5:44 a.m.
Message ID <1353476660-18018-2-git-send-email-koba@kmckk.co.jp>
Download mbox | patch
Permalink /patch/200580/
State Rejected
Delegated to: Albert ARIBAUD
Headers show

Comments

Tetsuyuki Kobayashi - Nov. 21, 2012, 5:44 a.m.
U-Boot from NOR flash relocates itself to RAM erea. The relocation address is
calaculated at runtime to get maxium contiguous space to load kernel. So it may
vary after code changed. In the early debug phase it would be easier to handle
if the relocation address does not change.
This patch sets relocation address to fixed address specified by
CONFIG_DEBUG_RELOC_FIX_ADDR. If there is no enough space after
CONFIG_DEBUG_RELOC_FIX_ADDR, it is ignored.
patch to kzm9g.h is a example. CONFIG_DEBUG_RELOC_FIX_ADDR should be defined at
each config file.

Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
---
 arch/arm/lib/board.c    |    9 ++++++++-
 include/configs/kzm9g.h |    4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)
Wolfgang Denk - Nov. 21, 2012, 8:24 a.m.
Dear Tetsuyuki Kobayashi,

In message <1353476660-18018-2-git-send-email-koba@kmckk.co.jp> you wrote:
> U-Boot from NOR flash relocates itself to RAM erea. The relocation address is
> calaculated at runtime to get maxium contiguous space to load kernel. So it may
> vary after code changed. In the early debug phase it would be easier to handle
> if the relocation address does not change.
> This patch sets relocation address to fixed address specified by
> CONFIG_DEBUG_RELOC_FIX_ADDR. If there is no enough space after
> CONFIG_DEBUG_RELOC_FIX_ADDR, it is ignored.
> patch to kzm9g.h is a example. CONFIG_DEBUG_RELOC_FIX_ADDR should be defined at
> each config file.
> 
> Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
> ---
>  arch/arm/lib/board.c    |    9 ++++++++-
>  include/configs/kzm9g.h |    4 ++++
>  2 files changed, 12 insertions(+), 1 deletion(-)

NAK for this patch for the general reasons outlined oin my summary
reply to the cover letter.

In addition:

- If this is supposed to be a RFC patch series, then please add the
  RFC part to ALL patches, not only to the cover letter.

- Any changes to basic infrastucture like this have to be done in a
  general, architecture-independent way.  Doing this for ARM only is
  not acceptable.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 92cad9a..340aa6e 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -377,7 +377,14 @@  void board_init_f(ulong bootflag)
 	addr &= ~(4096 - 1);
 
 	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
-
+#ifdef CONFIG_DEBUG_RELOC_FIX_ADDR
+	if (addr >= CONFIG_DEBUG_RELOC_FIX_ADDR) {
+		addr = CONFIG_DEBUG_RELOC_FIX_ADDR;
+		debug("Fixing relocation address to %08lx\n", addr);
+	} else {
+		debug("CONFIG_DEBUG_RELOC_FIX_ADDR is ignored. It should be less than %08lx\n", addr);
+	}
+#endif
 #ifndef CONFIG_SPL_BUILD
 	/*
 	 * reserve memory for malloc() arena
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 4898fb6..f96ea3e 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -23,6 +23,10 @@ 
 
 #undef DEBUG
 
+/* Uncomment this to relocate to fixed address */
+/*#define CONFIG_DEBUG_RELOC_FIX_ADDR 0x5f800000 */
+
+
 #define CONFIG_RMOBILE
 #define CONFIG_SH73A0
 #define CONFIG_KZM_A9_GT