summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_helper.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-07-15 11:19:11 -0400
committerTom Rini <trini@konsulko.com>2023-07-15 11:19:11 -0400
commit3a7a17dbdc016e77627f62f5dc55819e1be09f9c (patch)
tree5526535fea4647d182018a7f54c404c68bf47d7c /lib/efi_loader/efi_helper.c
parente6e67bb9e0a40f3eb3c87d16935192821987c3e0 (diff)
parent345a8b15acf228c4a429f6569c34cbc0232e76eb (diff)
Merge tag 'efi-2023-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2023-10-rc1 Documentation: * enhance UEFI anti-rollback documentation EFI: * Reconnect drivers if UninstallProtocol fails * Prefer short device paths for boot options * Fix error handling when updating boot options for block devices
Diffstat (limited to 'lib/efi_loader/efi_helper.c')
-rw-r--r--lib/efi_loader/efi_helper.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 1f4ab2b419a..cdfd16ea774 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -257,3 +257,28 @@ efi_status_t efi_next_variable_name(efi_uintn_t *size, u16 **buf, efi_guid_t *gu
return ret;
}
+
+/**
+ * efi_search_bootorder() - search the boot option index in BootOrder
+ *
+ * @bootorder: pointer to the BootOrder variable
+ * @num: number of BootOrder entry
+ * @target: target boot option index to search
+ * @index: pointer to store the index of BootOrder variable
+ * Return: true if exists, false otherwise
+ */
+bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *index)
+{
+ u32 i;
+
+ for (i = 0; i < num; i++) {
+ if (target == bootorder[i]) {
+ if (index)
+ *index = i;
+
+ return true;
+ }
+ }
+
+ return false;
+}