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