]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/GenericBdsLib.h
Sync in bug fix from EDK I:
[mirror_edk2.git] / MdeModulePkg / Include / Library / GenericBdsLib.h
index aca0ee5b2bd5775be980a56720196d996dd4e02c..76b7f9484f476667ec274a319a24df21ff316cfc 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  Generic BDS library definition, include the file and data structure\r
+  Generic BDS library definition, include the data structure and function.\r
 \r
 Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _GENERIC_BDS_LIB_H_\r
 #define _GENERIC_BDS_LIB_H_\r
 \r
-#include <PiDxe.h>\r
 #include <Protocol/HiiDatabase.h>\r
 #include <IndustryStandard/PeImage.h>\r
 \r
@@ -25,7 +24,7 @@ extern EFI_HANDLE mBdsImageHandle;
 //\r
 // Constants which are variable names used to access variables\r
 //\r
-#define VarLegacyDevOrder L"LegacyDevOrder"\r
+#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r
 \r
 //\r
 // Data structures and defines\r
@@ -105,10 +104,10 @@ typedef struct {
 //\r
 \r
 //\r
-// Bds boot relate lib functions\r
+// Bds boot related lib functions\r
 //\r
 /**\r
-  Boot from the EFI1.1 spec defined "BootNext" variable\r
+  Boot from the UEFI spec defined "BootNext" variable.\r
 \r
 **/\r
 VOID\r
@@ -118,17 +117,17 @@ BdsLibBootNext (
   );\r
 \r
 /**\r
-  Process the boot option follow the EFI 1.1 specification and\r
+  Process the boot option follow the UEFI specification and\r
   special treat the legacy boot option with BBS_DEVICE_PATH.\r
 \r
   @param  Option                 The boot option need to be processed\r
   @param  DevicePath             The device path which describe where to load the\r
                                  boot image or the legcy BBS device path to boot\r
                                  the legacy OS\r
-  @param  ExitDataSize           Returned directly from gBS->StartImage ()\r
-  @param  ExitData               Returned directly from gBS->StartImage ()\r
+  @param  ExitDataSize           The size of exit data.\r
+  @param  ExitData               Data returned when Boot image failed.\r
 \r
-  @retval EFI_SUCCESS            Status from gBS->StartImage ()\r
+  @retval EFI_SUCCESS            Boot from the input boot option successfully.\r
   @retval EFI_NOT_FOUND          If the Device Path is not found in the system\r
 \r
 **/\r
@@ -166,8 +165,7 @@ BdsLibEnumerateAllBootOption (
                                  boot option\r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
-\r
-  @return VOID\r
+  @param  String                 The description of the boot option.\r
 \r
 **/\r
 VOID\r
@@ -180,15 +178,13 @@ BdsLibBuildOptionFromHandle (
 \r
 \r
 /**\r
-  Build the on flash shell boot option with the handle parsed in\r
+  Build the on flash shell boot option with the handle parsed in.\r
 \r
   @param  Handle                 The handle which present the device path to create\r
                                  on flash shell boot option\r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -270,8 +266,8 @@ BdsLibBuildOptionFromVar (
   @param  VendorGuid            GUID part of EFI variable name\r
   @param  VariableSize          Returns the size of the EFI variable that was read\r
 \r
-  @return Dynamically allocated memory that contains a copy of the EFI variable.\r
-  @return Caller is responsible freeing the buffer.\r
+  @return                       Dynamically allocated memory that contains a copy of the EFI variable\r
+                                Caller is responsible freeing the buffer.\r
   @retval NULL                  Variable was not read\r
 \r
 **/\r
@@ -304,7 +300,7 @@ BdsLibOutputStrings (
 \r
 /**\r
   Build the boot#### or driver#### option from the VariableName, the\r
-  build boot#### or driver#### will also be linked to BdsCommonOptionList\r
+  build boot#### or driver#### will also be linked to BdsCommonOptionList.\r
 \r
   @param  BdsCommonOptionList   The header of the boot#### or driver#### option\r
                                 link list\r
@@ -430,7 +426,7 @@ BdsLibDisconnectAllEfi (
   );\r
 \r
 //\r
-// Bds console relate lib functions\r
+// Bds console related lib functions\r
 //\r
 /**\r
   This function will search every simpletxt devive in current system,\r
@@ -450,8 +446,7 @@ BdsLibConnectAllConsoles (
 \r
   @retval EFI_SUCCESS              At least one of the ConIn and ConOut device have\r
                                    been connected success.\r
-  @retval EFI_STATUS               Return the status of\r
-                                   BdsLibConnectConsoleVariable ().\r
+  @retval EFI_STATUS               Return the status of BdsLibConnectConsoleVariable ().\r
 \r
 **/\r
 EFI_STATUS\r
@@ -473,7 +468,7 @@ BdsLibConnectAllDefaultConsoles (
                                    from the console variable ConVarName, this\r
                                    parameter can not be multi-instance.\r
 \r
-  @retval EFI_UNSUPPORTED          Add or remove the same device path.\r
+  @retval EFI_UNSUPPORTED          The added device path is same to the removed one.\r
   @retval EFI_SUCCESS              Success add or remove the device path from  the\r
                                    console variable.\r
 \r
@@ -508,7 +503,7 @@ BdsLibConnectConsoleVariable (
   );\r
 \r
 //\r
-// Bds device path relate lib functions\r
+// Bds device path related lib functions\r
 //\r
 /**\r
   Function unpacks a device path data structure so that all the nodes\r
@@ -555,8 +550,8 @@ BdsLibDelPartMatchInstance (
   @param  Single                A pointer to a single-instance device path data\r
                                 structure.\r
 \r
-  @retval TRUE                  If the Single is contained within Multi\r
-  @retval FALSE                 The Single is not match within Multi\r
+  @retval TRUE                  If the Single device path is contained within Multi device path.\r
+  @retval FALSE                 The Single device path is not match within Multi device path.\r
 \r
 **/\r
 BOOLEAN\r
@@ -622,12 +617,20 @@ typedef struct {
 //\r
 #if defined (MDE_CPU_IPF)\r
 #define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r
-VOID\r
-ShadowAllOptionRom();\r
 #else\r
 #define EFI64_SHADOW_ALL_LEGACY_ROM()\r
 #endif\r
 \r
+/**\r
+  Shadow all Legacy OptionRom. \r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ShadowAllOptionRom (\r
+  VOID\r
+  );\r
+\r
 //\r
 // BBS support macros and functions\r
 //\r
@@ -641,27 +644,76 @@ ShadowAllOptionRom();
 #define REFRESH_LEGACY_BOOT_OPTIONS\r
 #endif\r
 \r
+/**\r
+  Delete all the invalid legacy boot options.\r
+\r
+  @retval EFI_SUCCESS             All invalide legacy boot options are deleted.\r
+  @retval EFI_OUT_OF_RESOURCES    Fail to allocate necessary memory.\r
+  @retval EFI_NOT_FOUND           Fail to retrive variable of boot order.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsDeleteAllInvalidLegacyBootOptions (\r
   VOID\r
   );\r
 \r
+/**\r
+\r
+  Add the legacy boot options from BBS table if they do not exist.\r
+\r
+  @retval EFI_SUCCESS       The boot options are added successfully \r
+                            or they are already in boot options.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsAddNonExistingLegacyBootOptions (\r
   VOID\r
   );\r
 \r
+/**\r
+\r
+  Add the legacy boot devices from BBS table into \r
+  the legacy device boot order.\r
+\r
+  @retval EFI_SUCCESS       The boot devices are added successfully.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsUpdateLegacyDevOrder (\r
   VOID\r
   );\r
 \r
+/**\r
+\r
+  Set the boot priority for BBS entries based on boot option entry and boot order.\r
+\r
+  @param  Entry             The boot option is to be checked for refresh BBS table.\r
+  \r
+  @retval EFI_SUCCESS       The boot priority for BBS entries is refreshed successfully.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsRefreshBbsTableForBoot (\r
   IN BDS_COMMON_OPTION        *Entry\r
   );\r
 \r
+/**\r
+\r
+  Delete boot option specified by OptionNumber and adjust the boot order.\r
+\r
+  @param  OptionNumber      The boot option to be deleted.\r
+  @param  BootOrder         Boot order list to be adjusted by remove this boot option.\r
+  @param  BootOrderSize     The size of Boot order list will be modified.\r
+  \r
+  @retval EFI_SUCCESS       The boot option is deleted successfully.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsDeleteBootOption (\r
   IN UINTN                       OptionNumber,\r
   IN OUT UINT16                  *BootOrder,\r
@@ -755,8 +807,7 @@ SetupResetReminder (
   @param  Device                SimpleFileSystem device handle\r
   @param  FileName              File name for the image\r
   @param  DosHeader             Pointer to dos header\r
-  @param  ImageHeader           Pointer to image header\r
-  @param  OptionalHeader        Pointer to optional header\r
+  @param  Hdr                   The buffer in which to return the PE32, PE32+, or TE header.\r
 \r
   @retval EFI_SUCCESS           Successfully get the machine type.\r
   @retval EFI_NOT_FOUND         The file is not found.\r
@@ -818,8 +869,8 @@ BdsLibGetImageHeader (
   @param  HardDriveDevicePath    A device path which starts with a hard drive media\r
                                  device path.\r
 \r
-  @retval TRUE                   There is a matched device path instance FALSE\r
-                                 -There is no matched device path instance\r
+  @retval TRUE                   There is a matched device path instance.\r
+  @retval FALSE                  There is no matched device path instance.\r
 \r
 **/\r
 BOOLEAN\r
@@ -858,7 +909,6 @@ BdsExpandPartitionPartialDevicePathToFull (
 \r
   @param  DevicePath             Device Path to a  bootable device\r
 \r
-  @retval NULL                   The device path points to an EFI bootable Media\r
   @retval NULL                   The media on the DevicePath is not bootable\r
 \r
 **/\r
@@ -873,11 +923,11 @@ BdsLibGetBootableHandle (
   Check whether the Device path in a boot option point to a valide bootable device,\r
   And if CheckMedia is true, check the device is ready to boot now.\r
 \r
-  DevPath -- the Device path in a boot option\r
-  CheckMedia -- if true, check the device is ready to boot now.\r
+  @param  DevPath     the Device path in a boot option\r
+  @param  CheckMedia  if true, check the device is ready to boot now.\r
 \r
-  @return TRUE      -- the Device path  is valide\r
-  @return FALSE   -- the Device path  is invalide .\r
+  @retval TRUE        the Device path  is valide\r
+  @retval FALSE       the Device path  is invalide .\r
 \r
 **/\r
 BOOLEAN\r
@@ -888,7 +938,7 @@ BdsLibIsValidEFIBootOptDevicePath (
   );\r
   \r
 /**\r
-  For a bootable Device path, return its boot type\r
+  For a bootable Device path, return its boot type.\r
 \r
   @param  DevicePath                      The bootable device Path to check\r
 \r
@@ -919,8 +969,8 @@ BdsGetBootTypeFromDevicePath (
 \r
 \r
 /**\r
-  This routine register a function to adjust the different type memory page number just before booting\r
-  and save the updated info into the variable for next boot to use\r
+  This routine register a function to adjust the different type memory page number\r
+  just before booting and save the updated info into the variable for next boot to use.\r
 \r
 **/\r
 VOID\r
@@ -965,12 +1015,13 @@ BdsLibUpdateFvFileDevicePath (
   @param  HostControllerPI      Uhci (0x00) or Ehci (0x20) or Both uhci and ehci\r
                                 (0xFF)\r
   @param  RemainingDevicePath   a short-form device path that starts with the first\r
-                                element  being a USB WWID or a USB Class device\r
+                                element being a USB WWID or a USB Class device\r
                                 path\r
 \r
-  @return EFI_INVALID_PARAMETER\r
-  @return EFI_SUCCESS\r
-  @return EFI_NOT_FOUND\r
+  @retval EFI_SUCCESS           The specific Usb device is connected successfully.\r
+  @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r
+                                or RemainingDevicePath is not the USB class device path.\r
+  @retval EFI_NOT_FOUND         The device specified by device path is not found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -985,33 +1036,30 @@ BdsLibConnectUsbDevByShortFormDP(
 // The implementation of this function is provided by Platform code.\r
 //\r
 /**\r
-  Convert Vendor device path to device name\r
+  Convert Vendor device path to device name.\r
 \r
   @param  Str      The buffer store device name\r
   @param  DevPath  Pointer to vendor device path\r
 \r
-  @return When it return, the device name have been stored in *Str.\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
 DevPathVendor (\r
   IN OUT POOL_PRINT       *Str,\r
   IN VOID                 *DevPath\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Concatenates a formatted unicode string to allocated pool.\r
   The caller must free the resulting buffer.\r
 \r
-  @param  Str      Tracks the allocated pool, size in use, and  amount of pool\r
-                   allocated.\r
+  @param  Str      Tracks the allocated pool, size in use, and amount of pool allocated.\r
   @param  fmt      The format string\r
+  @param  ...      The data will be printed.\r
 \r
   @return Allocated buffer with the formatted string printed in it.\r
-  @return The caller must free the allocated buffer.   The buffer\r
-  @return allocation is not packed.\r
+          The caller must free the allocated buffer.\r
+          The buffer allocation is not packed.\r
 \r
 **/\r
 CHAR16 *\r
@@ -1020,7 +1068,6 @@ CatPrint (
   IN OUT POOL_PRINT   *Str,\r
   IN CHAR16           *fmt,\r
   ...\r
-  )\r
-;\r
+  );\r
 #endif\r
 \r