Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
On 12.08.20 16:21, Daniel Schwierzeck wrote: Am Mittwoch, den 12.08.2020, 14:37 +0200 schrieb Pali Rohár: Hello! diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 0a13f6edb7..b3ef15963e 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -242,7 +242,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) int arch_fixup_fdt(void *blob) { - u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart); + u64 mem_start = virt_to_phys((void *)gd->bd->bi_dram[0].start); u64 mem_size = gd->ram_size; I do not fully understand this change. Why on some places you are suing bi_dram[0].size and on some places gd->ram_size? This patch is mainly a search and replace s/bd->bi_memstart/bd->bi_dram[0].start. But as your test has shown, this is not always correct. Yes, this search+replace needs to be better reviewed and tested. Such big change has potential to break random stuff which nobody think about. @@ -607,8 +603,11 @@ int setup_bdinfo(void) { struct bd_info *bd = gd->bd; - bd->bi_memstart = gd->ram_base; /* start of memory */ - bd->bi_memsize = gd->ram_size; /* size in bytes */ + /* Only overwrite bi_dram[0] values if not already set */ + if (!bd->bi_dram[0].size) { This still look suspicious. When is bi_dram[0].size zero? I tried to trace source code. dram_init_banksize() is always called before setup_bdinfo() which fills bi_dram[], so when can be dram size zero? Or I'm missing something? dram_init_banksize() is always called earlier, yes. But its weak default only sets the bi_dram[] values when CONFIG_SYS_SDRAM_BASE is configured. I'm checking right now, if this might be a problem. Should not be in this case extended dram_init_banksize() to always properly fill bi_dram[] structure? Setting bi_dram[] on more places and doing overwriting could complicate things for future debugging or extending. for all users of bi_memstart/bi_memsize the search+replace should be enough. But in setup_bdinfo() it is wrong because it overrides the initialization done in dram_init_banksize(). But setup_bdinfo() is a new function due to some other bd_info refactoring merged two weeks ago and was not available in v2 of this patch. I guess N900 was still working with v2 and v3 now has this kind of merge conflict regression. Just removing those lines without replacing with bi_dram should fix this: bd->bi_memstart = gd->ram_base; /* start of memory */ bd->bi_memsize = gd->ram_size; /* size in bytes */ Yes. A new patchset will follow soon, which removes these assignments in setup_bdinfo() but also adds a default assignment to dram_init_banksize(). BTW: looking deeper in the code and history I think bd_info.bi_dram is heavily misused as storage for DRAM configuration. Such information should be stored in global_data where generic code can access it if needed (e.g. LMB, fdt_fixup_memory_banks()). I agree. Some of this is addressed in the upcoming patchset. bd_info should just be initialized and used when needed to boot old kernels. Also there should be a Kconfig option to completely disable the support of bd_info. I agree in general, but: If we want to support booting of the old kernels (at least on PowerPC), then we can't remove bi_memstart/memsize from bd_info. This is a decision that we need to make. Currently my patches remove it and therefore at least booting of old PowerPC kernels using bd_info to transfer the memory infos to the kernel will not work any more. This could easily be changed by not removing those values from the struct and adding one assignment of them to some common place. I'm not sure if its worth it though. And I'm not even sure, if I can test this somehow, as I would need a PowerPC board that is supported in U-Boot & Linux for a very long time. Thanks, Stefan
Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
Am Mittwoch, den 12.08.2020, 09:44 +0200 schrieb Stefan Roese: > Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") & > commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"), > CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default). > It makes no sense to still carry code that is guarded with > "#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes > all these unreferenced code paths. > > Also complete remove bi_memstart & bi_memsize from the board-info > struct. As now bi_dram[] is always enabled and should be used instead. > This removes the redundant varriables. > > Signed-off-by: Stefan Roese > Cc: Daniel Schwierzeck > Cc: Tom Rini > Cc: Ramon Fried > Cc: Simon Glass > Cc: Michal Simek > Cc: Pali Rohár > --- > v3: > - Rebase on TOT > - Add check to not overwrite bi_dram[0] if already configured in > setup_bdinfo(). This fixes the test issue with Nokia RX51. > > Azure test report success: > https://dev.azure.com/sr0718/u-boot/_build/results?buildId=26=results > > v2: > - Change all references to bi_memstart & bi_memsize to bi_dram[0].start/ > size and remove it from the bd_info struct completely, as suggested by > Daniel > > api/api_platform-mips.c | 4 ++-- > api/api_platform-powerpc.c| 2 +- > arch/mips/lib/boot.c | 2 +- > arch/mips/lib/bootm.c | 2 +- > arch/powerpc/cpu/mpc83xx/fdt.c| 2 +- > arch/powerpc/cpu/mpc83xx/traps.c | 2 +- > arch/powerpc/cpu/mpc85xx/fdt.c| 4 ++-- > arch/powerpc/cpu/mpc85xx/traps.c | 2 +- > arch/powerpc/cpu/mpc86xx/fdt.c| 2 +- > arch/powerpc/cpu/mpc86xx/traps.c | 2 +- > arch/powerpc/cpu/mpc8xx/fdt.c | 2 +- > arch/powerpc/lib/bootm.c | 4 ++-- > arch/x86/cpu/broadwell/cpu_from_spl.c | 2 -- > arch/xtensa/lib/bdinfo.c | 4 ++-- > arch/xtensa/lib/bootm.c | 4 ++-- > board/Arcturus/ucp1020/spl.c | 4 ++-- > board/freescale/p1010rdb/spl.c| 4 ++-- > board/freescale/p1_p2_rdb_pc/spl.c| 4 ++-- > board/freescale/t102xrdb/spl.c| 4 ++-- > board/freescale/t104xrdb/spl.c| 4 ++-- > board/freescale/t208xqds/spl.c| 4 ++-- > board/freescale/t208xrdb/spl.c| 4 ++-- > board/freescale/t4rdb/spl.c | 4 ++-- > board/xilinx/zynqmp/zynqmp.c | 2 -- > cmd/bdinfo.c | 6 ++--- > cmd/bedbug.c | 2 +- > common/board_f.c | 13 +-- > common/image.c| 10 +--- > common/init/handoff.c | 33 +++ > drivers/pci/pci-uclass.c | 17 +- > drivers/video/cfb_console.c | 8 +-- > include/asm-generic/u-boot.h | 4 > include/handoff.h | 2 -- > lib/fdtdec.c | 5 > lib/lmb.c | 7 -- > 35 files changed, 60 insertions(+), 121 deletions(-) > > diff --git a/api/api_platform-mips.c b/api/api_platform-mips.c > index 51cd328b3d..f1721cef19 100644 > --- a/api/api_platform-mips.c > +++ b/api/api_platform-mips.c > @@ -24,8 +24,8 @@ DECLARE_GLOBAL_DATA_PTR; > int platform_sys_info(struct sys_info *si) > { > > - platform_set_mr(si, gd->bd->bi_memstart, > - gd->bd->bi_memsize, MR_ATTR_DRAM); > + platform_set_mr(si, gd->bd->bi_dram[0].start, > + gd->bd->bi_dram[0].size, MR_ATTR_DRAM); > > return 1; > } > diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c > index 15930cfdb6..8fff6e4cae 100644 > --- a/api/api_platform-powerpc.c > +++ b/api/api_platform-powerpc.c > @@ -42,7 +42,7 @@ int platform_sys_info(struct sys_info *si) > si->bar = 0; > #endif > > - platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, > MR_ATTR_DRAM); > + platform_set_mr(si, gd->bd->bi_dram[0].start, gd->bd->bi_dram[0].size, > MR_ATTR_DRAM); > platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, > MR_ATTR_FLASH); > platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, > MR_ATTR_SRAM); > > diff --git a/arch/mips/lib/boot.c b/arch/mips/lib/boot.c > index db862f6379..3b960691c5 100644 > --- a/arch/mips/lib/boot.c > +++ b/arch/mips/lib/boot.c > @@ -17,7 +17,7 @@ unsigned long do_go_exec(ulong (*entry)(int, char * const > []), >* whole SDRAM area, since we don't know the size of the image >* that was loaded. >*/ > - flush_cache(gd->bd->bi_memstart, gd->ram_top - gd->bd->bi_memstart); > + flush_cache(gd->bd->bi_dram[0].start, gd->ram_top - > gd->bd->bi_dram[0].start); > > return entry(argc, argv); > } > diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c > index 0a13f6edb7..b3ef15963e 100644 > --- a/arch/mips/lib/bootm.c > +++ b/arch/mips/lib/bootm.c > @@ -242,7 +242,7 @@ static int
Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
Am Mittwoch, den 12.08.2020, 14:37 +0200 schrieb Pali Rohár: > Hello! > > > > > diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c > > > > index 0a13f6edb7..b3ef15963e 100644 > > > > --- a/arch/mips/lib/bootm.c > > > > +++ b/arch/mips/lib/bootm.c > > > > @@ -242,7 +242,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) > > > > #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) > > > > int arch_fixup_fdt(void *blob) > > > > { > > > > - u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart); > > > > + u64 mem_start = virt_to_phys((void *)gd->bd->bi_dram[0].start); > > > > u64 mem_size = gd->ram_size; > > > > > > I do not fully understand this change. Why on some places you are suing > > > bi_dram[0].size and on some places gd->ram_size? > > > > This patch is mainly a search and replace > > s/bd->bi_memstart/bd->bi_dram[0].start. But as your test has shown, this is > > not always > > correct. > > Yes, this search+replace needs to be better reviewed and tested. Such > big change has potential to break random stuff which nobody think about. > > > > > @@ -607,8 +603,11 @@ int setup_bdinfo(void) > > > > { > > > > struct bd_info *bd = gd->bd; > > > > - bd->bi_memstart = gd->ram_base; /* start of memory */ > > > > - bd->bi_memsize = gd->ram_size; /* size in bytes */ > > > > + /* Only overwrite bi_dram[0] values if not already set */ > > > > + if (!bd->bi_dram[0].size) { > > > > > > This still look suspicious. When is bi_dram[0].size zero? I tried to > > > trace source code. dram_init_banksize() is always called before > > > setup_bdinfo() which fills bi_dram[], so when can be dram size zero? > > > Or I'm missing something? > > > > dram_init_banksize() is always called earlier, yes. But its weak default > > only sets the bi_dram[] values when CONFIG_SYS_SDRAM_BASE is configured. > > I'm checking right now, if this might be a problem. > > Should not be in this case extended dram_init_banksize() to always > properly fill bi_dram[] structure? Setting bi_dram[] on more places and > doing overwriting could complicate things for future debugging or > extending. for all users of bi_memstart/bi_memsize the search+replace should be enough. But in setup_bdinfo() it is wrong because it overrides the initialization done in dram_init_banksize(). But setup_bdinfo() is a new function due to some other bd_info refactoring merged two weeks ago and was not available in v2 of this patch. I guess N900 was still working with v2 and v3 now has this kind of merge conflict regression. Just removing those lines without replacing with bi_dram should fix this: bd->bi_memstart = gd->ram_base; /* start of memory */ bd->bi_memsize = gd->ram_size; /* size in bytes */ BTW: looking deeper in the code and history I think bd_info.bi_dram is heavily misused as storage for DRAM configuration. Such information should be stored in global_data where generic code can access it if needed (e.g. LMB, fdt_fixup_memory_banks()). bd_info should just be initialized and used when needed to boot old kernels. Also there should be a Kconfig option to completely disable the support of bd_info. -- - Daniel
Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
Hello! > > > diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c > > > index 0a13f6edb7..b3ef15963e 100644 > > > --- a/arch/mips/lib/bootm.c > > > +++ b/arch/mips/lib/bootm.c > > > @@ -242,7 +242,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) > > > #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) > > > int arch_fixup_fdt(void *blob) > > > { > > > - u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart); > > > + u64 mem_start = virt_to_phys((void *)gd->bd->bi_dram[0].start); > > > u64 mem_size = gd->ram_size; > > > > I do not fully understand this change. Why on some places you are suing > > bi_dram[0].size and on some places gd->ram_size? > > This patch is mainly a search and replace > s/bd->bi_memstart/bd->bi_dram[0].start. But as your test has shown, this is > not always > correct. Yes, this search+replace needs to be better reviewed and tested. Such big change has potential to break random stuff which nobody think about. > > > @@ -607,8 +603,11 @@ int setup_bdinfo(void) > > > { > > > struct bd_info *bd = gd->bd; > > > - bd->bi_memstart = gd->ram_base; /* start of memory */ > > > - bd->bi_memsize = gd->ram_size; /* size in bytes */ > > > + /* Only overwrite bi_dram[0] values if not already set */ > > > + if (!bd->bi_dram[0].size) { > > > > This still look suspicious. When is bi_dram[0].size zero? I tried to > > trace source code. dram_init_banksize() is always called before > > setup_bdinfo() which fills bi_dram[], so when can be dram size zero? > > Or I'm missing something? > > dram_init_banksize() is always called earlier, yes. But its weak default > only sets the bi_dram[] values when CONFIG_SYS_SDRAM_BASE is configured. > I'm checking right now, if this might be a problem. Should not be in this case extended dram_init_banksize() to always properly fill bi_dram[] structure? Setting bi_dram[] on more places and doing overwriting could complicate things for future debugging or extending. > > For me it looks like that this patch is mixing different structures for > > ram size from different sources. > > Again, it started as a "simple" search and replace. It seems, that I > need to change this patch, so that the "correct" value is used in > place of bi_memstart & bi_memsize instead of always using bi_dram[]. > > I'll rework this patch again. > > > It is really correct? Does not it break > > other boards? > > > > I think that there is missing explanation of these changes. > > Perhaps its also the patch history that you are missing. This patch > started with a simple remove of the unreferenced CONFIG_NR_DRAM_BANKS > code paths (as the patch subject still mentions). And its extended, > after Daniel pointed out, that with the move of CONFIG_NR_DRAM_BANKS > the usage of bi_memstart etc is now not 100% correct any more. He > suggested to replace those references with bi_dram[]. I have not seen patch history, only its current version which caused u-boot failure on n900. So I was not sure what is intension of this patch. Sorry for that. I think 1:1 replacement is not such trivial as with more dram banks you would need to join address space from bi_dram[0], bi_dram[1], ... as previous code is expecting. I would suggest that more people with different hardware affected by this change would test if everything is working fine. I do not know how many boards have full boot test scenarios (from booting u-boot to booting kernel) like N900 and such tests are useful when playing with patches which changes such big parts. I would suggest to other board maintainers to write or provides test suite as it can really help with catching such fatal errors. I cannot believe that N900 was the only device on which u-boot stopped booting kernel. From that code it looks like that all OMAP3 devices must have been affected and possible any architecture with two or more dram banks. > I agree that this is a bit confusing. I'll rework this patch into > multiple separate patches now instead. This will hopefully make it > easier to follow the intention and review these changes. Lokesh, do you have OMAP3 devices to test these future Stefan's patches? For me it looks like that OMAP3 is good candidate which can be affected by these changes if code is not properly reviewed.
Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
Hi Pali, On 12.08.20 10:05, Pali Rohár wrote: On Wednesday 12 August 2020 09:44:17 Stefan Roese wrote: Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") & commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"), CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default). It makes no sense to still carry code that is guarded with "#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes all these unreferenced code paths. Also complete remove bi_memstart & bi_memsize from the board-info struct. As now bi_dram[] is always enabled and should be used instead. This removes the redundant varriables. Signed-off-by: Stefan Roese Cc: Daniel Schwierzeck Cc: Tom Rini Cc: Ramon Fried Cc: Simon Glass Cc: Michal Simek Cc: Pali Rohár --- v3: - Rebase on TOT - Add check to not overwrite bi_dram[0] if already configured in setup_bdinfo(). This fixes the test issue with Nokia RX51. Azure test report success: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=26=results v2: - Change all references to bi_memstart & bi_memsize to bi_dram[0].start/ size and remove it from the bd_info struct completely, as suggested by Daniel api/api_platform-mips.c | 4 ++-- api/api_platform-powerpc.c| 2 +- arch/mips/lib/boot.c | 2 +- arch/mips/lib/bootm.c | 2 +- arch/powerpc/cpu/mpc83xx/fdt.c| 2 +- arch/powerpc/cpu/mpc83xx/traps.c | 2 +- arch/powerpc/cpu/mpc85xx/fdt.c| 4 ++-- arch/powerpc/cpu/mpc85xx/traps.c | 2 +- arch/powerpc/cpu/mpc86xx/fdt.c| 2 +- arch/powerpc/cpu/mpc86xx/traps.c | 2 +- arch/powerpc/cpu/mpc8xx/fdt.c | 2 +- arch/powerpc/lib/bootm.c | 4 ++-- arch/x86/cpu/broadwell/cpu_from_spl.c | 2 -- arch/xtensa/lib/bdinfo.c | 4 ++-- arch/xtensa/lib/bootm.c | 4 ++-- board/Arcturus/ucp1020/spl.c | 4 ++-- board/freescale/p1010rdb/spl.c| 4 ++-- board/freescale/p1_p2_rdb_pc/spl.c| 4 ++-- board/freescale/t102xrdb/spl.c| 4 ++-- board/freescale/t104xrdb/spl.c| 4 ++-- board/freescale/t208xqds/spl.c| 4 ++-- board/freescale/t208xrdb/spl.c| 4 ++-- board/freescale/t4rdb/spl.c | 4 ++-- board/xilinx/zynqmp/zynqmp.c | 2 -- cmd/bdinfo.c | 6 ++--- cmd/bedbug.c | 2 +- common/board_f.c | 13 +-- common/image.c| 10 +--- common/init/handoff.c | 33 +++ drivers/pci/pci-uclass.c | 17 +- drivers/video/cfb_console.c | 8 +-- include/asm-generic/u-boot.h | 4 include/handoff.h | 2 -- lib/fdtdec.c | 5 lib/lmb.c | 7 -- 35 files changed, 60 insertions(+), 121 deletions(-) diff --git a/api/api_platform-mips.c b/api/api_platform-mips.c index 51cd328b3d..f1721cef19 100644 --- a/api/api_platform-mips.c +++ b/api/api_platform-mips.c @@ -24,8 +24,8 @@ DECLARE_GLOBAL_DATA_PTR; int platform_sys_info(struct sys_info *si) { - platform_set_mr(si, gd->bd->bi_memstart, - gd->bd->bi_memsize, MR_ATTR_DRAM); + platform_set_mr(si, gd->bd->bi_dram[0].start, + gd->bd->bi_dram[0].size, MR_ATTR_DRAM); return 1; } diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c index 15930cfdb6..8fff6e4cae 100644 --- a/api/api_platform-powerpc.c +++ b/api/api_platform-powerpc.c @@ -42,7 +42,7 @@ int platform_sys_info(struct sys_info *si) si->bar = 0; #endif - platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM); + platform_set_mr(si, gd->bd->bi_dram[0].start, gd->bd->bi_dram[0].size, MR_ATTR_DRAM); platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH); platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM); diff --git a/arch/mips/lib/boot.c b/arch/mips/lib/boot.c index db862f6379..3b960691c5 100644 --- a/arch/mips/lib/boot.c +++ b/arch/mips/lib/boot.c @@ -17,7 +17,7 @@ unsigned long do_go_exec(ulong (*entry)(int, char * const []), * whole SDRAM area, since we don't know the size of the image * that was loaded. */ - flush_cache(gd->bd->bi_memstart, gd->ram_top - gd->bd->bi_memstart); + flush_cache(gd->bd->bi_dram[0].start, gd->ram_top - gd->bd->bi_dram[0].start); return entry(argc, argv); } diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 0a13f6edb7..b3ef15963e 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -242,7 +242,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) int
Re: [PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
On Wednesday 12 August 2020 09:44:17 Stefan Roese wrote: > Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") & > commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"), > CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default). > It makes no sense to still carry code that is guarded with > "#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes > all these unreferenced code paths. > > Also complete remove bi_memstart & bi_memsize from the board-info > struct. As now bi_dram[] is always enabled and should be used instead. > This removes the redundant varriables. > > Signed-off-by: Stefan Roese > Cc: Daniel Schwierzeck > Cc: Tom Rini > Cc: Ramon Fried > Cc: Simon Glass > Cc: Michal Simek > Cc: Pali Rohár > --- > v3: > - Rebase on TOT > - Add check to not overwrite bi_dram[0] if already configured in > setup_bdinfo(). This fixes the test issue with Nokia RX51. > > Azure test report success: > https://dev.azure.com/sr0718/u-boot/_build/results?buildId=26=results > > v2: > - Change all references to bi_memstart & bi_memsize to bi_dram[0].start/ > size and remove it from the bd_info struct completely, as suggested by > Daniel > > api/api_platform-mips.c | 4 ++-- > api/api_platform-powerpc.c| 2 +- > arch/mips/lib/boot.c | 2 +- > arch/mips/lib/bootm.c | 2 +- > arch/powerpc/cpu/mpc83xx/fdt.c| 2 +- > arch/powerpc/cpu/mpc83xx/traps.c | 2 +- > arch/powerpc/cpu/mpc85xx/fdt.c| 4 ++-- > arch/powerpc/cpu/mpc85xx/traps.c | 2 +- > arch/powerpc/cpu/mpc86xx/fdt.c| 2 +- > arch/powerpc/cpu/mpc86xx/traps.c | 2 +- > arch/powerpc/cpu/mpc8xx/fdt.c | 2 +- > arch/powerpc/lib/bootm.c | 4 ++-- > arch/x86/cpu/broadwell/cpu_from_spl.c | 2 -- > arch/xtensa/lib/bdinfo.c | 4 ++-- > arch/xtensa/lib/bootm.c | 4 ++-- > board/Arcturus/ucp1020/spl.c | 4 ++-- > board/freescale/p1010rdb/spl.c| 4 ++-- > board/freescale/p1_p2_rdb_pc/spl.c| 4 ++-- > board/freescale/t102xrdb/spl.c| 4 ++-- > board/freescale/t104xrdb/spl.c| 4 ++-- > board/freescale/t208xqds/spl.c| 4 ++-- > board/freescale/t208xrdb/spl.c| 4 ++-- > board/freescale/t4rdb/spl.c | 4 ++-- > board/xilinx/zynqmp/zynqmp.c | 2 -- > cmd/bdinfo.c | 6 ++--- > cmd/bedbug.c | 2 +- > common/board_f.c | 13 +-- > common/image.c| 10 +--- > common/init/handoff.c | 33 +++ > drivers/pci/pci-uclass.c | 17 +- > drivers/video/cfb_console.c | 8 +-- > include/asm-generic/u-boot.h | 4 > include/handoff.h | 2 -- > lib/fdtdec.c | 5 > lib/lmb.c | 7 -- > 35 files changed, 60 insertions(+), 121 deletions(-) > > diff --git a/api/api_platform-mips.c b/api/api_platform-mips.c > index 51cd328b3d..f1721cef19 100644 > --- a/api/api_platform-mips.c > +++ b/api/api_platform-mips.c > @@ -24,8 +24,8 @@ DECLARE_GLOBAL_DATA_PTR; > int platform_sys_info(struct sys_info *si) > { > > - platform_set_mr(si, gd->bd->bi_memstart, > - gd->bd->bi_memsize, MR_ATTR_DRAM); > + platform_set_mr(si, gd->bd->bi_dram[0].start, > + gd->bd->bi_dram[0].size, MR_ATTR_DRAM); > > return 1; > } > diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c > index 15930cfdb6..8fff6e4cae 100644 > --- a/api/api_platform-powerpc.c > +++ b/api/api_platform-powerpc.c > @@ -42,7 +42,7 @@ int platform_sys_info(struct sys_info *si) > si->bar = 0; > #endif > > - platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, > MR_ATTR_DRAM); > + platform_set_mr(si, gd->bd->bi_dram[0].start, gd->bd->bi_dram[0].size, > MR_ATTR_DRAM); > platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, > MR_ATTR_FLASH); > platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, > MR_ATTR_SRAM); > > diff --git a/arch/mips/lib/boot.c b/arch/mips/lib/boot.c > index db862f6379..3b960691c5 100644 > --- a/arch/mips/lib/boot.c > +++ b/arch/mips/lib/boot.c > @@ -17,7 +17,7 @@ unsigned long do_go_exec(ulong (*entry)(int, char * const > []), >* whole SDRAM area, since we don't know the size of the image >* that was loaded. >*/ > - flush_cache(gd->bd->bi_memstart, gd->ram_top - gd->bd->bi_memstart); > + flush_cache(gd->bd->bi_dram[0].start, gd->ram_top - > gd->bd->bi_dram[0].start); > > return entry(argc, argv); > } > diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c > index 0a13f6edb7..b3ef15963e 100644 > --- a/arch/mips/lib/bootm.c > +++ b/arch/mips/lib/bootm.c > @@ -242,7 +242,7 @@ static int
[PATCH v3] CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") & commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"), CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default). It makes no sense to still carry code that is guarded with "#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes all these unreferenced code paths. Also complete remove bi_memstart & bi_memsize from the board-info struct. As now bi_dram[] is always enabled and should be used instead. This removes the redundant varriables. Signed-off-by: Stefan Roese Cc: Daniel Schwierzeck Cc: Tom Rini Cc: Ramon Fried Cc: Simon Glass Cc: Michal Simek Cc: Pali Rohár --- v3: - Rebase on TOT - Add check to not overwrite bi_dram[0] if already configured in setup_bdinfo(). This fixes the test issue with Nokia RX51. Azure test report success: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=26=results v2: - Change all references to bi_memstart & bi_memsize to bi_dram[0].start/ size and remove it from the bd_info struct completely, as suggested by Daniel api/api_platform-mips.c | 4 ++-- api/api_platform-powerpc.c| 2 +- arch/mips/lib/boot.c | 2 +- arch/mips/lib/bootm.c | 2 +- arch/powerpc/cpu/mpc83xx/fdt.c| 2 +- arch/powerpc/cpu/mpc83xx/traps.c | 2 +- arch/powerpc/cpu/mpc85xx/fdt.c| 4 ++-- arch/powerpc/cpu/mpc85xx/traps.c | 2 +- arch/powerpc/cpu/mpc86xx/fdt.c| 2 +- arch/powerpc/cpu/mpc86xx/traps.c | 2 +- arch/powerpc/cpu/mpc8xx/fdt.c | 2 +- arch/powerpc/lib/bootm.c | 4 ++-- arch/x86/cpu/broadwell/cpu_from_spl.c | 2 -- arch/xtensa/lib/bdinfo.c | 4 ++-- arch/xtensa/lib/bootm.c | 4 ++-- board/Arcturus/ucp1020/spl.c | 4 ++-- board/freescale/p1010rdb/spl.c| 4 ++-- board/freescale/p1_p2_rdb_pc/spl.c| 4 ++-- board/freescale/t102xrdb/spl.c| 4 ++-- board/freescale/t104xrdb/spl.c| 4 ++-- board/freescale/t208xqds/spl.c| 4 ++-- board/freescale/t208xrdb/spl.c| 4 ++-- board/freescale/t4rdb/spl.c | 4 ++-- board/xilinx/zynqmp/zynqmp.c | 2 -- cmd/bdinfo.c | 6 ++--- cmd/bedbug.c | 2 +- common/board_f.c | 13 +-- common/image.c| 10 +--- common/init/handoff.c | 33 +++ drivers/pci/pci-uclass.c | 17 +- drivers/video/cfb_console.c | 8 +-- include/asm-generic/u-boot.h | 4 include/handoff.h | 2 -- lib/fdtdec.c | 5 lib/lmb.c | 7 -- 35 files changed, 60 insertions(+), 121 deletions(-) diff --git a/api/api_platform-mips.c b/api/api_platform-mips.c index 51cd328b3d..f1721cef19 100644 --- a/api/api_platform-mips.c +++ b/api/api_platform-mips.c @@ -24,8 +24,8 @@ DECLARE_GLOBAL_DATA_PTR; int platform_sys_info(struct sys_info *si) { - platform_set_mr(si, gd->bd->bi_memstart, - gd->bd->bi_memsize, MR_ATTR_DRAM); + platform_set_mr(si, gd->bd->bi_dram[0].start, + gd->bd->bi_dram[0].size, MR_ATTR_DRAM); return 1; } diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c index 15930cfdb6..8fff6e4cae 100644 --- a/api/api_platform-powerpc.c +++ b/api/api_platform-powerpc.c @@ -42,7 +42,7 @@ int platform_sys_info(struct sys_info *si) si->bar = 0; #endif - platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM); + platform_set_mr(si, gd->bd->bi_dram[0].start, gd->bd->bi_dram[0].size, MR_ATTR_DRAM); platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH); platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM); diff --git a/arch/mips/lib/boot.c b/arch/mips/lib/boot.c index db862f6379..3b960691c5 100644 --- a/arch/mips/lib/boot.c +++ b/arch/mips/lib/boot.c @@ -17,7 +17,7 @@ unsigned long do_go_exec(ulong (*entry)(int, char * const []), * whole SDRAM area, since we don't know the size of the image * that was loaded. */ - flush_cache(gd->bd->bi_memstart, gd->ram_top - gd->bd->bi_memstart); + flush_cache(gd->bd->bi_dram[0].start, gd->ram_top - gd->bd->bi_dram[0].start); return entry(argc, argv); } diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 0a13f6edb7..b3ef15963e 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -242,7 +242,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) int arch_fixup_fdt(void *blob) { - u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart); + u64 mem_start = virt_to_phys((void