
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 sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com Cc: Tom Rini trini@konsulko.com Cc: Ramon Fried ramon.fried@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Michal Simek michal.simek@xilinx.com Cc: Pali Rohár pali@kernel.org
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&view=resul...
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 *)gd->bd->bi_dram[0].start); u64 mem_size = gd->ram_size;
return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1);
diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c index ebdedb2888..05523ecc67 100644 --- a/arch/powerpc/cpu/mpc83xx/fdt.c +++ b/arch/powerpc/cpu/mpc83xx/fdt.c @@ -121,7 +121,7 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) "clock-frequency", get_serial_clock(), 1); #endif
- fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- fdt_fixup_memory(blob, (u64)bd->bi_dram[0].start, (u64)bd->bi_dram[0].size);
#if defined(CONFIG_BOOTCOUNT_LIMIT) && \ (defined(CONFIG_QE) && !defined(CONFIG_ARCH_MPC831X)) diff --git a/arch/powerpc/cpu/mpc83xx/traps.c b/arch/powerpc/cpu/mpc83xx/traps.c index c3cc119d65..5a8cd36420 100644 --- a/arch/powerpc/cpu/mpc83xx/traps.c +++ b/arch/powerpc/cpu/mpc83xx/traps.c @@ -23,7 +23,7 @@ DECLARE_GLOBAL_DATA_PTR; /* Returns 0 if exception not found and fixup otherwise. */ extern unsigned long search_exception_table(unsigned long);
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize) +#define END_OF_MEM (gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size)
/*
- Trap & Exception support
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c index 9569c1a64b..2cc567a5f4 100644 --- a/arch/powerpc/cpu/mpc85xx/fdt.c +++ b/arch/powerpc/cpu/mpc85xx/fdt.c @@ -672,10 +672,10 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) "clock-frequency", get_bus_freq(0), 1); #endif
- fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- fdt_fixup_memory(blob, (u64)bd->bi_dram[0].start, (u64)bd->bi_dram[0].size);
#ifdef CONFIG_MP
- ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);
- ft_fixup_cpu(blob, (u64)bd->bi_dram[0].start + (u64)bd->bi_dram[0].size); ft_fixup_num_cores(blob);
#endif
diff --git a/arch/powerpc/cpu/mpc85xx/traps.c b/arch/powerpc/cpu/mpc85xx/traps.c index f37a45e269..061b7b8f6e 100644 --- a/arch/powerpc/cpu/mpc85xx/traps.c +++ b/arch/powerpc/cpu/mpc85xx/traps.c @@ -37,7 +37,7 @@ extern unsigned long search_exception_table(unsigned long);
- amount of memory on the system if we're unable to keep all
- the memory mapped in.
*/ -#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize()) +#define END_OF_MEM (gd->bd->bi_dram[0].start + get_effective_memsize())
static __inline__ void set_tsr(unsigned long val) { diff --git a/arch/powerpc/cpu/mpc86xx/fdt.c b/arch/powerpc/cpu/mpc86xx/fdt.c index 24e53115ec..143575befd 100644 --- a/arch/powerpc/cpu/mpc86xx/fdt.c +++ b/arch/powerpc/cpu/mpc86xx/fdt.c @@ -27,7 +27,7 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) do_fixup_by_prop_u32(blob, "device_type", "soc", 4, "bus-frequency", bd->bi_busfreq, 1);
- fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- fdt_fixup_memory(blob, (u64)bd->bi_dram[0].start, (u64)bd->bi_dram[0].size);
#ifdef CONFIG_SYS_NS16550 do_fixup_by_compat_u32(blob, "ns16550", diff --git a/arch/powerpc/cpu/mpc86xx/traps.c b/arch/powerpc/cpu/mpc86xx/traps.c index c0161e3379..532df93c3c 100644 --- a/arch/powerpc/cpu/mpc86xx/traps.c +++ b/arch/powerpc/cpu/mpc86xx/traps.c @@ -30,7 +30,7 @@ extern unsigned long search_exception_table(unsigned long);
- amount of memory on the system if we're unable to keep all
- the memory mapped in.
*/ -#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize()) +#define END_OF_MEM (gd->bd->bi_dram[0].start + get_effective_memsize())
/*
- Trap & Exception support
diff --git a/arch/powerpc/cpu/mpc8xx/fdt.c b/arch/powerpc/cpu/mpc8xx/fdt.c index 4d952a3882..e593242631 100644 --- a/arch/powerpc/cpu/mpc8xx/fdt.c +++ b/arch/powerpc/cpu/mpc8xx/fdt.c @@ -25,5 +25,5 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) do_fixup_by_compat_u32(blob, "fsl,cpm-brg", "clock-frequency", gd->arch.brg_clk, 1);
- fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- fdt_fixup_memory(blob, (u64)bd->bi_dram[0].start, (u64)bd->bi_dram[0].size);
} diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 8c8ed99cd3..d8bf5a14f6 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -298,8 +298,8 @@ void boot_prep_vxworks(bootm_headers_t *images) if (!images->ft_addr) return;
- base = (u64)gd->bd->bi_memstart;
- size = (u64)gd->bd->bi_memsize;
base = (u64)gd->bd->bi_dram[0].start;
size = (u64)gd->bd->bi_dram[0].size;
off = fdt_path_offset(images->ft_addr, "/memory"); if (off < 0)
diff --git a/arch/x86/cpu/broadwell/cpu_from_spl.c b/arch/x86/cpu/broadwell/cpu_from_spl.c index 6567d50653..4d4cdafa2b 100644 --- a/arch/x86/cpu/broadwell/cpu_from_spl.c +++ b/arch/x86/cpu/broadwell/cpu_from_spl.c @@ -53,14 +53,12 @@ void board_debug_uart_init(void)
int dram_init_banksize(void) { -#ifdef CONFIG_NR_DRAM_BANKS struct spl_handoff *ho;
ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho)); if (!ho) return log_msg_ret("Missing SPL hand-off info", -ENOENT); handoff_load_dram_banks(ho); -#endif
return 0; } diff --git a/arch/xtensa/lib/bdinfo.c b/arch/xtensa/lib/bdinfo.c index 4ec8529521..1839edd9bb 100644 --- a/arch/xtensa/lib/bdinfo.c +++ b/arch/xtensa/lib/bdinfo.c @@ -15,8 +15,8 @@ int arch_setup_bdinfo(void) { struct bd_info *bd = gd->bd;
- bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
- bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
bd->bi_dram[0].start = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
bd->bi_dram[0].size = CONFIG_SYS_SDRAM_SIZE;
return 0;
} diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c index 458eaf95c0..16ab51dbc9 100644 --- a/arch/xtensa/lib/bootm.c +++ b/arch/xtensa/lib/bootm.c @@ -48,8 +48,8 @@ static struct bp_tag *setup_memory_tag(struct bp_tag *params) params->size = sizeof(struct meminfo); mem = (struct meminfo *)params->data; mem->type = MEMORY_TYPE_CONVENTIONAL;
- mem->start = bd->bi_memstart;
- mem->end = bd->bi_memstart + bd->bi_memsize;
mem->start = bd->bi_dram[0].start;
mem->end = bd->bi_dram[0].start + bd->bi_dram[0].size;
printf(" MEMORY: tag:0x%04x, type:0X%lx, start:0X%lx, end:0X%lx\n", BP_TAG_MEMORY, mem->type, mem->start, mem->end);
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c index 5416a5b663..8eb641ef8d 100644 --- a/board/Arcturus/ucp1020/spl.c +++ b/board/Arcturus/ucp1020/spl.c @@ -83,8 +83,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
- bd->bi_memsize = CONFIG_SYS_L2_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L2_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c index 4ee4573d2b..ddc0af3faa 100644 --- a/board/freescale/p1010rdb/spl.c +++ b/board/freescale/p1010rdb/spl.c @@ -69,8 +69,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
- bd->bi_memsize = CONFIG_SYS_L2_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L2_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c index e76c3e82c3..f67b0fcbb9 100644 --- a/board/freescale/p1_p2_rdb_pc/spl.c +++ b/board/freescale/p1_p2_rdb_pc/spl.c @@ -75,8 +75,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
- bd->bi_memsize = CONFIG_SYS_L2_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L2_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L2_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c index da442fcc18..ce7ccfe41d 100644 --- a/board/freescale/t102xrdb/spl.c +++ b/board/freescale/t102xrdb/spl.c @@ -103,8 +103,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(gd + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
- bd->bi_memsize = CONFIG_SYS_L3_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L3_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c index f83d69ba15..4b5fb8b955 100644 --- a/board/freescale/t104xrdb/spl.c +++ b/board/freescale/t104xrdb/spl.c @@ -94,8 +94,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(gd + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
- bd->bi_memsize = CONFIG_SYS_L3_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L3_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c index c197884421..dc0046d93c 100644 --- a/board/freescale/t208xqds/spl.c +++ b/board/freescale/t208xqds/spl.c @@ -102,8 +102,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(gd + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
- bd->bi_memsize = CONFIG_SYS_L3_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L3_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c index 07aab6349c..f523622de9 100644 --- a/board/freescale/t208xrdb/spl.c +++ b/board/freescale/t208xrdb/spl.c @@ -72,8 +72,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(gd + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
- bd->bi_memsize = CONFIG_SYS_L3_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L3_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c index 64d2753da8..a5351e813a 100644 --- a/board/freescale/t4rdb/spl.c +++ b/board/freescale/t4rdb/spl.c @@ -75,8 +75,8 @@ void board_init_r(gd_t *gd, ulong dest_addr) bd = (struct bd_info *)(gd + sizeof(gd_t)); memset(bd, 0, sizeof(struct bd_info)); gd->bd = bd;
- bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
- bd->bi_memsize = CONFIG_SYS_L3_SIZE;
bd->bi_dram[0].start = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_dram[0].size = CONFIG_SYS_L3_SIZE;
arch_cpu_init(); get_clocks();
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index ebb7172908..4cc5cb6fd7 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -467,10 +467,8 @@ int dram_init(void) #else int dram_init_banksize(void) { -#if defined(CONFIG_NR_DRAM_BANKS) gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = get_effective_memsize(); -#endif
mem_map_fill();
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 9593b345a3..117788dade 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -49,7 +49,6 @@ void bdinfo_print_mhz(const char *name, unsigned long hz)
static void print_bi_dram(const struct bd_info *bd) { -#ifdef CONFIG_NR_DRAM_BANKS int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { @@ -59,7 +58,6 @@ static void print_bi_dram(const struct bd_info *bd) bdinfo_print_num("-> size", bd->bi_dram[i].size); } } -#endif }
__weak void arch_print_bdinfo(void) @@ -75,8 +73,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #endif bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params); print_bi_dram(bd);
- bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
- print_phys_addr("memsize", bd->bi_memsize);
- bdinfo_print_num("memstart", (ulong)bd->bi_dram[0].start);
- print_phys_addr("memsize", bd->bi_dram[0].size);
this would be redundant because the DRAM banks are already printed in print_bi_dram() above. You could just remove these two lines.