]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
Add 2 new Bds features
[mirror_edk2.git] / IntelFrameworkModulePkg / Include / Library / GenericBdsLib.h
index f17f4344b039bb71214a46c1e96ad4bb97e3b90f..422666abe0bf8f7e5fe10b8fe31f7d2f6f730eaa 100644 (file)
@@ -1,16 +1,16 @@
 /** @file\r
-  Generic BDS library defines general interfaces for BDS driver including:\r
-    1) BDS boot policy interface\r
-    2) BDS boot device connect interface\r
+  Generic BDS library defines general interfaces for a BDS driver, including:\r
+    1) BDS boot policy interface.\r
+    2) BDS boot device connect interface.\r
     3) BDS Misc interfaces for mainting boot variable, ouput string.\r
 \r
-Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under \r
+the terms and conditions of the BSD License that accompanies this distribution.  \r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.                                          \r
+    \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -18,15 +18,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _GENERIC_BDS_LIB_H_\r
 #define _GENERIC_BDS_LIB_H_\r
 \r
-extern EFI_HANDLE mBdsImageHandle;\r
+#include <Protocol/UserManager.h>\r
 \r
 ///\r
-/// Constants which are variable names used to access variables\r
+/// Constants which are variable names used to access variables.\r
 ///\r
 #define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r
 \r
 ///\r
-/// Data structures and defines\r
+/// Data structures and defines.\r
 ///\r
 #define FRONT_PAGE_QUESTION_ID  0x0000\r
 #define FRONT_PAGE_DATA_WIDTH   0x01\r
@@ -57,13 +57,13 @@ extern EFI_HANDLE mBdsImageHandle;
 #define IS_LOAD_OPTION_TYPE(_c, _Mask)  (BOOLEAN) (((_c) & (_Mask)) != 0)\r
 \r
 ///\r
-/// Define Maximum characters that will be accepted\r
+/// Define the maximum characters that will be accepted.\r
 ///\r
 #define MAX_CHAR            480\r
 #define MAX_CHAR_SIZE       (MAX_CHAR * 2)\r
 \r
 ///\r
-/// Define maximum characters for boot option variable "BootXXXX"\r
+/// Define maximum characters for boot option variable "BootXXXX".\r
 ///\r
 #define BOOT_OPTION_MAX_CHAR 10\r
 \r
@@ -109,18 +109,17 @@ BdsLibBootNext (
   );\r
 \r
 /**\r
-  Process the boot option follow the UEFI specification and\r
-  special treat the legacy boot option with BBS_DEVICE_PATH.\r
+  Process the boot option according to the UEFI specification. The legacy boot option device path includes BBS_DEVICE_PATH.\r
 \r
-  @param  Option                 The boot option to be processed\r
+  @param  Option                 The boot option to be processed.\r
   @param  DevicePath             The device path describing where to load the\r
                                  boot image or the legcy BBS device path to boot\r
-                                 the legacy OS\r
+                                 the legacy OS.\r
   @param  ExitDataSize           The size of exit data.\r
   @param  ExitData               Data returned when Boot image failed.\r
 \r
   @retval EFI_SUCCESS            Boot from the input boot option succeeded.\r
-  @retval EFI_NOT_FOUND          The Device Path is not found in the system\r
+  @retval EFI_NOT_FOUND          The Device Path is not found in the system.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -174,12 +173,13 @@ BdsLibBootViaBootOption (
   It will excute once every boot.\r
   \r
   @param  BdsBootOptionList      The header of the linked list that indexed all\r
-                                 current boot options\r
+                                 current boot options.\r
 \r
-  @retval EFI_SUCCESS            Finished all the boot device enumerations and created\r
-                                 the boot option based on the boot device\r
+  @retval EFI_SUCCESS            Finished all the boot device enumerations and \r
+                                 created the boot option based on the boot device.\r
 \r
-  @retval EFI_OUT_OF_RESOURCES   Failed to enumerate the boot device and create the boot option list\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to enumerate the boot device and create \r
+                                 the boot option list.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -188,12 +188,12 @@ BdsLibEnumerateAllBootOption (
   );\r
 \r
 /**\r
-  Build the boot option with the handle parsed in\r
+  Build the boot option with the handle parsed in.\r
 \r
-  @param  Handle                 The handle representing the device path for which to create\r
-                                 boot option\r
-  @param  BdsBootOptionList      The header of the link list which indexed all\r
-                                 current boot options\r
+  @param  Handle                 The handle representing the device path for which \r
+                                 to create a boot option.\r
+  @param  BdsBootOptionList      The header of the link list that indexed all\r
+                                 current boot options.\r
   @param  String                 The description of the boot option.\r
 \r
 **/\r
@@ -210,9 +210,9 @@ BdsLibBuildOptionFromHandle (
   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
+                                 the on flash shell boot option.\r
+  @param  BdsBootOptionList      The header of the link list that indexed all\r
+                                 current boot options.\r
 \r
 **/\r
 VOID\r
@@ -226,11 +226,11 @@ BdsLibBuildOptionFromShell (
 // Bds misc lib functions\r
 //\r
 /**\r
-  Get boot mode by looking up configuration table and parsing HOB list\r
+  Get boot mode by looking up the configuration table and parsing the HOB list.\r
 \r
-  @param  BootMode              Boot mode from PEI handoff HOB.\r
+  @param  BootMode              The boot mode from PEI handoff HOB.\r
 \r
-  @retval EFI_SUCCESS           Successfully get boot mode\r
+  @retval EFI_SUCCESS           Successfully got boot mode.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -244,7 +244,7 @@ BdsLibGetBootMode (
   The function will go through the driver option link list, and then load and start\r
   every driver to which the driver option device path points.\r
 \r
-  @param  BdsDriverLists        The header of the current driver option link list\r
+  @param  BdsDriverLists        The header of the current driver option link list.\r
 \r
 **/\r
 VOID\r
@@ -255,17 +255,18 @@ BdsLibLoadDrivers (
 \r
 \r
 /**\r
-  Process BootOrder, or DriverOrder variables, by calling\r
+  This function processes BootOrder or DriverOrder variables, by calling\r
+\r
   BdsLibVariableToOption () for each UINT16 in the variables.\r
 \r
-  @param  BdsCommonOptionList   The header of the option list base on variable\r
-                                VariableName\r
-  @param  VariableName          EFI Variable name indicate the BootOrder or\r
-                                DriverOrder\r
+  @param  BdsCommonOptionList   The header of the option list base on the variable\r
+                                VariableName.\r
+  @param  VariableName          An EFI Variable name indicate the BootOrder or\r
+                                DriverOrder.\r
 \r
-  @retval EFI_SUCCESS           Success create the boot option or driver option\r
-                                list\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to get the boot option or driver option list\r
+  @retval EFI_SUCCESS           Successfully created the boot option or driver option\r
+                                list.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to get the boot option or the driver option list.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -276,15 +277,16 @@ BdsLibBuildOptionFromVar (
 \r
 /**\r
   This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated\r
-  buffer and the size of the buffer. If failure, return NULL.\r
+  buffer and the size of the buffer. If it fails, return NULL.\r
 \r
-  @param  Name                  String part of EFI variable name\r
-  @param  VendorGuid            GUID part of EFI variable name\r
-  @param  VariableSize          Returns the size of the EFI variable that was read\r
+  @param  Name                  The string part of the  EFI variable name.\r
+  @param  VendorGuid            The GUID part of the 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
-                                Caller is responsible freeing the buffer.\r
-  @retval NULL                  Variable was not read\r
+  @return                       Dynamically allocated memory that contains a copy \r
+                                of the EFI variable. The caller is responsible for \r
+                                freeing the buffer.\r
+  @retval NULL                  The variable was not read.\r
 \r
 **/\r
 VOID *\r
@@ -299,11 +301,11 @@ BdsLibGetVariableAndSize (
 /**\r
   This function prints a series of strings.\r
 \r
-  @param  ConOut                Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
-  @param  ...                   A variable argument list containing series of\r
+  @param  ConOut                A pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.\r
+  @param  ...                   A variable argument list containing series of\r
                                 strings, the last string must be NULL.\r
 \r
-  @retval EFI_SUCCESS           Success print out the string using ConOut.\r
+  @retval EFI_SUCCESS           Successfully printed out the string using ConOut.\r
   @retval EFI_STATUS            Return the status of the ConOut->OutputString ().\r
 \r
 **/\r
@@ -319,12 +321,12 @@ BdsLibOutputStrings (
   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
+                                link list.\r
   @param  VariableName          EFI Variable name, indicates if it is boot#### or\r
-                                driver####\r
+                                driver####.\r
 \r
-  @retval BDS_COMMON_OPTION     The option that was created\r
-  @retval NULL                  Failed to get the new option\r
+  @retval BDS_COMMON_OPTION     The option that was created.\r
+  @retval NULL                  Failed to get the new option.\r
 \r
 **/\r
 BDS_COMMON_OPTION *\r
@@ -340,14 +342,14 @@ BdsLibVariableToOption (
   to BdsOptionList and also update to the VariableName. After the boot#### or\r
   driver#### updated, the BootOrder or DriverOrder will also be updated.\r
 \r
-  @param  BdsOptionList         The header of the boot#### or driver#### link list\r
-  @param  DevicePath            The device path which the boot#### or driver####\r
-                                option present\r
-  @param  String                The description of the boot#### or driver####\r
-  @param  VariableName          Indicate if the boot#### or driver#### option\r
+  @param  BdsOptionList         The header of the boot#### or driver#### link list.\r
+  @param  DevicePath            The device path that the boot#### or driver####\r
+                                option present.\r
+  @param  String                The description of the boot#### or driver####.\r
+  @param  VariableName          Indicate if the boot#### or driver#### option.\r
 \r
-  @retval EFI_SUCCESS           The boot#### or driver#### have been success\r
-                                registered\r
+  @retval EFI_SUCCESS           The boot#### or driver#### have been successfully\r
+                                registered.\r
   @retval EFI_STATUS            Return the status of gRT->SetVariable ().\r
 \r
 **/\r
@@ -384,17 +386,17 @@ BdsLibConnectAll (
   );\r
 \r
 /**\r
-  This function creates all handles associated with every device\r
-  path node. If the handle associated with one device path node can not\r
+  This function creates all handles associated with the given device\r
+  path node. If the handle associated with one device path node cannot\r
   be created, then it tries to execute the dispatch to load the missing drivers.  \r
 \r
   @param  DevicePathToConnect   The device path to be connected. Can be\r
-                                a multi-instance device path\r
+                                a multi-instance device path.\r
 \r
   @retval EFI_SUCCESS           All handles associates with every device path node\r
-                                were created\r
-  @retval EFI_OUT_OF_RESOURCES  Not enough resources to create new handles\r
-  @retval EFI_NOT_FOUND         At least one handle could not be created\r
+                                were created.\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resources to create new handles.\r
+  @retval EFI_NOT_FOUND         At least one handle could not be created.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -404,8 +406,13 @@ BdsLibConnectDevicePath (
   );\r
 \r
 /**\r
-  This function will connect all current system handles recursively.     gBS->ConnectController() service is invoked for each handle exist in system handler buffer.  If the handle is bus type handler, all childrens also will be connected recursively  by gBS->ConnectController().\r
-  @retval EFI_SUCCESS           All handles and child handles have been                                connected  @retval EFI_STATUS            Return the status of gBS->LocateHandleBuffer().\r
+  This function will connect all current system handles recursively.     \r
+  gBS->ConnectController() service is invoked for each handle exist in system handler buffer.  \r
+  If the handle is bus type handler, all childrens also will be connected recursively  by gBS->ConnectController().\r
+  \r
+  @retval EFI_SUCCESS           All handles and child handles have been\r
+                                connected.  \r
+  @retval EFI_STATUS            Return the status of gBS->LocateHandleBuffer().\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -414,8 +421,11 @@ BdsLibConnectAllEfi (
   );\r
 \r
 /**\r
-  This function will disconnect all current system handles.     gBS->DisconnectController() is invoked for each handle exists in system handle buffer.  If handle is a bus type handle, all childrens also are disconnected recursively by  gBS->DisconnectController().\r
-  @retval EFI_SUCCESS           All handles have been disconnected\r
+  This function will disconnect all current system handles.     \r
+  gBS->DisconnectController() is invoked for each handle exists in system handle buffer.  \r
+  If handle is a bus type handle, all childrens also are disconnected recursively by  gBS->DisconnectController().\r
+  \r
+  @retval EFI_SUCCESS           All handles have been disconnected.\r
   @retval EFI_STATUS            Error status returned by of gBS->LocateHandleBuffer().\r
 \r
 **/\r
@@ -430,7 +440,7 @@ BdsLibDisconnectAllEfi (
 //\r
 /**\r
   This function will search every simpletxt device in the current system,\r
-  and make every simpletxt device as pertantial console device.\r
+  and make every simpletxt device a potential console device.\r
 \r
 **/\r
 VOID\r
@@ -455,16 +465,33 @@ BdsLibConnectAllDefaultConsoles (
   VOID\r
   );\r
 \r
+\r
+/**\r
+  This function will connect console device except ConIn base on the console\r
+  device variable ConOut and ErrOut.\r
+\r
+  @retval EFI_SUCCESS              At least one of the ConOut device have\r
+                                   been connected success.\r
+  @retval EFI_STATUS               Return the status of BdsLibConnectConsoleVariable ().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BdsLibConnectAllDefaultConsolesWithOutConIn (\r
+  VOID\r
+  );\r
+\r
+\r
 /**\r
   This function updates the console variable based on ConVarName. It can\r
   add or remove one specific console device path from the variable\r
 \r
-  @param  ConVarName               Console-related variable name: ConIn, ConOut,\r
+  @param  ConVarName               The console-related variable name: ConIn, ConOut,\r
                                    ErrOut.\r
   @param  CustomizedConDevicePath  The console device path to be added to\r
-                                   the console variable ConVarName. Can not be multi-instance.\r
+                                   the console variable ConVarName. Cannot be multi-instance.\r
   @param  ExclusiveDevicePath      The console device path to be removed\r
-                                   from the console variable ConVarName. Can not be multi-instance.\r
+                                   from the console variable ConVarName. Cannot be multi-instance.\r
 \r
   @retval EFI_UNSUPPORTED          The added device path is the same as a removed one.\r
   @retval EFI_SUCCESS              Successfully added or removed the device path from the\r
@@ -485,7 +512,7 @@ BdsLibUpdateConsoleVariable (
   instance connects successfully, then this function\r
   will return success.\r
 \r
-  @param  ConVarName               Console related variable name, ConIn, ConOut,\r
+  @param  ConVarName               The console related variable name: ConIn, ConOut,\r
                                    ErrOut.\r
 \r
   @retval EFI_NOT_FOUND            No console devices were connected successfully\r
@@ -503,7 +530,7 @@ BdsLibConnectConsoleVariable (
 // Bds device path related lib functions\r
 //\r
 /**\r
-  Delete the instance in Multi that overlaps with Single \r
+  Delete the instance in Multi that overlaps with Single. \r
 \r
   @param  Multi                 A pointer to a multi-instance device path data\r
                                 structure.\r
@@ -511,7 +538,7 @@ BdsLibConnectConsoleVariable (
                                 structure.\r
 \r
   @return This function removes the device path instances in Multi that overlap\r
-   Single, and returns the resulting device path. If there is no\r
+          Single, and returns the resulting device path. If there is no\r
           remaining device path as a result, this function will return NULL.\r
 \r
 **/\r
@@ -523,7 +550,7 @@ BdsLibDelPartMatchInstance (
   );\r
 \r
 /**\r
-  Function compares a device path data structure to that of all the nodes of a\r
+  This function compares a device path data structure to that of all the nodes of a\r
   second device path instance.\r
 \r
   @param  Multi                 A pointer to a multi-instance device path data\r
@@ -531,8 +558,10 @@ BdsLibDelPartMatchInstance (
   @param  Single                A pointer to a single-instance device path data\r
                                 structure.\r
 \r
-  @retval TRUE                  If the Single device path is contained within Multi device path.\r
-  @retval FALSE                 The Single device path is not contained within Multi device path.\r
+  @retval TRUE                  If the Single device path is contained within a \r
+                                Multi device path.\r
+  @retval FALSE                 The Single device path is not contained within a \r
+                                Multi device path.\r
 \r
 **/\r
 BOOLEAN\r
@@ -547,7 +576,7 @@ BdsLibMatchDevicePaths (
 \r
   @param DevPath                  A pointer to the device path structure.\r
 \r
-  @return A new allocated Unicode string that represents the device path.\r
+  @return A newly allocated Unicode string that represents the device path.\r
 \r
 **/\r
 CHAR16 *\r
@@ -556,7 +585,6 @@ DevicePathToStr (
   IN EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
   );\r
 \r
-\r
 //\r
 // Internal definitions\r
 //\r
@@ -566,23 +594,25 @@ typedef struct {
   UINTN   Maxlen;\r
 } POOL_PRINT;\r
 \r
+typedef\r
+VOID\r
+(*DEV_PATH_FUNCTION) (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  );\r
+\r
 typedef struct {\r
-  UINT8 Type;\r
-  UINT8 SubType;\r
-  VOID (*Function) (POOL_PRINT *, VOID *);\r
+  UINT8             Type;\r
+  UINT8             SubType;\r
+  DEV_PATH_FUNCTION Function;\r
 } DEVICE_PATH_STRING_TABLE;\r
 \r
-extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r
-\r
 typedef struct {\r
   EFI_DEVICE_PATH_PROTOCOL  Header;\r
   EFI_GUID                  Guid;\r
   UINT8                     VendorDefinedData[1];\r
 } VENDOR_DEVICE_PATH_WITH_DATA;\r
 \r
-\r
-extern EFI_GUID mEfiDevicePathMessagingSASGuid;\r
-\r
 typedef struct {\r
   EFI_DEVICE_PATH_PROTOCOL  Header;\r
   UINT16                    NetworkProtocol;\r
@@ -592,26 +622,6 @@ typedef struct {
   CHAR16                    TargetName[1];\r
 } ISCSI_DEVICE_PATH_WITH_NAME;\r
 \r
-\r
-//\r
-// Notes: EFI 64 shadow all option rom\r
-//\r
-#if defined (MDE_CPU_IPF)\r
-#define EFI64_SHADOW_ALL_LEGACY_ROM() 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
@@ -628,9 +638,9 @@ ShadowAllOptionRom (
 /**\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 retrieve variable of boot order.\r
+  @retval EFI_SUCCESS             All invalid legacy boot options are deleted.\r
+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate necessary memory.\r
+  @retval EFI_NOT_FOUND           Failed to retrieve variable of boot order.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -642,7 +652,7 @@ BdsDeleteAllInvalidLegacyBootOptions (
 /**\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
+  @retval EFI_SUCCESS          The boot options were added successfully, \r
                                or they are already in boot options.\r
   @retval EFI_NOT_FOUND        No legacy boot options is found.\r
   @retval EFI_OUT_OF_RESOURCE  No enough memory.\r
@@ -658,11 +668,11 @@ BdsAddNonExistingLegacyBootOptions (
   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
+  @retval EFI_SUCCESS           The boot devices were added successfully.\r
   @retval EFI_NOT_FOUND         The legacy boot devices are not found.\r
-  @retval EFI_OUT_OF_RESOURCES  Memmory or storage is not enough.\r
-  @retval EFI_DEVICE_ERROR      Fail to add the legacy device boot order into EFI variable\r
-                                because of hardware error.\r
+  @retval EFI_OUT_OF_RESOURCES  Memory or storage is not enough.\r
+  @retval EFI_DEVICE_ERROR      Failed to add the legacy device boot order into EFI variable\r
+                                because of hardware error.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -671,11 +681,11 @@ BdsUpdateLegacyDevOrder (
   );\r
 \r
 /**\r
-  Set the boot priority for BBS entries based on boot option entry and boot order.\r
+  Refresh 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
+  @param  Entry             The boot option is to be checked for a refreshed BBS table.\r
   \r
-  @retval EFI_SUCCESS           The boot priority for BBS entries is refreshed successfully.\r
+  @retval EFI_SUCCESS           The boot priority for BBS entries refreshed successfully.\r
   @retval EFI_NOT_FOUND         BBS entries can't be found.\r
   @retval EFI_OUT_OF_RESOURCES  Failed to get the legacy device boot order.\r
 **/\r
@@ -686,16 +696,16 @@ BdsRefreshBbsTableForBoot (
   );\r
 \r
 /**\r
-  Deletete the Boot Option from EFI Variable. The Boot Order Arrray\r
+  Delete the Boot Option from EFI Variable. The Boot Order Arrray\r
   is also updated.\r
 \r
-  @param OptionNumber    The number of Boot option want to be deleted.\r
+  @param OptionNumber    The number of Boot options wanting to be deleted.\r
   @param BootOrder       The Boot Order array.\r
   @param BootOrderSize   The size of the Boot Order Array.\r
 \r
-  @retval  EFI_SUCCESS           The Boot Option Variable was found and removed\r
-  @retval  EFI_UNSUPPORTED       The Boot Option Variable store was inaccessible\r
-  @retval  EFI_NOT_FOUND         The Boot Option Variable was not found\r
+  @retval  EFI_SUCCESS           The Boot Option Variable was found and removed.\r
+  @retval  EFI_UNSUPPORTED       The Boot Option Variable store was inaccessible.\r
+  @retval  EFI_NOT_FOUND         The Boot Option Variable was not found.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -710,7 +720,7 @@ BdsDeleteBootOption (
 //\r
 /**\r
   Enable the setup browser reset reminder feature.\r
-  This routine is used in platform tip. If the platform policy needs the feature, use the routine to enable it.\r
+  This routine is used in platform tip. If the platform policy needs the feature, use the routine to enable it.\r
 \r
 **/\r
 VOID\r
@@ -721,7 +731,7 @@ EnableResetReminderFeature (
 \r
 /**\r
   Disable the setup browser reset reminder feature.\r
-  This routine is used in platform tip. If the platform policy does not want the feature, use the routine to disable it.\r
+  This routine is used in platform tip. If the platform policy does not want the feature, use the routine to disable it.\r
 \r
 **/\r
 VOID\r
@@ -787,67 +797,45 @@ SetupResetReminder (
 \r
 \r
 ///\r
-/// Define the boot option default description \r
-///\r
-#define DESCRIPTION_FLOPPY        L"EFI Floppy"\r
-#define DESCRIPTION_FLOPPY_NUM    L"EFI Floppy %d"\r
-#define DESCRIPTION_DVD           L"EFI DVD/CDROM"\r
-#define DESCRIPTION_DVD_NUM       L"EFI DVD/CDROM %d"\r
-#define DESCRIPTION_USB           L"EFI USB Device"\r
-#define DESCRIPTION_USB_NUM       L"EFI USB Device %d"\r
-#define DESCRIPTION_SCSI          L"EFI SCSI Device"\r
-#define DESCRIPTION_SCSI_NUM      L"EFI SCSI Device %d"\r
-#define DESCRIPTION_MISC          L"EFI Misc Device"\r
-#define DESCRIPTION_MISC_NUM      L"EFI Misc Device %d"\r
-#define DESCRIPTION_NETWORK       L"EFI Network"\r
-#define DESCRIPTION_NETWORK_NUM   L"EFI Network %d"       \r
-#define DESCRIPTION_NON_BLOCK     L"EFI Non-Block Boot Device"\r
-#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"\r
-\r
-///\r
-/// Define the boot type which to classify the boot option type\r
-/// Different boot option type could have different boot behavior\r
-/// Use their device path node (Type + SubType) as type value\r
-/// The boot type here can be added according to requirement\r
+/// Define the boot type with which to classify the boot option type.\r
+/// Different boot option types could have different boot behaviors.\r
+/// Use their device path node (Type + SubType) as the type value.\r
+/// The boot type here can be added according to requirements.\r
 ///\r
 \r
 ///\r
-/// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r
+/// ACPI boot type. For ACPI devices, using sub-types to distinguish devices is not allowed, so hardcode their values.\r
 ///\r
 #define  BDS_EFI_ACPI_FLOPPY_BOOT         0x0201\r
 ///\r
 /// Message boot type\r
-/// If a device path of boot option only point to a message node, the boot option is message boot type\r
+/// If a device path of boot option only points to a message node, the boot option is a message boot type.\r
 ///\r
 #define  BDS_EFI_MESSAGE_ATAPI_BOOT       0x0301 // Type 03; Sub-Type 01\r
 #define  BDS_EFI_MESSAGE_SCSI_BOOT        0x0302 // Type 03; Sub-Type 02\r
 #define  BDS_EFI_MESSAGE_USB_DEVICE_BOOT  0x0305 // Type 03; Sub-Type 05\r
-#define  BDS_EFI_MESSAGE_SATA_BOOT        0x0318 // Type 03; Sub-Type 18\r
+#define  BDS_EFI_MESSAGE_SATA_BOOT        0x0312 // Type 03; Sub-Type 18\r
+#define  BDS_EFI_MESSAGE_MAC_BOOT         0x030b // Type 03; Sub-Type 11\r
 #define  BDS_EFI_MESSAGE_MISC_BOOT        0x03FF\r
+\r
 ///\r
 /// Media boot type\r
-/// If a device path of boot option contain a media node, the boot option is media boot type\r
+/// If a device path of boot option contains a media node, the boot option is media boot type.\r
 ///\r
 #define  BDS_EFI_MEDIA_HD_BOOT            0x0401 // Type 04; Sub-Type 01\r
 #define  BDS_EFI_MEDIA_CDROM_BOOT         0x0402 // Type 04; Sub-Type 02\r
 ///\r
 /// BBS boot type\r
-/// If a device path of boot option contain a BBS node, the boot option is BBS boot type\r
+/// If a device path of boot option contains a BBS node, the boot option is BBS boot type.\r
 ///\r
 #define  BDS_LEGACY_BBS_BOOT              0x0501 //  Type 05; Sub-Type 01\r
 \r
 #define  BDS_EFI_UNSUPPORT                0xFFFF\r
 \r
-///\r
-/// USB host controller Programming Interface.\r
-///\r
-#define  PCI_CLASSC_PI_UHCI               0x00\r
-#define  PCI_CLASSC_PI_EHCI               0x20\r
-\r
 /**\r
-  Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path\r
+  Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path.\r
 \r
-  @param  BlockIoDevicePath      Multi device path instances to check\r
+  @param  BlockIoDevicePath      Multi device path instances to check.\r
   @param  HardDriveDevicePath    A device path starting with a hard drive media\r
                                  device path.\r
 \r
@@ -865,15 +853,15 @@ MatchPartitionDevicePathNode (
 \r
 /**\r
   Expand a device path that starts with a hard drive media device path node to be a\r
-  full device path that includes the full hardware path to the device. We need\r
-  to do this so it can be booted. As an optimizaiton the front match (the part point\r
-  to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ) is saved in a variable\r
-  so a connect all is not required on every boot. All successful history device path\r
-  which point to partition node (the front part) will be saved.\r
+  full device path that includes the full hardware path to the device. This function enables the device to boot. \r
+  To avoid requiring a connect on every boot, the front match is saved in a variable (the part point\r
+  to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ).\r
+  All successful history device paths\r
+  that point to the front part of the partition node will be saved.\r
 \r
   @param  HardDriveDevicePath    EFI Device Path to boot, if it starts with a hard\r
                                  drive media device path.\r
-  @return A Pointer to the full device path or NULL if a valid Hard Drive devic path\r
+  @return A Pointer to the full device path, or NULL if a valid Hard Drive devic path\r
           cannot be found.\r
 \r
 **/\r
@@ -889,7 +877,7 @@ BdsExpandPartitionPartialDevicePathToFull (
   Second, check whether the device path points to a device that supports SimpleFileSystemProtocol.\r
   Third, detect the the default boot file in the Media, and return the removable Media handle.\r
 \r
-  @param  DevicePath             Device Path to a  bootable device\r
+  @param  DevicePath             The Device Path to a  bootable device.\r
 \r
   @return  The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.\r
 \r
@@ -905,11 +893,11 @@ BdsLibGetBootableHandle (
   Checks whether the Device path in a boot option points to a valid bootable device, and if the device\r
   is ready to boot now.\r
 \r
-  @param  DevPath     the Device path in a boot option\r
-  @param  CheckMedia  if true, check whether the device is ready to boot now.\r
+  @param  DevPath     The Device path in a boot option.\r
+  @param  CheckMedia  If true, check whether the device is ready to boot now.\r
 \r
-  @retval TRUE        the Device path is valid\r
-  @retval FALSE       the Device path is invalid\r
+  @retval TRUE        The Device path is valid.\r
+  @retval FALSE       The Device path is invalid.\r
 \r
 **/\r
 BOOLEAN\r
@@ -926,12 +914,12 @@ BdsLibIsValidEFIBootOptDevicePath (
   device, this function checks whether the description conflicts with other auto-created\r
   boot options.\r
 \r
-  @param  DevPath     the Device path in a boot option\r
-  @param  CheckMedia  if true, checks if the device is ready to boot now.\r
-  @param  Description the description of a boot option\r
+  @param  DevPath     The Device path in a boot option.\r
+  @param  CheckMedia  If true, checks if the device is ready to boot now.\r
+  @param  Description The description of a boot option.\r
 \r
-  @retval TRUE        the Device path is valid\r
-  @retval FALSE       the Device path is invalid\r
+  @retval TRUE        The Device path is valid.\r
+  @retval FALSE       The Device path is invalid.\r
 \r
 **/\r
 BOOLEAN\r
@@ -945,10 +933,26 @@ BdsLibIsValidEFIBootOptDevicePathExt (
 /**\r
   For a bootable Device path, return its boot type.\r
 \r
-  @param  DevicePath                      The bootable device Path to check\r
-\r
-  @retval BDS_EFI_MEDIA_HD_BOOT           If given device path contains MEDIA_DEVICE_PATH type device path node                                           which subtype is MEDIA_HARDDRIVE_DP  @retval BDS_EFI_MEDIA_CDROM_BOOT        If given device path contains MEDIA_DEVICE_PATH type device path node                                          which subtype is MEDIA_CDROM_DP  @retval BDS_EFI_ACPI_FLOPPY_BOOT        If given device path contains ACPI_DEVICE_PATH type device path node                                          which HID is floppy device.  @retval BDS_EFI_MESSAGE_ATAPI_BOOT      If given device path contains MESSAGING_DEVICE_PATH type device path node                                          and its last device path node's subtype is MSG_ATAPI_DP.  @retval BDS_EFI_MESSAGE_SCSI_BOOT       If given device path contains MESSAGING_DEVICE_PATH type device path node                                          and its last device path node's subtype is MSG_SCSI_DP.  @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node                                          and its last device path node's subtype is MSG_USB_DP.  @retval BDS_EFI_MESSAGE_MISC_BOOT       If the device path not contains any media device path node,  and                                          its last device path node point to a message device path node.  @retval BDS_LEGACY_BBS_BOOT             If given device path contains BBS_DEVICE_PATH type device path node.  @retval BDS_EFI_UNSUPPORT               An EFI Removable BlockIO device path not point to a media and message device,   \r
-**/\r
+  @param  DevicePath                      The bootable device Path to check.\r
+\r
+  @retval BDS_EFI_MEDIA_HD_BOOT           The given device path contains MEDIA_DEVICE_PATH type device path node,\r
+                                          whose subtype is MEDIA_HARDDRIVE_DP.  \r
+  @retval BDS_EFI_MEDIA_CDROM_BOOT        If given device path contains MEDIA_DEVICE_PATH type device path node, \r
+                                          whose subtype is MEDIA_CDROM_DP.  \r
+  @retval BDS_EFI_ACPI_FLOPPY_BOOT        A given device path contains ACPI_DEVICE_PATH type device path node,                                          \r
+                                          whose HID is floppy device.  \r
+  @retval BDS_EFI_MESSAGE_ATAPI_BOOT      A given device path contains MESSAGING_DEVICE_PATH type device path node, \r
+                                          and its last device path node's subtype is MSG_ATAPI_DP.  \r
+  @retval BDS_EFI_MESSAGE_SCSI_BOOT       A given device path contains MESSAGING_DEVICE_PATH type device path node,\r
+                                          and its last device path node's subtype is MSG_SCSI_DP. \r
+  @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node, \r
+                                          and its last device path node's subtype is MSG_USB_DP.\r
+  @retval BDS_EFI_MESSAGE_MISC_BOOT       The device path does not contain any media device path node, and  \r
+                                          its last device path node points to a message device path node.  \r
+  @retval BDS_LEGACY_BBS_BOOT             A given device path contains BBS_DEVICE_PATH type device path node. \r
+  @retval BDS_EFI_UNSUPPORT               An EFI Removable BlockIO device path does not point to a media and message device.   \r
+\r
+  **/\r
 UINT32\r
 EFIAPI\r
 BdsGetBootTypeFromDevicePath (\r
@@ -967,6 +971,21 @@ BdsLibSaveMemoryTypeInformation (
   VOID\r
   );\r
   \r
+/**\r
+  Identify a user and, if authenticated, returns the current user profile handle.\r
+\r
+  @param[out]  User           Points to the user profile handle.\r
+  \r
+  @retval EFI_SUCCESS         The user is successfully identified, or user identification\r
+                              is not supported.\r
+  @retval EFI_ACCESS_DENIED   The user was not successfully identified.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BdsLibUserIdentify (\r
+  OUT EFI_USER_PROFILE_HANDLE         *User\r
+  );  \r
 \r
 /**\r
   This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,\r
@@ -974,17 +993,17 @@ BdsLibSaveMemoryTypeInformation (
   FV address maybe changes for memory layout adjust from time to time, use this funciton\r
   could promise the Fv file device path is right.\r
 \r
-  @param  DevicePath             on input, the Fv file device path to check. On\r
+  @param  DevicePath             On input, the Fv file device path to check. On\r
                                  output, the updated valid Fv file device path\r
-  @param  FileGuid               the Fv file GUID\r
+  @param  FileGuid               the Fv file GUID.\r
 \r
-  @retval EFI_INVALID_PARAMETER  the input DevicePath or FileGuid is invalid\r
-  @retval EFI_UNSUPPORTED        the input DevicePath does not contain an Fv file\r
-                                 GUID at all\r
-  @retval EFI_ALREADY_STARTED    the input DevicePath has pointed to the Fv file and is\r
-                                 valid\r
-  @retval EFI_SUCCESS            successfully updated the invalid DevicePath\r
-                                 and returned the updated device path in DevicePath\r
+  @retval EFI_INVALID_PARAMETER  The input DevicePath or FileGuid is invalid.\r
+  @retval EFI_UNSUPPORTED        The input DevicePath does not contain an Fv file\r
+                                 GUID at all.\r
+  @retval EFI_ALREADY_STARTED    The input DevicePath has pointed to the Fv file and is\r
+                                 valid.\r
+  @retval EFI_SUCCESS            Successfully updated the invalid DevicePath\r
+                                 and returned the updated device path in DevicePath.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -997,13 +1016,13 @@ BdsLibUpdateFvFileDevicePath (
 \r
 /**\r
   Connect the specific USB device that matches the RemainingDevicePath,\r
-  and whose bus is determined by Host Controller (Uhci or Ehci)\r
+  and whose bus is determined by Host Controller (Uhci or Ehci).\r
 \r
   @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
+                                (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
-                                path\r
+                                path.\r
 \r
   @retval EFI_SUCCESS           The specific Usb device is connected successfully.\r
   @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r
@@ -1025,8 +1044,8 @@ BdsLibConnectUsbDevByShortFormDP(
 /**\r
   Convert Vendor device path to a device name.\r
 \r
-  @param  Str      The buffer storing device name\r
-  @param  DevPath  Pointer to vendor device path\r
+  @param  Str      The buffer storing device name.\r
+  @param  DevPath  The pointer to vendor device path.\r
 \r
 **/\r
 VOID\r
@@ -1036,11 +1055,11 @@ DevPathVendor (
   );\r
 \r
 /**\r
-  Concatenates a formatted unicode string to allocated pool.\r
+  Concatenates a formatted unicode string to an 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 allocated.\r
-  @param  Fmt      The format string\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
@@ -1060,10 +1079,10 @@ CatPrint (
   Use SystemTable ConOut to stop video based Simple Text Out consoles from going\r
   to the video device. Put up LogoFile on every video device that is a console.\r
 \r
-  @param[in]  LogoFile   File name of logo to display on the center of the screen.\r
+  @param[in]  LogoFile   The file name of logo to display on the center of the screen.\r
 \r
   @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo displayed.\r
-  @retval EFI_UNSUPPORTED Logo not found\r
+  @retval EFI_UNSUPPORTED Logo not found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1075,7 +1094,7 @@ EnableQuietBoot (
 \r
 /**\r
   Use SystemTable ConOut to turn on video based Simple Text Out consoles. The \r
-  Simple Text Out screens will now be synced up with all non video output devices\r
+  Simple Text Out screens will now be synced up with all non-video output devices.\r
 \r
   @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.\r
 \r