diff mbox

[U-Boot,v2,1/3] common: Display >=4GiB memory bank size

Message ID 1438572815-20943-1-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Aug. 3, 2015, 3:33 a.m. UTC
bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- Drop patches which are already applied
- Change start to phys_addr_t
- Change debug output to either %016llx or %08lx

 common/board_f.c             | 9 ++++++++-
 include/asm-generic/u-boot.h | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

Simon Glass Aug. 5, 2015, 2:38 p.m. UTC | #1
On 2 August 2015 at 21:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> bd->bi_dram[] has both start address and size defined as 32-bit,
> which is not the case on some platforms where >=4GiB memory bank
> is used. Change them to support such memory banks.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - Drop patches which are already applied
> - Change start to phys_addr_t
> - Change debug output to either %016llx or %08lx
>
>  common/board_f.c             | 9 ++++++++-
>  include/asm-generic/u-boot.h | 4 ++--
>  2 files changed, 10 insertions(+), 3 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 5, 2015, 4:58 p.m. UTC | #2
Hi Bin,

On 5 August 2015 at 08:38, Simon Glass <sjg@chromium.org> wrote:
>
> On 2 August 2015 at 21:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> > bd->bi_dram[] has both start address and size defined as 32-bit,
> > which is not the case on some platforms where >=4GiB memory bank
> > is used. Change them to support such memory banks.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > ---
> >
> > Changes in v2:
> > - Drop patches which are already applied
> > - Change start to phys_addr_t
> > - Change debug output to either %016llx or %08lx
> >
> >  common/board_f.c             | 9 ++++++++-
> >  include/asm-generic/u-boot.h | 4 ++--
> >  2 files changed, 10 insertions(+), 3 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Unfortunately this one gives an error with grasshopper:

buildman grasshopper
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 32 jobs per thread)
     avr32:  +   grasshopper
+common/board_f.c: In function 'show_dram_config':
+common/board_f.c:211: warning: comparison is always false due to
limited range of data type

Can you please take a look?

Regards,
Simon
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 6d922b8..eb24f6c 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -206,7 +206,14 @@  static int show_dram_config(void)
 	debug("\nRAM Configuration:\n");
 	for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
 		size += gd->bd->bi_dram[i].size;
-		debug("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
+
+		if (gd->bd->bi_dram[i].start >= 0x100000000ULL) {
+			debug("Bank #%d: %016llx ", i,
+			      (unsigned long long)(gd->bd->bi_dram[i].start));
+		} else {
+			debug("Bank #%d: %08lx ", i,
+			      (unsigned long)(gd->bd->bi_dram[i].start));
+		}
 #ifdef DEBUG
 		print_size(gd->bd->bi_dram[i].size, "\n");
 #endif
diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index c918049..9f3351d 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -130,8 +130,8 @@  typedef struct bd_info {
 	ulong	        bi_boot_params;	/* where this board expects params */
 #ifdef CONFIG_NR_DRAM_BANKS
 	struct {			/* RAM configuration */
-		ulong start;
-		ulong size;
+		phys_addr_t start;
+		phys_size_t size;
 	} bi_dram[CONFIG_NR_DRAM_BANKS];
 #endif /* CONFIG_NR_DRAM_BANKS */
 } bd_t;