diff options
author | Tom Rini <trini@konsulko.com> | 2020-05-05 12:32:44 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-05-05 12:32:44 -0400 |
commit | 9a3cc7b6d416fddfa6058b731fe5c9055dba6918 (patch) | |
tree | d08f6b1c5c9707d03b9343ad4896ea4df749b9c6 /lib/efi_loader/efi_disk.c | |
parent | 191ee8aac60d6b828ee5f933ab2c6aceda167082 (diff) | |
parent | 16ad946f41d3dc3e475d8313f4acbba0df527a2a (diff) |
Merge tag 'efi-2020-07-rc2-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2020-07-rc2-2
This patch contains error corrections and code simplifications for the UEFI
sub-system.
Diffstat (limited to 'lib/efi_loader/efi_disk.c')
-rw-r--r-- | lib/efi_loader/efi_disk.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index fd3df80b0b9..0582e02158f 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -588,3 +588,32 @@ efi_status_t efi_disk_register(void) return EFI_SUCCESS; } + +/** + * efi_disk_is_system_part() - check if handle refers to an EFI system partition + * + * @handle: handle of partition + * + * Return: true if handle refers to an EFI system partition + */ +bool efi_disk_is_system_part(efi_handle_t handle) +{ + struct efi_handler *handler; + struct efi_disk_obj *diskobj; + disk_partition_t info; + efi_status_t ret; + int r; + + /* check if this is a block device */ + ret = efi_search_protocol(handle, &efi_block_io_guid, &handler); + if (ret != EFI_SUCCESS) + return false; + + diskobj = container_of(handle, struct efi_disk_obj, header); + + r = part_get_info(diskobj->desc, diskobj->part, &info); + if (r) + return false; + + return !!(info.bootable & PART_EFI_SYSTEM_PARTITION); +} |