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