]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/UefiBootManagerLib.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Library / UefiBootManagerLib.h
CommitLineData
067ed98a
RN
1/** @file\r
2 Provide Boot Manager related library APIs.\r
3\r
b4e1ad87 4Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>\r
3dc5c1ae 5(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
067ed98a
RN
7\r
8**/\r
9\r
10\r
11#ifndef _UEFI_BOOT_MANAGER_LIB_H_\r
12#define _UEFI_BOOT_MANAGER_LIB_H_\r
13\r
14#include <Protocol/DriverHealth.h>\r
15#include <Library/SortLib.h>\r
16\r
17//\r
18// Boot Manager load option library functions.\r
19//\r
20\r
21//\r
22// Load Option Type\r
23//\r
24typedef enum {\r
25 LoadOptionTypeDriver,\r
26 LoadOptionTypeSysPrep,\r
27 LoadOptionTypeBoot,\r
780e05ca 28 LoadOptionTypePlatformRecovery,\r
067ed98a
RN
29 LoadOptionTypeMax\r
30} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE;\r
31\r
32typedef enum {\r
33 LoadOptionNumberMax = 0x10000,\r
34 LoadOptionNumberUnassigned = LoadOptionNumberMax\r
35} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER;\r
36\r
37//\r
38// Common structure definition for DriverOption and BootOption\r
39//\r
40typedef struct {\r
41 //\r
42 // Data read from UEFI NV variables\r
43 //\r
44 UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned\r
45 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver\r
46 UINT32 Attributes; // Load Option Attributes\r
47 CHAR16 *Description; // Load Option Description\r
48 EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path\r
49 UINT8 *OptionalData; // Load Option optional data to pass into image\r
50 UINT32 OptionalDataSize; // Load Option size of OptionalData\r
51 EFI_GUID VendorGuid;\r
52\r
53 //\r
54 // Used at runtime\r
55 //\r
56 EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage ()\r
d1102dba 57 CHAR16 *ExitData; // Exit data returned from gBS->StartImage ()\r
067ed98a
RN
58 UINTN ExitDataSize; // Size of ExitData\r
59} EFI_BOOT_MANAGER_LOAD_OPTION;\r
60\r
61/**\r
62 Returns an array of load options based on the EFI variable\r
63 L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it.\r
d1102dba 64 #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry.\r
067ed98a
RN
65\r
66 @param LoadOptionCount Returns number of entries in the array.\r
67 @param LoadOptionType The type of the load option.\r
68\r
69 @retval NULL No load options exist.\r
70 @retval !NULL Array of load option entries.\r
71\r
72**/\r
73EFI_BOOT_MANAGER_LOAD_OPTION *\r
74EFIAPI\r
75EfiBootManagerGetLoadOptions (\r
76 OUT UINTN *LoadOptionCount,\r
77 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType\r
78 );\r
79\r
80/**\r
81 Free an array of load options returned from EfiBootManagerGetLoadOptions().\r
82\r
83 @param LoadOptions Pointer to the array of load options to free.\r
84 @param LoadOptionCount Number of array entries in LoadOptions.\r
85\r
86 @return EFI_SUCCESS LoadOptions was freed.\r
87 @return EFI_INVALID_PARAMETER LoadOptions is NULL.\r
88**/\r
89EFI_STATUS\r
90EFIAPI\r
91EfiBootManagerFreeLoadOptions (\r
92 IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,\r
93 IN UINTN LoadOptionCount\r
94 );\r
95\r
96/**\r
97 Initialize a load option.\r
98\r
99 @param Option Pointer to the load option to be initialized.\r
100 @param OptionNumber Option number of the load option.\r
101 @param OptionType Type of the load option.\r
102 @param Attributes Attributes of the load option.\r
103 @param Description Description of the load option.\r
104 @param FilePath Device path of the load option.\r
105 @param OptionalData Optional data of the load option.\r
106 @param OptionalDataSize Size of the optional data of the load option.\r
107\r
108 @retval EFI_SUCCESS The load option was initialized successfully.\r
109 @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL.\r
110**/\r
111EFI_STATUS\r
112EFIAPI\r
113EfiBootManagerInitializeLoadOption (\r
114 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,\r
115 IN UINTN OptionNumber,\r
116 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,\r
117 IN UINT32 Attributes,\r
118 IN CHAR16 *Description,\r
119 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
120 IN UINT8 *OptionalData,\r
121 IN UINT32 OptionalDataSize\r
122 );\r
123\r
124/**\r
125 Free a load option created by EfiBootManagerInitializeLoadOption()\r
126 or EfiBootManagerVariableToLoadOption().\r
127\r
128 @param LoadOption Pointer to the load option to free.\r
129 CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify\r
130 @return EFI_SUCCESS LoadOption was freed.\r
131 @return EFI_INVALID_PARAMETER LoadOption is NULL.\r
132\r
133**/\r
134EFI_STATUS\r
135EFIAPI\r
136EfiBootManagerFreeLoadOption (\r
137 IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
138 );\r
139\r
140/**\r
141 Initialize the load option from the VariableName.\r
142\r
143 @param VariableName EFI Variable name which could be Boot#### or\r
144 Driver####\r
145 @param LoadOption Pointer to the load option to be initialized\r
146\r
147 @retval EFI_SUCCESS The option was created\r
148 @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL.\r
149 @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found.\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153EfiBootManagerVariableToLoadOption (\r
154 IN CHAR16 *VariableName,\r
155 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
156 );\r
157\r
158/**\r
159 Create the Boot#### or Driver#### variable from the load option.\r
d1102dba 160\r
067ed98a
RN
161 @param LoadOption Pointer to the load option.\r
162\r
163 @retval EFI_SUCCESS The variable was created.\r
164 @retval Others Error status returned by RT->SetVariable.\r
165**/\r
166EFI_STATUS\r
167EFIAPI\r
168EfiBootManagerLoadOptionToVariable (\r
169 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
170 );\r
171\r
172/**\r
8b5c80e0
RN
173 This function will register the new Boot####, Driver#### or SysPrep#### option.\r
174 After the *#### is updated, the *Order will also be updated.\r
175\r
176 @param Option Pointer to load option to add. If on input\r
177 Option->OptionNumber is LoadOptionNumberUnassigned,\r
178 then on output Option->OptionNumber is updated to\r
179 the number of the new Boot####,\r
180 Driver#### or SysPrep#### option.\r
181 @param Position Position of the new load option to put in the ****Order variable.\r
182\r
183 @retval EFI_SUCCESS The *#### have been successfully registered.\r
184 @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF.\r
185 @retval EFI_ALREADY_STARTED The option number of Option is being used already.\r
186 Note: this API only adds new load option, no replacement support.\r
187 @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the\r
188 option number specified in the Option is LoadOptionNumberUnassigned.\r
189 @return Status codes of gRT->SetVariable ().\r
067ed98a 190\r
067ed98a
RN
191**/\r
192EFI_STATUS\r
193EFIAPI\r
194EfiBootManagerAddLoadOptionVariable (\r
8b5c80e0
RN
195 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,\r
196 IN UINTN Position\r
067ed98a
RN
197 );\r
198\r
199/**\r
200 Delete the load option according to the OptionNumber and OptionType.\r
d1102dba 201\r
067ed98a 202 Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber.\r
d1102dba 203\r
067ed98a
RN
204 @param OptionNumber Option number of the load option.\r
205 @param OptionType Type of the load option.\r
206\r
207 @retval EFI_NOT_FOUND The load option cannot be found.\r
208 @retval EFI_SUCCESS The load option was deleted.\r
209**/\r
210EFI_STATUS\r
211EFIAPI\r
212EfiBootManagerDeleteLoadOptionVariable (\r
213 IN UINTN OptionNumber,\r
214 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType\r
215 );\r
216\r
217/**\r
d1102dba 218 Sort the load options. The DriverOrder/BootOrder variables will be re-created to\r
067ed98a
RN
219 reflect the new order.\r
220\r
221 @param OptionType The type of the load option.\r
54ae9c08 222 @param CompareFunction The comparator function pointer.\r
067ed98a
RN
223**/\r
224VOID\r
225EFIAPI\r
226EfiBootManagerSortLoadOptionVariable (\r
227 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,\r
228 IN SORT_COMPARE CompareFunction\r
229 );\r
230\r
5d3a9896
SW
231/**\r
232 Return the index of the load option in the load option array.\r
233\r
d1102dba 234 The function consider two load options are equal when the\r
5d3a9896
SW
235 OptionType, Attributes, Description, FilePath and OptionalData are equal.\r
236\r
237 @param Key Pointer to the load option to be found.\r
238 @param Array Pointer to the array of load options to be found.\r
239 @param Count Number of entries in the Array.\r
240\r
241 @retval -1 Key wasn't found in the Array.\r
242 @retval 0 ~ Count-1 The index of the Key in the Array.\r
243**/\r
244INTN\r
245EFIAPI\r
246EfiBootManagerFindLoadOption (\r
247 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,\r
248 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,\r
249 IN UINTN Count\r
250 );\r
251\r
067ed98a
RN
252//\r
253// Boot Manager hot key library functions.\r
254//\r
255\r
256#pragma pack(1)\r
257///\r
258/// EFI Key Option.\r
259///\r
260typedef struct {\r
261 ///\r
262 /// Specifies options about how the key will be processed.\r
263 ///\r
264 EFI_BOOT_KEY_DATA KeyData;\r
265 ///\r
266 /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to\r
267 /// which BootOption refers. If the CRC-32s do not match this value, then this key\r
268 /// option is ignored.\r
269 ///\r
270 UINT32 BootOptionCrc;\r
271 ///\r
272 /// The Boot#### option which will be invoked if this key is pressed and the boot option\r
273 /// is active (LOAD_OPTION_ACTIVE is set).\r
274 ///\r
275 UINT16 BootOption;\r
276 ///\r
277 /// The key codes to compare against those returned by the\r
278 /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.\r
279 /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.\r
280 ///\r
281 EFI_INPUT_KEY Keys[3];\r
282 UINT16 OptionNumber;\r
283} EFI_BOOT_MANAGER_KEY_OPTION;\r
284#pragma pack()\r
285\r
286/**\r
287 Start the hot key service so that the key press can trigger the boot option.\r
288\r
d1102dba 289 @param HotkeyTriggered Return the waitable event and it will be signaled\r
067ed98a
RN
290 when a valid hot key is pressed.\r
291\r
292 @retval EFI_SUCCESS The hot key service is started.\r
293**/\r
294EFI_STATUS\r
295EFIAPI\r
296EfiBootManagerStartHotkeyService (\r
297 IN EFI_EVENT *HotkeyTriggered\r
298 );\r
299\r
300//\r
301// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable\r
302//\r
303#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001\r
304#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002\r
305#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004\r
306#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008\r
307#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010\r
308#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020\r
309\r
310/**\r
311 Add the key option.\r
312 It adds the key option variable and the key option takes affect immediately.\r
313\r
314 @param AddedOption Return the added key option.\r
315 @param BootOptionNumber The boot option number for the key option.\r
316 @param Modifier Key shift state.\r
317 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
318\r
319 @retval EFI_SUCCESS The key option is added.\r
320 @retval EFI_ALREADY_STARTED The hot key is already used by certain key option.\r
321**/\r
322EFI_STATUS\r
323EFIAPI\r
324EfiBootManagerAddKeyOptionVariable (\r
325 OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption, OPTIONAL\r
326 IN UINT16 BootOptionNumber,\r
327 IN UINT32 Modifier,\r
328 ...\r
329 );\r
330\r
331/**\r
332 Delete the Key Option variable and unregister the hot key\r
333\r
334 @param DeletedOption Return the deleted key options.\r
335 @param Modifier Key shift state.\r
336 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
337\r
338 @retval EFI_SUCCESS The key option is deleted.\r
339 @retval EFI_NOT_FOUND The key option cannot be found.\r
340**/\r
341EFI_STATUS\r
342EFIAPI\r
343EfiBootManagerDeleteKeyOptionVariable (\r
344 IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption, OPTIONAL\r
345 IN UINT32 Modifier,\r
346 ...\r
347 );\r
348\r
349/**\r
350 Register the key option to exit the waiting of the Boot Manager timeout.\r
351 Platform should ensure that the continue key option isn't conflict with\r
352 other boot key options.\r
353\r
354 @param Modifier Key shift state.\r
355 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
356\r
357 @retval EFI_SUCCESS Successfully register the continue key option.\r
358 @retval EFI_ALREADY_STARTED The continue key option is already registered.\r
359**/\r
360EFI_STATUS\r
361EFIAPI\r
362EfiBootManagerRegisterContinueKeyOption (\r
363 IN UINT32 Modifier,\r
364 ...\r
365 );\r
366\r
367/**\r
368 Try to boot the boot option triggered by hot key.\r
369**/\r
370VOID\r
371EFIAPI\r
372EfiBootManagerHotkeyBoot (\r
373 VOID\r
374 );\r
375//\r
376// Boot Manager boot library functions.\r
377//\r
378\r
379/**\r
380 The function creates boot options for all possible bootable medias in the following order:\r
381 1. Removable BlockIo - The boot option only points to the removable media\r
382 device, like USB key, DVD, Floppy etc.\r
383 2. Fixed BlockIo - The boot option only points to a Fixed blockIo device,\r
384 like HardDisk.\r
385 3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting\r
386 SimpleFileSystem Protocol, but not supporting BlockIo\r
387 protocol.\r
d1102dba 388 4. LoadFile - The boot option points to the media supporting\r
067ed98a
RN
389 LoadFile protocol.\r
390 Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior\r
391\r
392 The function won't delete the boot option not added by itself.\r
393**/\r
394VOID\r
395EFIAPI\r
396EfiBootManagerRefreshAllBootOption (\r
397 VOID\r
398 );\r
399\r
400/**\r
401 Attempt to boot the EFI boot option. This routine sets L"BootCurent" and\r
402 signals the EFI ready to boot event. If the device path for the option starts\r
403 with a BBS device path a legacy boot is attempted. Short form device paths are\r
d1102dba 404 also supported via this rountine. A device path starting with\r
067ed98a 405 MEDIA_HARDDRIVE_DP, MSG_USB_WWID_DP, MSG_USB_CLASS_DP gets expaned out\r
d1102dba 406 to find the first device that matches. If the BootOption Device Path\r
067ed98a
RN
407 fails the removable media boot algorithm is attempted (\EFI\BOOTIA32.EFI,\r
408 \EFI\BOOTX64.EFI,... only one file type is tried per processor type)\r
409\r
410 @param BootOption Boot Option to try and boot.\r
411 On return, BootOption->Status contains the boot status:\r
412 EFI_SUCCESS BootOption was booted\r
413 EFI_UNSUPPORTED BootOption isn't supported.\r
414 EFI_NOT_FOUND The BootOption was not found on the system\r
415 Others BootOption failed with this error status\r
416\r
417**/\r
418VOID\r
419EFIAPI\r
420EfiBootManagerBoot (\r
421 IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
422 );\r
423\r
424/**\r
e58f1ae5
SW
425 Return the boot option corresponding to the Boot Manager Menu.\r
426 It may automatically create one if the boot option hasn't been created yet.\r
427\r
067ed98a
RN
428 @param BootOption Return the Boot Manager Menu.\r
429\r
430 @retval EFI_SUCCESS The Boot Manager Menu is successfully returned.\r
e58f1ae5
SW
431 @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.\r
432 @retval others Return status of gRT->SetVariable (). BootOption still points\r
433 to the Boot Manager Menu even the Status is not EFI_SUCCESS\r
434 and EFI_NOT_FOUND.\r
067ed98a
RN
435**/\r
436EFI_STATUS\r
437EFIAPI\r
438EfiBootManagerGetBootManagerMenu (\r
439 EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
440 );\r
4ed2440d 441\r
b4e1ad87
CC
442/**\r
443 Get the next possible full path pointing to the load option.\r
444 The routine doesn't guarantee the returned full path points to an existing\r
445 file, and it also doesn't guarantee the existing file is a valid load option.\r
446 BmGetNextLoadOptionBuffer() guarantees.\r
447\r
448 @param FilePath The device path pointing to a load option.\r
449 It could be a short-form device path.\r
450 @param FullPath The full path returned by the routine in last call.\r
451 Set to NULL in first call.\r
452\r
453 @return The next possible full path pointing to the load option.\r
454 Caller is responsible to free the memory.\r
455**/\r
456EFI_DEVICE_PATH_PROTOCOL *\r
68a4e15e
CC
457EFIAPI\r
458EfiBootManagerGetNextLoadOptionDevicePath (\r
b4e1ad87
CC
459 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
460 IN EFI_DEVICE_PATH_PROTOCOL *FullPath\r
461 );\r
4ed2440d
RN
462\r
463/**\r
464 Get the load option by its device path.\r
465\r
466 @param FilePath The device path pointing to a load option.\r
467 It could be a short-form device path.\r
468 @param FullPath Return the full device path of the load option after\r
469 short-form device path expanding.\r
470 Caller is responsible to free it.\r
471 @param FileSize Return the load option size.\r
472\r
473 @return The load option buffer. Caller is responsible to free the memory.\r
474**/\r
475VOID *\r
476EFIAPI\r
477EfiBootManagerGetLoadOptionBuffer (\r
478 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
479 OUT EFI_DEVICE_PATH_PROTOCOL **FullPath,\r
480 OUT UINTN *FileSize\r
481 );\r
067ed98a
RN
482\r
483/**\r
d1102dba 484 The function enumerates all the legacy boot options, creates them and\r
067ed98a
RN
485 registers them in the BootOrder variable.\r
486**/\r
487typedef\r
488VOID\r
489(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION) (\r
490 VOID\r
491 );\r
492\r
493/**\r
494 The function boots a legacy boot option.\r
495**/\r
496typedef\r
497VOID\r
498(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT) (\r
499 IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
500 );\r
501\r
502/**\r
503 The function registers the legacy boot support capabilities.\r
504\r
505 @param RefreshLegacyBootOption The function pointer to create all the legacy boot options.\r
506 @param LegacyBoot The function pointer to boot the legacy boot option.\r
507**/\r
508VOID\r
509EFIAPI\r
510EfiBootManagerRegisterLegacyBootSupport (\r
511 EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption,\r
512 EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot\r
513 );\r
514\r
f41c71d2
RN
515/**\r
516 Return the platform provided boot option description for the controller.\r
517\r
518 @param Handle Controller handle.\r
519 @param DefaultDescription Default boot description provided by core.\r
520\r
521 @return The callee allocated description string\r
522 or NULL if the handler wants to use DefaultDescription.\r
523**/\r
524typedef\r
525CHAR16 *\r
526(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER) (\r
527 IN EFI_HANDLE Handle,\r
528 IN CONST CHAR16 *DefaultDescription\r
529 );\r
530\r
531/**\r
532 Register the platform provided boot description handler.\r
533\r
534 @param Handler The platform provided boot description handler\r
535\r
536 @retval EFI_SUCCESS The handler was registered successfully.\r
537 @retval EFI_ALREADY_STARTED The handler was already registered.\r
538 @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration.\r
539**/\r
540EFI_STATUS\r
541EFIAPI\r
542EfiBootManagerRegisterBootDescriptionHandler (\r
543 IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler\r
544 );\r
067ed98a
RN
545\r
546//\r
547// Boot Manager connect and disconnect library functions\r
548//\r
549\r
550/**\r
551 This function will connect all the system driver to controller\r
552 first, and then special connect the default console, this make\r
553 sure all the system controller available and the platform default\r
554 console connected.\r
555**/\r
556VOID\r
557EFIAPI\r
558EfiBootManagerConnectAll (\r
559 VOID\r
560 );\r
561\r
562/**\r
563 This function will create all handles associate with every device\r
564 path node. If the handle associate with one device path node can not\r
565 be created successfully, then still give chance to do the dispatch,\r
566 which load the missing drivers if possible.\r
567\r
568 @param DevicePathToConnect The device path which will be connected, it can be\r
569 a multi-instance device path\r
570 @param MatchingHandle Return the controller handle closest to the DevicePathToConnect\r
571\r
572 @retval EFI_SUCCESS All handles associate with every device path node\r
573 have been created.\r
574 @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles.\r
575 @retval EFI_NOT_FOUND Create the handle associate with one device path\r
576 node failed.\r
d1102dba 577 @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device\r
067ed98a
RN
578 drivers on the DevicePath.\r
579**/\r
580EFI_STATUS\r
581EFIAPI\r
582EfiBootManagerConnectDevicePath (\r
583 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,\r
584 OUT EFI_HANDLE *MatchingHandle OPTIONAL\r
585 );\r
586\r
587/**\r
d1102dba
LG
588 This function will disconnect all current system handles.\r
589\r
067ed98a
RN
590 gBS->DisconnectController() is invoked for each handle exists in system handle buffer.\r
591 If handle is a bus type handle, all childrens also are disconnected recursively by\r
592 gBS->DisconnectController().\r
593**/\r
594VOID\r
595EFIAPI\r
596EfiBootManagerDisconnectAll (\r
597 VOID\r
598 );\r
599\r
600\r
601//\r
602// Boot Manager console library functions\r
603//\r
604\r
605typedef enum {\r
606 ConIn,\r
607 ConOut,\r
608 ErrOut,\r
609 ConInDev,\r
610 ConOutDev,\r
611 ErrOutDev,\r
612 ConsoleTypeMax\r
613} CONSOLE_TYPE;\r
614\r
615/**\r
616 This function will connect all the console devices base on the console\r
617 device variable ConIn, ConOut and ErrOut.\r
618\r
619 @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error.\r
620 @retval EFI_SUCCESS Success connect any one instance of the console\r
621 device path base on the variable ConVarName.\r
622**/\r
623EFI_STATUS\r
624EFIAPI\r
625EfiBootManagerConnectAllDefaultConsoles (\r
626 VOID\r
627 );\r
628\r
629/**\r
630 This function updates the console variable based on ConVarName. It can\r
631 add or remove one specific console device path from the variable\r
632\r
633 @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev.\r
634 @param CustomizedConDevicePath The console device path to be added to\r
635 the console variable. Cannot be multi-instance.\r
636 @param ExclusiveDevicePath The console device path to be removed\r
637 from the console variable. Cannot be multi-instance.\r
638\r
639 @retval EFI_UNSUPPORTED The added device path is the same as a removed one.\r
640 @retval EFI_SUCCESS Successfully added or removed the device path from the\r
641 console variable.\r
642\r
643**/\r
644EFI_STATUS\r
645EFIAPI\r
646EfiBootManagerUpdateConsoleVariable (\r
647 IN CONSOLE_TYPE ConsoleType,\r
648 IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r
649 IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r
650 );\r
651\r
652/**\r
653 Connect the console device base on the variable ConVarName, if\r
654 device path of the ConVarName is multi-instance device path, if\r
655 anyone of the instances is connected success, then this function\r
656 will return success.\r
657\r
658 @param ConsoleType ConIn, ConOut or ErrOut.\r
659\r
660 @retval EFI_NOT_FOUND There is not any console devices connected\r
661 success\r
662 @retval EFI_SUCCESS Success connect any one instance of the console\r
663 device path base on the variable ConVarName.\r
664\r
665**/\r
666EFI_STATUS\r
667EFIAPI\r
668EfiBootManagerConnectConsoleVariable (\r
669 IN CONSOLE_TYPE ConsoleType\r
670 );\r
671\r
672/**\r
d1102dba 673 Query all the children of VideoController and return the device paths of all the\r
067ed98a
RN
674 children that support GraphicsOutput protocol.\r
675\r
676 @param VideoController PCI handle of video controller.\r
677\r
678 @return Device paths of all the children that support GraphicsOutput protocol.\r
679**/\r
680EFI_DEVICE_PATH_PROTOCOL *\r
681EFIAPI\r
682EfiBootManagerGetGopDevicePath (\r
683 IN EFI_HANDLE VideoController\r
684 );\r
685\r
686/**\r
687 Connect the platform active active video controller.\r
688\r
689 @param VideoController PCI handle of video controller.\r
690\r
691 @retval EFI_NOT_FOUND There is no active video controller.\r
692 @retval EFI_SUCCESS The video controller is connected.\r
693**/\r
694EFI_STATUS\r
695EFIAPI\r
696EfiBootManagerConnectVideoController (\r
697 EFI_HANDLE VideoController OPTIONAL\r
698 );\r
699\r
700//\r
701// Boot Manager driver health library functions.\r
702//\r
703\r
704typedef struct {\r
705 EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;\r
706\r
707 ///\r
708 /// Driver relative handles\r
709 ///\r
710 EFI_HANDLE DriverHealthHandle;\r
711 EFI_HANDLE ControllerHandle;\r
712 EFI_HANDLE ChildHandle;\r
713\r
714 ///\r
d1102dba 715 /// Driver health messages of the specify Driver\r
067ed98a
RN
716 ///\r
717 EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;\r
718\r
719 ///\r
720 /// HII relative handles\r
721 ///\r
722 EFI_HII_HANDLE HiiHandle;\r
723\r
724 ///\r
725 /// Driver Health status\r
726 ///\r
727 EFI_DRIVER_HEALTH_STATUS HealthStatus;\r
728} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO;\r
729\r
730/**\r
731 Return all the Driver Health information.\r
732\r
733 When the cumulative health status of all the controllers managed by the\r
734 driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one\r
735 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such\r
736 EFI_DRIVER_HEALTH_PROTOCOL instance.\r
737 Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO\r
738 entry. Additionally every child controller creates one\r
739 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver.\r
740\r
741 @param Count Return the count of the Driver Health information.\r
742\r
743 @retval NULL No Driver Health information is returned.\r
744 @retval !NULL Pointer to the Driver Health information array.\r
745**/\r
746EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *\r
747EFIAPI\r
748EfiBootManagerGetDriverHealthInfo (\r
749 UINTN *Count\r
750 );\r
751\r
752/**\r
753 Free the Driver Health information array.\r
754\r
755 @param DriverHealthInfo Pointer to array of the Driver Health information.\r
756 @param Count Count of the array.\r
757\r
758 @retval EFI_SUCCESS The array is freed.\r
759 @retval EFI_INVALID_PARAMETER The array is NULL.\r
760**/\r
761EFI_STATUS\r
762EFIAPI\r
763EfiBootManagerFreeDriverHealthInfo (\r
764 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo,\r
765 UINTN Count\r
766 );\r
767\r
768/**\r
769 Process (load and execute) the load option.\r
770\r
771 @param LoadOption Pointer to the load option.\r
772\r
d1102dba 773 @retval EFI_INVALID_PARAMETER The load option type is invalid,\r
067ed98a
RN
774 or the load option file path doesn't point to a valid file.\r
775 @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot.\r
776 @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed.\r
777**/\r
778EFI_STATUS\r
779EFIAPI\r
780EfiBootManagerProcessLoadOption (\r
781 EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
782 );\r
3dc5c1ae
TP
783\r
784/**\r
785 Check whether the VariableName is a valid load option variable name\r
786 and return the load option type and option number.\r
787\r
788 @param VariableName The name of the load option variable.\r
789 @param OptionType Return the load option type.\r
790 @param OptionNumber Return the load option number.\r
791\r
792 @retval TRUE The variable name is valid; The load option type and\r
793 load option number are returned.\r
794 @retval FALSE The variable name is NOT valid.\r
795**/\r
796BOOLEAN\r
797EFIAPI\r
798EfiBootManagerIsValidLoadOptionVariableName (\r
799 IN CHAR16 *VariableName,\r
800 OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL,\r
801 OUT UINT16 *OptionNumber OPTIONAL\r
802 );\r
803\r
b33af221
RN
804\r
805/**\r
806 Dispatch the deferred images that are returned from all DeferredImageLoad instances.\r
807\r
808 @retval EFI_SUCCESS At least one deferred image is loaded successfully and started.\r
809 @retval EFI_NOT_FOUND There is no deferred image.\r
810 @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load.\r
811**/\r
812EFI_STATUS\r
813EFIAPI\r
814EfiBootManagerDispatchDeferredImages (\r
815 VOID\r
816 );\r
067ed98a 817#endif\r