Commit graph

12 commits

Author SHA1 Message Date
Heinrich Schuchardt
e9c34fab18 efi_loader: use LOGC_EFI consistently
The log category should be LOGC_EFI all over the EFI sub-system.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-01-26 11:06:56 +01:00
Simon Glass
cfb4aa2a75 efi_loader: Avoid mapping the ACPI tables twice
The add_u_boot_and_runtime() function paints with a broad brush,
considering all of the memory from the top of U-Boot stack to
gd->ram_top as EFI_RUNTIME_SERVICES_CODE

This is fine, but we need to make sure we don't add a separate entry for
any ACPI tables in this region (which happens when bloblist is used for
tables). Otherwise the memory map looks strange and we get a test
failure on qemu-x86 (only) for the 'virtual address map' test.

Good map:

   Type             Start            End              Attributes
   ================ ================ ================ ==========
   CONVENTIONAL     0000000000000000-00000000000a0000 WB
   RESERVED         00000000000a0000-00000000000f0000 WB
   RUNTIME DATA     00000000000f0000-00000000000f2000 WB|RT
   RESERVED         00000000000f2000-0000000000100000 WB
   CONVENTIONAL     0000000000100000-0000000005cc7000 WB
   BOOT DATA        0000000005cc7000-0000000005ccc000 WB
   RUNTIME DATA     0000000005ccc000-0000000005ccd000 WB|RT
   BOOT DATA        0000000005ccd000-0000000005cce000 WB
   RUNTIME DATA     0000000005cce000-0000000005cf0000 WB|RT
   BOOT DATA        0000000005cf0000-0000000006cf5000 WB
   RESERVED         0000000006cf5000-0000000006cfa000 WB
   ACPI RECLAIM MEM 0000000006cfa000-0000000006d1c000 WB
   RESERVED         0000000006d1c000-0000000006f35000 WB
   RUNTIME CODE     0000000006f35000-0000000006f37000 WB|RT
   RESERVED         0000000006f37000-0000000008000000 WB
   RESERVED         00000000e0000000-00000000f0000000 WB

Bad map: (with BLOBLIST_TABLES but without this patch):

   Type             Start            End              Attributes
   ================ ================ ================ ==========
   CONVENTIONAL     0000000000000000-00000000000a0000 WB
   RESERVED         00000000000a0000-00000000000f0000 WB
   ACPI RECLAIM MEM 00000000000f0000-00000000000f1000 WB
   RESERVED         00000000000f1000-0000000000100000 WB
   CONVENTIONAL     0000000000100000-0000000005ca5000 WB
   BOOT DATA        0000000005ca5000-0000000005caa000 WB
   RUNTIME DATA     0000000005caa000-0000000005cab000 WB|RT
   BOOT DATA        0000000005cab000-0000000005cac000 WB
   RUNTIME DATA     0000000005cac000-0000000005cce000 WB|RT
   BOOT DATA        0000000005cce000-0000000006cd3000 WB
   RUNTIME DATA     0000000006cd3000-0000000006cd5000 WB|RT
   BOOT DATA        0000000006cd5000-0000000006cf4000 WB
   RESERVED         0000000006cf4000-0000000006cf9000 WB
   ACPI RECLAIM MEM 0000000006cf9000-0000000006ce6000 WB

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22 17:08:23 -06:00
Heinrich Schuchardt
8d7ccea1c3 efi_loader: 'EFI using ACPI tables at' should be debug message
The message "EFI using ACPI tables at %lx\n" is only of interest when
debugging. Make it a debug message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-13 11:03:12 +02:00
Tom Rini
c38cb227d3 efi_loader: Remove <common.h>
We largely do not need <common.h> in these files, so drop it. The only
exception here is that efi_freestanding.c needs <linux/types.h> and had
been getting that via <common.h>.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21 08:54:37 -05:00
Simon Glass
085f8db6b9 efi: Use the installed ACPI tables
U-Boot sets up the ACPI tables during startup. Rather than creating a
new set, install the existing ones. Create a memory-map record to cover
the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-17 17:23:15 +08:00
Simon Glass
a9e414dd50 efi: Correct address handling with ACPI tables
The current EFI implementation confuses pointers and addresses. Normally
we can get away with this but in the case of sandbox it causes failures.

Despite the fact that efi_allocate_pages() returns a u64, it is actually
a pointer, not an address. Add special handling to avoid a crash when
running 'bootefi hello'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25 11:44:36 -07:00
Simon Glass
47642428ee efi: Correct call to write_acpi_tables()
This must be passed a ulong, not a u64. Fix it to avoid LTO warnings on
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25 11:44:36 -07:00
Heinrich Schuchardt
185f812c41 doc: replace @return by Return:
Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-19 18:11:34 +01:00
Heinrich Schuchardt
992b1731e6 efi_loader: ACPI tables must be in EfiACPIReclaimMemory
The UEFI spec does not allow ACPI tables to be in runtime services memory.
It recommends EfiACPIReclaimMemory.

Remove a superfluous check that the allocated pages are 16 byte aligned.
EFI pages are 4 KiB aligned.

Fixes: 86df34d42b ("efi_loader: Install ACPI configuration tables")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-02-26 16:17:43 +01:00
Simon Glass
f7ae49fc4f common: Drop log.h from common header
Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 21:19:18 -04:00
Simon Glass
776cc20194 x86: Move acpi_table header to main include/ directory
This file is potentially useful to other architectures saddled with ACPI
so move most of its contents to a common location.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2020-04-16 14:36:28 +08:00
Bin Meng
86df34d42b efi_loader: Install ACPI configuration tables
ACPI tables can be passed via EFI configuration table to an EFI
application. This is only supported on x86 so far.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-02 09:23:28 +08:00