]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/DevicePathUtilities.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / DevicePathUtilities.h
CommitLineData
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
30typedef\r
31UINTN\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 Create a duplicate of the specified path.\r
38\r
39 @param DevicePath Points to the source EFI device path.\r
40\r
41 @retval Pointer A pointer to the duplicate device path.\r
f1004231 42 @retval NULL insufficient memory or DevicePath is NULL\r
d1f95000 43\r
44**/\r
45typedef\r
2f88bd3a 46EFI_DEVICE_PATH_PROTOCOL *\r
8b13229b 47(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(\r
d1f95000 48 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
9095d37b 49 );\r
d1f95000 50\r
51/**\r
52 Create a new path by appending the second device path to the first.\r
9095d37b 53 If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.\r
f1004231
LG
54 If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.\r
55 If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.\r
d1f95000 56\r
f1004231
LG
57 @param Src1 Points to the first device path.\r
58 @param Src2 Points to the second device path.\r
d1f95000 59\r
60 @retval Pointer A pointer to the newly created device path.\r
61 @retval NULL Memory could not be allocated\r
d1f95000 62\r
63**/\r
64typedef\r
2f88bd3a 65EFI_DEVICE_PATH_PROTOCOL *\r
8b13229b 66(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(\r
d1f95000 67 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r
68 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r
9095d37b
LG
69 );\r
70\r
d1f95000 71/**\r
72 Creates a new path by appending the device node to the device path.\r
9095d37b 73 If DeviceNode is NULL then a copy of DevicePath is returned.\r
f1004231
LG
74 If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.\r
75 If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.\r
d1f95000 76\r
77 @param DevicePath Points to the device path.\r
78 @param DeviceNode Points to the device node.\r
79\r
80 @retval Pointer A pointer to the allocated device node.\r
f1004231 81 @retval NULL There was insufficient memory.\r
d1f95000 82\r
83**/\r
84typedef\r
2f88bd3a 85EFI_DEVICE_PATH_PROTOCOL *\r
8b13229b 86(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(\r
d1f95000 87 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
88 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r
ed66e1bc 89 );\r
d1f95000 90\r
91/**\r
92 Creates a new path by appending the specified device path instance to the specified device path.\r
93\r
94 @param DevicePath Points to the device path. If NULL, then ignored.\r
95 @param DevicePathInstance Points to the device path instance.\r
96\r
97 @retval Pointer A pointer to the newly created device path\r
98 @retval NULL Memory could not be allocated or DevicePathInstance is NULL.\r
99\r
100**/\r
101typedef\r
2f88bd3a 102EFI_DEVICE_PATH_PROTOCOL *\r
8b13229b 103(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(\r
d1f95000 104 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
105 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r
9095d37b 106 );\r
d1f95000 107\r
108/**\r
109 Creates a copy of the current device path instance and returns a pointer to the next device path\r
110 instance.\r
111\r
112 @param DevicePathInstance On input, this holds the pointer to the current device path\r
113 instance. On output, this holds the pointer to the next\r
114 device path instance or NULL if there are no more device\r
9095d37b 115 path instances in the device path.\r
d1f95000 116 @param DevicePathInstanceSize On output, this holds the size of the device path instance,\r
f1004231
LG
117 in bytes or zero, if DevicePathInstance is NULL.\r
118 If NULL, then the instance size is not output.\r
d1f95000 119\r
120 @retval Pointer A pointer to the copy of the current device path instance.\r
121 @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.\r
122\r
123**/\r
124typedef\r
2f88bd3a 125EFI_DEVICE_PATH_PROTOCOL *\r
8b13229b 126(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(\r
d1f95000 127 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r
128 OUT UINTN *DevicePathInstanceSize\r
9095d37b 129 );\r
d1f95000 130\r
131/**\r
132 Creates a device node\r
133\r
134 @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r
135 the new device node.\r
136 @param NodeSubType NodeSubType is the device node sub-type\r
137 EFI_DEVICE_PATH.SubType) for the new device node.\r
138 @param NodeLength NodeLength is the length of the device node\r
139 (EFI_DEVICE_PATH.Length) for the new device node.\r
140\r
141 @retval Pointer A pointer to the newly created device node.\r
142 @retval NULL NodeLength is less than\r
143 the size of the header or there was insufficient memory.\r
144\r
145**/\r
146typedef\r
2f88bd3a 147EFI_DEVICE_PATH_PROTOCOL *\r
37de2c84 148(EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(\r
d1f95000 149 IN UINT8 NodeType,\r
150 IN UINT8 NodeSubType,\r
151 IN UINT16 NodeLength\r
2f88bd3a 152 );\r
d1f95000 153\r
154/**\r
155 Returns whether a device path is multi-instance.\r
156\r
157 @param DevicePath Points to the device path. If NULL, then ignored.\r
158\r
159 @retval TRUE The device path has more than one instance\r
160 @retval FALSE The device path is empty or contains only a single instance.\r
161\r
162**/\r
163typedef\r
164BOOLEAN\r
8b13229b 165(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(\r
d1f95000 166 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
9095d37b
LG
167 );\r
168\r
44717a39 169///\r
170/// This protocol is used to creates and manipulates device paths and device nodes.\r
9095d37b 171///\r
d1f95000 172typedef struct {\r
2f88bd3a
MK
173 EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;\r
174 EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;\r
175 EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;\r
176 EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;\r
177 EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;\r
178 EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;\r
179 EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;\r
180 EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;\r
d1f95000 181} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;\r
182\r
2f88bd3a 183extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;\r
d1f95000 184\r
185#endif\r