blob: bc97eeee31b68a57fa9a6e7af80d04b92bf023f5 [file] [log] [blame]
Leif Lindholmb6e6fdc2018-03-09 17:43:21 +01001/*
2 * EFI device path interface
3 *
4 * Copyright (c) 2017 Leif Lindholm
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#include <common.h>
10#include <efi_loader.h>
11
12const efi_guid_t efi_guid_device_path_utilities_protocol =
13 EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID;
14
15static efi_uintn_t EFIAPI get_device_path_size(
16 const struct efi_device_path *device_path)
17{
18 efi_uintn_t sz = 0;
19
20 EFI_ENTRY("%p", device_path);
21 /* size includes the END node: */
22 if (device_path)
23 sz = efi_dp_size(device_path) + sizeof(struct efi_device_path);
24 return EFI_EXIT(sz);
25}
26
27static struct efi_device_path * EFIAPI duplicate_device_path(
28 const struct efi_device_path *device_path)
29{
30 EFI_ENTRY("%p", device_path);
31 return EFI_EXIT(efi_dp_dup(device_path));
32}
33
34static struct efi_device_path * EFIAPI append_device_path(
35 const struct efi_device_path *src1,
36 const struct efi_device_path *src2)
37{
38 EFI_ENTRY("%p, %p", src1, src2);
39 return EFI_EXIT(efi_dp_append(src1, src2));
40}
41
42static struct efi_device_path * EFIAPI append_device_node(
43 const struct efi_device_path *device_path,
44 const struct efi_device_path *device_node)
45{
46 EFI_ENTRY("%p, %p", device_path, device_node);
47 return EFI_EXIT(efi_dp_append_node(device_path, device_node));
48}
49
50static struct efi_device_path * EFIAPI append_device_path_instance(
51 const struct efi_device_path *device_path,
52 const struct efi_device_path *device_path_instance)
53{
54 EFI_ENTRY("%p, %p", device_path, device_path_instance);
55 return EFI_EXIT(NULL);
56}
57
58static struct efi_device_path * EFIAPI get_next_device_path_instance(
59 struct efi_device_path **device_path_instance,
60 efi_uintn_t *device_path_instance_size)
61{
62 EFI_ENTRY("%p, %p", device_path_instance, device_path_instance_size);
63 return EFI_EXIT(NULL);
64}
65
66static bool EFIAPI is_device_path_multi_instance(
67 const struct efi_device_path *device_path)
68{
69 EFI_ENTRY("%p", device_path);
70 return EFI_EXIT(false);
71}
72
73static struct efi_device_path * EFIAPI create_device_node(
74 uint8_t node_type, uint8_t node_sub_type, uint16_t node_length)
75{
76 EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length);
77 return EFI_EXIT(NULL);
78}
79
80const struct efi_device_path_utilities_protocol efi_device_path_utilities = {
81 .get_device_path_size = get_device_path_size,
82 .duplicate_device_path = duplicate_device_path,
83 .append_device_path = append_device_path,
84 .append_device_node = append_device_node,
85 .append_device_path_instance = append_device_path_instance,
86 .get_next_device_path_instance = get_next_device_path_instance,
87 .is_device_path_multi_instance = is_device_path_multi_instance,
88 .create_device_node = create_device_node,
89};