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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>