The EFI app will eventually execute binaries, but it does not enable
the CONFIG_EFI_LOADER option. So move the option to a common directory.
Signed-off-by: Simon Glass <sjg@chromium.org>
efi_binary_run_dp() calls efi_init_obj_list() which is specific to the
EFI loader. Move this into a new file within lib/efi_loader
Similarly, move efi_run_image() since the app will need a different
implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Move this function and some dependencies into the lib/efi directory so
that it can be used by the app, which does not enable CONFIG_EFI_LOADER
Since the networking has an #ifdef add CONFIG_EFI_LOADER to it, since
the definitions are in efi_loader.h for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Most of these utility functions are useful for the app, so move them
into the common directory.
Move the GUIDs used by this file from their various other location, so
they are available to the app, even if it doesn't enabled EFI_LOADER
Fix the rather large number of checkpath warnings in this file, except
for the lwip one, best left to the maintainer to sort out.
One noteable change is adding a return value to dp_fill() for the case
where an option is not enabled but its uclass is referenced. This
presuambly never happens during execution, since if the uclass is not
supported there can be no device in that uclass and therefore nothing
will ever request its path. So just handle this like an invalid device.
Signed-off-by: Simon Glass <sjg@chromium.org>
This function calculates the parent size in many places and does the
same addition in most cases. Create a variable for the parent_size and
another for the size, so we can do the addition once at the end.
The uclass array is too sparse to consider an array.
Signed-off-by: Simon Glass <sjg@chromium.org>
The device-path code requires memory allocation. Provide an
implementation of these for use by the client.
Note that this will not work for the stub, since in that case it needs
to use U-Boot's memory allocation. This was a subject of a long argument
on the mailing list about U-Boot using its own malloc() where possible,
so it seems best to just leave this broken.
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
Move disabling of interrupts to bootm_final() so it is done for bootm
and EFI boot paths. Drop the now-duplicate calls.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add this call to the bootm_final() function, dropping it from RISC-V
Add a flag to ensure that cleanup_before_linux() is not called when
booting an EFI app.
Signed-off-by: Simon Glass <sjg@chromium.org>
This work-around dates from 2019 and grub 2.04 which is quite old. New
builds of grub don't have the problem and old boards presumably use an
older U-Boot, so don't need this.
Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Make use of this function, adding some pieces needed by RISC-V
Drop the udc_disconnect() from EFI_LOADER since it is now done in
bootm_final()
Signed-off-by: Simon Glass <sjg@chromium.org>
EFI has a Boot Graphics Record Table which can be used to show a logo
when booting up and shutting down.
Add support for adding this to the image, using a U-Boot logo which
includes the name, since many people will be unfamiliar with the logo.
Signed-off-by: Simon Glass <sjg@chromium.org>
For QEMU we want to add new tables to the end of what QEMU provides. Add
a function to find the correct place for a new table.
Add a function to support this.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present acpi_find_table() support locating most of the tables, but
not these two, since they are the pointers to the rest.
When adding new tables, these tables need to be located and updated, so
update acpi_find_table() to allow searching for them.
Signed-off-by: Simon Glass <sjg@chromium.org>
The acpi_table.c file includes ACPI_WRITER() declarations and is only
included in the build if CONFIG_ACPIGEN is enabled.
For QEMU we want to augment the tables provided via qfw, but
CONFIG_ACPIGEN is not enabled.
Move the core functions out to the acpi.c file which is included in all
x86 builds. This allows the QEMU build to make use of these functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
The start of this function determines whether xdst or rdsp is used for
locating tables. Move it into a separate function so that we can use
this logic elsewhere.
Signed-off-by: Simon Glass <sjg@chromium.org>
The RSP is not valid unless the checksums are corrrect, so add a test
for this.
Add a few blank lines for readability while here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Create a function for this checksumming, since it is not trivial. This
will allow the code to be shared with tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
There is no guarantee that the RNG device has a sequence number of zero.
Use the first available device instead, by default.
This resolved a failure to find the device with qemu-x86_64 when the
virtio device is used.
Signed-off-by: Simon Glass <sjg@chromium.org>
On 64-bit machines we don't always want to show 16 hex digits,
particularly if the value is 32-bit. Add a new function to show a 32-bit
value.
Signed-off-by: Simon Glass <sjg@chromium.org>
The bdinfo command makes use of quite a few functions which show a label
followed by a value, on a single line.
This sort of thing is generally useful outside of bdinfo, so move it to
a generic place. Use 'l' (for label) as the prefix.
The margin is still hard-coded to 12, which seems a reasonable limit for
a label.
Signed-off-by: Simon Glass <sjg@chromium.org>
Define MACH_QEMU whenever ARCH_QEMU_ARM is used.
Some of the uses of ARCH_QEMU_ARM with efi_loader should clearly apply
to all QEMU variables, so update these.
Signed-off-by: Simon Glass <sjg@chromium.org>
Now that the stub code is unified, switch over to it, dropping the
individual efi_main() functions.
Series-to: concept
Cover-letter:
efi: Unify the scripts and start-up code
We have two scripts which run QEMU, one for EFI and one for bare metal.
They have similar options so it seems reasonable to try to unify them a
bit. This series creates a common file and adjusts arguments so they are
consistent across both scripts.
The EFI app for ARM and x86 have different start-up code but in fact
the code is quiet similar. This series creates a new common main
program, called efi_main_common() which is used for both architectures.
The small number of differences are handled in arch-specific code.
END
Fill in the required helper functions and call efi_main_common() to
do everything else.
Delete the old efi_main() function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fill in the required helper functions and call efi_main_common() to
do everything else.
Delete the old efi_main() function.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present x86 and ARM have different implementations, but they are
similar enough that it is not too hard to unify them.
Create a new common function, with arch-specific pieces at the start
(setting up the address to which to copy U-Boot) and end (to jump to
U-Boot).
For now, nothing uses this code.
Signed-off-by: Simon Glass <sjg@chromium.org>
The x86 and ARM implementations use a different variable for the same
thing, just inverted.
Invent a third name for this, adjust both files to use it and store it
in the common stub.c file.
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
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>
Print a line that indicates if this is the app, to match the line shown
for the payload, i.e.:
Model: EFI x86 Application
or:
Model: EFI x86 Payload
or:
Model: EFI ARM Application
Drop CONFIG_DISPLAY_BOARDINFO_LATE as it is not needed.
Note that there is no (generic) stub for ARM.
Signed-off-by: Simon Glass <sjg@chromium.org>
This existing function does not have any context associated with it.
Rename it so that fs_read() can be used for the new FS uclass.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sandbox needs to include system headers in some files, but also wants
to use alist. Adjust the headers to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
This script has conflict markers in it so comes up as an unwanted match
when searching them. Remove the file since it is not used in U-Boot.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases it is convenient to provide an address when initing an
abuf, instead of a pointer. Add a function for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than a weak function, use the recently added event to adjust the
OS load-address. Tidy up the code a little while here.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases, we may wish to set up the TPM log under full control of
a driver in U-Boot. Export the required function to make this possible.
This avoids calling the weak function tcg2_platform_get_log() when the
caller already knows where the log is.
Series-to: u-boot
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:458273
Although GD_FLG_SKIP_RELOC is enabled for the app, the code for
relocation is still present in the image. Add a few dummy functions
needed on x86.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a Kconfig option to easily enable debugging of the app using the
recommended method. Provide some docs too.
Signed-off-by: Simon Glass <sjg@chromium.org>