aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2023-11-10tree-wide: Replace http:// link with https:// link for ti.comNishanth Menon1-1/+1
Replace instances of http://www.ti.com with https://www.ti.com Signed-off-by: Nishanth Menon <nm@ti.com>
2023-10-30common: Reword CONSOLE_RECORD_.*SIZE help textsTom Rini1-8/+8
Make it clear that in the options for setting the console record buffer sizes that we are talking about buffers for that feature specifically and not the general console buffers. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-24serial: introduce CONFIG_CONSOLE_FLUSH_ON_NEWLINERasmus Villemoes1-0/+10
When debugging, one sometimes only gets partial output lines or nothing at all from the last printf, because the uart has a largish buffer, and the code after the printf() may cause the CPU to hang before the uart IP has time to actually emit all the characters. That can be very confusing, because one doesn't then know exactly where the hang happens. Introduce a config knob allowing one to wait for the uart fifo to drain whenever a newline character is printed, roughly corresponding to the effect of setvbuf(..., _IOLBF, ...) in ordinary C programs. Since this uses IS_ENABLED() instead of cpp ifdef, we can remove the ifdef around the _serial_flush() definition - if neither CONSOLE_FLUSH_SUPPORT or CONSOLE_FLUSH_ON_NEWLINE are enabled, the compiler elides _serial_flush(), but it won't warn about it being unused. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24cli: Consume invalid escape sequences earlyYurii Monakov1-0/+2
Unexpected 'Esc' key presses are accumulated internally, even if it is already clear that the current escape sequence is invalid. This results in weird behaviour. For example, the next character after 'Esc' key simply disappears from input and 'Unknown command' is printed after 'Enter'. This commit fixes some issues with extra 'Esc' keys entered by user: 1. Sequence <Esc><Esc><Enter> right after autoboot stop gives: => nknown command 'ry 'help' => 2. Sequence <Esc><p><r><i><Enter> gives: => ri Unknown command 'ri' - try 'help' => 3. Extra 'Esc' key presses break backspace functionality. Signed-off-by: Yurii Monakov <monakov.y@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24Merge tag 'u-boot-imx-20231024' of ↵Tom Rini1-1/+13
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20231024 ------------------- CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/18211 - Fixes for MC2432 Eeprom - i.MX93 ADC - Secondary boot mode on i.MX8M
2023-10-23Merge tag 'u-boot-at91-2024.01-b' of ↵Tom Rini2-0/+2
https://source.denx.de/u-boot/custodians/u-boot-at91 Second set of u-boot-at91 features for the 2024.01 cycle This feature set a new board named Conclusive KSTR sama5d27 with some small prerequisites patches.
2023-10-23event: add new EVT_SETTINGS_R eventArtur Rojek2-0/+2
Introduce EVT_SETTINGS_R, triggered post-relocation and before console init. This event gives an option to perform any platform-dependent setup, which needs to take place before show_board_info(). Usage examples include readout of EEPROM stored settings. Signed-off-by: Artur Rojek <artur@conclusive.pl> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-22sunxi: add Allwinner R528/T113 SoC supportAndre Przywara1-0/+1
This adds the remaining code bits to teach U-Boot about Allwinner's newest SoC generation. This was introduced with the RISC-V based Allwinner D1 SoC, which actually shares a die with the ARM cores versions called R528 (BGA, without DRAM) and T113s (QFP, with embedded DRAM). This adds the new Kconfig stanza, using the two newly introduced symbols for the new SoC generation and pincontroller. It also adds the new symbols to the relavent code places, to set all the hardcoded bits directly. We need one DT override: The ARM core version of the DT specifies the CPUX watchdog as "reserved", which means it won't be recognised by U-Boot. Override this in our generic sunxi-u-boot.dtsi, to let U-Boot pick up this watchdog, so that the generic reset driver will work. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-10-22sunxi: introduce NCAT2 generation modelAndre Przywara1-1/+1
Allwinner seems to typically stick to a common MMIO memory map for several SoCs, but from time to time does some breaking changes, which also introduce new generations of some peripherals. The last time this happened with the H6, which apart from re-organising the base addresses also changed the clock controller significantly. We added a CONFIG_SUN50I_GEN_H6 symbol back then to mark SoCs sharing those traits. Now the Allwinner D1 changes the memory map again, and also extends the pincontroller, among other peripherals. To mark this generation of SoCs, add a CONFIG_SUNXI_GEN_NCAT2 symbol, this name is reportedly used in the Allwinner BSP code, and prevents us from inventing our own name. Add this new symbol to some guards that were already checking for the H6 generation, since many features are shared between the two (like the renovated clock controller). This paves the way to introduce a first user of this generation. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-19spl: riscv: add os type for next booting stageRandolph2-3/+9
If SPL_LOAD_FIT_OPENSBI_OS_BOOT is enabled, the function spl_invoke_opensbi should change the target OS type to IH_OS_LINUX. OpenSBI will load the Linux image as the next boot stage. The os_takes_devicetree function returns a value of true or false depending on whether or not SPL_LOAD_FIT_OPENSBI_OS_BOOT is enabled. Signed-off-by: Randolph <randolph@andestech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-19spl: riscv: opensbi: change the default os_type as varibleRandolph1-10/+16
In order to introduce the Opensbi OS boot mode, the next stage boot image of OpenSBI should be configurable. Signed-off-by: Randolph <randolph@andestech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Use map_sysmem where appropriateSean Anderson11-35/+69
All "physical" addresses in SPL must be converted to virtual addresses before access in order for sandbox to work. Add some calls to map_sysmem in appropriate places. We do not generally call unmap_sysmem, since we need the image memory to still be mapped when we jump to the image. This doesn't matter at the moment since unmap_sysmem is a no-op. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Add callbacks to invalidate cached devicesSean Anderson2-1/+12
Several SPL functions try to avoid performing initialization twice by caching devices. This is fine for regular boot, but does not work with UNIT_TEST, since all devices are torn down after each test. Add some functions to invalidate the caches which can be called before testing these load methods. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17fs: ext4: Fix building ext4 in SPL if write is enabledSean Anderson1-0/+1
If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but not CRC16. Add an option to enable CRC16 to avoid linker errors. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17Move i.MX8 container image loading support to common/splSean Anderson3-0/+173
To facilitate testing loading i.MX8 container images, move the parse-container code to common/spl. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17arm: imx: Check header before calling spl_load_imx_containerSean Anderson4-4/+12
Make sure we have an IMX header before calling spl_load_imx_container, since if we don't it will fail with -ENOENT. This allows us to fall back to legacy/raw images if they are also enabled. This is a functional change, one which likely should have been in place from the start, but a functional change nonetheless. Previously, all non-IMX8 images (except FITs without FIT_FULL) would be optimized out if the only image load method enabled supported IMX8 images. With this change, support for other image types now has an effect. There are seven boards with SPL_LOAD_IMX_CONTAINER enabled: three with SPL_BOOTROM_SUPPORT: imx93_11x11_evk_ld imx93_11x11_evk imx8ulp_evk and four with SPL_MMC: deneb imx8qxp_mek giedi imx8qm_mek All of these boards also have SPL_RAW_IMAGE_SUPPORT and SPL_LEGACY_IMAGE_FORMAT enabled as well. However, none have FIT support enabled. Of the six load methods affected by this patch, only SPL_MMC and SPL_BOOTROM_SUPPORT are enabled with SPL_LOAD_IMX_CONTAINER. spl_romapi_load_image_seekable does not support legacy or raw images, so there is no growth. However, mmc_load_image_raw_sector does support loading legacy/raw images. Since these images could not have been booted before, I have disabled support for legacy/raw images on these four boards. This reduces bloat from around 800 bytes to around 200. There are no in-tree boards with SPL_LOAD_IMX_CONTAINER and AHAB_BOOT both enabled, so we do not need to worry about potentially falling back to legacy images in a secure boot scenario. Future work could include merging imx_container.h with imx8image.h, since they appear to define mostly the same structures. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17spl: fit: Fix entry point for SPL_LOAD_FIT_FULLSean Anderson1-1/+2
The entry point is not always the same as the load address. Use the value of the entry property if it exists. Fixes: 8a9dc16e4d0 ("spl: Add full fitImage support") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: nor: Don't allocate header on stackSean Anderson1-7/+4
spl_image_info.name contains a reference to legacy_img_hdr. If we allocate the latter on the stack, it will be clobbered after we return. This was addressed for NAND back in 06377c5a1fc ("spl: spl_legacy: Fix NAND boot on OMAP3 BeagleBoard"), but that commit didn't fix NOR. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2023-10-17spl: legacy: Fix referencing _image_binary_endSean Anderson1-1/+1
On non-arm architectures, _image_binary_end is defined as a ulong and not a char[]. Take the address of it when accessing it, which is correct for both. Fixes: 1b8a1be1a1f ("spl: spl_legacy: Fix spl_end address") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: mmc: Fix subsequent calls to spl_mmc_load with CONFIG_BLKSean Anderson1-1/+1
MMC devices do not have uclass platdata containing blk_descs, only their child block devices do. Fortunately, we have a function just for this purpose. This fixes subsequent calls to spl_mmc_load. Fixes: bf28d9a6599 ("spl: mmc: Use correct MMC device when loading image") Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17spl: mmc: Introduce proper layering for spl_mmc_get_uboot_raw_sector()Marek Vasut1-1/+13
Introduce two new weak functions, arch_spl_mmc_get_uboot_raw_sector() and board_spl_mmc_get_uboot_raw_sector(), each of which can be overridden at a matching level, that is arch/ and board/ , in addition to the existing weak function spl_mmc_get_uboot_raw_sector(). This way, architecture code can define a default architecture specific implementation of arch_spl_mmc_get_uboot_raw_sector(), while the board code can override that using board_spl_mmc_get_uboot_raw_sector() which takes precedence over the architecture code. In some sort of unlikely special case where code has to take precedence over board code too, the spl_mmc_get_uboot_raw_sector() is still left out to be a weak function, but it should be unlikely that this is ever needed to be overridden. Signed-off-by: Marek Vasut <marex@denx.de>
2023-10-16spl: fit: Add board level function to decide application of DTOMarek Vasut1-3/+20
Add board-specific function used to indicate whether a DTO from fitImage configuration node 'fdt' property DT and DTO list should be applied onto the base DT or not applied. This is useful in case of DTOs which implement e.g. different board revision details, where such DTO should be applied on one board revision, and should not be applied on another board revision. Signed-off-by: Marek Vasut <marex@denx.de>
2023-10-11cli: Add a function to set up a new creadSimon Glass1-9/+15
Create a init function so that it is easy to use command-line reading. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Allow command completion to be disabledSimon Glass1-1/+2
When inputting text outside the command line we don't want to use tab for command completion. Add an option to control this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Allow history to be disabledSimon Glass1-20/+22
When inputting text outside the command line we don't want history to be accessible. Add an option to control this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Terminate the string in cread_line_process_ch()Simon Glass1-1/+7
Rather than relying on the caller, terminate the string inside this function. Do this each time we return, whether input is finished or not. It is not needed when the input is aborted, since the string will be discarded in that case. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Create a function to process charactersSimon Glass1-45/+63
Move most of the inner loop from cread_line() into a new function. This will allow using it from other code. This involves adding a few more members to the state struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Unindent some code in cread_line()Simon Glass1-140/+139
Reduce the indentation level of this code so it is easier to review the next patch, which moves it into a function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Convert cread_line() to use a struct for the main varsSimon Glass1-55/+61
We want to reuse the editing code elsewhere. As a first step, move the common variables into a struct. This will allow us to eventually put the contents of the inner loop in a function, so it can be called from elsewhere. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Use unsigned int instead of unsigned longSimon Glass1-9/+8
The index values are not very large so it makes no sense to use a long integer. Change these to uint instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Implement delete-word in cread_line()Simon Glass1-0/+31
The Ctrl-W option is implemented in the cread_line_simple() but not in the full version. This seems odd, so add an implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Drop #ifdefs for CONFIG_AUTO_COMPLETE in cli_readlineSimon Glass1-43/+42
Use a static inline and adjust the logic to avoid the need for #ifdefs in cli_readline_into_buffer() Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Drop some #ifdefs in cli_readlineSimon Glass1-6/+14
Add a few static inlines to avoid the need for #ifdefs in cli_readline_into_buffer() Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Add a command to show cmdline historySimon Glass1-3/+1
There is a function for this but it is never used. Showing the history is a useful feature, so add a new 'history' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Move simple readline into a functionSimon Glass1-33/+46
Move this code into its own function since it is a separate implementation from the full version. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11event: Rename rest of EVENT_SPY to EVENT_SPY_FULL or EVENT_SPY*Marek Vasut1-2/+2
Fix up remaining occurances of EVENT_SPY with no suffix. Fixes: 6c4cad7438 ("event: Rename EVENT_SPY to EVENT_SPY_FULL") Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-11malloc: Enable assertions if UNIT_TEST is enabledSean Anderson1-4/+4
dlmalloc has some sanity checks it performs on free() which can help detect memory corruption. However, they are only enabled if DEBUG is defined before including common.h. Define DEBUG earlier if UNIT_TEST is enabled so that assertions are enabled in sandbox. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: Use a macro for the typical block sizeBin Meng1-2/+2
Avoid using the magic number 512 directly. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-09stdio: fix stdio_deregister_dev()Heinrich Schuchardt1-3/+3
When copying the name of a stdio device we must ensure that it is NUL terminated before passing it to strcmp() to avoid a buffer overrun. Truncating the name field leads to failure to deregister a stdio device. When copying we must ensure that the name field sizes match. Addresses-Coverity-ID: 350462 String not null terminated Fixes: 5294e97832a6 ("stdio: extend "name" to 32 symbols") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-09spl: Jump to image at end of board_init_rJonas Karlman1-5/+7
spl_board_prepare_for_boot() is not called before jumping/invoking atf, optee, opensbi or linux images. Jump to image at the end of board_init_r() to fix this. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-09spl: add __noreturn attribute to spl_invoke_atf functionChanho Park1-4/+4
spl_invoke_atf function will not be returned to SPL. Thus, we need to set __noreturn function attribute to the function. Signed-off-by: Chanho Park <chanho61.park@samsung.com>
2023-10-08Merge tag 'u-boot-rockchip-20231007' of ↵WIP/08Oct2023Tom Rini1-3/+17
https://source.denx.de/u-boot/custodians/u-boot-rockchip - Add Board: rk3568 Bananapi R2Pro; - Update pcie bifurcation support; - dwc_eth_qos controller support for rk3568 and rk3588; - Compressed binary support for U-Boot on rockchip platform; - dts and config updates for different board and soc; [ trini: Fix conflict on include/spl.h ] Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-07spl: fit: support for booting a LZMA-compressed U-boot binaryManoj Sai1-1/+12
If LZMA Compression support is enabled, LZMA compressed U-Boot binary will be placed at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assigned as the source address. image_decomp() function, will decompress the LZMA compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-07spl: fit: support for booting a GZIP-compressed U-boot binaryManoj Sai1-3/+6
If GZIP Compression support is enabled, GZIP compressed U-Boot binary will be at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assign it as the source address. gunzip function in spl_load_fit_image ,will decompress the GZIP compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-06bloblist: Add missing nameSimon Glass1-0/+1
Add a missing bloblist name. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06bloblist: Support initing from multiple placesSimon Glass2-4/+13
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-06sandbox: Move the bloblist down a little in memorySimon Glass1-1/+1
Move this down by 4KB so that it is large enough to hold the devicetree. Also fix up the devicetree address in the documetation while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06spl: Move bloblist writing until the image is knownSimon Glass1-12/+12
The bloblist should not be finalised until the image is fully set up. This allows any final handoff information to be included in the bloblist. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06spl: Use the correct FIT_..._PROP constantsSimon Glass1-5/+6
Rather than open-coding the property names, use the existing constants provided for this purpose. This better aligns the simple-FIT code with the full FIT implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06spl: Move the full FIT code to spl_fit.cSimon Glass2-101/+100
For some reason this code was put in the main spl.c file. Move it out to the FIT implementation where it belongs. Signed-off-by: Simon Glass <sjg@chromium.org>