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