* [PATCH 00/35] global_data: Reduce size of struct global_data
@ 2024-07-24 15:08 Simon Glass
2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
` (36 more replies)
0 siblings, 37 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Aaron Williams, Algapally Santosh Sagar,
Anatolij Gustschin, Andrew Davis, Aradhya Bhatia, Bin Meng,
Dan Carpenter, Devarsh Thakkar, Enrico Leto, Fabio Estevam,
Heinrich Schuchardt, Huan Wang, Ilko Iliev, Ion Agorria,
Joao Marcos Costa, Jonas Karlman, Kever Yang, MD Danish Anwar,
Mario Six, Matthias Schiffer, Michal Simek, NXP i.MX U-Boot Team,
Nishanth Menon, Patrice Chotard, Peng Fan, Peter Robinson,
Philipp Tomsich, Quentin Schulz, Sean Anderson, Shiji Yang,
Stefan Bosch, Stefano Babic, Svyatoslav Ryhel,
This contributor prefers not to receive mails, Troy Kisky,
Venkatesh Yadav Abbarapu, Wasim Khan
The global data structure has grown quite a lot over the years, being
the best place to put an important pointer or something that must be
accessed before and after relocation.
This series attempts to reduce the size a little, by moving some things
out and shrinking and aligning some fields.
Some fields are needed during init but not afterwards. To deal with this
a new 'boardf' structure is created, which sits on the stack and is only
present during board_init_f(). It is possible that more fields could
move to this struct, but for now only 4 are moved.
An assumption is made that an int is 32-bits wide on all architectures,
which seems to be true, but maintainers should be able to confirm.
Mostly the code-size impact is neutral, but the patch
'Use less space for environment fields' does increase U-Boot's size by
about 30 bytes on aarch64.
For firefly-rk3399 (64-bit) the size of global reduces from 456 to 368
bytes. For SPL it reduces from 416 to 272 bytes.
There are other things which could be attempted, for example:
- Using hlist instead of list for some lists
- Checking that only necessary fields are present in SPL
Simon Glass (35):
global_data: Move pci_clk to m68k and powerpc
x86: Drop use of global_data fb_base
video: Add a function to obtain the framebuffer address
video: mxc: Avoid setting global_data fb_base
video: mxs: Avoid setting global_data fb_base
arm: friendlyarm: Avoid accessing global_data fb_base
arm: ronetix: Avoid accessing global_data fb_base
zynqmp: Avoid setting the framebuffer address
video: Avoid setting global_data fb_base from SPL handoff
video: Avoid setting global_data fb_base in video setup
global_data: Drop fb_base
global_data: Convert have_console into a flag
global_data: Remove pci_ram_top
global_data: Drop global_data hose
global_data: Drop pci_bootdelay
global_data: Use less space for environment fields
board_f: Add a new struct to hold pre-relocation info
board_f: Move fdt_size to board
board_f: Move new_bootstage to boardf
board_f: Move new_bloblist to boardf
global_data: Drop spl_handoff
global_data: Collect common fields at the top
global_data: Reduce the size of bus_clk and mem_clk
global_data: Reduce the size of mon_len
global_data: log: Reorder and shrink fields
global_data: Reduce size of early-malloc vars
global_data: Move baud_rate field lower
global_data: Move env_addr field higher
global_data: Put phys_addr fields near the top
global_data: Move ulong fields together
global_data: Move pointer members together
global_data: Remove jump table in SPL
global_data: Remove environment members if not used
doc: Move generic-board documentation into rst
doc: Add some guidelines about global data
arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
arch/arm/lib/bdinfo.c | 2 +-
arch/arm/mach-exynos/spl_boot.c | 2 +-
arch/arm/mach-k3/common.c | 2 +-
arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
arch/arm/mach-tegra/board2.c | 4 -
arch/arm/mach-tegra/cboot.c | 4 -
arch/m68k/cpu/mcf5445x/cpu.c | 2 +-
arch/m68k/include/asm/global_data.h | 2 +
arch/m68k/lib/bdinfo.c | 2 +-
arch/mips/mach-ath79/ar934x/clk.c | 4 +-
arch/mips/mach-octeon/cpu.c | 2 +-
arch/powerpc/cpu/mpc83xx/pci.c | 4 +-
arch/powerpc/cpu/mpc83xx/speed.c | 2 +-
arch/powerpc/include/asm/global_data.h | 2 +
arch/x86/cpu/i386/cpu.c | 8 -
arch/x86/cpu/intel_common/cpu_from_spl.c | 4 +-
arch/x86/cpu/ivybridge/cpu.c | 5 -
arch/x86/lib/fsp/fsp_graphics.c | 1 -
arch/x86/lib/fsp2/fsp_dram.c | 4 +-
board/freescale/ls2080ardb/eth_ls2080rdb.c | 2 +-
board/friendlyarm/nanopi2/board.c | 9 +-
board/ronetix/pm9263/pm9263.c | 6 +-
board/siemens/common/board_am335x.c | 2 +-
cmd/bdinfo.c | 2 -
cmd/sb.c | 6 +-
common/board_f.c | 59 ++-
common/board_r.c | 2 +-
common/console.c | 17 +-
common/hwconfig.c | 8 +-
common/init/handoff.c | 12 +
common/malloc_simple.c | 7 +-
common/spl/spl.c | 6 +-
doc/develop/global_data.rst | 25 ++
.../historical/generic_board.rst} | 16 +-
doc/develop/historical/index.rst | 12 +
doc/develop/index.rst | 8 +
drivers/clk/mpc83xx_clk.c | 2 +-
drivers/clk/rockchip/clk_rk3399.c | 3 +-
drivers/video/imx/mxc_ipuv3_fb.c | 2 -
drivers/video/mxsfb.c | 1 -
drivers/video/video-uclass.c | 16 +-
drivers/video/zynqmp/zynqmp_dpsub.c | 3 +-
include/asm-generic/global_data.h | 349 ++++++++----------
include/board_f.h | 35 ++
include/env_default.h | 3 -
include/env_internal.h | 1 +
include/handoff.h | 7 +
include/video.h | 11 +
lib/asm-offsets.c | 2 +
test/cmd/bdinfo.c | 3 -
test/log/log_test.c | 6 +-
52 files changed, 373 insertions(+), 330 deletions(-)
rename doc/{README.generic-board => develop/historical/generic_board.rst} (96%)
create mode 100644 doc/develop/historical/index.rst
create mode 100644 include/board_f.h
--
2.34.1
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-29 7:57 ` Acked Angelo Dureghello
2024-07-24 15:08 ` [PATCH 02/35] x86: Drop use of global_data fb_base Simon Glass
` (35 subsequent siblings)
36 siblings, 1 reply; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Angelo Dureghello, Bin Meng,
Francis Laniel, Huan Wang, Lukasz Majewski, Mario Six,
Sean Anderson
Only m68k and powerpc use this field, so move it to the arch-specific
info, to reduce the size for other archs.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/m68k/cpu/mcf5445x/cpu.c | 2 +-
arch/m68k/include/asm/global_data.h | 2 ++
arch/m68k/lib/bdinfo.c | 2 +-
arch/powerpc/cpu/mpc83xx/pci.c | 4 ++--
arch/powerpc/cpu/mpc83xx/speed.c | 2 +-
arch/powerpc/include/asm/global_data.h | 2 ++
drivers/clk/mpc83xx_clk.c | 2 +-
include/asm-generic/global_data.h | 5 -----
8 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c
index b811ac355e4..3fbd6a58c7d 100644
--- a/arch/m68k/cpu/mcf5445x/cpu.c
+++ b/arch/m68k/cpu/mcf5445x/cpu.c
@@ -92,7 +92,7 @@ int print_cpuinfo(void)
strmhz(buf3, gd->arch.flb_clk));
#ifdef CONFIG_PCI
printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
- strmhz(buf1, gd->pci_clk),
+ strmhz(buf1, gd->arch.pci_clk),
strmhz(buf2, gd->arch.inp_clk),
strmhz(buf3, gd->arch.vco_clk));
#else
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index 93efc722ba8..4ac886933c6 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -26,6 +26,8 @@ struct arch_global_data {
#if defined(CONFIG_FSL_ESDHC)
unsigned long sdhc_per_clk;
#endif
+ /** @pci_clk: PCI clock rate in Hz */
+ unsigned long pci_clk;
};
#include <asm-generic/global_data.h>
diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
index cf6ae5adddf..891e94bbd3f 100644
--- a/arch/m68k/lib/bdinfo.c
+++ b/arch/m68k/lib/bdinfo.c
@@ -22,7 +22,7 @@ int arch_setup_bdinfo(void)
bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
if (IS_ENABLED(CONFIG_PCI))
- bd->bi_pcifreq = gd->pci_clk;
+ bd->bi_pcifreq = gd->arch.pci_clk;
#if defined(CONFIG_EXTRA_CLOCK)
bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
diff --git a/arch/powerpc/cpu/mpc83xx/pci.c b/arch/powerpc/cpu/mpc83xx/pci.c
index 6f378c4e221..aef1123a2b7 100644
--- a/arch/powerpc/cpu/mpc83xx/pci.c
+++ b/arch/powerpc/cpu/mpc83xx/pci.c
@@ -45,7 +45,7 @@ void ft_pci_setup(void *blob, struct bd_info *bd)
do_fixup_by_path(blob, path, "bus-range",
&tmp, sizeof(tmp), 1);
- tmp[0] = cpu_to_be32(gd->pci_clk);
+ tmp[0] = cpu_to_be32(gd->arch.pci_clk);
do_fixup_by_path(blob, path, "clock-frequency",
&tmp, sizeof(tmp[0]), 1);
}
@@ -60,7 +60,7 @@ void ft_pci_setup(void *blob, struct bd_info *bd)
do_fixup_by_path(blob, path, "bus-range",
&tmp, sizeof(tmp), 1);
- tmp[0] = cpu_to_be32(gd->pci_clk);
+ tmp[0] = cpu_to_be32(gd->arch.pci_clk);
do_fixup_by_path(blob, path, "clock-frequency",
&tmp, sizeof(tmp[0]), 1);
}
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 72464962613..0185ab50ad9 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -456,7 +456,7 @@ int get_clocks(void)
#if defined(CONFIG_ARCH_MPC837X)
gd->arch.sata_clk = sata_clk;
#endif
- gd->pci_clk = pci_sync_in;
+ gd->arch.pci_clk = pci_sync_in;
gd->cpu_clk = gd->arch.core_clk;
gd->bus_clk = gd->arch.csb_clk;
return 0;
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index a9efbbdd3d4..cc2ce617350 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -87,6 +87,8 @@ struct arch_global_data {
#if defined(CONFIG_LWMON5)
unsigned long kbd_status;
#endif
+ /** @pci_clk: PCI clock rate in Hz */
+ unsigned long pci_clk;
};
#include <asm-generic/global_data.h>
diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c
index a29ad0d7a68..a43fff2e7ed 100644
--- a/drivers/clk/mpc83xx_clk.c
+++ b/drivers/clk/mpc83xx_clk.c
@@ -358,7 +358,7 @@ static int mpc83xx_clk_probe(struct udevice *dev)
gd->mem_clk = priv->speed[MPC83XX_CLK_MEM];
if (mpc83xx_has_pci(type))
- gd->pci_clk = priv->speed[MPC83XX_CLK_PCI];
+ gd->arch.pci_clk = priv->speed[MPC83XX_CLK_PCI];
gd->cpu_clk = priv->speed[MPC83XX_CLK_CORE];
gd->bus_clk = priv->speed[MPC83XX_CLK_CSB];
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index aa336d63e3a..970053892e1 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -59,11 +59,6 @@ struct global_data {
* @bus_clk: platform clock rate in Hz
*/
unsigned long bus_clk;
- /**
- * @pci_clk: PCI clock rate in Hz
- */
- /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
- unsigned long pci_clk;
/**
* @mem_clk: memory clock rate in Hz
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 02/35] x86: Drop use of global_data fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 03/35] video: Add a function to obtain the framebuffer address Simon Glass
` (34 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng
This value is set by not used on x86 so there is no point in setting it.
Drop the assignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/x86/lib/fsp/fsp_graphics.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index 5f7701265a9..ad25020086c 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -103,7 +103,6 @@ static int fsp_video_probe(struct udevice *dev)
* For IGD, it seems to be always on BAR2.
*/
vesa->phys_base_ptr = dm_pci_read_bar32(dev, 2);
- gd->fb_base = vesa->phys_base_ptr;
ret = vesa_setup_video_priv(vesa, vesa->phys_base_ptr, uc_priv, plat);
if (ret)
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 03/35] video: Add a function to obtain the framebuffer address
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
2024-07-24 15:08 ` [PATCH 02/35] x86: Drop use of global_data fb_base Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 04/35] video: mxc: Avoid setting global_data fb_base Simon Glass
` (33 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Bin Meng,
Dan Carpenter, Devarsh Thakkar, Heinrich Schuchardt,
Nikhil M Jain, Peter Robinson
Add a new function which returns the framebuffer address of the first
video device. This will allow the global_data field top be dropped.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/video-uclass.c | 14 ++++++++++++++
include/video.h | 11 +++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index ff1382f4a43..cb3144f68e0 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -146,6 +146,20 @@ int video_reserve(ulong *addrp)
return 0;
}
+ulong video_get_fb(void)
+{
+ struct udevice *dev;
+
+ uclass_find_first_device(UCLASS_VIDEO, &dev);
+ if (dev) {
+ const struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+
+ return uc_plat->base;
+ }
+
+ return 0;
+}
+
int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
int yend, u32 colour)
{
diff --git a/include/video.h b/include/video.h
index 4d8df9baaad..ab3a7ff4930 100644
--- a/include/video.h
+++ b/include/video.h
@@ -418,4 +418,15 @@ int bmp_info(ulong addr);
*/
int video_reserve_from_bloblist(struct video_handoff *ho);
+/**
+ * video_get_fb() - Get the first framebuffer address
+ *
+ * This function does not probe video devices, so can only be used after a video
+ * device has been activated.
+ *
+ * Return: address of the framebuffer of the first video device found, or 0 if
+ * there is no device
+ */
+ulong video_get_fb(void);
+
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 04/35] video: mxc: Avoid setting global_data fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (2 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 03/35] video: Add a function to obtain the framebuffer address Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 05/35] video: mxs: " Simon Glass
` (32 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Peter Robinson
This is not used, so don't set it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/imx/mxc_ipuv3_fb.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c
index 039b22086a9..fdeb3cabea7 100644
--- a/drivers/video/imx/mxc_ipuv3_fb.c
+++ b/drivers/video/imx/mxc_ipuv3_fb.c
@@ -403,7 +403,6 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
(uint32_t) fbi->fix.smem_start, fbi->fix.smem_len);
fbi->screen_size = fbi->fix.smem_len;
- gd->fb_base = fbi->fix.smem_start;
/* Clear the screen */
memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
@@ -633,7 +632,6 @@ static int ipuv3_video_probe(struct udevice *dev)
mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
DCACHE_WRITEBACK);
video_set_flush_dcache(dev, true);
- gd->fb_base = fb_start;
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 05/35] video: mxs: Avoid setting global_data fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (3 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 04/35] video: mxc: Avoid setting global_data fb_base Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 06/35] arm: friendlyarm: Avoid accessing " Simon Glass
` (31 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Peter Robinson,
Sébastien Szymanski
This is not used, so don't set it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/mxsfb.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 792d6314d15..e72839cead4 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -335,7 +335,6 @@ static int mxs_video_probe(struct udevice *dev)
mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
DCACHE_WRITEBACK);
video_set_flush_dcache(dev, true);
- gd->fb_base = plat->base;
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 06/35] arm: friendlyarm: Avoid accessing global_data fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (4 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 05/35] video: mxs: " Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-29 17:57 ` Stefan Bosch
2024-07-24 15:08 ` [PATCH 07/35] arm: ronetix: " Simon Glass
` (30 subsequent siblings)
36 siblings, 1 reply; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Albert Aribaud, Stefan Bosch
Use the new video function to get the framebuffer base.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
board/friendlyarm/nanopi2/board.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/board/friendlyarm/nanopi2/board.c b/board/friendlyarm/nanopi2/board.c
index c8cbc5a15fa..b32dfc6b570 100644
--- a/board/friendlyarm/nanopi2/board.c
+++ b/board/friendlyarm/nanopi2/board.c
@@ -11,6 +11,7 @@
#ifdef CONFIG_PWM_NX
#include <pwm.h>
#endif
+#include <video.h>
#include <asm/global_data.h>
#include <asm/io.h>
@@ -492,12 +493,8 @@ int splash_screen_prepare(void)
ARRAY_SIZE(splash_locations));
}
- if (!err) {
- char addr[64];
-
- sprintf(addr, "0x%lx", gd->fb_base);
- env_set("fb_addr", addr);
- }
+ if (!err)
+ env_set_hex("fb_addr", video_get_fb());
return err;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 07/35] arm: ronetix: Avoid accessing global_data fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (5 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 06/35] arm: friendlyarm: Avoid accessing " Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 08/35] zynqmp: Avoid setting the framebuffer address Simon Glass
` (29 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Albert Aribaud, Ilko Iliev
Use the new video function to get the framebuffer base.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
board/ronetix/pm9263/pm9263.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/board/ronetix/pm9263/pm9263.c b/board/ronetix/pm9263/pm9263.c
index 1de1bd68701..8125f064cf1 100644
--- a/board/ronetix/pm9263/pm9263.c
+++ b/board/ronetix/pm9263/pm9263.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <init.h>
+#include <video.h>
#include <asm/global_data.h>
#include <linux/sizes.h>
#include <asm/io.h>
@@ -110,11 +111,12 @@ int dram_init_banksize(void)
#ifdef CONFIG_DISPLAY_BOARDINFO
int checkboard (void)
{
+ ulong fb_base = video_get_fb();
char *ss;
printf ("Board : Ronetix PM9263\n");
- switch (gd->fb_base) {
+ switch (fb_base) {
case PHYS_PSRAM:
ss = "(PSRAM)";
break;
@@ -127,7 +129,7 @@ int checkboard (void)
ss = "";
break;
}
- printf("Video memory : 0x%08lX %s\n", gd->fb_base, ss );
+ printf("Video memory : 0x%08lX %s\n", fb_base, ss);
printf ("\n");
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 08/35] zynqmp: Avoid setting the framebuffer address
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (6 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 07/35] arm: ronetix: " Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 09/35] video: Avoid setting global_data fb_base from SPL handoff Simon Glass
` (28 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Michal Simek,
Peter Robinson
This is handled by driver model so this driver should not be setting the
framebuffer address. Drop the assignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/zynqmp/zynqmp_dpsub.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/zynqmp/zynqmp_dpsub.c b/drivers/video/zynqmp/zynqmp_dpsub.c
index 1405b29cb8b..76abfeac443 100644
--- a/drivers/video/zynqmp/zynqmp_dpsub.c
+++ b/drivers/video/zynqmp/zynqmp_dpsub.c
@@ -49,7 +49,7 @@ static void dma_init_video_descriptor(struct udevice *dev)
DPDMA_DESCRIPTOR_ADDR_EXT_SRC_ADDR_EXT_SHIFT) |
(upper_32_bits((u64)&cur_desc)));
cur_desc.next_desr = lower_32_bits((u64)&cur_desc);
- cur_desc.src_addr = lower_32_bits((u64)gd->fb_base);
+ cur_desc.src_addr = lower_32_bits((u64)video_get_fb());
}
static void dma_set_descriptor_address(struct udevice *dev)
@@ -2134,7 +2134,6 @@ static int zynqmp_dpsub_probe(struct udevice *dev)
dev_dbg(dev, "BPP in bits %d, bpix %d\n",
priv->non_live_graphics->bpp, uc_priv->bpix);
- uc_priv->fb = (void *)gd->fb_base;
uc_priv->xsize = vidc_video_timing_modes[priv->video_mode].video_timing.h_active;
uc_priv->ysize = vidc_video_timing_modes[priv->video_mode].video_timing.v_active;
/* Calculated by core but need it for my own setup */
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 09/35] video: Avoid setting global_data fb_base from SPL handoff
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (7 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 08/35] zynqmp: Avoid setting the framebuffer address Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 10/35] video: Avoid setting global_data fb_base in video setup Simon Glass
` (27 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Bin Meng,
Devarsh Thakkar, Nikhil M Jain, Peter Robinson
This field is not used, so don't set it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/video-uclass.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index cb3144f68e0..1a2cde47a33 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -218,7 +218,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho)
return -ENOENT;
gd->video_bottom = ho->fb;
- gd->fb_base = ho->fb;
gd->video_top = ho->fb + ho->size;
debug("%s: Reserving %lx bytes at %08x as per bloblist received\n",
__func__, (unsigned long)ho->size, (u32)ho->fb);
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 10/35] video: Avoid setting global_data fb_base in video setup
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (8 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 09/35] video: Avoid setting global_data fb_base from SPL handoff Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 11/35] global_data: Drop fb_base Simon Glass
` (26 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Anatolij Gustschin, Bin Meng,
Devarsh Thakkar, Nikhil M Jain, Peter Robinson
This field is not used, so don't set it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/video/video-uclass.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 1a2cde47a33..f75c0d4c937 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -139,7 +139,6 @@ int video_reserve(ulong *addrp)
*addrp -= CONFIG_VAL(VIDEO_PCI_DEFAULT_FB_SIZE);
gd->video_bottom = *addrp;
- gd->fb_base = *addrp;
debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
gd->video_top);
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 11/35] global_data: Drop fb_base
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (9 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 10/35] video: Avoid setting global_data fb_base in video setup Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-07-24 15:08 ` [PATCH 12/35] global_data: Convert have_console into a flag Simon Glass
` (25 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
This value mirrors information recorded by driver model video drivers,
so can be removed to save space. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 970053892e1..af568e99f47 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -63,12 +63,6 @@ struct global_data {
* @mem_clk: memory clock rate in Hz
*/
unsigned long mem_clk;
-#if CONFIG_IS_ENABLED(VIDEO)
- /**
- * @fb_base: base address of frame buffer memory
- */
- unsigned long fb_base;
-#endif
#if defined(CONFIG_POST)
/**
* @post_log_word: active POST tests
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 12/35] global_data: Convert have_console into a flag
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (10 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 11/35] global_data: Drop fb_base Simon Glass
@ 2024-07-24 15:08 ` Simon Glass
2024-08-16 13:08 ` Sverdlin, Alexander
2024-07-24 15:09 ` [PATCH 13/35] global_data: Remove pci_ram_top Simon Glass
` (24 subsequent siblings)
36 siblings, 1 reply; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:08 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Alexander Sverdlin, Andrew Davis,
Aradhya Bhatia, Bin Meng, Devarsh Thakkar, Enrico Leto,
Fabio Estevam, Francis Laniel, Heinrich Schuchardt, Ion Agorria,
Joao Paulo Goncalves, Jonas Karlman, MD Danish Anwar, Marek Vasut,
Matthias Schiffer, Mattijs Korpershoek, Minkyu Kang,
NXP i.MX U-Boot Team, Nishanth Menon, Patrice Chotard, Peng Fan,
Ravi Gunasekaran, Raymond Mao, Sean Anderson, Shiji Yang,
Stefano Babic, Svyatoslav Ryhel,
This contributor prefers not to receive mails, Vitor Soares
We don't need a full word for this boolean value. Convert it into a flag
to save space in global_data.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
arch/arm/mach-exynos/spl_boot.c | 2 +-
arch/arm/mach-k3/common.c | 2 +-
arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
board/siemens/common/board_am335x.c | 2 +-
common/board_f.c | 2 +-
common/console.c | 14 +++++++-------
common/spl/spl.c | 2 +-
include/asm-generic/global_data.h | 17 +++++++----------
9 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
index 76a69d7f958..dd748328293 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
@@ -117,7 +117,7 @@ static void mxs_spl_console_init(void)
gd->bd = &bdata;
gd->baudrate = CONFIG_BAUDRATE;
serial_init();
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
#endif
}
diff --git a/arch/arm/mach-exynos/spl_boot.c b/arch/arm/mach-exynos/spl_boot.c
index bd5a06447b9..219d7fbf957 100644
--- a/arch/arm/mach-exynos/spl_boot.c
+++ b/arch/arm/mach-exynos/spl_boot.c
@@ -312,7 +312,7 @@ static void setup_global_data(gd_t *gdp)
memzero((void *)gd, sizeof(gd_t));
gd->flags |= GD_FLG_RELOC;
gd->baudrate = CONFIG_BAUDRATE;
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
}
void board_init_f(unsigned long bootflag)
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index eaa7d361767..df48ec8d479 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -104,7 +104,7 @@ int early_console_init(void)
gd->cur_serial_dev = dev;
gd->flags |= GD_FLG_SERIAL_READY;
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
return 0;
}
diff --git a/arch/arm/mach-k3/r5/sysfw-loader.c b/arch/arm/mach-k3/r5/sysfw-loader.c
index 94d051ba0fb..188731e673d 100644
--- a/arch/arm/mach-k3/r5/sysfw-loader.c
+++ b/arch/arm/mach-k3/r5/sysfw-loader.c
@@ -451,7 +451,7 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
* the case when continuing to boot serially from the same
* UART that the ROM loaded the initial bootloader from.
*/
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
early_console_init();
#endif
ret = spl_ymodem_load_image(&spl_image, &bootdev);
diff --git a/board/siemens/common/board_am335x.c b/board/siemens/common/board_am335x.c
index 2a727606bc3..e6537b0675a 100644
--- a/board/siemens/common/board_am335x.c
+++ b/board/siemens/common/board_am335x.c
@@ -36,7 +36,7 @@ void set_mux_conf_regs(void)
/* enable early the console */
gd->baudrate = CONFIG_BAUDRATE;
serial_init();
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
siemens_ee_setup();
if (draco_read_eeprom() < 0)
diff --git a/common/board_f.c b/common/board_f.c
index 29e185137ad..1935b1dd11b 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -1006,7 +1006,7 @@ static const init_fnc_t init_sequence_f[] = {
void board_init_f(ulong boot_flags)
{
gd->flags = boot_flags;
- gd->have_console = 0;
+ gd->flags &= ~GD_FLG_HAVE_CONSOLE;
if (initcall_run_list(init_sequence_f))
hang();
diff --git a/common/console.c b/common/console.c
index 63f78004fdb..30ddefef6b1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -586,7 +586,7 @@ int getchar(void)
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
return 0;
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
return 0;
ch = console_record_getc();
@@ -607,7 +607,7 @@ int tstc(void)
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
return 0;
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
return 0;
if (console_record_tstc())
@@ -715,7 +715,7 @@ void putc(const char c)
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
return;
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
return pre_console_putc(c);
if (gd->flags & GD_FLG_DEVINIT) {
@@ -759,7 +759,7 @@ void puts(const char *s)
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
return;
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
return pre_console_puts(s);
if (gd->flags & GD_FLG_DEVINIT) {
@@ -793,7 +793,7 @@ void flush(void)
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
return;
- if (!gd->have_console)
+ if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
return;
if (gd->flags & GD_FLG_DEVINIT) {
@@ -872,7 +872,7 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */
static int ctrlc_was_pressed = 0;
int ctrlc(void)
{
- if (!ctrlc_disabled && gd->have_console) {
+ if (!ctrlc_disabled && (gd->flags & GD_FLG_HAVE_CONSOLE)) {
if (tstc()) {
switch (getchar()) {
case 0x03: /* ^C - Control C */
@@ -1011,7 +1011,7 @@ int console_announce_r(void)
/* Called before relocation - use serial functions */
int console_init_f(void)
{
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
console_update_silent();
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7794ddccade..de34fb06548 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -832,7 +832,7 @@ void preloader_console_init(void)
serial_init(); /* serial communications setup */
- gd->have_console = 1;
+ gd->flags |= GD_FLG_HAVE_CONSOLE;
#if CONFIG_IS_ENABLED(BANNER_PRINT)
puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index af568e99f47..f98d821e085 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -92,15 +92,6 @@ struct global_data {
*/
unsigned long board_type;
#endif
- /**
- * @have_console: console is available
- *
- * A value of 1 indicates that serial_init() was called and a console
- * is available.
- * A value of 0 indicates that console input and output drivers shall
- * not be called.
- */
- unsigned long have_console;
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
/**
* @precon_buf_idx: pre-console buffer index
@@ -219,7 +210,7 @@ struct global_data {
#endif
#ifdef CONFIG_TIMER
/**
- * @timer: timer instance for Driver Model
+s * @timer: timer instance for Driver Model
*/
struct udevice *timer;
#endif
@@ -690,6 +681,12 @@ enum gd_flags {
* @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
*/
GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
+ /**
+ * @GD_FLG_HAVE_CONSOLE: serial_init() was called and a console
+ * is available. When not set, indicates that console input and output
+ * drivers shall not be called.
+ */
+ GD_FLG_HAVE_CONSOLE = 0x4000000,
};
#endif /* __ASSEMBLY__ */
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 13/35] global_data: Remove pci_ram_top
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (11 preceding siblings ...)
2024-07-24 15:08 ` [PATCH 12/35] global_data: Convert have_console into a flag Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 14/35] global_data: Drop global_data hose Simon Glass
` (23 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel,
Heinrich Schuchardt, Svyatoslav Ryhel, Thierry Reding, Troy Kisky
This field is set but not used. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/arm/mach-tegra/board2.c | 4 ----
arch/arm/mach-tegra/cboot.c | 4 ----
arch/x86/cpu/i386/cpu.c | 8 --------
include/asm-generic/global_data.h | 10 ----------
4 files changed, 26 deletions(-)
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 479137e457c..7971e3b68d5 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -423,10 +423,6 @@ int dram_init_banksize(void)
gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = usable_ram_size_below_4g();
-#ifdef CONFIG_PCI
- gd->pci_ram_top = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
-#endif
-
#ifdef CONFIG_PHYS_64BIT
if (gd->ram_size > SZ_2G) {
gd->bd->bi_dram[1].start = 0x100000000;
diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
index c12543d71ac..e2342b2aece 100644
--- a/arch/arm/mach-tegra/cboot.c
+++ b/arch/arm/mach-tegra/cboot.c
@@ -189,10 +189,6 @@ int cboot_dram_init_banksize(void)
gd->bd->bi_dram[i].size = tegra_mem_map[1 + i].size;
}
-#ifdef CONFIG_PCI
- gd->pci_ram_top = ram_top;
-#endif
-
return 0;
}
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index db2727d7485..934e98ac582 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -412,12 +412,6 @@ int cpu_phys_address_size(void)
return 32;
}
-/* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
-static void setup_pci_ram_top(void)
-{
- gd_set_pci_ram_top(0x80000000U);
-}
-
static void setup_mtrr(void)
{
u64 mtrr_cap;
@@ -469,7 +463,6 @@ int x86_cpu_init_f(void)
setup_cpu_features();
setup_identity();
setup_mtrr();
- setup_pci_ram_top();
/* Set up the i8254 timer if required */
if (IS_ENABLED(CONFIG_I8254_TIMER))
@@ -483,7 +476,6 @@ int x86_cpu_reinit_f(void)
long addr;
setup_identity();
- setup_pci_ram_top();
addr = locate_coreboot_table();
if (addr >= 0) {
gd->arch.coreboot_table = addr;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index f98d821e085..d014beb2617 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -302,10 +302,6 @@ s * @timer: timer instance for Driver Model
* @hose: PCI hose for early use
*/
struct pci_controller *hose;
- /**
- * @pci_ram_top: top of region accessible to PCI
- */
- phys_addr_t pci_ram_top;
#endif
#ifdef CONFIG_PCI_BOOTDELAY
/**
@@ -558,12 +554,6 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_set_malloc_start(val)
#endif
-#if CONFIG_IS_ENABLED(PCI)
-#define gd_set_pci_ram_top(val) gd->pci_ram_top = val
-#else
-#define gd_set_pci_ram_top(val)
-#endif
-
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
#define gd_malloc_ptr() gd->malloc_ptr
#else
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 14/35] global_data: Drop global_data hose
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (12 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 13/35] global_data: Remove pci_ram_top Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 15/35] global_data: Drop pci_bootdelay Simon Glass
` (22 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
This is set on one x86 boards, but is not used anymore. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/x86/cpu/ivybridge/cpu.c | 5 -----
include/asm-generic/global_data.h | 8 +-------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
index d71ab0a6385..05691a38d2e 100644
--- a/arch/x86/cpu/ivybridge/cpu.c
+++ b/arch/x86/cpu/ivybridge/cpu.c
@@ -55,7 +55,6 @@ int arch_cpu_init(void)
static int ivybridge_cpu_init(void)
{
- struct pci_controller *hose;
struct udevice *bus, *dev;
int ret;
@@ -65,10 +64,6 @@ static int ivybridge_cpu_init(void)
if (ret)
return ret;
post_code(0x72);
- hose = dev_get_uclass_priv(bus);
-
- /* TODO(sjg@chromium.org): Get rid of gd->hose */
- gd->hose = hose;
ret = uclass_first_device_err(UCLASS_LPC, &dev);
if (ret)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index d014beb2617..e57015365c1 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -210,7 +210,7 @@ struct global_data {
#endif
#ifdef CONFIG_TIMER
/**
-s * @timer: timer instance for Driver Model
+ * @timer: timer instance for Driver Model
*/
struct udevice *timer;
#endif
@@ -297,12 +297,6 @@ s * @timer: timer instance for Driver Model
*/
unsigned long malloc_ptr;
#endif
-#ifdef CONFIG_PCI
- /**
- * @hose: PCI hose for early use
- */
- struct pci_controller *hose;
-#endif
#ifdef CONFIG_PCI_BOOTDELAY
/**
* @pcidelay_done: delay time before scanning of PIC hose expired
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 15/35] global_data: Drop pci_bootdelay
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (13 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 14/35] global_data: Drop global_data hose Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 16/35] global_data: Use less space for environment fields Simon Glass
` (21 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Algapally Santosh Sagar, Bin Meng,
Francis Laniel, Janne Grunau, Joe Hershberger, Michal Simek,
Venkatesh Yadav Abbarapu
This is not used. Drop the field and the environment code which uses it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 11 -----------
include/env_default.h | 3 ---
2 files changed, 14 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index e57015365c1..d8be0654a87 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -296,17 +296,6 @@ struct global_data {
* @malloc_ptr: current address of early malloc()
*/
unsigned long malloc_ptr;
-#endif
-#ifdef CONFIG_PCI_BOOTDELAY
- /**
- * @pcidelay_done: delay time before scanning of PIC hose expired
- *
- * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
- * milliseconds defined by environment variable pcidelay before
- * scanning. Once this delay has expired the flag @pcidelay_done
- * is set to 1.
- */
- int pcidelay_done;
#endif
/**
* @cur_serial_dev: current serial device
diff --git a/include/env_default.h b/include/env_default.h
index 076ffdd44e9..aa3dd40f3fa 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -82,9 +82,6 @@ const char default_environment[] = {
#ifdef CONFIG_SYS_LOAD_ADDR
"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0"
#endif
-#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
- "pcidelay=" __stringify(CONFIG_PCI_BOOTDELAY)"\0"
-#endif
#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG
"arch=" CONFIG_SYS_ARCH "\0"
#ifdef CONFIG_SYS_CPU
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 16/35] global_data: Use less space for environment fields
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (14 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 15/35] global_data: Drop pci_bootdelay Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 17/35] board_f: Add a new struct to hold pre-relocation info Simon Glass
` (20 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Algapally Santosh Sagar, Bin Meng,
Francis Laniel, Joe Hershberger, Michal Simek,
Venkatesh Yadav Abbarapu
Use shorter types for some of these fields to save space. Reorder to put
fields with like alignment together.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 14 +++++++-------
include/env_internal.h | 1 +
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index d8be0654a87..0904fcf77fc 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -113,21 +113,21 @@ struct global_data {
*/
unsigned long env_addr;
/**
- * @env_valid: environment is valid
+ * @env_has_init: bit mask indicating environment locations
*
- * See &enum env_valid
+ * &enum env_location defines which bit relates to which location
*/
- unsigned long env_valid;
+ unsigned short env_has_init;
/**
- * @env_has_init: bit mask indicating environment locations
+ * @env_valid: environment is valid
*
- * &enum env_location defines which bit relates to which location
+ * See &enum env_valid
*/
- unsigned long env_has_init;
+ unsigned char env_valid;
/**
* @env_load_prio: priority of the loaded environment
*/
- int env_load_prio;
+ char env_load_prio;
/**
* @ram_base: base address of RAM used by U-Boot
*/
diff --git a/include/env_internal.h b/include/env_internal.h
index cbd1ef3e914..2a66a98b97e 100644
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -101,6 +101,7 @@ extern const char default_environment[];
#include <env_flags.h>
#include <search.h>
+/* this is stored as bits in gd->env_has_init so is limited to 16 entries */
enum env_location {
ENVL_UNKNOWN,
ENVL_EEPROM,
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 17/35] board_f: Add a new struct to hold pre-relocation info
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (15 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 16/35] global_data: Use less space for environment fields Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 18/35] board_f: Move fdt_size to board Simon Glass
` (19 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Marek Vasut, Raymond Mao, Shiji Yang,
This contributor prefers not to receive mails
Quite a few of the members of struct global_data are only used before
reloction, or have little meaning afterwards, yet they hang around in
struct global_data for the lifetime of U-Boot. This uses up precious
pre-relocation SRAM on many boards.
To help with this, start a new struct which exists only before
relocation. Move new_fdt into this new struct. Drop the display of it
in the 'bdinfo' command as it is probably not very useful.
Note that the field does not exist in SPL builds.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
cmd/bdinfo.c | 1 -
common/board_f.c | 11 +++++++----
include/asm-generic/global_data.h | 11 +++++++----
include/board_f.h | 23 +++++++++++++++++++++++
test/cmd/bdinfo.c | 2 --
5 files changed, 37 insertions(+), 11 deletions(-)
create mode 100644 include/board_f.h
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 437ac4e8630..b53b51acca4 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -154,7 +154,6 @@ static int bdinfo_print_all(struct bd_info *bd)
if (IS_ENABLED(CONFIG_CMD_NET))
print_eth();
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
- bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt));
bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size);
if (IS_ENABLED(CONFIG_VIDEO))
show_video_info();
diff --git a/common/board_f.c b/common/board_f.c
index 1935b1dd11b..2125eb5ca50 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -577,7 +577,7 @@ static int reserve_fdt(void)
gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32);
gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size);
- gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
+ gd->boardf->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
debug("Reserving %lu Bytes for FDT at: %08lx\n",
gd->fdt_size, gd->start_addr_sp);
}
@@ -667,10 +667,10 @@ static int init_post(void)
static int reloc_fdt(void)
{
if (!IS_ENABLED(CONFIG_OF_EMBED)) {
- if (gd->new_fdt) {
- memcpy(gd->new_fdt, gd->fdt_blob,
+ if (gd->boardf->new_fdt) {
+ memcpy(gd->boardf->new_fdt, gd->fdt_blob,
fdt_totalsize(gd->fdt_blob));
- gd->fdt_blob = gd->new_fdt;
+ gd->fdt_blob = gd->boardf->new_fdt;
}
}
@@ -1005,8 +1005,11 @@ static const init_fnc_t init_sequence_f[] = {
void board_init_f(ulong boot_flags)
{
+ struct board_f boardf;
+
gd->flags = boot_flags;
gd->flags &= ~GD_FLG_HAVE_CONSOLE;
+ gd->boardf = &boardf;
if (initcall_run_list(init_sequence_f))
hang();
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 0904fcf77fc..bd053f77f6c 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -20,6 +20,7 @@
*/
#ifndef __ASSEMBLY__
+#include <board_f.h>
#include <cyclic.h>
#include <event_internal.h>
#include <fdtdec.h>
@@ -41,6 +42,12 @@ struct global_data {
* @bd: board information
*/
struct bd_info *bd;
+#ifndef CONFIG_SPL_BUILD
+ /**
+ * @boardf: information only used before relocation
+ */
+ struct board_f *boardf;
+#endif
/**
* @flags: global data flags
*
@@ -218,10 +225,6 @@ struct global_data {
* @fdt_blob: U-Boot's own device tree, NULL if none
*/
const void *fdt_blob;
- /**
- * @new_fdt: relocated device tree
- */
- void *new_fdt;
/**
* @fdt_size: space reserved for relocated device space
*/
diff --git a/include/board_f.h b/include/board_f.h
new file mode 100644
index 00000000000..74fca6df75c
--- /dev/null
+++ b/include/board_f.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 Google LLC
+ * Written by: Simon Glass <sjg@chromeium.org>
+ */
+
+#ifndef __BOARD_F
+#define __BOARD_F
+
+/**
+ * struct board_f: Information used only before relocation
+ *
+ * This struct is set up in board_init_f() and used to deal with relocation. It
+ * is not available after relocation.
+ */
+struct board_f {
+ /**
+ * @new_fdt: relocated device tree
+ */
+ void *new_fdt;
+};
+
+#endif
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 027848c3e24..60adc4aa960 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -185,8 +185,6 @@ static int bdinfo_test_all(struct unit_test_state *uts)
ut_assert(map_to_sysmem(gd->fdt_blob) == env_get_hex("fdtcontroladdr", 0x1234));
ut_assertok(test_num_l(uts, "fdt_blob",
(ulong)map_to_sysmem(gd->fdt_blob)));
- ut_assertok(test_num_l(uts, "new_fdt",
- (ulong)map_to_sysmem(gd->new_fdt)));
ut_assertok(test_num_l(uts, "fdt_size", (ulong)gd->fdt_size));
if (IS_ENABLED(CONFIG_VIDEO))
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 18/35] board_f: Move fdt_size to board
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (16 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 17/35] board_f: Add a new struct to hold pre-relocation info Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 19/35] board_f: Move new_bootstage to boardf Simon Glass
` (18 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Marek Vasut, Raymond Mao, Shiji Yang,
This contributor prefers not to receive mails
This value is only really used before relocation. There is not much use
to showing its value in bdinfo, so drop it. Move it to the new boardf
struct.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
cmd/bdinfo.c | 1 -
common/board_f.c | 11 +++++++----
include/asm-generic/global_data.h | 4 ----
include/board_f.h | 4 ++++
test/cmd/bdinfo.c | 1 -
5 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index b53b51acca4..59fbaea498b 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -154,7 +154,6 @@ static int bdinfo_print_all(struct bd_info *bd)
if (IS_ENABLED(CONFIG_CMD_NET))
print_eth();
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
- bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size);
if (IS_ENABLED(CONFIG_VIDEO))
show_video_info();
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
diff --git a/common/board_f.c b/common/board_f.c
index 2125eb5ca50..71194cccdb5 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -574,12 +574,15 @@ static int reserve_fdt(void)
* section, then it will be relocated with other data.
*/
if (gd->fdt_blob) {
- gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32);
+ gd->boardf->fdt_size =
+ ALIGN(fdt_totalsize(gd->fdt_blob), 32);
- gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size);
- gd->boardf->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
+ gd->start_addr_sp = reserve_stack_aligned(
+ gd->boardf->fdt_size);
+ gd->boardf->new_fdt = map_sysmem(gd->start_addr_sp,
+ gd->boardf->fdt_size);
debug("Reserving %lu Bytes for FDT at: %08lx\n",
- gd->fdt_size, gd->start_addr_sp);
+ gd->boardf->fdt_size, gd->start_addr_sp);
}
}
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index bd053f77f6c..81becbac2ad 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -225,10 +225,6 @@ struct global_data {
* @fdt_blob: U-Boot's own device tree, NULL if none
*/
const void *fdt_blob;
- /**
- * @fdt_size: space reserved for relocated device space
- */
- unsigned long fdt_size;
/**
* @fdt_src: Source of FDT
*/
diff --git a/include/board_f.h b/include/board_f.h
index 74fca6df75c..d9c793fbeb1 100644
--- a/include/board_f.h
+++ b/include/board_f.h
@@ -18,6 +18,10 @@ struct board_f {
* @new_fdt: relocated device tree
*/
void *new_fdt;
+ /**
+ * @fdt_size: space reserved for relocated device space
+ */
+ unsigned long fdt_size;
};
#endif
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 60adc4aa960..591390560b7 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -185,7 +185,6 @@ static int bdinfo_test_all(struct unit_test_state *uts)
ut_assert(map_to_sysmem(gd->fdt_blob) == env_get_hex("fdtcontroladdr", 0x1234));
ut_assertok(test_num_l(uts, "fdt_blob",
(ulong)map_to_sysmem(gd->fdt_blob)));
- ut_assertok(test_num_l(uts, "fdt_size", (ulong)gd->fdt_size));
if (IS_ENABLED(CONFIG_VIDEO))
ut_assertok(test_video_info(uts));
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 19/35] board_f: Move new_bootstage to boardf
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (17 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 18/35] board_f: Move fdt_size to board Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 20/35] board_f: Move new_bloblist " Simon Glass
` (17 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Raymond Mao, Shiji Yang,
This contributor prefers not to receive mails
This value is only used before relocation. Move it to the new boardf
struct.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/board_f.c | 10 +++++-----
include/asm-generic/global_data.h | 4 ----
include/board_f.h | 4 ++++
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 71194cccdb5..83f14560cda 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -595,7 +595,7 @@ static int reserve_bootstage(void)
int size = bootstage_get_size();
gd->start_addr_sp = reserve_stack_aligned(size);
- gd->new_bootstage = map_sysmem(gd->start_addr_sp, size);
+ gd->boardf->new_bootstage = map_sysmem(gd->start_addr_sp, size);
debug("Reserving %#x Bytes for bootstage at: %08lx\n", size,
gd->start_addr_sp);
#endif
@@ -685,13 +685,13 @@ static int reloc_bootstage(void)
#ifdef CONFIG_BOOTSTAGE
if (gd->flags & GD_FLG_SKIP_RELOC)
return 0;
- if (gd->new_bootstage) {
+ if (gd->boardf->new_bootstage) {
int size = bootstage_get_size();
debug("Copying bootstage from %p to %p, size %x\n",
- gd->bootstage, gd->new_bootstage, size);
- memcpy(gd->new_bootstage, gd->bootstage, size);
- gd->bootstage = gd->new_bootstage;
+ gd->bootstage, gd->boardf->new_bootstage, size);
+ memcpy(gd->boardf->new_bootstage, gd->bootstage, size);
+ gd->bootstage = gd->boardf->new_bootstage;
bootstage_relocate();
}
#endif
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 81becbac2ad..8f88ce09f4a 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -334,10 +334,6 @@ struct global_data {
* @bootstage: boot stage information
*/
struct bootstage_data *bootstage;
- /**
- * @new_bootstage: relocated boot stage information
- */
- struct bootstage_data *new_bootstage;
#endif
#ifdef CONFIG_LOG
/**
diff --git a/include/board_f.h b/include/board_f.h
index d9c793fbeb1..1eba236a961 100644
--- a/include/board_f.h
+++ b/include/board_f.h
@@ -22,6 +22,10 @@ struct board_f {
* @fdt_size: space reserved for relocated device space
*/
unsigned long fdt_size;
+ /**
+ * @new_bootstage: relocated boot stage information
+ */
+ struct bootstage_data *new_bootstage;
};
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 20/35] board_f: Move new_bloblist to boardf
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (18 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 19/35] board_f: Move new_bootstage to boardf Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 21/35] global_data: Drop spl_handoff Simon Glass
` (16 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Raymond Mao, Shiji Yang,
This contributor prefers not to receive mails
This value is only used before relocation. Move it to the new boardf
struct.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/board_f.c | 11 ++++++-----
include/asm-generic/global_data.h | 4 ----
include/board_f.h | 4 ++++
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 83f14560cda..1e698d31841 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -626,8 +626,8 @@ static int reserve_bloblist(void)
/* Align to a 4KB boundary for easier reading of addresses */
gd->start_addr_sp = ALIGN_DOWN(gd->start_addr_sp -
CONFIG_BLOBLIST_SIZE_RELOC, 0x1000);
- gd->new_bloblist = map_sysmem(gd->start_addr_sp,
- CONFIG_BLOBLIST_SIZE_RELOC);
+ gd->boardf->new_bloblist = map_sysmem(gd->start_addr_sp,
+ CONFIG_BLOBLIST_SIZE_RELOC);
#endif
return 0;
@@ -710,10 +710,11 @@ static int reloc_bloblist(void)
debug("Not relocating bloblist\n");
return 0;
}
- if (gd->new_bloblist) {
+ if (gd->boardf->new_bloblist) {
debug("Copying bloblist from %p to %p, size %x\n",
- gd->bloblist, gd->new_bloblist, gd->bloblist->total_size);
- return bloblist_reloc(gd->new_bloblist,
+ gd->bloblist, gd->boardf->new_bloblist,
+ gd->bloblist->total_size);
+ return bloblist_reloc(gd->boardf->new_bloblist,
CONFIG_BLOBLIST_SIZE_RELOC);
}
#endif
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 8f88ce09f4a..a23925ba9b3 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -394,10 +394,6 @@ struct global_data {
* @bloblist: blob list information
*/
struct bloblist_hdr *bloblist;
- /**
- * @new_bloblist: relocated blob list information
- */
- struct bloblist_hdr *new_bloblist;
#endif
#if CONFIG_IS_ENABLED(HANDOFF)
/**
diff --git a/include/board_f.h b/include/board_f.h
index 1eba236a961..05aa51510c2 100644
--- a/include/board_f.h
+++ b/include/board_f.h
@@ -26,6 +26,10 @@ struct board_f {
* @new_bootstage: relocated boot stage information
*/
struct bootstage_data *new_bootstage;
+ /**
+ * @new_bloblist: relocated blob list information
+ */
+ struct bloblist_hdr *new_bloblist;
};
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 21/35] global_data: Drop spl_handoff
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (19 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 20/35] board_f: Move new_bloblist " Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 22/35] global_data: Collect common fields at the top Simon Glass
` (15 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Heinrich Schuchardt, Jonas Karlman, Kever Yang, Lukasz Majewski,
Philipp Tomsich, Quentin Schulz, Raymond Mao, Sean Anderson,
Shiji Yang, This contributor prefers not to receive mails
Provide a function to locate this information, rather than doing it
automatically on startup, to save space in global_data.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/x86/cpu/intel_common/cpu_from_spl.c | 4 +---
arch/x86/lib/fsp2/fsp_dram.c | 4 ++--
cmd/sb.c | 6 ++++--
common/board_f.c | 12 ------------
common/init/handoff.c | 12 ++++++++++++
drivers/clk/rockchip/clk_rk3399.c | 3 ++-
include/asm-generic/global_data.h | 6 ------
include/handoff.h | 7 +++++++
8 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/arch/x86/cpu/intel_common/cpu_from_spl.c b/arch/x86/cpu/intel_common/cpu_from_spl.c
index 48b2ef253cb..5aad2ae7309 100644
--- a/arch/x86/cpu/intel_common/cpu_from_spl.c
+++ b/arch/x86/cpu/intel_common/cpu_from_spl.c
@@ -24,9 +24,7 @@ int arch_cpu_init(void)
int ret;
#if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB)
- struct spl_handoff *ho = gd->spl_handoff;
-
- gd->arch.hob_list = ho->arch.hob_list;
+ gd->arch.hob_list = handoff_get();
#endif
ret = x86_cpu_reinit_f();
diff --git a/arch/x86/lib/fsp2/fsp_dram.c b/arch/x86/lib/fsp2/fsp_dram.c
index 83c6d7bcc93..a50dc985a3c 100644
--- a/arch/x86/lib/fsp2/fsp_dram.c
+++ b/arch/x86/lib/fsp2/fsp_dram.c
@@ -59,7 +59,7 @@ int dram_init(void)
#endif
} else {
#if CONFIG_IS_ENABLED(HANDOFF)
- struct spl_handoff *ho = gd->spl_handoff;
+ struct spl_handoff *ho = handoff_get();
if (!ho) {
log_debug("No SPL handoff found\n");
@@ -82,7 +82,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
return gd->ram_size;
#if CONFIG_IS_ENABLED(HANDOFF)
- struct spl_handoff *ho = gd->spl_handoff;
+ struct spl_handoff *ho = handoff_get();
log_debug("usable_ram_top = %lx\n", ho->arch.usable_ram_top);
diff --git a/cmd/sb.c b/cmd/sb.c
index 1aa5921f03e..db485fddfca 100644
--- a/cmd/sb.c
+++ b/cmd/sb.c
@@ -14,8 +14,10 @@ static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
#if CONFIG_IS_ENABLED(HANDOFF)
- if (gd->spl_handoff)
- printf("SPL handoff magic %lx\n", gd->spl_handoff->arch.magic);
+ struct spl_handoff *handoff = handoff_get();
+
+ if (handoff)
+ printf("SPL handoff magic %lx\n", handoff->arch.magic);
else
printf("SPL handoff info not received\n");
diff --git a/common/board_f.c b/common/board_f.c
index 1e698d31841..c99b573bc17 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -304,17 +304,6 @@ static int setup_mon_len(void)
return 0;
}
-static int setup_spl_handoff(void)
-{
-#if CONFIG_IS_ENABLED(HANDOFF)
- gd->spl_handoff = bloblist_find(BLOBLISTT_U_BOOT_SPL_HANDOFF,
- sizeof(struct spl_handoff));
- debug("Found SPL hand-off info %p\n", gd->spl_handoff);
-#endif
-
- return 0;
-}
-
__weak int arch_cpu_init(void)
{
return 0;
@@ -876,7 +865,6 @@ static const init_fnc_t init_sequence_f[] = {
initf_bootstage, /* uses its own timer, so does not need DM */
event_init,
bloblist_maybe_init,
- setup_spl_handoff,
#if defined(CONFIG_CONSOLE_RECORD_INIT_F)
console_record_init,
#endif
diff --git a/common/init/handoff.c b/common/init/handoff.c
index a7cd065fb38..86c020ee0b9 100644
--- a/common/init/handoff.c
+++ b/common/init/handoff.c
@@ -5,6 +5,7 @@
* Copyright 2018 Google, Inc
*/
+#include <bloblist.h>
#include <handoff.h>
#include <asm/global_data.h>
@@ -38,3 +39,14 @@ void handoff_load_dram_banks(struct spl_handoff *ho)
bd->bi_dram[i].size = ho->ram_bank[i].size;
}
}
+
+struct spl_handoff *handoff_get(void)
+{
+ struct spl_handoff *handoff;
+
+ handoff = bloblist_find(BLOBLISTT_U_BOOT_SPL_HANDOFF,
+ sizeof(struct spl_handoff));
+ debug("Found SPL hand-off info %p\n", handoff);
+
+ return handoff;
+}
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index 24cefebd1b2..89924041299 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -8,6 +8,7 @@
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <handoff.h>
#include <log.h>
#include <malloc.h>
#include <mapmem.h>
@@ -1467,7 +1468,7 @@ static int rk3399_clk_probe(struct udevice *dev)
init_clocks = true;
#elif CONFIG_IS_ENABLED(HANDOFF)
if (!(gd->flags & GD_FLG_RELOC)) {
- if (!(gd->spl_handoff))
+ if (!handoff_get())
init_clocks = true;
}
#endif
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index a23925ba9b3..1331686066c 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -395,12 +395,6 @@ struct global_data {
*/
struct bloblist_hdr *bloblist;
#endif
-#if CONFIG_IS_ENABLED(HANDOFF)
- /**
- * @spl_handoff: SPL hand-off information
- */
- struct spl_handoff *spl_handoff;
-#endif
#if defined(CONFIG_TRANSLATION_OFFSET)
/**
* @translation_offset: optional translation offset
diff --git a/include/handoff.h b/include/handoff.h
index c0ae7b19a75..0072ea832f8 100644
--- a/include/handoff.h
+++ b/include/handoff.h
@@ -31,6 +31,13 @@ void handoff_save_dram(struct spl_handoff *ho);
void handoff_load_dram_size(struct spl_handoff *ho);
void handoff_load_dram_banks(struct spl_handoff *ho);
+/**
+ * handoff_get() - Get the SPL handoff information
+ *
+ * Return: Pointer to SPL handoff if received, else NULL
+ */
+struct spl_handoff *handoff_get(void);
+
/**
* handoff_arch_save() - Save arch-specific info into the handoff area
*
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 22/35] global_data: Collect common fields at the top
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (20 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 21/35] global_data: Drop spl_handoff Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 23/35] global_data: Reduce the size of bus_clk and mem_clk Simon Glass
` (14 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Move all the fields which are always present to the top of the struct,
so we can potentially save some space by taking note of alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 166 +++++++++++++++---------------
1 file changed, 82 insertions(+), 84 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 1331686066c..48241d10034 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -70,48 +70,6 @@ struct global_data {
* @mem_clk: memory clock rate in Hz
*/
unsigned long mem_clk;
-#if defined(CONFIG_POST)
- /**
- * @post_log_word: active POST tests
- *
- * @post_log_word is a bit mask defining which POST tests are recorded
- * (see constants POST_*).
- */
- unsigned long post_log_word;
- /**
- * @post_log_res: POST results
- *
- * @post_log_res is a bit mask with the POST results. A bit with value 1
- * indicates successful execution.
- */
- unsigned long post_log_res;
- /**
- * @post_init_f_time: time in ms when post_init_f() started
- */
- unsigned long post_init_f_time;
-#endif
-#ifdef CONFIG_BOARD_TYPES
- /**
- * @board_type: board type
- *
- * If a U-Boot configuration supports multiple board types, the actual
- * board type may be stored in this field.
- */
- unsigned long board_type;
-#endif
-#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
- /**
- * @precon_buf_idx: pre-console buffer index
- *
- * @precon_buf_idx indicates the current position of the
- * buffer used to collect output before the console becomes
- * available. When negative, the pre-console buffer is
- * temporarily disabled (used when the pre-console buffer is
- * being written out, to prevent adding its contents to
- * itself).
- */
- long precon_buf_idx;
-#endif
/**
* @env_addr: address of environment structure
*
@@ -176,7 +134,87 @@ struct global_data {
* @new_gd: pointer to relocated global data
*/
struct global_data *new_gd;
-
+ /**
+ * @fdt_blob: U-Boot's own device tree, NULL if none
+ */
+ const void *fdt_blob;
+ /**
+ * @fdt_src: Source of FDT
+ */
+ enum fdt_source_t fdt_src;
+ /**
+ * @jt: jump table
+ *
+ * The jump table contains pointers to exported functions. A pointer to
+ * the jump table is passed to standalone applications.
+ */
+ struct jt_funcs *jt;
+ /**
+ * @env_buf: buffer for env_get() before reloc
+ */
+ char env_buf[32];
+ /**
+ * @cur_serial_dev: current serial device
+ */
+ struct udevice *cur_serial_dev;
+ /**
+ * @arch: architecture-specific data
+ */
+ struct arch_global_data arch;
+ /**
+ * @dmtag_list: List of DM tags
+ */
+ struct list_head dmtag_list;
+ /**
+ * @timebase_h: high 32 bits of timer
+ */
+ unsigned int timebase_h;
+ /**
+ * @timebase_l: low 32 bits of timer
+ */
+ unsigned int timebase_l;
+#if defined(CONFIG_POST)
+ /**
+ * @post_log_word: active POST tests
+ *
+ * @post_log_word is a bit mask defining which POST tests are recorded
+ * (see constants POST_*).
+ */
+ unsigned long post_log_word;
+ /**
+ * @post_log_res: POST results
+ *
+ * @post_log_res is a bit mask with the POST results. A bit with value 1
+ * indicates successful execution.
+ */
+ unsigned long post_log_res;
+ /**
+ * @post_init_f_time: time in ms when post_init_f() started
+ */
+ unsigned long post_init_f_time;
+#endif
+#ifdef CONFIG_BOARD_TYPES
+ /**
+ * @board_type: board type
+ *
+ * If a U-Boot configuration supports multiple board types, the actual
+ * board type may be stored in this field.
+ */
+ unsigned long board_type;
+#endif
+#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
+ /**
+ * @precon_buf_idx: pre-console buffer index
+ *
+ * @precon_buf_idx indicates the current position of the
+ * buffer used to collect output before the console becomes
+ * available. When negative, the pre-console buffer is
+ * temporarily disabled (used when the pre-console buffer is
+ * being written out, to prevent adding its contents to
+ * itself).
+ */
+ long precon_buf_idx;
+#endif
#ifdef CONFIG_DM
/**
* @dm_root: root instance for Driver Model
@@ -221,38 +259,18 @@ struct global_data {
*/
struct udevice *timer;
#endif
- /**
- * @fdt_blob: U-Boot's own device tree, NULL if none
- */
- const void *fdt_blob;
- /**
- * @fdt_src: Source of FDT
- */
- enum fdt_source_t fdt_src;
#if CONFIG_IS_ENABLED(OF_LIVE)
/**
* @of_root: root node of the live tree
*/
struct device_node *of_root;
#endif
-
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
/**
* @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
*/
const void *multi_dtb_fit;
#endif
- /**
- * @jt: jump table
- *
- * The jump table contains pointers to exported functions. A pointer to
- * the jump table is passed to standalone applications.
- */
- struct jt_funcs *jt;
- /**
- * @env_buf: buffer for env_get() before reloc
- */
- char env_buf[32];
#ifdef CONFIG_TRACE
/**
* @trace_buff: trace buffer
@@ -268,18 +286,10 @@ struct global_data {
*/
int cur_i2c_bus;
#endif
- /**
- * @timebase_h: high 32 bits of timer
- */
- unsigned int timebase_h;
- /**
- * @timebase_l: low 32 bits of timer
- */
- unsigned int timebase_l;
+#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
/**
* @malloc_start: start of malloc() region
*/
-#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
unsigned long malloc_start;
#endif
#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
@@ -296,14 +306,6 @@ struct global_data {
*/
unsigned long malloc_ptr;
#endif
- /**
- * @cur_serial_dev: current serial device
- */
- struct udevice *cur_serial_dev;
- /**
- * @arch: architecture-specific data
- */
- struct arch_global_data arch;
#ifdef CONFIG_CONSOLE_RECORD
/**
* @console_out: output buffer for console recording
@@ -431,10 +433,6 @@ struct global_data {
*/
struct hlist_head cyclic_list;
#endif
- /**
- * @dmtag_list: List of DM tags
- */
- struct list_head dmtag_list;
};
#ifndef DO_DEPS_ONLY
static_assert(sizeof(struct global_data) == GD_SIZE);
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 23/35] global_data: Reduce the size of bus_clk and mem_clk
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (21 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 22/35] global_data: Collect common fields at the top Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 24/35] global_data: Reduce the size of mon_len Simon Glass
` (13 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Aaron Williams, Bin Meng,
Daniel Schwierzeck, Francis Laniel
The bus clock and memory clock are unlikely to go above 4GHz for now, so
reduce the field size to 32 bits.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/mips/mach-ath79/ar934x/clk.c | 4 ++--
arch/mips/mach-octeon/cpu.c | 2 +-
include/asm-generic/global_data.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/mips/mach-ath79/ar934x/clk.c b/arch/mips/mach-ath79/ar934x/clk.c
index bdaa6839a2b..231a21ca90f 100644
--- a/arch/mips/mach-ath79/ar934x/clk.c
+++ b/arch/mips/mach-ath79/ar934x/clk.c
@@ -327,8 +327,8 @@ int do_ar934x_showclk(struct cmd_tbl *cmdtp, int flag, int argc,
{
ar934x_update_clock();
printf("CPU: %8ld MHz\n", gd->cpu_clk / 1000000);
- printf("Memory: %8ld MHz\n", gd->mem_clk / 1000000);
- printf("AHB: %8ld MHz\n", gd->bus_clk / 1000000);
+ printf("Memory: %8d MHz\n", gd->mem_clk / 1000000);
+ printf("AHB: %8d MHz\n", gd->bus_clk / 1000000);
return 0;
}
diff --git a/arch/mips/mach-octeon/cpu.c b/arch/mips/mach-octeon/cpu.c
index c7744e84706..c771da61a68 100644
--- a/arch/mips/mach-octeon/cpu.c
+++ b/arch/mips/mach-octeon/cpu.c
@@ -67,7 +67,7 @@ static int get_clocks(void)
gd->cpu_clk = ref_clock * FIELD_GET(RST_BOOT_C_MUL, val);
gd->bus_clk = ref_clock * FIELD_GET(RST_BOOT_PNR_MUL, val);
- debug("%s: cpu: %lu, bus: %lu\n", __func__, gd->cpu_clk, gd->bus_clk);
+ debug("%s: cpu: %lu, bus: %u\n", __func__, gd->cpu_clk, gd->bus_clk);
return 0;
}
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 48241d10034..7910e73e2e3 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -65,11 +65,11 @@ struct global_data {
/**
* @bus_clk: platform clock rate in Hz
*/
- unsigned long bus_clk;
+ unsigned int bus_clk;
/**
* @mem_clk: memory clock rate in Hz
*/
- unsigned long mem_clk;
+ unsigned int mem_clk;
/**
* @env_addr: address of environment structure
*
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 24/35] global_data: Reduce the size of mon_len
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (22 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 23/35] global_data: Reduce the size of bus_clk and mem_clk Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 25/35] global_data: log: Reorder and shrink fields Simon Glass
` (12 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Devarsh Thakkar, Francis Laniel,
Raymond Mao, Shiji Yang,
This contributor prefers not to receive mails
This is the length of the U-Boot binary, which is typically 200-800KB
and certainly not larger than 4GB. Use a 32-bit value to save space in
global_data and move it up to be with fields of the same alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/board_f.c | 4 ++--
include/asm-generic/global_data.h | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index c99b573bc17..1bd4b790e80 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -339,7 +339,7 @@ __weak int arch_setup_dest_addr(void)
static int setup_dest_addr(void)
{
- debug("Monitor len: %08lX\n", gd->mon_len);
+ debug("Monitor len: %08x\n", gd->mon_len);
/*
* Ram is setup, size stored in gd !!
*/
@@ -476,7 +476,7 @@ static int reserve_uboot(void)
gd->relocaddr &= ~(65536 - 1);
#endif
- debug("Reserving %ldk for U-Boot at: %08lx\n",
+ debug("Reserving %dk for U-Boot at: %08lx\n",
gd->mon_len >> 10, gd->relocaddr);
}
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 7910e73e2e3..c8699c9e963 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -70,6 +70,10 @@ struct global_data {
* @mem_clk: memory clock rate in Hz
*/
unsigned int mem_clk;
+ /**
+ * @mon_len: monitor length in bytes
+ */
+ unsigned int mon_len;
/**
* @env_addr: address of environment structure
*
@@ -114,10 +118,6 @@ struct global_data {
* @ram_size: RAM size in bytes
*/
phys_size_t ram_size;
- /**
- * @mon_len: monitor length in bytes
- */
- unsigned long mon_len;
/**
* @irq_sp: IRQ stack pointer
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 25/35] global_data: log: Reorder and shrink fields
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (23 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 24/35] global_data: Reduce the size of mon_len Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 26/35] global_data: Reduce size of early-malloc vars Simon Glass
` (11 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Some of the logging fields are larger than they need to be. Shrink them
and adjust the ordering to improve alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 43 +++++++++++++++----------------
test/log/log_test.c | 6 ++---
2 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index c8699c9e963..6ec80a2ccdf 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -338,6 +338,16 @@ struct global_data {
struct bootstage_data *bootstage;
#endif
#ifdef CONFIG_LOG
+ /**
+ * @log_head: list of logging devices
+ */
+ struct list_head log_head;
+ /**
+ * @log_fmt: bit mask for logging format
+ *
+ * The @log_fmt bit mask selects the fields to be shown in log messages.
+ * &enum log_fmt defines the bits of the bit mask.
+ */
/**
* @log_drop_count: number of dropped log messages
*
@@ -352,44 +362,33 @@ struct global_data {
* For logging devices without filters @default_log_level defines the
* logging level, cf. &enum log_level_t.
*/
- int default_log_level;
- /**
- * @log_head: list of logging devices
- */
- struct list_head log_head;
- /**
- * @log_fmt: bit mask for logging format
- *
- * The @log_fmt bit mask selects the fields to be shown in log messages.
- * &enum log_fmt defines the bits of the bit mask.
- */
- int log_fmt;
-
- /**
- * @processing_msg: a log message is being processed
- *
- * This flag is used to suppress the creation of additional messages
- * while another message is being processed.
- */
- bool processing_msg;
+ char default_log_level;
+ char log_fmt;
/**
* @logc_prev: logging category of previous message
*
* This value is used as logging category for continuation messages.
*/
- int logc_prev;
+ unsigned char logc_prev;
/**
* @logl_prev: logging level of the previous message
*
* This value is used as logging level for continuation messages.
*/
- int logl_prev;
+ unsigned char logl_prev;
/**
* @log_cont: Previous log line did not finished wtih \n
*
* This allows for chained log messages on the same line
*/
bool log_cont;
+ /**
+ * @processing_msg: a log message is being processed
+ *
+ * This flag is used to suppress the creation of additional messages
+ * while another message is being processed.
+ */
+ bool processing_msg;
#endif
#if CONFIG_IS_ENABLED(BLOBLIST)
/**
diff --git a/test/log/log_test.c b/test/log/log_test.c
index 855353a9c40..2ccc187916f 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -379,9 +379,9 @@ int log_test_level_deny(struct unit_test_state *uts)
ut_assertok(console_record_reset_enable());
log_run();
- check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
- LOGL_WARNING + 1,
- min(gd->default_log_level, LOGL_INFO));
+ check_log_entries_flags_levels(
+ EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
+ LOGL_WARNING + 1, min((int)gd->default_log_level, LOGL_INFO));
ut_assertok(log_remove_filter("console", filt1));
ut_assertok(log_remove_filter("console", filt2));
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 26/35] global_data: Reduce size of early-malloc vars
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (24 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 25/35] global_data: log: Reorder and shrink fields Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 27/35] global_data: Move baud_rate field lower Simon Glass
` (10 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Artur Rojek, Bin Meng, Devarsh Thakkar,
Francis Laniel, Heinrich Schuchardt, Jonas Karlman, Marek Vasut,
Rasmus Villemoes, Sean Anderson, Shiji Yang
The early malloc region is normally quite small and is certainly less
than 4GB, so use a 32-bit value for the limit and pointer. Update the
comment for clarity while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/arm/lib/bdinfo.c | 2 +-
common/board_r.c | 2 +-
common/malloc_simple.c | 7 ++++---
common/spl/spl.c | 4 ++--
include/asm-generic/global_data.h | 6 +++---
5 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
index 7c49462c8eb..c7fff01c435 100644
--- a/arch/arm/lib/bdinfo.c
+++ b/arch/arm/lib/bdinfo.c
@@ -58,7 +58,7 @@ void arch_print_bdinfo(void)
printf("Board Type = %ld\n", gd->board_type);
#endif
#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
- printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
+ printf("Early malloc usage: %x / %x\n", gd->malloc_ptr,
CONFIG_VAL(SYS_MALLOC_F_LEN));
#endif
}
diff --git a/common/board_r.c b/common/board_r.c
index d4ba245ac69..460b012306e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -192,7 +192,7 @@ static int initr_malloc(void)
ulong start;
#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
- debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
+ debug("Pre-reloc malloc() used %#x bytes (%d KB)\n", gd->malloc_ptr,
gd->malloc_ptr / 1024);
#endif
/* The malloc area is immediately below the monitor copy in DRAM */
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 4e6d7952b3c..c24e70c95c2 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -18,12 +18,13 @@ DECLARE_GLOBAL_DATA_PTR;
static void *alloc_simple(size_t bytes, int align)
{
- ulong addr, new_ptr;
+ ulong addr;
+ uint new_ptr;
void *ptr;
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
new_ptr = addr + bytes - gd->malloc_base;
- log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
+ log_debug("size=%lx, ptr=%x, limit=%x: ", (ulong)bytes, new_ptr,
gd->malloc_limit);
if (new_ptr > gd->malloc_limit) {
log_err("alloc space exhausted\n");
@@ -87,6 +88,6 @@ void free_simple(void *ptr)
void malloc_simple_info(void)
{
- log_info("malloc_simple: %lx bytes used, %lx remain\n", gd->malloc_ptr,
+ log_info("malloc_simple: %x bytes used, %x remain\n", gd->malloc_ptr,
CONFIG_VAL(SYS_MALLOC_F_LEN) - gd->malloc_ptr);
}
diff --git a/common/spl/spl.c b/common/spl/spl.c
index de34fb06548..5c966a88b8e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -784,7 +784,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
}
if (CONFIG_IS_ENABLED(SYS_MALLOC_F) &&
!IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
- debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
+ debug("SPL malloc() used 0x%x bytes (%d KB)\n",
gd_malloc_ptr(), gd_malloc_ptr() / 1024);
bootstage_mark_name(get_bootstage_id(false), "end phase");
@@ -895,7 +895,7 @@ ulong spl_relocate_stack_gd(void)
#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
- debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
+ debug("SPL malloc() before relocation used 0x%x bytes (%d KB)\n",
gd->malloc_ptr, gd->malloc_ptr / 1024);
ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
gd->malloc_base = ptr;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 6ec80a2ccdf..21d4ddea12d 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -298,13 +298,13 @@ struct global_data {
*/
unsigned long malloc_base;
/**
- * @malloc_limit: limit address of early malloc()
+ * @malloc_limit: maximum size of early malloc()
*/
- unsigned long malloc_limit;
+ unsigned int malloc_limit;
/**
* @malloc_ptr: current address of early malloc()
*/
- unsigned long malloc_ptr;
+ unsigned int malloc_ptr;
#endif
#ifdef CONFIG_CONSOLE_RECORD
/**
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 27/35] global_data: Move baud_rate field lower
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (25 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 26/35] global_data: Reduce size of early-malloc vars Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 28/35] global_data: Move env_addr field higher Simon Glass
` (9 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Move this field to be with others of the same alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 21d4ddea12d..a52794e1e86 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -54,10 +54,6 @@ struct global_data {
* See &enum gd_flags
*/
unsigned long flags;
- /**
- * @baudrate: baud rate of the serial interface
- */
- unsigned int baudrate;
/**
* @cpu_clk: CPU clock rate in Hz
*/
@@ -74,6 +70,10 @@ struct global_data {
* @mon_len: monitor length in bytes
*/
unsigned int mon_len;
+ /**
+ * @baudrate: baud rate of the serial interface
+ */
+ unsigned int baudrate;
/**
* @env_addr: address of environment structure
*
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 28/35] global_data: Move env_addr field higher
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (26 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 27/35] global_data: Move baud_rate field lower Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 29/35] global_data: Put phys_addr fields near the top Simon Glass
` (8 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Move this field to be with others of the same alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index a52794e1e86..368b19ffb60 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -58,6 +58,13 @@ struct global_data {
* @cpu_clk: CPU clock rate in Hz
*/
unsigned long cpu_clk;
+ /**
+ * @env_addr: address of environment structure
+ *
+ * @env_addr contains the address of the structure holding the
+ * environment variables.
+ */
+ unsigned long env_addr;
/**
* @bus_clk: platform clock rate in Hz
*/
@@ -74,13 +81,6 @@ struct global_data {
* @baudrate: baud rate of the serial interface
*/
unsigned int baudrate;
- /**
- * @env_addr: address of environment structure
- *
- * @env_addr contains the address of the structure holding the
- * environment variables.
- */
- unsigned long env_addr;
/**
* @env_has_init: bit mask indicating environment locations
*
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 29/35] global_data: Put phys_addr fields near the top
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (27 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 28/35] global_data: Move env_addr field higher Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 30/35] global_data: Move ulong fields together Simon Glass
` (7 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Put these fields near the top and together, since they have the same
alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 368b19ffb60..82c74dee161 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -48,6 +48,14 @@ struct global_data {
*/
struct board_f *boardf;
#endif
+ /**
+ * @ram_size: RAM size in bytes
+ */
+ phys_size_t ram_size;
+ /**
+ * @ram_top: top address of RAM used by U-Boot
+ */
+ phys_addr_t ram_top;
/**
* @flags: global data flags
*
@@ -101,10 +109,6 @@ struct global_data {
* @ram_base: base address of RAM used by U-Boot
*/
unsigned long ram_base;
- /**
- * @ram_top: top address of RAM used by U-Boot
- */
- phys_addr_t ram_top;
/**
* @relocaddr: start address of U-Boot in RAM
*
@@ -114,10 +118,6 @@ struct global_data {
* GDB using the 'add-symbol-file u-boot <relocaddr>' command.
*/
unsigned long relocaddr;
- /**
- * @ram_size: RAM size in bytes
- */
- phys_size_t ram_size;
/**
* @irq_sp: IRQ stack pointer
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 30/35] global_data: Move ulong fields together
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (28 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 29/35] global_data: Put phys_addr fields near the top Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 31/35] global_data: Move pointer members together Simon Glass
` (6 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Move all the always-present ulong fields next to the others at the top
of global_data
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 50 +++++++++++++++----------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 82c74dee161..005c79c6a7d 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -73,6 +73,31 @@ struct global_data {
* environment variables.
*/
unsigned long env_addr;
+ /**
+ * @ram_base: base address of RAM used by U-Boot
+ */
+ unsigned long ram_base;
+ /**
+ * @relocaddr: start address of U-Boot in RAM
+ *
+ * After relocation this field indicates the address to which U-Boot
+ * has been relocated. It can be displayed using the bdinfo command.
+ * Its value is needed to display the source code when debugging with
+ * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
+ */
+ unsigned long relocaddr;
+ /**
+ * @irq_sp: IRQ stack pointer
+ */
+ unsigned long irq_sp;
+ /**
+ * @start_addr_sp: initial stack pointer address
+ */
+ unsigned long start_addr_sp;
+ /**
+ * @reloc_off: relocation offset
+ */
+ unsigned long reloc_off;
/**
* @bus_clk: platform clock rate in Hz
*/
@@ -105,31 +130,6 @@ struct global_data {
* @env_load_prio: priority of the loaded environment
*/
char env_load_prio;
- /**
- * @ram_base: base address of RAM used by U-Boot
- */
- unsigned long ram_base;
- /**
- * @relocaddr: start address of U-Boot in RAM
- *
- * After relocation this field indicates the address to which U-Boot
- * has been relocated. It can be displayed using the bdinfo command.
- * Its value is needed to display the source code when debugging with
- * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
- */
- unsigned long relocaddr;
- /**
- * @irq_sp: IRQ stack pointer
- */
- unsigned long irq_sp;
- /**
- * @start_addr_sp: initial stack pointer address
- */
- unsigned long start_addr_sp;
- /**
- * @reloc_off: relocation offset
- */
- unsigned long reloc_off;
/**
* @new_gd: pointer to relocated global data
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 31/35] global_data: Move pointer members together
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (29 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 30/35] global_data: Move ulong fields together Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 32/35] global_data: Remove jump table in SPL Simon Glass
` (5 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel
Collect the pointer members near the top of global_data to help with
alignment.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/asm-generic/global_data.h | 38 +++++++++++++++----------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 005c79c6a7d..f6d1ee1d57a 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -42,6 +42,25 @@ struct global_data {
* @bd: board information
*/
struct bd_info *bd;
+ /**
+ * @new_gd: pointer to relocated global data
+ */
+ struct global_data *new_gd;
+ /**
+ * @fdt_blob: U-Boot's own device tree, NULL if none
+ */
+ const void *fdt_blob;
+ /**
+ * @jt: jump table
+ *
+ * The jump table contains pointers to exported functions. A pointer to
+ * the jump table is passed to standalone applications.
+ */
+ struct jt_funcs *jt;
+ /**
+ * @cur_serial_dev: current serial device
+ */
+ struct udevice *cur_serial_dev;
#ifndef CONFIG_SPL_BUILD
/**
* @boardf: information only used before relocation
@@ -130,33 +149,14 @@ struct global_data {
* @env_load_prio: priority of the loaded environment
*/
char env_load_prio;
- /**
- * @new_gd: pointer to relocated global data
- */
- struct global_data *new_gd;
- /**
- * @fdt_blob: U-Boot's own device tree, NULL if none
- */
- const void *fdt_blob;
/**
* @fdt_src: Source of FDT
*/
enum fdt_source_t fdt_src;
- /**
- * @jt: jump table
- *
- * The jump table contains pointers to exported functions. A pointer to
- * the jump table is passed to standalone applications.
- */
- struct jt_funcs *jt;
/**
* @env_buf: buffer for env_get() before reloc
*/
char env_buf[32];
- /**
- * @cur_serial_dev: current serial device
- */
- struct udevice *cur_serial_dev;
/**
* @arch: architecture-specific data
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 32/35] global_data: Remove jump table in SPL
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (30 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 31/35] global_data: Move pointer members together Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 33/35] global_data: Remove environment members if not used Simon Glass
` (4 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel, Ion Agorria,
Mattijs Korpershoek, Patrice Chotard, Priyanka Jain,
Svyatoslav Ryhel, Wasim Khan
SPL builds don't use the jump table since they cannot run apps. Drop
it, moving it together with boardf.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
board/freescale/ls2080ardb/eth_ls2080rdb.c | 2 +-
common/console.c | 3 ++-
include/asm-generic/global_data.h | 10 +++++-----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/board/freescale/ls2080ardb/eth_ls2080rdb.c b/board/freescale/ls2080ardb/eth_ls2080rdb.c
index 44d9782d729..7fc4fecf774 100644
--- a/board/freescale/ls2080ardb/eth_ls2080rdb.c
+++ b/board/freescale/ls2080ardb/eth_ls2080rdb.c
@@ -12,7 +12,7 @@ DECLARE_GLOBAL_DATA_PTR;
int board_eth_init(struct bd_info *bis)
{
-#ifdef CONFIG_PHY_AQUANTIA
+#if defined(CONFIG_PHY_AQUANTIA) && !defined(CONFIG_SPL_BUILD)
/*
* Export functions to be used by AQ firmware
* upload application
diff --git a/common/console.c b/common/console.c
index 30ddefef6b1..f39821385bb 100644
--- a/common/console.c
+++ b/common/console.c
@@ -189,6 +189,7 @@ static int console_setfile(int file, struct stdio_dev * dev)
/* Assign the new device (leaving the existing one started) */
stdio_devices[file] = dev;
+#ifndef CONFIG_SPL_BUILD
/*
* Update monitor functions
* (to use the console stuff by other applications)
@@ -206,7 +207,7 @@ static int console_setfile(int file, struct stdio_dev * dev)
break;
}
break;
-
+#endif
default: /* Invalid file ID */
error = -1;
}
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index f6d1ee1d57a..18d21de6237 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -50,6 +50,11 @@ struct global_data {
* @fdt_blob: U-Boot's own device tree, NULL if none
*/
const void *fdt_blob;
+ /**
+ * @cur_serial_dev: current serial device
+ */
+ struct udevice *cur_serial_dev;
+#ifndef CONFIG_SPL_BUILD
/**
* @jt: jump table
*
@@ -57,11 +62,6 @@ struct global_data {
* the jump table is passed to standalone applications.
*/
struct jt_funcs *jt;
- /**
- * @cur_serial_dev: current serial device
- */
- struct udevice *cur_serial_dev;
-#ifndef CONFIG_SPL_BUILD
/**
* @boardf: information only used before relocation
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 33/35] global_data: Remove environment members if not used
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (31 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 32/35] global_data: Remove jump table in SPL Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 34/35] doc: Move generic-board documentation into rst Simon Glass
` (3 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Bin Meng, Francis Laniel, Sean Anderson
If the environment is not enabled we don't need these fields in
global_data. Make them conditional.
Make these fields conditional. Move env_buf up one so it can share
an #ifdef.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/hwconfig.c | 8 +++++++-
include/asm-generic/global_data.h | 12 ++++++++----
lib/asm-offsets.c | 2 ++
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/common/hwconfig.c b/common/hwconfig.c
index afaa6cb37ab..25a8cd5bf5d 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -77,7 +77,13 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
/* if we are passed a buffer use it, otherwise try the environment */
if (!env_hwconfig) {
- if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+ if (!(gd->flags & GD_FLG_ENV_READY) &&
+ gd->env_valid != ENV_VALID)
+#else
+ if (true)
+#endif
+ {
printf("WARNING: Calling __hwconfig without a buffer "
"and before environment is ready\n");
return NULL;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 18d21de6237..1d58ada4094 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -85,6 +85,7 @@ struct global_data {
* @cpu_clk: CPU clock rate in Hz
*/
unsigned long cpu_clk;
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
/**
* @env_addr: address of environment structure
*
@@ -92,6 +93,7 @@ struct global_data {
* environment variables.
*/
unsigned long env_addr;
+#endif /* ENV_SUPPORT */
/**
* @ram_base: base address of RAM used by U-Boot
*/
@@ -133,6 +135,7 @@ struct global_data {
* @baudrate: baud rate of the serial interface
*/
unsigned int baudrate;
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
/**
* @env_has_init: bit mask indicating environment locations
*
@@ -149,14 +152,15 @@ struct global_data {
* @env_load_prio: priority of the loaded environment
*/
char env_load_prio;
- /**
- * @fdt_src: Source of FDT
- */
- enum fdt_source_t fdt_src;
/**
* @env_buf: buffer for env_get() before reloc
*/
char env_buf[32];
+#endif /* ENV_SUPPORT */
+ /**
+ * @fdt_src: Source of FDT
+ */
+ enum fdt_source_t fdt_src;
/**
* @arch: architecture-specific data
*/
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 4e2dbda9a71..b6bbcbf76ca 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -44,7 +44,9 @@ int main(void)
DEFINE(GD_NEW_GD, offsetof(struct global_data, new_gd));
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
DEFINE(GD_ENV_ADDR, offsetof(struct global_data, env_addr));
+#endif
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 34/35] doc: Move generic-board documentation into rst
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (32 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 33/35] global_data: Remove environment members if not used Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 15:09 ` [PATCH 35/35] doc: Add some guidelines about global data Simon Glass
` (2 subsequent siblings)
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Simon Glass, Alexander Dahl, Heinrich Schuchardt,
Joao Marcos Costa, Mattijs Korpershoek, Quentin Schulz
This information is useful for people looking at how U-Boot has changed
over the years and the design decisions which led to it. Move it into
doc/ in an 'historical' section.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
.../historical/generic_board.rst} | 16 ++++++++--------
doc/develop/historical/index.rst | 12 ++++++++++++
doc/develop/index.rst | 8 ++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
rename doc/{README.generic-board => develop/historical/generic_board.rst} (96%)
create mode 100644 doc/develop/historical/index.rst
diff --git a/doc/README.generic-board b/doc/develop/historical/generic_board.rst
similarity index 96%
rename from doc/README.generic-board
rename to doc/develop/historical/generic_board.rst
index bc35179fbfd..6711d3d7a89 100644
--- a/doc/README.generic-board
+++ b/doc/develop/historical/generic_board.rst
@@ -1,10 +1,9 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2014 Google, Inc
-# Simon Glass <sjg@chromium.org>
+.. SPDX-License-Identifier: GPL-2.0+
+.. (C) Copyright 2014 Google, Inc
+.. sectionauthor:: Simon Glass <sjg@chromium.org>
-Background
-----------
+Generic board
+-------------
U-Boot traditionally had a board.c file for each architecture. This introduced
quite a lot of duplication, with each architecture tending to do
@@ -16,7 +15,7 @@ All boards and architectures have moved to this as of mid 2016.
What has changed?
------------------
+~~~~~~~~~~~~~~~~~
The main change is that the arch/<arch>/lib/board.c file is removed in
favour of common/board_f.c (for pre-relocation init) and common/board_r.c
@@ -28,7 +27,7 @@ have been moved to separate structures.
Further Background
-------------------
+~~~~~~~~~~~~~~~~~~
The full text of the original generic board series is reproduced below.
@@ -132,4 +131,5 @@ convenience.
Simon Glass, sjg@chromium.org
March 2014
+
Updated after final removal, May 2016
diff --git a/doc/develop/historical/index.rst b/doc/develop/historical/index.rst
new file mode 100644
index 00000000000..e4462f5d2a7
--- /dev/null
+++ b/doc/develop/historical/index.rst
@@ -0,0 +1,12 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Historical Documents
+====================
+
+This section provides documentation about major changes in U-Boot over the
+years.
+
+.. toctree::
+ :maxdepth: 1
+
+ generic_board
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index c0107a783fc..0d0e60ab56c 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -99,3 +99,11 @@ Code quality
:maxdepth: 1
python_cq
+
+Historical documentation
+------------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ historical/index
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 35/35] doc: Add some guidelines about global data
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (33 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 34/35] doc: Move generic-board documentation into rst Simon Glass
@ 2024-07-24 15:09 ` Simon Glass
2024-07-24 23:07 ` [PATCH 00/35] global_data: Reduce size of struct global_data Tom Rini
2024-08-21 0:48 ` Tom Rini
36 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-07-24 15:09 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass
Update the documentation to provide a bit more information about how to
use global data.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
doc/develop/global_data.rst | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/doc/develop/global_data.rst b/doc/develop/global_data.rst
index d143f27eedd..2863154ea42 100644
--- a/doc/develop/global_data.rst
+++ b/doc/develop/global_data.rst
@@ -51,6 +51,31 @@ U-Boot. The value of gd has to be saved every time U-Boot is left and restored
whenever U-Boot is reentered. This is also relevant for the implementation of
function tracing. For setting the value of gd function set_gd() can be used.
+Guidelines
+----------
+
+The global_data structure is placed in some memory which is available very early
+after boot to allow for a minimum set of global variables during system
+initialisation (until the memory controller is set up and RAM can be used). It
+is the primary data structure passed from pre-relocation U-Boot to
+post-relocation, i.e. ``from board_init_f()`` ``to board_init_r()``.
+
+The global_data struct exists for the lifetime of U-Boot. Since the struct is
+used by all architectures, fields added should be useful for most architectures.
+Fields which are only needed on one or two architectures can be placed in the
+architecture-specific ``struct arch_global_data``.
+
+In any case the struct should be kept small, since it uses precious SRAM on
+many boards.
+
+SPL also uses global data, as well as U-Boot proper, so take care to avoid
+adding fields to SPL which are not actually used by SPL. You can create
+access functions or macros in the header file to avoid filling the C code with
+#ifdefs.
+
+A flags word is available, which provides a convenient means to track the state
+of various initialisation phases within U-Boot.
+
Global data structure
---------------------
--
2.34.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 00/35] global_data: Reduce size of struct global_data
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (34 preceding siblings ...)
2024-07-24 15:09 ` [PATCH 35/35] doc: Add some guidelines about global data Simon Glass
@ 2024-07-24 23:07 ` Tom Rini
2024-08-21 0:48 ` Tom Rini
36 siblings, 0 replies; 44+ messages in thread
From: Tom Rini @ 2024-07-24 23:07 UTC (permalink / raw)
To: Simon Glass
Cc: U-Boot Mailing List, Aaron Williams, Algapally Santosh Sagar,
Anatolij Gustschin, Andrew Davis, Aradhya Bhatia, Bin Meng,
Dan Carpenter, Devarsh Thakkar, Enrico Leto, Fabio Estevam,
Heinrich Schuchardt, Huan Wang, Ilko Iliev, Ion Agorria,
Joao Marcos Costa, Jonas Karlman, Kever Yang, MD Danish Anwar,
Mario Six, Matthias Schiffer, Michal Simek, NXP i.MX U-Boot Team,
Nishanth Menon, Patrice Chotard, Peng Fan, Peter Robinson,
Philipp Tomsich, Quentin Schulz, Sean Anderson, Shiji Yang,
Stefan Bosch, Stefano Babic, Svyatoslav Ryhel,
This contributor prefers not to receive mails, Troy Kisky,
Venkatesh Yadav Abbarapu, Wasim Khan
[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]
On Wed, Jul 24, 2024 at 09:08:47AM -0600, Simon Glass wrote:
> The global data structure has grown quite a lot over the years, being
> the best place to put an important pointer or something that must be
> accessed before and after relocation.
>
> This series attempts to reduce the size a little, by moving some things
> out and shrinking and aligning some fields.
>
> Some fields are needed during init but not afterwards. To deal with this
> a new 'boardf' structure is created, which sits on the stack and is only
> present during board_init_f(). It is possible that more fields could
> move to this struct, but for now only 4 are moved.
>
> An assumption is made that an int is 32-bits wide on all architectures,
> which seems to be true, but maintainers should be able to confirm.
>
> Mostly the code-size impact is neutral, but the patch
> 'Use less space for environment fields' does increase U-Boot's size by
> about 30 bytes on aarch64.
>
> For firefly-rk3399 (64-bit) the size of global reduces from 456 to 368
> bytes. For SPL it reduces from 416 to 272 bytes.
>
> There are other things which could be attempted, for example:
> - Using hlist instead of list for some lists
> - Checking that only necessary fields are present in SPL
This is good, thanks for doing this. I'm planning to grab this in to
-next once I open it.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Acked
2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
@ 2024-07-29 7:57 ` Angelo Dureghello
0 siblings, 0 replies; 44+ messages in thread
From: Angelo Dureghello @ 2024-07-29 7:57 UTC (permalink / raw)
To: Simon Glass, U-Boot Mailing List
Cc: Tom Rini, Bin Meng, Francis Laniel, Huan Wang, Lukasz Majewski,
Mario Six, Sean Anderson
Acked-by: Angelo Dureghello <angelo@kernel-space.org>
On 24/07/24 5:08 PM, Simon Glass wrote:
> Only m68k and powerpc use this field, so move it to the arch-specific
> info, to reduce the size for other archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> arch/m68k/cpu/mcf5445x/cpu.c | 2 +-
> arch/m68k/include/asm/global_data.h | 2 ++
> arch/m68k/lib/bdinfo.c | 2 +-
> arch/powerpc/cpu/mpc83xx/pci.c | 4 ++--
> arch/powerpc/cpu/mpc83xx/speed.c | 2 +-
> arch/powerpc/include/asm/global_data.h | 2 ++
> drivers/clk/mpc83xx_clk.c | 2 +-
> include/asm-generic/global_data.h | 5 -----
> 8 files changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c
> index b811ac355e4..3fbd6a58c7d 100644
> --- a/arch/m68k/cpu/mcf5445x/cpu.c
> +++ b/arch/m68k/cpu/mcf5445x/cpu.c
> @@ -92,7 +92,7 @@ int print_cpuinfo(void)
> strmhz(buf3, gd->arch.flb_clk));
> #ifdef CONFIG_PCI
> printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
> - strmhz(buf1, gd->pci_clk),
> + strmhz(buf1, gd->arch.pci_clk),
> strmhz(buf2, gd->arch.inp_clk),
> strmhz(buf3, gd->arch.vco_clk));
> #else
> diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
> index 93efc722ba8..4ac886933c6 100644
> --- a/arch/m68k/include/asm/global_data.h
> +++ b/arch/m68k/include/asm/global_data.h
> @@ -26,6 +26,8 @@ struct arch_global_data {
> #if defined(CONFIG_FSL_ESDHC)
> unsigned long sdhc_per_clk;
> #endif
> + /** @pci_clk: PCI clock rate in Hz */
> + unsigned long pci_clk;
> };
>
> #include <asm-generic/global_data.h>
> diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
> index cf6ae5adddf..891e94bbd3f 100644
> --- a/arch/m68k/lib/bdinfo.c
> +++ b/arch/m68k/lib/bdinfo.c
> @@ -22,7 +22,7 @@ int arch_setup_bdinfo(void)
> bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
>
> if (IS_ENABLED(CONFIG_PCI))
> - bd->bi_pcifreq = gd->pci_clk;
> + bd->bi_pcifreq = gd->arch.pci_clk;
>
> #if defined(CONFIG_EXTRA_CLOCK)
> bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
> diff --git a/arch/powerpc/cpu/mpc83xx/pci.c b/arch/powerpc/cpu/mpc83xx/pci.c
> index 6f378c4e221..aef1123a2b7 100644
> --- a/arch/powerpc/cpu/mpc83xx/pci.c
> +++ b/arch/powerpc/cpu/mpc83xx/pci.c
> @@ -45,7 +45,7 @@ void ft_pci_setup(void *blob, struct bd_info *bd)
> do_fixup_by_path(blob, path, "bus-range",
> &tmp, sizeof(tmp), 1);
>
> - tmp[0] = cpu_to_be32(gd->pci_clk);
> + tmp[0] = cpu_to_be32(gd->arch.pci_clk);
> do_fixup_by_path(blob, path, "clock-frequency",
> &tmp, sizeof(tmp[0]), 1);
> }
> @@ -60,7 +60,7 @@ void ft_pci_setup(void *blob, struct bd_info *bd)
> do_fixup_by_path(blob, path, "bus-range",
> &tmp, sizeof(tmp), 1);
>
> - tmp[0] = cpu_to_be32(gd->pci_clk);
> + tmp[0] = cpu_to_be32(gd->arch.pci_clk);
> do_fixup_by_path(blob, path, "clock-frequency",
> &tmp, sizeof(tmp[0]), 1);
> }
> diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
> index 72464962613..0185ab50ad9 100644
> --- a/arch/powerpc/cpu/mpc83xx/speed.c
> +++ b/arch/powerpc/cpu/mpc83xx/speed.c
> @@ -456,7 +456,7 @@ int get_clocks(void)
> #if defined(CONFIG_ARCH_MPC837X)
> gd->arch.sata_clk = sata_clk;
> #endif
> - gd->pci_clk = pci_sync_in;
> + gd->arch.pci_clk = pci_sync_in;
> gd->cpu_clk = gd->arch.core_clk;
> gd->bus_clk = gd->arch.csb_clk;
> return 0;
> diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
> index a9efbbdd3d4..cc2ce617350 100644
> --- a/arch/powerpc/include/asm/global_data.h
> +++ b/arch/powerpc/include/asm/global_data.h
> @@ -87,6 +87,8 @@ struct arch_global_data {
> #if defined(CONFIG_LWMON5)
> unsigned long kbd_status;
> #endif
> + /** @pci_clk: PCI clock rate in Hz */
> + unsigned long pci_clk;
> };
>
> #include <asm-generic/global_data.h>
> diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c
> index a29ad0d7a68..a43fff2e7ed 100644
> --- a/drivers/clk/mpc83xx_clk.c
> +++ b/drivers/clk/mpc83xx_clk.c
> @@ -358,7 +358,7 @@ static int mpc83xx_clk_probe(struct udevice *dev)
> gd->mem_clk = priv->speed[MPC83XX_CLK_MEM];
>
> if (mpc83xx_has_pci(type))
> - gd->pci_clk = priv->speed[MPC83XX_CLK_PCI];
> + gd->arch.pci_clk = priv->speed[MPC83XX_CLK_PCI];
>
> gd->cpu_clk = priv->speed[MPC83XX_CLK_CORE];
> gd->bus_clk = priv->speed[MPC83XX_CLK_CSB];
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index aa336d63e3a..970053892e1 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -59,11 +59,6 @@ struct global_data {
> * @bus_clk: platform clock rate in Hz
> */
> unsigned long bus_clk;
> - /**
> - * @pci_clk: PCI clock rate in Hz
> - */
> - /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
> - unsigned long pci_clk;
> /**
> * @mem_clk: memory clock rate in Hz
> */
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 06/35] arm: friendlyarm: Avoid accessing global_data fb_base
2024-07-24 15:08 ` [PATCH 06/35] arm: friendlyarm: Avoid accessing " Simon Glass
@ 2024-07-29 17:57 ` Stefan Bosch
0 siblings, 0 replies; 44+ messages in thread
From: Stefan Bosch @ 2024-07-29 17:57 UTC (permalink / raw)
To: Simon Glass; +Cc: Tom Rini, Albert Aribaud, U-Boot Mailing List
Hi Simon,
On 24.07.24 17:08, Simon Glass wrote:
> Use the new video function to get the framebuffer base.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
Tested-by: Stefan Bosch <stefan_b@posteo.net>
Looks OK, tested on FriendlyElec-Board NanoPC-T2
(s5p4418_nanopi2_defconfig).
Thanks!
>
> board/friendlyarm/nanopi2/board.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/board/friendlyarm/nanopi2/board.c b/board/friendlyarm/nanopi2/board.c
> index c8cbc5a15fa..b32dfc6b570 100644
> --- a/board/friendlyarm/nanopi2/board.c
> +++ b/board/friendlyarm/nanopi2/board.c
> @@ -11,6 +11,7 @@
> #ifdef CONFIG_PWM_NX
> #include <pwm.h>
> #endif
> +#include <video.h>
> #include <asm/global_data.h>
> #include <asm/io.h>
>
> @@ -492,12 +493,8 @@ int splash_screen_prepare(void)
> ARRAY_SIZE(splash_locations));
> }
>
> - if (!err) {
> - char addr[64];
> -
> - sprintf(addr, "0x%lx", gd->fb_base);
> - env_set("fb_addr", addr);
> - }
> + if (!err)
> + env_set_hex("fb_addr", video_get_fb());
>
> return err;
> }
Regards,
Stefan
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 12/35] global_data: Convert have_console into a flag
2024-07-24 15:08 ` [PATCH 12/35] global_data: Convert have_console into a flag Simon Glass
@ 2024-08-16 13:08 ` Sverdlin, Alexander
2024-08-29 14:05 ` Simon Glass
0 siblings, 1 reply; 44+ messages in thread
From: Sverdlin, Alexander @ 2024-08-16 13:08 UTC (permalink / raw)
To: sjg@chromium.org, u-boot@lists.denx.de
Cc: joao.goncalves@toradex.com, bmeng.cn@gmail.com, peng.fan@nxp.com,
patrice.chotard@foss.st.com, vitor.soares@toradex.com,
clamor95@gmail.com, sbabic@denx.de, trini@konsulko.com,
afd@ti.com, ion@agorria.com, marex@denx.de, r-gunasekaran@ti.com,
a-bhatia1@ti.com, sean.anderson@seco.com, noreply@example.com,
Leto, Enrico, mkorpershoek@baylibre.com, mk7.kang@samsung.com,
devarsht@ti.com, yangshiji66@outlook.com, jonas@kwiboo.se,
danishanwar@ti.com, francis.laniel@amarulasolutions.com,
nm@ti.com, matthias.schiffer@ew.tq-group.com, xypron.glpk@gmx.de,
festevam@gmail.com, raymond.mao@linaro.org, uboot-imx@nxp.com
Hi Simon,
On Wed, 2024-07-24 at 09:08 -0600, Simon Glass wrote:
> We don't need a full word for this boolean value. Convert it into a flag
> to save space in global_data.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
> arch/arm/mach-exynos/spl_boot.c | 2 +-
> arch/arm/mach-k3/common.c | 2 +-
> arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
> board/siemens/common/board_am335x.c | 2 +-
> common/board_f.c | 2 +-
> common/console.c | 14 +++++++-------
> common/spl/spl.c | 2 +-
> include/asm-generic/global_data.h | 17 +++++++----------
> 9 files changed, 21 insertions(+), 24 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> index 76a69d7f958..dd748328293 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
[...]
> @@ -219,7 +210,7 @@ struct global_data {
> #endif
> #ifdef CONFIG_TIMER
> /**
> - * @timer: timer instance for Driver Model
> +s * @timer: timer instance for Driver Model
an unintentional change?
> */
> struct udevice *timer;
> #endif
the rest looks good to me and you can add my
Reviewed-by: if you remove the above chunk.
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 00/35] global_data: Reduce size of struct global_data
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
` (35 preceding siblings ...)
2024-07-24 23:07 ` [PATCH 00/35] global_data: Reduce size of struct global_data Tom Rini
@ 2024-08-21 0:48 ` Tom Rini
36 siblings, 0 replies; 44+ messages in thread
From: Tom Rini @ 2024-08-21 0:48 UTC (permalink / raw)
To: Simon Glass
Cc: U-Boot Mailing List, Aaron Williams, Algapally Santosh Sagar,
Anatolij Gustschin, Andrew Davis, Aradhya Bhatia, Bin Meng,
Dan Carpenter, Devarsh Thakkar, Enrico Leto, Fabio Estevam,
Heinrich Schuchardt, Huan Wang, Ilko Iliev, Ion Agorria,
Joao Marcos Costa, Jonas Karlman, Kever Yang, MD Danish Anwar,
Mario Six, Matthias Schiffer, Michal Simek, NXP i.MX U-Boot Team,
Nishanth Menon, Patrice Chotard, Peng Fan, Peter Robinson,
Philipp Tomsich, Quentin Schulz, Sean Anderson, Shiji Yang,
Stefan Bosch, Stefano Babic, Svyatoslav Ryhel,
This contributor prefers not to receive mails, Troy Kisky,
Venkatesh Yadav Abbarapu, Wasim Khan
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
On Wed, Jul 24, 2024 at 09:08:47AM -0600, Simon Glass wrote:
> The global data structure has grown quite a lot over the years, being
> the best place to put an important pointer or something that must be
> accessed before and after relocation.
Please rebase this on top of current -next, thanks.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 12/35] global_data: Convert have_console into a flag
2024-08-16 13:08 ` Sverdlin, Alexander
@ 2024-08-29 14:05 ` Simon Glass
2024-08-29 14:28 ` Tom Rini
0 siblings, 1 reply; 44+ messages in thread
From: Simon Glass @ 2024-08-29 14:05 UTC (permalink / raw)
To: Sverdlin, Alexander
Cc: u-boot@lists.denx.de, joao.goncalves@toradex.com,
bmeng.cn@gmail.com, peng.fan@nxp.com, patrice.chotard@foss.st.com,
vitor.soares@toradex.com, clamor95@gmail.com, sbabic@denx.de,
trini@konsulko.com, afd@ti.com, ion@agorria.com, marex@denx.de,
r-gunasekaran@ti.com, a-bhatia1@ti.com, sean.anderson@seco.com,
noreply@example.com, Leto, Enrico, mkorpershoek@baylibre.com,
mk7.kang@samsung.com, devarsht@ti.com, yangshiji66@outlook.com,
jonas@kwiboo.se, danishanwar@ti.com,
francis.laniel@amarulasolutions.com, nm@ti.com,
matthias.schiffer@ew.tq-group.com, xypron.glpk@gmx.de,
festevam@gmail.com, raymond.mao@linaro.org, uboot-imx@nxp.com
Hi Alexander,
On Fri, 16 Aug 2024 at 07:08, Sverdlin, Alexander
<alexander.sverdlin@siemens.com> wrote:
>
> Hi Simon,
>
> On Wed, 2024-07-24 at 09:08 -0600, Simon Glass wrote:
> > We don't need a full word for this boolean value. Convert it into a flag
> > to save space in global_data.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
> > arch/arm/mach-exynos/spl_boot.c | 2 +-
> > arch/arm/mach-k3/common.c | 2 +-
> > arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
> > board/siemens/common/board_am335x.c | 2 +-
> > common/board_f.c | 2 +-
> > common/console.c | 14 +++++++-------
> > common/spl/spl.c | 2 +-
> > include/asm-generic/global_data.h | 17 +++++++----------
> > 9 files changed, 21 insertions(+), 24 deletions(-)
> >
> > diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > index 76a69d7f958..dd748328293 100644
> > --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
>
> [...]
>
> > @@ -219,7 +210,7 @@ struct global_data {
> > #endif
> > #ifdef CONFIG_TIMER
> > /**
> > - * @timer: timer instance for Driver Model
> > +s * @timer: timer instance for Driver Model
>
> an unintentional change?
>
> > */
> > struct udevice *timer;
> > #endif
>
> the rest looks good to me and you can add my
> Reviewed-by: if you remove the above chunk.
>
Thank you. I'm not sure where that came from, but it seems to be gone now.
Regards,
Simon
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 12/35] global_data: Convert have_console into a flag
2024-08-29 14:05 ` Simon Glass
@ 2024-08-29 14:28 ` Tom Rini
2024-08-29 15:01 ` Simon Glass
0 siblings, 1 reply; 44+ messages in thread
From: Tom Rini @ 2024-08-29 14:28 UTC (permalink / raw)
To: Simon Glass
Cc: Sverdlin, Alexander, u-boot@lists.denx.de,
joao.goncalves@toradex.com, bmeng.cn@gmail.com, peng.fan@nxp.com,
patrice.chotard@foss.st.com, vitor.soares@toradex.com,
clamor95@gmail.com, sbabic@denx.de, afd@ti.com, ion@agorria.com,
marex@denx.de, r-gunasekaran@ti.com, a-bhatia1@ti.com,
sean.anderson@seco.com, noreply@example.com, Leto, Enrico,
mkorpershoek@baylibre.com, mk7.kang@samsung.com, devarsht@ti.com,
yangshiji66@outlook.com, jonas@kwiboo.se, danishanwar@ti.com,
francis.laniel@amarulasolutions.com, nm@ti.com,
matthias.schiffer@ew.tq-group.com, xypron.glpk@gmx.de,
festevam@gmail.com, raymond.mao@linaro.org, uboot-imx@nxp.com
[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]
On Thu, Aug 29, 2024 at 08:05:35AM -0600, Simon Glass wrote:
> Hi Alexander,
>
> On Fri, 16 Aug 2024 at 07:08, Sverdlin, Alexander
> <alexander.sverdlin@siemens.com> wrote:
> >
> > Hi Simon,
> >
> > On Wed, 2024-07-24 at 09:08 -0600, Simon Glass wrote:
> > > We don't need a full word for this boolean value. Convert it into a flag
> > > to save space in global_data.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > > arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
> > > arch/arm/mach-exynos/spl_boot.c | 2 +-
> > > arch/arm/mach-k3/common.c | 2 +-
> > > arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
> > > board/siemens/common/board_am335x.c | 2 +-
> > > common/board_f.c | 2 +-
> > > common/console.c | 14 +++++++-------
> > > common/spl/spl.c | 2 +-
> > > include/asm-generic/global_data.h | 17 +++++++----------
> > > 9 files changed, 21 insertions(+), 24 deletions(-)
> > >
> > > diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > > index 76a69d7f958..dd748328293 100644
> > > --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > > +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> >
> > [...]
> >
> > > @@ -219,7 +210,7 @@ struct global_data {
> > > #endif
> > > #ifdef CONFIG_TIMER
> > > /**
> > > - * @timer: timer instance for Driver Model
> > > +s * @timer: timer instance for Driver Model
> >
> > an unintentional change?
> >
> > > */
> > > struct udevice *timer;
> > > #endif
> >
> > the rest looks good to me and you can add my
> > Reviewed-by: if you remove the above chunk.
> >
>
> Thank you. I'm not sure where that came from, but it seems to be gone now.
I fixed this up manually when applying (and added the tag).
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 12/35] global_data: Convert have_console into a flag
2024-08-29 14:28 ` Tom Rini
@ 2024-08-29 15:01 ` Simon Glass
0 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-08-29 15:01 UTC (permalink / raw)
To: Tom Rini
Cc: Sverdlin, Alexander, u-boot@lists.denx.de,
joao.goncalves@toradex.com, bmeng.cn@gmail.com, peng.fan@nxp.com,
patrice.chotard@foss.st.com, vitor.soares@toradex.com,
clamor95@gmail.com, sbabic@denx.de, afd@ti.com, ion@agorria.com,
marex@denx.de, r-gunasekaran@ti.com, a-bhatia1@ti.com,
sean.anderson@seco.com, noreply@example.com, Leto, Enrico,
mkorpershoek@baylibre.com, mk7.kang@samsung.com, devarsht@ti.com,
yangshiji66@outlook.com, jonas@kwiboo.se, danishanwar@ti.com,
francis.laniel@amarulasolutions.com, nm@ti.com,
matthias.schiffer@ew.tq-group.com, xypron.glpk@gmx.de,
festevam@gmail.com, raymond.mao@linaro.org, uboot-imx@nxp.com
On Thu, 29 Aug 2024 at 08:28, Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Aug 29, 2024 at 08:05:35AM -0600, Simon Glass wrote:
> > Hi Alexander,
> >
> > On Fri, 16 Aug 2024 at 07:08, Sverdlin, Alexander
> > <alexander.sverdlin@siemens.com> wrote:
> > >
> > > Hi Simon,
> > >
> > > On Wed, 2024-07-24 at 09:08 -0600, Simon Glass wrote:
> > > > We don't need a full word for this boolean value. Convert it into a flag
> > > > to save space in global_data.
> > > >
> > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > ---
> > > >
> > > > arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 +-
> > > > arch/arm/mach-exynos/spl_boot.c | 2 +-
> > > > arch/arm/mach-k3/common.c | 2 +-
> > > > arch/arm/mach-k3/r5/sysfw-loader.c | 2 +-
> > > > board/siemens/common/board_am335x.c | 2 +-
> > > > common/board_f.c | 2 +-
> > > > common/console.c | 14 +++++++-------
> > > > common/spl/spl.c | 2 +-
> > > > include/asm-generic/global_data.h | 17 +++++++----------
> > > > 9 files changed, 21 insertions(+), 24 deletions(-)
> > > >
> > > > diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > > > index 76a69d7f958..dd748328293 100644
> > > > --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > > > +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> > >
> > > [...]
> > >
> > > > @@ -219,7 +210,7 @@ struct global_data {
> > > > #endif
> > > > #ifdef CONFIG_TIMER
> > > > /**
> > > > - * @timer: timer instance for Driver Model
> > > > +s * @timer: timer instance for Driver Model
> > >
> > > an unintentional change?
> > >
> > > > */
> > > > struct udevice *timer;
> > > > #endif
> > >
> > > the rest looks good to me and you can add my
> > > Reviewed-by: if you remove the above chunk.
> > >
> >
> > Thank you. I'm not sure where that came from, but it seems to be gone now.
>
> I fixed this up manually when applying (and added the tag).
Thanks!
- Simon
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2024-08-29 15:03 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24 15:08 [PATCH 00/35] global_data: Reduce size of struct global_data Simon Glass
2024-07-24 15:08 ` [PATCH 01/35] global_data: Move pci_clk to m68k and powerpc Simon Glass
2024-07-29 7:57 ` Acked Angelo Dureghello
2024-07-24 15:08 ` [PATCH 02/35] x86: Drop use of global_data fb_base Simon Glass
2024-07-24 15:08 ` [PATCH 03/35] video: Add a function to obtain the framebuffer address Simon Glass
2024-07-24 15:08 ` [PATCH 04/35] video: mxc: Avoid setting global_data fb_base Simon Glass
2024-07-24 15:08 ` [PATCH 05/35] video: mxs: " Simon Glass
2024-07-24 15:08 ` [PATCH 06/35] arm: friendlyarm: Avoid accessing " Simon Glass
2024-07-29 17:57 ` Stefan Bosch
2024-07-24 15:08 ` [PATCH 07/35] arm: ronetix: " Simon Glass
2024-07-24 15:08 ` [PATCH 08/35] zynqmp: Avoid setting the framebuffer address Simon Glass
2024-07-24 15:08 ` [PATCH 09/35] video: Avoid setting global_data fb_base from SPL handoff Simon Glass
2024-07-24 15:08 ` [PATCH 10/35] video: Avoid setting global_data fb_base in video setup Simon Glass
2024-07-24 15:08 ` [PATCH 11/35] global_data: Drop fb_base Simon Glass
2024-07-24 15:08 ` [PATCH 12/35] global_data: Convert have_console into a flag Simon Glass
2024-08-16 13:08 ` Sverdlin, Alexander
2024-08-29 14:05 ` Simon Glass
2024-08-29 14:28 ` Tom Rini
2024-08-29 15:01 ` Simon Glass
2024-07-24 15:09 ` [PATCH 13/35] global_data: Remove pci_ram_top Simon Glass
2024-07-24 15:09 ` [PATCH 14/35] global_data: Drop global_data hose Simon Glass
2024-07-24 15:09 ` [PATCH 15/35] global_data: Drop pci_bootdelay Simon Glass
2024-07-24 15:09 ` [PATCH 16/35] global_data: Use less space for environment fields Simon Glass
2024-07-24 15:09 ` [PATCH 17/35] board_f: Add a new struct to hold pre-relocation info Simon Glass
2024-07-24 15:09 ` [PATCH 18/35] board_f: Move fdt_size to board Simon Glass
2024-07-24 15:09 ` [PATCH 19/35] board_f: Move new_bootstage to boardf Simon Glass
2024-07-24 15:09 ` [PATCH 20/35] board_f: Move new_bloblist " Simon Glass
2024-07-24 15:09 ` [PATCH 21/35] global_data: Drop spl_handoff Simon Glass
2024-07-24 15:09 ` [PATCH 22/35] global_data: Collect common fields at the top Simon Glass
2024-07-24 15:09 ` [PATCH 23/35] global_data: Reduce the size of bus_clk and mem_clk Simon Glass
2024-07-24 15:09 ` [PATCH 24/35] global_data: Reduce the size of mon_len Simon Glass
2024-07-24 15:09 ` [PATCH 25/35] global_data: log: Reorder and shrink fields Simon Glass
2024-07-24 15:09 ` [PATCH 26/35] global_data: Reduce size of early-malloc vars Simon Glass
2024-07-24 15:09 ` [PATCH 27/35] global_data: Move baud_rate field lower Simon Glass
2024-07-24 15:09 ` [PATCH 28/35] global_data: Move env_addr field higher Simon Glass
2024-07-24 15:09 ` [PATCH 29/35] global_data: Put phys_addr fields near the top Simon Glass
2024-07-24 15:09 ` [PATCH 30/35] global_data: Move ulong fields together Simon Glass
2024-07-24 15:09 ` [PATCH 31/35] global_data: Move pointer members together Simon Glass
2024-07-24 15:09 ` [PATCH 32/35] global_data: Remove jump table in SPL Simon Glass
2024-07-24 15:09 ` [PATCH 33/35] global_data: Remove environment members if not used Simon Glass
2024-07-24 15:09 ` [PATCH 34/35] doc: Move generic-board documentation into rst Simon Glass
2024-07-24 15:09 ` [PATCH 35/35] doc: Add some guidelines about global data Simon Glass
2024-07-24 23:07 ` [PATCH 00/35] global_data: Reduce size of struct global_data Tom Rini
2024-08-21 0:48 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox