]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/UefiBootManagerLib.h
MdeModulePkg: Skip registering BootManagerMenu if absent
[mirror_edk2.git] / MdeModulePkg / Include / Library / UefiBootManagerLib.h
index 886229ed9e3cea1c741f4878ee9420b0c04bbb3b..e333ffd86bcef712a797013a782a73bac7247361 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Provide Boot Manager related library APIs.\r
 \r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -30,6 +31,7 @@ typedef enum {
   LoadOptionTypeDriver,\r
   LoadOptionTypeSysPrep,\r
   LoadOptionTypeBoot,\r
+  LoadOptionTypePlatformRecovery,\r
   LoadOptionTypeMax\r
 } EFI_BOOT_MANAGER_LOAD_OPTION_TYPE;\r
 \r
@@ -213,7 +215,7 @@ EfiBootManagerDeleteLoadOptionVariable (
   reflect the new order.\r
 \r
   @param OptionType        The type of the load option.\r
-  @param Comparator        The comparator function pointer.\r
+  @param CompareFunction   The comparator function pointer.\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -222,6 +224,27 @@ EfiBootManagerSortLoadOptionVariable (
   IN SORT_COMPARE                      CompareFunction\r
   );\r
 \r
+/**\r
+  Return the index of the load option in the load option array.\r
+\r
+  The function consider two load options are equal when the \r
+  OptionType, Attributes, Description, FilePath and OptionalData are equal.\r
+\r
+  @param Key    Pointer to the load option to be found.\r
+  @param Array  Pointer to the array of load options to be found.\r
+  @param Count  Number of entries in the Array.\r
+\r
+  @retval -1          Key wasn't found in the Array.\r
+  @retval 0 ~ Count-1 The index of the Key in the Array.\r
+**/\r
+INTN\r
+EFIAPI\r
+EfiBootManagerFindLoadOption (\r
+  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,\r
+  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,\r
+  IN UINTN                              Count\r
+  );\r
+\r
 //\r
 // Boot Manager hot key library functions.\r
 //\r
@@ -395,12 +418,16 @@ EfiBootManagerBoot (
   );\r
 \r
 /**\r
-  Return the Boot Manager Menu.\r
\r
+  Return the boot option corresponding to the Boot Manager Menu.\r
+  It may automatically create one if the boot option hasn't been created yet.\r
+\r
   @param BootOption    Return the Boot Manager Menu.\r
 \r
   @retval EFI_SUCCESS   The Boot Manager Menu is successfully returned.\r
-  @retval EFI_NOT_FOUND The Boot Manager Menu is not found.\r
+  @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.\r
+  @retval others        Return status of gRT->SetVariable (). BootOption still points\r
+                        to the Boot Manager Menu even the Status is not EFI_SUCCESS\r
+                        and EFI_NOT_FOUND.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -408,6 +435,27 @@ EfiBootManagerGetBootManagerMenu (
   EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
   );\r
 \r
+\r
+/**\r
+  Get the load option by its device path.\r
+\r
+  @param FilePath  The device path pointing to a load option.\r
+                   It could be a short-form device path.\r
+  @param FullPath  Return the full device path of the load option after\r
+                   short-form device path expanding.\r
+                   Caller is responsible to free it.\r
+  @param FileSize  Return the load option size.\r
+\r
+  @return The load option buffer. Caller is responsible to free the memory.\r
+**/\r
+VOID *\r
+EFIAPI\r
+EfiBootManagerGetLoadOptionBuffer (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL          *FilePath,\r
+  OUT EFI_DEVICE_PATH_PROTOCOL          **FullPath,\r
+  OUT UINTN                             *FileSize\r
+  );\r
+\r
 /**\r
   The function enumerates all the legacy boot options, creates them and \r
   registers them in the BootOrder variable.\r
@@ -440,6 +488,36 @@ EfiBootManagerRegisterLegacyBootSupport (
   EFI_BOOT_MANAGER_LEGACY_BOOT                  LegacyBoot\r
   );\r
 \r
+/**\r
+  Return the platform provided boot option description for the controller.\r
+\r
+  @param Handle                Controller handle.\r
+  @param DefaultDescription    Default boot description provided by core.\r
+\r
+  @return  The callee allocated description string\r
+           or NULL if the handler wants to use DefaultDescription.\r
+**/\r
+typedef\r
+CHAR16 *\r
+(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER) (\r
+  IN EFI_HANDLE                  Handle,\r
+  IN CONST CHAR16                *DefaultDescription\r
+  );\r
+\r
+/**\r
+  Register the platform provided boot description handler.\r
+\r
+  @param Handler  The platform provided boot description handler\r
+\r
+  @retval EFI_SUCCESS          The handler was registered successfully.\r
+  @retval EFI_ALREADY_STARTED  The handler was already registered.\r
+  @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiBootManagerRegisterBootDescriptionHandler (\r
+  IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER  Handler\r
+  );\r
 \r
 //\r
 // Boot Manager connect and disconnect library functions\r
@@ -678,4 +756,25 @@ EFIAPI
 EfiBootManagerProcessLoadOption (\r
   EFI_BOOT_MANAGER_LOAD_OPTION       *LoadOption\r
   );\r
+\r
+/**\r
+  Check whether the VariableName is a valid load option variable name\r
+  and return the load option type and option number.\r
+\r
+  @param VariableName The name of the load option variable.\r
+  @param OptionType   Return the load option type.\r
+  @param OptionNumber Return the load option number.\r
+\r
+  @retval TRUE  The variable name is valid; The load option type and\r
+                load option number are returned.\r
+  @retval FALSE The variable name is NOT valid.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+EfiBootManagerIsValidLoadOptionVariableName (\r
+  IN CHAR16                             *VariableName,\r
+  OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType   OPTIONAL,\r
+  OUT UINT16                            *OptionNumber OPTIONAL\r
+  );\r
+\r
 #endif\r