8 Commits

Author SHA1 Message Date
Simon Glass
7477fe4d9b efi: Allow excluding efi_main()
In some cases this function may be provided outside the library, e.g. by
a Rust main program. Add a Kconfig to control this and refactor the code
so that it is optional.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
eb85d76a42 efi: Provide a way to sync EFI reserved-memory to fdt
When booting Linux with EFI the devicetree memory-map is ignored and
Linux calls through EFI to obtain the real memory map.

When booting Linux from the EFI app, without EFI, we must pass the
reserved memory onto Linux using the devicetree.

Add a function to support this. It reads the EFI memory-map and adds any
missing regions to the reserved-memory node.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 07:00:55 -06:00
Simon Glass
28b512bad3 efi_client: Support running an app
Add support for running another app from with the EFI app. This can be
used to boot an OS, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:59:11 -06:00
Simon Glass
61844e4076 efi: Drop information about removing C flags
A 'removing flags -mregparm=3' message appears when building sometimes.
It isn't very useful and does not indicate a problem, so remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-23 20:19:42 -06:00
Simon Glass
d43aab19fb efi: Create a common file for the stub
There is some duplicated code across x86 and ARM even though they have
slightly different implementations.

They both call efi_stub_exit_boot_services() and this function does not
relate to the app, so belongs better outside the general-purpose efi.c
file.

Create a new efi_stub C file containing this function. Leave out the
efi_ prefix since this is obvious from the directory name.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:26:34 -06:00
Simon Glass
0b00c34e7c efi: Drop the efi_ prefix on the arch-specific stub files
These are already in the lib/efi/ directory so the extra efi_ prefix is
redundant and makes files harder to find. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:26:34 -06:00
Simon Glass
cf4fc6dd9a efi: Rename efi_stub.o Makefile variable
This variable is a bit confusing as it looks like a filename. Use
stub_obj instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:26:34 -06:00
Simon Glass
5f4327ec9f efi: Rename the lib/efi directory
This directory was created when U-Boot gained the ability to run as an
EFI app in 2015. Since then the EFI-loader feature has been added.

The code in lib/efi is not actually used by the loader, so the name is
confusing.

Rename the directory to efi_client to indicate that it includes files
just for U-Boot being a client of EFI, i.e. the EFI app and stub.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-28 08:02:11 +01:00