]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/DevicePathUtilities.h
Import Pal.h and Sal.h.
[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
5 Copyright (c) 2006, Intel Corporation \r
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
14 Module Name: DevicePathUtilities.h\r
15\r
16**/\r
17\r
18#ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r
19#define __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r
20\r
21\r
22#include <Protocol/DevicePath.h>\r
23\r
24//\r
25// Device Path Utilities protocol\r
26//\r
27#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \\r
28 { \\r
29 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \\r
30 }\r
31\r
32/**\r
33 Returns the size of the device path, in bytes.\r
34\r
35 @param DevicePath Points to the start of the EFI device path.\r
36\r
37 @revtal Size Size of the specified device path, in bytes, including the end-of-path tag.\r
38\r
39**/\r
40typedef\r
41UINTN\r
42(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) (\r
43 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
44 )\r
45; \r
46 \r
47\r
48/**\r
49 Create a duplicate of the specified path.\r
50\r
51 @param DevicePath Points to the source EFI device path.\r
52\r
53 @retval Pointer A pointer to the duplicate device path.\r
54 @retval NULL insufficient memory\r
55\r
56**/\r
57typedef\r
58EFI_DEVICE_PATH_PROTOCOL*\r
59(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) (\r
60 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
61 )\r
62; \r
63\r
64/**\r
65 Create a new path by appending the second device path to the first.\r
66\r
67 @param Src1 Points to the first device path. If NULL, then it is ignored.\r
68 @param Src2 Points to the second device path. If NULL, then it is ignored.\r
69\r
70 @retval Pointer A pointer to the newly created device path.\r
71 @retval NULL Memory could not be allocated\r
72 or either DevicePath or DeviceNode is NULL.\r
73\r
74**/\r
75typedef\r
76EFI_DEVICE_PATH_PROTOCOL*\r
77(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) (\r
78 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r
79 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r
80 )\r
81; \r
82 \r
83/**\r
84 Creates a new path by appending the device node to the device path.\r
85\r
86 @param DevicePath Points to the device path.\r
87 @param DeviceNode Points to the device node.\r
88\r
89 @retval Pointer A pointer to the allocated device node.\r
90 @retval NULL Memory could not be allocated\r
91 or either DevicePath or DeviceNode is NULL.\r
92\r
93**/\r
94typedef\r
95EFI_DEVICE_PATH_PROTOCOL*\r
96(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) (\r
97 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
98 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r
99 )\r
100;\r
101\r
102/**\r
103 Creates a new path by appending the specified device path instance to the specified device path.\r
104\r
105 @param DevicePath Points to the device path. If NULL, then ignored.\r
106 @param DevicePathInstance Points to the device path instance.\r
107\r
108 @retval Pointer A pointer to the newly created device path\r
109 @retval NULL Memory could not be allocated or DevicePathInstance is NULL.\r
110\r
111**/\r
112typedef\r
113EFI_DEVICE_PATH_PROTOCOL*\r
114(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) (\r
115 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
116 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r
117 )\r
118; \r
119\r
120/**\r
121 Creates a copy of the current device path instance and returns a pointer to the next device path\r
122 instance.\r
123\r
124 @param DevicePathInstance On input, this holds the pointer to the current device path\r
125 instance. On output, this holds the pointer to the next\r
126 device path instance or NULL if there are no more device\r
127 path instances in the device path. \r
128 @param DevicePathInstanceSize On output, this holds the size of the device path instance,\r
129 in bytes or zero, if DevicePathInstance is zero.\r
130\r
131 @retval Pointer A pointer to the copy of the current device path instance.\r
132 @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.\r
133\r
134**/\r
135typedef\r
136EFI_DEVICE_PATH_PROTOCOL*\r
137(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) (\r
138 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r
139 OUT UINTN *DevicePathInstanceSize\r
140 )\r
141; \r
142\r
143/**\r
144 Creates a device node\r
145\r
146 @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r
147 the new device node.\r
148 @param NodeSubType NodeSubType is the device node sub-type\r
149 EFI_DEVICE_PATH.SubType) for the new device node.\r
150 @param NodeLength NodeLength is the length of the device node\r
151 (EFI_DEVICE_PATH.Length) for the new device node.\r
152\r
153 @retval Pointer A pointer to the newly created device node.\r
154 @retval NULL NodeLength is less than\r
155 the size of the header or there was insufficient memory.\r
156\r
157**/\r
158typedef\r
159EFI_DEVICE_PATH_PROTOCOL*\r
160(EFIAPI *EFI_DEVICE_PATH_CREATE_NODE) (\r
161 IN UINT8 NodeType,\r
162 IN UINT8 NodeSubType,\r
163 IN UINT16 NodeLength\r
164)\r
165; \r
166\r
167/**\r
168 Returns whether a device path is multi-instance.\r
169\r
170 @param DevicePath Points to the device path. If NULL, then ignored.\r
171\r
172 @retval TRUE The device path has more than one instance\r
173 @retval FALSE The device path is empty or contains only a single instance.\r
174\r
175**/\r
176typedef\r
177BOOLEAN\r
178(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) (\r
179 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
180 )\r
181; \r
182 \r
183\r
184typedef struct {\r
185 EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;\r
186 EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;\r
187 EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;\r
188 EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;\r
189 EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;\r
190 EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;\r
191 EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;\r
192 EFI_DEVICE_PATH_CREATE_NODE CreateDeviceNode;\r
193} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;\r
194\r
195extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid; \r
196\r
197#endif\r