]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
9095d37b | 2 | EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.\r |
d1f95000 | 3 | Use to create and manipulate device paths and device nodes.\r |
4 | \r | |
9095d37b | 5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d1f95000 | 7 | \r |
d1f95000 | 8 | **/\r |
9 | \r | |
10 | #ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r | |
11 | #define __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r | |
12 | \r | |
99e8ed21 | 13 | ///\r |
14 | /// Device Path Utilities protocol\r | |
15 | ///\r | |
d1f95000 | 16 | #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \\r |
17 | { \\r | |
18 | 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \\r | |
19 | }\r | |
20 | \r | |
21 | /**\r | |
22 | Returns the size of the device path, in bytes.\r | |
23 | \r | |
24 | @param DevicePath Points to the start of the EFI device path.\r | |
25 | \r | |
f1004231 | 26 | @return Size Size of the specified device path, in bytes, including the end-of-path tag.\r |
9095d37b | 27 | @retval 0 DevicePath is NULL\r |
d1f95000 | 28 | \r |
29 | **/\r | |
30 | typedef\r | |
31 | UINTN\r | |
8b13229b | 32 | (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(\r |
d1f95000 | 33 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
9095d37b LG |
34 | );\r |
35 | \r | |
d1f95000 | 36 | \r |
37 | /**\r | |
38 | Create a duplicate of the specified path.\r | |
39 | \r | |
40 | @param DevicePath Points to the source EFI device path.\r | |
41 | \r | |
42 | @retval Pointer A pointer to the duplicate device path.\r | |
f1004231 | 43 | @retval NULL insufficient memory or DevicePath is NULL\r |
d1f95000 | 44 | \r |
45 | **/\r | |
46 | typedef\r | |
47 | EFI_DEVICE_PATH_PROTOCOL*\r | |
8b13229b | 48 | (EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(\r |
d1f95000 | 49 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
9095d37b | 50 | );\r |
d1f95000 | 51 | \r |
52 | /**\r | |
53 | Create a new path by appending the second device path to the first.\r | |
9095d37b | 54 | If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.\r |
f1004231 LG |
55 | If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.\r |
56 | If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.\r | |
d1f95000 | 57 | \r |
f1004231 LG |
58 | @param Src1 Points to the first device path.\r |
59 | @param Src2 Points to the second device path.\r | |
d1f95000 | 60 | \r |
61 | @retval Pointer A pointer to the newly created device path.\r | |
62 | @retval NULL Memory could not be allocated\r | |
d1f95000 | 63 | \r |
64 | **/\r | |
65 | typedef\r | |
66 | EFI_DEVICE_PATH_PROTOCOL*\r | |
8b13229b | 67 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(\r |
d1f95000 | 68 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r |
69 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
9095d37b LG |
70 | );\r |
71 | \r | |
d1f95000 | 72 | /**\r |
73 | Creates a new path by appending the device node to the device path.\r | |
9095d37b | 74 | If DeviceNode is NULL then a copy of DevicePath is returned.\r |
f1004231 LG |
75 | If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.\r |
76 | If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.\r | |
d1f95000 | 77 | \r |
78 | @param DevicePath Points to the device path.\r | |
79 | @param DeviceNode Points to the device node.\r | |
80 | \r | |
81 | @retval Pointer A pointer to the allocated device node.\r | |
f1004231 | 82 | @retval NULL There was insufficient memory.\r |
d1f95000 | 83 | \r |
84 | **/\r | |
85 | typedef\r | |
86 | EFI_DEVICE_PATH_PROTOCOL*\r | |
8b13229b | 87 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(\r |
d1f95000 | 88 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
89 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r | |
ed66e1bc | 90 | );\r |
d1f95000 | 91 | \r |
92 | /**\r | |
93 | Creates a new path by appending the specified device path instance to the specified device path.\r | |
94 | \r | |
95 | @param DevicePath Points to the device path. If NULL, then ignored.\r | |
96 | @param DevicePathInstance Points to the device path instance.\r | |
97 | \r | |
98 | @retval Pointer A pointer to the newly created device path\r | |
99 | @retval NULL Memory could not be allocated or DevicePathInstance is NULL.\r | |
100 | \r | |
101 | **/\r | |
102 | typedef\r | |
103 | EFI_DEVICE_PATH_PROTOCOL*\r | |
8b13229b | 104 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(\r |
d1f95000 | 105 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
106 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r | |
9095d37b | 107 | );\r |
d1f95000 | 108 | \r |
109 | /**\r | |
110 | Creates a copy of the current device path instance and returns a pointer to the next device path\r | |
111 | instance.\r | |
112 | \r | |
113 | @param DevicePathInstance On input, this holds the pointer to the current device path\r | |
114 | instance. On output, this holds the pointer to the next\r | |
115 | device path instance or NULL if there are no more device\r | |
9095d37b | 116 | path instances in the device path.\r |
d1f95000 | 117 | @param DevicePathInstanceSize On output, this holds the size of the device path instance,\r |
f1004231 LG |
118 | in bytes or zero, if DevicePathInstance is NULL.\r |
119 | If NULL, then the instance size is not output.\r | |
d1f95000 | 120 | \r |
121 | @retval Pointer A pointer to the copy of the current device path instance.\r | |
122 | @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.\r | |
123 | \r | |
124 | **/\r | |
125 | typedef\r | |
126 | EFI_DEVICE_PATH_PROTOCOL*\r | |
8b13229b | 127 | (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(\r |
d1f95000 | 128 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r |
129 | OUT UINTN *DevicePathInstanceSize\r | |
9095d37b | 130 | );\r |
d1f95000 | 131 | \r |
132 | /**\r | |
133 | Creates a device node\r | |
134 | \r | |
135 | @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r | |
136 | the new device node.\r | |
137 | @param NodeSubType NodeSubType is the device node sub-type\r | |
138 | EFI_DEVICE_PATH.SubType) for the new device node.\r | |
139 | @param NodeLength NodeLength is the length of the device node\r | |
140 | (EFI_DEVICE_PATH.Length) for the new device node.\r | |
141 | \r | |
142 | @retval Pointer A pointer to the newly created device node.\r | |
143 | @retval NULL NodeLength is less than\r | |
144 | the size of the header or there was insufficient memory.\r | |
145 | \r | |
146 | **/\r | |
147 | typedef\r | |
148 | EFI_DEVICE_PATH_PROTOCOL*\r | |
37de2c84 | 149 | (EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(\r |
d1f95000 | 150 | IN UINT8 NodeType,\r |
151 | IN UINT8 NodeSubType,\r | |
152 | IN UINT16 NodeLength\r | |
9095d37b | 153 | );\r |
d1f95000 | 154 | \r |
155 | /**\r | |
156 | Returns whether a device path is multi-instance.\r | |
157 | \r | |
158 | @param DevicePath Points to the device path. If NULL, then ignored.\r | |
159 | \r | |
160 | @retval TRUE The device path has more than one instance\r | |
161 | @retval FALSE The device path is empty or contains only a single instance.\r | |
162 | \r | |
163 | **/\r | |
164 | typedef\r | |
165 | BOOLEAN\r | |
8b13229b | 166 | (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(\r |
d1f95000 | 167 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
9095d37b LG |
168 | );\r |
169 | \r | |
44717a39 | 170 | ///\r |
171 | /// This protocol is used to creates and manipulates device paths and device nodes.\r | |
9095d37b | 172 | ///\r |
d1f95000 | 173 | typedef struct {\r |
174 | EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;\r | |
175 | EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;\r | |
176 | EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;\r | |
177 | EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;\r | |
178 | EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;\r | |
179 | EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;\r | |
180 | EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;\r | |
37de2c84 | 181 | EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;\r |
d1f95000 | 182 | } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;\r |
183 | \r | |
9095d37b | 184 | extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;\r |
d1f95000 | 185 | \r |
186 | #endif\r |