]> git.sur5r.net Git - u-boot/commitdiff
efi_loader: implement CreateDeviceNode
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 16 Apr 2018 05:59:05 +0000 (07:59 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 23 Apr 2018 19:34:28 +0000 (21:34 +0200)
Implement the CreateDeviceNode service of the device path utility protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_loader.h
lib/efi_loader/efi_device_path.c
lib/efi_loader/efi_device_path_utilities.c

index 17f9d3d1ef2c58ec3471291d9d39a8959d44e9d4..0358bcb1d7b0885a477a35a20cf36aa0891fe704 100644 (file)
@@ -330,7 +330,10 @@ struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1,
                                      const struct efi_device_path *dp2);
 struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
                                           const struct efi_device_path *node);
-
+/* Create a device path node of given type, sub-type, length */
+struct efi_device_path *efi_dp_create_device_node(const u8 type,
+                                                 const u8 sub_type,
+                                                 const u16 length);
 
 struct efi_device_path *efi_dp_from_dev(struct udevice *dev);
 struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part);
index e965f1d88eda378e6a27e9644ca4c7be1ec29d84..0cd0b459e3dec6ac2601a6bcc66f99936a4ed529 100644 (file)
@@ -315,6 +315,21 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
        return ret;
 }
 
+struct efi_device_path *efi_dp_create_device_node(const u8 type,
+                                                 const u8 sub_type,
+                                                 const u16 length)
+{
+       struct efi_device_path *ret;
+
+       ret = dp_alloc(length);
+       if (!ret)
+               return ret;
+       ret->type = type;
+       ret->sub_type = sub_type;
+       ret->length = length;
+       return ret;
+}
+
 #ifdef CONFIG_DM
 /* size of device-path not including END node for device and all parents
  * up to the root device.
index bc97eeee31b68a57fa9a6e7af80d04b92bf023f5..e73188b242ccd6bc8ae68147f289ef0c954e720d 100644 (file)
@@ -70,11 +70,26 @@ static bool EFIAPI is_device_path_multi_instance(
        return EFI_EXIT(false);
 }
 
+/*
+ * Create device node.
+ *
+ * This function implements the CreateDeviceNode service of the device path
+ * utilities protocol.
+ *
+ * See the Unified Extensible Firmware Interface (UEFI) specification
+ * for details.
+ *
+ * @node_type          node type
+ * @node_sub_type      node sub type
+ * @node_length                node length
+ * @return             device path node
+ */
 static struct efi_device_path * EFIAPI create_device_node(
        uint8_t node_type, uint8_t node_sub_type, uint16_t node_length)
 {
        EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length);
-       return EFI_EXIT(NULL);
+       return EFI_EXIT(efi_dp_create_device_node(node_type, node_sub_type,
+                       node_length));
 }
 
 const struct efi_device_path_utilities_protocol efi_device_path_utilities = {