microblaze: drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE
PATCH v2 1/4 microblaze: drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE
These macros are not used anymore in microblaze code since commit f113d7d303467 ("Convert CONFIG_SPL_STACK to Kconfig"), so remove them.
---
Changes in v2:
Improved commit message, added "Fixes" tag.
include/configs/microblaze-generic.h | 6 ------ 1 file changed, 6 deletions(-)
include/configs/microblaze-generic.h +0 -6
@@ -97,10 +97,4 @@#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE -/* SP location before relocation, must use scratch RAM */ -/* BRAM start */ -#define CONFIG_SYS_INIT_RAM_ADDR 0x0 -/* BRAM size - will be generated */ -#define CONFIG_SYS_INIT_RAM_SIZE 0x100000 -#endif /* __CONFIG_H */
Signature · 1 line
2.25.1
PATCH v2 2/4 cpu: microblaze: add error handling in microblaze_cpu_get_desc()
Check snprintf() return value for errors.
Make microblaze_cpu_get_desc() directly return snprintf() error code if ret < 0. Otherwise, if the return value is greater than or equal to size, the resulting string is truncated, so return -ENOSPC.
---
Changes in v2:
New patch.
drivers/cpu/microblaze_cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpu/microblaze_cpu.c +3 -1
@@ -97,8 +97,10 @@ static int microblaze_cpu_get_desc(const struct udevice *dev, char *buf, ret =snprintf (buf, size,"MicroBlaze @ %uMHz, Rev: %s, FPGA family: %s" , cpu_freq_mhz, cpu_ver, fpga_family); +if (ret <0 ) +return ret; -return 0 ; +return (ret >= size) ? -ENOSPC :0 ; } static int microblaze_cpu_get_info(const struct udevice *dev,
Signature · 1 line
2.25.1
PATCH v2 3/4 cmd: bdinfo: introduce bdinfo_print_size() helper
In reply to Ovidiu PanaitAdd bdinfo_print_size() helper to display size variables (such as cache sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", "xxx GiB", etc as needed;
---
Changes in v2:
Added "Reviewed-by" tag from Simon.
cmd/bdinfo.c | 7 +++++++ include/init.h | 13 +++++++++++++ 2 files changed, 20 insertions(+)
cmd/bdinfo.c +7 -0
@@ -16,9 +16,16 @@#include <vsprintf.h> #include <asm/cache.h> #include <asm/global_data.h> +#include <display_options.h> DECLARE_GLOBAL_DATA_PTR ; +void bdinfo_print_size (const char *name,uint64_t size) +{ +printf ("%-12s= " , name); +print_size (size,"\n" ); +} +void bdinfo_print_num_l (const char *name,ulong value) {printf ("%-12s= 0x%0*lx\n" , name,2 * (int )sizeof (value), value);
include/init.h +13 -0
@@ -343,6 +343,19 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value);/* Print a clock speed in MHz */ void bdinfo_print_mhz (const char *name,unsigned long hz); +/** +* bdinfo_print_size - print size variables in bdinfo format +* @name: string to print before the size +* @size: size to print +* +* Helper function for displaying size variables as properly formatted bdinfo +* entries. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", +* "xxx GiB", etc. as needed; +* +* For use in arch_print_bdinfo(). +*/ +void bdinfo_print_size (const char *name,uint64_t size); +/* Show arch-specific information for the 'bd' command */ void arch_print_bdinfo (void );
Signature · 1 line
2.25.1
RE: [PATCH v2 3/4] cmd: bdinfo: introduce bdinfo_print_size() helper
Quoted 12 lines
-----Original Message-----
From: Ovidiu Panait <[email protected]>
Sent: 2022年8月30日 1:02
To: [email protected]
Cc: Ovidiu Panait <[email protected]>; Simon Glass <[email protected]>; Andy Shevchenko <[email protected]>; Dzmitry Sankouski <[email protected]>; Heinrich Schuchardt <[email protected]>; Jason Liu <[email protected]>
Subject: [PATCH v2 3/4] cmd: bdinfo: introducebdinfo_print_size()helper
Quoted 2 lines
Add
bdinfo_print_size()helper to display size variables (such as cache sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB",
"xxx MiB",
Quoted 4 lines
"xxx GiB", etc as needed;
Reviewed-by Simon Glass <[email protected]>Signed-off-by Ovidiu Panait <[email protected]>
Quoted 9 lines
---
Changes in v2:
Added "Reviewed-by" tag from Simon.cmd/bdinfo.c | 7 +++++++ include/init.h | 13 +++++++++++++ 2 files changed, 20 insertions(+)
The patch looks good to me.
Quoted 9 lines
cmd/bdinfo.c index 37cd8a57eb..9e23c4dd8f renamed from cmd/bdinfo.c +0
-0100644
cmd/bdinfo.c +1
-0@@ -16,9 +16,16 @@#include <vsprintf.h> #include <asm/cache.h> #include <asm/global_data.h> +#include <display_options.h>
cmd/bdinfo.c line 29
Quoted 10 lines
cmd/bdinfo.c +5
-0DECLARE_GLOBAL_DATA_PTR ; +void bdinfo_print_size (const char *name,uint64_t size) { +printf ("%-12s= " , name); +print_size (size,"\n" ); +} +void bdinfo_print_num_l (const char *name,ulong value) {printf ("%-12s= 0x%0*lx\n" , name,2 * (int )sizeof (value), value);
diff --git
Quoted 27 lines
a/include/init.hb/include/init.hindex7b8f62c121..02bb4ce13e100644include/init.h +14
-0@@ -343,6 +343,19 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value);/* Print a clock speed in MHz */ void bdinfo_print_mhz (const char *name,unsigned long hz); +/** +* bdinfo_print_size - print size variables in bdinfo format +* @name: string to print before the size +* @size: size to print +* +* Helper function for displaying size variables as properly formatted +bdinfo +* entries. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", +* "xxx GiB", etc. as needed; +* +* For use in arch_print_bdinfo(). +*/ +void bdinfo_print_size (const char *name,uint64_t size); +/* Show arch-specific information for the 'bd' command */ void
arch_print_bdinfo(void);--
2.25.1
PATCH v2 4/4 microblaze: add arch_print_bdinfo() implementation
In reply to Ovidiu PanaitAllow bdinfo command to print icache/dcache information:
U-Boot-mONStR> bdinfoboot_params = 0x00000000
DRAM bank = 0x00000000 -> start = 0x04000000 -> size = 0x04000000 flashstart = 0x00000000 flashsize = 0x00000000 flashoffset = 0x00000000 baudrate = 9600 bps relocaddr = 0x07f76000 reloc off = 0x02f76000 Build = 32-bit current eth = unknown ethaddr = (not set) IP addr = <NULL> fdt_blob = 0x07fec7e0 new_fdt = 0x00000000 fdt_size = 0x00000000
lmb_dump_all:
memory.cnt = 0x1
memory[0] [0x4000000-0x7ffffff], 0x04000000 bytes flags: 0
reserved.cnt = 0x1
reserved[0] [0x7e94b8c-0x7ffffff], 0x0016b474 bytes flags: 0
devicetree = embed
icache = 32 KiB
icache line = 4 Bytes
dcache = 32 KiB
dcache line = 4 Bytes
---
(no changes since v1)
arch/microblaze/lib/Makefile | 1 + arch/microblaze/lib/bdinfo.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 arch/microblaze/lib/bdinfo.c
arch/microblaze/lib/Makefile +1 -0
@@ -4,4 +4,5 @@ # Wolfgang Denk, DENX Software Engineering, [email protected]. obj-$(CONFIG_CMD_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BDI) += bdinfo.o obj-y += muldi3.o
arch/microblaze/lib/bdinfo.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022, Ovidiu Panait <[email protected]> +*/ +#include <init.h> +#include <asm/cpuinfo.h> +#include <asm/global_data.h> + +DECLARE_GLOBAL_DATA_PTR ; + +void arch_print_bdinfo (void ) +{ +struct microblaze_cpuinfo *ci =gd_cpuinfo (); + +if (ci->icache_size) { +bdinfo_print_size ("icache" , ci->icache_size); +bdinfo_print_size ("icache line" , ci->icache_line_length); + } + +if (ci->dcache_size) { +bdinfo_print_size ("dcache" , ci->dcache_size); +bdinfo_print_size ("dcache line" , ci->dcache_line_length); + } +}
Signature · 1 line
2.25.1
Quoted 18 lines · Ovidiu Panait
These macros are not used anymore in microblaze code since commit
f113d7d303467("ConvertCONFIG_SPL_STACKtoKconfig"), so remove them.Fixes f113d7d303467 ("Convert CONFIG_SPL_STACK to Kconfig")Signed-off-by Ovidiu Panait <[email protected]>---
Changes in v2:
Improved commit message, added "Fixes" tag.include/configs/microblaze-generic.h | 6 ------ 1 file changed, 6 deletions(-)include/configs/microblaze-generic.h +0
-0
include/configs/microblaze-generic.h line 100
Quoted 10 lines
include/configs/microblaze-generic.h +0
-6@@ -97,10 +97,4 @@#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE -/* SP location before relocation, must use scratch RAM */ -/* BRAM start */ -#define CONFIG_SYS_INIT_RAM_ADDR 0x0 -/* BRAM size - will be generated */ -#define CONFIG_SYS_INIT_RAM_SIZE 0x100000 -#endif /* __CONFIG_H */
Applied all.
M