Commit Graph

96903 Commits

Author SHA1 Message Date
Simon Glass
b3cde69543 lib: Mark crc8 as relocation code
Mark the crc8 code as needed by relocation. This is used as a simple
check against corruption of the code when copying.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
87283bc94e spl: Provide a way to mark code needed for relocation
Add a linker symbol which can be used to mark relocation code, so it can
be collected by the linker and copied into a suitable place and executed
when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
931539ae76 spl: Allow spl_load() to be controlled in any xPL phase
Some phases may wish to use full FIT-loading and others not, so allow
this to be controlled.

Add some debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
972db76fea vbe: Support selecting images based on phase in FIT
With SPL we want to specify the phase of the image to be loaded. Add
support for this.

This is the implementation of a FIT feature added to the spec a few
years ago and entails a small code-size increase, about 70 bytes on
Thumb2.

Signed-off-by: Simon Glass <sjg@chromium.org>
Link: https://docs.u-boot.org/en/latest/usage/fit/index.html
2025-02-06 23:49:28 +00:00
Simon Glass
8a358d7665 spl: Support selecting images based on phase in simple FIT
At present the simple FIT-loader always loads images, ignoring whether
they are intended for the next phase or not.

VBE packages up several images in the same FIT, some destined for VPL
and some for SPL. Add logic to check the phase before loading the
image. Return -EPERM in that case and handle it gracefully.

Fix a unnecessary re-computation of read_offset while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
a3869773e2 spl: Avoid including hash algorithms which are not wanted
Update the build rule so that hash algorithms are only included in an
SPL build if they are requested. This helps to reduce code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-02-06 23:49:28 +00:00
Simon Glass
8425fce8c0 spl: Adjust debugging and xPL symbols
The size of some malloc() fields has reduced on 64-bit machines, but
the spl_reloc code was not updated. Fix this to avoid a compiler
warning.

Also update for the new xPL naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-02-06 23:49:28 +00:00
Simon Glass
29be4c0a8e lib: Allow crc16 code to be dropped
This code is not necessarily needed in VPL, even if SPL uses it, so
adjust the rules to allow it to be dropped.

Do the same for the hash API.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-02-06 23:49:28 +00:00
Simon Glass
eb977c14c6 mmc: Allow controlling DM_MMC for VPL builds
VPL may want to use driver model for MMC even if TPL does not. Update
the rule in this driver to support that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-02-06 23:49:28 +00:00
Simon Glass
5efeb0e5cf sandbox: Update sandbox_vpl to select sha1 and sha256
These algorithms are used in VPL, so enable them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
5a23db792b mbedtls: Add SHA symbols for VPL
Add some symbols for supporting SHA1 etc. for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 23:49:28 +00:00
Simon Glass
b2adf3eeda Merge branch 'ci-concur' into 'master'
CI: Improve concurrent operation

See merge request u-boot/u-boot!35
2025-02-06 23:34:24 +00:00
Simon Glass
61b7fbe50b CI: Use different git-directories for concurrent runners
When running multiple runners on the same machine, each git repo should
be in its own place to avoid them interfering with either other.

Link to docs:

https://docs.gitlab.com/ee/ci/runners/configure_runners.html#custom-build-directories

Series-to: u-boot
Series-cc: trini
Series-version: 2
Series-links: 442655
Series-changes: 3
- Use GIT_CLONE_PATH instead

Series-changes: 2
- Put this under the global 'default' part
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 15:34:47 -07:00
Simon Glass
83edc63da1 CI: Move default image under global defaults
This is a global default, so put it under 'default' like the tags.

Series-changes: 2
- Add new patch to move default image under global defaults

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
2025-02-06 09:05:36 -07:00
Simon Glass
035985731c Merge branch 'ci' into 'master'
gitlab: Add a Zynq Zybo to the sjg lab

See merge request u-boot/u-boot!33
2025-02-06 14:11:03 +00:00
Simon Glass
cba43bf2d0 gitlab: Add a Zynq Zybo to the sjg lab
With help from Michal Simek I have this running with Labgrid now, so
add it to the lab.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-06 06:10:49 -07:00
Simon Glass
d78df1b3ca Merge branch 'ci' into 'master'
rockchip: Add more space below the stack pointer with kevin

See merge request u-boot/u-boot!32
2025-02-05 18:59:15 +00:00
Simon Glass
309ea3d58a rockchip: Add more space below the stack pointer with kevin
Move this up higher on kevin and bob so we can accommodate a larger
U-Boot, e.g. with debugging info enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-05 08:36:09 -07:00
Simon Glass
4c5855fdb0 Merge branch 'ci' into 'master'
gitlab: Add an rpi5 to the sjg lab

See merge request u-boot/u-boot!31
2025-02-03 12:49:09 +00:00
Simon Glass
8f4b447b2d gitlab: Add an rpi5 to the sjg lab
I have one of these 2GB boards with Ubuntu 24.10 loaded. Add an entry
for it so that it can be used for testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-03 05:46:36 -07:00
Simon Glass
ab30e912c6 Merge branch 'ci' into 'master'
efi: implement EFISTUB support for ARM64 and Qualcomm

See merge request u-boot/u-boot!30
2025-02-03 12:45:00 +00:00
Caleb Connolly
de6dd73b4e efi: stub: add known memory to U-Boot's EFI memory map
When running U-Boot as an EFI payload with CONFIG_EFI_STUB, the reserved
regions from the previous stage EFI bootloader should be carried over
since they may not fully align with the reserved-memory regions in
devicetree.

Implement a helper to map these pages when the EFI subsystem starts up.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-02-03 04:46:46 -07:00
Caleb Connolly
8cb8d63b43 efi: stub: log EFI memory banks
Add a debug log for these since its often useful to inspect the memory
map from the EFI we're jumping from.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-02-03 04:46:46 -07:00
Caleb Connolly
cef0312def efi: stub: add additional types of memory
U-Boot itself might be mapped as LOADER_CODE, there's also no reason not
to make additional pages accessible to the OS. This fixes an issue where
U-Boot can't run EFI apps because it gets relocated somewhere outside of
its own memory map.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-02-03 04:46:46 -07:00
Caleb Connolly
d9d2b8fb71 efi: stub: add helpers to populate memory map and framebuffer
Introduce two new helpers dram_init_banksize_from_efi() and
of_populate_from_efi(). These populate the DRAM bank info and simplefb
framebuffer OF node respectively using the EFI table populated by the
EFI stub.

dram_init_banksize_from_efi() is directly moved from the x86 payload
code to make it available for other boards.

Populating the simplefb node allows for an easy way to bring up video
without the full heft of VIDEO_EFI which is not particularly well-suited
to ARM.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Avoid changing the devicetree with the EFI app; fix build error on x86:
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:46:45 -07:00
Caleb Connolly
630cb84000 efi: move efi_info_get() to a new header file
Split out the EFI stub specific code to a new efi_stub.h header file.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
e0a8bf6f45 efi: stub: support running U-Boot as an EFI payload on ARM64
Implement support for launching U-Boot via an EFI stub app on ARM64.

This is more or less a straight port of the x86 implementation, but due
to the highly x86/qemu specific nature of that implementation I decided
to just split it out to its own file.

Unlike the x86 implementation, there is no debug UART here since ARM
platforms don't have a standard UART interface. However it is usually
possible to port over the debug uart implementation for you platform for
bringup purposes.

Currently this implementation doesn't provide a DTB to U-Boot and
expects U-Boot to use a built-in one, however this ought to be a fairly
trivial addition in the future.

The other significant difference to the x86 version is that rather than
copying U-Boot to CONFIG_TEXT_OFFSET, we require that U-Boot is built
position independent and copy it to EFI allocated memory.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
88e332d707 cmd: efi: avoid unitialized read
The key variable might be unitialised when accessed for the printf().
Zero initialise it to avoid this.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
9cb4de8983 qcom_defconfig: enable QCOM_SMEM
Used to parse memory layout in some situations.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
c0d987a4b3 mach-snapdragon: fetch serial# from SMEM
If available, otherwise fall back to cmdline.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
4842f98041 mach-snapdragon: support parsing memory map from SMEM
It is possible to derive the memory map for a Qualcomm platform from the
SMEM shared memory region. The memory map is populated by the preloader.

Introduce support for parsing this data and using it to populate
U-Boot's memory map. Since we aren't yet sure if this will work for
every platform, it is not yet used in all cases, if U-Boot is booted
with an internal FDT which has the memory map defined, this will
be used instead.

If the FDT comes from ABL, or we're using an internal FDT with no memory
map defined, then U-Boot will try to use SMEM. This should remove the
need to define the memory map statically in a U-Boot overlay DT for most
boards.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
a7e1d6d276 mach-snapdragon: move memory parsing to its own file
This code is getting a bit complicated, split it out to try and keep
things a bit better organised as we're going to be supporting populating
the memory layout from various other sources.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
0e64489e08 mach-snapdragon: increase pre-relocation malloc size for smem
Ensure we have enough space to init smem prior to relocation, since we
might parse the DDR bank layout from there.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
ab606d987b soc: qcom: smem: add build infra
Build the new SMEM driver port, and select it when ARCH_SNAPDRAGON is
selected, since it will be a hard dependency for Qualcomm platforms.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:48 -07:00
Caleb Connolly
17af3e9e83 soc: qcom: smem: stub functions
Allow smem to be optional for Qualcomm platforms by providing stub
functions.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add remaining stub functions and use static inline:
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-03 04:43:46 -07:00
Caleb Connolly
9f333e1708 soc: qcom: smem: get serial number from socinfo
Implement socinfo support to fetch the serial number if available.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
efc20ac01f soc: qcom: smem: adjust for U-Boot
Port over the smem code to U-Boot and remove socinfo.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
6408b9a629 soc: qcom: smem: adjust headers for U-Boot
Drop Linux headers for the U-Boot ones.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
252a93301a soc: qcom: import smem from Linux 6.11-rc2
Import the SMEM driver from Linux.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
513edfc585 Revert "drivers: smem: sandbox"
This reverts commit 7fd7e2cf33.
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
3bcbdcddf7 Revert "test: smem: add basic smem test"
This reverts commit 20e7705764.
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:33 -07:00
Caleb Connolly
e0a97d59aa smem: drop drivers/smem
Remove the old qcom SMEM driver port and the sandbox stub
implementation.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:32 -07:00
Caleb Connolly
92bf7d08c6 Revert "dm: SMEM (Shared memory) uclass"
SMEM is a highly Qualcomm specific interface, while having a dedicated
UCLASS for it offers a nice abstraction, for things like memory layout
parsing we need to use it before the driver model is available.

Therefore, it doesn't make sense to fit SMEM into the driver model.
Instead let's adopt a model closer to Linux, and parse SMEM really early
during boot (as soon as we have the FDT).

This reverts commit 7b384eccc7.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-31 06:10:32 -07:00
Simon Glass
688cfa7ba9 Merge branch 'ci' into 'master'
efi_loader: Complete the bootflow_efi() test

See merge request u-boot/u-boot!29
2025-01-30 20:41:30 +00:00
Simon Glass
65091e5d24 efi_loader: Test that active-DMA devices are removed
When exit-boot-services is called, active devices should be removed.

Update testapp to call this method and check that the USB controller is
removed as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:19 -07:00
Simon Glass
6472fd0733 efi_loader: Check that the bootflow is not removed by app
The bootflow should not be affected by the app running and returning.
Add a check that it is still valid after the app completes execution.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:19 -07:00
Simon Glass
b5cd469c34 efi_loader: Update testapp to get memory map correctly
Allocate enough memory for the memory map so that it can be received
successfully.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:19 -07:00
Simon Glass
24f65a85c7 efi_loader: Check memory allocations in bootflow_efi test()
Add checks that all memory allocations complete successfully and that
only expected parameters are provided. Check that memory addresses are
within range.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:19 -07:00
Simon Glass
911b75d77d efi_loader: Correct bounce-buffer setup
This should set the bounce buffer to a pointer, not an address. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:19 -07:00
Simon Glass
c0bc39f924 efi_loader: Return the memory map in pointer format
An EFI app expects pointers to be returned, cast to u64. The conversion
to use addresses missed this, so fix the call.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-30 13:05:18 -07:00