aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_device_path.c
diff options
context:
space:
mode:
authorMasahisa Kojima <masahisa.kojima@linaro.org>2021-10-26 17:27:25 +0900
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-10-26 21:32:46 +0200
commitce3dbc5d080de8045dd5e2b512cad75434ba4cf5 (patch)
tree914447046e0c0668321d7e749eeede4e2c0ccc47 /lib/efi_loader/efi_device_path.c
parent3d49ee8510d38e7fd087c7250a3f4392a38bf0dd (diff)
downloadu-boot-ce3dbc5d080de8045dd5e2b512cad75434ba4cf5.zip
u-boot-ce3dbc5d080de8045dd5e2b512cad75434ba4cf5.tar.gz
u-boot-ce3dbc5d080de8045dd5e2b512cad75434ba4cf5.tar.bz2
efi_loader: add UEFI GPT measurement
This commit adds the UEFI GPT disk partition topology measurement required in TCG PC Client Platform Firmware Profile Specification Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Diffstat (limited to 'lib/efi_loader/efi_device_path.c')
-rw-r--r--lib/efi_loader/efi_device_path.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index c04439d..735ed0b 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -1239,3 +1239,30 @@ efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
return NULL;
}
+
+/**
+ * search_gpt_dp_node() - search gpt device path node
+ *
+ * @device_path: device path
+ *
+ * Return: pointer to the gpt device path node
+ */
+struct efi_device_path *search_gpt_dp_node(struct efi_device_path *device_path)
+{
+ struct efi_device_path *dp = device_path;
+
+ while (dp) {
+ if (dp->type == DEVICE_PATH_TYPE_MEDIA_DEVICE &&
+ dp->sub_type == DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH) {
+ struct efi_device_path_hard_drive_path *hd_dp =
+ (struct efi_device_path_hard_drive_path *)dp;
+
+ if (hd_dp->partmap_type == PART_FORMAT_GPT &&
+ hd_dp->signature_type == SIG_TYPE_GUID)
+ return dp;
+ }
+ dp = efi_dp_next(dp);
+ }
+
+ return NULL;
+}