mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
Pull request efi-2024-01-rc5
Documentation: * Update and correct support notes on clang * sandbox: Fix VPL instructions UEFI: * Fix a bug in DisconnectController * Provide better error messages for missing CONFIG_EFI_CAPSULE_ESL_FILE * Create EFI memory reservations when booting via ACPI * Make ACPI tables accessible in EFI app -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmVucn4ACgkQhO4vgnE3 U0uY5w/+L5qoWGW+iTe8JEMzL2KKDmWYn3faaz6UC6sXeziNRrn0noiAfXKT8r/h hL0oQZzVZ9McMAcmKUQnCrpdLV8YVuojURjcjKHPktjxIs3dunqKYea0dC3EIZ6K CBglRqBo9oghQgC6v+tEwEqVFTZnrxBRWZHW7Z7zJ/Tfdzm8adlWxqPdZg+MAZTj KjpRZWSiGCDA/h8ugritsx66qZ5HjBOYFGrXgeqmaaOwgKMB47IDVJQf0t4qcZK2 PMh1GrMuh6Km/cev/792Je/oF8MV0JtHBeLNuR8tOIyH/KQV7Kc/omQccxNRcQNM +wFWxZeKwNWOks3Ulmwk3REZL4I92PmDGCIIEW/lkLO2YJAtBLSKqQz4okGL1c8t zfgFVaPnBVKSlK9wobbEZkhHIFX4d3BBBx0IzM8nrdmk6KgWyGm4nzM6Aw9h8aIz pL8Mz65IYnppl1EAz3HwsU8XmYG3yTzMAa/AT9Ls1dEZ7qhRsIg9R9DeFxnJYVib Xjn0zgJmZ4skOxbK6CB7NvWp1YH2OIITgWe6w+JIEYVkQNn7gUqB+C+6FC6pD7Ql tPot0JhDtexnrW0Qial5q6gcGNeCknG5mZveNgKqHVr5A95K3aIb/5m3bUb/G2y9 QwIGymvvRR3fo5uOgCJLOIG99JBw24TIVC7CWQkm2OdLWCHnp7E= =VZPN -----END PGP SIGNATURE----- Merge tag 'efi-2024-01-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request efi-2024-01-rc5 Documentation: * Update and correct support notes on clang * sandbox: Fix VPL instructions UEFI: * Fix a bug in DisconnectController * Provide better error messages for missing CONFIG_EFI_CAPSULE_ESL_FILE * Create EFI memory reservations when booting via ACPI * Make ACPI tables accessible in EFI app
This commit is contained in:
commit
dd638467a4
9 changed files with 106 additions and 57 deletions
|
@ -162,8 +162,6 @@ static efi_status_t efi_env_set_load_options(efi_handle_t handle,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
|
||||
|
||||
/**
|
||||
* copy_fdt() - Copy the device tree to a new location available to EFI
|
||||
*
|
||||
|
@ -237,8 +235,6 @@ static void *get_config_table(const efi_guid_t *guid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
|
||||
|
||||
/**
|
||||
* efi_install_fdt() - install device tree
|
||||
*
|
||||
|
@ -258,18 +254,15 @@ static void *get_config_table(const efi_guid_t *guid)
|
|||
*/
|
||||
efi_status_t efi_install_fdt(void *fdt)
|
||||
{
|
||||
struct bootm_headers img = { 0 };
|
||||
efi_status_t ret;
|
||||
|
||||
/*
|
||||
* The EBBR spec requires that we have either an FDT or an ACPI table
|
||||
* but not both.
|
||||
*/
|
||||
#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
|
||||
if (fdt) {
|
||||
if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
|
||||
log_warning("WARNING: Can't have ACPI table and device tree - ignoring DT.\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#else
|
||||
struct bootm_headers img = { 0 };
|
||||
efi_status_t ret;
|
||||
|
||||
if (fdt == EFI_FDT_USE_INTERNAL) {
|
||||
const char *fdt_opt;
|
||||
|
@ -302,6 +295,12 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
/* Create memory reservations as indicated by the device tree */
|
||||
efi_carve_out_dt_rsv(fdt);
|
||||
|
||||
if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE))
|
||||
return EFI_SUCCESS;
|
||||
|
||||
/* Prepare device tree for payload */
|
||||
ret = copy_fdt(&fdt);
|
||||
if (ret) {
|
||||
|
@ -314,9 +313,6 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
/* Create memory reservations as indicated by the device tree */
|
||||
efi_carve_out_dt_rsv(fdt);
|
||||
|
||||
efi_try_purge_kaslr_seed(fdt);
|
||||
|
||||
if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
|
||||
|
@ -333,7 +329,6 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
log_err("ERROR: failed to install device tree\n");
|
||||
return ret;
|
||||
}
|
||||
#endif /* GENERATE_ACPI_TABLE */
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,8 @@ void efi_show_tables(struct efi_system_table *systab)
|
|||
|
||||
for (i = 0; i < systab->nr_tables; i++) {
|
||||
struct efi_configuration_table *tab = &systab->tables[i];
|
||||
char guid_str[37];
|
||||
|
||||
uuid_bin_to_str(tab->guid.b, guid_str, 1);
|
||||
printf("%p %pUl %s\n", tab->table, guid_str,
|
||||
printf("%p %pUl %s\n", tab->table, tab->guid.b,
|
||||
uuid_guid_get_str(tab->guid.b) ?: "(unknown)");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,15 +424,59 @@ space. See existing code for examples.
|
|||
VPL (Verifying Program Loader)
|
||||
------------------------------
|
||||
|
||||
Sandbox provides an example build of vpl called `sandbox_vpl`. This can be run
|
||||
using::
|
||||
Sandbox provides an example build of vpl called `sandbox_vpl`. To build it:
|
||||
|
||||
/path/to/sandbox_vpl/tpl/u-boot-tpl -D
|
||||
.. code-block:: bash
|
||||
|
||||
make sandbox_vpl_defconfig all
|
||||
|
||||
This can be run using:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./tpl/u-boot-tpl -d u-boot.dtb
|
||||
|
||||
It starts up TPL (first-stage init), then VPL, then runs SPL and finally U-Boot
|
||||
proper, following the normal flow for a verified boot. At present, no
|
||||
verification is actually implemented.
|
||||
|
||||
Here is an example trace::
|
||||
|
||||
U-Boot TPL 2024.01-rc2-00129 (Nov 19 2023 - 08:10:12 -0700)
|
||||
Trying to boot from sandbox_image
|
||||
Trying to boot from sandbox_file
|
||||
|
||||
U-Boot VPL 2024.01-rc2-00129 (Nov 19 2023 - 08:10:12 -0700)
|
||||
Trying to boot from vbe_simple
|
||||
Trying to boot from sandbox_image
|
||||
Trying to boot from sandbox_file
|
||||
|
||||
U-Boot SPL 2024.01-rc2-00129 (Nov 19 2023 - 08:10:12 -0700)
|
||||
Trying to boot from vbe_simple
|
||||
Trying to boot from sandbox_image
|
||||
Trying to boot from sandbox_file
|
||||
|
||||
|
||||
U-Boot 2024.01-rc2-00129 (Nov 19 2023 - 08:10:12 -0700)
|
||||
|
||||
Reset Status: COLD
|
||||
Model: sandbox
|
||||
DRAM: 256 MiB
|
||||
using memory 0x1b576000-0x1f578000 for malloc()
|
||||
|
||||
Warning: host_lo MAC addresses don't match:
|
||||
Address in ROM is 96:cd:ef:82:78:51
|
||||
Address in environment is 02:00:11:22:33:44
|
||||
Core: 103 devices, 51 uclasses, devicetree: board
|
||||
MMC:
|
||||
Loading Environment from nowhere... OK
|
||||
In: serial,cros-ec-keyb,usbkbd
|
||||
Out: serial,vidconsole
|
||||
Err: serial,vidconsole
|
||||
Model: sandbox
|
||||
Net: eth0: host_lo, eth1: host_enp14s0, eth2: host_eth6, eth3: host_wlp15s0, eth4: host_virbr0, eth5: host_docker0, eth6: eth@10002000
|
||||
Hit any key to stop autoboot: 1
|
||||
|
||||
|
||||
Debugging the init sequence
|
||||
---------------------------
|
||||
|
|
22
doc/build/clang.rst
vendored
22
doc/build/clang.rst
vendored
|
@ -11,14 +11,6 @@ The ARM backend can be instructed not to use the r9 and x18 registers using
|
|||
supported inline assembly is needed to get and set the r9 or x18 value. This
|
||||
leads to larger code then strictly necessary, but at least works.
|
||||
|
||||
**NOTE:** target compilation only work for _some_ ARM boards at the moment.
|
||||
Also AArch64 is not supported currently due to a lack of private libgcc
|
||||
support. Boards which reassign gd in c will also fail to compile, but there is
|
||||
in no strict reason to do so in the ARM world, since crt0.S takes care of this.
|
||||
These assignments can be avoided by changing the init calls but this is not in
|
||||
mainline yet.
|
||||
|
||||
|
||||
Debian based
|
||||
------------
|
||||
|
||||
|
@ -28,14 +20,20 @@ Required packages can be installed via apt, e.g.
|
|||
|
||||
sudo apt-get install clang
|
||||
|
||||
Note that we still use binutils for some tools so we must continue to set
|
||||
CROSS_COMPILE. To compile U-Boot with Clang on Linux without IAS use e.g.
|
||||
We make use of the CROSS_COMPILE variable to derive the build target which is
|
||||
passed as the --target parameter to clang.
|
||||
|
||||
The CROSS_COMPILE variable further determines the paths to other build
|
||||
tools. As assembler we use the binary pointed to by '$(CROSS_COMPILE)as'
|
||||
instead of the LLVM integrated assembler (IAS).
|
||||
|
||||
Here is an example demonstrating building U-Boot for the Raspberry Pi 2
|
||||
using clang:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make HOSTCC=clang rpi_2_defconfig
|
||||
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
|
||||
CC="clang -target arm-linux-gnueabi" -j8
|
||||
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- CC=clang -j8
|
||||
|
||||
It can also be used to compile sandbox:
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ A Custodian has additional privileges and can:
|
|||
|
||||
* Awaiting Upstream
|
||||
|
||||
* Superseeded
|
||||
* Superseded
|
||||
|
||||
* Deferred
|
||||
|
||||
|
@ -399,7 +399,7 @@ today. Not all states are used by all custodians.
|
|||
and has not merged yet to master, or has queued the patch up to be submitted
|
||||
to be merged, but has not yet.
|
||||
|
||||
* Superseeded: Patches are marked as 'superseeded' when the poster submits a
|
||||
* Superseded: Patches are marked as 'superseded' when the poster submits a
|
||||
new version of these patches.
|
||||
|
||||
* Deferred: Deferred usually means the patch depends on something else that
|
||||
|
|
|
@ -12,18 +12,21 @@
|
|||
#include <cpu_func.h>
|
||||
#include <debug_uart.h>
|
||||
#include <dm.h>
|
||||
#include <efi.h>
|
||||
#include <efi_api.h>
|
||||
#include <errno.h>
|
||||
#include <init.h>
|
||||
#include <malloc.h>
|
||||
#include <sysreset.h>
|
||||
#include <uuid.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/types.h>
|
||||
#include <efi.h>
|
||||
#include <efi_api.h>
|
||||
#include <sysreset.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include <dm/lists.h>
|
||||
#include <dm/root.h>
|
||||
#include <mapmem.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
@ -320,6 +323,19 @@ int dm_scan_other(bool pre_reloc_only)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void scan_tables(struct efi_system_table *sys_table)
|
||||
{
|
||||
efi_guid_t acpi = EFI_ACPI_TABLE_GUID;
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < sys_table->nr_tables; i++) {
|
||||
struct efi_configuration_table *tab = &sys_table->tables[i];
|
||||
|
||||
if (!memcmp(&tab->guid, &acpi, sizeof(efi_guid_t)))
|
||||
gd_set_acpi_start(map_to_sysmem(tab->table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_main() - Start an EFI image
|
||||
*
|
||||
|
@ -354,6 +370,8 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
|
|||
return ret;
|
||||
}
|
||||
|
||||
scan_tables(priv->sys_table);
|
||||
|
||||
/*
|
||||
* We could store the EFI memory map here, but it changes all the time,
|
||||
* so this is only useful for debugging.
|
||||
|
|
|
@ -51,9 +51,7 @@ obj-y += efi_console.o
|
|||
obj-y += efi_device_path.o
|
||||
obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
|
||||
obj-$(CONFIG_EFI_DEVICE_PATH_UTIL) += efi_device_path_utilities.o
|
||||
ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
|
||||
obj-y += efi_dt_fixup.o
|
||||
endif
|
||||
obj-y += efi_file.o
|
||||
obj-$(CONFIG_EFI_LOADER_HII) += efi_hii.o
|
||||
obj-y += efi_image_loader.o
|
||||
|
|
|
@ -1339,7 +1339,7 @@ static efi_status_t efi_disconnect_all_drivers
|
|||
const efi_guid_t *protocol,
|
||||
efi_handle_t child_handle)
|
||||
{
|
||||
efi_uintn_t number_of_drivers, tmp;
|
||||
efi_uintn_t number_of_drivers;
|
||||
efi_handle_t *driver_handle_buffer;
|
||||
efi_status_t r, ret;
|
||||
|
||||
|
@ -1350,27 +1350,13 @@ static efi_status_t efi_disconnect_all_drivers
|
|||
if (!number_of_drivers)
|
||||
return EFI_SUCCESS;
|
||||
|
||||
tmp = number_of_drivers;
|
||||
while (number_of_drivers) {
|
||||
ret = EFI_CALL(efi_disconnect_controller(
|
||||
r = EFI_CALL(efi_disconnect_controller(
|
||||
handle,
|
||||
driver_handle_buffer[--number_of_drivers],
|
||||
child_handle));
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto reconnect;
|
||||
}
|
||||
|
||||
free(driver_handle_buffer);
|
||||
return ret;
|
||||
|
||||
reconnect:
|
||||
/* Reconnect all disconnected drivers */
|
||||
for (; number_of_drivers < tmp; number_of_drivers++) {
|
||||
r = EFI_CALL(efi_connect_controller(handle,
|
||||
&driver_handle_buffer[number_of_drivers],
|
||||
NULL, true));
|
||||
if (r != EFI_SUCCESS)
|
||||
EFI_PRINT("Failed to reconnect controller\n");
|
||||
ret = r;
|
||||
}
|
||||
|
||||
free(driver_handle_buffer);
|
||||
|
@ -1409,6 +1395,13 @@ static efi_status_t efi_uninstall_protocol
|
|||
r = efi_disconnect_all_drivers(handle, protocol, NULL);
|
||||
if (r != EFI_SUCCESS) {
|
||||
r = EFI_ACCESS_DENIED;
|
||||
/*
|
||||
* This will reconnect all controllers of the handle, even ones
|
||||
* that were not connected before. This can be done better
|
||||
* but we are following the EDKII implementation on this for
|
||||
* now
|
||||
*/
|
||||
EFI_CALL(efi_connect_controller(handle, NULL, NULL, true));
|
||||
goto out;
|
||||
}
|
||||
/* Close protocol */
|
||||
|
|
|
@ -339,7 +339,12 @@ cmd_capsule_esl_gen = \
|
|||
$(shell sed "s:ESL_BIN_FILE:$(capsule_esl_path):" $(capsule_esl_input_file) > $@)
|
||||
|
||||
$(obj)/.capsule_esl.dtsi: FORCE
|
||||
ifeq ($(CONFIG_EFI_CAPSULE_ESL_FILE),"")
|
||||
$(error "CONFIG_EFI_CAPSULE_ESL_FILE is empty, EFI capsule authentication \
|
||||
public key must be specified when CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled")
|
||||
else
|
||||
$(call cmd_capsule_esl_gen)
|
||||
endif
|
||||
|
||||
capsule_esl_input_file=$(srctree)/lib/efi_loader/capsule_esl.dtsi.in
|
||||
capsule_esl_dtsi = .capsule_esl.dtsi
|
||||
|
|
Loading…
Reference in a new issue