Commit graph

6214 commits

Author SHA1 Message Date
Chanho Park
27c7a62986 dm: event: add EVT_DM_POST_INIT_R event type
This patch introduces EVT_DM_POST_INIT_R event type for handling hooks
after relocation.

Fixes: 55171aedda ("dm: Emit the arch_cpu_init_dm() even only before relocation")
Suggested-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev>
Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev>
Fixed missing event name in event.c:
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-22 08:07:43 -06:00
Heinrich Schuchardt
4ad85a9fea spl: don't assume NVMe partition 1 exists
There is no requirement that a partition 1 exists in a partition table.
We should not try to retrieve information about it.

We should not even try reading with partition number
CONFIG_SYS_NVME_BOOT_PARTITION here as this is done in the fs_set_blk_dev()
call anyway.

Fixes: 8ce6a2e175 ("spl: blk: Support loading images from fs")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-08-19 04:12:52 +02:00
Heinrich Schuchardt
d768dd8855 common: return type board_get_usable_ram_top
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-15 18:21:17 +02:00
Shengyu Qu
6419f8e9fd riscv: Add SPL_ZERO_MEM_BEFORE_USE implementation
Add the actual support code for SPL_ZERO_MEM_BEFORE_USE and remove
existing Starfive JH7110's L2 LIM clean code, since existing code has
following issues:
 1. Each hart (in the middle of a function call) overwriting its own
    stack and other harts' stacks.
    (data-race and data-corruption)
 2. Lottery winner hart can be doing "board_init_f_init_reserve",
    while other harts are in the middle of zeroing L2 LIM.
    (data-race)

Signed-off-by: Bo Gan <ganboing@gmail.com>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2023-08-10 10:58:12 +08:00
Simon Glass
b7080bfceb video: Add a Kconfig option for SPL video handoff
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-09 23:31:11 +08:00
Simon Glass
d7d78576bb bootstd: Rename bootdev_setup_sibling_blk()
This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-08-09 23:31:11 +08:00
Marek Vasut
fa96774d29 common: Drop duplicate space in SPL_BMP description
Drop duplicate space in Kconfig symbol description.

Signed-off-by: Marek Vasut <marex@denx.de>
2023-08-07 13:41:44 -04:00
Heinrich Schuchardt
3b7b73879f common: fix detection of SYS_MALLOC_F_LEN=0x0
CONFIG_$(SPL_TPL_)SYS_MALLOC_F_LEN is defined as hex. If set to zero
manually, .config contains '0x0' and not '0' as value.

The default value for CONFIG_SPL_SYS_MALLOC_F_LEN should not be set to 0
but to 0x0 if CONFIG_SPL_FRAMEWORK=n to match a manually set value.

Fixes: c0126bd862 ("spl: Support bootstage, log, hash and early malloc in TPL")
Fixes: b616947052 ("SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-08-07 13:41:44 -04:00
Oleksandr Suvorov
af62d83cc0 spl: move SPL_CRC32 option to lib/Kconfig
All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-07 13:41:44 -04:00
Oleksandr Suvorov
0d2761abbd spl: remove duplicate SPL_MD5 option
There is another SPL_MD5 option defined in lib/Kconfig.
Renaming SPL_MD5_SUPPORT introduced duplicate option with
different description. As for now FIT and hash algorithm options
are not related to each others, removing a duplicate option seems OK.

Fixes: 4b00fd1a84 ("Kconfig: Rename SPL_MD5_SUPPORT to SPL_MD5")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2023-08-07 13:41:44 -04:00
Tom Rini
a536b2fdb1 bloblist: Enforce CRC32
In the common bloblist code we call crc32 to get a checksum for the
data.  Ensure we will have the CRC32 code via select.

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-07 13:41:44 -04:00
Jaehoon Chung
b49662083f event: Fix a wrong type_name from dm_post_init to dm_post_init_f
DM_POST_INIT was changed to DM_POST_INIT_F.
To debug correct message, change type_name from dm_post_init to
dm_post_init_f.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
s/an/a/ :
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Bin Meng
6b343ab38d console: Print out complete stdio device list
At present if both CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are on,
during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.

For such case, we can print out the stdio device name from the
environment variables.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-08-02 16:32:31 +08:00
Bin Meng
f30fd55e82 console: Refactor stdio_print_current_devices() a little bit
In preparation to future changes, refactor this routine a little bit.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
2023-08-02 16:32:26 +08:00
Bin Meng
75bfc6fac5 console: Make stdio_print_current_devices() static
As it is only called in common/console.c

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>  # qemu-x86_64
2023-08-02 16:32:02 +08:00
Bin Meng
142276ce51 console: kconfig: Drop the redundant VIDEO dependency
The VIDEO dependency is described twice in CONSOLE_MUX.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 16:31:58 +08:00
Heinrich Schuchardt
7d4c8cfe25 spl: initialize PCI before booting
MMC, SATA, and USB may be using PCI based controllers.
Initialize the PCI sub-system before trying to boot.

Remove the initialization for NVMe that is now redundant.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-07-30 18:53:08 +02:00
Heinrich Schuchardt
d62e7b8059 spl: blk: partition numbers are hexadecimal
Loading u-boot.itb from device 0x00, partition 0x0f fails with:

    Trying to boot from NVME

    Device 0: Vendor: 0x4x Rev: 8.0.50   Prod: nvme-1
                Type: Hard Disk
                Capacity: 3814.6 MB = 3.7 GB (7812500 x 512)
    ** Invalid partition 21 **
    Couldn't find partition nvme 0:15

Like the command line interface fs_det_blk_dev() expects that the device
number and the partition number are hexadecimal.

Fixes: 8ce6a2e175 ("spl: blk: Support loading images from fs")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-07-30 18:52:03 +02:00
Heinrich Schuchardt
8acfd7ddce spl: blk: use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
We should target to unify the code for different block devices in SPL to
reduce code size.

MMC, USB, SATA, and Semihosting use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME to
indicate the filename to load.

NVMe uses CONFIG_SPL_PAYLOAD in spl_blk_load_image().

CONFIG_SPL_PAYLOAD is meant to define which binary to integrate into
u-boot-with-spl.bin. See commit
7550dbe38b ("spl: Add option SPL_PAYLOAD").

Change spl_blk_load_image() to use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME.

Fixes: 8ce6a2e175 ("spl: blk: Support loading images from fs")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-07-30 18:50:24 +02:00
Samuel Dionne-Riel
373991d693 common: Kconfig: Fix CMD_BMP/BMP dependency
Using `default y` will not select BMP when CMD_BMP has been enabled, if
it was already configured.

By using `select`, if `CMD_BMP` is turned on, it will force the presence
of `BMP`.

Fixes: 072b0e16c4 ("common: Kconfig: Add BMP configs")
Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
2023-07-21 15:32:12 -04:00
Nikhil M Jain
954b0ad4a2 common: spl: spl: Remove video driver
Use config SPL_VIDEO_REMOVE to remove video driver at SPL stage before
jumping to next stage, in place of CONFIG_SPL_VIDEO, to allow user to
remove video if required.

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-21 15:32:12 -04:00
Nikhil M Jain
5bc610a7d9 common: board_f: Pass frame buffer info from SPL to u-boot
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-21 15:32:12 -04:00
Nikhil M Jain
149fb05b83 common: spl: spl: Update stack pointer address
At SPL stage when stack is relocated, the stack pointer needs to be
updated, the stack pointer may point to stack in on chip memory even
though stack is relocated.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-07-21 15:32:12 -04:00
Nikhil M Jain
2b36c623ef common: splash_source: Fix type casting errors
During compilation splash_source puts out below warning for type
conversion in splash_load_fit for bmp_load_addr and fit_header.
Change their type to uintptr_t to fix the warnings.

common/splash_source.c: In function ‘splash_load_fit’:
common/splash_source.c:366:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  366 |         img_header = (struct legacy_img_hdr *)bmp_load_addr;
      |                      ^
common/splash_source.c:376:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  376 |         res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
      |                                                 ^
common/splash_source.c:401:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  401 |                 memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size);

The above warnings are generated if CONFIG_FIT is enabled.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
2023-07-21 13:13:43 -04:00
Christian Taedcke
a1190b4d6a event: Add fpga load event
This enables implementing custom logic after a bitstream was loaded
into the fpga.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/r/20230720072724.11516-1-christian.taedcke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-07-21 09:00:39 +02:00
Michal Simek
174d728471 arm64: zynqmp: Switch to amd.com emails
Update my and DPs email address to match current setup.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/aba5b19b9c5a95608829e86ad5cc4671c940f1bb.1688992543.git.michal.simek@amd.com
2023-07-21 09:00:38 +02:00
Joshua Watt
3430f24bc6 android_ab: Try backup booloader_message
Some devices keep 2 copies of the bootloader_message in the misc
partition and write each in sequence when updating. This ensures that
there is always one valid copy of the bootloader_message. Teach u-boot
to optionally try a backup bootloader_message from a specified offset if
the primary one fails its CRC check.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-07-17 16:20:08 -04:00
Simon Glass
f9ebfd7c7a log: Support outputing function names in SPL
The output is garbled when tiny printf() is used. Correct this by adding
a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-17 17:23:15 +08:00
Simon Glass
03fe79c091 x86: Pass video settings from SPL to U-Boot proper
When video is set up in SPL, U-Boot proper needs to use the correct
parameters so it can write to the display.

Put these in a bloblist so they are available to U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-17 17:12:26 +08:00
Simon Glass
0be0f205b9 bdinfo: Show the malloc base with the bdinfo command
It is useful to see the base of the malloc region. This is visible when
debugging but not in normal usage.

Add it to the global data so that it can be shown.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Nikhil M Jain <n-jain1@ti.com>
2023-07-17 17:12:21 +08:00
Simon Glass
8f015d3781 x86: Improve the trampoline in 64-bit mode
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-17 17:12:07 +08:00
Simon Glass
f98caa6ae3 log: Tidy up an ambiguous comment
Add a bit more detail so it is clear that multiple devices are
supported, but only one per driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-17 17:12:07 +08:00
Kunihiko Hayashi
874bf6e0e2 board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set
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>
2023-07-14 15:21:08 -04:00
Sergei Antonov
497e3a89ba hash: fix a memory leak
memalign() returns a pointer which is to be freed by free(). To call
unmap_sysmem() is incorrect, furthermore it was called in a wrong scope.

Also add a check for allocation error.

Fixes: d7af2baa49 ("crypto/fsl: Fix HW accelerated hash commands")
Cc: Breno Lima <breno.lima@nxp.com>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-14 15:21:07 -04:00
Simon Glass
c98cb51252 bootstd: Add a separate log category for expo
This feature is different enough from bootstd that it probably deserves
its own log category. It cannot use a uclass since it is not a device.

Add a new category.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Ying Sun
0f42f89955 tpl: Kconfig: TPL_BANNER_PRINT depends on DEBUG_UART && TPL_SERIAL
As implemented in the arch/arm/mach-rockchip/tpl.c file,
the CONFIG_TPL_BANNER_PRINT option will not work
if either of these options is not enabled.

Add dependency constraints to the CONFIG_TPL_BANNER_PRINT option
definition to prevent configuration problems
where option is enabled but do not take effect.

Suggested-by: Yanjie Ren <renyanjie01@gmail.com>
Signed-off-by: Ying Sun <sunying@nj.iscas.ac.cn>
2023-07-07 16:25:56 -04:00
Ying Sun
29f925d8f9 common: Kconfig: SYS_CONSOLE_ENV_OVERWRITE depends on SYS_CONSOLE_IS_IN_ENV
CONFIG_SYS_CONSOLE_ENV_OVERWRITE is implemented in common/console.c
when "#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)" is met.

It is recommended to add dependency constraints to its definition.

Suggested-by: Yanjie Ren <renyanjie01@gmail.com>
Signed-off-by: Ying Sun <sunying@nj.iscas.ac.cn>
2023-07-07 16:25:56 -04:00
Heinrich Schuchardt
9eb0fc24c9 RISC-V: CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS description
Describe which numeric values can be used for as scratch options for
OpenSBI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
2023-07-06 17:28:08 +08:00
Tom Rini
e80f4079b3 Prepare v2023.07-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmSjExsACgkQFHw5/5Y0
 tywJ3gwAsTbr9mCmCzaKs2F/Jh6H47WEUMEz96wE8eXwuS57pfNJhml4v2rEhYpQ
 MlBjz6vTOyHDrtinRlvempJWVZEuoflMb6M2OTqVFqZPuPT3cLLuSdM4pgb5SdKS
 jNDWcxr12LqiDS0Mz+QOHdps3H8mzsCnOXeOTT+VaSeYHPOLQ+M9OV2o/aY2BsNi
 JLAGX+8i7FuZnVYZzSv6PQYYGZZV+Kvl5oLlPPJttsA7bGu4m2k8zRQQdzd+PIbu
 owAh3CHSKCy1g+y7ASn1Nd2VE06huvqGG7Qo2sj+Ypf/wbNy16qbMc2C7HDwDcul
 nrnf6BZ+MTelwxyPHBOR52ERgY6H8rgpvsCNL0arxaCHJOVddXtrUY1591vE71aB
 nGxhnyLnHwOXXdDGsPsR7p4SF16e6RzaINKmDorQ37nidRnTFLlFCxidnR8ztscR
 aUpLraqYUquGJf7lejYX2OZg2f36lvpYKy1lwuJfd9fUSgK8iyUKrE9wOJhWnTK8
 cIOnS/A+
 =DNor
 -----END PGP SIGNATURE-----

Merge tag 'v2023.07-rc6' into next

Prepare v2023.07-rc6
2023-07-05 11:28:55 -04:00
Fabio Estevam
1b8a1be1a1 spl: spl_legacy: Fix spl_end address
Currently, spl_end points to the __bss_end address, which
is an external RAM address instead of the end of the SPL text
section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```
Fix this problem by assigning spl_end to _image_binary_end, as this
symbol properly represents the end of the SPL text section.

From u-boot-spl.map:

.end
 *(.__end)
                0x00000000009121a4                _image_binary_end = .

Fixes: 77aed22b48 ("spl: spl_legacy: Add extra address checks")
Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de> # DH i.MX6Q DHCOM PDK2
2023-07-03 10:20:13 -04:00
Marek Vasut
6039e0edc8 imx: hab: Simplify the mechanism
The current mechanism is unnecessarily complex. Simplify the whole mechanism
such that the entire fitImage is signed, IVT is placed at the end, followed
by CSF, and this entire bundle is also authenticated. This makes the signing
scripting far simpler.

Signed-off-by: Marek Vasut <marex@denx.de>
2023-06-24 13:47:02 -04:00
Marek Vasut
77aed22b48 spl: spl_legacy: Add extra address checks
Check whether the loaded image or entry point does not overlap SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
2023-06-24 13:47:00 -04:00
Simon Glass
a7536e95e2 menu: Re-enable the ANSI codes
The intent here was to allow ANSI codes to be disabled, since it was
proving impoosible to test operation of the menu code when it kept moving
the cursor. Unfortunately this ended up in the patch.

Correct this by enabling ANSI again.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Pali Rohár <pali@kernel.org>
Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl>
Reported-by: Frank Wunderlich <frank-w@public-files.de>
Fixes: 32bab0eae5 ("menu: Make use of CLI character processing")
Tested-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2023-06-23 14:38:16 -04:00
Emanuele Ghidoli
1c64b98c1e common/memsize.c: Fix get_ram_size() when cache is enabled
Ensure that every write is flushed to memory and afterward reads are
from memory.
Since the algorithm rely on the fact that accessing to not existent
memory lead to write at addr / 2 without this modification accesses
to aliased (not physically present) addresses are cached and
wrong size is returned.

This was discovered while working on a TI AM625 based board
where cache is normally enabled, see commit c02712a748 ("arm: mach-k3: Enable dcache in SPL").

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
2023-06-21 16:54:25 -04:00
Masahiro Yamada
e0afedb640 stdio: Remove stdio_init()
This function is not used by anyone.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-20 20:56:27 -04:00
Mario Kicherer
1aeedef937 spl: spl-nor: return error if no valid image was loaded
If only FIT images are enabled and loading the FIT image fails,
spl_nor_load_image() should return an error instead of zero.

Without this patch:

>>SPL: board_init_r()
spl_init
Trying to boot from NOR
Unsupported OS image.. Jumping nevertheless..
image entry point: 0x0

With patch:

>>SPL: board_init_r()
spl_init
Trying to boot from NOR
SPL: failed to boot from all boot devices (err=-6)
.### ERROR ### Please RESET the board ###

Signed-off-by: Mario Kicherer <dev@kicherer.org>
2023-06-20 13:02:34 -04:00
Mayuresh Chitale
02d9c0b0e5 common: spl: Add spl NVMe boot support
Add support to load the next stage image from an NVMe disk which may
be formatted as an EXT or FAT filesystem.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
[trini: Drop hunk changing disk/part.c as that breaks other users]
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-06-19 17:47:41 -04:00
Mayuresh Chitale
8ce6a2e175 spl: blk: Support loading images from fs
Add a generic API to support loading of SPL payload from any supported
filesystem on a given partition of a block device.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-06-19 17:19:44 -04:00
Mayuresh Chitale
f3228a7232 spl: Add Kconfig options for NVME
Add kconfig options to enable NVME and PCI NVMe support in SPL

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-19 17:19:44 -04:00
Patrick Delaunay
163c5f60eb fdt_support: add fdt_copy_fixed_partitions function
Add a new function fdt_copy_fixed_partitions to copy the fixed
partition nodes from U-Boot device tree to Linux kernel
device tree and to dynamically configure the MTD partitions.

This function fdt_copy_fixed_partitions is only based on device tree
with livetree compatible function and replace the function
fdt_fixup_mtdparts based on mtdparts variable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-06-16 11:01:15 +02:00