1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 09:42:22 +02:00

eficonfig: menu-driven addition of UEFI boot option

This commit add the "eficonfig" command.
The "eficonfig" command implements the menu-driven UEFI boot option
maintenance feature. This commit implements the addition of
new boot option. User can select the block device volume having
efi_simple_file_system_protocol and select the file corresponding
to the Boot#### variable. User can also enter the description and
optional_data of the BOOT#### variable in utf8.

This commit adds "include/efi_config.h", it contains the common
definition to be used from other menus such as UEFI Secure Boot
key management.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
This commit is contained in:
Masahisa Kojima
2022-09-12 17:33:50 +09:00
committed by Heinrich Schuchardt
parent c2238fcf0c
commit 87d791423a
10 changed files with 1952 additions and 47 deletions

View File

@@ -760,3 +760,53 @@ efi_status_t efi_disk_init(void)
return EFI_SUCCESS;
}
/**
* efi_disk_get_device_name() - get U-Boot device name associated with EFI handle
*
* @handle: pointer to the EFI handle
* @buf: pointer to the buffer to store the string
* @size: size of buffer
* Return: status code
*/
efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int size)
{
int count;
int diskid;
enum uclass_id id;
unsigned int part;
struct udevice *dev;
struct blk_desc *desc;
const char *if_typename;
bool is_partition = false;
struct disk_part *part_data;
if (!handle || !buf || !size)
return EFI_INVALID_PARAMETER;
dev = handle->dev;
id = device_get_uclass_id(dev);
if (id == UCLASS_BLK) {
desc = dev_get_uclass_plat(dev);
} else if (id == UCLASS_PARTITION) {
desc = dev_get_uclass_plat(dev_get_parent(dev));
is_partition = true;
} else {
return EFI_INVALID_PARAMETER;
}
if_typename = blk_get_if_type_name(desc->if_type);
diskid = desc->devnum;
if (is_partition) {
part_data = dev_get_uclass_plat(dev);
part = part_data->partnum;
count = snprintf(buf, size, "%s %d:%d", if_typename, diskid, part);
} else {
count = snprintf(buf, size, "%s %d", if_typename, diskid);
}
if (count < 0 || (count + 1) > size)
return EFI_INVALID_PARAMETER;
return EFI_SUCCESS;
}