]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
2 | Entry point to a DXE Boot Services Driver\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation \r | |
5 | All rights reserved. This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | Module Name: DevicePathLib.h\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __DEVICE_PATH_LIB_H__\r | |
18 | #define __DEVICE_PATH_LIB_H__\r | |
19 | \r | |
20 | /**\r | |
21 | Returns the size of a device path in bytes.\r | |
22 | \r | |
23 | This function returns the size, in bytes, of the device path data structure specified by\r | |
24 | DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.\r | |
25 | \r | |
26 | @param DevicePath A pointer to a device path data structure.\r | |
27 | \r | |
28 | @return The size of a device path in bytes.\r | |
29 | \r | |
30 | **/\r | |
31 | UINTN\r | |
32 | EFIAPI\r | |
33 | GetDevicePathSize (\r | |
34 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
35 | );\r | |
36 | \r | |
37 | /**\r | |
38 | Creates a new device path by appending a second device path to a first device path.\r | |
39 | \r | |
40 | This function allocates space for a new copy of the device path specified by DevicePath. If\r | |
41 | DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the\r | |
42 | contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer\r | |
43 | is returned. Otherwise, NULL is returned. \r | |
44 | \r | |
45 | @param DevicePath A pointer to a device path data structure.\r | |
46 | \r | |
47 | @return A pointer to the duplicated device path.\r | |
48 | \r | |
49 | **/\r | |
50 | EFI_DEVICE_PATH_PROTOCOL *\r | |
51 | EFIAPI\r | |
52 | DuplicateDevicePath (\r | |
53 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
54 | );\r | |
55 | \r | |
56 | /**\r | |
57 | Creates a new device path by appending a second device path to a first device path.\r | |
58 | \r | |
59 | This function creates a new device path by appending a copy of SecondDevicePath to a copy of\r | |
60 | FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from\r | |
61 | SecondDevicePath is retained. The newly created device path is returned. \r | |
62 | If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned. \r | |
63 | If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned. \r | |
64 | If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned. \r | |
65 | If there is not enough memory for the newly allocated buffer, then NULL is returned.\r | |
66 | The memory for the new device path is allocated from EFI boot services memory. It is the\r | |
67 | responsibility of the caller to free the memory allocated.\r | |
68 | \r | |
69 | @param FirstDevicePath A pointer to a device path data structure.\r | |
70 | @param SecondDevicePath A pointer to a device path data structure.\r | |
71 | \r | |
72 | @return A pointer to the new device path.\r | |
73 | \r | |
74 | **/\r | |
75 | EFI_DEVICE_PATH_PROTOCOL *\r | |
76 | EFIAPI\r | |
77 | AppendDevicePath (\r | |
78 | IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL\r | |
79 | IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL\r | |
80 | );\r | |
81 | \r | |
82 | /**\r | |
83 | Creates a new path by appending the device node to the device path.\r | |
84 | \r | |
85 | This function creates a new device path by appending a copy of the device node specified by\r | |
86 | DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.\r | |
87 | The end-of-device-path device node is moved after the end of the appended device node.\r | |
88 | If DevicePath is NULL, then NULL is returned.\r | |
89 | If DevicePathNode is NULL, then NULL is returned.\r | |
90 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r | |
91 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
92 | free the memory allocated.\r | |
93 | \r | |
94 | @param DevicePath A pointer to a device path data structure.\r | |
95 | @param DevicePathNode A pointer to a single device path node.\r | |
96 | \r | |
97 | @return A pointer to the new device path.\r | |
98 | \r | |
99 | **/\r | |
100 | EFI_DEVICE_PATH_PROTOCOL *\r | |
101 | EFIAPI\r | |
102 | AppendDevicePathNode (\r | |
103 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r | |
104 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL\r | |
105 | );\r | |
106 | \r | |
107 | /**\r | |
108 | Creates a new device path by appending the specified device path instance to the specified device\r | |
109 | path.\r | |
110 | \r | |
111 | This function creates a new device path by appending a copy of the device path instance specified\r | |
112 | by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.\r | |
113 | The end-of-device-path device node is moved after the end of the appended device path instance\r | |
114 | and a new end-of-device-path-instance node is inserted between. \r | |
115 | If DevicePath is NULL, then a copy if DevicePathInstance is returned.\r | |
116 | If DevicePathInstance is NULL, then NULL is returned.\r | |
117 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r | |
118 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
119 | free the memory allocated.\r | |
120 | \r | |
121 | @param DevicePath A pointer to a device path data structure.\r | |
122 | @param DevicePathInstance A pointer to a device path instance.\r | |
123 | \r | |
124 | @return A pointer to the new device path.\r | |
125 | \r | |
126 | **/\r | |
127 | EFI_DEVICE_PATH_PROTOCOL *\r | |
128 | EFIAPI\r | |
129 | AppendDevicePathInstance (\r | |
130 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r | |
131 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL\r | |
132 | );\r | |
133 | \r | |
134 | /**\r | |
135 | Creates a copy of the current device path instance and returns a pointer to the next device path\r | |
136 | instance.\r | |
137 | \r | |
138 | This function creates a copy of the current device path instance. It also updates DevicePath to\r | |
139 | point to the next device path instance in the device path (or NULL if no more) and updates Size\r | |
140 | to hold the size of the device path instance copy.\r | |
141 | If DevicePath is NULL, then NULL is returned.\r | |
142 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r | |
143 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
144 | free the memory allocated.\r | |
145 | If Size is NULL, then ASSERT().\r | |
146 | \r | |
147 | @param DevicePath On input, this holds the pointer to the current device path\r | |
148 | instance. On output, this holds the pointer to the next device\r | |
149 | path instance or NULL if there are no more device path\r | |
150 | instances in the device path pointer to a device path data\r | |
151 | structure.\r | |
152 | @param Size On output, this holds the size of the device path instance, in\r | |
153 | bytes or zero, if DevicePath is NULL.\r | |
154 | \r | |
155 | @return A pointer to the current device path instance.\r | |
156 | \r | |
157 | **/\r | |
158 | EFI_DEVICE_PATH_PROTOCOL *\r | |
159 | EFIAPI\r | |
160 | GetNextDevicePathInstance (\r | |
161 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r | |
162 | OUT UINTN *Size\r | |
163 | );\r | |
164 | \r | |
165 | /**\r | |
166 | Creates a copy of the current device path instance and returns a pointer to the next device path\r | |
167 | instance.\r | |
168 | \r | |
169 | This function creates a new device node in a newly allocated buffer of size NodeLength and\r | |
170 | initializes the device path node header with NodeType and NodeSubType. The new device path node\r | |
171 | is returned.\r | |
172 | If NodeLength is smaller than a device path header, then NULL is returned. \r | |
173 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r | |
174 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
175 | free the memory allocated.\r | |
176 | \r | |
177 | @param NodeType The device node type for the new device node.\r | |
178 | @param NodeSubType The device node sub-type for the new device node.\r | |
179 | @param NodeLength The length of the new device node.\r | |
180 | \r | |
181 | @return The new device path.\r | |
182 | \r | |
183 | **/\r | |
184 | EFI_DEVICE_PATH_PROTOCOL *\r | |
185 | EFIAPI\r | |
186 | CreateDeviceNode (\r | |
187 | IN UINT8 NodeType,\r | |
188 | IN UINT8 NodeSubType,\r | |
189 | IN UINT16 NodeLength\r | |
190 | );\r | |
191 | \r | |
192 | /**\r | |
193 | Determines if a device path is single or multi-instance.\r | |
194 | \r | |
195 | This function returns TRUE if the device path specified by DevicePath is multi-instance.\r | |
196 | Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.\r | |
197 | \r | |
198 | @param DevicePath A pointer to a device path data structure.\r | |
199 | \r | |
200 | @retval TRUE DevicePath is multi-instance.\r | |
201 | @retval FALSE DevicePath is not multi-instance or DevicePath is NULL.\r | |
202 | \r | |
203 | **/\r | |
204 | BOOLEAN\r | |
205 | EFIAPI\r | |
206 | IsDevicePathMultiInstance (\r | |
207 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
208 | );\r | |
209 | \r | |
210 | /**\r | |
211 | Retrieves the device path protocol from a handle.\r | |
212 | \r | |
213 | This function returns the device path protocol from the handle specified by Handle. If Handle is\r | |
214 | NULL or Handle does not contain a device path protocol, then NULL is returned.\r | |
215 | \r | |
216 | @param Handle The handle from which to retrieve the device path protocol.\r | |
217 | \r | |
218 | @return The device path protocol from the handle specified by Handle.\r | |
219 | \r | |
220 | **/\r | |
221 | EFI_DEVICE_PATH_PROTOCOL *\r | |
222 | EFIAPI\r | |
223 | DevicePathFromHandle (\r | |
224 | IN EFI_HANDLE Handle\r | |
225 | );\r | |
226 | \r | |
227 | /**\r | |
228 | Allocates a device path for a file and appends it to an existing device path.\r | |
229 | \r | |
230 | If Device is a valid device handle that contains a device path protocol, then a device path for\r | |
231 | the file specified by FileName is allocated and appended to the device path associated with the\r | |
232 | handle Device. The allocated device path is returned. If Device is NULL or Device is a handle\r | |
233 | that does not support the device path protocol, then a device path containing a single device\r | |
234 | path node for the file specified by FileName is allocated and returned.\r | |
235 | If FileName is NULL, then ASSERT().\r | |
236 | \r | |
237 | @param Device A pointer to a device handle. This parameter is optional and\r | |
238 | may be NULL.\r | |
239 | @param FileName A pointer to a Null-terminated Unicode string.\r | |
240 | \r | |
241 | @return The allocated device path.\r | |
242 | \r | |
243 | **/\r | |
244 | EFI_DEVICE_PATH_PROTOCOL *\r | |
245 | EFIAPI\r | |
246 | FileDevicePath (\r | |
247 | IN EFI_HANDLE Device, OPTIONAL\r | |
248 | IN CONST CHAR16 *FileName\r | |
249 | );\r | |
250 | \r | |
251 | #endif\r |