From: Tom Rini Date: Mon, 19 Sep 2022 17:19:39 +0000 (-0400) Subject: Merge branch 'master' into next X-Git-Tag: v2025.01-rc5-pxa1908~1263^2~10 X-Git-Url: http://git.dujemihanovic.xyz/%22http:/kyber.dk/phpMyBuilder/static/git-logo.png?a=commitdiff_plain;h=e9a1ff9724348408144c7f1c5b5cc26130ba46e5;p=u-boot.git Merge branch 'master' into next Signed-off-by: Tom Rini --- e9a1ff9724348408144c7f1c5b5cc26130ba46e5 diff --cc lib/efi_loader/efi_disk.c index 819dcb4f13,5feeb52ccb..e39968a3f3 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@@ -761,52 -761,19 +761,69 @@@ 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; +} ++ + /** + * efi_disks_register() - ensure all block devices are available in UEFI + * + * The function probes all block devices. As we store UEFI variables on the + * EFI system partition this function has to be called before enabling + * variable services. + */ + efi_status_t efi_disks_register(void) + { + struct udevice *dev; + + uclass_foreach_dev_probe(UCLASS_BLK, dev) { + } + + return EFI_SUCCESS; + }