]>
Commit | Line | Data |
---|---|---|
ddac74d1 | 1 | /** @file\r |
920d2c23 | 2 | Generic BDS library defines general interfaces for BDS driver including:\r |
3d8bd97c | 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 |
920d2c23 | 7 | Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r |
ddac74d1 | 8 | All rights reserved. This program and the accompanying materials\r |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. 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 | |
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 | |
ddac74d1 | 21 | extern EFI_HANDLE mBdsImageHandle;\r |
22 | \r | |
e83c9064 LG |
23 | ///\r |
24 | /// Constants which are variable names used to access variables\r | |
25 | ///\r | |
ddac74d1 | 26 | #define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r |
27 | \r | |
e83c9064 LG |
28 | ///\r |
29 | /// Data structures and defines\r | |
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 |
3d8bd97c | 60 | /// Define 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 LG |
65 | ///\r |
66 | /// Define maximum characters for boot option variable "BootXXXX"\r | |
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 | |
112 | Process the boot option follow the UEFI specification and\r | |
113 | special treat the legacy boot option with BBS_DEVICE_PATH.\r | |
114 | \r | |
3d8bd97c | 115 | @param Option The boot option to be processed\r |
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 |
118 | the legacy OS\r | |
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 |
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 |
ddac74d1 | 177 | current boot options\r |
178 | \r | |
3d8bd97c | 179 | @retval EFI_SUCCESS Finished all the boot device enumerations and created\r |
180 | the boot option based on the boot device\r | |
ddac74d1 | 181 | \r |
e83c9064 | 182 | @retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create 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 | |
191 | Build the boot option with the handle parsed in\r | |
192 | \r | |
3d8bd97c | 193 | @param Handle The handle representing the device path for which to create\r |
ddac74d1 | 194 | boot option\r |
195 | @param BdsBootOptionList The header of the link list which indexed all\r | |
196 | current boot options\r | |
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 | |
213 | on flash shell boot option\r | |
214 | @param BdsBootOptionList The header of the link list which indexed all\r | |
215 | current boot options\r | |
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 |
229 | Get boot mode by looking up configuration table and parsing HOB list\r | |
230 | \r | |
231 | @param BootMode Boot mode from PEI handoff HOB.\r | |
232 | \r | |
233 | @retval EFI_SUCCESS Successfully get boot mode\r | |
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 |
247 | @param BdsDriverLists The header of the current driver option link list\r | |
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 | |
3d8bd97c | 258 | This function processes BootOrder or DriverOrder variables, by calling\r |
ddac74d1 | 259 | BdsLibVariableToOption () for each UINT16 in the variables.\r |
260 | \r | |
3d8bd97c | 261 | @param BdsCommonOptionList The header of the option list base on variable VariableName. @param VariableName EFI Variable name indicate the BootOrder or DriverOrder.\r |
262 | @retval EFI_SUCCESS Successfully created the boot option or driver option list @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list**/\r | |
ddac74d1 | 263 | EFI_STATUS\r |
264 | EFIAPI\r | |
265 | BdsLibBuildOptionFromVar (\r | |
266 | IN LIST_ENTRY *BdsCommonOptionList,\r | |
267 | IN CHAR16 *VariableName\r | |
268 | );\r | |
269 | \r | |
270 | /**\r | |
3d8bd97c | 271 | This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated\r |
272 | buffer and the size of the buffer. If failure, return NULL.\r | |
ddac74d1 | 273 | \r |
274 | @param Name String part of EFI variable name\r | |
275 | @param VendorGuid GUID part of EFI variable name\r | |
276 | @param VariableSize Returns the size of the EFI variable that was read\r | |
277 | \r | |
278 | @return Dynamically allocated memory that contains a copy of the EFI variable\r | |
279 | Caller is responsible freeing the buffer.\r | |
280 | @retval NULL Variable was not read\r | |
281 | \r | |
282 | **/\r | |
283 | VOID *\r | |
284 | EFIAPI\r | |
285 | BdsLibGetVariableAndSize (\r | |
286 | IN CHAR16 *Name,\r | |
287 | IN EFI_GUID *VendorGuid,\r | |
288 | OUT UINTN *VariableSize\r | |
289 | );\r | |
290 | \r | |
291 | \r | |
292 | /**\r | |
293 | This function prints a series of strings.\r | |
294 | \r | |
295 | @param ConOut Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r | |
296 | @param ... A variable argument list containing series of\r | |
297 | strings, the last string must be NULL.\r | |
298 | \r | |
299 | @retval EFI_SUCCESS Success print out the string using ConOut.\r | |
300 | @retval EFI_STATUS Return the status of the ConOut->OutputString ().\r | |
301 | \r | |
302 | **/\r | |
303 | EFI_STATUS\r | |
304 | EFIAPI\r | |
305 | BdsLibOutputStrings (\r | |
306 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,\r | |
307 | ...\r | |
308 | );\r | |
309 | \r | |
310 | /**\r | |
3d8bd97c | 311 | Build the boot#### or driver#### option from the VariableName. The\r |
ddac74d1 | 312 | build boot#### or driver#### will also be linked to BdsCommonOptionList.\r |
313 | \r | |
314 | @param BdsCommonOptionList The header of the boot#### or driver#### option\r | |
315 | link list\r | |
3d8bd97c | 316 | @param VariableName EFI Variable name, indicates if it is boot#### or\r |
ddac74d1 | 317 | driver####\r |
318 | \r | |
3d8bd97c | 319 | @retval BDS_COMMON_OPTION The option that was created\r |
ddac74d1 | 320 | @retval NULL Failed to get the new option\r |
321 | \r | |
322 | **/\r | |
323 | BDS_COMMON_OPTION *\r | |
324 | EFIAPI\r | |
325 | BdsLibVariableToOption (\r | |
326 | IN OUT LIST_ENTRY *BdsCommonOptionList,\r | |
327 | IN CHAR16 *VariableName\r | |
328 | );\r | |
329 | \r | |
330 | /**\r | |
3d8bd97c | 331 | This function registers the new boot#### or driver#### option based on\r |
ddac74d1 | 332 | the VariableName. The new registered boot#### or driver#### will be linked\r |
333 | to BdsOptionList and also update to the VariableName. After the boot#### or\r | |
334 | driver#### updated, the BootOrder or DriverOrder will also be updated.\r | |
335 | \r | |
336 | @param BdsOptionList The header of the boot#### or driver#### link list\r | |
337 | @param DevicePath The device path which the boot#### or driver####\r | |
338 | option present\r | |
339 | @param String The description of the boot#### or driver####\r | |
340 | @param VariableName Indicate if the boot#### or driver#### option\r | |
341 | \r | |
342 | @retval EFI_SUCCESS The boot#### or driver#### have been success\r | |
343 | registered\r | |
344 | @retval EFI_STATUS Return the status of gRT->SetVariable ().\r | |
345 | \r | |
346 | **/\r | |
347 | EFI_STATUS\r | |
348 | EFIAPI\r | |
349 | BdsLibRegisterNewOption (\r | |
350 | IN LIST_ENTRY *BdsOptionList,\r | |
351 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
352 | IN CHAR16 *String,\r | |
353 | IN CHAR16 *VariableName\r | |
354 | );\r | |
355 | \r | |
356 | //\r | |
3d8bd97c | 357 | // Bds connect and disconnect driver lib funcions\r |
ddac74d1 | 358 | //\r |
359 | /**\r | |
3d8bd97c | 360 | This function connects all system drivers with the corresponding controllers. \r |
ddac74d1 | 361 | \r |
362 | **/\r | |
363 | VOID\r | |
364 | EFIAPI\r | |
365 | BdsLibConnectAllDriversToAllControllers (\r | |
366 | VOID\r | |
367 | );\r | |
368 | \r | |
369 | /**\r | |
3d8bd97c | 370 | This function connects all system drivers to controllers.\r |
ddac74d1 | 371 | \r |
372 | **/\r | |
373 | VOID\r | |
374 | EFIAPI\r | |
375 | BdsLibConnectAll (\r | |
376 | VOID\r | |
377 | );\r | |
378 | \r | |
379 | /**\r | |
3d8bd97c | 380 | This function creates all handles associated with every device\r |
381 | path node. If the handle associated with one device path node can not\r | |
382 | be created, then it tries to execute the dispatch to load the missing drivers. \r | |
ddac74d1 | 383 | \r |
3d8bd97c | 384 | @param DevicePathToConnect The device path to be connected. Can be\r |
ddac74d1 | 385 | a multi-instance device path\r |
386 | \r | |
3d8bd97c | 387 | @retval EFI_SUCCESS All handles associates with every device path node\r |
388 | were created\r | |
389 | @retval EFI_OUT_OF_RESOURCES Not enough resources to create new handles\r | |
390 | @retval EFI_NOT_FOUND At least one handle could not be created\r | |
ddac74d1 | 391 | \r |
392 | **/\r | |
393 | EFI_STATUS\r | |
394 | EFIAPI\r | |
395 | BdsLibConnectDevicePath (\r | |
396 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r | |
397 | );\r | |
398 | \r | |
399 | /**\r | |
3d8bd97c | 400 | This function will connect all current system handles recursively. gBS->ConnectController() service is invoked for each handle exist in system handler buffer. If the handle is bus type handler, all childrens also will be connected recursively by gBS->ConnectController().\r |
401 | @retval EFI_SUCCESS All handles and child handles have been connected @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r | |
ddac74d1 | 402 | **/\r |
403 | EFI_STATUS\r | |
404 | EFIAPI\r | |
405 | BdsLibConnectAllEfi (\r | |
406 | VOID\r | |
407 | );\r | |
408 | \r | |
ddac74d1 | 409 | /**\r |
3d8bd97c | 410 | This function will disconnect all current system handles. gBS->DisconnectController() is invoked for each handle exists in system handle buffer. If handle is a bus type handle, all childrens also are disconnected recursively by gBS->DisconnectController().\r |
ddac74d1 | 411 | @retval EFI_SUCCESS All handles have been disconnected\r |
0977c9b2 | 412 | @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer().\r |
ddac74d1 | 413 | \r |
414 | **/\r | |
415 | EFI_STATUS\r | |
416 | EFIAPI\r | |
417 | BdsLibDisconnectAllEfi (\r | |
418 | VOID\r | |
419 | );\r | |
420 | \r | |
421 | //\r | |
422 | // Bds console related lib functions\r | |
423 | //\r | |
424 | /**\r | |
3d8bd97c | 425 | This function will search every simpletxt device in the current system,\r |
ddac74d1 | 426 | and make every simpletxt device as pertantial console device.\r |
427 | \r | |
428 | **/\r | |
429 | VOID\r | |
430 | EFIAPI\r | |
431 | BdsLibConnectAllConsoles (\r | |
432 | VOID\r | |
433 | );\r | |
434 | \r | |
435 | \r | |
436 | /**\r | |
3d8bd97c | 437 | This function will connect console device based on the console\r |
ddac74d1 | 438 | device variable ConIn, ConOut and ErrOut.\r |
439 | \r | |
3d8bd97c | 440 | @retval EFI_SUCCESS At least one of the ConIn and ConOut devices have\r |
441 | been connected.\r | |
ddac74d1 | 442 | @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().\r |
443 | \r | |
444 | **/\r | |
445 | EFI_STATUS\r | |
446 | EFIAPI\r | |
447 | BdsLibConnectAllDefaultConsoles (\r | |
448 | VOID\r | |
449 | );\r | |
450 | \r | |
451 | /**\r | |
3d8bd97c | 452 | This function updates the console variable based on ConVarName. It can\r |
ddac74d1 | 453 | add or remove one specific console device path from the variable\r |
454 | \r | |
3d8bd97c | 455 | @param ConVarName Console-related variable name: ConIn, ConOut,\r |
ddac74d1 | 456 | ErrOut.\r |
3d8bd97c | 457 | @param CustomizedConDevicePath The console device path to be added to\r |
458 | the console variable ConVarName. Can not be multi-instance.\r | |
459 | @param ExclusiveDevicePath The console device path to be removed\r | |
460 | from the console variable ConVarName. Can not be multi-instance.\r | |
461 | \r | |
462 | @retval EFI_UNSUPPORTED The added device path is the same as a removed one.\r | |
463 | @retval EFI_SUCCESS Successfully added or removed the device path from the\r | |
ddac74d1 | 464 | console variable.\r |
465 | \r | |
466 | **/\r | |
467 | EFI_STATUS\r | |
468 | EFIAPI\r | |
469 | BdsLibUpdateConsoleVariable (\r | |
470 | IN CHAR16 *ConVarName,\r | |
471 | IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r | |
472 | IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r | |
473 | );\r | |
474 | \r | |
475 | /**\r | |
3d8bd97c | 476 | Connect the console device base on the variable ConVarName. If\r |
477 | ConVarName is a multi-instance device path, and at least one\r | |
478 | instance connects successfully, then this function\r | |
ddac74d1 | 479 | will return success.\r |
480 | \r | |
481 | @param ConVarName Console related variable name, ConIn, ConOut,\r | |
482 | ErrOut.\r | |
483 | \r | |
3d8bd97c | 484 | @retval EFI_NOT_FOUND No console devices were connected successfully\r |
485 | @retval EFI_SUCCESS Connected at least one instance of the console\r | |
486 | device path based on the variable ConVarName.\r | |
ddac74d1 | 487 | \r |
488 | **/\r | |
489 | EFI_STATUS\r | |
490 | EFIAPI\r | |
491 | BdsLibConnectConsoleVariable (\r | |
492 | IN CHAR16 *ConVarName\r | |
493 | );\r | |
494 | \r | |
495 | //\r | |
496 | // Bds device path related lib functions\r | |
497 | //\r | |
498 | /**\r | |
3d8bd97c | 499 | Delete the instance in Multi that overlaps with Single \r |
ddac74d1 | 500 | \r |
501 | @param Multi A pointer to a multi-instance device path data\r | |
502 | structure.\r | |
503 | @param Single A pointer to a single-instance device path data\r | |
504 | structure.\r | |
505 | \r | |
3d8bd97c | 506 | @return This function removes the device path instances in Multi that overlap\r |
507 | Single, and returns the resulting device path. If there is no\r | |
ddac74d1 | 508 | remaining device path as a result, this function will return NULL.\r |
509 | \r | |
510 | **/\r | |
511 | EFI_DEVICE_PATH_PROTOCOL *\r | |
512 | EFIAPI\r | |
513 | BdsLibDelPartMatchInstance (\r | |
514 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
515 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
516 | );\r | |
517 | \r | |
518 | /**\r | |
519 | Function compares a device path data structure to that of all the nodes of a\r | |
520 | second device path instance.\r | |
521 | \r | |
522 | @param Multi A pointer to a multi-instance device path data\r | |
523 | structure.\r | |
524 | @param Single A pointer to a single-instance device path data\r | |
525 | structure.\r | |
526 | \r | |
527 | @retval TRUE If the Single device path is contained within Multi device path.\r | |
3d8bd97c | 528 | @retval FALSE The Single device path is not contained within Multi device path.\r |
ddac74d1 | 529 | \r |
530 | **/\r | |
531 | BOOLEAN\r | |
532 | EFIAPI\r | |
533 | BdsLibMatchDevicePaths (\r | |
534 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
535 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
536 | );\r | |
537 | \r | |
538 | /**\r | |
539 | This function converts an input device structure to a Unicode string.\r | |
540 | \r | |
541 | @param DevPath A pointer to the device path structure.\r | |
542 | \r | |
543 | @return A new allocated Unicode string that represents the device path.\r | |
544 | \r | |
545 | **/\r | |
546 | CHAR16 *\r | |
547 | EFIAPI\r | |
548 | DevicePathToStr (\r | |
549 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
550 | );\r | |
551 | \r | |
552 | \r | |
553 | //\r | |
554 | // Internal definitions\r | |
555 | //\r | |
556 | typedef struct {\r | |
b4b6c8de LG |
557 | CHAR16 *Str;\r |
558 | UINTN Len;\r | |
559 | UINTN Maxlen;\r | |
ddac74d1 | 560 | } POOL_PRINT;\r |
561 | \r | |
562 | typedef struct {\r | |
563 | UINT8 Type;\r | |
564 | UINT8 SubType;\r | |
565 | VOID (*Function) (POOL_PRINT *, VOID *);\r | |
566 | } DEVICE_PATH_STRING_TABLE;\r | |
567 | \r | |
568 | extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r | |
569 | \r | |
570 | typedef struct {\r | |
571 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
572 | EFI_GUID Guid;\r | |
573 | UINT8 VendorDefinedData[1];\r | |
574 | } VENDOR_DEVICE_PATH_WITH_DATA;\r | |
575 | \r | |
576 | \r | |
577 | extern EFI_GUID mEfiDevicePathMessagingSASGuid;\r | |
578 | \r | |
579 | typedef struct {\r | |
580 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
581 | UINT16 NetworkProtocol;\r | |
582 | UINT16 LoginOption;\r | |
583 | UINT64 Lun;\r | |
584 | UINT16 TargetPortalGroupTag;\r | |
201e4066 | 585 | CHAR16 TargetName[1];\r |
ddac74d1 | 586 | } ISCSI_DEVICE_PATH_WITH_NAME;\r |
587 | \r | |
588 | \r | |
589 | //\r | |
590 | // Notes: EFI 64 shadow all option rom\r | |
591 | //\r | |
592 | #if defined (MDE_CPU_IPF)\r | |
593 | #define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r | |
594 | #else\r | |
595 | #define EFI64_SHADOW_ALL_LEGACY_ROM()\r | |
596 | #endif\r | |
597 | \r | |
598 | /**\r | |
599 | Shadow all Legacy OptionRom. \r | |
600 | \r | |
601 | **/\r | |
602 | VOID\r | |
603 | EFIAPI\r | |
604 | ShadowAllOptionRom (\r | |
605 | VOID\r | |
606 | );\r | |
607 | \r | |
608 | //\r | |
609 | // BBS support macros and functions\r | |
610 | //\r | |
611 | \r | |
612 | #if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)\r | |
613 | #define REFRESH_LEGACY_BOOT_OPTIONS \\r | |
614 | BdsDeleteAllInvalidLegacyBootOptions ();\\r | |
615 | BdsAddNonExistingLegacyBootOptions (); \\r | |
616 | BdsUpdateLegacyDevOrder ()\r | |
617 | #else\r | |
618 | #define REFRESH_LEGACY_BOOT_OPTIONS\r | |
619 | #endif\r | |
620 | \r | |
621 | /**\r | |
622 | Delete all the invalid legacy boot options.\r | |
623 | \r | |
624 | @retval EFI_SUCCESS All invalide legacy boot options are deleted.\r | |
625 | @retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.\r | |
3d8bd97c | 626 | @retval EFI_NOT_FOUND Fail to retrieve variable of boot order.\r |
ddac74d1 | 627 | \r |
628 | **/\r | |
629 | EFI_STATUS\r | |
630 | EFIAPI\r | |
631 | BdsDeleteAllInvalidLegacyBootOptions (\r | |
632 | VOID\r | |
633 | );\r | |
634 | \r | |
635 | /**\r | |
ddac74d1 | 636 | Add the legacy boot options from BBS table if they do not exist.\r |
637 | \r | |
e83c9064 LG |
638 | @retval EFI_SUCCESS The boot options are added successfully \r |
639 | or they are already in boot options.\r | |
640 | @retval EFI_NOT_FOUND No legacy boot options is found.\r | |
641 | @retval EFI_OUT_OF_RESOURCE No enough memory.\r | |
642 | @return Other value LegacyBoot options are not added.\r | |
ddac74d1 | 643 | **/\r |
644 | EFI_STATUS\r | |
645 | EFIAPI\r | |
646 | BdsAddNonExistingLegacyBootOptions (\r | |
647 | VOID\r | |
648 | );\r | |
649 | \r | |
650 | /**\r | |
ddac74d1 | 651 | Add the legacy boot devices from BBS table into \r |
652 | the legacy device boot order.\r | |
653 | \r | |
e83c9064 LG |
654 | @retval EFI_SUCCESS The boot devices are added successfully.\r |
655 | @retval EFI_NOT_FOUND The legacy boot devices are not found.\r | |
656 | @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough.\r | |
657 | @retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable\r | |
658 | because of hardware error.\r | |
ddac74d1 | 659 | **/\r |
660 | EFI_STATUS\r | |
661 | EFIAPI\r | |
662 | BdsUpdateLegacyDevOrder (\r | |
663 | VOID\r | |
664 | );\r | |
665 | \r | |
666 | /**\r | |
ddac74d1 | 667 | Set the boot priority for BBS entries based on boot option entry and boot order.\r |
668 | \r | |
669 | @param Entry The boot option is to be checked for refresh BBS table.\r | |
670 | \r | |
e83c9064 LG |
671 | @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r |
672 | @retval EFI_NOT_FOUND BBS entries can't be found.\r | |
673 | @retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.\r | |
ddac74d1 | 674 | **/\r |
675 | EFI_STATUS\r | |
676 | EFIAPI\r | |
677 | BdsRefreshBbsTableForBoot (\r | |
678 | IN BDS_COMMON_OPTION *Entry\r | |
679 | );\r | |
680 | \r | |
681 | /**\r | |
e83c9064 LG |
682 | Deletete the Boot Option from EFI Variable. The Boot Order Arrray\r |
683 | is also updated.\r | |
ddac74d1 | 684 | \r |
e83c9064 LG |
685 | @param OptionNumber The number of Boot option want to be deleted.\r |
686 | @param BootOrder The Boot Order array.\r | |
687 | @param BootOrderSize The size of the Boot Order Array.\r | |
ddac74d1 | 688 | \r |
e83c9064 LG |
689 | @retval EFI_SUCCESS The Boot Option Variable was found and removed\r |
690 | @retval EFI_UNSUPPORTED The Boot Option Variable store was inaccessible\r | |
691 | @retval EFI_NOT_FOUND The Boot Option Variable was not found\r | |
ddac74d1 | 692 | **/\r |
693 | EFI_STATUS\r | |
694 | EFIAPI\r | |
695 | BdsDeleteBootOption (\r | |
696 | IN UINTN OptionNumber,\r | |
697 | IN OUT UINT16 *BootOrder,\r | |
698 | IN OUT UINTN *BootOrderSize\r | |
699 | );\r | |
700 | \r | |
701 | //\r | |
3d8bd97c | 702 | //The interface functions related to the Setup Browser Reset Reminder feature\r |
ddac74d1 | 703 | //\r |
704 | /**\r | |
705 | Enable the setup browser reset reminder feature.\r | |
3d8bd97c | 706 | This routine is used in platform tip. If the platform policy needs the feature, use the routine to enable it.\r |
ddac74d1 | 707 | \r |
708 | **/\r | |
709 | VOID\r | |
710 | EFIAPI\r | |
711 | EnableResetReminderFeature (\r | |
712 | VOID\r | |
713 | );\r | |
714 | \r | |
715 | /**\r | |
716 | Disable the setup browser reset reminder feature.\r | |
3d8bd97c | 717 | This routine is used in platform tip. If the platform policy does not want the feature, use the routine to disable it.\r |
ddac74d1 | 718 | \r |
719 | **/\r | |
720 | VOID\r | |
721 | EFIAPI\r | |
722 | DisableResetReminderFeature (\r | |
723 | VOID\r | |
724 | );\r | |
725 | \r | |
726 | /**\r | |
3d8bd97c | 727 | Record the info that a reset is required.\r |
728 | A module boolean variable is used to record whether a reset is required.\r | |
ddac74d1 | 729 | \r |
730 | **/\r | |
731 | VOID\r | |
732 | EFIAPI\r | |
733 | EnableResetRequired (\r | |
734 | VOID\r | |
735 | );\r | |
736 | \r | |
737 | \r | |
738 | /**\r | |
3d8bd97c | 739 | Record the info that no reset is required.\r |
740 | A module boolean variable is used to record whether a reset is required.\r | |
ddac74d1 | 741 | \r |
742 | **/\r | |
743 | VOID\r | |
744 | EFIAPI\r | |
745 | DisableResetRequired (\r | |
746 | VOID\r | |
747 | );\r | |
748 | \r | |
749 | /**\r | |
3d8bd97c | 750 | Check whether platform policy enables the reset reminder feature. The default is enabled.\r |
ddac74d1 | 751 | \r |
752 | **/\r | |
753 | BOOLEAN\r | |
754 | EFIAPI\r | |
755 | IsResetReminderFeatureEnable (\r | |
756 | VOID\r | |
757 | );\r | |
758 | \r | |
759 | /**\r | |
3d8bd97c | 760 | Check if the user changed any option setting that needs a system reset to be effective.\r |
ddac74d1 | 761 | \r |
762 | **/\r | |
763 | BOOLEAN\r | |
764 | EFIAPI\r | |
765 | IsResetRequired (\r | |
766 | VOID\r | |
767 | );\r | |
768 | \r | |
769 | /**\r | |
770 | Check whether a reset is needed, and finish the reset reminder feature.\r | |
3d8bd97c | 771 | If a reset is needed, pop up a menu to notice user, and finish the feature\r |
ddac74d1 | 772 | according to the user selection.\r |
773 | \r | |
774 | **/\r | |
775 | VOID\r | |
776 | EFIAPI\r | |
777 | SetupResetReminder (\r | |
778 | VOID\r | |
779 | );\r | |
780 | \r | |
3384a9bc | 781 | \r |
e83c9064 LG |
782 | ///\r |
783 | /// Define the boot option default description \r | |
784 | ///\r | |
3384a9bc | 785 | #define DESCRIPTION_FLOPPY L"EFI Floppy"\r |
786 | #define DESCRIPTION_FLOPPY_NUM L"EFI Floppy %d"\r | |
787 | #define DESCRIPTION_DVD L"EFI DVD/CDROM"\r | |
788 | #define DESCRIPTION_DVD_NUM L"EFI DVD/CDROM %d"\r | |
789 | #define DESCRIPTION_USB L"EFI USB Device"\r | |
790 | #define DESCRIPTION_USB_NUM L"EFI USB Device %d"\r | |
791 | #define DESCRIPTION_SCSI L"EFI SCSI Device"\r | |
792 | #define DESCRIPTION_SCSI_NUM L"EFI SCSI Device %d"\r | |
793 | #define DESCRIPTION_MISC L"EFI Misc Device"\r | |
794 | #define DESCRIPTION_MISC_NUM L"EFI Misc Device %d"\r | |
795 | #define DESCRIPTION_NETWORK L"EFI Network"\r | |
796 | #define DESCRIPTION_NETWORK_NUM L"EFI Network %d" \r | |
797 | #define DESCRIPTION_NON_BLOCK L"EFI Non-Block Boot Device"\r | |
798 | #define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"\r | |
799 | \r | |
e83c9064 LG |
800 | ///\r |
801 | /// Define the boot type which to classify the boot option type\r | |
802 | /// Different boot option type could have different boot behavior\r | |
803 | /// Use their device path node (Type + SubType) as type value\r | |
804 | /// The boot type here can be added according to requirement\r | |
805 | ///\r | |
806 | \r | |
807 | ///\r | |
808 | /// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r | |
809 | ///\r | |
ddac74d1 | 810 | #define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201\r |
e83c9064 LG |
811 | ///\r |
812 | /// Message boot type\r | |
813 | /// If a device path of boot option only point to a message node, the boot option is message boot type\r | |
814 | ///\r | |
ddac74d1 | 815 | #define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01\r |
816 | #define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02\r | |
817 | #define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05\r | |
3384a9bc | 818 | #define BDS_EFI_MESSAGE_SATA_BOOT 0x0318 // Type 03; Sub-Type 18\r |
ddac74d1 | 819 | #define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF\r |
e83c9064 LG |
820 | ///\r |
821 | /// Media boot type\r | |
822 | /// If a device path of boot option contain a media node, the boot option is media boot type\r | |
823 | ///\r | |
ddac74d1 | 824 | #define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01\r |
825 | #define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02\r | |
e83c9064 LG |
826 | ///\r |
827 | /// BBS boot type\r | |
828 | /// If a device path of boot option contain a BBS node, the boot option is BBS boot type\r | |
829 | ///\r | |
ddac74d1 | 830 | #define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01\r |
831 | \r | |
832 | #define BDS_EFI_UNSUPPORT 0xFFFF\r | |
833 | \r | |
e83c9064 LG |
834 | ///\r |
835 | /// USB host controller Programming Interface.\r | |
836 | ///\r | |
ddac74d1 | 837 | #define PCI_CLASSC_PI_UHCI 0x00\r |
838 | #define PCI_CLASSC_PI_EHCI 0x20\r | |
839 | \r | |
840 | /**\r | |
3d8bd97c | 841 | Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path\r |
ddac74d1 | 842 | \r |
3d8bd97c | 843 | @param BlockIoDevicePath Multi device path instances to check\r |
844 | @param HardDriveDevicePath A device path starting with a hard drive media\r | |
ddac74d1 | 845 | device path.\r |
846 | \r | |
847 | @retval TRUE There is a matched device path instance.\r | |
848 | @retval FALSE There is no matched device path instance.\r | |
849 | \r | |
850 | **/\r | |
851 | BOOLEAN\r | |
852 | EFIAPI\r | |
853 | MatchPartitionDevicePathNode (\r | |
854 | IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,\r | |
855 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
856 | );\r | |
857 | \r | |
858 | \r | |
859 | /**\r | |
860 | Expand a device path that starts with a hard drive media device path node to be a\r | |
861 | full device path that includes the full hardware path to the device. We need\r | |
862 | to do this so it can be booted. As an optimizaiton the front match (the part point\r | |
863 | to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ) is saved in a variable\r | |
864 | so a connect all is not required on every boot. All successful history device path\r | |
865 | which point to partition node (the front part) will be saved.\r | |
866 | \r | |
867 | @param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard\r | |
868 | drive media device path.\r | |
869 | @return A Pointer to the full device path or NULL if a valid Hard Drive devic path\r | |
870 | cannot be found.\r | |
871 | \r | |
872 | **/\r | |
873 | EFI_DEVICE_PATH_PROTOCOL *\r | |
874 | EFIAPI\r | |
875 | BdsExpandPartitionPartialDevicePathToFull (\r | |
876 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
877 | );\r | |
878 | \r | |
879 | /**\r | |
880 | Return the bootable media handle.\r | |
3d8bd97c | 881 | First, check whether the device is connected.\r |
882 | Second, check whether the device path points to a device that supports SimpleFileSystemProtocol.\r | |
ddac74d1 | 883 | Third, detect the the default boot file in the Media, and return the removable Media handle.\r |
884 | \r | |
885 | @param DevicePath Device Path to a bootable device\r | |
886 | \r | |
e83c9064 | 887 | @return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.\r |
ddac74d1 | 888 | \r |
889 | **/\r | |
890 | EFI_HANDLE\r | |
891 | EFIAPI\r | |
892 | BdsLibGetBootableHandle (\r | |
893 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
894 | );\r | |
895 | \r | |
896 | \r | |
897 | /**\r | |
3d8bd97c | 898 | Checks whether the Device path in a boot option points to a valid bootable device, and if the device\r |
899 | is ready to boot now.\r | |
ddac74d1 | 900 | \r |
901 | @param DevPath the Device path in a boot option\r | |
3d8bd97c | 902 | @param CheckMedia if true, check whether the device is ready to boot now.\r |
ddac74d1 | 903 | \r |
3d8bd97c | 904 | @retval TRUE the Device path is valid\r |
905 | @retval FALSE the Device path is invalid\r | |
ddac74d1 | 906 | \r |
907 | **/\r | |
908 | BOOLEAN\r | |
909 | EFIAPI\r | |
910 | BdsLibIsValidEFIBootOptDevicePath (\r | |
911 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
912 | IN BOOLEAN CheckMedia\r | |
913 | );\r | |
3384a9bc | 914 | \r |
915 | /**\r | |
3d8bd97c | 916 | Checks whether the Device path in a boot option points to a valid bootable device, and if the device\r |
917 | is ready to boot now.\r | |
918 | If Description is not NULL and the device path points to a fixed BlockIo\r | |
919 | device, this function checks whether the description conflicts with other auto-created\r | |
3384a9bc | 920 | boot options.\r |
921 | \r | |
922 | @param DevPath the Device path in a boot option\r | |
3d8bd97c | 923 | @param CheckMedia if true, checks if the device is ready to boot now.\r |
924 | @param Description the description of a boot option\r | |
3384a9bc | 925 | \r |
3d8bd97c | 926 | @retval TRUE the Device path is valid\r |
927 | @retval FALSE the Device path is invalid\r | |
3384a9bc | 928 | \r |
929 | **/\r | |
930 | BOOLEAN\r | |
931 | EFIAPI\r | |
932 | BdsLibIsValidEFIBootOptDevicePathExt (\r | |
933 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
934 | IN BOOLEAN CheckMedia,\r | |
935 | IN CHAR16 *Description\r | |
936 | );\r | |
937 | \r | |
ddac74d1 | 938 | /**\r |
939 | For a bootable Device path, return its boot type.\r | |
940 | \r | |
941 | @param DevicePath The bootable device Path to check\r | |
942 | \r | |
3d8bd97c | 943 | @retval BDS_EFI_MEDIA_HD_BOOT If 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 | 944 | **/\r |
945 | UINT32\r | |
946 | EFIAPI\r | |
947 | BdsGetBootTypeFromDevicePath (\r | |
948 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
949 | );\r | |
950 | \r | |
951 | \r | |
952 | /**\r | |
3d8bd97c | 953 | This routine registers a function to adjust the different types of memory page numbers\r |
954 | just before booting, and saves the updated info into the variable for the next boot to use.\r | |
ddac74d1 | 955 | \r |
956 | **/\r | |
957 | VOID\r | |
958 | EFIAPI\r | |
959 | BdsLibSaveMemoryTypeInformation (\r | |
960 | VOID\r | |
961 | );\r | |
962 | \r | |
963 | \r | |
964 | /**\r | |
3d8bd97c | 965 | This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,\r |
966 | it tries to return the valid device path.\r | |
ddac74d1 | 967 | FV address maybe changes for memory layout adjust from time to time, use this funciton\r |
968 | could promise the Fv file device path is right.\r | |
969 | \r | |
3d8bd97c | 970 | @param DevicePath on input, the Fv file device path to check. On\r |
ddac74d1 | 971 | output, the updated valid Fv file device path\r |
3d8bd97c | 972 | @param FileGuid the Fv file GUID\r |
ddac74d1 | 973 | \r |
974 | @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid\r | |
3d8bd97c | 975 | @retval EFI_UNSUPPORTED the input DevicePath does not contain an Fv file\r |
976 | GUID at all\r | |
977 | @retval EFI_ALREADY_STARTED the input DevicePath has pointed to the Fv file and is\r | |
ddac74d1 | 978 | valid\r |
3d8bd97c | 979 | @retval EFI_SUCCESS successfully updated the invalid DevicePath\r |
980 | and returned the updated device path in DevicePath\r | |
ddac74d1 | 981 | \r |
982 | **/\r | |
983 | EFI_STATUS\r | |
984 | EFIAPI\r | |
985 | BdsLibUpdateFvFileDevicePath (\r | |
986 | IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,\r | |
987 | IN EFI_GUID *FileGuid\r | |
988 | );\r | |
989 | \r | |
990 | \r | |
991 | /**\r | |
3d8bd97c | 992 | Connect the specific USB device that matches the RemainingDevicePath,\r |
ddac74d1 | 993 | and whose bus is determined by Host Controller (Uhci or Ehci)\r |
994 | \r | |
995 | @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci\r | |
996 | (0xFF)\r | |
997 | @param RemainingDevicePath a short-form device path that starts with the first\r | |
998 | element being a USB WWID or a USB Class device\r | |
999 | path\r | |
1000 | \r | |
1001 | @retval EFI_SUCCESS The specific Usb device is connected successfully.\r | |
1002 | @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r | |
1003 | or RemainingDevicePath is not the USB class device path.\r | |
1004 | @retval EFI_NOT_FOUND The device specified by device path is not found.\r | |
1005 | \r | |
1006 | **/\r | |
1007 | EFI_STATUS\r | |
1008 | EFIAPI\r | |
1009 | BdsLibConnectUsbDevByShortFormDP(\r | |
1010 | IN UINT8 HostControllerPI,\r | |
1011 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
1012 | );\r | |
1013 | \r | |
1014 | \r | |
1015 | //\r | |
1016 | // The implementation of this function is provided by Platform code.\r | |
1017 | //\r | |
1018 | /**\r | |
3d8bd97c | 1019 | Convert Vendor device path to a device name.\r |
ddac74d1 | 1020 | \r |
3d8bd97c | 1021 | @param Str The buffer storing device name\r |
ddac74d1 | 1022 | @param DevPath Pointer to vendor device path\r |
1023 | \r | |
1024 | **/\r | |
1025 | VOID\r | |
ddac74d1 | 1026 | DevPathVendor (\r |
1027 | IN OUT POOL_PRINT *Str,\r | |
1028 | IN VOID *DevPath\r | |
1029 | );\r | |
1030 | \r | |
1031 | /**\r | |
1032 | Concatenates a formatted unicode string to allocated pool.\r | |
1033 | The caller must free the resulting buffer.\r | |
1034 | \r | |
1035 | @param Str Tracks the allocated pool, size in use, and amount of pool allocated.\r | |
b4b6c8de | 1036 | @param Fmt The format string\r |
ddac74d1 | 1037 | @param ... The data will be printed.\r |
1038 | \r | |
1039 | @return Allocated buffer with the formatted string printed in it.\r | |
1040 | The caller must free the allocated buffer.\r | |
1041 | The buffer allocation is not packed.\r | |
1042 | \r | |
1043 | **/\r | |
1044 | CHAR16 *\r | |
1045 | EFIAPI\r | |
1046 | CatPrint (\r | |
1047 | IN OUT POOL_PRINT *Str,\r | |
b4b6c8de | 1048 | IN CHAR16 *Fmt,\r |
ddac74d1 | 1049 | ...\r |
1050 | );\r | |
1051 | \r | |
1052 | /**\r | |
3d8bd97c | 1053 | Use Console Control to stop UGA-based Simple Text Out consoles from going\r |
1054 | to the UGA device. Put up LogoFile on every UGA device that is a console.\r | |
ddac74d1 | 1055 | \r |
1056 | @param[in] LogoFile File name of logo to display on the center of the screen.\r | |
1057 | \r | |
1058 | @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.\r | |
1059 | @retval EFI_UNSUPPORTED Logo not found\r | |
1060 | \r | |
1061 | **/\r | |
1062 | EFI_STATUS\r | |
1063 | EFIAPI\r | |
1064 | EnableQuietBoot (\r | |
1065 | IN EFI_GUID *LogoFile\r | |
1066 | );\r | |
1067 | \r | |
1068 | \r | |
1069 | /**\r | |
1070 | Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r | |
1071 | Simple Text Out screens will now be synced up with all non UGA output devices\r | |
1072 | \r | |
1073 | @retval EFI_SUCCESS UGA devices are back in text mode and synced up.\r | |
1074 | \r | |
1075 | **/\r | |
1076 | EFI_STATUS\r | |
1077 | EFIAPI\r | |
1078 | DisableQuietBoot (\r | |
1079 | VOID\r | |
1080 | );\r | |
1081 | \r | |
1082 | /**\r | |
1083 | Use Console Control Protocol to lock the Console In Spliter virtual handle. \r | |
1084 | This is the ConInHandle and ConIn handle in the EFI system table. All key\r | |
1085 | presses will be ignored until the Password is typed in. The only way to\r | |
1086 | disable the password is to type it in to a ConIn device.\r | |
1087 | \r | |
1088 | @param Password Password used to lock ConIn device.\r | |
1089 | \r | |
1090 | @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.\r | |
1091 | @retval EFI_UNSUPPORTED Password not found\r | |
1092 | \r | |
1093 | **/\r | |
1094 | EFI_STATUS\r | |
1095 | EFIAPI\r | |
1096 | LockKeyboards (\r | |
1097 | IN CHAR16 *Password\r | |
1098 | );\r | |
1099 | \r | |
1100 | #endif\r | |
1101 | \r |