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