]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/UefiBootManagerLib.h
MdeModulePkg: Apply uncrustify changes
[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
067ed98a
RN
10#ifndef _UEFI_BOOT_MANAGER_LIB_H_\r
11#define _UEFI_BOOT_MANAGER_LIB_H_\r
12\r
13#include <Protocol/DriverHealth.h>\r
14#include <Library/SortLib.h>\r
15\r
16//\r
17// Boot Manager load option library functions.\r
18//\r
19\r
20//\r
21// Load Option Type\r
22//\r
23typedef enum {\r
24 LoadOptionTypeDriver,\r
25 LoadOptionTypeSysPrep,\r
26 LoadOptionTypeBoot,\r
780e05ca 27 LoadOptionTypePlatformRecovery,\r
067ed98a
RN
28 LoadOptionTypeMax\r
29} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE;\r
30\r
31typedef enum {\r
1436aea4 32 LoadOptionNumberMax = 0x10000,\r
067ed98a
RN
33 LoadOptionNumberUnassigned = LoadOptionNumberMax\r
34} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER;\r
35\r
36//\r
37// Common structure definition for DriverOption and BootOption\r
38//\r
39typedef struct {\r
40 //\r
41 // Data read from UEFI NV variables\r
42 //\r
1436aea4
MK
43 UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned\r
44 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver\r
45 UINT32 Attributes; // Load Option Attributes\r
46 CHAR16 *Description; // Load Option Description\r
47 EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path\r
48 UINT8 *OptionalData; // Load Option optional data to pass into image\r
49 UINT32 OptionalDataSize; // Load Option size of OptionalData\r
50 EFI_GUID VendorGuid;\r
067ed98a
RN
51\r
52 //\r
53 // Used at runtime\r
54 //\r
1436aea4
MK
55 EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage ()\r
56 CHAR16 *ExitData; // Exit data returned from gBS->StartImage ()\r
57 UINTN ExitDataSize; // Size of ExitData\r
067ed98a
RN
58} EFI_BOOT_MANAGER_LOAD_OPTION;\r
59\r
60/**\r
61 Returns an array of load options based on the EFI variable\r
62 L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it.\r
d1102dba 63 #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry.\r
067ed98a
RN
64\r
65 @param LoadOptionCount Returns number of entries in the array.\r
66 @param LoadOptionType The type of the load option.\r
67\r
68 @retval NULL No load options exist.\r
69 @retval !NULL Array of load option entries.\r
70\r
71**/\r
72EFI_BOOT_MANAGER_LOAD_OPTION *\r
73EFIAPI\r
74EfiBootManagerGetLoadOptions (\r
1436aea4
MK
75 OUT UINTN *LoadOptionCount,\r
76 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType\r
067ed98a
RN
77 );\r
78\r
79/**\r
80 Free an array of load options returned from EfiBootManagerGetLoadOptions().\r
81\r
82 @param LoadOptions Pointer to the array of load options to free.\r
83 @param LoadOptionCount Number of array entries in LoadOptions.\r
84\r
85 @return EFI_SUCCESS LoadOptions was freed.\r
86 @return EFI_INVALID_PARAMETER LoadOptions is NULL.\r
87**/\r
88EFI_STATUS\r
89EFIAPI\r
90EfiBootManagerFreeLoadOptions (\r
91 IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,\r
92 IN UINTN LoadOptionCount\r
93 );\r
94\r
95/**\r
96 Initialize a load option.\r
97\r
98 @param Option Pointer to the load option to be initialized.\r
99 @param OptionNumber Option number of the load option.\r
100 @param OptionType Type of the load option.\r
101 @param Attributes Attributes of the load option.\r
102 @param Description Description of the load option.\r
103 @param FilePath Device path of the load option.\r
104 @param OptionalData Optional data of the load option.\r
105 @param OptionalDataSize Size of the optional data of the load option.\r
106\r
107 @retval EFI_SUCCESS The load option was initialized successfully.\r
108 @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL.\r
109**/\r
110EFI_STATUS\r
111EFIAPI\r
112EfiBootManagerInitializeLoadOption (\r
1436aea4
MK
113 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,\r
114 IN UINTN OptionNumber,\r
115 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,\r
116 IN UINT32 Attributes,\r
117 IN CHAR16 *Description,\r
118 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
119 IN UINT8 *OptionalData,\r
120 IN UINT32 OptionalDataSize\r
067ed98a
RN
121 );\r
122\r
123/**\r
124 Free a load option created by EfiBootManagerInitializeLoadOption()\r
125 or EfiBootManagerVariableToLoadOption().\r
126\r
127 @param LoadOption Pointer to the load option to free.\r
128 CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify\r
129 @return EFI_SUCCESS LoadOption was freed.\r
130 @return EFI_INVALID_PARAMETER LoadOption is NULL.\r
131\r
132**/\r
133EFI_STATUS\r
134EFIAPI\r
135EfiBootManagerFreeLoadOption (\r
136 IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
137 );\r
138\r
139/**\r
140 Initialize the load option from the VariableName.\r
141\r
142 @param VariableName EFI Variable name which could be Boot#### or\r
143 Driver####\r
144 @param LoadOption Pointer to the load option to be initialized\r
145\r
146 @retval EFI_SUCCESS The option was created\r
147 @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL.\r
148 @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found.\r
149**/\r
150EFI_STATUS\r
151EFIAPI\r
152EfiBootManagerVariableToLoadOption (\r
1436aea4
MK
153 IN CHAR16 *VariableName,\r
154 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
067ed98a
RN
155 );\r
156\r
157/**\r
158 Create the Boot#### or Driver#### variable from the load option.\r
d1102dba 159\r
067ed98a
RN
160 @param LoadOption Pointer to the load option.\r
161\r
162 @retval EFI_SUCCESS The variable was created.\r
163 @retval Others Error status returned by RT->SetVariable.\r
164**/\r
165EFI_STATUS\r
166EFIAPI\r
167EfiBootManagerLoadOptionToVariable (\r
1436aea4 168 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
067ed98a
RN
169 );\r
170\r
171/**\r
8b5c80e0
RN
172 This function will register the new Boot####, Driver#### or SysPrep#### option.\r
173 After the *#### is updated, the *Order will also be updated.\r
174\r
175 @param Option Pointer to load option to add. If on input\r
176 Option->OptionNumber is LoadOptionNumberUnassigned,\r
177 then on output Option->OptionNumber is updated to\r
178 the number of the new Boot####,\r
179 Driver#### or SysPrep#### option.\r
180 @param Position Position of the new load option to put in the ****Order variable.\r
181\r
182 @retval EFI_SUCCESS The *#### have been successfully registered.\r
183 @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF.\r
184 @retval EFI_ALREADY_STARTED The option number of Option is being used already.\r
185 Note: this API only adds new load option, no replacement support.\r
186 @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the\r
187 option number specified in the Option is LoadOptionNumberUnassigned.\r
188 @return Status codes of gRT->SetVariable ().\r
067ed98a 189\r
067ed98a
RN
190**/\r
191EFI_STATUS\r
192EFIAPI\r
193EfiBootManagerAddLoadOptionVariable (\r
1436aea4
MK
194 IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,\r
195 IN UINTN Position\r
067ed98a
RN
196 );\r
197\r
198/**\r
199 Delete the load option according to the OptionNumber and OptionType.\r
d1102dba 200\r
067ed98a 201 Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber.\r
d1102dba 202\r
067ed98a
RN
203 @param OptionNumber Option number of the load option.\r
204 @param OptionType Type of the load option.\r
205\r
206 @retval EFI_NOT_FOUND The load option cannot be found.\r
207 @retval EFI_SUCCESS The load option was deleted.\r
208**/\r
209EFI_STATUS\r
210EFIAPI\r
211EfiBootManagerDeleteLoadOptionVariable (\r
212 IN UINTN OptionNumber,\r
213 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType\r
214 );\r
215\r
216/**\r
d1102dba 217 Sort the load options. The DriverOrder/BootOrder variables will be re-created to\r
067ed98a
RN
218 reflect the new order.\r
219\r
220 @param OptionType The type of the load option.\r
54ae9c08 221 @param CompareFunction The comparator function pointer.\r
067ed98a
RN
222**/\r
223VOID\r
224EFIAPI\r
225EfiBootManagerSortLoadOptionVariable (\r
1436aea4
MK
226 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,\r
227 IN SORT_COMPARE CompareFunction\r
067ed98a
RN
228 );\r
229\r
5d3a9896
SW
230/**\r
231 Return the index of the load option in the load option array.\r
232\r
d1102dba 233 The function consider two load options are equal when the\r
5d3a9896
SW
234 OptionType, Attributes, Description, FilePath and OptionalData are equal.\r
235\r
236 @param Key Pointer to the load option to be found.\r
237 @param Array Pointer to the array of load options to be found.\r
238 @param Count Number of entries in the Array.\r
239\r
240 @retval -1 Key wasn't found in the Array.\r
241 @retval 0 ~ Count-1 The index of the Key in the Array.\r
242**/\r
243INTN\r
244EFIAPI\r
245EfiBootManagerFindLoadOption (\r
1436aea4
MK
246 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,\r
247 IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,\r
248 IN UINTN Count\r
5d3a9896
SW
249 );\r
250\r
067ed98a
RN
251//\r
252// Boot Manager hot key library functions.\r
253//\r
254\r
255#pragma pack(1)\r
256///\r
257/// EFI Key Option.\r
258///\r
259typedef struct {\r
260 ///\r
261 /// Specifies options about how the key will be processed.\r
262 ///\r
1436aea4 263 EFI_BOOT_KEY_DATA KeyData;\r
067ed98a
RN
264 ///\r
265 /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to\r
266 /// which BootOption refers. If the CRC-32s do not match this value, then this key\r
267 /// option is ignored.\r
268 ///\r
1436aea4 269 UINT32 BootOptionCrc;\r
067ed98a
RN
270 ///\r
271 /// The Boot#### option which will be invoked if this key is pressed and the boot option\r
272 /// is active (LOAD_OPTION_ACTIVE is set).\r
273 ///\r
1436aea4 274 UINT16 BootOption;\r
067ed98a
RN
275 ///\r
276 /// The key codes to compare against those returned by the\r
277 /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.\r
278 /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.\r
279 ///\r
1436aea4
MK
280 EFI_INPUT_KEY Keys[3];\r
281 UINT16 OptionNumber;\r
067ed98a
RN
282} EFI_BOOT_MANAGER_KEY_OPTION;\r
283#pragma pack()\r
284\r
285/**\r
286 Start the hot key service so that the key press can trigger the boot option.\r
287\r
d1102dba 288 @param HotkeyTriggered Return the waitable event and it will be signaled\r
067ed98a
RN
289 when a valid hot key is pressed.\r
290\r
291 @retval EFI_SUCCESS The hot key service is started.\r
292**/\r
293EFI_STATUS\r
294EFIAPI\r
295EfiBootManagerStartHotkeyService (\r
1436aea4 296 IN EFI_EVENT *HotkeyTriggered\r
067ed98a
RN
297 );\r
298\r
299//\r
300// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable\r
301//\r
1436aea4
MK
302#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001\r
303#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002\r
304#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004\r
305#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008\r
306#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010\r
307#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020\r
067ed98a
RN
308\r
309/**\r
310 Add the key option.\r
311 It adds the key option variable and the key option takes affect immediately.\r
312\r
313 @param AddedOption Return the added key option.\r
314 @param BootOptionNumber The boot option number for the key option.\r
315 @param Modifier Key shift state.\r
316 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
317\r
318 @retval EFI_SUCCESS The key option is added.\r
319 @retval EFI_ALREADY_STARTED The hot key is already used by certain key option.\r
320**/\r
321EFI_STATUS\r
322EFIAPI\r
323EfiBootManagerAddKeyOptionVariable (\r
1436aea4
MK
324 OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL,\r
325 IN UINT16 BootOptionNumber,\r
326 IN UINT32 Modifier,\r
067ed98a
RN
327 ...\r
328 );\r
329\r
330/**\r
331 Delete the Key Option variable and unregister the hot key\r
332\r
333 @param DeletedOption Return the deleted key options.\r
334 @param Modifier Key shift state.\r
335 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
336\r
337 @retval EFI_SUCCESS The key option is deleted.\r
338 @retval EFI_NOT_FOUND The key option cannot be found.\r
339**/\r
340EFI_STATUS\r
341EFIAPI\r
342EfiBootManagerDeleteKeyOptionVariable (\r
1436aea4
MK
343 IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL,\r
344 IN UINT32 Modifier,\r
067ed98a
RN
345 ...\r
346 );\r
347\r
348/**\r
349 Register the key option to exit the waiting of the Boot Manager timeout.\r
350 Platform should ensure that the continue key option isn't conflict with\r
351 other boot key options.\r
352\r
353 @param Modifier Key shift state.\r
354 @param ... Parameter list of pointer of EFI_INPUT_KEY.\r
355\r
356 @retval EFI_SUCCESS Successfully register the continue key option.\r
357 @retval EFI_ALREADY_STARTED The continue key option is already registered.\r
358**/\r
359EFI_STATUS\r
360EFIAPI\r
361EfiBootManagerRegisterContinueKeyOption (\r
1436aea4 362 IN UINT32 Modifier,\r
067ed98a
RN
363 ...\r
364 );\r
365\r
366/**\r
367 Try to boot the boot option triggered by hot key.\r
368**/\r
369VOID\r
370EFIAPI\r
371EfiBootManagerHotkeyBoot (\r
372 VOID\r
373 );\r
1436aea4 374\r
067ed98a
RN
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
1436aea4 439 EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
067ed98a 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
1436aea4
MK
459 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
460 IN EFI_DEVICE_PATH_PROTOCOL *FullPath\r
b4e1ad87 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
1436aea4
MK
478 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
479 OUT EFI_DEVICE_PATH_PROTOCOL **FullPath,\r
480 OUT UINTN *FileSize\r
4ed2440d 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
1436aea4 489(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION)(\r
067ed98a
RN
490 VOID\r
491 );\r
492\r
493/**\r
494 The function boots a legacy boot option.\r
495**/\r
496typedef\r
497VOID\r
1436aea4 498(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT)(\r
067ed98a
RN
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
1436aea4
MK
511 EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption,\r
512 EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot\r
067ed98a
RN
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
1436aea4 526(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER)(\r
f41c71d2
RN
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
067ed98a
RN
600//\r
601// Boot Manager console library functions\r
602//\r
603\r
604typedef enum {\r
605 ConIn,\r
606 ConOut,\r
607 ErrOut,\r
608 ConInDev,\r
609 ConOutDev,\r
610 ErrOutDev,\r
611 ConsoleTypeMax\r
612} CONSOLE_TYPE;\r
613\r
614/**\r
615 This function will connect all the console devices base on the console\r
616 device variable ConIn, ConOut and ErrOut.\r
617\r
618 @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error.\r
619 @retval EFI_SUCCESS Success connect any one instance of the console\r
620 device path base on the variable ConVarName.\r
621**/\r
622EFI_STATUS\r
623EFIAPI\r
624EfiBootManagerConnectAllDefaultConsoles (\r
625 VOID\r
626 );\r
627\r
628/**\r
629 This function updates the console variable based on ConVarName. It can\r
630 add or remove one specific console device path from the variable\r
631\r
632 @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev.\r
633 @param CustomizedConDevicePath The console device path to be added to\r
634 the console variable. Cannot be multi-instance.\r
635 @param ExclusiveDevicePath The console device path to be removed\r
636 from the console variable. Cannot be multi-instance.\r
637\r
638 @retval EFI_UNSUPPORTED The added device path is the same as a removed one.\r
639 @retval EFI_SUCCESS Successfully added or removed the device path from the\r
640 console variable.\r
641\r
642**/\r
643EFI_STATUS\r
644EFIAPI\r
645EfiBootManagerUpdateConsoleVariable (\r
646 IN CONSOLE_TYPE ConsoleType,\r
647 IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r
648 IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r
649 );\r
650\r
651/**\r
652 Connect the console device base on the variable ConVarName, if\r
653 device path of the ConVarName is multi-instance device path, if\r
654 anyone of the instances is connected success, then this function\r
655 will return success.\r
656\r
657 @param ConsoleType ConIn, ConOut or ErrOut.\r
658\r
659 @retval EFI_NOT_FOUND There is not any console devices connected\r
660 success\r
661 @retval EFI_SUCCESS Success connect any one instance of the console\r
662 device path base on the variable ConVarName.\r
663\r
664**/\r
665EFI_STATUS\r
666EFIAPI\r
667EfiBootManagerConnectConsoleVariable (\r
1436aea4 668 IN CONSOLE_TYPE ConsoleType\r
067ed98a
RN
669 );\r
670\r
671/**\r
d1102dba 672 Query all the children of VideoController and return the device paths of all the\r
067ed98a
RN
673 children that support GraphicsOutput protocol.\r
674\r
675 @param VideoController PCI handle of video controller.\r
676\r
677 @return Device paths of all the children that support GraphicsOutput protocol.\r
678**/\r
679EFI_DEVICE_PATH_PROTOCOL *\r
680EFIAPI\r
681EfiBootManagerGetGopDevicePath (\r
1436aea4 682 IN EFI_HANDLE VideoController\r
067ed98a
RN
683 );\r
684\r
685/**\r
686 Connect the platform active active video controller.\r
687\r
688 @param VideoController PCI handle of video controller.\r
689\r
690 @retval EFI_NOT_FOUND There is no active video controller.\r
691 @retval EFI_SUCCESS The video controller is connected.\r
692**/\r
693EFI_STATUS\r
694EFIAPI\r
695EfiBootManagerConnectVideoController (\r
1436aea4 696 EFI_HANDLE VideoController OPTIONAL\r
067ed98a
RN
697 );\r
698\r
699//\r
700// Boot Manager driver health library functions.\r
701//\r
702\r
703typedef struct {\r
1436aea4 704 EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;\r
067ed98a
RN
705\r
706 ///\r
707 /// Driver relative handles\r
708 ///\r
1436aea4
MK
709 EFI_HANDLE DriverHealthHandle;\r
710 EFI_HANDLE ControllerHandle;\r
711 EFI_HANDLE ChildHandle;\r
067ed98a
RN
712\r
713 ///\r
d1102dba 714 /// Driver health messages of the specify Driver\r
067ed98a 715 ///\r
1436aea4 716 EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;\r
067ed98a
RN
717\r
718 ///\r
719 /// HII relative handles\r
720 ///\r
1436aea4 721 EFI_HII_HANDLE HiiHandle;\r
067ed98a
RN
722\r
723 ///\r
724 /// Driver Health status\r
725 ///\r
1436aea4 726 EFI_DRIVER_HEALTH_STATUS HealthStatus;\r
067ed98a
RN
727} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO;\r
728\r
729/**\r
730 Return all the Driver Health information.\r
731\r
732 When the cumulative health status of all the controllers managed by the\r
733 driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one\r
734 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such\r
735 EFI_DRIVER_HEALTH_PROTOCOL instance.\r
736 Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO\r
737 entry. Additionally every child controller creates one\r
738 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver.\r
739\r
740 @param Count Return the count of the Driver Health information.\r
741\r
742 @retval NULL No Driver Health information is returned.\r
743 @retval !NULL Pointer to the Driver Health information array.\r
744**/\r
745EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *\r
746EFIAPI\r
747EfiBootManagerGetDriverHealthInfo (\r
1436aea4 748 UINTN *Count\r
067ed98a
RN
749 );\r
750\r
751/**\r
752 Free the Driver Health information array.\r
753\r
754 @param DriverHealthInfo Pointer to array of the Driver Health information.\r
755 @param Count Count of the array.\r
756\r
757 @retval EFI_SUCCESS The array is freed.\r
758 @retval EFI_INVALID_PARAMETER The array is NULL.\r
759**/\r
760EFI_STATUS\r
761EFIAPI\r
762EfiBootManagerFreeDriverHealthInfo (\r
763 EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo,\r
764 UINTN Count\r
765 );\r
766\r
767/**\r
768 Process (load and execute) the load option.\r
769\r
770 @param LoadOption Pointer to the load option.\r
771\r
d1102dba 772 @retval EFI_INVALID_PARAMETER The load option type is invalid,\r
067ed98a
RN
773 or the load option file path doesn't point to a valid file.\r
774 @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot.\r
775 @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed.\r
776**/\r
777EFI_STATUS\r
778EFIAPI\r
779EfiBootManagerProcessLoadOption (\r
1436aea4 780 EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption\r
067ed98a 781 );\r
3dc5c1ae
TP
782\r
783/**\r
784 Check whether the VariableName is a valid load option variable name\r
785 and return the load option type and option number.\r
786\r
787 @param VariableName The name of the load option variable.\r
788 @param OptionType Return the load option type.\r
789 @param OptionNumber Return the load option number.\r
790\r
791 @retval TRUE The variable name is valid; The load option type and\r
792 load option number are returned.\r
793 @retval FALSE The variable name is NOT valid.\r
794**/\r
795BOOLEAN\r
796EFIAPI\r
797EfiBootManagerIsValidLoadOptionVariableName (\r
1436aea4
MK
798 IN CHAR16 *VariableName,\r
799 OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL,\r
800 OUT UINT16 *OptionNumber OPTIONAL\r
3dc5c1ae
TP
801 );\r
802\r
b33af221
RN
803/**\r
804 Dispatch the deferred images that are returned from all DeferredImageLoad instances.\r
805\r
806 @retval EFI_SUCCESS At least one deferred image is loaded successfully and started.\r
807 @retval EFI_NOT_FOUND There is no deferred image.\r
808 @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load.\r
809**/\r
810EFI_STATUS\r
811EFIAPI\r
812EfiBootManagerDispatchDeferredImages (\r
813 VOID\r
814 );\r
1436aea4 815\r
067ed98a 816#endif\r