]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its...
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / BootMaint / BootMaint.c
index a017e89b8c98247a16e850142da81259af5483c6..ac313989874c0ee5020984eba0bebcdfe43b1d52 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  Boot Maintainence Main File\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2008, 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
@@ -9,58 +10,66 @@ http://opensource.org/licenses/bsd-license.php
 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
-Module Name:\r
-\r
-  BootMaint.c\r
-\r
-Abstract:\r
-\r
-  Boot Maintainence Main File\r
-\r
---*/\r
+**/\r
 \r
 #include "BootMaint.h"\r
 #include "FormGuid.h"\r
 #include "Bds.h"\r
 #include "FrontPage.h"\r
 \r
-EFI_GUID EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;\r
-EFI_GUID mBootMaintGuid = BOOT_MAINT_FORMSET_GUID;\r
-EFI_GUID mFileExplorerGuid = FILE_EXPLORE_FORMSET_GUID;\r
+EFI_DEVICE_PATH_PROTOCOL  EndDevicePath[] = {\r
+  END_DEVICE_PATH_TYPE,\r
+  END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+  END_DEVICE_PATH_LENGTH,\r
+  0\r
+};\r
+\r
+\r
+EFI_GUID EfiLegacyDevOrderGuid  = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;\r
+EFI_GUID mBootMaintGuid         = BOOT_MAINT_FORMSET_GUID;\r
+EFI_GUID mFileExplorerGuid      = FILE_EXPLORE_FORMSET_GUID;\r
+\r
+CHAR16  mBootMaintStorageName[]     = L"BmData";\r
+CHAR16  mFileExplorerStorageName[]  = L"FeData";\r
 \r
-CHAR16  mBootMaintStorageName[] = L"BmData";\r
-CHAR16  mFileExplorerStorageName[] = L"FeData";\r
+/**\r
+  Init all memu.\r
 \r
+  @param CallbackData    The BMM context data.\r
+\r
+**/\r
 VOID\r
 InitAllMenu (\r
   IN  BMM_CALLBACK_DATA    *CallbackData\r
   );\r
 \r
+/**\r
+  Free up all Menu Option list.\r
+\r
+**/\r
 VOID\r
 FreeAllMenu (\r
   VOID\r
   );\r
 \r
+/**\r
+  Create string tokens for a menu from its help strings and display strings\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+  @param HiiHandle       Hii Handle of the package to be updated.\r
+  @param MenuOption      The Menu whose string tokens need to be created\r
+\r
+  @retval  EFI_SUCCESS      string tokens created successfully\r
+  @retval  others           contain some errors\r
+\r
+**/\r
 EFI_STATUS\r
 CreateMenuStringToken (\r
   IN BMM_CALLBACK_DATA                *CallbackData,\r
   IN EFI_HII_HANDLE                   HiiHandle,\r
   IN BM_MENU_OPTION                   *MenuOption\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Create string tokens for a menu from its help strings and display strings\r
-\r
-Arguments:\r
-  HiiHandle       - Hii Handle of the package to be updated.\r
-  MenuOption      - The Menu whose string tokens need to be created\r
-\r
-Returns:\r
-  EFI_SUCCESS     - string tokens created successfully\r
-  others          - contain some errors\r
-\r
---*/\r
 {\r
   BM_MENU_ENTRY *NewMenuEntry;\r
   UINTN         Index;\r
@@ -88,6 +97,28 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  This function allows a caller to extract the current configuration for one\r
+  or more named elements from the target driver.\r
+\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Request         A null-terminated Unicode string in <ConfigRequest> format.\r
+  @param Progress        On return, points to a character in the Request string.\r
+                         Points to the string's null terminator if request was successful.\r
+                         Points to the most recent '&' before the first failing name/value\r
+                         pair (or the beginning of the string if the failure is in the\r
+                         first name/value pair) if the request was not successful.\r
+  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which\r
+                         has all values filled in for the names in the Request string.\r
+                         String to be allocated by the called function.\r
+\r
+  @retval  EFI_SUCCESS            The Results is filled with the requested values.\r
+  @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.\r
+  @retval  EFI_INVALID_PARAMETER  Request is NULL, illegal syntax, or unknown name.\r
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BootMaintExtractConfig (\r
@@ -96,31 +127,6 @@ BootMaintExtractConfig (
   OUT EFI_STRING                             *Progress,\r
   OUT EFI_STRING                             *Results\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function allows a caller to extract the current configuration for one\r
-    or more named elements from the target driver.\r
-\r
-  Arguments:\r
-    This       - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Request    - A null-terminated Unicode string in <ConfigRequest> format.\r
-    Progress   - On return, points to a character in the Request string.\r
-                 Points to the string's null terminator if request was successful.\r
-                 Points to the most recent '&' before the first failing name/value\r
-                 pair (or the beginning of the string if the failure is in the\r
-                 first name/value pair) if the request was not successful.\r
-    Results    - A null-terminated Unicode string in <ConfigAltResp> format which\r
-                 has all values filled in for the names in the Request string.\r
-                 String to be allocated by the called function.\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Results is filled with the requested values.\r
-    EFI_OUT_OF_RESOURCES  - Not enough memory to store the results.\r
-    EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.\r
-    EFI_NOT_FOUND         - Routing data doesn't match any storage in this driver.\r
-\r
---*/\r
 {\r
   EFI_STATUS         Status;\r
   UINTN              BufferSize;\r
@@ -143,6 +149,24 @@ BootMaintExtractConfig (
   return Status;\r
 }\r
 \r
+/**\r
+  This function processes the results of changes in configuration.\r
+\r
+\r
+  @param This            - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          - Specifies the type of action taken by the browser.\r
+  @param QuestionId      - A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\r
+  @param Type            - The type of value for the question.\r
+  @param Value           - A pointer to the data being sent to the original exporting driver.\r
+  @param ActionRequest   - On return, points to the action requested by the callback function.\r
+\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.\r
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.\r
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the callback.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BootMaintCallback (\r
@@ -153,27 +177,6 @@ BootMaintCallback (
   IN  EFI_IFR_TYPE_VALUE                     *Value,\r
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function processes the results of changes in configuration.\r
-\r
-  Arguments:\r
-    This          - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Action        - Specifies the type of action taken by the browser.\r
-    QuestionId    - A unique value which is sent to the original exporting driver\r
-                    so that it can identify the type of data to expect.\r
-    Type          - The type of value for the question.\r
-    Value         - A pointer to the data being sent to the original exporting driver.\r
-    ActionRequest - On return, points to the action requested by the callback function.\r
-\r
-  Returns:\r
-    EFI_SUCCESS          - The callback successfully handled the action.\r
-    EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.\r
-    EFI_DEVICE_ERROR     - The variable could not be saved.\r
-    EFI_UNSUPPORTED      - The specified Action is not supported by the callback.\r
-\r
---*/\r
 {\r
   BMM_CALLBACK_DATA *Private;\r
   BM_MENU_ENTRY     *NewMenuEntry;\r
@@ -534,27 +537,23 @@ BootMaintCallback (
   return Status;\r
 }\r
 \r
+/**\r
+  Function handling request to apply changes for BMM pages.\r
+\r
+  @param Private            Pointer to callback data buffer.\r
+  @param CurrentFakeNVMap   Pointer to buffer holding data of various values used by BMM\r
+  @param FormId             ID of the form which has sent the request to apply change.\r
+\r
+  @retval  EFI_SUCCESS       Change successfully applied.\r
+  @retval  Other             Error occurs while trying to apply changes.\r
+\r
+**/\r
 EFI_STATUS\r
 ApplyChangeHandler (\r
   IN  BMM_CALLBACK_DATA               *Private,\r
   IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap,\r
   IN  EFI_FORM_ID                     FormId\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Function handling request to apply changes for BMM pages.\r
-\r
-Arguments:\r
-  Private          - Pointer to callback data buffer.\r
-  CurrentFakeNVMap - Pointer to buffer holding data of various values used by BMM\r
-  FormId           - ID of the form which has sent the request to apply change.\r
-\r
-Returns:\r
-  EFI_SUCCESS      - Change successfully applied.\r
-  Other            - Error occurs while trying to apply changes.\r
-\r
---*/\r
 {\r
   BM_CONSOLE_CONTEXT  *NewConsoleContext;\r
   BM_TERMINAL_CONTEXT *NewTerminalContext;\r
@@ -724,6 +723,14 @@ Error:
   return Status;\r
 }\r
 \r
+/**\r
+  Discard all changes done to the BMM pages such as Boot Order change,\r
+  Driver order change.\r
+\r
+  @param Private            The BMM context data.\r
+  @param CurrentFakeNVMap   The current Fack NV Map.\r
+\r
+**/\r
 VOID\r
 DiscardChangeHandler (\r
   IN  BMM_CALLBACK_DATA               *Private,\r
@@ -770,24 +777,18 @@ DiscardChangeHandler (
   }\r
 }\r
 \r
+/**\r
+  Initialize the Boot Maintenance Utitliy.\r
+\r
+\r
+  @retval  EFI_SUCCESS      utility ended successfully\r
+  @retval  others           contain some errors\r
+\r
+**/\r
 EFI_STATUS\r
 InitializeBM (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Initialize the Boot Maintenance Utitliy\r
-\r
-Arguments:\r
-  ImageHandle     - caller provided handle\r
-  SystemTable     - caller provided system tables\r
-\r
-Returns:\r
-  EFI_SUCCESS     - utility ended successfully\r
-  others          - contain some errors\r
-\r
---*/\r
 {\r
   EFI_LEGACY_BIOS_PROTOCOL    *LegacyBios;\r
   EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
@@ -800,7 +801,7 @@ Returns:
   //\r
   // Create CallbackData structures for Driver Callback\r
   //\r
-  BmmCallbackInfo = EfiAllocateZeroPool (sizeof (BMM_CALLBACK_DATA));\r
+  BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));\r
   if (BmmCallbackInfo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -808,9 +809,9 @@ Returns:
   //\r
   // Create LoadOption in BmmCallbackInfo for Driver Callback\r
   //\r
-  Ptr = EfiAllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));\r
-  if (!Ptr) {\r
-    SafeFreePool (BmmCallbackInfo);\r
+  Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));\r
+  if (Ptr == NULL) {\r
+    FreePool (BmmCallbackInfo);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -914,10 +915,10 @@ Returns:
   // Allocate space for creation of Buffer\r
   //\r
   gUpdateData.BufferSize = UPDATE_DATA_SIZE;\r
-  gUpdateData.Data = EfiAllocateZeroPool (UPDATE_DATA_SIZE);\r
+  gUpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
   if (gUpdateData.Data == NULL) {\r
-    SafeFreePool (BmmCallbackInfo->LoadContext);\r
-    SafeFreePool (BmmCallbackInfo);\r
+    FreePool (BmmCallbackInfo->LoadContext);\r
+    FreePool (BmmCallbackInfo);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -1019,14 +1020,22 @@ Returns:
 \r
   FreeAllMenu ();\r
 \r
-  SafeFreePool (BmmCallbackInfo->LoadContext);\r
-  SafeFreePool (BmmCallbackInfo);\r
-  SafeFreePool (gUpdateData.Data);\r
+  FreePool (BmmCallbackInfo->LoadContext);\r
+  FreePool (BmmCallbackInfo);\r
+  FreePool (gUpdateData.Data);\r
   gUpdateData.Data = NULL;\r
 \r
   return Status;\r
 }\r
 \r
+/**\r
+  Initialized all Menu Option List.\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 InitAllMenu (\r
   IN  BMM_CALLBACK_DATA    *CallbackData\r
@@ -1048,6 +1057,14 @@ InitAllMenu (
   GetAllConsoles ();\r
 }\r
 \r
+/**\r
+  Free up all Menu Option list.\r
+\r
+  \r
+\r
+  \r
+\r
+**/\r
 VOID\r
 FreeAllMenu (\r
   VOID\r
@@ -1062,25 +1079,22 @@ FreeAllMenu (
   FreeAllConsoles ();\r
 }\r
 \r
-VOID\r
-InitializeStringDepository (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Intialize all the string depositories.\r
 \r
-Arguments:\r
-  None.\r
 \r
-Returns:\r
-  None.\r
+  \r
+\r
+  \r
 \r
---*/\r
+**/\r
+VOID\r
+InitializeStringDepository (\r
+  VOID\r
+  )\r
 {\r
   STRING_DEPOSITORY *StringDepository;\r
-  StringDepository              = EfiAllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);\r
+  StringDepository              = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);\r
   FileOptionStrDepository       = StringDepository++;\r
   ConsoleOptionStrDepository    = StringDepository++;\r
   BootOptionStrDepository       = StringDepository++;\r
@@ -1090,23 +1104,21 @@ Returns:
   TerminalStrDepository         = StringDepository;\r
 }\r
 \r
+/**\r
+  Fetch a usable string node from the string depository and return the string token.\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+  @param StringDepository  The string repository.\r
+\r
+  @retval  EFI_STRING_ID           String token.\r
+\r
+**/\r
 EFI_STRING_ID\r
 GetStringTokenFromDepository (\r
   IN   BMM_CALLBACK_DATA     *CallbackData,\r
   IN   STRING_DEPOSITORY     *StringDepository\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Fetch a usable string node from the string depository and return the string token.\r
-\r
-Arguments:\r
-  StringDepository       - Pointer of the string depository.\r
-\r
-Returns:\r
-  EFI_STRING_ID          - String token.\r
-\r
---*/\r
 {\r
   STRING_LIST_NODE  *CurrentListNode;\r
   STRING_LIST_NODE  *NextListNode;\r
@@ -1122,7 +1134,7 @@ Returns:
     //\r
     // If there is no usable node in the list, update the list.\r
     //\r
-    NextListNode = EfiAllocateZeroPool (sizeof (STRING_LIST_NODE));\r
+    NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));\r
 \r
     HiiLibNewString (CallbackData->BmmHiiHandle, &(NextListNode->StringToken), L" ");\r
     ASSERT (NextListNode->StringToken != 0);\r
@@ -1141,22 +1153,19 @@ Returns:
   return StringDepository->CurrentNode->StringToken;\r
 }\r
 \r
-VOID\r
-ReclaimStringDepository (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Reclaim string depositories by moving the current node pointer to list head..\r
 \r
-Arguments:\r
-  None.\r
 \r
-Returns:\r
-  None.\r
+   \r
+\r
+  \r
 \r
---*/\r
+**/\r
+VOID\r
+ReclaimStringDepository (\r
+  VOID\r
+  )\r
 {\r
   UINTN             DepositoryIndex;\r
   STRING_DEPOSITORY *StringDepository;\r
@@ -1168,22 +1177,19 @@ Returns:
   }\r
 }\r
 \r
-VOID\r
-CleanUpStringDepository (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Release resource for all the string depositories.\r
 \r
-Arguments:\r
-  None.\r
 \r
-Returns:\r
-  None.\r
+  \r
 \r
---*/\r
+  \r
+\r
+**/\r
+VOID\r
+CleanUpStringDepository (\r
+  VOID\r
+  )\r
 {\r
   UINTN             NodeIndex;\r
   UINTN             DepositoryIndex;\r
@@ -1199,7 +1205,7 @@ Returns:
     CurrentListNode = StringDepository->ListHead;\r
     for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {\r
       NextListNode = CurrentListNode->Next;\r
-      SafeFreePool (CurrentListNode);\r
+      FreePool (CurrentListNode);\r
       CurrentListNode = NextListNode;\r
     }\r
 \r
@@ -1208,23 +1214,23 @@ Returns:
   //\r
   // Release string depository.\r
   //\r
-  SafeFreePool (FileOptionStrDepository);\r
+  FreePool (FileOptionStrDepository);\r
 }\r
 \r
-EFI_STATUS\r
-BdsStartBootMaint (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Start boot maintenance manager\r
 \r
-Arguments:\r
 \r
-Returns:\r
+  \r
+\r
+  @retval EFI_SUCCESS If BMM is invoked successfully.\r
+  @return Other value if BMM return unsuccessfully.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BdsStartBootMaint (\r
+  VOID\r
+  )\r
 {\r
   EFI_STATUS      Status;\r
   LIST_ENTRY      BdsBootOptionList;\r
@@ -1243,38 +1249,29 @@ Returns:
   //\r
   BdsLibEnumerateAllBootOption (&BdsBootOptionList);\r
 \r
-  //\r
-  // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION\r
-  //\r
-  gBS->RestoreTPL (TPL_APPLICATION);\r
-\r
   //\r
   // Init the BMM\r
   //\r
   Status = InitializeBM ();\r
 \r
-  //\r
-  // Raise the TPL level back to TPL_APPLICATION\r
-  //\r
-  gBS->RaiseTPL (TPL_APPLICATION);\r
-\r
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-FormSetDispatcher (\r
-  IN  BMM_CALLBACK_DATA    *CallbackData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Dispatch BMM formset and FileExplorer formset.\r
 \r
-Arguments:\r
 \r
-Returns:\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @retval EFI_SUCCESS If function complete successfully.\r
+  @return Other value if the Setup Browser process BMM's pages and\r
+           return unsuccessfully.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+FormSetDispatcher (\r
+  IN  BMM_CALLBACK_DATA    *CallbackData\r
+  )\r
 {\r
   EFI_STATUS                 Status;\r
   EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
@@ -1329,3 +1326,58 @@ Returns:
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Deletete the Boot Option from EFI Variable. The Boot Order Arrray\r
+  is also updated.\r
+\r
+  @param OptionNumber    EDES_TODO: Add parameter description\r
+  @param BootOrder       The Boot Order array.\r
+  @param BootOrderSize   The size of the Boot Order Array.\r
+\r
+  @return Other value if the Boot Option specified by OptionNumber is not deleteed succesfully.\r
+  @retval EFI_SUCCESS    If function return successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+BdsDeleteBootOption (\r
+  IN UINTN                       OptionNumber,\r
+  IN OUT UINT16                  *BootOrder,\r
+  IN OUT UINTN                   *BootOrderSize\r
+  )\r
+{\r
+  UINT16      BootOption[100];\r
+  UINTN       Index;\r
+  EFI_STATUS  Status;\r
+  UINTN       Index2Del;\r
+\r
+  Status    = EFI_SUCCESS;\r
+  Index2Del = 0;\r
+\r
+  UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);\r
+  Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);\r
+  //\r
+  // adjust boot order array\r
+  //\r
+  for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {\r
+    if (BootOrder[Index] == OptionNumber) {\r
+      Index2Del = Index;\r
+      break;\r
+    }\r
+  }\r
+\r
+  if (Index != *BootOrderSize / sizeof (UINT16)) {\r
+    for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {\r
+      if (Index >= Index2Del) {\r
+        BootOrder[Index] = BootOrder[Index + 1];\r
+      }\r
+    }\r
+\r
+    *BootOrderSize -= sizeof (UINT16);\r
+  }\r
+\r
+  return Status;\r
+\r
+}\r
+\r
+\r