Skip to content
Snippets Groups Projects
Commit 211314c1 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Alexander Graf
Browse files

efi_loader: implement CreateDeviceNode


Implement the CreateDeviceNode service of the device path utility protocol.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 065a8eca
No related branches found
No related tags found
No related merge requests found
...@@ -330,7 +330,10 @@ struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1, ...@@ -330,7 +330,10 @@ struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1,
const struct efi_device_path *dp2); const struct efi_device_path *dp2);
struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
const struct efi_device_path *node); 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_dev(struct udevice *dev);
struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part);
......
...@@ -315,6 +315,21 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, ...@@ -315,6 +315,21 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
return ret; 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 #ifdef CONFIG_DM
/* size of device-path not including END node for device and all parents /* size of device-path not including END node for device and all parents
* up to the root device. * up to the root device.
......
...@@ -70,11 +70,26 @@ static bool EFIAPI is_device_path_multi_instance( ...@@ -70,11 +70,26 @@ static bool EFIAPI is_device_path_multi_instance(
return EFI_EXIT(false); 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( static struct efi_device_path * EFIAPI create_device_node(
uint8_t node_type, uint8_t node_sub_type, uint16_t node_length) 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); 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 = { const struct efi_device_path_utilities_protocol efi_device_path_utilities = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment