efi_loader: move udevice pointer into struct efi_object

This is a preparation patch to provide the unified method
to access udevice pointer associated with the EFI handle
by adding udevice pointer into struct efi_object.
The patch also introduces a helper function efi_link_dev()
to link the udevice and EFI handle.

The EFI handles of both EFI block io driver implemented in
lib/efi_loader/efi_disk.c and EFI block io driver implemented
as EFI payload can access the udevice pointer in the struct efi_object.
We can use this udevice pointer to get the U-Boot friendly
block device name(e.g. mmc 0:1, nvme 0:1) through EFI handle.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Masahisa Kojima
2022-07-22 11:39:10 +09:00
committed by Heinrich Schuchardt
parent e7496e57a0
commit ee57666294
4 changed files with 24 additions and 11 deletions

View File

@@ -375,6 +375,7 @@ enum efi_object_type {
* @protocols: linked list with the protocol interfaces installed on this
* handle
* @type: image type if the handle relates to an image
* @dev: pointer to the DM device which is associated with this EFI handle
*
* UEFI offers a flexible and expandable object model. The objects in the UEFI
* API are devices, drivers, and loaded images. struct efi_object is our storage
@@ -392,6 +393,7 @@ struct efi_object {
/* The list of protocols */
struct list_head protocols;
enum efi_object_type type;
struct udevice *dev;
};
enum efi_image_auth_status {
@@ -690,6 +692,8 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid);
const char *guid_to_sha_str(const efi_guid_t *guid);
int algo_to_len(const char *algo);
int efi_link_dev(efi_handle_t handle, struct udevice *dev);
/**
* efi_size_in_pages() - convert size in bytes to size in pages
*