summaryrefslogtreecommitdiff
path: root/common/board_f.c
AgeCommit message (Collapse)Author
2025-06-04x86: Correct condition for init_cache_f_r()Simon Glass
The condition here is reversed, which makes link and coral very slow, leading to lab failures. Fixes 6c171f7a184 ("common: board: make initcalls static") Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-04-15common: Add CONFIG_SKIP_RELOCATEJesse Taube
Add a check for CONFIG_SKIP_RELOCATE in reserve_uboot to skip the relocation of the U-Boot image. CONFIG_SKIP_RELOCATE skips relocation of U-Boot to the end of RAM allowing for systems that have extremely limited RAM to run U-Boot. Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Reviewed-by: Fabio Estevam <festevam@gmail.com>
2025-04-14Merge patch series "Static initcalls"Tom Rini
Jerome Forissier <jerome.forissier@linaro.org> says: This series replaces the dynamic initcalls (with function pointers) with static calls, and gets rid of initcall_run_list(), init_sequence_f, init_sequence_f_r and init_sequence_r. This makes the code simpler and the binary slighlty smaller: -2281 bytes/-0.21 % with LTO enabled and -510 bytes/-0.05 % with LTO disabled (xilinx_zynqmp_kria_defconfig). Execution time doesn't seem to change noticeably. There is no impact on the SPL. The inline assembly fixes, although they look unrelated, are triggered on some platforms with LTO enabled. For example: kirkwood_defconfig. CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/25514 Link: https://lore.kernel.org/r/20250404135038.2134570-1-jerome.forissier@linaro.org
2025-04-14common: board: make initcalls staticJerome Forissier
Change board_init_f(), board_init_f_r() and board_init_r() to make static calls instead of iterating over the init_sequence_f, init_sequence_f_r and init_sequence_r arrays, respectively. This makes the code a simpler (and even more so when initcall_run_list() is later removed) and it reduces the binary size as well. Tested with xilinx_zynqmp_kria_defconfig; bloat-o-meter results: - With LTO add/remove: 106/196 grow/shrink: 10/28 up/down: 31548/-33829 (-2281) Total: Before=1070471, After=1068190, chg -0.21% - Without LTO add/remove: 0/54 grow/shrink: 3/0 up/down: 2322/-2832 (-510) Total: Before=1121723, After=1121213, chg -0.05% Execution time does not change in a noticeable way. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-04-08Merge patch series "Change DRAM message and add RAM doc"Tom Rini
Neha Malcom Francis <n-francis@ti.com> says: This short series is an ongoing effort to make RAM utilization clearer for easier debugging and understanding of code. Intention is for users to quickly be able to identify the CONFIGs needed to modify for their RAM usecase. Link: https://lore.kernel.org/r/20250319140327.301266-1-n-francis@ti.com
2025-04-08board_f: Modify DRAM messageNeha Malcom Francis
The message "DRAM: 2 GiB (effective 32 GiB)" can be a little confusing, modify the message s/effective/total to make it more evident. Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
2025-03-10Merge tag 'v2025.04-rc4' into nextTom Rini
This uses Heinrich's merge of lib/efi_loader/efi_net.c which results in no changes.
2025-03-04Revert "dm: core: Simplify dm_probe_devices()"Simon Glass
Unfortunately this change was not safe as some devices are bound before relocation, but we don't want to probe them. It causes 'raise: Signal # 8 caught' on jerry. Move the bootstage timer to after autoprobe in initf_dm() since the trace test does not tolerate any variance. This reverts commit 21dd873572a01d74bfdfceb7a30b056f8ccba187. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-19bloblist: refactor xferlist and bloblistRaymond Mao
Refactor the xferlist to remove the relocating when bloblist passed from the boot args. Refactor bloblist init to use incoming standard passage by default if a valid transfer list exists in the boot args. For bloblist relocation, use the actual total size if it has a smaller BLOBLIST_SIZE_RELOC. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-01-14common: Move autoprobe out to board initSimon Glass
Rather than doing autoprobe within the driver model code, move it out to the board-init code. This makes it clear that it is a separate step from binding devices. For now this is always done twice, before and after relocation, but we should discuss whether it might be possible to drop the post-relocation probe. For boards with SPL, the autoprobe is still done there as well. Note that with this change, autoprobe happens after the EVT_DM_POST_INIT_R/F events are sent, rather than before. Link: https://lore.kernel.org/u-boot/20240626235717.272219-1-marex@denx.de/ Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-14common: Drop check for DM in initf_dm()Simon Glass
This is enabled by all boards, so drop the condition. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-12-09Merge tag 'v2025.01-rc4' into nextTom Rini
Prepare v2025.01-rc4
2024-12-02Revert "global_data: Drop spl_handoff"Simon Glass
This breaks chromebook_coral which says: Video: No video mode configured in FSP! This reverts commit 2e9313179a846b581c0fc3f6a49e19f3d343efa8. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-16global: Remove bi_sramstart/bi_sramsizeTom Rini
These fields are currently set on exactly two platforms today, and used by only one of them. Update pic32mzdask to use CFG_SYS_SRAM* in the one location it needs it and otherwise drop this field from the bd_info struct. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-10-25bootstage: Allow counting memory without stringsSimon Glass
The bootstage array includes pointers to strings but not the strings themselves. The strings are added when stashing, but including them in the size calculation gives an inflated view of the amount of space used by the array. Update this function so it can return the amount of memory used by the bootstage structures themselves, without the strings which they point to. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-25common: Fix up malloc() comment in reserve_noncached()Simon Glass
The function name has changed, so update it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-10-11xpl: Rename spl_phase() to xpl_phase()Simon Glass
Rename this function to indicate that it refers to any xPL phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-28bootstage: Fix unstash of records from SPLJonas Karlman
The commit b81e31a1e6c5 ("bootstash: Do not provide a default address for all") changed a bootstage unstash call to bootstage stash, this has resulted in bootstage records stashed in SPL no longer get unstaged in U-Boot proper. Fix this by changing back to a unstage call. Fixes: b81e31a1e6c5 ("bootstash: Do not provide a default address for all") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-08-26global_data: Reduce the size of mon_lenSimon Glass
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>
2024-08-26global_data: Drop spl_handoffSimon Glass
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>
2024-08-26board_f: Move new_bloblist to boardfSimon Glass
This value is only used before relocation. Move it to the new boardf struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26board_f: Move new_bootstage to boardfSimon Glass
This value is only used before relocation. Move it to the new boardf struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26board_f: Move fdt_size to boardSimon Glass
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>
2024-08-26board_f: Add a new struct to hold pre-relocation infoSimon Glass
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>
2024-08-26global_data: Convert have_console into a flagSimon Glass
We don't need a full word for this boolean value. Convert it into a flag to save space in global_data. Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-15bootstage: Fix out-of-bounds read in reloc_bootstage()Richard Weinberger
bootstage_get_size() returns the total size of the data structure including associated records. When copying from gd->bootstage, only the allocation size of gd->bootstage must be used. Otherwise too much memory is copied. This bug caused no harm so far because gd->new_bootstage is always large enough and reading beyond the allocation length of gd->bootstage caused no problem due to the U-Boot memory layout. Fix by using the correct size and perform the initial copy directly in bootstage_relocate() to have the whole relocation process in the same function. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-09upl: Plumb in universal payload to the init processSimon Glass
Read the UPL early in boot so that it is available. For now none of the information is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-19bootstash: Do not provide a default address for allTom Rini
A valid memory location to stash bootstage information at will be architecture dependent. Move the existing defaults to the main Kconfig file for this option and set 0x0 as the default only for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-12board_f: Add support for CONFIG_OF_BOARD_FIXUP for XIP imagesPali Rohár
When U-Boot is running from flash memory (execute in place) then gd->fdt_blob before relocation points to read-only flash memory. So U-Boot calls board_fix_fdt() with read-only gd->fdt_blob pointer which cause immediate CPU crash when callback is trying to modify gd->fdt_blob. Fix this issue by introducing a new config option OF_INITIAL_DTB_READONLY which moves fix_fdt callback after the reloc_fdt callback. This makes CONFIG_OF_BOARD_FIXUP working also if U-Boot before relocation is not running from read/write (S)RAM memory. This is required for mpc85xx boards when booting from flash NOR. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Mojík <marek.mojik@nic.cz> Reviewed-by: Marek Behún <kabel@kernel.org>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06common: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "commmon/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-12mcheck: introduce mcheck_on_ramrelocation(.)Eugene Uriev
The using of pre-reloc/malloc_simple heap is too hard to follow after the relocation. So lets drop it from the pedantic registry and switch to dlmalloc, when moved. The offset is ignored, but kept in the API for the probable case, when that early heap is relocated too. Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-03-01common: board_f: change calculation of gd->mon_len to fix s5p4418 relocStefan Bosch
ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start is after the header (NSIH). Therefore the monitor length has to be calculated using __image_copy_start instead of _start in order the whole monitor code is relocated. Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
2024-02-29bloblist: refactor of bloblist_reloc()Raymond Mao
The current bloblist pointer and size can be retrieved from global data, so we don't need to pass them from the function arguments. This change also help to remove all external access of gd->bloblist outside of bloblist module. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-29video: Skip framebuffer reservation if already reservedDevarsh Thakkar
Skip framebufer reservation if it was already reserved from previous stage and whose information was passed using a bloblist. Return error in case framebuffer information received from bloblist is invalid i.e NULL or empty. While at it, improve the debug message to make it more clear that address in discussion is of framebuffer and not bloblist and also match it with printing scheme followed in video_reserve function. Signed-off-by: Devarsh Thakkar <devarsht@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-01-29common/board_f: Catch bloblist before starting reservationsDevarsh Thakkar
Start reservations needed for init sequence only after catching bloblists from previous stage. This is to avoid catching bloblists in the middle causing gaps while u-boot is reserving. Adjust the relocaddr as per video hand-off information received from previous stage so that further reservations start only after regions reserved for previous stages Skip reservation for video memory if it was already filled by a bloblist. Signed-off-by: Devarsh Thakkar <devarsht@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-06bloblist: Support initing from multiple placesSimon Glass
Typically the bloblist is set up after the devicetree is present. This makes sense because bloblist may use malloc() to allocate the space it needs. However sometimes the devicetree itself may be present in the bloblist. In that case it is at a known location in memory so we can init the bloblist very early, before devicetree. Add a flag to indicate whether the bloblist has been inited. Add a function to init it only if needed. Use that in the init sequence. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LENSimon Glass
Use the new SPL/TPL/VPL_SYS_MALLOC_F symbols to determine whether the malloc pool exists. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2023-08-31freescale: Drop call to init_func_vid() in the init sequenceSimon Glass
Use the misc_init_f event instead, which is designed for this purpose. All boards with CONFIG_VID already enable CONFIG_EVENT. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31x86: Convert arch_fsp_init() to use eventsSimon Glass
Convert this to use events instead of calling a function directly in the init sequence. Rename it to arch_fsp_init_f() to distinguish it from the one that happens after relocation. For FSPv2 nothing needs to be done here, so drop the empty function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31initcall: Support emitting eventsSimon Glass
At present the initcall list consists of a list of function pointers. Over time the initcall lists will likely change to mostly emitting events, since most of the calls are board- or arch-specific. As a first step, allow an initcall to be an event type instead of a function pointer. Add the required macro and update initcall_run_list() to emit an event in that case, or ignore it if events are not enabled. The bottom 8 bits of the function pointer are used to hold the event type, with the rest being all ones. This should avoid any collision, since initcalls should not be above 0xffffff00 in memory. Convert misc_init_f over to use this mechanism. Add comments to the initcall header file while we are here. Also fix up the trace test to handle the change. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-21Merge tag 'v2023.10-rc3' into nextTom Rini
Prepare v2023.10-rc3 Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-15common: return type board_get_usable_ram_topHeinrich Schuchardt
board_get_usable_ram_top() returns a physical address that is stored in gd->ram_top. The return type of the function should be phys_addr_t like the current type of gd->ram_top. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-08-09video: Add a Kconfig option for SPL video handoffSimon Glass
At present this feature is enabled in SPL if a bloblist is available. Some platforms may not want to use this, so add an option to allow the feature to be disabled. Note that the feature unfortunately only fills in part of the video-handoff information, so causes failures on x86 platforms. For now, disable it there. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
2023-08-09treewide: unify the linker symbol reference formatShiji Yang
Now all linker symbols are declared as type char[]. Though we can reference the address via both the array name 'var' and its address '&var'. It's better to unify them to avoid confusing developers. This patch converts all '&var' linker symbol refrences to the most commonly used format 'var'. Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-08-08board_f: Cosmetic style fixBin Meng
Some coding convention fixes for print_resetinfo(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-21common: board_f: Pass frame buffer info from SPL to u-bootNikhil M Jain
U-boot proper can use frame buffer address passed from SPL to reserve the memory area used by framebuffer set in SPL so that splash image set in SPL continues to get displayed while u-boot proper is running. Put the framebuffer address and size in a bloblist to make them available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined. Signed-off-by: Nikhil M Jain <n-jain1@ti.com> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-17x86: Improve the trampoline in 64-bit modeSimon Glass
At present this leaves the stack at the pre-relocation value. This is not ideal since we want to have U-Boot running entirely from the top of memory. In addition, the new global_data pointer is not actually used, since the global_data pointer itself is relocated, then the pre-relocation value is changed, so the effective value (after relocation) does not update. Adjust the implementation to follow the 32-bit code more closely, with a trampoline function which is passed the new stack and global_data pointer. This ensures that the correct values come through even when relocating. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-14board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is setKunihiko Hayashi
In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed after _end, and fdt_find_separate() always returns _end. There is a .bss section after _end and the section is cleared before relocation. When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is still in .bss section, but will be cleared. As a result, the devicetree become invalid. To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC in reloc_fdt(). Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>