mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-13 20:36:02 +01:00
Pull request for efi-2022-07-rc5
UEFI: * Ignore OsIndications if CONFIG_EFI_IGNORE_OSINDICATIONS=y * Correct UEFI default binary name * Let efidebug create boot options without file path * Support booting with a boot option with shortened device only device path -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmKm12gACgkQxIHbvCwF GsTYDQ/+P4s0HdA8mb05PdInq2NZs1nSX89sHYLt9yC9ElBdZ3O399GmfOVDRpfa qBjh+N0p2B6PwQc4xN0b+pn/Rj+PV8aqG06hV3ASY63xpLxq2tKvnwUKexTyb7Wz l+StEUz63NO1PNNdSz/uDUFkLqdjV28ys6Qz8N0tUNNE63lVtxO7oNhyARc3/VRh +Rry4/iO3tCvEr6EUGOWzWbOwt4AVUk0bBSpoBG0CvmOTjtS8lKAJXDYYqOxZxXi J+tLramOUHgEbZmGLSFBvx9WOFHnIvAV7H4dJ19d7V2YZUwXcBNinSNjwgTDVXJ+ o5NXyxnpsyrUTdm0g9lE2hmmhz/LlrlYzIQ4Rz6v0b4Gk1ZS5fFeUVhNp6B1hTL9 hN8lJ2Jn3+inGrIRkCiG30b6qEU14YmjBpJ3Z5nZZSOkx6ce4TZNKb0VUD2DFeYc JCHg8Cecv361cM5LS2BVT2a2+1zghEWpv4xHh0m+xAccUM3E3kdDZGo2EiLQXGvp wPF0hX2K0LqZt6lD2Vyk5aBKTxz9XRDjzXXVKJCnLFcCSBlASRAymQu53xHd5/7L jAtvwVhDw//IWo9bA+5qjJqdDD9zgUE0ujrVOqU9/L3Oa55hYyM0WMBiDtM0xiSY GiPvmdDXqhCyNEfZNPcoAE6GUG1mq5Qdwt1NVQOhg85+TdvvcGI= =Ylyv -----END PGP SIGNATURE----- Merge tag 'efi-2022-07-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc5 UEFI: * Ignore OsIndications if CONFIG_EFI_IGNORE_OSINDICATIONS=y * Correct UEFI default binary name * Let efidebug create boot options without file path * Support booting with a boot option with shortened device only device path
This commit is contained in:
commit
92a8bc6b41
@ -5,6 +5,7 @@
|
||||
* file name is defined in this include.
|
||||
*
|
||||
* Copyright (c) 2022, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
* Copyright (c) 2022, Linaro Limited
|
||||
*/
|
||||
|
||||
#ifndef _EFI_DEFAULT_FILENAME_H
|
||||
@ -14,32 +15,42 @@
|
||||
|
||||
#undef BOOTEFI_NAME
|
||||
|
||||
#ifdef CONFIG_SANDBOX
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_X86_64
|
||||
#define BOOTEFI_NAME "BOOTX64.EFI"
|
||||
#endif
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_X86
|
||||
#elif HOST_ARCH == HOST_ARCH_X86
|
||||
#define BOOTEFI_NAME "BOOTIA32.EFI"
|
||||
#endif
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_AARCH64
|
||||
#elif HOST_ARCH == HOST_ARCH_AARCH64
|
||||
#define BOOTEFI_NAME "BOOTAA64.EFI"
|
||||
#endif
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_ARM
|
||||
#elif HOST_ARCH == HOST_ARCH_ARM
|
||||
#define BOOTEFI_NAME "BOOTARM.EFI"
|
||||
#endif
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_RISCV32
|
||||
#elif HOST_ARCH == HOST_ARCH_RISCV32
|
||||
#define BOOTEFI_NAME "BOOTRISCV32.EFI"
|
||||
#endif
|
||||
|
||||
#if HOST_ARCH == HOST_ARCH_RISCV64
|
||||
#elif HOST_ARCH == HOST_ARCH_RISCV64
|
||||
#define BOOTEFI_NAME "BOOTRISCV64.EFI"
|
||||
#else
|
||||
#error Unsupported UEFI architecture
|
||||
#endif
|
||||
|
||||
#ifndef BOOTEFI_NAME
|
||||
#else
|
||||
|
||||
#if defined(CONFIG_ARM64)
|
||||
#define BOOTEFI_NAME "BOOTAA64.EFI"
|
||||
#elif defined(CONFIG_ARM)
|
||||
#define BOOTEFI_NAME "BOOTARM.EFI"
|
||||
#elif defined(CONFIG_X86_64)
|
||||
#define BOOTEFI_NAME "BOOTX64.EFI"
|
||||
#elif defined(CONFIG_X86)
|
||||
#define BOOTEFI_NAME "BOOTIA32.EFI"
|
||||
#elif defined(CONFIG_ARCH_RV32I)
|
||||
#define BOOTEFI_NAME "BOOTRISCV32.EFI"
|
||||
#elif defined(CONFIG_ARCH_RV64I)
|
||||
#define BOOTEFI_NAME "BOOTRISCV64.EFI"
|
||||
#else
|
||||
#error Unsupported UEFI architecture
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -44,9 +44,8 @@ static const struct efi_runtime_services *rs;
|
||||
static
|
||||
struct efi_device_path *expand_media_path(struct efi_device_path *device_path)
|
||||
{
|
||||
struct efi_device_path *dp, *full_path;
|
||||
struct efi_device_path *dp, *rem, *full_path;
|
||||
efi_handle_t handle;
|
||||
efi_status_t ret;
|
||||
|
||||
if (!device_path)
|
||||
return NULL;
|
||||
@ -57,11 +56,10 @@ struct efi_device_path *expand_media_path(struct efi_device_path *device_path)
|
||||
* booting from removable media.
|
||||
*/
|
||||
dp = device_path;
|
||||
ret = EFI_CALL(efi_locate_device_path(
|
||||
&efi_simple_file_system_protocol_guid,
|
||||
&dp, &handle));
|
||||
if (ret == EFI_SUCCESS) {
|
||||
if (dp->type == DEVICE_PATH_TYPE_END) {
|
||||
handle = efi_dp_find_obj(dp, &efi_simple_file_system_protocol_guid,
|
||||
&rem);
|
||||
if (handle) {
|
||||
if (rem->type == DEVICE_PATH_TYPE_END) {
|
||||
dp = efi_dp_from_file(NULL, 0,
|
||||
"/EFI/BOOT/" BOOTEFI_NAME);
|
||||
full_path = efi_dp_append(device_path, dp);
|
||||
|
@ -1058,14 +1058,15 @@ static void efi_capsule_scan_done(void)
|
||||
*/
|
||||
static efi_status_t check_run_capsules(void)
|
||||
{
|
||||
u64 os_indications;
|
||||
u64 os_indications = 0x0;
|
||||
efi_uintn_t size;
|
||||
efi_status_t r;
|
||||
|
||||
size = sizeof(os_indications);
|
||||
r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid,
|
||||
NULL, &size, &os_indications, NULL);
|
||||
if (r != EFI_SUCCESS || size != sizeof(os_indications))
|
||||
if (!IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS) &&
|
||||
(r != EFI_SUCCESS || size != sizeof(os_indications)))
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
if (os_indications &
|
||||
@ -1084,7 +1085,7 @@ static efi_status_t check_run_capsules(void)
|
||||
return EFI_SUCCESS;
|
||||
} else if (IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS)) {
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
@ -973,9 +973,22 @@ static void path_to_uefi(void *uefi, const char *src)
|
||||
*pos = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If desc is NULL, this creates a path with only the file component,
|
||||
* otherwise it creates a full path with both device and file components
|
||||
/**
|
||||
* efi_dp_from_file() - create device path for file
|
||||
*
|
||||
* The function creates a device path from the block descriptor @desc and the
|
||||
* partition number @part and appends a device path node created describing the
|
||||
* file path @path.
|
||||
*
|
||||
* If @desc is NULL, the device path will not contain nodes describing the
|
||||
* partition.
|
||||
* If @path is an empty string "", the device path will not contain a node
|
||||
* for the file path.
|
||||
*
|
||||
* @desc: block device descriptor or NULL
|
||||
* @part: partition number
|
||||
* @path: file path on partition or ""
|
||||
* Return: device path or NULL in case of an error
|
||||
*/
|
||||
struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
|
||||
const char *path)
|
||||
@ -1002,12 +1015,14 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
|
||||
buf = dp_part_fill(buf, desc, part);
|
||||
|
||||
/* add file-path: */
|
||||
fp = buf;
|
||||
fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
|
||||
fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
|
||||
fp->dp.length = (u16)fpsize;
|
||||
path_to_uefi(fp->str, path);
|
||||
buf += fpsize;
|
||||
if (*path) {
|
||||
fp = buf;
|
||||
fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
|
||||
fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
|
||||
fp->dp.length = (u16)fpsize;
|
||||
path_to_uefi(fp->str, path);
|
||||
buf += fpsize;
|
||||
}
|
||||
|
||||
*((struct efi_device_path *)buf) = END;
|
||||
|
||||
|
@ -241,18 +241,8 @@ efi_status_t efi_firmware_capsule_authenticate(const void **p_image,
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_FIT
|
||||
/*
|
||||
* This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update
|
||||
* method with existing FIT image format, and handles
|
||||
* - multiple regions of firmware via DFU
|
||||
* but doesn't support
|
||||
* - versioning of firmware image
|
||||
* - package information
|
||||
*/
|
||||
|
||||
/**
|
||||
* efi_firmware_fit_get_image_info - return information about the current
|
||||
* efi_firmware_get_image_info - return information about the current
|
||||
* firmware image
|
||||
* @this: Protocol instance
|
||||
* @image_info_size: Size of @image_info
|
||||
@ -270,7 +260,7 @@ efi_status_t efi_firmware_capsule_authenticate(const void **p_image,
|
||||
* Return status code
|
||||
*/
|
||||
static
|
||||
efi_status_t EFIAPI efi_firmware_fit_get_image_info(
|
||||
efi_status_t EFIAPI efi_firmware_get_image_info(
|
||||
struct efi_firmware_management_protocol *this,
|
||||
efi_uintn_t *image_info_size,
|
||||
struct efi_firmware_image_descriptor *image_info,
|
||||
@ -303,6 +293,16 @@ efi_status_t EFIAPI efi_firmware_fit_get_image_info(
|
||||
return EFI_EXIT(ret);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_FIT
|
||||
/*
|
||||
* This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update
|
||||
* method with existing FIT image format, and handles
|
||||
* - multiple regions of firmware via DFU
|
||||
* but doesn't support
|
||||
* - versioning of firmware image
|
||||
* - package information
|
||||
*/
|
||||
|
||||
/**
|
||||
* efi_firmware_fit_set_image - update the firmware image
|
||||
* @this: Protocol instance
|
||||
@ -348,7 +348,7 @@ efi_status_t EFIAPI efi_firmware_fit_set_image(
|
||||
}
|
||||
|
||||
const struct efi_firmware_management_protocol efi_fmp_fit = {
|
||||
.get_image_info = efi_firmware_fit_get_image_info,
|
||||
.get_image_info = efi_firmware_get_image_info,
|
||||
.get_image = efi_firmware_get_image_unsupported,
|
||||
.set_image = efi_firmware_fit_set_image,
|
||||
.check_image = efi_firmware_check_image_unsupported,
|
||||
@ -363,58 +363,6 @@ const struct efi_firmware_management_protocol efi_fmp_fit = {
|
||||
* method with raw data.
|
||||
*/
|
||||
|
||||
/**
|
||||
* efi_firmware_raw_get_image_info - return information about the current
|
||||
* firmware image
|
||||
* @this: Protocol instance
|
||||
* @image_info_size: Size of @image_info
|
||||
* @image_info: Image information
|
||||
* @descriptor_version: Pointer to version number
|
||||
* @descriptor_count: Pointer to number of descriptors
|
||||
* @descriptor_size: Pointer to descriptor size
|
||||
* @package_version: Package version
|
||||
* @package_version_name: Package version's name
|
||||
*
|
||||
* Return information bout the current firmware image in @image_info.
|
||||
* @image_info will consist of a number of descriptors.
|
||||
* Each descriptor will be created based on "dfu_alt_info" variable.
|
||||
*
|
||||
* Return status code
|
||||
*/
|
||||
static
|
||||
efi_status_t EFIAPI efi_firmware_raw_get_image_info(
|
||||
struct efi_firmware_management_protocol *this,
|
||||
efi_uintn_t *image_info_size,
|
||||
struct efi_firmware_image_descriptor *image_info,
|
||||
u32 *descriptor_version,
|
||||
u8 *descriptor_count,
|
||||
efi_uintn_t *descriptor_size,
|
||||
u32 *package_version,
|
||||
u16 **package_version_name)
|
||||
{
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
|
||||
EFI_ENTRY("%p %p %p %p %p %p %p %p\n", this,
|
||||
image_info_size, image_info,
|
||||
descriptor_version, descriptor_count, descriptor_size,
|
||||
package_version, package_version_name);
|
||||
|
||||
if (!image_info_size)
|
||||
return EFI_EXIT(EFI_INVALID_PARAMETER);
|
||||
|
||||
if (*image_info_size &&
|
||||
(!image_info || !descriptor_version || !descriptor_count ||
|
||||
!descriptor_size || !package_version || !package_version_name))
|
||||
return EFI_EXIT(EFI_INVALID_PARAMETER);
|
||||
|
||||
ret = efi_fill_image_desc_array(image_info_size, image_info,
|
||||
descriptor_version, descriptor_count,
|
||||
descriptor_size, package_version,
|
||||
package_version_name);
|
||||
|
||||
return EFI_EXIT(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_firmware_raw_set_image - update the firmware image
|
||||
* @this: Protocol instance
|
||||
@ -461,7 +409,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
|
||||
}
|
||||
|
||||
const struct efi_firmware_management_protocol efi_fmp_raw = {
|
||||
.get_image_info = efi_firmware_raw_get_image_info,
|
||||
.get_image_info = efi_firmware_get_image_info,
|
||||
.get_image = efi_firmware_get_image_unsupported,
|
||||
.set_image = efi_firmware_raw_set_image,
|
||||
.check_image = efi_firmware_check_image_unsupported,
|
||||
|
Loading…
x
Reference in New Issue
Block a user