summaryrefslogtreecommitdiffstats
path: root/common/efi-devicepath.c
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2014-12-08 14:42:28 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-12-09 09:59:09 +0100
commitda94ff1e37315900037dee2171f43c342616206d (patch)
tree7f8d9d2aa837aec213faa60a7b4311c7f988e4ff /common/efi-devicepath.c
parent38c6f5d35177e3e469ae0abb994b7aea68b790e9 (diff)
downloadbarebox-da94ff1e37315900037dee2171f43c342616206d.tar.gz
efi: add function to determine type of device path
Thanks to the wonders of UEFI we have to walk down the device path all the way until we arrive at the device we got this path from... Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/efi-devicepath.c')
-rw-r--r--common/efi-devicepath.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c
index 2b1d916..a53c6d2 100644
--- a/common/efi-devicepath.c
+++ b/common/efi-devicepath.c
@@ -1368,3 +1368,18 @@ char *device_path_to_str(struct efi_device_path *dev_path)
return str.str;
}
+
+u8 device_path_to_type(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 device_path_type(dev_path);
+}