Commit graph

895 commits

Author SHA1 Message Date
Jonas Karlman
6826c432e3 spl: Jump to image at end of board_init_r
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-09 15:24:31 -04:00
Chanho Park
a60d9686f2 spl: add __noreturn attribute to spl_invoke_atf function
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-09 15:24:31 -04:00
Tom Rini
d9bb6d779b Merge tag 'u-boot-rockchip-20231007' of 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-08 09:58:55 -04:00
Manoj Sai
a1b7fd7f0a spl: fit: support for booting a LZMA-compressed U-boot binary
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-07 16:49:41 +08:00
Manoj Sai
ce6ab56401 spl: fit: support for booting a GZIP-compressed U-boot binary
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-07 16:49:41 +08:00
Simon Glass
a17e1e76c8 spl: Move bloblist writing until the image is known
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-06 14:38:12 -04:00
Simon Glass
2354daaf39 spl: Use the correct FIT_..._PROP constants
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-06 14:38:12 -04:00
Simon Glass
035ab46e39 spl: Move the full FIT code to spl_fit.c
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>
2023-10-06 14:38:12 -04:00
Simon Glass
d7c232e6b5 spl: Rename spl_load_fit_image() to load_simple_fit()
We have two functions called spl_load_fit_image(), one in spl.c and one in
spl_fit.c

Rename the second one, to indicate that it relates to simple FIT parsing,
rather than the full version.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
17ba50106e spl: Remove #ifdefs with BOOTSTAGE
This feature has some helpers in its header file so that its functions
resolve to nothing when the feature is disabled. Add a few more and use
these to simplify the code.

With this there are no more #ifdefs in board_init_r()

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
2003a83cc8 spl: Avoid an #ifdef when printing gd->malloc_ptr
Use an accessor in the header file to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
3d6d507514 spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN
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-10-06 14:38:12 -04:00
Simon Glass
f817e08ff2 spl: Drop the switch() statement for OS selection
This code is pretty ugly, with many #ifdefs

There are quite a lot of IH_OS_U_BOOT values so the compiler struggles
to create a jump table here. Also, most of the options are normally
disabled.

Change it to an else...if construct instead. Add an accessor for the
spl_image field behind an #ifdef to avoid needing #ifdef in the C code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
e0be6eaf58 spl: Avoid #ifdef with CONFIG_SPL_PAYLOAD_ARGS_ADDR
Move the condition to the header file to improve readability.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
6371c47999 spl: Drop #ifdefs for BOARD_INIT and watchdog
Avoid using the preprocessor for these checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:12 -04:00
Simon Glass
6c2bdf5c1a spl: mx6: powerpc: Drop the condition on timer_init()
It doesn't make sense to have some boards do this differently. Drop the
condition in the hope that the maintainers can figure out any run-time
problems.

This has been tested on qemu-ppce500

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-10-06 14:38:12 -04:00
Simon Glass
52779874da spl: Avoid #ifdef with CONFIG_SPL_SYS_MALLOC
Use IF_ENABLED_INT() to avoid needing to use the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:11 -04:00
Simon Glass
9cbdc3a0fc spl: Rename SYS_SPL_ARGS_ADDR to SPL_PAYLOAD_ARGS_ADDR
Rename this so that SPL is first, as per U-Boot convention. Also add
PAYLOAD_ since this is where in memory the parameters for the payload
have been stored.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06 14:38:11 -04:00
Simon Glass
82e26e0d68 spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_...
We like to put the SPL first so it is clear that it relates to SPL. Rename
various malloc-related options which have crept in, to stick to this
convention.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-10-06 14:38:11 -04:00
Tom Rini
ac897385bb Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-02 10:55:44 -04:00
Jesse Taube
6ab77bb14f Convert CFG_SYS_UBOOT_START to Kconfig
Commit 65cc0e2a65 ("global: Move remaining CONFIG_SYS_* to CFG_SYS_*")
renamed CONFIG_SYS_UBOOT_START to CFG_SYS_UBOOT_START. Unfortunately,
this meant that the value was no longer available to the Makefile. This
caused imxrt to fail to boot. All the other boards that used this
variable were unaffected because they were using the default value
which is CONFIG_TEXT_BASE.

This commit converts CFG_SYS_UBOOT_START to Kconfig and sets the default
value to CONFIG_TEXT_BASE.

Suggested-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-30 15:24:43 -04:00
Simon Glass
1e94b46f73 common: Drop linux/printk.h from common header
This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-09-24 09:54:57 -04:00
Simon Glass
15a23b6f16 dm: core: Allow marking driver model as dead
On x86 devices we use CAR (Cache-As-RAM) to hold the malloc() region in
SPL, since SDRAM is not set up yet. This means that driver model stores
its tables in this region.

When preparing to jump from SPL to U-Boot proper, we must disable CAR, so
that the CPU can uses the caches normally. This means that driver model
tables become inaccessible. From there until we jump to U-Boot proper, we
must avoid using driver model.

This is only a problem on boards which operate this way, for example
chromebook_link64

Add a flag to indicate that driver model is dead and should not be used.
It can be used in SPL to avoid hanging the machine.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-09-22 06:03:46 +08:00
Simon Glass
63f0da65e1 spl: Tidy up load address in spl_ram
This CONFIG is used but is not given a value by some boards. Use
a default value of 0 explicitly, rather than relying on the 0 value
provided by CONFIG_SPL_LOAD_FIT_ADDRESS

This will allow us to make SPL_LOAD_FIT_ADDRESS depend on SPL_LOAD_FIT
as it should.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-09-19 11:36:26 -04:00
Marek Vasut
6b84acc978 sdp: Use plain udevice for UDC controller interaction
Convert to plain udevice interaction with UDC controller
device, avoid the use of UDC uclass dev_array .

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marex@denx.de>
2023-09-15 23:38:02 +02:00
Marek Vasut
99924db71f spl: sdp: Detach the controller on error
In case anything errors out during the SDP transfer, detach
the controller instead of bailing out right away. This way,
the controller can be reattached on next attempt.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marex@denx.de>
2023-09-15 23:38:02 +02:00
Heinrich Schuchardt
323e91a183 spl: undefined return value in spl_blk_load_image
spl_blk_load_image() should not return an uninitialized value if
blk_get_devnum_by_uclass_id() fails.

Fixes: 8ce6a2e175 ("spl: blk: Support loading images from fs")
Reported-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by:  Xavier Drudis Ferran <xdrudis@tinet.cat>
2023-09-09 06:12:47 +02:00
Chanho Park
ef08687ea0 spl: add __noreturn attribute to spl_invoke_opensbi function
spl_invoke_opensbi function is not returned to SPL. Thus, we need to
set __noreturn function attribute.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2023-09-05 10:53:51 +08:00
Tom Rini
7e6e40c572 Prepare v2023.10-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTjxwsACgkQFHw5/5Y0
 tyz4TAwAtVgllQGPVNIVDaEBdG93htm1DoZPc4EMZ4L5rf0nT0yJPeOhRCGygYY+
 zYL1ueleBZtpJhYOuHGetSns0B/M5Wx7gu1eGHNGrMNHH7zCV5Ynjjee2IaqKgbU
 tdSSc8XQpJ3PJY6rhJ6qZ7pO/EcUlQEdqplEUGFmA4JObx43j1+bmqyGTJA57vEw
 rrr+tyUVlr+Wv4lqlX/YJWzAB6IoSMUStv34M2lmiZvZoTYHezvIqBK33GrQ4Cwl
 hQ8nP7ymBXdA5GoMFBpfaBCA7aX3esx4yYN3JIRNRjNmnITJHYs0G8oIh8R5iNnJ
 psroU7GRPu3MmXfOnHlRfA/v0mo8xQGc2RQHyZUGXuApTI8+SFK/4WJPBny/IYse
 ggcVCHoI57dx1+j4+JHYhh61bMR1JUwARs4/UU4dKT3MRZM8Gb99OvbXO3+switZ
 R0YHSnDP///MTC7/MzbOPWzsJiTn9gkZd8nFVTXoncrVI8F3OtCc89G4HBruBSj7
 ptfylxqH
 =VlzD
 -----END PGP SIGNATURE-----

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-21 17:32:17 -04: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
Elena Popa
86b1aad541 spl: mmc: Fix check of CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR
When Falcon Mode is enabled, SPL needs to check the value of
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR. Unfortunately, it was using the
CONFIG_VAL(SYS_MMCSD_RAW_MODE_ARGS_SECTOR) which converts it into
CONFIG_SPL_SYS_MMCSD_RAW_MODE_ARGS_SECTOR when CONFIG_SPL_BUILD is
enabled. CONFIG_SPL_SYS_MMCSD_RAW_MODE_ARGS_SECTOR does not exist in
common/spl/Kconfig. Replaced with
defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR).

Signed-off-by: Elena Popa <elena.popa@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-08-17 16:39:20 -04:00
Heinrich Schuchardt
688d62bfc8 spl: add FIT support to semihosting boot method
Allow loading a FIT image via semihosting in SPL.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-08-14 17:55:53 -04:00
Tom Rini
a077ac13d0 Kconfigs: Correct default of "0" on hex type entries
It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0".  However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-09 09:21:42 -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
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
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
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
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
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
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
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