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