diff mbox

[U-Boot,2/5] Added extra documentation about how the relocation address to RAM is picked for ARM.

Message ID 20110704174348.GC3016@harvey-pc.matrox.com
State Changes Requested
Headers show

Commit Message

Christopher Harvey July 4, 2011, 5:43 p.m. UTC
Signed-off-by: Christopher Harvey <charvey@matrox.com>
---
 doc/README.arm-relocation |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Comments

Wolfgang Denk July 4, 2011, 7:43 p.m. UTC | #1
Dear Christopher Harvey,

In message <20110704174348.GC3016@harvey-pc.matrox.com> you wrote:
> Signed-off-by: Christopher Harvey <charvey@matrox.com>
> ---
>  doc/README.arm-relocation |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)

Please let's stop with ARM specific documatation of things that are
considered generic.

> +The code that picks the location in RAM for ARM can be found in the 
> +arch/arm/lib/board.c file under the board_init_f function. 

under the function? Who dropped that code? :-)  s/under/in/

Also delete "for ARM", and s/arm/<arch>/.  This is not ARM specific.

> +The postfix _f means executed from flash, and _r means from RAM. 

Maybe we whould rather write "... from NOR flash" to indicate that we
actually mean ROM.

> +The new location is picked with respect to the highest RAM address, and the
> +exact final value depends heavily on compile time options. The source is the
> +best documentation here. 

This should be changed, i. e. better documentation should be provided
:-)

Best regards,

Wolfgang Denk
Christopher Harvey July 6, 2011, 8:58 p.m. UTC | #2
On Mon, Jul 04, 2011 at 09:43:24PM +0200, Wolfgang Denk wrote:
> Dear Christopher Harvey,
> 
> In message <20110704174348.GC3016@harvey-pc.matrox.com> you wrote:
> > Signed-off-by: Christopher Harvey <charvey@matrox.com>
> > ---
> >  doc/README.arm-relocation |    9 ++++++++-
> >  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> Please let's stop with ARM specific documatation of things that are
> considered generic.
> 
> > +The code that picks the location in RAM for ARM can be found in the 
> > +arch/arm/lib/board.c file under the board_init_f function. 
> 
> under the function? Who dropped that code? :-)  s/under/in/
> 
> Also delete "for ARM", and s/arm/<arch>/.  This is not ARM specific.
> 

I don't understand, I found the following snippet in 
arch/arm/lib/board.c

       --addr defined and set here--

	gd->relocaddr = addr;
	gd->start_addr_sp = addr_sp;
	gd->reloc_off = addr - _TEXT_BASE;
	debug ("relocation Offset is: %08lx\n", gd->reloc_off);
	memcpy (id, (void *)gd, sizeof (gd_t));

	relocate_code (addr_sp, id, addr);
	/* NOTREACHED - relocate_code() does not return */

Running grep -R gd->relocaddr *,
I found similar assignments for various architectures. 

 ...
 [snip]
 ...
> 
> Best regards,
> 
> Wolfgang Denk
> 

Thanks for the clarification,
-Chris
Wolfgang Denk July 6, 2011, 9:29 p.m. UTC | #3
Dear Christopher Harvey,

In message <20110706205857.GB2168@harvey-pc.matrox.com> you wrote:
>
> > Also delete "for ARM", and s/arm/<arch>/.  This is not ARM specific.
> 
> I don't understand, I found the following snippet in 
> arch/arm/lib/board.c
> 
>        --addr defined and set here--
> 
> 	gd->relocaddr = addr;
> 	gd->start_addr_sp = addr_sp;
> 	gd->reloc_off = addr - _TEXT_BASE;
> 	debug ("relocation Offset is: %08lx\n", gd->reloc_off);
> 	memcpy (id, (void *)gd, sizeof (gd_t));
> 
> 	relocate_code (addr_sp, id, addr);
> 	/* NOTREACHED - relocate_code() does not return */
> 
> Running grep -R gd->relocaddr *,
> I found similar assignments for various architectures. 

Yes, that's what I said: this is not ARM specific, it is supposed to
be common code used by all architectures (except for the sad fact that
there are several non-conforming implementations).  But if we document
it, we should document the nominal state.  [If in doubt, use the
powerpc implementation as reference.]

Best regards,

Wolfgang Denk
Albert ARIBAUD July 7, 2011, 4:10 p.m. UTC | #4
Hi Christopher,

Le 04/07/2011 19:43, Christopher Harvey a écrit :

> +The postfix _f means executed from flash, and _r means from RAM.

s/postfix/suffix/

Amicalement,
diff mbox

Patch

diff --git a/doc/README.arm-relocation b/doc/README.arm-relocation
index 5a9a2fb..954627d 100644
--- a/doc/README.arm-relocation
+++ b/doc/README.arm-relocation
@@ -22,7 +22,7 @@  At cpu level: modify linker file and add a relocation and fixup loop
 At board level:
 
 	dram_init(): bd pointer is now at this point not accessible, so only
-	detect the real dramsize, and store it in gd->ram_size. Bst detected
+	detect the real dramsize, and store it in gd->ram_size. Best detected
 	with get_ram_size().
 
 TODO:	move also dram initialization there on boards where it is possible.
@@ -38,6 +38,13 @@  At lib level:
 
 Boards which are not fixed to support relocation will be REMOVED!
 
+The code that picks the location in RAM for ARM can be found in the 
+arch/arm/lib/board.c file under the board_init_f function. 
+The postfix _f means executed from flash, and _r means from RAM. 
+The new location is picked with respect to the highest RAM address, and the
+exact final value depends heavily on compile time options. The source is the
+best documentation here. 
+
 -----------------------------------------------------------------------------
 
 For boards which boot from nand_spl, it is possible to save one copy