1
2
3
4
5
6
7
8#include <common.h>
9#include <efi_loader.h>
10
11const efi_guid_t efi_guid_device_path_utilities_protocol =
12 EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID;
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27static efi_uintn_t EFIAPI get_device_path_size(
28 const struct efi_device_path *device_path)
29{
30 efi_uintn_t sz = 0;
31
32 EFI_ENTRY("%pD", device_path);
33
34 if (device_path)
35 sz = efi_dp_size(device_path) + sizeof(struct efi_device_path);
36 return EFI_EXIT(sz);
37}
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55static struct efi_device_path * EFIAPI duplicate_device_path(
56 const struct efi_device_path *device_path)
57{
58 EFI_ENTRY("%pD", device_path);
59 return EFI_EXIT(efi_dp_dup(device_path));
60}
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75static struct efi_device_path * EFIAPI append_device_path(
76 const struct efi_device_path *src1,
77 const struct efi_device_path *src2)
78{
79 EFI_ENTRY("%pD, %pD", src1, src2);
80 return EFI_EXIT(efi_dp_append(src1, src2));
81}
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96static struct efi_device_path * EFIAPI append_device_node(
97 const struct efi_device_path *device_path,
98 const struct efi_device_path *device_node)
99{
100 EFI_ENTRY("%pD, %p", device_path, device_node);
101 return EFI_EXIT(efi_dp_append_node(device_path, device_node));
102}
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117static struct efi_device_path * EFIAPI append_device_path_instance(
118 const struct efi_device_path *device_path,
119 const struct efi_device_path *device_path_instance)
120{
121 EFI_ENTRY("%pD, %pD", device_path, device_path_instance);
122 return EFI_EXIT(efi_dp_append_instance(device_path,
123 device_path_instance));
124}
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139static struct efi_device_path * EFIAPI get_next_device_path_instance(
140 struct efi_device_path **device_path_instance,
141 efi_uintn_t *device_path_instance_size)
142{
143 EFI_ENTRY("%pD, %p", device_path_instance, device_path_instance_size);
144 return EFI_EXIT(efi_dp_get_next_instance(device_path_instance,
145 device_path_instance_size));
146}
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161static bool EFIAPI is_device_path_multi_instance(
162 const struct efi_device_path *device_path)
163{
164 EFI_ENTRY("%pD", device_path);
165 return EFI_EXIT(efi_dp_is_multi_instance(device_path));
166}
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182static struct efi_device_path * EFIAPI create_device_node(
183 uint8_t node_type, uint8_t node_sub_type, uint16_t node_length)
184{
185 EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length);
186 return EFI_EXIT(efi_dp_create_device_node(node_type, node_sub_type,
187 node_length));
188}
189
190const struct efi_device_path_utilities_protocol efi_device_path_utilities = {
191 .get_device_path_size = get_device_path_size,
192 .duplicate_device_path = duplicate_device_path,
193 .append_device_path = append_device_path,
194 .append_device_node = append_device_node,
195 .append_device_path_instance = append_device_path_instance,
196 .get_next_device_path_instance = get_next_device_path_instance,
197 .is_device_path_multi_instance = is_device_path_multi_instance,
198 .create_device_node = create_device_node,
199};
200