summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
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-23spl: Create a function to init spl_load_infoSimon Glass
Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-08-23spl: Remove remaining #ifdef in spl_parse_image_header()Simon Glass
Define spl_set_header_raw_uboot() always so we can drop the last #ifdef in this function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-23spl: Remove some #ifdefs in spl_parse_image_header()Simon Glass
This function has a number of unnecessary #ifdefs so remove them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-23spl: mmc: Try to clean up raw-mode optionsSimon Glass
Make the raw-mode options depend on SPL_SYS_MMCSD_RAW_MODE in a more direct way. This makes it easier to understand the options with 'make menuconfig'. There are three different ways of specifying the offset: - sector offset - partition number - partition type So make these a choice, so it is more obvious what is going on. Update existing boards to enable SPL_SYS_MMCSD_RAW_MODE where needed. Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-23spl: Correct use of CMD_BOOTI and CMD_BOOTZSimon Glass
These should have a CONFIG_ prefix. Add it. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 7a0d88076b9 ("Add in the ability to load and boot an uncompr...") Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-23spl: mmc: Adjust args of spl_mmc_find_device()Simon Glass
At present spl_mmc_load() is the only caller of this function, passing it a boot_device, an index into the available MMC devices. Pass the device number instead, since it is known by the caller and simplifies the code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-23spl: mmc: Handle error codes consistentlySimon Glass
Use 'ret' as the return code, since it may not be an error and this is the common name in U-Boot. Make sure to return the error code when given, rather than transforming it into -1 (-EPERM). Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-23spl: mmc: Drop checks for CONFIG_SPL_LIBCOMMON_SUPPORTSimon Glass
This check is not needed now, since printf() resolved to nothing if not available. Drop the #ifdefs Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-23log: Avoid including function names by defaultSimon Glass
Unless function names are requested, the logging system should not compile these into the code. Adjust the macros to handle this. This means that turning on function names at runtime won't work unless CONFIG_LOGF_FUNC is enabled. We could perhaps split this into a separate option if that is a problem. Enable CONFIG_LOGF_FUNC logging for sandbox since the tests expect the function names to be included. Fix up the pinmux test which checks a logging statement. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-19Merge tag 'v2024.10-rc3' into nextTom Rini
Prepare v2024.10-rc3
2024-08-15dlmalloc: Make sure allocation size is within malloc areaRichard Weinberger
Since U-Boot does not support memory overcommit we can enforce that the allocation size is within the malloc area. This is a simple and efficient hardening measure to mitigate further integer overflows in dlmalloc. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-15dlmalloc: Fix integer overflow in sbrk()Richard Weinberger
Make sure that the new break is within mem_malloc_start and mem_malloc_end before making progress. ulong new = old + increment; can overflow for extremely large increment values and memset() can get wrongly called. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-15dlmalloc: Fix integer overflow in request2size()Richard Weinberger
req is of type size_t, casting it to long opens the door for an integer overflow. Values between LONG_MAX - (SIZE_SZ + MALLOC_ALIGN_MASK) - 1 and LONG_MAX cause and overflow such that request2size() returns MINSIZE. Fix by removing the cast. The origin of the cast is unclear, it's in u-boot and ppcboot since ever and predates the CVS history. Doug Lea's original dlmalloc implementation also doesn't have it. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-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-13spl: binman: Disable u_boot_any symbols for i.MX 8ULP boardsGary Bisson
This is extending commit da96f93cda9 ("spl: binman: Disable u_boot_any symbols for i.MX93 boards") to i.MX 8ULP boards. Signed-off-by: Gary Bisson <bisson.gary@gmail.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2024-08-09Merge patch series "Universal Payload initial series"Tom Rini
Simon Glass <sjg@chromium.org> says: Universal Payload (UPL) is an Industry Standard for firmware components[1]. UPL is designed to improve interoperability within the firmware industry, allowing mixing and matching of projects with less friction and fewer project-specific implementations. UPL is cross-platform, supporting ARM, x86 and RISC-V initially. This series provides some initial support for this, targeting 0.9.1 and sandbox only. Features still to come include: - Support for architectures - FIT validation - Handoff validation - Interoperability tests
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-08-09spl: Plumb in the Universal Payload handoffSimon Glass
Specify the FIT and include information about each loaded image, as required by the UPL handoff. Write the UPL handoff into the bloblist before jumping to the next phase. Control this using a runtime flag to avoid conflicting with other handoff mechanisms. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-09spl: Set SPL_FIT_FOUND for full FIT alsoSimon Glass
This flag is set for simple FIT, so set it for full FIT too. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-09upl: Add support for Universal Payload in SPLSimon Glass
Add the basic code to create a handoff structure in SPL, so it can be passed to the next phase. For now this is not plumbed in. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-07Merge patch series "alist: Implement a pointer list / array of structs"Tom Rini
Simon Glass <sjg@chromium.org> says: This data structure provides a list of pointers / array of structures. I was planning to use it for the lmb restructure, to allow it to support any number of entries, but then I gave up on it. There are quite a few places in U-Boot where such a list would be useful, since it supports growing the array. [...] Example: struct my_struct obj; struct my_struct *ptr = alist_add(&lst, &obj, struct my_struct); // now ptr is in the list [trini: Reword the cover letter slightly, do not merge the RFC portion]
2024-08-07malloc: Support testing with realloc()Simon Glass
At present in tests it is possible to cause an out-of-memory condition with malloc() but not realloc(). Add support to realloc() too, so code which uses that function can be tested. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-06Merge patch series "omap configuration cleanups"Tom Rini
Paul Kocialkowski <paulk@sys-base.io> says: Here is a bunch of configuration cleanups for OMAP boards, mostly unifying and moving common configuration from board-specific defconfigs to Kconfig definitions. There's also a cleanup of the sniper (LG Optimus Black) defconfig, prior to migrating it to DM/DT in a future follow-up series.
2024-08-06omap3: Define maximum SPL size in Kconfig instead of defconfigsPaul Kocialkowski
The maximum SPL size was defined to the same value in each OMAP3 board defconfig. Move the common definition to the Kconfig option declaration instead. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Derald D. Woods <woods.technical@gmail.com>
2024-08-06omap3: Define common SPL text base in Kconfig instead of defconfigsPaul Kocialkowski
The SPL text base was defined to the same value in each OMAP3 board defconfig. Move the common definition to the Kconfig option declaration instead. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Tested-by: Adam Ford <aford173@gmail.com> #am3517-evm Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Derald D. Woods <woods.technical@gmail.com>
2024-07-31sandbox: Increase cyclic CPU-time limitSimon Glass
Now that sandbox is using cyclic for video, it trips the 1us time limit. Updating the sandbox display often takes 20ms or more. Increase the limit to 100ms to avoid a warning. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-31cyclic: Add a symbol for SPLSimon Glass
The cyclic subsystem is currently enabled either in all build phases or none. For tools this should not be enabled, but since lib/shc256.c and other files include watchdog.h in the host build, we must make sure that it is not enabled there. Add an SPL symbol so that there is more control of this. Add an include into cyclic.h so that tools can include this file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Reviewed-by: Stefan Roese <sr@denx.de>
2024-07-23arm: ti: Remove omap4 platform supportTom Rini
There are no longer any OMAP4 platforms in U-Boot, remove the related functionality. Signed-off-by: Tom Rini <trini@konsulko.com>
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-18bloblist: fix bloblist convention check.Levi Yun
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes). As updating of TL's signature, register value of x1/r1 should be: In aarch32's r1 value should be R1[23:0]: set to the TL signature (4a0f_b10b -> masked range value: 0f_b10b) R1[31:24]: version of the register convention == 1 and In aarch64's x1 value should be X1[31:0]: set to the TL signature (4a0f_b10b) X1[39:32]: version of the register convention == 1 X1[63:40]: MBZ (See the [2] and [3]). This patch fix problems: 1. breaking X1 value with updated specification in aarch64 - change of length of signature field. 2. previous error value set in R1 in arm32. - length of signature should be 24, but it uses 32bit signature. This patch is a breaking change. It works only TF-A is updated. Link: https://github.com/FirmwareHandoff/firmware_handoff [1] Link: https://github.com/FirmwareHandoff/firmware_handoff/issues/32 [2] Link: https://github.com/FirmwareHandoff/firmware_handoff/commit/5aa7aa1d3a1db75213e458d392b751f0707de027 [3] Signed-off-by: Levi Yun <yeoreum.yun@arm.com> Reviewed-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-15common: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-12Merge patch series "Add Turris 1.x board"Tom Rini
Marek Mojík <marek.mojik@nic.cz> says: Hello all, this is a continuation of previous work by Pali to add support for the Turris 1.x board. As the patches were based on u-boot v2022.04, a nontrivial rebasing was needed. Some notes: - Some options that are in SD defconfig are disabled in NOR defconfig because over the years u-boot grew and the old NOR defconfig will not fit into NOR memory. - SD boot with RAM larger than 2GB will only allocate 2GB of RAM (We were not able to fix this yet)
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-07-06usb: Assimilate usb_get_descriptor() to linuxPhilip Oberfichtner
Before this commit, usb_get_descriptor() failed for some flakey USB devices. We hereby adopt the more robust linux implementation [1]. For instance, for the "Alcor Micro Corp. Flash Drive" (VID 0x058f, PID 0x6387), the following behavior occurs from time to time: => usb start starting USB... Bus xhci_pci: Register 10000840 NbrPorts 16 Starting the controller USB XHCI 1.20 scanning bus xhci_pci for devices... usb_new_device: Cannot read configuration, skipping device 058f:6387 Signed-off-by: Philip Oberfichtner <pro@denx.de> Reviewed-by: Marek Vasut <marex@denx.de> [1] From a38297e3fb012 (Linux 6.9), see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/core/message.c?h=v6.9#n781
2024-07-03global_data.h: drop write-only field dm_root_fRasmus Villemoes
The dm_root_f field seems to be entirely write-only and hence redundant, unless 'git grep' fails to find some access generated via preprocessor token concatenation or similar. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-01Merge branch 'next'Tom Rini
2024-06-30spl: correct link to FIT specificationHeinrich Schuchardt
Replace the invalid link to the FIT file format specification. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-28spl: Allow ATF to work when dcache is disabledSimon Glass
The dcache may not be enabled in SPL. Add a check to avoid trying to use an undefined function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-06-24Merge tag 'v2024.07-rc5' into nextTom Rini
Prepare v2024.07-rc5
2024-06-18cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000Jiaxun Yang
The default value CYCLIC_MAX_CPU_TIME_US was 1000, which is a little bit too low for slower hardware and sandbox. On my MIPS Boston FPGA board with interaptiv CPU, wdt_cyclic can easily take 3200 us to run. On azure pipeline sandbox_clang, wdt_cyclic some times goes beyond 1300 us. Raise default value to 5000, which is the value already taken by octeon_nic32. This is still sufficent to maintain system responsiveness. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Stefan Roese <sr@denx.de>
2024-06-17Merge tag 'xilinx-for-v2024.10-rc1' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-microblaze into next AMD/Xilinx changes for v2024.10-rc1 common: - spl: Introduce SoC specific init function xilinx: - Enable FF-A and NVMEM - Rename spl_board_init() to spl_soc_init() zynqmp: - DT alignments - Enable reset from SPL - Enable USB3 for KD240 - Align multiboot register on Kria for proper reboot - Allow multiboot environment write even in saved environment - Move zynqmp commands from board/ to arch/ - Clean up xilinx_zynqmp.h versal: - Do not prioritize boot device if driver is not enabled versal-net: - Setup location for redundant variables in SPI versal2: - Add support for new SOC mmc: - Fix tap delay for SD on Versal NET spi: - Add SPI_NOR_OCTAL_READ flag for mx66uw2g345gx0 flash part gpio: - Cover MODEPIN firmware dependency
2024-06-17spl: Introduce SoC specific init functionLukas Funke
Some architectures use spl_board_init() in their SoC specific implementation. Board developers should be able to add board specific implementation via spl_board_init(). Hence, introduce a spl_soc_init() method which is called right before spl_board_init() for SoC specific implementation. Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Link: https://lore.kernel.org/r/20240327121153.2455126-2-lukas.funke-oss@weidmueller.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-06-16Merge branch 'next' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-watchdog into next - misc cyclic infrastructure improvements (Rasmus) - watchdog_reset cleanup (Rasmus) CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=369&view=results