]>
Commit | Line | Data |
---|---|---|
ddac74d1 | 1 | /** @file\r |
49fd8a35 | 2 | Generic BDS library defines general interfaces for a BDS driver, including:\r |
3 | 1) BDS boot policy interface.\r | |
4 | 2) BDS boot device connect interface.\r | |
920d2c23 | 5 | 3) BDS Misc interfaces for mainting boot variable, ouput string.\r |
ddac74d1 | 6 | \r |
18cf3950 | 7 | Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r |
49fd8a35 | 8 | This program and the accompanying materials are licensed and made available under \r |
9 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
10 | The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php. \r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
ddac74d1 | 14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef _GENERIC_BDS_LIB_H_\r | |
19 | #define _GENERIC_BDS_LIB_H_\r | |
20 | \r | |
337661bb | 21 | #include <Protocol/UserManager.h>\r |
ddac74d1 | 22 | \r |
e83c9064 | 23 | ///\r |
49fd8a35 | 24 | /// Constants which are variable names used to access variables.\r |
e83c9064 | 25 | ///\r |
ddac74d1 | 26 | #define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r |
27 | \r | |
e83c9064 | 28 | ///\r |
49fd8a35 | 29 | /// Data structures and defines.\r |
e83c9064 | 30 | ///\r |
ddac74d1 | 31 | #define FRONT_PAGE_QUESTION_ID 0x0000\r |
32 | #define FRONT_PAGE_DATA_WIDTH 0x01\r | |
33 | \r | |
e83c9064 LG |
34 | ///\r |
35 | /// ConnectType\r | |
36 | ///\r | |
ddac74d1 | 37 | #define CONSOLE_OUT 0x00000001\r |
38 | #define STD_ERROR 0x00000002\r | |
39 | #define CONSOLE_IN 0x00000004\r | |
40 | #define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r | |
41 | \r | |
e83c9064 LG |
42 | ///\r |
43 | /// Load Option Attributes\r | |
44 | ///\r | |
ddac74d1 | 45 | #define LOAD_OPTION_ACTIVE 0x00000001\r |
46 | #define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r | |
47 | \r | |
48 | #define LOAD_OPTION_HIDDEN 0x00000008\r | |
49 | #define LOAD_OPTION_CATEGORY 0x00001F00\r | |
50 | \r | |
51 | #define LOAD_OPTION_CATEGORY_BOOT 0x00000000\r | |
52 | #define LOAD_OPTION_CATEGORY_APP 0x00000100\r | |
53 | \r | |
54 | #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001\r | |
55 | #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002\r | |
56 | \r | |
57 | #define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)\r | |
58 | \r | |
e83c9064 | 59 | ///\r |
49fd8a35 | 60 | /// Define the maximum characters that will be accepted.\r |
e83c9064 | 61 | ///\r |
ddac74d1 | 62 | #define MAX_CHAR 480\r |
63 | #define MAX_CHAR_SIZE (MAX_CHAR * 2)\r | |
64 | \r | |
e83c9064 | 65 | ///\r |
49fd8a35 | 66 | /// Define maximum characters for boot option variable "BootXXXX".\r |
e83c9064 | 67 | ///\r |
ddac74d1 | 68 | #define BOOT_OPTION_MAX_CHAR 10\r |
69 | \r | |
70 | //\r | |
e83c9064 | 71 | // This data structure is the part of BDS_CONNECT_ENTRY\r |
ddac74d1 | 72 | //\r |
73 | #define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O')\r | |
74 | \r | |
75 | typedef struct {\r | |
76 | \r | |
77 | UINTN Signature;\r | |
78 | LIST_ENTRY Link;\r | |
79 | \r | |
80 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
81 | \r | |
82 | CHAR16 *OptionName;\r | |
83 | UINTN OptionNumber;\r | |
84 | UINT16 BootCurrent;\r | |
85 | UINT32 Attribute;\r | |
86 | CHAR16 *Description;\r | |
87 | VOID *LoadOptions;\r | |
88 | UINT32 LoadOptionsSize;\r | |
89 | CHAR16 *StatusString;\r | |
90 | \r | |
91 | } BDS_COMMON_OPTION;\r | |
92 | \r | |
93 | typedef struct {\r | |
94 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
95 | UINTN ConnectType;\r | |
96 | } BDS_CONSOLE_CONNECT_ENTRY;\r | |
97 | \r | |
ddac74d1 | 98 | //\r |
99 | // Bds boot related lib functions\r | |
100 | //\r | |
101 | /**\r | |
102 | Boot from the UEFI spec defined "BootNext" variable.\r | |
103 | \r | |
104 | **/\r | |
105 | VOID\r | |
106 | EFIAPI\r | |
107 | BdsLibBootNext (\r | |
108 | VOID\r | |
109 | );\r | |
110 | \r | |
111 | /**\r | |
d0bd68b2 | 112 | Process the boot option according to the UEFI specification. The legacy boot option device path includes BBS_DEVICE_PATH.\r |
ddac74d1 | 113 | \r |
49fd8a35 | 114 | @param Option The boot option to be processed.\r |
3d8bd97c | 115 | @param DevicePath The device path describing where to load the\r |
ddac74d1 | 116 | boot image or the legcy BBS device path to boot\r |
49fd8a35 | 117 | the legacy OS.\r |
ddac74d1 | 118 | @param ExitDataSize The size of exit data.\r |
119 | @param ExitData Data returned when Boot image failed.\r | |
120 | \r | |
3d8bd97c | 121 | @retval EFI_SUCCESS Boot from the input boot option succeeded.\r |
49fd8a35 | 122 | @retval EFI_NOT_FOUND The Device Path is not found in the system.\r |
ddac74d1 | 123 | \r |
124 | **/\r | |
125 | EFI_STATUS\r | |
126 | EFIAPI\r | |
127 | BdsLibBootViaBootOption (\r | |
128 | IN BDS_COMMON_OPTION * Option,\r | |
129 | IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r | |
130 | OUT UINTN *ExitDataSize,\r | |
131 | OUT CHAR16 **ExitData OPTIONAL\r | |
132 | );\r | |
133 | \r | |
134 | \r | |
135 | /**\r | |
3d8bd97c | 136 | This function will enumerate all possible boot devices in the system, and\r |
137 | automatically create boot options for Network, Shell, Removable BlockIo, \r | |
138 | and Non-BlockIo Simplefile devices. \r | |
139 | \r | |
140 | BDS separates EFI boot options into six types:\r | |
8d3b5aff | 141 | 1. Network - The boot option points to the SimpleNetworkProtocol device. \r |
3d8bd97c | 142 | Bds will try to automatically create this type of boot option during enumeration.\r |
8d3b5aff | 143 | 2. Shell - The boot option points to internal flash shell. \r |
3d8bd97c | 144 | Bds will try to automatically create this type of boot option during enumeration.\r |
145 | 3. Removable BlockIo - The boot option points to a removable media\r | |
146 | device, such as a USB flash drive or DVD drive.\r | |
147 | These devices should contain a *removable* blockIo\r | |
8d3b5aff | 148 | protocol in their device handle.\r |
149 | Bds will try to automatically create this type boot option \r | |
150 | when enumerate.\r | |
3d8bd97c | 151 | 4. Fixed BlockIo - The boot option points to a Fixed blockIo device, \r |
152 | such as a hard disk.\r | |
153 | These devices should contain a *fixed* blockIo\r | |
8d3b5aff | 154 | protocol in their device handle.\r |
3d8bd97c | 155 | BDS will skip fixed blockIo devices, and not\r |
8d3b5aff | 156 | automatically create boot option for them. But BDS \r |
3d8bd97c | 157 | will help to delete those fixed blockIo boot options, \r |
158 | whose description rules conflict with other auto-created\r | |
8d3b5aff | 159 | boot options.\r |
160 | 5. Non-BlockIo Simplefile - The boot option points to a device whose handle \r | |
161 | has SimpleFileSystem Protocol, but has no blockio\r | |
162 | protocol. These devices do not offer blockIo\r | |
163 | protocol, but BDS still can get the \r | |
164 | \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem\r | |
165 | Protocol.\r | |
166 | 6. File - The boot option points to a file. These boot options are usually \r | |
3d8bd97c | 167 | created by the user, either manually or with an OS loader. BDS will not delete or modify\r |
8d3b5aff | 168 | these boot options. \r |
169 | \r | |
3d8bd97c | 170 | This function will enumerate all possible boot devices in the system, and\r |
8d3b5aff | 171 | automatically create boot options for Network, Shell, Removable BlockIo, \r |
172 | and Non-BlockIo Simplefile devices.\r | |
3d8bd97c | 173 | It will excute once every boot.\r |
8d3b5aff | 174 | \r |
3d8bd97c | 175 | @param BdsBootOptionList The header of the linked list that indexed all\r |
49fd8a35 | 176 | current boot options.\r |
ddac74d1 | 177 | \r |
49fd8a35 | 178 | @retval EFI_SUCCESS Finished all the boot device enumerations and \r |
179 | created the boot option based on the boot device.\r | |
ddac74d1 | 180 | \r |
49fd8a35 | 181 | @retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create \r |
182 | the boot option list.\r | |
ddac74d1 | 183 | **/\r |
184 | EFI_STATUS\r | |
185 | EFIAPI\r | |
186 | BdsLibEnumerateAllBootOption (\r | |
187 | IN OUT LIST_ENTRY *BdsBootOptionList\r | |
188 | );\r | |
189 | \r | |
190 | /**\r | |
49fd8a35 | 191 | Build the boot option with the handle parsed in.\r |
ddac74d1 | 192 | \r |
49fd8a35 | 193 | @param Handle The handle representing the device path for which \r |
194 | to create a boot option.\r | |
195 | @param BdsBootOptionList The header of the link list that indexed all\r | |
196 | current boot options.\r | |
ddac74d1 | 197 | @param String The description of the boot option.\r |
198 | \r | |
199 | **/\r | |
200 | VOID\r | |
201 | EFIAPI\r | |
202 | BdsLibBuildOptionFromHandle (\r | |
203 | IN EFI_HANDLE Handle,\r | |
204 | IN LIST_ENTRY *BdsBootOptionList,\r | |
205 | IN CHAR16 *String\r | |
206 | );\r | |
207 | \r | |
208 | \r | |
209 | /**\r | |
210 | Build the on flash shell boot option with the handle parsed in.\r | |
211 | \r | |
212 | @param Handle The handle which present the device path to create\r | |
49fd8a35 | 213 | the on flash shell boot option.\r |
214 | @param BdsBootOptionList The header of the link list that indexed all\r | |
215 | current boot options.\r | |
ddac74d1 | 216 | \r |
217 | **/\r | |
218 | VOID\r | |
219 | EFIAPI\r | |
220 | BdsLibBuildOptionFromShell (\r | |
221 | IN EFI_HANDLE Handle,\r | |
222 | IN OUT LIST_ENTRY *BdsBootOptionList\r | |
223 | );\r | |
224 | \r | |
225 | //\r | |
226 | // Bds misc lib functions\r | |
227 | //\r | |
ddac74d1 | 228 | /**\r |
49fd8a35 | 229 | Get boot mode by looking up the configuration table and parsing the HOB list.\r |
ddac74d1 | 230 | \r |
49fd8a35 | 231 | @param BootMode The boot mode from PEI handoff HOB.\r |
ddac74d1 | 232 | \r |
49fd8a35 | 233 | @retval EFI_SUCCESS Successfully got boot mode.\r |
ddac74d1 | 234 | \r |
235 | **/\r | |
236 | EFI_STATUS\r | |
237 | EFIAPI\r | |
238 | BdsLibGetBootMode (\r | |
239 | OUT EFI_BOOT_MODE *BootMode\r | |
240 | );\r | |
241 | \r | |
242 | \r | |
243 | /**\r | |
3d8bd97c | 244 | The function will go through the driver option link list, and then load and start\r |
245 | every driver to which the driver option device path points.\r | |
ddac74d1 | 246 | \r |
49fd8a35 | 247 | @param BdsDriverLists The header of the current driver option link list.\r |
ddac74d1 | 248 | \r |
249 | **/\r | |
250 | VOID\r | |
251 | EFIAPI\r | |
252 | BdsLibLoadDrivers (\r | |
253 | IN LIST_ENTRY *BdsDriverLists\r | |
254 | );\r | |
255 | \r | |
256 | \r | |
257 | /**\r | |
d0bd68b2 | 258 | This function processes BootOrder or DriverOrder variables, by calling\r |
259 | \r | |
ddac74d1 | 260 | BdsLibVariableToOption () for each UINT16 in the variables.\r |
261 | \r | |
49fd8a35 | 262 | @param BdsCommonOptionList The header of the option list base on the variable\r |
263 | VariableName.\r | |
264 | @param VariableName An EFI Variable name indicate the BootOrder or\r | |
265 | DriverOrder.\r | |
24cdd14e | 266 | \r |
49fd8a35 | 267 | @retval EFI_SUCCESS Successfully created the boot option or driver option\r |
268 | list.\r | |
269 | @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or the driver option list.\r | |
24cdd14e | 270 | **/\r |
ddac74d1 | 271 | EFI_STATUS\r |
272 | EFIAPI\r | |
273 | BdsLibBuildOptionFromVar (\r | |
274 | IN LIST_ENTRY *BdsCommonOptionList,\r | |
275 | IN CHAR16 *VariableName\r | |
276 | );\r | |
277 | \r | |
278 | /**\r | |
3d8bd97c | 279 | This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated\r |
49fd8a35 | 280 | buffer and the size of the buffer. If it fails, return NULL.\r |
ddac74d1 | 281 | \r |
49fd8a35 | 282 | @param Name The string part of the EFI variable name.\r |
283 | @param VendorGuid The GUID part of the EFI variable name.\r | |
284 | @param VariableSize Returns the size of the EFI variable that was read.\r | |
ddac74d1 | 285 | \r |
49fd8a35 | 286 | @return Dynamically allocated memory that contains a copy \r |
287 | of the EFI variable. The caller is responsible for \r | |
288 | freeing the buffer.\r | |
289 | @retval NULL The variable was not read.\r | |
ddac74d1 | 290 | \r |
291 | **/\r | |
292 | VOID *\r | |
293 | EFIAPI\r | |
294 | BdsLibGetVariableAndSize (\r | |
295 | IN CHAR16 *Name,\r | |
296 | IN EFI_GUID *VendorGuid,\r | |
297 | OUT UINTN *VariableSize\r | |
298 | );\r | |
299 | \r | |
300 | \r | |
301 | /**\r | |
302 | This function prints a series of strings.\r | |
303 | \r | |
49fd8a35 | 304 | @param ConOut A pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.\r |
305 | @param ... A variable argument list containing a series of\r | |
ddac74d1 | 306 | strings, the last string must be NULL.\r |
307 | \r | |
49fd8a35 | 308 | @retval EFI_SUCCESS Successfully printed out the string using ConOut.\r |
ddac74d1 | 309 | @retval EFI_STATUS Return the status of the ConOut->OutputString ().\r |
310 | \r | |
311 | **/\r | |
312 | EFI_STATUS\r | |
313 | EFIAPI\r | |
314 | BdsLibOutputStrings (\r | |
315 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,\r | |
316 | ...\r | |
317 | );\r | |
318 | \r | |
319 | /**\r | |
3d8bd97c | 320 | Build the boot#### or driver#### option from the VariableName. The\r |
ddac74d1 | 321 | build boot#### or driver#### will also be linked to BdsCommonOptionList.\r |
322 | \r | |
323 | @param BdsCommonOptionList The header of the boot#### or driver#### option\r | |
49fd8a35 | 324 | link list.\r |
3d8bd97c | 325 | @param VariableName EFI Variable name, indicates if it is boot#### or\r |
49fd8a35 | 326 | driver####.\r |
ddac74d1 | 327 | \r |
49fd8a35 | 328 | @retval BDS_COMMON_OPTION The option that was created.\r |
329 | @retval NULL Failed to get the new option.\r | |
ddac74d1 | 330 | \r |
331 | **/\r | |
332 | BDS_COMMON_OPTION *\r | |
333 | EFIAPI\r | |
334 | BdsLibVariableToOption (\r | |
335 | IN OUT LIST_ENTRY *BdsCommonOptionList,\r | |
336 | IN CHAR16 *VariableName\r | |
337 | );\r | |
338 | \r | |
339 | /**\r | |
3d8bd97c | 340 | This function registers the new boot#### or driver#### option based on\r |
ddac74d1 | 341 | the VariableName. The new registered boot#### or driver#### will be linked\r |
342 | to BdsOptionList and also update to the VariableName. After the boot#### or\r | |
343 | driver#### updated, the BootOrder or DriverOrder will also be updated.\r | |
344 | \r | |
49fd8a35 | 345 | @param BdsOptionList The header of the boot#### or driver#### link list.\r |
346 | @param DevicePath The device path that the boot#### or driver####\r | |
347 | option present.\r | |
348 | @param String The description of the boot#### or driver####.\r | |
349 | @param VariableName Indicate if the boot#### or driver#### option.\r | |
ddac74d1 | 350 | \r |
49fd8a35 | 351 | @retval EFI_SUCCESS The boot#### or driver#### have been successfully\r |
352 | registered.\r | |
ddac74d1 | 353 | @retval EFI_STATUS Return the status of gRT->SetVariable ().\r |
354 | \r | |
355 | **/\r | |
356 | EFI_STATUS\r | |
357 | EFIAPI\r | |
358 | BdsLibRegisterNewOption (\r | |
359 | IN LIST_ENTRY *BdsOptionList,\r | |
360 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
361 | IN CHAR16 *String,\r | |
362 | IN CHAR16 *VariableName\r | |
363 | );\r | |
364 | \r | |
365 | //\r | |
3d8bd97c | 366 | // Bds connect and disconnect driver lib funcions\r |
ddac74d1 | 367 | //\r |
368 | /**\r | |
3d8bd97c | 369 | This function connects all system drivers with the corresponding controllers. \r |
ddac74d1 | 370 | \r |
371 | **/\r | |
372 | VOID\r | |
373 | EFIAPI\r | |
374 | BdsLibConnectAllDriversToAllControllers (\r | |
375 | VOID\r | |
376 | );\r | |
377 | \r | |
378 | /**\r | |
3d8bd97c | 379 | This function connects all system drivers to controllers.\r |
ddac74d1 | 380 | \r |
381 | **/\r | |
382 | VOID\r | |
383 | EFIAPI\r | |
384 | BdsLibConnectAll (\r | |
385 | VOID\r | |
386 | );\r | |
387 | \r | |
388 | /**\r | |
d0bd68b2 | 389 | This function creates all handles associated with the given device\r |
49fd8a35 | 390 | path node. If the handle associated with one device path node cannot\r |
3d8bd97c | 391 | be created, then it tries to execute the dispatch to load the missing drivers. \r |
ddac74d1 | 392 | \r |
3d8bd97c | 393 | @param DevicePathToConnect The device path to be connected. Can be\r |
49fd8a35 | 394 | a multi-instance device path.\r |
ddac74d1 | 395 | \r |
3d8bd97c | 396 | @retval EFI_SUCCESS All handles associates with every device path node\r |
49fd8a35 | 397 | were created.\r |
398 | @retval EFI_OUT_OF_RESOURCES Not enough resources to create new handles.\r | |
399 | @retval EFI_NOT_FOUND At least one handle could not be created.\r | |
ddac74d1 | 400 | \r |
401 | **/\r | |
402 | EFI_STATUS\r | |
403 | EFIAPI\r | |
404 | BdsLibConnectDevicePath (\r | |
405 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r | |
406 | );\r | |
407 | \r | |
408 | /**\r | |
49fd8a35 | 409 | This function will connect all current system handles recursively. \r |
410 | gBS->ConnectController() service is invoked for each handle exist in system handler buffer. \r | |
411 | If the handle is bus type handler, all childrens also will be connected recursively by gBS->ConnectController().\r | |
412 | \r | |
413 | @retval EFI_SUCCESS All handles and child handles have been\r | |
414 | connected. \r | |
415 | @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r | |
ddac74d1 | 416 | **/\r |
417 | EFI_STATUS\r | |
418 | EFIAPI\r | |
419 | BdsLibConnectAllEfi (\r | |
420 | VOID\r | |
421 | );\r | |
422 | \r | |
ddac74d1 | 423 | /**\r |
49fd8a35 | 424 | This function will disconnect all current system handles. \r |
425 | gBS->DisconnectController() is invoked for each handle exists in system handle buffer. \r | |
426 | If handle is a bus type handle, all childrens also are disconnected recursively by gBS->DisconnectController().\r | |
427 | \r | |
428 | @retval EFI_SUCCESS All handles have been disconnected.\r | |
0977c9b2 | 429 | @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer().\r |
ddac74d1 | 430 | \r |
431 | **/\r | |
432 | EFI_STATUS\r | |
433 | EFIAPI\r | |
434 | BdsLibDisconnectAllEfi (\r | |
435 | VOID\r | |
436 | );\r | |
437 | \r | |
438 | //\r | |
439 | // Bds console related lib functions\r | |
440 | //\r | |
441 | /**\r | |
3d8bd97c | 442 | This function will search every simpletxt device in the current system,\r |
d0bd68b2 | 443 | and make every simpletxt device a potential console device.\r |
ddac74d1 | 444 | \r |
445 | **/\r | |
446 | VOID\r | |
447 | EFIAPI\r | |
448 | BdsLibConnectAllConsoles (\r | |
449 | VOID\r | |
450 | );\r | |
451 | \r | |
452 | \r | |
453 | /**\r | |
3d8bd97c | 454 | This function will connect console device based on the console\r |
ddac74d1 | 455 | device variable ConIn, ConOut and ErrOut.\r |
456 | \r | |
3d8bd97c | 457 | @retval EFI_SUCCESS At least one of the ConIn and ConOut devices have\r |
458 | been connected.\r | |
ddac74d1 | 459 | @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().\r |
460 | \r | |
461 | **/\r | |
462 | EFI_STATUS\r | |
463 | EFIAPI\r | |
464 | BdsLibConnectAllDefaultConsoles (\r | |
465 | VOID\r | |
466 | );\r | |
467 | \r | |
18cf3950 | 468 | \r |
469 | /**\r | |
470 | This function will connect console device except ConIn base on the console\r | |
471 | device variable ConOut and ErrOut.\r | |
472 | \r | |
473 | @retval EFI_SUCCESS At least one of the ConOut device have\r | |
474 | been connected success.\r | |
475 | @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().\r | |
476 | \r | |
477 | **/\r | |
478 | EFI_STATUS\r | |
479 | EFIAPI\r | |
480 | BdsLibConnectAllDefaultConsolesWithOutConIn (\r | |
481 | VOID\r | |
482 | );\r | |
483 | \r | |
484 | \r | |
ddac74d1 | 485 | /**\r |
3d8bd97c | 486 | This function updates the console variable based on ConVarName. It can\r |
ddac74d1 | 487 | add or remove one specific console device path from the variable\r |
488 | \r | |
49fd8a35 | 489 | @param ConVarName The console-related variable name: ConIn, ConOut,\r |
ddac74d1 | 490 | ErrOut.\r |
3d8bd97c | 491 | @param CustomizedConDevicePath The console device path to be added to\r |
49fd8a35 | 492 | the console variable ConVarName. Cannot be multi-instance.\r |
3d8bd97c | 493 | @param ExclusiveDevicePath The console device path to be removed\r |
49fd8a35 | 494 | from the console variable ConVarName. Cannot be multi-instance.\r |
3d8bd97c | 495 | \r |
496 | @retval EFI_UNSUPPORTED The added device path is the same as a removed one.\r | |
497 | @retval EFI_SUCCESS Successfully added or removed the device path from the\r | |
ddac74d1 | 498 | console variable.\r |
499 | \r | |
500 | **/\r | |
501 | EFI_STATUS\r | |
502 | EFIAPI\r | |
503 | BdsLibUpdateConsoleVariable (\r | |
504 | IN CHAR16 *ConVarName,\r | |
505 | IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r | |
506 | IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r | |
507 | );\r | |
508 | \r | |
509 | /**\r | |
3d8bd97c | 510 | Connect the console device base on the variable ConVarName. If\r |
511 | ConVarName is a multi-instance device path, and at least one\r | |
512 | instance connects successfully, then this function\r | |
ddac74d1 | 513 | will return success.\r |
514 | \r | |
49fd8a35 | 515 | @param ConVarName The console related variable name: ConIn, ConOut,\r |
ddac74d1 | 516 | ErrOut.\r |
517 | \r | |
3d8bd97c | 518 | @retval EFI_NOT_FOUND No console devices were connected successfully\r |
519 | @retval EFI_SUCCESS Connected at least one instance of the console\r | |
520 | device path based on the variable ConVarName.\r | |
ddac74d1 | 521 | \r |
522 | **/\r | |
523 | EFI_STATUS\r | |
524 | EFIAPI\r | |
525 | BdsLibConnectConsoleVariable (\r | |
526 | IN CHAR16 *ConVarName\r | |
527 | );\r | |
528 | \r | |
529 | //\r | |
530 | // Bds device path related lib functions\r | |
531 | //\r | |
532 | /**\r | |
49fd8a35 | 533 | Delete the instance in Multi that overlaps with Single. \r |
ddac74d1 | 534 | \r |
535 | @param Multi A pointer to a multi-instance device path data\r | |
536 | structure.\r | |
537 | @param Single A pointer to a single-instance device path data\r | |
538 | structure.\r | |
539 | \r | |
3d8bd97c | 540 | @return This function removes the device path instances in Multi that overlap\r |
49fd8a35 | 541 | Single, and returns the resulting device path. If there is no\r |
ddac74d1 | 542 | remaining device path as a result, this function will return NULL.\r |
543 | \r | |
544 | **/\r | |
545 | EFI_DEVICE_PATH_PROTOCOL *\r | |
546 | EFIAPI\r | |
547 | BdsLibDelPartMatchInstance (\r | |
548 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
549 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
550 | );\r | |
551 | \r | |
552 | /**\r | |
49fd8a35 | 553 | This function compares a device path data structure to that of all the nodes of a\r |
ddac74d1 | 554 | second device path instance.\r |
555 | \r | |
556 | @param Multi A pointer to a multi-instance device path data\r | |
557 | structure.\r | |
558 | @param Single A pointer to a single-instance device path data\r | |
559 | structure.\r | |
560 | \r | |
49fd8a35 | 561 | @retval TRUE If the Single device path is contained within a \r |
562 | Multi device path.\r | |
563 | @retval FALSE The Single device path is not contained within a \r | |
564 | Multi device path.\r | |
ddac74d1 | 565 | \r |
566 | **/\r | |
567 | BOOLEAN\r | |
568 | EFIAPI\r | |
569 | BdsLibMatchDevicePaths (\r | |
570 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
571 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
572 | );\r | |
573 | \r | |
574 | /**\r | |
575 | This function converts an input device structure to a Unicode string.\r | |
576 | \r | |
577 | @param DevPath A pointer to the device path structure.\r | |
578 | \r | |
49fd8a35 | 579 | @return A newly allocated Unicode string that represents the device path.\r |
ddac74d1 | 580 | \r |
581 | **/\r | |
582 | CHAR16 *\r | |
583 | EFIAPI\r | |
584 | DevicePathToStr (\r | |
585 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
586 | );\r | |
587 | \r | |
ddac74d1 | 588 | //\r |
589 | // Internal definitions\r | |
590 | //\r | |
591 | typedef struct {\r | |
b4b6c8de LG |
592 | CHAR16 *Str;\r |
593 | UINTN Len;\r | |
594 | UINTN Maxlen;\r | |
ddac74d1 | 595 | } POOL_PRINT;\r |
596 | \r | |
8e8ae2da | 597 | typedef\r |
598 | VOID\r | |
599 | (*DEV_PATH_FUNCTION) (\r | |
600 | IN OUT POOL_PRINT *Str,\r | |
601 | IN VOID *DevPath\r | |
602 | );\r | |
603 | \r | |
ddac74d1 | 604 | typedef struct {\r |
8e8ae2da | 605 | UINT8 Type;\r |
606 | UINT8 SubType;\r | |
607 | DEV_PATH_FUNCTION Function;\r | |
ddac74d1 | 608 | } DEVICE_PATH_STRING_TABLE;\r |
609 | \r | |
ddac74d1 | 610 | typedef struct {\r |
611 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
612 | EFI_GUID Guid;\r | |
613 | UINT8 VendorDefinedData[1];\r | |
614 | } VENDOR_DEVICE_PATH_WITH_DATA;\r | |
615 | \r | |
ddac74d1 | 616 | typedef struct {\r |
617 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
618 | UINT16 NetworkProtocol;\r | |
619 | UINT16 LoginOption;\r | |
620 | UINT64 Lun;\r | |
621 | UINT16 TargetPortalGroupTag;\r | |
201e4066 | 622 | CHAR16 TargetName[1];\r |
ddac74d1 | 623 | } ISCSI_DEVICE_PATH_WITH_NAME;\r |
624 | \r | |
ddac74d1 | 625 | //\r |
626 | // BBS support macros and functions\r | |
627 | //\r | |
628 | \r | |
629 | #if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)\r | |
630 | #define REFRESH_LEGACY_BOOT_OPTIONS \\r | |
631 | BdsDeleteAllInvalidLegacyBootOptions ();\\r | |
632 | BdsAddNonExistingLegacyBootOptions (); \\r | |
633 | BdsUpdateLegacyDevOrder ()\r | |
634 | #else\r | |
635 | #define REFRESH_LEGACY_BOOT_OPTIONS\r | |
636 | #endif\r | |
637 | \r | |
638 | /**\r | |
639 | Delete all the invalid legacy boot options.\r | |
640 | \r | |
49fd8a35 | 641 | @retval EFI_SUCCESS All invalid legacy boot options are deleted.\r |
642 | @retval EFI_OUT_OF_RESOURCES Failed to allocate necessary memory.\r | |
643 | @retval EFI_NOT_FOUND Failed to retrieve variable of boot order.\r | |
ddac74d1 | 644 | \r |
645 | **/\r | |
646 | EFI_STATUS\r | |
647 | EFIAPI\r | |
648 | BdsDeleteAllInvalidLegacyBootOptions (\r | |
649 | VOID\r | |
650 | );\r | |
651 | \r | |
652 | /**\r | |
ddac74d1 | 653 | Add the legacy boot options from BBS table if they do not exist.\r |
654 | \r | |
49fd8a35 | 655 | @retval EFI_SUCCESS The boot options were added successfully, \r |
e83c9064 LG |
656 | or they are already in boot options.\r |
657 | @retval EFI_NOT_FOUND No legacy boot options is found.\r | |
658 | @retval EFI_OUT_OF_RESOURCE No enough memory.\r | |
659 | @return Other value LegacyBoot options are not added.\r | |
ddac74d1 | 660 | **/\r |
661 | EFI_STATUS\r | |
662 | EFIAPI\r | |
663 | BdsAddNonExistingLegacyBootOptions (\r | |
664 | VOID\r | |
665 | );\r | |
666 | \r | |
667 | /**\r | |
ddac74d1 | 668 | Add the legacy boot devices from BBS table into \r |
669 | the legacy device boot order.\r | |
670 | \r | |
49fd8a35 | 671 | @retval EFI_SUCCESS The boot devices were added successfully.\r |
e83c9064 | 672 | @retval EFI_NOT_FOUND The legacy boot devices are not found.\r |
49fd8a35 | 673 | @retval EFI_OUT_OF_RESOURCES Memory or storage is not enough.\r |
674 | @retval EFI_DEVICE_ERROR Failed to add the legacy device boot order into EFI variable\r | |
675 | because of a hardware error.\r | |
ddac74d1 | 676 | **/\r |
677 | EFI_STATUS\r | |
678 | EFIAPI\r | |
679 | BdsUpdateLegacyDevOrder (\r | |
680 | VOID\r | |
681 | );\r | |
682 | \r | |
683 | /**\r | |
d0bd68b2 | 684 | Refresh the boot priority for BBS entries based on boot option entry and boot order.\r |
ddac74d1 | 685 | \r |
49fd8a35 | 686 | @param Entry The boot option is to be checked for a refreshed BBS table.\r |
ddac74d1 | 687 | \r |
49fd8a35 | 688 | @retval EFI_SUCCESS The boot priority for BBS entries refreshed successfully.\r |
e83c9064 LG |
689 | @retval EFI_NOT_FOUND BBS entries can't be found.\r |
690 | @retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.\r | |
ddac74d1 | 691 | **/\r |
692 | EFI_STATUS\r | |
693 | EFIAPI\r | |
694 | BdsRefreshBbsTableForBoot (\r | |
695 | IN BDS_COMMON_OPTION *Entry\r | |
696 | );\r | |
697 | \r | |
698 | /**\r | |
d0bd68b2 | 699 | Delete the Boot Option from EFI Variable. The Boot Order Arrray\r |
e83c9064 | 700 | is also updated.\r |
ddac74d1 | 701 | \r |
49fd8a35 | 702 | @param OptionNumber The number of Boot options wanting to be deleted.\r |
e83c9064 LG |
703 | @param BootOrder The Boot Order array.\r |
704 | @param BootOrderSize The size of the Boot Order Array.\r | |
ddac74d1 | 705 | \r |
49fd8a35 | 706 | @retval EFI_SUCCESS The Boot Option Variable was found and removed.\r |
707 | @retval EFI_UNSUPPORTED The Boot Option Variable store was inaccessible.\r | |
708 | @retval EFI_NOT_FOUND The Boot Option Variable was not found.\r | |
ddac74d1 | 709 | **/\r |
710 | EFI_STATUS\r | |
711 | EFIAPI\r | |
712 | BdsDeleteBootOption (\r | |
713 | IN UINTN OptionNumber,\r | |
714 | IN OUT UINT16 *BootOrder,\r | |
715 | IN OUT UINTN *BootOrderSize\r | |
716 | );\r | |
717 | \r | |
718 | //\r | |
3d8bd97c | 719 | //The interface functions related to the Setup Browser Reset Reminder feature\r |
ddac74d1 | 720 | //\r |
721 | /**\r | |
722 | Enable the setup browser reset reminder feature.\r | |
49fd8a35 | 723 | This routine is used in a platform tip. If the platform policy needs the feature, use the routine to enable it.\r |
ddac74d1 | 724 | \r |
725 | **/\r | |
726 | VOID\r | |
727 | EFIAPI\r | |
728 | EnableResetReminderFeature (\r | |
729 | VOID\r | |
730 | );\r | |
731 | \r | |
732 | /**\r | |
733 | Disable the setup browser reset reminder feature.\r | |
49fd8a35 | 734 | This routine is used in a platform tip. If the platform policy does not want the feature, use the routine to disable it.\r |
ddac74d1 | 735 | \r |
736 | **/\r | |
737 | VOID\r | |
738 | EFIAPI\r | |
739 | DisableResetReminderFeature (\r | |
740 | VOID\r | |
741 | );\r | |
742 | \r | |
743 | /**\r | |
3d8bd97c | 744 | Record the info that a reset is required.\r |
745 | A module boolean variable is used to record whether a reset is required.\r | |
ddac74d1 | 746 | \r |
747 | **/\r | |
748 | VOID\r | |
749 | EFIAPI\r | |
750 | EnableResetRequired (\r | |
751 | VOID\r | |
752 | );\r | |
753 | \r | |
754 | \r | |
755 | /**\r | |
3d8bd97c | 756 | Record the info that no reset is required.\r |
757 | A module boolean variable is used to record whether a reset is required.\r | |
ddac74d1 | 758 | \r |
759 | **/\r | |
760 | VOID\r | |
761 | EFIAPI\r | |
762 | DisableResetRequired (\r | |
763 | VOID\r | |
764 | );\r | |
765 | \r | |
766 | /**\r | |
3d8bd97c | 767 | Check whether platform policy enables the reset reminder feature. The default is enabled.\r |
ddac74d1 | 768 | \r |
769 | **/\r | |
770 | BOOLEAN\r | |
771 | EFIAPI\r | |
772 | IsResetReminderFeatureEnable (\r | |
773 | VOID\r | |
774 | );\r | |
775 | \r | |
776 | /**\r | |
3d8bd97c | 777 | Check if the user changed any option setting that needs a system reset to be effective.\r |
ddac74d1 | 778 | \r |
779 | **/\r | |
780 | BOOLEAN\r | |
781 | EFIAPI\r | |
782 | IsResetRequired (\r | |
783 | VOID\r | |
784 | );\r | |
785 | \r | |
786 | /**\r | |
787 | Check whether a reset is needed, and finish the reset reminder feature.\r | |
3d8bd97c | 788 | If a reset is needed, pop up a menu to notice user, and finish the feature\r |
ddac74d1 | 789 | according to the user selection.\r |
790 | \r | |
791 | **/\r | |
792 | VOID\r | |
793 | EFIAPI\r | |
794 | SetupResetReminder (\r | |
795 | VOID\r | |
796 | );\r | |
797 | \r | |
3384a9bc | 798 | \r |
e83c9064 | 799 | ///\r |
49fd8a35 | 800 | /// Define the boot type with which to classify the boot option type.\r |
801 | /// Different boot option types could have different boot behaviors.\r | |
802 | /// Use their device path node (Type + SubType) as the type value.\r | |
803 | /// The boot type here can be added according to requirements.\r | |
e83c9064 LG |
804 | ///\r |
805 | \r | |
806 | ///\r | |
49fd8a35 | 807 | /// ACPI boot type. For ACPI devices, using sub-types to distinguish devices is not allowed, so hardcode their values.\r |
e83c9064 | 808 | ///\r |
ddac74d1 | 809 | #define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201\r |
e83c9064 LG |
810 | ///\r |
811 | /// Message boot type\r | |
49fd8a35 | 812 | /// If a device path of boot option only points to a message node, the boot option is a message boot type.\r |
e83c9064 | 813 | ///\r |
ddac74d1 | 814 | #define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01\r |
815 | #define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02\r | |
816 | #define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05\r | |
429cac9c | 817 | #define BDS_EFI_MESSAGE_SATA_BOOT 0x0312 // Type 03; Sub-Type 18\r |
818 | #define BDS_EFI_MESSAGE_MAC_BOOT 0x030b // Type 03; Sub-Type 11\r | |
ddac74d1 | 819 | #define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF\r |
429cac9c | 820 | \r |
e83c9064 LG |
821 | ///\r |
822 | /// Media boot type\r | |
49fd8a35 | 823 | /// If a device path of boot option contains a media node, the boot option is media boot type.\r |
e83c9064 | 824 | ///\r |
ddac74d1 | 825 | #define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01\r |
826 | #define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02\r | |
e83c9064 LG |
827 | ///\r |
828 | /// BBS boot type\r | |
49fd8a35 | 829 | /// If a device path of boot option contains a BBS node, the boot option is BBS boot type.\r |
e83c9064 | 830 | ///\r |
ddac74d1 | 831 | #define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01\r |
832 | \r | |
833 | #define BDS_EFI_UNSUPPORT 0xFFFF\r | |
834 | \r | |
ddac74d1 | 835 | /**\r |
49fd8a35 | 836 | Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path.\r |
ddac74d1 | 837 | \r |
49fd8a35 | 838 | @param BlockIoDevicePath Multi device path instances to check.\r |
3d8bd97c | 839 | @param HardDriveDevicePath A device path starting with a hard drive media\r |
ddac74d1 | 840 | device path.\r |
841 | \r | |
842 | @retval TRUE There is a matched device path instance.\r | |
843 | @retval FALSE There is no matched device path instance.\r | |
844 | \r | |
845 | **/\r | |
846 | BOOLEAN\r | |
847 | EFIAPI\r | |
848 | MatchPartitionDevicePathNode (\r | |
849 | IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,\r | |
850 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
851 | );\r | |
852 | \r | |
853 | \r | |
854 | /**\r | |
855 | Expand a device path that starts with a hard drive media device path node to be a\r | |
d0bd68b2 | 856 | full device path that includes the full hardware path to the device. This function enables the device to boot. \r |
857 | To avoid requiring a connect on every boot, the front match is saved in a variable (the part point\r | |
858 | to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ).\r | |
859 | All successful history device paths\r | |
860 | that point to the front part of the partition node will be saved.\r | |
ddac74d1 | 861 | \r |
862 | @param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard\r | |
863 | drive media device path.\r | |
49fd8a35 | 864 | @return A Pointer to the full device path, or NULL if a valid Hard Drive devic path\r |
ddac74d1 | 865 | cannot be found.\r |
866 | \r | |
867 | **/\r | |
868 | EFI_DEVICE_PATH_PROTOCOL *\r | |
869 | EFIAPI\r | |
870 | BdsExpandPartitionPartialDevicePathToFull (\r | |
871 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
872 | );\r | |
873 | \r | |
874 | /**\r | |
875 | Return the bootable media handle.\r | |
3d8bd97c | 876 | First, check whether the device is connected.\r |
877 | Second, check whether the device path points to a device that supports SimpleFileSystemProtocol.\r | |
ddac74d1 | 878 | Third, detect the the default boot file in the Media, and return the removable Media handle.\r |
879 | \r | |
49fd8a35 | 880 | @param DevicePath The Device Path to a bootable device.\r |
ddac74d1 | 881 | \r |
e83c9064 | 882 | @return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.\r |
ddac74d1 | 883 | \r |
884 | **/\r | |
885 | EFI_HANDLE\r | |
886 | EFIAPI\r | |
887 | BdsLibGetBootableHandle (\r | |
888 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
889 | );\r | |
890 | \r | |
891 | \r | |
892 | /**\r | |
3d8bd97c | 893 | Checks whether the Device path in a boot option points to a valid bootable device, and if the device\r |
894 | is ready to boot now.\r | |
ddac74d1 | 895 | \r |
49fd8a35 | 896 | @param DevPath The Device path in a boot option.\r |
897 | @param CheckMedia If true, check whether the device is ready to boot now.\r | |
ddac74d1 | 898 | \r |
49fd8a35 | 899 | @retval TRUE The Device path is valid.\r |
900 | @retval FALSE The Device path is invalid.\r | |
ddac74d1 | 901 | \r |
902 | **/\r | |
903 | BOOLEAN\r | |
904 | EFIAPI\r | |
905 | BdsLibIsValidEFIBootOptDevicePath (\r | |
906 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
907 | IN BOOLEAN CheckMedia\r | |
908 | );\r | |
3384a9bc | 909 | \r |
910 | /**\r | |
3d8bd97c | 911 | Checks whether the Device path in a boot option points to a valid bootable device, and if the device\r |
912 | is ready to boot now.\r | |
913 | If Description is not NULL and the device path points to a fixed BlockIo\r | |
914 | device, this function checks whether the description conflicts with other auto-created\r | |
3384a9bc | 915 | boot options.\r |
916 | \r | |
49fd8a35 | 917 | @param DevPath The Device path in a boot option.\r |
918 | @param CheckMedia If true, checks if the device is ready to boot now.\r | |
919 | @param Description The description of a boot option.\r | |
3384a9bc | 920 | \r |
49fd8a35 | 921 | @retval TRUE The Device path is valid.\r |
922 | @retval FALSE The Device path is invalid.\r | |
3384a9bc | 923 | \r |
924 | **/\r | |
925 | BOOLEAN\r | |
926 | EFIAPI\r | |
927 | BdsLibIsValidEFIBootOptDevicePathExt (\r | |
928 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
929 | IN BOOLEAN CheckMedia,\r | |
930 | IN CHAR16 *Description\r | |
931 | );\r | |
932 | \r | |
ddac74d1 | 933 | /**\r |
934 | For a bootable Device path, return its boot type.\r | |
935 | \r | |
49fd8a35 | 936 | @param DevicePath The bootable device Path to check.\r |
ddac74d1 | 937 | \r |
38dc2202 | 938 | @retval BDS_EFI_MEDIA_HD_BOOT The given device path contains MEDIA_DEVICE_PATH type device path node,\r |
939 | whose subtype is MEDIA_HARDDRIVE_DP. \r | |
940 | @retval BDS_EFI_MEDIA_CDROM_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node, \r | |
941 | whose subtype is MEDIA_CDROM_DP. \r | |
942 | @retval BDS_EFI_ACPI_FLOPPY_BOOT A given device path contains ACPI_DEVICE_PATH type device path node, \r | |
943 | whose HID is floppy device. \r | |
944 | @retval BDS_EFI_MESSAGE_ATAPI_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node, \r | |
945 | and its last device path node's subtype is MSG_ATAPI_DP. \r | |
946 | @retval BDS_EFI_MESSAGE_SCSI_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node,\r | |
947 | and its last device path node's subtype is MSG_SCSI_DP. \r | |
948 | @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node, \r | |
949 | and its last device path node's subtype is MSG_USB_DP.\r | |
950 | @retval BDS_EFI_MESSAGE_MISC_BOOT The device path does not contain any media device path node, and \r | |
951 | its last device path node points to a message device path node. \r | |
952 | @retval BDS_LEGACY_BBS_BOOT A given device path contains BBS_DEVICE_PATH type device path node. \r | |
953 | @retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path does not point to a media and message device. \r | |
954 | \r | |
955 | **/\r | |
ddac74d1 | 956 | UINT32\r |
957 | EFIAPI\r | |
958 | BdsGetBootTypeFromDevicePath (\r | |
959 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
960 | );\r | |
961 | \r | |
962 | \r | |
963 | /**\r | |
3d8bd97c | 964 | This routine registers a function to adjust the different types of memory page numbers\r |
965 | just before booting, and saves the updated info into the variable for the next boot to use.\r | |
ddac74d1 | 966 | \r |
967 | **/\r | |
968 | VOID\r | |
969 | EFIAPI\r | |
970 | BdsLibSaveMemoryTypeInformation (\r | |
971 | VOID\r | |
972 | );\r | |
973 | \r | |
337661bb | 974 | /**\r |
975 | Identify a user and, if authenticated, returns the current user profile handle.\r | |
976 | \r | |
49fd8a35 | 977 | @param[out] User Points to the user profile handle.\r |
337661bb | 978 | \r |
49fd8a35 | 979 | @retval EFI_SUCCESS The user is successfully identified, or user identification\r |
337661bb | 980 | is not supported.\r |
49fd8a35 | 981 | @retval EFI_ACCESS_DENIED The user was not successfully identified.\r |
337661bb | 982 | \r |
983 | **/\r | |
984 | EFI_STATUS\r | |
985 | EFIAPI\r | |
986 | BdsLibUserIdentify (\r | |
987 | OUT EFI_USER_PROFILE_HANDLE *User\r | |
988 | ); \r | |
ddac74d1 | 989 | \r |
990 | /**\r | |
3d8bd97c | 991 | This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,\r |
992 | it tries to return the valid device path.\r | |
ddac74d1 | 993 | FV address maybe changes for memory layout adjust from time to time, use this funciton\r |
994 | could promise the Fv file device path is right.\r | |
995 | \r | |
49fd8a35 | 996 | @param DevicePath On input, the Fv file device path to check. On\r |
ddac74d1 | 997 | output, the updated valid Fv file device path\r |
49fd8a35 | 998 | @param FileGuid the Fv file GUID.\r |
ddac74d1 | 999 | \r |
49fd8a35 | 1000 | @retval EFI_INVALID_PARAMETER The input DevicePath or FileGuid is invalid.\r |
1001 | @retval EFI_UNSUPPORTED The input DevicePath does not contain an Fv file\r | |
1002 | GUID at all.\r | |
1003 | @retval EFI_ALREADY_STARTED The input DevicePath has pointed to the Fv file and is\r | |
1004 | valid.\r | |
1005 | @retval EFI_SUCCESS Successfully updated the invalid DevicePath\r | |
1006 | and returned the updated device path in DevicePath.\r | |
ddac74d1 | 1007 | \r |
1008 | **/\r | |
1009 | EFI_STATUS\r | |
1010 | EFIAPI\r | |
1011 | BdsLibUpdateFvFileDevicePath (\r | |
1012 | IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,\r | |
1013 | IN EFI_GUID *FileGuid\r | |
1014 | );\r | |
1015 | \r | |
1016 | \r | |
1017 | /**\r | |
3d8bd97c | 1018 | Connect the specific USB device that matches the RemainingDevicePath,\r |
49fd8a35 | 1019 | and whose bus is determined by Host Controller (Uhci or Ehci).\r |
ddac74d1 | 1020 | \r |
1021 | @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci\r | |
49fd8a35 | 1022 | (0xFF).\r |
1023 | @param RemainingDevicePath A short-form device path that starts with the first\r | |
ddac74d1 | 1024 | element being a USB WWID or a USB Class device\r |
49fd8a35 | 1025 | path.\r |
ddac74d1 | 1026 | \r |
1027 | @retval EFI_SUCCESS The specific Usb device is connected successfully.\r | |
1028 | @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r | |
1029 | or RemainingDevicePath is not the USB class device path.\r | |
1030 | @retval EFI_NOT_FOUND The device specified by device path is not found.\r | |
1031 | \r | |
1032 | **/\r | |
1033 | EFI_STATUS\r | |
1034 | EFIAPI\r | |
1035 | BdsLibConnectUsbDevByShortFormDP(\r | |
1036 | IN UINT8 HostControllerPI,\r | |
1037 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
1038 | );\r | |
1039 | \r | |
1040 | \r | |
1041 | //\r | |
1042 | // The implementation of this function is provided by Platform code.\r | |
1043 | //\r | |
1044 | /**\r | |
3d8bd97c | 1045 | Convert Vendor device path to a device name.\r |
ddac74d1 | 1046 | \r |
49fd8a35 | 1047 | @param Str The buffer storing device name.\r |
1048 | @param DevPath The pointer to vendor device path.\r | |
ddac74d1 | 1049 | \r |
1050 | **/\r | |
1051 | VOID\r | |
ddac74d1 | 1052 | DevPathVendor (\r |
1053 | IN OUT POOL_PRINT *Str,\r | |
1054 | IN VOID *DevPath\r | |
1055 | );\r | |
1056 | \r | |
1057 | /**\r | |
49fd8a35 | 1058 | Concatenates a formatted unicode string to an allocated pool.\r |
ddac74d1 | 1059 | The caller must free the resulting buffer.\r |
1060 | \r | |
1061 | @param Str Tracks the allocated pool, size in use, and amount of pool allocated.\r | |
49fd8a35 | 1062 | @param Fmt The format string.\r |
ddac74d1 | 1063 | @param ... The data will be printed.\r |
1064 | \r | |
1065 | @return Allocated buffer with the formatted string printed in it.\r | |
1066 | The caller must free the allocated buffer.\r | |
1067 | The buffer allocation is not packed.\r | |
1068 | \r | |
1069 | **/\r | |
1070 | CHAR16 *\r | |
1071 | EFIAPI\r | |
1072 | CatPrint (\r | |
1073 | IN OUT POOL_PRINT *Str,\r | |
b4b6c8de | 1074 | IN CHAR16 *Fmt,\r |
ddac74d1 | 1075 | ...\r |
1076 | );\r | |
1077 | \r | |
1078 | /**\r | |
24cdd14e LG |
1079 | Use SystemTable ConOut to stop video based Simple Text Out consoles from going\r |
1080 | to the video device. Put up LogoFile on every video device that is a console.\r | |
ddac74d1 | 1081 | \r |
49fd8a35 | 1082 | @param[in] LogoFile The file name of logo to display on the center of the screen.\r |
ddac74d1 | 1083 | \r |
1084 | @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.\r | |
49fd8a35 | 1085 | @retval EFI_UNSUPPORTED Logo not found.\r |
ddac74d1 | 1086 | \r |
1087 | **/\r | |
1088 | EFI_STATUS\r | |
1089 | EFIAPI\r | |
1090 | EnableQuietBoot (\r | |
1091 | IN EFI_GUID *LogoFile\r | |
1092 | );\r | |
1093 | \r | |
1094 | \r | |
1095 | /**\r | |
24cdd14e | 1096 | Use SystemTable ConOut to turn on video based Simple Text Out consoles. The \r |
49fd8a35 | 1097 | Simple Text Out screens will now be synced up with all non-video output devices.\r |
ddac74d1 | 1098 | \r |
1099 | @retval EFI_SUCCESS UGA devices are back in text mode and synced up.\r | |
1100 | \r | |
1101 | **/\r | |
1102 | EFI_STATUS\r | |
1103 | EFIAPI\r | |
1104 | DisableQuietBoot (\r | |
1105 | VOID\r | |
1106 | );\r | |
1107 | \r | |
ddac74d1 | 1108 | #endif\r |
1109 | \r |