Commit Graph

97276 Commits

Author SHA1 Message Date
Simon Glass
4a03fbc8bb boot: Add missing code for bootz_run()
The bootz method is special in that it uses its own implementation of
several of the bootm states.

The existing do_bootz() function calls bootz_run() but first does a few
other things. These are missing in the direct call to bootz_run(). I
probably missed this because bootz_start() sets up its own
struct bootm_info so I assumed it was independent. While the struct
itself is independent, changes to the images member (which is a pointer)
persist.

Move the required code into bootz_run()

This change was manually tested on an rpi2 with postmarketOS added,
using standard boot and also the 'bootz' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 47eda7e80e ("boot: pxe: Use bootm_...() functions where possible")
Reported-by: Svyatoslav Ryhel <clamor95@gmail.com>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895
2025-04-18 05:02:56 -06:00
Simon Glass
5841e78ed6 Merge branch 'ci' into 'master'
bloblist: Drop BSD license

See merge request u-boot/u-boot!59
2025-04-17 15:55:40 +00:00
Simon Glass
8fa2f3610d bloblist: Drop BSD license
Linaro has decided to write their own version of bloblist from scratch,
so there is no point in having a non-GPL license on this file. Change
it, to better fit with the U-Boot project.

Signed-off-by: Simon Glass <sjg@chromium.org>
Link: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/22215
Acked-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-17 09:54:26 -06:00
Simon Glass
ea9e72801c Merge branch 'ci' into 'master'
Merge patch series "vepxpress64: disable CRC32 by default and add FVP with TF-A guide"

See merge request u-boot/u-boot!58
2025-04-08 21:36:27 +00:00
Harrison Mutai
796206b5ac board: vexpress64: enable bloblist for SPL handoff
Enable bloblist on vexpress64 platforms to facilitate information
passing from TF-A using the firmware handoff framework.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2025-04-08 14:55:13 -06:00
Harrison Mutai
1c56f6babc bloblist: add support for CONFIG_BLOBLIST_PASSAGE
When the configuration option CONFIG_BLOBLIST_PASSAGE is selected, the
bloblist present in the incoming standard passage is utilised in-place.
There is no need to specify the size of the bloblist as the system
automatically detects it using the header information.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2025-04-08 14:55:08 -06:00
Harrison Mutai
62ba2d48dd board: vexpress64: default to hardware device tree
When booting into the Linux kernel with semi-hosting, use the device
tree provided by hardware unless one is provided in the current
directory.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2025-04-08 14:55:04 -06:00
Harrison Mutai
7b94a32be2 bloblist: fix typo in code comments
Fix the two typos in the spelling of same and set in common/Kconfig and
include/bloblist.h.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2025-04-08 14:54:55 -06:00
Simon Glass
9e7b8db24d efi: Tidy up nits in the ARM64 EFI app
This patches tidies up a few things in the recently added EFI app for
ARM:

- Use 0 as the value for SYS_LOAD_ADDR
- Reword help for TARGET_EFI_ARM_APP64
- Do the same for x86-app targets, for consistency
- Delete efi-arm_app32 MAINTAINERS entry since there is no such thing

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Caleb Connolly <caleb.connolly@linaro.org>
2025-04-08 14:52:28 -06:00
Simon Glass
d47b5693e2 Merge branch 'ci' into 'master'
patman: Show base commit on each patch when no cover letter

See merge request u-boot/u-boot!57
2025-04-05 23:08:25 +00:00
Simon Glass
811fcc0738 patman: Show base commit on each patch when no cover letter
If a series is sent without a cover letter, there is no indication of
the base commit. Add support for this, since single patches of small
series may not always have a cover letter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-06 10:13:58 +12:00
Simon Glass
3f76d803db Merge branch 'ci' into 'master'
xPL-stack cleanup

See merge request u-boot/u-boot!56
2025-03-28 15:34:02 +00:00
Simon Glass
d07049b9f2 arm: Support a separate stack for VPL
VPL has the same needs as TPL in situations where the stack is at the
top of SRAM. Add an option for this and implement it for arm

Series-changes: 2
- Reply on existing CONFIG_VAL() to select the VPL stack
- Correct reference to TPL when VPL was intended

Series-changes: 3
- Use 'phase' instead of 'stage' in VPL_STACK
- Split off into its own 'vbh' series

Series-to: u-boot
Series-version: 3
Series-cc: jonas
Cover-letter:
xPL-stack cleanup
This series was split from the VBE part H series. It adjusts the logic
for selecting the top of the stack so that it is more consistent across
xPL phases.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-28 08:11:36 -06:00
Simon Glass
abfff044f2 spl: Use CONFIG_VAL() to obtain the SPL stack
Now that we have the same option for SPL and TPL, simplify the logic for
determining the initial stack.

Note that this changes behaviour as current SPL_STACK is a fallback for
TPL. However, that was likely unintended and can be handled with Kconfig
defaults if needed.

Series-changes: 2
- Add new patch to use CONFIG_VAL() to obtain the SPL stack

Series-changes: 3
- Fixed 'VPL' typo
- Update commit message to mention the behaviour change
- Update TPL_HAVE_INIT_STACK to drop the SPL fallback

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Suggested-by: Tom Rini <trini@konsulko.com>
2025-03-28 08:11:34 -06:00
Simon Glass
7a032a125f spl: Add an SPL_HAVE_INIT_STACK option
At present there is a hex value SPL_STACK which both determines whether
SPL has its own initial stack and the hex value of that stack.

Split off the former into SPL_HAVE_INIT_STACK with SPL_STACK depending
on that and only providing the latter.

Series-changes: 2
- Add new patch with an SPL_HAVE_INIT_STACK option

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-28 08:11:33 -06:00
Simon Glass
8d319b2201 tpl: Rename TPL_NEEDS_SEPARATE_STACK to TPL_HAVE_INIT_STACK
The most common word for features that make a platform work is to use
'HAVE_xxx'. Rename this option to match.

Update the help to use the word 'phase' rather than 'stage', since
that is the current terminology. Also clarify that, absent this setting,
the stack pointer generally comes from the value used by U-Boot proper,
rather than SPL.

Move the option just above TPL_STACK which depends on it.

Series-changes: 2
- Add new patch to rename TPL_NEEDS_SEPARATE_STACK

Series-changes: 3
- Reword the Kconfig help for TPL_HAVE_INIT_STACK

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-28 08:11:32 -06:00
Simon Glass
794124b325 Merge branch 'ci' into 'master'
arm: Support building as an EFI app

See merge request u-boot/u-boot!55
2025-03-27 13:37:10 +00:00
Simon Glass
eea87b0b3a scripts: Update build-efi to support arm64
Provide a -A flag to select ARM instead of x86. For now, only the app
is supported and only for 64-bit ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:35:34 -06:00
Simon Glass
483d409aa3 efi: arm: Add an EFI app for arm64
Introduce an EFI app for arm64 and update the documentation.

Provide a value for LOAD_ADDR to avoid a link error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
7fa6a68131 efi: arm: Simplify the crt0 file and update link script
We don't need to manually add the PE header, since binutils has support
for this now. Remove it to simplify the file.

Set the link-target to efi-app-aarch64 so that binutils knows what to
do. Add rules to pick up the arm64 files.

Make some updates to the link-script for arm64, so this all works:

- Pass  .hash .eh_frame and .reloc sections through to objcopy
- Put RELA pieces into a single section
- Put linker lists into .data
- Embed the dtb

Add a config.mk fragment into the baord directory.

Note that it does not seem to be possible to use this approach with
32-bit ARM, so this is left alone.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
a615863003 efi: arm: Use EFI flags for all compilation with the app
As opposed to the payload, which is built normally with just an EFI
stub, the app is build homogenously using EFI flags. Update
PLATFORM_CPPFLAGS to enable this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
d95743158f efi: arm: Disable STATIC_RELA for the EFI app
This feature should not be used with the app, since we don't know where
U-Boot will be loaded. Disable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
eb82ca7cbe efi: Generate the app as a shared library
The app should be built as a shared library, with position-independent
code and the -shared flags. Update the Makefile to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
a248c4b40e efi: arm: Provide startup and relocation code
Build in the EFI-app startup code as well as the code to relocate U-Boot
to the loaded position, since this is under the control of the previous
firmware.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
0a306683b5 efi: arm: Adjust how the monitor length is calculated
Adjust the conditions to support the EFI app when running on ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
1c52fa6278 efi: arm: Drop startup code from the app
The EFI app uses different startup and relocation code and the existing
code uses symbols not present in the app. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
4448cb0e18 efi: arm: Disable --gc-sections for the app
This option cannot be used with a shared library, since it results in
everything being removed. Disable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
f4fdb3a8be efi: arm: x86: Allow use of the EFI table in the app
It isn't worth the hassle of omitting this field for the app, since code
is shared between the payload and the app. Adjust the condition to avoid
a build error in the 'efi' command with the app on 64-bit ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
78c4c1d17e efi: arm: Drop exception-level code when running as EFI app
The switch_to_non_secure_mode() function cannot be used since EFI is in
charge of managing exception-levels.

Build just the exceptions.S file.

Modify the existing SPL rule to cater to the EFI app too.

This is quite confusing, so add an issue to clean this up:

https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/36

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
fd36a7e9e4 efi: arm: Omit the ARM start-up code in the EFI app
This code is not used with the EFI app, since it enters through a call
to efi_main(). Remove start.S and crt files from the build.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
d6ba90af9c efi: arm: Implement access to global_data for EFI
The EFI app likes to use a simple variable for global data. Implement
this for ARM (for use only with 64-bit ARM at present).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
a568a92ec6 efi: arm: Avoid enabling caches when running under EFI
The previous bootloader has already set up the cache, so don't try to do
it again.

This fixes a crash in QEMU when booting from EDK2

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
399d95ca99 efi: arm: Avoid allocating page tables when running under EFI
The previous bootloader has already set up the page tables, so don't try
to do it again.

This fixes a crash in QEMU when booting from EDK2

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
571fce8e30 efi: arm: Don't do the EL2 switch when running under EFI
The previous bootloader has likely done this already, so avoid trying to
do it again. This fixes a crash in QEMU when booting from EDK2

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
b189537d79 efi: lmb: Avoid access to _start
The app does not have this symbol. Also the memory where the app is
loaded is not under U-Boot's control.

There is no sense in relocating from one alloced region to another.
U-Boot is not able to relocate to the top of memory, nor decide what
other parts of memory are used for.

For these reasons, the EFI app skips relocation. It is not running at
the address pointed to by the _start symbol.

So disable this reservation for the EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
871ef532c8 efi: Rename ImageBase to image_base
It is confusing to have a camel-case indentifier in the these files.
Rename them to fit with U-Boot's snake-case style.

The image_base symbol is already used in the x86 link-scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
63c52892ec efi: Tidy up setup of global_data
Use the available functions for setting and getting the global_data
pointer so that EFI-startup can operate on 64-bit ARM as well as x86.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
255a0f2165 efi: x86: Allow setting the global_data pointer with EFI
Provide a function which sets this pointer, for use in the EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
ab351a6c58 efi: x86: Rework VENDOR_EFI option to permit other archs
At present only x86 supports the EFI app and (apart from Qualcomm) the
payload. In preparation for supporting 64-bit ARM more generally, rename
the existing ARCH_EFI option to ARCH_EFI_X86, using that to define a
generic ARCH_EFI which will be enabled for all architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
711542d2c6 treewide: Rename VENDOR_EFI to ARCH_EFI
The 'vendor' concept comes from arch/x86. Rather than letting this
spread around the tree, rename it to ARCH_EFI.

While EFI is not quite an architecture in the strict sense, it is
similar to sandbox in that it sits somewhat above the CPU architecture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
97b1f411a8 efi: x86: Move EFI SDRAM-handling into a common file
This code is not actually x86-specific, so move it into the lib/efi dir
where other archs can use it.

Drop inclusion of the unnecessary x86-specific header.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
a95cdd3559 efi: Allow board/efi Kconfig to be used outside x86
So far only x86 supports the EFI app. ARM is going the same way, so
allow these options to be enabled for 64-bit ARM too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
88065731df efi: Rename app and payload to include x86
Since we plan to support the EFI app and payload on 64-bit ARM too,
rename the x86 target.

Adjust the Kconfig rules to allow non-x86 builds to be added.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
8d62f11990 lib: Provide fdtdec_get_pci_bar32() only with PCI enabled
This function calls dm_pci_read_bar32() which is only available if PCI
is enabled. Add this condition here too, so that the EFI app can build
without needing --gc-sections

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:31:43 -06:00
Simon Glass
2eaf5b3b51 video: Use a local mode_info struct in the EFI driver
There is no need to use the global struct provided by PCI. Declare a
local structure instead, so this can be used on ARM without including
support for PCI ROMs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
219a52d7fa video: Move vesa_setup_video_priv() into its own file
This helper is used by the EFI driver and we would like to use that on
ARM. Move the helper function into its own file, separate from PCI ROMs,
which are an x86 thing.

Add a forward declaration for struct udevice so that the header can be
included directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:31:43 -06:00
Simon Glass
06b75366ac Makefile: Avoid using TEXT_BASE with the EFI APP
This value is not available with the EFI app. Add a condition to avoid
introducing errors when linking.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-03-27 05:28:53 -06:00
Simon Glass
b20fefc5aa Merge branch 'ci' into 'master'
u_boot_pylib pylint warnings and ACPI bloblist fix

See merge request u-boot/u-boot!54
2025-03-16 08:17:41 +00:00
Simon Glass
1c5afd613f efi_loader: Install the ACPI table from the bloblist
When BLOBLIST_TABLES is used, the ACPI tables are not currently added to
the list of EFI tables. While we don't want to create a new memory
region, we do want to tell EFI about the tables.

Fix this by covering this case. At some point the non-bloblist code can
likely be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 3da59ee957 ("efi_loader: Avoid mapping the ACPI tables twice")
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2025-03-15 15:47:34 +00:00
Raymond Mao
2bfd7b1365 tpm: get tpm event log from bloblist
Get tpm event log from bloblist instead of FDT when bloblist is
enabled and valid from previous boot stage.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-03-15 15:47:34 +00:00