diff mbox

[U-Boot,v4,2/5] arm bootm: Do not append zero ATAG_MEM

Message ID 1350648008-25514-3-git-send-email-pali.rohar@gmail.com
State Rejected
Delegated to: Tom Rini
Headers show

Commit Message

Pali Rohár Oct. 19, 2012, noon UTC
If dram bank size is calculated at runtime, it can be zero on some boards.
This patch added code which ignore these zero bank size in ATAG_MEM.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
Changes in v4:
   - No changes

 arch/arm/lib/bootm.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Vasut Oct. 20, 2012, 9:34 a.m. UTC | #1
Dear Pali Rohár,

> If dram bank size is calculated at runtime, it can be zero on some boards.
> This patch added code which ignore these zero bank size in ATAG_MEM.
> 
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> ---
> Changes in v4:
>    - No changes

Did we not discuss this patch?

>  arch/arm/lib/bootm.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index 9323db0..d5811e0 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -133,6 +133,9 @@ static void setup_memory_tags(bd_t *bd)
>  	int i;
> 
>  	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> +		if (bd->bi_dram[i].size == 0)
> +			continue;
> +
>  		params->hdr.tag = ATAG_MEM;
>  		params->hdr.size = tag_size (tag_mem32);

Best regards,
Marek Vasut
Pali Rohár Oct. 20, 2012, 9:41 a.m. UTC | #2
On Saturday 20 October 2012 11:34:20 Marek Vasut wrote:
> Dear Pali Rohár,
> 
> > If dram bank size is calculated at runtime, it can be zero on
> > some boards. This patch added code which ignore these zero
> > bank size in ATAG_MEM.
> > 
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > ---
> > 
> > Changes in v4:
> >    - No changes
> 
> Did we not discuss this patch?
> 

Yes, but there was no change, see:
http://www.mail-archive.com/u-boot@lists.denx.de/msg96706.html
Tom Rini Oct. 26, 2012, 5:44 p.m. UTC | #3
On Sat, Oct 20, 2012 at 11:41:51AM +0200, Pali Roh?r wrote:
> On Saturday 20 October 2012 11:34:20 Marek Vasut wrote:
> > Dear Pali Roh??r,
> > 
> > > If dram bank size is calculated at runtime, it can be zero on
> > > some boards. This patch added code which ignore these zero
> > > bank size in ATAG_MEM.
> > > 
> > > Signed-off-by: Pali Roh??r <pali.rohar@gmail.com>
> > > ---
> > > 
> > > Changes in v4:
> > >    - No changes
> > 
> > Did we not discuss this patch?
> > 
> 
> Yes, but there was no change, see:
> http://www.mail-archive.com/u-boot@lists.denx.de/msg96706.html

I'm sorry if I wasn't clear then.  This change should not be needed as
N900 should simply always say 1 bank and the correct total memory size
of all populated memory banks.  Is the problem that in the ATAGs we're
re-using we have a zero-size memory ATAG?
Tom Rini Oct. 26, 2012, 5:52 p.m. UTC | #4
On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:

> If dram bank size is calculated at runtime, it can be zero on some boards.
> This patch added code which ignore these zero bank size in ATAG_MEM.
> 
> Signed-off-by: Pali Roh??r <pali.rohar@gmail.com>

My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags
are handled correctly (which is to say, parsed and found as -EINVAL).
So if we _have_to_ we can add this change.
Marek Vasut Oct. 27, 2012, 3:29 p.m. UTC | #5
Dear Tom Rini,

> On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:
> > If dram bank size is calculated at runtime, it can be zero on some
> > boards. This patch added code which ignore these zero bank size in
> > ATAG_MEM.
> > 
> > Signed-off-by: Pali Roh??r <pali.rohar@gmail.com>
> 
> My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags
> are handled correctly (which is to say, parsed and found as -EINVAL).
> So if we _have_to_ we can add this change.

I don't think we _have_to_ ... 

Best regards,
Marek Vasut
Tom Rini Oct. 29, 2012, 5:37 p.m. UTC | #6
On Sat, Oct 27, 2012 at 05:29:32PM +0200, Marek Vasut wrote:
> Dear Tom Rini,
> 
> > On Fri, Oct 19, 2012 at 02:00:05PM +0200, Pali Roh??r wrote:
> > > If dram bank size is calculated at runtime, it can be zero on some
> > > boards. This patch added code which ignore these zero bank size in
> > > ATAG_MEM.
> > > 
> > > Signed-off-by: Pali Roh??r <pali.rohar@gmail.com>
> > 
> > My reading of the kernel's arm_add_memory says that empty ATAG_MEM tags
> > are handled correctly (which is to say, parsed and found as -EINVAL).
> > So if we _have_to_ we can add this change.
> 
> I don't think we _have_to_ ... 

Indeed.  After talking with Pali on irc some more and checking things
again, we can simply drop this patch.  Other platforms pass 0 size
ATAG_MEM to the kernel and have for ages, so it's handled.
diff mbox

Patch

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 9323db0..d5811e0 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -133,6 +133,9 @@  static void setup_memory_tags(bd_t *bd)
 	int i;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		if (bd->bi_dram[i].size == 0)
+			continue;
+
 		params->hdr.tag = ATAG_MEM;
 		params->hdr.size = tag_size (tag_mem32);