Signed-off-by: Sascha Hauer <[email protected]>
---
 common/efi-devicepath.c | 15 +++++++++++++++
 include/efi.h           |  1 +
 2 files changed, 16 insertions(+)

diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c
index 3a3a8b9ebd..11d865af41 100644
--- a/common/efi-devicepath.c
+++ b/common/efi-devicepath.c
@@ -782,6 +782,21 @@ u8 device_path_to_type(struct efi_device_path *dev_path)
        return device_path_type(dev_path);
 }
 
+u8 device_path_to_subtype(struct efi_device_path *dev_path)
+{
+       struct efi_device_path *dev_path_next;
+
+       dev_path = unpack_device_path(dev_path);
+       dev_path_next = next_device_path_node(dev_path);
+
+       while (!is_device_path_end(dev_path_next)) {
+               dev_path = dev_path_next;
+               dev_path_next = next_device_path_node(dev_path);
+       }
+
+       return dev_path->sub_type;
+}
+
 char *device_path_to_partuuid(struct efi_device_path *dev_path)
 {
        struct efi_device_path *dev_path_node;
diff --git a/include/efi.h b/include/efi.h
index 439803c294..04dffaae5a 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -682,6 +682,7 @@ typedef union {
 struct efi_device_path *device_path_from_handle(efi_handle_t Handle);
 char *device_path_to_str(struct efi_device_path *dev_path);
 u8 device_path_to_type(struct efi_device_path *dev_path);
+u8 device_path_to_subtype(struct efi_device_path *dev_path);
 char *device_path_to_partuuid(struct efi_device_path *dev_path);
 
 const char *efi_guid_string(efi_guid_t *g);
-- 
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to