Skip to contentSkip to conversation

Remove CONFIG_NR_DRAM_BANKS option and bi_memstart/memsize from bd_info

PATCH Superseded Stefan Roese 8 participants 29 messages Aug 13, 2020 – Aug 21, 2020

Subsystems (9)
x86 PowerPC PCI Library code +5 more subsystems

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover Remove CONFIG_NR_DRAM_BANKS option and bi_memstart/memsize from bd_info

This patchset is an extension of the previous single patch "CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined". With a split into separate patches, its hopefully easier to understand, what is changed.

The earlier patch versions tried a simple search and replace of the bi_memstart / bi_memsize values with bi_dram[].start/.size. This did not work. This patchset now removes some of the assignments and changes in most cases to gd->ram_base/ram_size instead, which seems a better choice.

Thanks,
Stefan

Changes in v4:
- Only remove dead code with CONFIG_NR_DRAM_BANKS always defined
- New patch
- New patch
- New patch
- New patch
- New patch
- New patch
- New patch
- New patch

Stefan Roese (9):
CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
image: Use gd->ram_base/_size in env_get_bootm_size()
board_f: Add default values for bi_dram[] in dram_init_banksize()
global: Move from bi_memstart/memsize -> gd->ram_base/ram_size
xtensa: Remove arch_setup_bdinfo()
video: cfb_console.c: Use bi_dram[] values on all platforms
powerpc: Remove bi_memstart & bi_memsize assignments in spl.c
cmd: bdinfo: Remove print of superseeded bi_memstart / bi_memsize
values
asm-generic/u-boot.h: Remove bi_memstart & bi_memsize from bd_info

 api/api_platform-mips.c               |  3 +--
 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        |  4 +++-
 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/Makefile              |  2 +-
 arch/xtensa/lib/bdinfo.c              | 22 ------------------
 arch/xtensa/lib/bootm.c               |  5 ++--
 board/Arcturus/ucp1020/spl.c          |  2 --
 board/freescale/p1010rdb/spl.c        |  2 --
 board/freescale/p1_p2_rdb_pc/spl.c    |  2 --
 board/freescale/t102xrdb/spl.c        |  2 --
 board/freescale/t104xrdb/spl.c        |  2 --
 board/freescale/t208xqds/spl.c        |  2 --
 board/freescale/t208xrdb/spl.c        |  2 --
 board/freescale/t4rdb/spl.c           |  2 --
 board/xilinx/zynqmp/zynqmp.c          |  2 --
 cmd/bdinfo.c                          | 10 --------
 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                             |  9 ++------
 36 files changed, 43 insertions(+), 150 deletions(-)
 delete mode 100644 arch/xtensa/lib/bdinfo.c
Signature · 1 line
2.28.0
#1 lore raw

PATCH v4 1/9 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.

---

Changes in v4:
- Only remove dead code with CONFIG_NR_DRAM_BANKS always defined

 arch/x86/cpu/broadwell/cpu_from_spl.c |  2 --
 board/xilinx/zynqmp/zynqmp.c          |  2 --
 cmd/bdinfo.c                          |  2 --
 common/board_f.c                      |  7 +-----
 common/image.c                        |  3 +--
 common/init/handoff.c                 | 33 +++++++++++----------------
 drivers/pci/pci-uclass.c              | 17 +-------------
 include/asm-generic/u-boot.h          |  2 --
 include/handoff.h                     |  2 --
 lib/fdtdec.c                          |  5 ----
 lib/lmb.c                             |  9 ++------
 11 files changed, 18 insertions(+), 66 deletions(-)
arch/x86/cpu/broadwell/cpu_from_spl.c +0 -2
index 6567d50653..4d4cdafa2b 100644
@@ -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;
 }
board/xilinx/zynqmp/zynqmp.c +0 -2
index ebb7172908..4cc5cb6fd7 100644
@@ -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();
 
cmd/bdinfo.c +0 -2
index 9593b345a3..9e230f23cb 100644
@@ -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)
common/board_f.c +1 -6
index 79532f4365..dd9a5220e1 100644
@@ -215,8 +215,6 @@ static int announce_dram_init(void)
 static int show_dram_config(void)
 {
 	unsigned long long size;
-
-#ifdef CONFIG_NR_DRAM_BANKS
 	int i;
 
 	debug("\nRAM Configuration:\n");
@@ -229,9 +227,6 @@ static int show_dram_config(void)
 #endif
 	}
 	debug("\nDRAM:  ");
-#else
-	size = gd->ram_size;
-#endif
 
 	print_size(size, "");
 	board_add_ram_info(0);
@@ -242,7 +237,7 @@ static int show_dram_config(void)
 
 __weak int dram_init_banksize(void)
 {
-#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
+#if defined(CONFIG_SYS_SDRAM_BASE)
 	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
 	gd->bd->bi_dram[0].size = get_effective_memsize();
 #endif
common/image.c +1 -2
index 9d7d5c17d1..2ed46f7685 100644
@@ -685,8 +685,7 @@ phys_size_t env_get_bootm_size(void)
 		return tmp;
 	}
 
-#if (defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)) && \
-     defined(CONFIG_NR_DRAM_BANKS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)
 	start = gd->bd->bi_dram[0].start;
 	size = gd->bd->bi_dram[0].size;
 #else
common/init/handoff.c +13 -20
index e00b43e6a7..62071bd017 100644
@@ -12,18 +12,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void handoff_save_dram(struct spl_handoff *ho)
 {
+	struct bd_info *bd = gd->bd;
+	int i;
+
 	ho->ram_size = gd->ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
-	{
-		struct bd_info *bd = gd->bd;
-		int i;
-
-		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-			ho->ram_bank[i].start = bd->bi_dram[i].start;
-			ho->ram_bank[i].size = bd->bi_dram[i].size;
-		}
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		ho->ram_bank[i].start = bd->bi_dram[i].start;
+		ho->ram_bank[i].size = bd->bi_dram[i].size;
 	}
-#endif
 }
 
 void handoff_load_dram_size(struct spl_handoff *ho)
@@ -33,15 +30,11 @@ void handoff_load_dram_size(struct spl_handoff *ho)
 
 void handoff_load_dram_banks(struct spl_handoff *ho)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
-	{
-		struct bd_info *bd = gd->bd;
-		int i;
-
-		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-			bd->bi_dram[i].start = ho->ram_bank[i].start;
-			bd->bi_dram[i].size = ho->ram_bank[i].size;
-		}
+	struct bd_info *bd = gd->bd;
+	int i;
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		bd->bi_dram[i].start = ho->ram_bank[i].start;
+		bd->bi_dram[i].size = ho->ram_bank[i].size;
 	}
-#endif
 }
drivers/pci/pci-uclass.c +1 -16
index 834526c5a4..69fb46d3f4 100644
@@ -871,6 +871,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 			   ofnode node)
 {
 	int pci_addr_cells, addr_cells, size_cells;
+	struct bd_info *bd = gd->bd;
 	int cells_per_record;
 	const u32 *prop;
 	int len;
@@ -938,9 +939,6 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 	}
 
 	/* Add a region for our local memory */
-#ifdef CONFIG_NR_DRAM_BANKS
-	struct bd_info *bd = gd->bd;
-
 	if (!bd)
 		return;
 
@@ -958,19 +956,6 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 				       PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 		}
 	}
-#else
-	phys_addr_t base = 0, size;
-
-	size = gd->ram_size;
-#ifdef CONFIG_SYS_SDRAM_BASE
-	base = CONFIG_SYS_SDRAM_BASE;
-#endif
-	if (gd->pci_ram_top && gd->pci_ram_top < base + size)
-		size = gd->pci_ram_top - base;
-	if (size)
-		pci_set_region(hose->regions + hose->region_count++, base,
-			base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-#endif
 
 	return;
 }
include/asm-generic/u-boot.h +0 -2
index 62e61d41cc..99d3fe33ad 100644
@@ -70,12 +70,10 @@ struct bd_info {
 #endif
 	ulong	        bi_arch_number;	/* unique id for this board */
 	ulong	        bi_boot_params;	/* where this board expects params */
-#ifdef CONFIG_NR_DRAM_BANKS
 	struct {			/* RAM configuration */
 		phys_addr_t start;
 		phys_size_t size;
 	} bi_dram[CONFIG_NR_DRAM_BANKS];
-#endif /* CONFIG_NR_DRAM_BANKS */
 };
 
 #endif /* __ASSEMBLY__ */
include/handoff.h +0 -2
index 75d19b1f6e..070a79c1b9 100644
@@ -20,12 +20,10 @@
 struct spl_handoff {
 	struct arch_spl_handoff arch;
 	u64 ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
 	struct {
 		u64 start;
 		u64 size;
 	} ram_bank[CONFIG_NR_DRAM_BANKS];
-#endif
 };
 
 void handoff_save_dram(struct spl_handoff *ho);
lib/fdtdec.c +0 -5
index 78576b530f..ecbf10121d 100644
@@ -1055,8 +1055,6 @@ int fdtdec_setup_mem_size_base(void)
 	return 0;
 }
 
-#if defined(CONFIG_NR_DRAM_BANKS)
-
 static int get_next_memory_node(const void *blob, int mem)
 {
 	do {
@@ -1106,7 +1104,6 @@ int fdtdec_setup_memory_banksize(void)
 
 	return 0;
 }
-#endif
 
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\
@@ -1569,7 +1566,6 @@ int fdtdec_resetup(int *rescan)
 }
 #endif
 
-#ifdef CONFIG_NR_DRAM_BANKS
 int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 			   phys_addr_t *basep, phys_size_t *sizep,
 			   struct bd_info *bd)
@@ -1675,6 +1671,5 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 
 	return 0;
 }
-#endif /* CONFIG_NR_DRAM_BANKS */
 
 #endif /* !USE_HOSTCC */
lib/lmb.c +2 -7
index 75082f3559..d126f8dc04 100644
@@ -117,22 +117,17 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
 /* Initialize the struct, add memory and call arch/board reserve functions */
 void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
 	int i;
-#endif
 
 	lmb_init(lmb);
-#ifdef CONFIG_NR_DRAM_BANKS
+
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
 		if (bd->bi_dram[i].size) {
 			lmb_add(lmb, bd->bi_dram[i].start,
 				bd->bi_dram[i].size);
 		}
 	}
-#else
-	if (bd->bi_memsize)
-		lmb_add(lmb, bd->bi_memstart, bd->bi_memsize);
-#endif
+
 	lmb_reserve_common(lmb, fdt_blob);
 }
 
Signature · 1 line
2.28.0
#2 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Quoted 8 lines · On Thursday 13 August 2020 07:47:52 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.

Looks good for me, you can add my:

#3 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

In reply to Stefan Roese
Quoted 6 lines · 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.

...

Review

Quoted 11 lines
(quoted diff) +1 -3
 	int pci_addr_cells, addr_cells, size_cells;
+	struct bd_info *bd = gd->bd;
 	int cells_per_record;
 	const u32 *prop;
 	int len;
 
 	/* Add a region for our local memory */
 
-#ifdef CONFIG_NR_DRAM_BANKS
-	struct bd_info *bd = gd->bd;
-

Can we leave assignment here?

Quoted 2 lines
drivers/pci/pci-uclass.c +0 -0
 	if (!bd)
 		return;
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Quoted 16 lines · Andy Shevchenko
Quoted 6 lines · 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.

...

Quoted 5 lines

int pci_addr_cells, addr_cells, size_cells;

drivers/pci/pci-uclass.c +1 -0
+	struct bd_info *bd = gd->bd;
  	int cells_per_record;
  	const u32 *prop;
  	int len;
Quoted 7 lines

common/init/handoff.c DECLARE_GLOBAL_DATA_PTR; · line 20

Quoted 5 lines

/* Add a region for our local memory */

common/init/handoff.c +0 -3
-#ifdef CONFIG_NR_DRAM_BANKS
-	struct bd_info *bd = gd->bd;
-

Can we leave assignment here?

Sure. Just curious why? Is it recommended not to make the assignment with the declaration?

Thanks,
Stefan

#5 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Quoted 19 lines · Stefan Roese
Quoted 18 lines · Andy Shevchenko
Quoted 6 lines · 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.

...

Quoted 7 lines

int pci_addr_cells, addr_cells, size_cells;

drivers/pci/pci-uclass.c +1 -0
+	struct bd_info *bd = gd->bd;
  	int cells_per_record;
  	const u32 *prop;
  	int len;
 
  	/* Add a region for our local memory */
Quoted 8 lines
Quoted 5 lines

common/init/handoff.c DECLARE_GLOBAL_DATA_PTR; · line 20

Quoted 3 lines
common/init/handoff.c +0 -3
-#ifdef CONFIG_NR_DRAM_BANKS
-	struct bd_info *bd = gd->bd;
-

Can we leave assignment here?

Sure. Just curious why? Is it recommended not to make the assignment with the declaration?

Slightly easier to read and understand the code. I find it's hard when you need to spend additional 1,2...10 seconds to go around and see where this value comes from. Easy question to ask when you see such code: is this parameter evaluation (defensive programming) or some assignment happened earlier to check?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

In reply to Stefan Roese
Quoted 6 lines · 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.

I don't see any other patches, this one, after addressing the assignment position,

Quoted 316 lines

---

Changes in v4:
- Only remove dead code with CONFIG_NR_DRAM_BANKS always defined

 arch/x86/cpu/broadwell/cpu_from_spl.c |  2 --
 board/xilinx/zynqmp/zynqmp.c          |  2 --
 cmd/bdinfo.c                          |  2 --
 common/board_f.c                      |  7 +-----
 common/image.c                        |  3 +--
 common/init/handoff.c                 | 33 +++++++++++----------------
 drivers/pci/pci-uclass.c              | 17 +-------------
 include/asm-generic/u-boot.h          |  2 --
 include/handoff.h                     |  2 --
 lib/fdtdec.c                          |  5 ----
 lib/lmb.c                             |  9 ++------
 11 files changed, 18 insertions(+), 66 deletions(-)
arch/x86/cpu/broadwell/cpu_from_spl.c +0 -2
index 6567d50653..4d4cdafa2b 100644
@@ -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;
 }
board/xilinx/zynqmp/zynqmp.c +0 -2
index ebb7172908..4cc5cb6fd7 100644
@@ -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();
 
cmd/bdinfo.c +0 -2
index 9593b345a3..9e230f23cb 100644
@@ -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)
common/board_f.c +1 -6
index 79532f4365..dd9a5220e1 100644
@@ -215,8 +215,6 @@ static int announce_dram_init(void)
 static int show_dram_config(void)
 {
 	unsigned long long size;
-
-#ifdef CONFIG_NR_DRAM_BANKS
 	int i;
 
 	debug("\nRAM Configuration:\n");
@@ -229,9 +227,6 @@ static int show_dram_config(void)
 #endif
 	}
 	debug("\nDRAM:  ");
-#else
-	size = gd->ram_size;
-#endif
 
 	print_size(size, "");
 	board_add_ram_info(0);
@@ -242,7 +237,7 @@ static int show_dram_config(void)
 
 __weak int dram_init_banksize(void)
 {
-#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
+#if defined(CONFIG_SYS_SDRAM_BASE)
 	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
 	gd->bd->bi_dram[0].size = get_effective_memsize();
 #endif
common/image.c +1 -2
index 9d7d5c17d1..2ed46f7685 100644
@@ -685,8 +685,7 @@ phys_size_t env_get_bootm_size(void)
 		return tmp;
 	}
 
-#if (defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)) && \
-     defined(CONFIG_NR_DRAM_BANKS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)
 	start = gd->bd->bi_dram[0].start;
 	size = gd->bd->bi_dram[0].size;
 #else
common/init/handoff.c +13 -20
index e00b43e6a7..62071bd017 100644
@@ -12,18 +12,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void handoff_save_dram(struct spl_handoff *ho)
 {
+	struct bd_info *bd = gd->bd;
+	int i;
+
 	ho->ram_size = gd->ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
-	{
-		struct bd_info *bd = gd->bd;
-		int i;
-
-		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-			ho->ram_bank[i].start = bd->bi_dram[i].start;
-			ho->ram_bank[i].size = bd->bi_dram[i].size;
-		}
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		ho->ram_bank[i].start = bd->bi_dram[i].start;
+		ho->ram_bank[i].size = bd->bi_dram[i].size;
 	}
-#endif
 }
 
 void handoff_load_dram_size(struct spl_handoff *ho)
@@ -33,15 +30,11 @@ void handoff_load_dram_size(struct spl_handoff *ho)
 
 void handoff_load_dram_banks(struct spl_handoff *ho)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
-	{
-		struct bd_info *bd = gd->bd;
-		int i;
-
-		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-			bd->bi_dram[i].start = ho->ram_bank[i].start;
-			bd->bi_dram[i].size = ho->ram_bank[i].size;
-		}
+	struct bd_info *bd = gd->bd;
+	int i;
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		bd->bi_dram[i].start = ho->ram_bank[i].start;
+		bd->bi_dram[i].size = ho->ram_bank[i].size;
 	}
-#endif
 }
drivers/pci/pci-uclass.c +1 -16
index 834526c5a4..69fb46d3f4 100644
@@ -871,6 +871,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 			   ofnode node)
 {
 	int pci_addr_cells, addr_cells, size_cells;
+	struct bd_info *bd = gd->bd;
 	int cells_per_record;
 	const u32 *prop;
 	int len;
@@ -938,9 +939,6 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 	}
 
 	/* Add a region for our local memory */
-#ifdef CONFIG_NR_DRAM_BANKS
-	struct bd_info *bd = gd->bd;
-
 	if (!bd)
 		return;
 
@@ -958,19 +956,6 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 				       PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 		}
 	}
-#else
-	phys_addr_t base = 0, size;
-
-	size = gd->ram_size;
-#ifdef CONFIG_SYS_SDRAM_BASE
-	base = CONFIG_SYS_SDRAM_BASE;
-#endif
-	if (gd->pci_ram_top && gd->pci_ram_top < base + size)
-		size = gd->pci_ram_top - base;
-	if (size)
-		pci_set_region(hose->regions + hose->region_count++, base,
-			base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-#endif
 
 	return;
 }
include/asm-generic/u-boot.h +0 -2
index 62e61d41cc..99d3fe33ad 100644
@@ -70,12 +70,10 @@ struct bd_info {
 #endif
 	ulong	        bi_arch_number;	/* unique id for this board */
 	ulong	        bi_boot_params;	/* where this board expects params */
-#ifdef CONFIG_NR_DRAM_BANKS
 	struct {			/* RAM configuration */
 		phys_addr_t start;
 		phys_size_t size;
 	} bi_dram[CONFIG_NR_DRAM_BANKS];
-#endif /* CONFIG_NR_DRAM_BANKS */
 };
 
 #endif /* __ASSEMBLY__ */
include/handoff.h +0 -2
index 75d19b1f6e..070a79c1b9 100644
@@ -20,12 +20,10 @@
 struct spl_handoff {
 	struct arch_spl_handoff arch;
 	u64 ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
 	struct {
 		u64 start;
 		u64 size;
 	} ram_bank[CONFIG_NR_DRAM_BANKS];
-#endif
 };
 
 void handoff_save_dram(struct spl_handoff *ho);
lib/fdtdec.c +0 -5
index 78576b530f..ecbf10121d 100644
@@ -1055,8 +1055,6 @@ int fdtdec_setup_mem_size_base(void)
 	return 0;
 }
 
-#if defined(CONFIG_NR_DRAM_BANKS)
-
 static int get_next_memory_node(const void *blob, int mem)
 {
 	do {
@@ -1106,7 +1104,6 @@ int fdtdec_setup_memory_banksize(void)
 
 	return 0;
 }
-#endif
 
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\
@@ -1569,7 +1566,6 @@ int fdtdec_resetup(int *rescan)
 }
 #endif
 
-#ifdef CONFIG_NR_DRAM_BANKS
 int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 			   phys_addr_t *basep, phys_size_t *sizep,
 			   struct bd_info *bd)
@@ -1675,6 +1671,5 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 
 	return 0;
 }
-#endif /* CONFIG_NR_DRAM_BANKS */
 
 #endif /* !USE_HOSTCC */
lib/lmb.c +2 -7
index 75082f3559..d126f8dc04 100644
@@ -117,22 +117,17 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
 /* Initialize the struct, add memory and call arch/board reserve functions */
 void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
 	int i;
-#endif
 
 	lmb_init(lmb);
-#ifdef CONFIG_NR_DRAM_BANKS
+
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
 		if (bd->bi_dram[i].size) {
 			lmb_add(lmb, bd->bi_dram[i].start,
 				bd->bi_dram[i].size);
 		}
 	}
-#else
-	if (bd->bi_memsize)
-		lmb_add(lmb, bd->bi_memstart, bd->bi_memsize);
-#endif
+
 	lmb_reserve_common(lmb, fdt_blob);
 }
 
Signature · 1 line
2.28.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

In reply to Stefan Roese

Dear Stefan Roese,

Quoted 3 lines · In message <[email protected]> you 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).

Has there been any evaluation about the impact this change had on both text and data sizes of the resulting U-Boot image? Especially the default value of 4 makes no sense to me - whiy is this not 1?

Quoted 3 lines

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.

...thus futher hiding where we just lost another lof of memory, for no advantage.

Sic...

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If programming was easy, they wouldn't need something as  complicated
as a human being to do it, now would they?
                       - L. Wall & R. L. Schwartz, _Programming Perl_
#8 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Hi Wolfgang,

(added Ramon to Cc)

Quoted 7 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you 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).

Has there been any evaluation about the impact this change had on both text and data sizes of the resulting U-Boot image?

Not sure. Ramon and / or Tom might comment on this. Even though the git history shows that these Kconfig migration patches have been committed ~2 years ago, so their memory might be foggy ;)

commit 86cf1c82850f7c226f23684e19616e526ffaf10f

Author: Tom Rini <[email protected]>
Date:   Thu Aug 16 08:16:24 2018 -0400

configs: Migrate CONFIG_NR_DRAM_BANKS

We have the following cases:
- CONFIG_NR_DRAM_BANKS was defined, migrate normally
- CONFIG_NR_DRAM_BANKS_MAX was defined and then used for CONFIG_NR_DRAM_BANKS after a check, just migrate it over now.
- CONFIG_NR_DRAM_BANKS was very oddly defined on p2771-0000-* (to
1024 +
2), set this to 8.

commit 999a772d9f24bf9b8d0726e1359c9d8c3bdad72e

Author: Ramon Fried <[email protected]>
Date:   Tue Aug 14 01:00:04 2018 +0300

Kconfig: Migrate CONFIG_NR_DRAM_BANKS

Move CONFIG_NR_DRAM_BANKS from headers to Kconfig.

Quoted 2 lines

Especially the default value of 4 makes no sense to me - whiy is this not 1?

I can't really tell. I can only assume, that it originates from this patch:

commit 6b6f216f9234c33881af05116057c902cb411a62

Author: Ramon Fried <[email protected]>
Date:   Tue Aug 14 00:35:42 2018 +0300

fdt_support: Use CONFIG_NR_DRAM_BANKS if necessary

If CONFIG_NR_DRAM_BANKS is bigger than the default value (4) define MEMORY_BANKS_MAX as CONFIG_NR_DRAM_BANKS.

Fixes 2a1f4f1758b5 ("Revert "fdt_support: Use CONFIG_NR_DRAM_BANKS

if defined"")

Quoted 8 lines
Quoted 3 lines

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.

...thus futher hiding where we just lost another lof of memory, for no advantage.

Sic...

I'm not sure, what you mean with "lost lot of memory"? We carried referenced code for ~2 years, which this patch series now tries to solve.

Thanks,
Stefan

#9 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Dear Stefan,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Especially the default value of 4 makes no sense to me - whiy is this not 1?

I can't really tell. I can only assume, that it originates from this patch:

Yes, probably.

I think the issue here resutlsfromt he fact that those who worked on the patches came primarily from architectures where this array of banks has been used; for Power Architecture systems this has (for a long, long time) not been the case - there we would map several memory banks (after determining their respecitve sizes) into one contiguous area of memory starting at address 0.

So on all such system the definition of this array meand code and data overhead, as it is not needed.

Quoted 8 lines
Quoted 4 lines

...thus futher hiding where we just lost another lof of memory, for no advantage.

Sic...

I'm not sure, what you mean with "lost lot of memory"? We carried referenced code for ~2 years, which this patch series now tries to solve.

See above. On most PPC systems this array of sizes and addresses is not needed at all, and _if_ code is changed to use such an array, it should not waste even more memory be defining room for 4 banks where there usually will be only one.

Sorry, I know that you are not to blame for that...

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Make it right before you make it faster.
#10 lore raw

PATCH v4 1/9 CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

In reply to Wolfgang Denk
Quoted 11 lines · Wolfgang Denk

Dear Stefan Roese,

Quoted 3 lines · In message <[email protected]> you 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).

Has there been any evaluation about the impact this change had on both text and data sizes of the resulting U-Boot image? Especially the default value of 4 makes no sense to me - whiy is this not 1?

The default value is 4 because that was the most commonly used value. Annoyingly enough, I don't have those logs around (either I did them on Google Compute, or it was on a build box we reinstalled and I didn't save the logs off of) but I'm fairly sure there wasn't a size change, that's one of my tests for these migrations (that does sometimes fail to catch things, I need to play with getting the data out of buildman in something I can filter more easily).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200818/92167e80/attachment.sig>
#11 lore raw

PATCH v4 2/9 image: Use gd->ram_base/_size in env_get_bootm_size()

In reply to Stefan Roese

Use only gd->ram_base/_size in env_get_bootm_size() instead of bi_dram[] in some cases and bi_memstart in others.

---

Changes in v4:
- New patch

 common/image.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
common/image.c +2 -7
index 2ed46f7685..6f68b13fce 100644
@@ -685,13 +685,8 @@ phys_size_t env_get_bootm_size(void)
 		return tmp;
 	}
 
-#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)
-	start = gd->bd->bi_dram[0].start;
-	size = gd->bd->bi_dram[0].size;
-#else
-	start = gd->bd->bi_memstart;
-	size = gd->bd->bi_memsize;
-#endif
+	start = gd->ram_base;
+	size = gd->ram_size;
 
 	s = env_get("bootm_low");
 	if (s)
Signature · 1 line
2.28.0
#12 lore raw

PATCH v4 3/9 board_f: Add default values for bi_dram[] in dram_init_banksize()

In reply to Stefan Roese

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and make sure, that bd_dram[] is always configured in the weak default implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is not set.

---

Changes in v4:
- New patch

 common/board_f.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
common/board_f.c +3 -3
index dd9a5220e1..bfbeda29b2 100644
@@ -240,6 +240,9 @@ __weak int dram_init_banksize(void)
 #if defined(CONFIG_SYS_SDRAM_BASE)
 	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
 	gd->bd->bi_dram[0].size = get_effective_memsize();
+#else
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
 #endif
 
 	return 0;
@@ -602,9 +605,6 @@ 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 */
-
 	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
 		bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
 		bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */
Signature · 1 line
2.28.0
#13 lore raw

PATCH v4 4/9 global: Move from bi_memstart/memsize -> gd->ram_base/ram_size

In reply to Stefan Roese

With the removal of bi_memstart & bi_memsize, this patch now moves the references to the better suiting gd->ram_base/ram_size variables.

---

Changes in v4:
- New patch

 api/api_platform-mips.c          | 3 +--
 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   | 4 +++-
 arch/powerpc/cpu/mpc86xx/traps.c | 2 +-
 arch/powerpc/cpu/mpc8xx/fdt.c    | 2 +-
 arch/powerpc/lib/bootm.c         | 4 ++--
 arch/xtensa/lib/bootm.c          | 5 ++---
 cmd/bedbug.c                     | 2 +-
 14 files changed, 19 insertions(+), 19 deletions(-)
api/api_platform-mips.c +1 -2
index 51cd328b3d..e1509663af 100644
@@ -24,8 +24,7 @@ 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->ram_base, gd->ram_size, MR_ATTR_DRAM);
 
 	return 1;
 }
api/api_platform-powerpc.c +1 -1
index 15930cfdb6..847a4a3015 100644
@@ -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->ram_base, gd->ram_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);
 
arch/mips/lib/boot.c +1 -1
index db862f6379..6ef9109022 100644
@@ -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->ram_base, gd->ram_top - gd->ram_base);
 
 	return entry(argc, argv);
 }
arch/mips/lib/bootm.c +1 -1
index 0a13f6edb7..d5c99d891c 100644
@@ -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->ram_base);
 	u64 mem_size = gd->ram_size;
 
 	return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1);
arch/powerpc/cpu/mpc83xx/fdt.c +1 -1
index ebdedb2888..4ea7b27ef4 100644
@@ -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)gd->ram_base, (u64)gd->ram_size);
 
 #if defined(CONFIG_BOOTCOUNT_LIMIT) && \
 	(defined(CONFIG_QE) && !defined(CONFIG_ARCH_MPC831X))
arch/powerpc/cpu/mpc83xx/traps.c +1 -1
index c3cc119d65..ea8bc6c152 100644
@@ -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->ram_base + gd->ram_size)
 
 /*
  * Trap & Exception support
arch/powerpc/cpu/mpc85xx/fdt.c +2 -2
index 9569c1a64b..0d8353ceb2 100644
@@ -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)gd->ram_base, (u64)gd->ram_size);
 
 #ifdef CONFIG_MP
-	ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);
+	ft_fixup_cpu(blob, (u64)gd->ram_base + (u64)gd->ram_size);
 	ft_fixup_num_cores(blob);
 #endif
 
arch/powerpc/cpu/mpc85xx/traps.c +1 -1
index f37a45e269..db6ed1fc92 100644
@@ -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->ram_base + get_effective_memsize())
 
 static __inline__ void set_tsr(unsigned long val)
 {
arch/powerpc/cpu/mpc86xx/fdt.c +3 -1
index 24e53115ec..010b6d4fe6 100644
@@ -8,6 +8,8 @@
 #include <fdt_support.h>
 #include <asm/mp.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 extern void ft_fixup_num_cores(void *blob);
 extern void ft_srio_setup(void *blob);
 
@@ -27,7 +29,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)gd->ram_base, (u64)gd->ram_size);
 
 #ifdef CONFIG_SYS_NS16550
 	do_fixup_by_compat_u32(blob, "ns16550",
arch/powerpc/cpu/mpc86xx/traps.c +1 -1
index c0161e3379..3ee0ec859c 100644
@@ -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->ram_base + get_effective_memsize())
 
 /*
  * Trap & Exception support
arch/powerpc/cpu/mpc8xx/fdt.c +1 -1
index 4d952a3882..226e258f0e 100644
@@ -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)gd->ram_base, (u64)gd->ram_size);
 }
arch/powerpc/lib/bootm.c +2 -2
index 8c8ed99cd3..b903e6ec8d 100644
@@ -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->ram_base;
+	size = (u64)gd->ram_size;
 
 	off = fdt_path_offset(images->ft_addr, "/memory");
 	if (off < 0)
arch/xtensa/lib/bootm.c +2 -3
index 458eaf95c0..6fcbfc4292 100644
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct bp_tag *params)
 
 static struct bp_tag *setup_memory_tag(struct bp_tag *params)
 {
-	struct bd_info *bd = gd->bd;
 	struct meminfo *mem;
 
 	params->id = BP_TAG_MEMORY;
 	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 = gd->ram_base;
+	mem->end = gd->ram_base + gd->ram_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);
cmd/bedbug.c +1 -1
index 81ce256480..684e4a9ea5 100644
@@ -348,7 +348,7 @@ int do_bedbug_stack(struct cmd_tbl *cmdtp, int flag, int argc,
 		return 1;
 	}
 
-	top = gd->bd->bi_memstart + gd->bd->bi_memsize;
+	top = gd->ram_start + gd->ram_size;
 	depth = 0;
 
 	printf ("Depth     PC\n");
Signature · 1 line
2.28.0
#14 lore raw

PATCH v4 4/9 global: Move from bi_memstart/memsize -> gd->ram_base/ram_size

Dear Stefan,

Quoted 2 lines · In message <[email protected]> you wrote:

With the removal of bi_memstart & bi_memsize, this patch now moves the references to the better suiting gd->ram_base/ram_size variables.

This sounds as if bi_memstart & bi_memsize have already been removed, in whih case the patch order would be wrong as it would be unbisectable ; but if I see his right the actual removel will only follow in later patches ("[PATCH v4 7/9] powerpc: Remove bi_memstart & bi_memsize assignments in spl.c" etc.) ?

In this case it might be better to write something like:

"With the _planned_ removal ..."

or such?

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This was an  amazing  creation  using  small  squares  of  compressed
vegetable  matter on which letters were made by means of small carbon
particles from a stylus, giving an effect similar to the  traditional
word-processor  screen. It seemed amazingly portable and I never once
saw him have to change the batteries.
        - Terry Pratchett & Stephen Briggs, _The Discworld Companion_
#15 lore raw

PATCH v4 4/9 global: Move from bi_memstart/memsize -> gd->ram_base/ram_size

Hi Wolfgang,

Quoted 10 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

With the removal of bi_memstart & bi_memsize, this patch now moves the references to the better suiting gd->ram_base/ram_size variables.

This sounds as if bi_memstart & bi_memsize have already been removed, in whih case the patch order would be wrong as it would be unbisectable ; but if I see his right the actual removel will only follow in later patches ("[PATCH v4 7/9] powerpc: Remove bi_memstart & bi_memsize assignments in spl.c" etc.) ?

Quoted 5 lines

In this case it might be better to write something like:

"With the _planned_ removal ..."

or such?

Okay. I'll update the commit text accordingly in the next version.

Thanks,
Stefan

#16 lore raw

PATCH v4 5/9 xtensa: Remove arch_setup_bdinfo()

In reply to Stefan Roese

arch_setup_bdinfo() only configures the deprecated bi_memstart & bi_memsize values, which should not be needed any more. Lets remove this file completely.

---

Changes in v4:
- New patch

 arch/xtensa/lib/Makefile |  2 +-
 arch/xtensa/lib/bdinfo.c | 22 ----------------------
 2 files changed, 1 insertion(+), 23 deletions(-)
 delete mode 100644 arch/xtensa/lib/bdinfo.c
arch/xtensa/lib/Makefile +1 -1
index ceee59b9bd..c59df7d372 100644
@@ -5,4 +5,4 @@
 
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 
-obj-y 	+= cache.o misc.o relocate.o time.o bdinfo.o
+obj-y 	+= cache.o misc.o relocate.o time.o
arch/xtensa/lib/bdinfo.c deleted +0 -22
deleted file mode 100644
index 4ec8529521..0000000000
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * XTENSA-specific information for the 'bd' command
- *
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <init.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-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;
-
-	return 0;
-}
Signature · 1 line
2.28.0
#17 lore raw

PATCH v4 5/9 xtensa: Remove arch_setup_bdinfo()

Hi Stefan,

Quoted 42 lines · Stefan Roese

arch_setup_bdinfo() only configures the deprecated bi_memstart & bi_memsize values, which should not be needed any more. Lets remove this file completely.

---

Changes in v4:
- New patch

  arch/xtensa/lib/Makefile |  2 +-
  arch/xtensa/lib/bdinfo.c | 22 ----------------------
  2 files changed, 1 insertion(+), 23 deletions(-)

delete mode 100644 arch/xtensa/lib/bdinfo.c

arch/xtensa/lib/Makefile +1 -1
index ceee59b9bd..c59df7d372 100644
@@ -5,4 +5,4 @@
 
  obj-$(CONFIG_CMD_BOOTM) += bootm.o
 
-obj-y 	+= cache.o misc.o relocate.o time.o bdinfo.o
+obj-y 	+= cache.o misc.o relocate.o time.o
arch/xtensa/lib/bdinfo.c deleted +0 -10
deleted file mode 100644
index 4ec8529521..0000000000
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * XTENSA-specific information for the 'bd' command
- *
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <init.h>

arch/xtensa/lib/bdinfo.c line 20

Quoted 10 lines
arch/xtensa/lib/bdinfo.c deleted +0 -10
-
-DECLARE_GLOBAL_DATA_PTR;
-
-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;
-

When I did the setup_bdinfo refactoring, I realized that xtensa was the only arch handling bi_{memstart,memsize} in a special way:

	bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
	bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;

Because xtensa uses PHYSADDR(CONFIG_SYS_SDRAM_BASE) for bi_memstart, I was not able to replace it with gd->ram_base, as for all the other arches.

Currently, gd->ram_base is defined in common/board_f.c, function setup_dest_addr as:

#ifdef CONFIG_SYS_SDRAM_BASE

arch/xtensa/lib/bdinfo.c line 21

Quoted 1 line
arch/xtensa/lib/bdinfo.c deleted +0 -1
-------gd->ram_base = CONFIG_SYS_SDRAM_BASE;

#endif

So I think the PHYSADDR() logic needs to be preserved so that the patchset would not change the memory start/end logic in arch/xtensa/lib/bootm.c:

arch/xtensa/lib/bootm.c +2 -3
index 458eaf95c0..6fcbfc4292 100644
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct bp_tag *params)
  
  static struct bp_tag *setup_memory_tag(struct bp_tag *params)
  {
-	struct bd_info *bd = gd->bd;
  	struct meminfo *mem;
  
  	params->id = BP_TAG_MEMORY;
  	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 = gd->ram_base;
+	mem->end = gd->ram_base + gd->ram_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);

Also, the only xtensa board (board/cadence/xtfpga/xtfpga.c) has an empty stub for dram_init_banksize, overwriting the weak definition in common/board_f.c that should populate gd->bd->bi_dram[0].start/size. But maybe keeping gd->bd->bi_dram[0].start/size undefined does not have other implications.

Ovidiu

Quoted 2 lines
arch/xtensa/lib/bdinfo.c deleted +0 -2
-	return 0;
-}
#18 lore raw

PATCH v4 5/9 xtensa: Remove arch_setup_bdinfo()

Hi Ovidiu,

Quoted 57 lines · Ovidiu Panait

Hi Stefan,

Quoted 40 lines · Stefan Roese

arch_setup_bdinfo() only configures the deprecated bi_memstart & bi_memsize values, which should not be needed any more. Lets remove this file completely.

---

Changes in v4:
- New patch

? arch/xtensa/lib/Makefile |? 2 +-
? arch/xtensa/lib/bdinfo.c | 22 ---------------------- ? 2 files changed, 1 insertion(+), 23 deletions(-) ? delete mode 100644 arch/xtensa/lib/bdinfo.c

arch/xtensa/lib/Makefile +0 -0
index ceee59b9bd..c59df7d372 100644
@@ -5,4 +5,4 @@

? obj-$(CONFIG_CMD_BOOTM) += bootm.o

arch/xtensa/lib/Makefile +1 -1
-obj-y???? += cache.o misc.o relocate.o time.o bdinfo.o
+obj-y???? += cache.o misc.o relocate.o time.o
arch/xtensa/lib/bdinfo.c deleted +0 -10
deleted file mode 100644
index 4ec8529521..0000000000
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * XTENSA-specific information for the 'bd' command
- *
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <init.h>

arch/xtensa/lib/bdinfo.c line 20

Quoted 10 lines
arch/xtensa/lib/bdinfo.c deleted +0 -10
-
-DECLARE_GLOBAL_DATA_PTR;
-
-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;
-

When I did the setup_bdinfo refactoring, I realized that xtensa was the only arch handling bi_{memstart,memsize} in a special way:

Quoted 5 lines

????bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); ????bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;

Because xtensa uses PHYSADDR(CONFIG_SYS_SDRAM_BASE) for bi_memstart, I was not able to replace it with gd->ram_base, as for all the other arches.

Please note that bi_memstart/size is probably not used at all on xtensa - only for the bdinfo cmd AFAICT.

Quoted 6 lines

Currently, gd->ram_base is defined in common/board_f.c, function setup_dest_addr as:

#ifdef CONFIG_SYS_SDRAM_BASE

arch/xtensa/lib/bdinfo.c line 21

Quoted 1 line
arch/xtensa/lib/bdinfo.c deleted +0 -1
-------gd->ram_base = CONFIG_SYS_SDRAM_BASE;

#endif

Yes, this #ifdef is ugly - I also noticed it while working on this patchset.

Quoted 14 lines

So I think the PHYSADDR() logic needs to be preserved so that the patchset would not change the memory start/end logic in arch/xtensa/lib/bootm.c:

arch/xtensa/lib/bootm.c +0 -1
index 458eaf95c0..6fcbfc4292 100644
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct bp_tag 
 *params)
 
 ?static struct bp_tag *setup_memory_tag(struct bp_tag *params)
 ?{
-??? struct bd_info *bd = gd->bd;

arch/xtensa/lib/bootm.c static struct bp_tag *setup_last_tag(struct bp_tag · line 52

Quoted 10 lines
arch/xtensa/lib/bootm.c +2 -2
 ???? struct meminfo *mem;
 
 ???? params->id = BP_TAG_MEMORY;
 ???? 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 = gd->ram_base;
+??? mem->end = gd->ram_base + gd->ram_size;

I see. Why not add this instead as well to this new patchset:

arch/xtensa/cpu/cpu.c +1 -0
index 85d3464607..a4ba71a301 100644
@@ -45,6 +45,7 @@ int print_cpuinfo(void)
 
  int arch_cpu_init(void)
  {
+       gd->ram_base = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
         gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
         return 0;
  }

and keep the bi_memstart -> ram_base conversion above? Looks more consistant to me.

Quoted 11 lines
arch/xtensa/lib/bootm.c +0 -0
 ???? printf("?? MEMORY:????????? tag:0x%04x, type:0X%lx, start:0X%lx, 
 end:0X%lx\n",

??????????? BP_TAG_MEMORY, mem->type, mem->start, mem->end);

Also, the only xtensa board (board/cadence/xtfpga/xtfpga.c) has an empty stub for dram_init_banksize, overwriting the weak definition in common/board_f.c that should populate gd->bd->bi_dram[0].start/size. But maybe keeping gd->bd->bi_dram[0].start/size undefined does not have other implications.

I just stumbled over this issue with the "test.py xtfpga" CI test, which fails, since now bi_dram[].size is zero. I'll remove the local dram_init_banksize() no-op function in the next patchset version, so that the weak default will be used instead.

Thanks,
Stefan

#19 lore raw

PATCH v4 5/9 xtensa: Remove arch_setup_bdinfo()

Hi Ovidiu,

Quoted 120 lines · Stefan Roese

Hi Ovidiu,

Quoted 57 lines · Ovidiu Panait

Hi Stefan,

Quoted 40 lines · Stefan Roese

arch_setup_bdinfo() only configures the deprecated bi_memstart & bi_memsize values, which should not be needed any more. Lets remove this file completely.

---

Changes in v4:
- New patch

? arch/xtensa/lib/Makefile |? 2 +-
? arch/xtensa/lib/bdinfo.c | 22 ---------------------- ? 2 files changed, 1 insertion(+), 23 deletions(-) ? delete mode 100644 arch/xtensa/lib/bdinfo.c

arch/xtensa/lib/Makefile +0 -0
index ceee59b9bd..c59df7d372 100644
@@ -5,4 +5,4 @@

? obj-$(CONFIG_CMD_BOOTM) += bootm.o

arch/xtensa/lib/Makefile +1 -1
-obj-y???? += cache.o misc.o relocate.o time.o bdinfo.o
+obj-y???? += cache.o misc.o relocate.o time.o
arch/xtensa/lib/bdinfo.c deleted +0 -10
deleted file mode 100644
index 4ec8529521..0000000000
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * XTENSA-specific information for the 'bd' command
- *
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <init.h>

arch/xtensa/lib/bdinfo.c line 20

Quoted 10 lines
arch/xtensa/lib/bdinfo.c deleted +0 -10
-
-DECLARE_GLOBAL_DATA_PTR;
-
-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;
-

When I did the setup_bdinfo refactoring, I realized that xtensa was the only arch handling bi_{memstart,memsize} in a special way:

Quoted 6 lines

?????bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); ?????bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;

Because xtensa uses PHYSADDR(CONFIG_SYS_SDRAM_BASE) for bi_memstart, I was not able to replace it with gd->ram_base, as for all the other arches.

Please note that bi_memstart/size is probably not used at all on xtensa - only for the bdinfo cmd AFAICT.

Quoted 6 lines

Currently, gd->ram_base is defined in common/board_f.c, function setup_dest_addr as:

#ifdef CONFIG_SYS_SDRAM_BASE

arch/xtensa/lib/bdinfo.c line 21

Quoted 1 line
arch/xtensa/lib/bdinfo.c deleted +0 -1
-------gd->ram_base = CONFIG_SYS_SDRAM_BASE;

#endif

Yes, this #ifdef is ugly - I also noticed it while working on this patchset.

Quoted 14 lines

So I think the PHYSADDR() logic needs to be preserved so that the patchset would not change the memory start/end logic in arch/xtensa/lib/bootm.c:

arch/xtensa/lib/bootm.c +0 -1
index 458eaf95c0..6fcbfc4292 100644
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct bp_tag 
 *params)
 
 ??static struct bp_tag *setup_memory_tag(struct bp_tag *params)
 ??{
-??? struct bd_info *bd = gd->bd;

arch/xtensa/lib/bootm.c static struct bp_tag *setup_last_tag(struct bp_tag · line 52

Quoted 10 lines
arch/xtensa/lib/bootm.c +2 -2
 ????? struct meminfo *mem;
 
 ????? params->id = BP_TAG_MEMORY;
 ????? 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 = gd->ram_base;
+??? mem->end = gd->ram_base + gd->ram_size;

I see. Why not add this instead as well to this new patchset:

arch/xtensa/cpu/cpu.c +1 -0
index 85d3464607..a4ba71a301 100644
@@ -45,6 +45,7 @@ int print_cpuinfo(void)
 
 ?int arch_cpu_init(void)
 ?{
+?????? gd->ram_base = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
 ??????? gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 ??????? return 0;
 ?}
Quoted 2 lines

and keep the bi_memstart -> ram_base conversion above? Looks more consistant to me.

Thinking a bit more about this, its probably better to use this patch:

arch/xtensa/lib/bootm.c +0 -0
index 6fcbfc4292..0e564507f9 100644
@@ -47,8 +47,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 = gd->ram_base;
-       mem->end = gd->ram_base + gd->ram_size;
+       mem->start = PHYSADDR(gd->ram_base);
+       mem->end = PHYSADDR(gd->ram_base + gd->ram_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);

What do you think?

Thanks,
Stefan

#20 lore raw

PATCH v4 5/9 xtensa: Remove arch_setup_bdinfo()

Hi Stefan,

Quoted 146 lines · Stefan Roese

Hi Ovidiu,

Quoted 120 lines · Stefan Roese

Hi Ovidiu,

Quoted 57 lines · Ovidiu Panait

Hi Stefan,

Quoted 40 lines · Stefan Roese

arch_setup_bdinfo() only configures the deprecated bi_memstart & bi_memsize values, which should not be needed any more. Lets remove this file completely.

---

Changes in v4:
- New patch

? arch/xtensa/lib/Makefile |? 2 +-
? arch/xtensa/lib/bdinfo.c | 22 ---------------------- ? 2 files changed, 1 insertion(+), 23 deletions(-) ? delete mode 100644 arch/xtensa/lib/bdinfo.c

arch/xtensa/lib/Makefile +0 -0
index ceee59b9bd..c59df7d372 100644
@@ -5,4 +5,4 @@

? obj-$(CONFIG_CMD_BOOTM) += bootm.o

arch/xtensa/lib/Makefile +1 -1
-obj-y???? += cache.o misc.o relocate.o time.o bdinfo.o
+obj-y???? += cache.o misc.o relocate.o time.o
arch/xtensa/lib/bdinfo.c deleted +0 -10
deleted file mode 100644
index 4ec8529521..0000000000
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * XTENSA-specific information for the 'bd' command
- *
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <init.h>

arch/xtensa/lib/bdinfo.c line 20

Quoted 10 lines
arch/xtensa/lib/bdinfo.c deleted +0 -10
-
-DECLARE_GLOBAL_DATA_PTR;
-
-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;
-

When I did the setup_bdinfo refactoring, I realized that xtensa was the only arch handling bi_{memstart,memsize} in a special way:

Quoted 6 lines

?????bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); ?????bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;

Because xtensa uses PHYSADDR(CONFIG_SYS_SDRAM_BASE) for bi_memstart, I was not able to replace it with gd->ram_base, as for all the other arches.

Please note that bi_memstart/size is probably not used at all on xtensa - only for the bdinfo cmd AFAICT.

Quoted 6 lines

Currently, gd->ram_base is defined in common/board_f.c, function setup_dest_addr as:

#ifdef CONFIG_SYS_SDRAM_BASE

arch/xtensa/lib/bdinfo.c line 21

Quoted 1 line
arch/xtensa/lib/bdinfo.c deleted +0 -1
-------gd->ram_base = CONFIG_SYS_SDRAM_BASE;

#endif

Yes, this #ifdef is ugly - I also noticed it while working on this patchset.

Quoted 14 lines

So I think the PHYSADDR() logic needs to be preserved so that the patchset would not change the memory start/end logic in arch/xtensa/lib/bootm.c:

arch/xtensa/lib/bootm.c +0 -1
index 458eaf95c0..6fcbfc4292 100644
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct 
 bp_tag *params)
 
 ??static struct bp_tag *setup_memory_tag(struct bp_tag *params)
 ??{
-??? struct bd_info *bd = gd->bd;

arch/xtensa/lib/bootm.c static struct bp_tag *setup_last_tag(struct · line 52

Quoted 10 lines
arch/xtensa/lib/bootm.c +2 -2
 ????? struct meminfo *mem;
 
 ????? params->id = BP_TAG_MEMORY;
 ????? 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 = gd->ram_base;
+??? mem->end = gd->ram_base + gd->ram_size;

I see. Why not add this instead as well to this new patchset:

arch/xtensa/cpu/cpu.c +1 -0
index 85d3464607..a4ba71a301 100644
@@ -45,6 +45,7 @@ int print_cpuinfo(void)
 
 ??int arch_cpu_init(void)
 ??{
+?????? gd->ram_base = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
 ???????? gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 ???????? return 0;
 ??}
Quoted 2 lines

and keep the bi_memstart -> ram_base conversion above? Looks more consistant to me.

Thinking a bit more about this, its probably better to use this patch:

arch/xtensa/lib/bootm.c +2 -2
index 6fcbfc4292..0e564507f9 100644
@@ -47,8 +47,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 = gd->ram_base;
-?????? mem->end = gd->ram_base + gd->ram_size;
+?????? mem->start = PHYSADDR(gd->ram_base);
+?????? mem->end = PHYSADDR(gd->ram_base + gd->ram_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);

Quoted 2 lines

What do you think?

Yes, I think this is better. arch_cpu_init runs earlier than setup_dest_addr in the boot process, so the gd->ram_base would have been overwritten anyway if set there.

Ovidiu

Quoted 2 lines

Thanks,
Stefan

#21 lore raw

PATCH v4 6/9 video: cfb_console.c: Use bi_dram[] values on all platforms

In reply to Stefan Roese

All platforms support bi_dram[] since quite some time. Lets remove the and bi_memsize values completely.

---

Changes in v4:
- New patch

 drivers/video/cfb_console.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/cfb_console.c +1 -7
index badade353e..3f07f4eb29 100644
@@ -1983,8 +1983,6 @@ static void *video_logo(void)
 static int cfb_fb_is_in_dram(void)
 {
 	struct bd_info *bd = gd->bd;
-#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || \
-defined(CONFIG_SANDBOX) || defined(CONFIG_X86)
 	ulong start, end;
 	int i;
 
@@ -1995,11 +1993,7 @@ defined(CONFIG_SANDBOX) || defined(CONFIG_X86)
 		    (ulong)video_fb_address < end)
 			return 1;
 	}
-#else
-	if ((ulong)video_fb_address >= bd->bi_memstart &&
-	    (ulong)video_fb_address < bd->bi_memstart + bd->bi_memsize)
-		return 1;
-#endif
+
 	return 0;
 }
 
Signature · 1 line
2.28.0
#22 lore raw

PATCH v4 7/9 powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

In reply to Stefan Roese

Most likely these deprecated (removed) variables are not needed. Lets remove the assignments completely from all spl.c files.

---

Changes in v4:
- New patch

 board/Arcturus/ucp1020/spl.c       | 2 --
 board/freescale/p1010rdb/spl.c     | 2 --
 board/freescale/p1_p2_rdb_pc/spl.c | 2 --
 board/freescale/t102xrdb/spl.c     | 2 --
 board/freescale/t104xrdb/spl.c     | 2 --
 board/freescale/t208xqds/spl.c     | 2 --
 board/freescale/t208xrdb/spl.c     | 2 --
 board/freescale/t4rdb/spl.c        | 2 --
 8 files changed, 16 deletions(-)
board/Arcturus/ucp1020/spl.c +0 -2
index 5416a5b663..0fd9532d74 100644
@@ -83,8 +83,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/p1010rdb/spl.c +0 -2
index 4ee4573d2b..fbaa6a6514 100644
@@ -69,8 +69,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/p1_p2_rdb_pc/spl.c +0 -2
index e76c3e82c3..8aceceb56a 100644
@@ -75,8 +75,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t102xrdb/spl.c +0 -2
index da442fcc18..09dd88ac4e 100644
@@ -103,8 +103,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t104xrdb/spl.c +0 -2
index f83d69ba15..e7922954de 100644
@@ -94,8 +94,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t208xqds/spl.c +0 -2
index c197884421..d8c2bbe28d 100644
@@ -102,8 +102,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t208xrdb/spl.c +0 -2
index 07aab6349c..c64bd87115 100644
@@ -72,8 +72,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t4rdb/spl.c +0 -2
index 64d2753da8..9aa0a9b052 100644
@@ -75,8 +75,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
Signature · 1 line
2.28.0
#23 lore raw

PATCH v4 7/9 powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

Hi Oleksandr and Michael,
Hi developers as NXP,

Quoted 4 lines · Stefan Roese

Most likely these deprecated (removed) variables are not needed. Lets remove the assignments completely from all spl.c files.

Could you please test this patch on one of your platforms? I'm not 100% sure, if this assignment can be dropped.

Thanks,
Stefan

Quoted 112 lines

---

Changes in v4:
- New patch

  board/Arcturus/ucp1020/spl.c       | 2 --
  board/freescale/p1010rdb/spl.c     | 2 --
  board/freescale/p1_p2_rdb_pc/spl.c | 2 --
  board/freescale/t102xrdb/spl.c     | 2 --
  board/freescale/t104xrdb/spl.c     | 2 --
  board/freescale/t208xqds/spl.c     | 2 --
  board/freescale/t208xrdb/spl.c     | 2 --
  board/freescale/t4rdb/spl.c        | 2 --
  8 files changed, 16 deletions(-)
board/Arcturus/ucp1020/spl.c +0 -2
index 5416a5b663..0fd9532d74 100644
@@ -83,8 +83,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/p1010rdb/spl.c +0 -2
index 4ee4573d2b..fbaa6a6514 100644
@@ -69,8 +69,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/p1_p2_rdb_pc/spl.c +0 -2
index e76c3e82c3..8aceceb56a 100644
@@ -75,8 +75,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t102xrdb/spl.c +0 -2
index da442fcc18..09dd88ac4e 100644
@@ -103,8 +103,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t104xrdb/spl.c +0 -2
index f83d69ba15..e7922954de 100644
@@ -94,8 +94,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t208xqds/spl.c +0 -2
index c197884421..d8c2bbe28d 100644
@@ -102,8 +102,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t208xrdb/spl.c +0 -2
index 07aab6349c..c64bd87115 100644
@@ -72,8 +72,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t4rdb/spl.c +0 -0
index 64d2753da8..9aa0a9b052 100644

board/freescale/t4rdb/spl.c void board_init_r(gd_t *gd, ulong dest_addr) · line 80

Quoted 8 lines
board/freescale/t4rdb/spl.c +0 -2
@@ -75,8 +75,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#24 lore raw

PATCH v4 7/9 powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

We will ...

Michael
Arcturus Support
arcsupport at ArcturusNetworks.com

Quoted 138 lines · Stefan Roese

Hi Oleksandr and Michael,
Hi developers as NXP,

Quoted 4 lines · Stefan Roese

Most likely these deprecated (removed) variables are not needed. Lets remove the assignments completely from all spl.c files.

Could you please test this patch on one of your platforms? I'm not 100% sure, if this assignment can be dropped.

Thanks,
Stefan

Quoted 110 lines

---

Changes in v4:
- New patch

? board/Arcturus/ucp1020/spl.c?????? | 2 --
? board/freescale/p1010rdb/spl.c???? | 2 --
? board/freescale/p1_p2_rdb_pc/spl.c | 2 --
? board/freescale/t102xrdb/spl.c???? | 2 --
? board/freescale/t104xrdb/spl.c???? | 2 --
? board/freescale/t208xqds/spl.c???? | 2 --
? board/freescale/t208xrdb/spl.c???? | 2 --
? board/freescale/t4rdb/spl.c??????? | 2 --

? 8 files changed, 16 deletions(-)

board/Arcturus/ucp1020/spl.c +0 -2
index 5416a5b663..0fd9532d74 100644
@@ -83,8 +83,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/p1010rdb/spl.c +0 -2
index 4ee4573d2b..fbaa6a6514 100644
@@ -69,8 +69,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/p1_p2_rdb_pc/spl.c +0 -2
index e76c3e82c3..8aceceb56a 100644
@@ -75,8 +75,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/t102xrdb/spl.c +0 -2
index da442fcc18..09dd88ac4e 100644
@@ -103,8 +103,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/t104xrdb/spl.c +0 -2
index f83d69ba15..e7922954de 100644
@@ -94,8 +94,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/t208xqds/spl.c +0 -2
index c197884421..d8c2bbe28d 100644
@@ -102,8 +102,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/t208xrdb/spl.c +0 -2
index 07aab6349c..c64bd87115 100644
@@ -72,8 +72,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
board/freescale/t4rdb/spl.c +0 -0
index 64d2753da8..9aa0a9b052 100644

board/freescale/t4rdb/spl.c void board_init_r(gd_t *gd, ulong dest_addr) · line 80

Quoted 8 lines
board/freescale/t4rdb/spl.c +0 -2
@@ -75,8 +75,6 @@ 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;
 ? ????? arch_cpu_init();
 ????? get_clocks();
 

Viele Gr??e,
Stefan

#25 lore raw

PATCH v4 7/9 powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

In reply to Stefan Roese
Quoted 19 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefan Roese
Sent: Thursday, August 13, 2020 2:46 PM
To: Oleksandr Zhadan and Michael Durrant <[email protected]>; Priyanka Jain <[email protected]>; Qiang Zhao <[email protected]>; Shengzhou Liu <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v4 7/9] powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

Hi Oleksandr and Michael,
Hi developers as NXP,

Quoted 3 lines · Stefan Roese

Most likely these deprecated (removed) variables are not needed. Lets remove the assignments completely from all spl.c files.

Quoted 8 lines
Quoted 1 line

Could you please test this patch on one of your platforms? I'm not 100% sure, if this assignment can be dropped.

Thanks,
Stefan

Hello Stefan,

We will test and provide you the feedback.

Regards
Priyanka

Quoted 130 lines
Quoted 113 lines

---

Changes in v4:
- New patch

  board/Arcturus/ucp1020/spl.c       | 2 --
  board/freescale/p1010rdb/spl.c     | 2 --
  board/freescale/p1_p2_rdb_pc/spl.c | 2 --
  board/freescale/t102xrdb/spl.c     | 2 --
  board/freescale/t104xrdb/spl.c     | 2 --
  board/freescale/t208xqds/spl.c     | 2 --
  board/freescale/t208xrdb/spl.c     | 2 --
  board/freescale/t4rdb/spl.c        | 2 --
  8 files changed, 16 deletions(-)
(quoted diff) +0 -0

b/board/Arcturus/ucp1020/spl.c index 5416a5b663..0fd9532d74 100644

board/Arcturus/ucp1020/spl.c +0 -2
@@ -83,8 +83,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
(quoted diff) +0 -0

b/board/freescale/p1010rdb/spl.c index 4ee4573d2b..fbaa6a6514 100644

board/freescale/p1010rdb/spl.c +0 -2
@@ -69,8 +69,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/p1_p2_rdb_pc/spl.c +0 -2
index e76c3e82c3..8aceceb56a 100644
@@ -75,8 +75,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
(quoted diff) +0 -0

b/board/freescale/t102xrdb/spl.c index da442fcc18..09dd88ac4e 100644

board/freescale/t102xrdb/spl.c +0 -2
@@ -103,8 +103,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
(quoted diff) +0 -0

b/board/freescale/t104xrdb/spl.c index f83d69ba15..e7922954de 100644

board/freescale/t104xrdb/spl.c +0 -2
@@ -94,8 +94,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
(quoted diff) +0 -0

b/board/freescale/t208xqds/spl.c index c197884421..d8c2bbe28d 100644

board/freescale/t208xqds/spl.c +0 -2
@@ -102,8 +102,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
(quoted diff) +0 -0

b/board/freescale/t208xrdb/spl.c index 07aab6349c..c64bd87115 100644

board/freescale/t208xrdb/spl.c +0 -2
@@ -72,8 +72,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();
board/freescale/t4rdb/spl.c +0 -0
index 64d2753da8..9aa0a9b052 100644

board/freescale/t4rdb/spl.c void board_init_r(gd_t *gd, ulong dest_addr) · line 80

Quoted 8 lines
board/freescale/t4rdb/spl.c +0 -2
@@ -75,8 +75,6 @@ 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;
 
  	arch_cpu_init();
  	get_clocks();

Viele Gr??e,
Stefan

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

#26 lore raw

PATCH v4 7/9 powerpc: Remove bi_memstart & bi_memsize assignments in spl.c

In reply to Stefan Roese

Yes, you can drop the assignment for our ucp1020 board and apply your board/Arcturus/ucp1020/spl.c patch.

Tested-by: Oleksandr Zhadan and Michael Durrant
<[email protected]>

Quoted 124 lines · Stefan Roese

Most likely these deprecated (removed) variables are not needed. Lets remove the assignments completely from all spl.c files.

---

Changes in v4:
- New patch

 board/Arcturus/ucp1020/spl.c       | 2 --
 board/freescale/p1010rdb/spl.c     | 2 --
 board/freescale/p1_p2_rdb_pc/spl.c | 2 --
 board/freescale/t102xrdb/spl.c     | 2 --
 board/freescale/t104xrdb/spl.c     | 2 --
 board/freescale/t208xqds/spl.c     | 2 --
 board/freescale/t208xrdb/spl.c     | 2 --
 board/freescale/t4rdb/spl.c        | 2 --
 8 files changed, 16 deletions(-)
board/Arcturus/ucp1020/spl.c +0 -2
index 5416a5b663..0fd9532d74 100644
@@ -83,8 +83,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/p1010rdb/spl.c +0 -2
index 4ee4573d2b..fbaa6a6514 100644
@@ -69,8 +69,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/p1_p2_rdb_pc/spl.c +0 -2
index e76c3e82c3..8aceceb56a 100644
@@ -75,8 +75,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t102xrdb/spl.c +0 -2
index da442fcc18..09dd88ac4e 100644
@@ -103,8 +103,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t104xrdb/spl.c +0 -2
index f83d69ba15..e7922954de 100644
@@ -94,8 +94,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t208xqds/spl.c +0 -2
index c197884421..d8c2bbe28d 100644
@@ -102,8 +102,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t208xrdb/spl.c +0 -2
index 07aab6349c..c64bd87115 100644
@@ -72,8 +72,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
board/freescale/t4rdb/spl.c +0 -2
index 64d2753da8..9aa0a9b052 100644
@@ -75,8 +75,6 @@ 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;
 
 	arch_cpu_init();
 	get_clocks();
#27 lore raw

PATCH v4 8/9 cmd: bdinfo: Remove print of superseeded bi_memstart / bi_memsize values

In reply to Stefan Roese

Remove printing of the superseeded (by bi_dram[]) memory values from the bdinfo command.

---

Changes in v4:
- New patch

 cmd/bdinfo.c | 8 --------
 1 file changed, 8 deletions(-)
cmd/bdinfo.c +0 -8
index 9e230f23cb..0229846d3e 100644
@@ -34,12 +34,6 @@ static void print_eth(int idx)
 	printf("%-12s= %s\n", name, val);
 }
 
-static void print_phys_addr(const char *name, phys_addr_t value)
-{
-	printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong),
-	       (unsigned long long)value);
-}
-
 void bdinfo_print_mhz(const char *name, unsigned long hz)
 {
 	char buf[32];
@@ -73,8 +67,6 @@ 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);
 	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
 		bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
 		bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
Signature · 1 line
2.28.0
#28 lore raw

PATCH v4 9/9 asm-generic/u-boot.h: Remove bi_memstart & bi_memsize from bd_info

In reply to Stefan Roese

bi_memstart & bi_memsize are now not referenced any more. This patch removes their definitions from the bd_info struct.

---

Changes in v4:
- New patch

 include/asm-generic/u-boot.h | 2 --
 1 file changed, 2 deletions(-)
include/asm-generic/u-boot.h +0 -2
index 99d3fe33ad..637de0c455 100644
@@ -27,8 +27,6 @@
 #include <linux/types.h>
 
 struct bd_info {
-	unsigned long	bi_memstart;	/* start of DRAM memory */
-	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
Signature · 1 line
2.28.0