]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c
MdeModulePkg: Removing ipf which is no longer supported from edk2.
[mirror_edk2.git] / MdeModulePkg / Application / BootManagerMenuApp / BootManagerMenu.c
index a25f2ca298c758ee6e7e145b79ebe2cd25ed17b3..6a6b19ad09d8040408da71e95acfea0744399b55 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The application to show the Boot Manager Menu.\r
 \r
-Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<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
@@ -91,19 +91,19 @@ UINTN
 GetLineWidth (\r
   IN EFI_STRING_ID       StringId\r
   )\r
-{  \r
+{\r
   UINTN        Index;\r
   UINTN        IncrementValue;\r
   EFI_STRING   String;\r
   UINTN        LineWidth;\r
-  \r
+\r
   LineWidth = 0;\r
-  String = HiiGetString (gStringPackHandle, StringId, NULL); \r
-  \r
+  String = HiiGetString (gStringPackHandle, StringId, NULL);\r
+\r
   if (String != NULL) {\r
     Index           = 0;\r
     IncrementValue  = 1;\r
-    \r
+\r
     do {\r
       //\r
       // Advance to the null-terminator or to the first width directive\r
@@ -113,7 +113,7 @@ GetLineWidth (
            Index++, LineWidth = LineWidth + IncrementValue\r
           )\r
         ;\r
-    \r
+\r
       //\r
       // We hit the null-terminator, we now have a count\r
       //\r
@@ -137,11 +137,11 @@ GetLineWidth (
         Index++;\r
         IncrementValue = 2;\r
       }\r
-    } while (String[Index] != 0);   \r
+    } while (String[Index] != 0);\r
     FreePool (String);\r
   }\r
-  \r
-  return LineWidth;  \r
+\r
+  return LineWidth;\r
 }\r
 \r
 /**\r
@@ -150,10 +150,10 @@ GetLineWidth (
   @param  BootMenuData            The boot menu data to be processed.\r
 \r
   @return EFI_SUCCESS             calculate boot menu information successful.\r
-  @retval EFI_INVALID_PARAMETER   Input parameter is invalid   \r
+  @retval EFI_INVALID_PARAMETER   Input parameter is invalid\r
 \r
 **/\r
-EFI_STATUS \r
+EFI_STATUS\r
 InitializeBootMenuScreen (\r
   IN OUT  BOOT_MENU_POPUP_DATA  *BootMenuData\r
   )\r
@@ -172,21 +172,21 @@ InitializeBootMenuScreen (
   //\r
   // Get maximum string width\r
   //\r
-  MaxStrWidth = 0;  \r
-  for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++) {    \r
+  MaxStrWidth = 0;\r
+  for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++) {\r
     StrWidth = GetLineWidth (BootMenuData->TitleToken[Index]);\r
     MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;\r
   }\r
-   \r
+\r
   for (Index = 0; Index < BootMenuData->ItemCount; Index++) {\r
     StrWidth = GetLineWidth (BootMenuData->PtrTokens[Index]);\r
-    MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth; \r
-  } \r
-  \r
-  for (Index = 0; Index < HELP_TOKEN_COUNT; Index++) {    \r
+    MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;\r
+  }\r
+\r
+  for (Index = 0; Index < HELP_TOKEN_COUNT; Index++) {\r
     StrWidth = GetLineWidth (BootMenuData->HelpToken[Index]);\r
     MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;\r
-  }  \r
+  }\r
   //\r
   // query current row and column to calculate boot menu location\r
   //\r
@@ -195,10 +195,10 @@ InitializeBootMenuScreen (
                  gST->ConOut->Mode->Mode,\r
                  &Column,\r
                  &Row\r
-                 ); \r
-                 \r
-  MaxPrintRows = Row - 6;    \r
-  UnSelectableItmes = TITLE_TOKEN_COUNT + 2 + HELP_TOKEN_COUNT + 2;           \r
+                 );\r
+\r
+  MaxPrintRows = Row - 6;\r
+  UnSelectableItmes = TITLE_TOKEN_COUNT + 2 + HELP_TOKEN_COUNT + 2;\r
   BootMenuData->MenuScreen.Width = MaxStrWidth + 8;\r
   if (BootMenuData->ItemCount + UnSelectableItmes > MaxPrintRows) {\r
     BootMenuData->MenuScreen.Height = MaxPrintRows;\r
@@ -211,10 +211,10 @@ InitializeBootMenuScreen (
     BootMenuData->ScrollBarControl.HasScrollBar = FALSE;\r
     BootMenuData->ScrollBarControl.ItemCountPerScreen = BootMenuData->ItemCount;\r
     BootMenuData->ScrollBarControl.FirstItem = 0;\r
-    BootMenuData->ScrollBarControl.LastItem = BootMenuData->ItemCount - 1;    \r
+    BootMenuData->ScrollBarControl.LastItem = BootMenuData->ItemCount - 1;\r
   }\r
-  BootMenuData->MenuScreen.StartCol = (Column -  BootMenuData->MenuScreen.Width) / 2;              \r
-  BootMenuData->MenuScreen.StartRow = (Row -  BootMenuData->MenuScreen.Height) / 2;  \r
+  BootMenuData->MenuScreen.StartCol = (Column -  BootMenuData->MenuScreen.Width) / 2;\r
+  BootMenuData->MenuScreen.StartRow = (Row -  BootMenuData->MenuScreen.Height) / 2;\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -222,7 +222,7 @@ InitializeBootMenuScreen (
   This function uses check boot option is wheher setup application or no\r
 \r
   @param   BootOption   Pointer to EFI_BOOT_MANAGER_LOAD_OPTION array.\r
-  \r
+\r
   @retval  TRUE         This boot option is setup application.\r
   @retval  FALSE        This boot options isn't setup application\r
 \r
@@ -291,9 +291,9 @@ IgnoreBootOption (
   @param   BootOption             Pointer to EFI_BOOT_MANAGER_LOAD_OPTION array.\r
   @param   BootOptionCount        Number of boot option.\r
   @param   BootMenuData           The Input BootMenuData to be initialized.\r
-  \r
+\r
   @retval  EFI_SUCCESS            Initialize boot menu data successful.\r
-  @retval  EFI_INVALID_PARAMETER  Input parameter is invalid.   \r
+  @retval  EFI_INVALID_PARAMETER  Input parameter is invalid.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -305,7 +305,7 @@ InitializeBootMenuData (
 {\r
   UINTN                         Index;\r
   UINTN                         StrIndex;\r
-      \r
+\r
   if (BootOption == NULL || BootMenuData == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -324,21 +324,21 @@ InitializeBootMenuData (
 \r
     ASSERT (BootOption[Index].Description != NULL);\r
     BootMenuData->PtrTokens[StrIndex++] = HiiSetString (\r
-                                            gStringPackHandle, \r
+                                            gStringPackHandle,\r
                                             0,\r
                                             BootOption[Index].Description,\r
                                             NULL\r
                                             );\r
   }\r
 \r
-  BootMenuData->ItemCount           = StrIndex;   \r
+  BootMenuData->ItemCount           = StrIndex;\r
   BootMenuData->HelpToken[0] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP1_STRING);\r
   BootMenuData->HelpToken[1] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP2_STRING);\r
   BootMenuData->HelpToken[2] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP3_STRING);\r
   InitializeBootMenuScreen (BootMenuData);\r
   BootMenuData->SelectItem = 0;\r
   return EFI_SUCCESS;\r
-}    \r
+}\r
 \r
 /**\r
   This function uses input select item to highlight selected item\r
@@ -347,9 +347,9 @@ InitializeBootMenuData (
   @param  WantSelectItem          The user wants to select item.\r
   @param  BootMenuData            The boot menu data to be processed\r
 \r
-  @return EFI_SUCCESS             Highlight selected item and update current selected \r
-                                  item successful \r
-  @retval EFI_INVALID_PARAMETER   Input parameter is invalid   \r
+  @return EFI_SUCCESS             Highlight selected item and update current selected\r
+                                  item successful\r
+  @retval EFI_INVALID_PARAMETER   Input parameter is invalid\r
 **/\r
 EFI_STATUS\r
 BootMenuSelectItem (\r
@@ -359,7 +359,7 @@ BootMenuSelectItem (
 {\r
   INT32                 SavedAttribute;\r
   EFI_STRING            String;\r
-  UINTN                 StartCol;  \r
+  UINTN                 StartCol;\r
   UINTN                 StartRow;\r
   UINTN                 PrintCol;\r
   UINTN                 PrintRow;\r
@@ -370,7 +370,7 @@ BootMenuSelectItem (
   UINTN                 ItemCountPerScreen;\r
   UINTN                 Index;\r
   BOOLEAN               RePaintItems;\r
-  \r
+\r
   if (BootMenuData == NULL || WantSelectItem >= BootMenuData->ItemCount) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -381,20 +381,20 @@ BootMenuSelectItem (
   StartRow = BootMenuData->MenuScreen.StartRow;\r
   //\r
   // print selectable items again and adjust scroll bar if need\r
-  //         \r
+  //\r
   if (BootMenuData->ScrollBarControl.HasScrollBar &&\r
       (WantSelectItem < BootMenuData->ScrollBarControl.FirstItem ||\r
       WantSelectItem > BootMenuData->ScrollBarControl.LastItem ||\r
-      WantSelectItem == BootMenuData->SelectItem)) {          \r
+      WantSelectItem == BootMenuData->SelectItem)) {\r
     ItemCountPerScreen   = BootMenuData->ScrollBarControl.ItemCountPerScreen;\r
     //\r
     // Set first item and last item\r
-    //     \r
+    //\r
     if (WantSelectItem < BootMenuData->ScrollBarControl.FirstItem) {\r
       BootMenuData->ScrollBarControl.FirstItem = WantSelectItem;\r
-      BootMenuData->ScrollBarControl.LastItem = WantSelectItem + ItemCountPerScreen - 1;  \r
+      BootMenuData->ScrollBarControl.LastItem = WantSelectItem + ItemCountPerScreen - 1;\r
     } else if (WantSelectItem > BootMenuData->ScrollBarControl.LastItem) {\r
-      BootMenuData->ScrollBarControl.FirstItem = WantSelectItem - ItemCountPerScreen + 1; \r
+      BootMenuData->ScrollBarControl.FirstItem = WantSelectItem - ItemCountPerScreen + 1;\r
       BootMenuData->ScrollBarControl.LastItem = WantSelectItem;\r
     }\r
     gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);\r
@@ -407,7 +407,7 @@ BootMenuSelectItem (
         TopShadeNum++;\r
       }\r
       PrintCol = StartCol  + BootMenuData->MenuScreen.Width - 2;\r
-      PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;  \r
+      PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;\r
       for (Index = 0; Index < TopShadeNum; Index++, PrintRow++) {\r
         PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_LIGHT_SHADE);\r
       }\r
@@ -419,65 +419,65 @@ BootMenuSelectItem (
         LowShadeNum++;\r
       }\r
       PrintCol = StartCol  + BootMenuData->MenuScreen.Width - 2;\r
-      PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + ItemCountPerScreen - LowShadeNum;  \r
+      PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + ItemCountPerScreen - LowShadeNum;\r
       for (Index = 0; Index < LowShadeNum; Index++, PrintRow++) {\r
         PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_LIGHT_SHADE);\r
-      } \r
+      }\r
     }\r
     PrintCol = StartCol  + BootMenuData->MenuScreen.Width - 2;\r
-    PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + TopShadeNum;  \r
+    PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + TopShadeNum;\r
     for (Index = TopShadeNum; Index < ItemCountPerScreen - LowShadeNum; Index++, PrintRow++) {\r
       PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_FULL_BLOCK);\r
-    }      \r
+    }\r
 \r
 \r
     //\r
     // Clear selectable items first\r
     //\r
     PrintCol = StartCol  + 1;\r
-    PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;  \r
+    PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;\r
     String = AllocateZeroPool ((BootMenuData->MenuScreen.Width - 2) * sizeof (CHAR16));\r
     ASSERT (String != NULL);\r
     for (Index = 0; Index < BootMenuData->MenuScreen.Width - 3; Index++) {\r
       String[Index] = 0x20;\r
-    }      \r
-    for (Index = 0; Index < ItemCountPerScreen; Index++) {        \r
-      PrintStringAt (PrintCol, PrintRow + Index, String); \r
+    }\r
+    for (Index = 0; Index < ItemCountPerScreen; Index++) {\r
+      PrintStringAt (PrintCol, PrintRow + Index, String);\r
     }\r
     FreePool (String);\r
     //\r
-    // print selectable items  \r
+    // print selectable items\r
     //\r
     for (Index = 0; Index < ItemCountPerScreen; Index++, PrintRow++) {\r
       String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[Index + FirstItem], NULL);\r
       PrintStringAt (PrintCol, PrintRow, String);\r
-      FreePool (String); \r
+      FreePool (String);\r
     }\r
     RePaintItems = TRUE;\r
   }\r
-  \r
+\r
   //\r
-  // Print want to select item \r
+  // Print want to select item\r
   //\r
   FirstItem = BootMenuData->ScrollBarControl.FirstItem;\r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLACK);\r
   String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[WantSelectItem], NULL);\r
-  PrintCol = StartCol  + 1;  \r
-  PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + WantSelectItem - FirstItem;  \r
+  PrintCol = StartCol  + 1;\r
+  PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + WantSelectItem - FirstItem;\r
   PrintStringAt (PrintCol, PrintRow, String);\r
   FreePool (String);\r
-  \r
+\r
   //\r
-  // if Want Select and selected item isn't the same and doesn't re-draw selectable \r
+  // if Want Select and selected item isn't the same and doesn't re-draw selectable\r
   // items, clear select item\r
   //\r
   if (WantSelectItem != BootMenuData->SelectItem && !RePaintItems) {\r
     gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);\r
     String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[BootMenuData->SelectItem], NULL);\r
-    PrintCol = StartCol  + 1;  \r
-    PrintRow = StartRow + 3 + BootMenuData->SelectItem - FirstItem;  \r
+    PrintCol = StartCol  + 1;\r
+    PrintRow = StartRow + 3 + BootMenuData->SelectItem - FirstItem;\r
     PrintStringAt (PrintCol, PrintRow, String);\r
-    FreePool (String);    \r
+    FreePool (String);\r
   }\r
 \r
   gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);\r
@@ -489,28 +489,28 @@ BootMenuSelectItem (
   This function uses to draw boot popup menu\r
 \r
   @param   BootMenuData           The Input BootMenuData to be processed.\r
-  \r
+\r
   @retval  EFI_SUCCESS            Draw boot popup menu successful.\r
 \r
 **/\r
-EFI_STATUS \r
+EFI_STATUS\r
 DrawBootPopupMenu (\r
   IN  BOOT_MENU_POPUP_DATA  *BootMenuData\r
   )\r
 {\r
   EFI_STRING            String;\r
   UINTN                 Index;\r
-  UINTN                 Width;  \r
+  UINTN                 Width;\r
   UINTN                 StartCol;\r
   UINTN                 StartRow;\r
   UINTN                 PrintRow;\r
   UINTN                 PrintCol;\r
   UINTN                 LineWidth;\r
-  INT32                 SavedAttribute; \r
-  UINTN                 ItemCountPerScreen;  \r
+  INT32                 SavedAttribute;\r
+  UINTN                 ItemCountPerScreen;\r
 \r
   gST->ConOut->ClearScreen (gST->ConOut);\r
-  \r
+\r
   SavedAttribute = gST->ConOut->Mode->Attribute;\r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);\r
   Width    = BootMenuData->MenuScreen.Width;\r
@@ -518,17 +518,17 @@ DrawBootPopupMenu (
   StartRow = BootMenuData->MenuScreen.StartRow;\r
   ItemCountPerScreen = BootMenuData->ScrollBarControl.ItemCountPerScreen;\r
   PrintRow = StartRow;\r
\r
+\r
   gST->ConOut->EnableCursor (gST->ConOut, FALSE);\r
   //\r
   // Draw Boot popup menu screen\r
   //\r
   PrintCharAt (StartCol, PrintRow, BOXDRAW_DOWN_RIGHT);\r
   for (Index = 1; Index < Width - 1; Index++) {\r
-    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL); \r
+    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);\r
   }\r
   PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_DOWN_LEFT);\r
-  \r
+\r
   //\r
   // Draw the screen for title\r
   //\r
@@ -540,18 +540,18 @@ DrawBootPopupMenu (
 \r
   for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++) {\r
     PrintRow++;\r
-    PrintCharAt (StartCol, PrintRow, BOXDRAW_VERTICAL);  \r
+    PrintCharAt (StartCol, PrintRow, BOXDRAW_VERTICAL);\r
     PrintStringAt (StartCol + 1, PrintRow, String);\r
     PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL);\r
   }\r
-  \r
+\r
   PrintRow++;\r
   PrintCharAt (StartCol, PrintRow, BOXDRAW_VERTICAL_RIGHT);\r
   for (Index = 1; Index < Width - 1; Index++) {\r
-    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL); \r
+    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);\r
   }\r
-  PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL_LEFT);  \r
-  \r
+  PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL_LEFT);\r
+\r
   //\r
   // Draw screen for selectable items\r
   //\r
@@ -560,15 +560,15 @@ DrawBootPopupMenu (
     PrintCharAt (StartCol, PrintRow, BOXDRAW_VERTICAL);\r
     PrintStringAt (StartCol + 1, PrintRow, String);\r
     PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL);\r
-  }  \r
+  }\r
 \r
   PrintRow++;\r
   PrintCharAt (StartCol, PrintRow, BOXDRAW_VERTICAL_RIGHT);\r
   for (Index = 1; Index < Width - 1; Index++) {\r
-    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL); \r
+    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);\r
   }\r
   PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL_LEFT);\r
-  \r
+\r
   //\r
   // Draw screen for Help\r
   //\r
@@ -578,39 +578,39 @@ DrawBootPopupMenu (
     PrintStringAt (StartCol + 1, PrintRow, String);\r
     PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL);\r
   }\r
-  FreePool (String);  \r
-    \r
-  PrintRow++;  \r
+  FreePool (String);\r
+\r
+  PrintRow++;\r
   PrintCharAt (StartCol, PrintRow, BOXDRAW_UP_RIGHT);\r
   for (Index = 1; Index < Width - 1; Index++) {\r
-    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL); \r
+    PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);\r
   }\r
-  PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_UP_LEFT);        \r
-  \r
-  \r
+  PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_UP_LEFT);\r
+\r
+\r
   //\r
   // print title strings\r
   //\r
   PrintRow = StartRow + 1;\r
   for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++, PrintRow++) {\r
     String = HiiGetString (gStringPackHandle, BootMenuData->TitleToken[Index], NULL);\r
-    LineWidth = GetLineWidth (BootMenuData->TitleToken[Index]);      \r
+    LineWidth = GetLineWidth (BootMenuData->TitleToken[Index]);\r
     PrintCol = StartCol + (Width - LineWidth) / 2;\r
     PrintStringAt (PrintCol, PrintRow, String);\r
     FreePool (String);\r
   }\r
-  \r
+\r
   //\r
   // print selectable items\r
   //\r
   PrintCol = StartCol + 1;\r
-  PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;  \r
+  PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;\r
   for (Index = 0; Index < ItemCountPerScreen; Index++, PrintRow++) {\r
     String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[Index], NULL);\r
     PrintStringAt (PrintCol, PrintRow, String);\r
-    FreePool (String); \r
+    FreePool (String);\r
   }\r
-  \r
+\r
   //\r
   // Print Help strings\r
   //\r
@@ -622,20 +622,20 @@ DrawBootPopupMenu (
     PrintStringAt (PrintCol, PrintRow, String);\r
     FreePool (String);\r
   }\r
-  \r
+\r
   //\r
   // Print scroll bar if has scroll bar\r
   //\r
   if (BootMenuData->ScrollBarControl.HasScrollBar) {\r
     PrintCol = StartCol + Width - 2;\r
-    PrintRow = StartRow + 2; \r
-    PrintCharAt (PrintCol, PrintRow, GEOMETRICSHAPE_UP_TRIANGLE); \r
-    PrintCharAt (PrintCol + 1, PrintRow, BOXDRAW_VERTICAL); \r
-    PrintRow += (ItemCountPerScreen + 1);    \r
+    PrintRow = StartRow + 2;\r
+    PrintCharAt (PrintCol, PrintRow, GEOMETRICSHAPE_UP_TRIANGLE);\r
+    PrintCharAt (PrintCol + 1, PrintRow, BOXDRAW_VERTICAL);\r
+    PrintRow += (ItemCountPerScreen + 1);\r
     PrintCharAt (PrintCol, PrintRow, GEOMETRICSHAPE_DOWN_TRIANGLE);\r
-    PrintCharAt (PrintCol + 1, PrintRow, BOXDRAW_VERTICAL); \r
-  }  \r
-    \r
+    PrintCharAt (PrintCol + 1, PrintRow, BOXDRAW_VERTICAL);\r
+  }\r
+\r
   gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);\r
   //\r
   // Print Selected item\r
@@ -645,7 +645,7 @@ DrawBootPopupMenu (
 }\r
 \r
 /**\r
-  This function uses to boot from selected item \r
+  This function uses to boot from selected item\r
 \r
   @param   BootOptions            Pointer to EFI_BOOT_MANAGER_LOAD_OPTION array.\r
   @param   BootOptionCount        Number of boot option.\r
@@ -654,7 +654,7 @@ DrawBootPopupMenu (
 VOID\r
 BootFromSelectOption (\r
   IN   EFI_BOOT_MANAGER_LOAD_OPTION  *BootOptions,\r
-  IN   UINTN                         BootOptionCount, \r
+  IN   UINTN                         BootOptionCount,\r
   IN   UINTN                         SelectItem\r
   )\r
 {\r
@@ -677,9 +677,9 @@ BootFromSelectOption (
 \r
 /**\r
   This function will change video resolution and text mode\r
-  according to defined setup mode or defined boot mode  \r
+  according to defined setup mode or defined boot mode\r
 \r
-  @param  IsSetupMode   Indicate mode is changed to setup mode or boot mode. \r
+  @param  IsSetupMode   Indicate mode is changed to setup mode or boot mode.\r
 \r
   @retval  EFI_SUCCESS  Mode is changed successfully.\r
   @retval  Others             Mode failed to be changed.\r
@@ -707,13 +707,13 @@ BdsSetConsoleMode (
   EFI_STATUS                            Status;\r
   UINTN                                 Index;\r
   UINTN                                 CurrentColumn;\r
-  UINTN                                 CurrentRow;  \r
+  UINTN                                 CurrentRow;\r
 \r
   MaxGopMode  = 0;\r
   MaxTextMode = 0;\r
 \r
   //\r
-  // Get current video resolution and text mode \r
+  // Get current video resolution and text mode\r
   //\r
   Status = gBS->HandleProtocol (\r
                   gST->ConsoleOutHandle,\r
@@ -731,7 +731,7 @@ BdsSetConsoleMode (
                   );\r
   if (EFI_ERROR (Status)) {\r
     SimpleTextOut = NULL;\r
-  }  \r
+  }\r
 \r
   if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {\r
     return EFI_UNSUPPORTED;\r
@@ -752,12 +752,12 @@ BdsSetConsoleMode (
     NewHorizontalResolution = mBootHorizontalResolution;\r
     NewVerticalResolution   = mBootVerticalResolution;\r
     NewColumns              = mBootTextModeColumn;\r
-    NewRows                 = mBootTextModeRow;   \r
+    NewRows                 = mBootTextModeRow;\r
   }\r
-  \r
+\r
   if (GraphicsOutput != NULL) {\r
     MaxGopMode  = GraphicsOutput->Mode->MaxMode;\r
-  } \r
+  }\r
 \r
   if (SimpleTextOut != NULL) {\r
     MaxTextMode = SimpleTextOut->Mode->MaxMode;\r
@@ -861,7 +861,7 @@ BdsSetConsoleMode (
   ASSERT_EFI_ERROR (Status);\r
   Status = PcdSet32S (PcdConOutRow, NewRows);\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   //\r
   // Video mode is changed, so restart graphics console driver and higher level driver.\r
   // Reconnect graphics console driver and higher level driver.\r
@@ -894,10 +894,10 @@ BdsSetConsoleMode (
 \r
   @param   ImageHandle     The image handle.\r
   @param   SystemTable     The system table.\r
-  \r
+\r
   @retval  EFI_SUCCESS          Boot from selected boot option, and return success from boot option\r
   @retval  EFI_NOT_FOUND        User select to enter setup or can not find boot option\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -907,7 +907,7 @@ BootManagerMenuEntry (
   )\r
 {\r
   EFI_BOOT_MANAGER_LOAD_OPTION    *BootOption;\r
-  UINTN                           BootOptionCount;  \r
+  UINTN                           BootOptionCount;\r
   EFI_STATUS                      Status;\r
   BOOT_MENU_POPUP_DATA            BootMenuData;\r
   UINTN                           Index;\r
@@ -950,7 +950,7 @@ BootManagerMenuEntry (
 \r
   if (!mModeInitialized) {\r
     //\r
-    // After the console is ready, get current video resolution \r
+    // After the console is ready, get current video resolution\r
     // and text mode before launching setup at first time.\r
     //\r
     Status = gBS->HandleProtocol (\r
@@ -961,7 +961,7 @@ BootManagerMenuEntry (
     if (EFI_ERROR (Status)) {\r
       GraphicsOutput = NULL;\r
     }\r
-    \r
+\r
     Status = gBS->HandleProtocol (\r
                     gST->ConsoleOutHandle,\r
                     &gEfiSimpleTextOutProtocolGuid,\r
@@ -969,7 +969,7 @@ BootManagerMenuEntry (
                     );\r
     if (EFI_ERROR (Status)) {\r
       SimpleTextOut = NULL;\r
-    }  \r
+    }\r
 \r
     if (GraphicsOutput != NULL) {\r
       //\r
@@ -992,14 +992,14 @@ BootManagerMenuEntry (
 \r
     //\r
     // Get user defined text mode for setup.\r
-    //  \r
+    //\r
     mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);\r
-    mSetupVerticalResolution   = PcdGet32 (PcdSetupVideoVerticalResolution);      \r
+    mSetupVerticalResolution   = PcdGet32 (PcdSetupVideoVerticalResolution);\r
     mSetupTextModeColumn       = PcdGet32 (PcdSetupConOutColumn);\r
     mSetupTextModeRow          = PcdGet32 (PcdSetupConOutRow);\r
     mModeInitialized           = TRUE;\r
   }\r
-  \r
+\r
   //\r
   // Set back to conventional setup resolution\r
   //\r
@@ -1013,7 +1013,7 @@ BootManagerMenuEntry (
   // According to boot menu data to draw boot popup menu\r
   //\r
   DrawBootPopupMenu (&BootMenuData);\r
-  \r
+\r
   //\r
   // check user input to determine want to re-draw or boot from user selected item\r
   //\r
@@ -1023,18 +1023,18 @@ BootManagerMenuEntry (
     Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
     if (!EFI_ERROR (Status)) {\r
       switch (Key.UnicodeChar) {\r
-      \r
-      case CHAR_NULL:        \r
-        switch (Key.ScanCode) {          \r
-          \r
+\r
+      case CHAR_NULL:\r
+        switch (Key.ScanCode) {\r
+\r
         case SCAN_UP:\r
           SelectItem = BootMenuData.SelectItem == 0 ? BootMenuData.ItemCount - 1 : BootMenuData.SelectItem - 1;\r
-          BootMenuSelectItem (SelectItem, &BootMenuData); \r
+          BootMenuSelectItem (SelectItem, &BootMenuData);\r
           break;\r
-        \r
+\r
         case SCAN_DOWN:\r
           SelectItem = BootMenuData.SelectItem == BootMenuData.ItemCount - 1 ? 0 : BootMenuData.SelectItem + 1;\r
-          BootMenuSelectItem (SelectItem, &BootMenuData); \r
+          BootMenuSelectItem (SelectItem, &BootMenuData);\r
           break;\r
 \r
         case SCAN_ESC:\r
@@ -1045,12 +1045,12 @@ BootManagerMenuEntry (
           //\r
           BdsSetConsoleMode (FALSE);\r
           break;\r
-          \r
+\r
         default:\r
           break;\r
         }\r
         break;\r
-        \r
+\r
       case CHAR_CARRIAGE_RETURN:\r
         gST->ConOut->ClearScreen (gST->ConOut);\r
         //\r
@@ -1064,7 +1064,7 @@ BootManagerMenuEntry (
         BdsSetConsoleMode (TRUE);\r
         DrawBootPopupMenu (&BootMenuData);\r
         break;\r
-        \r
+\r
       default:\r
         break;\r
       }\r
@@ -1076,5 +1076,5 @@ BootManagerMenuEntry (
   HiiRemovePackages (gStringPackHandle);\r
 \r
   return Status;\r
-  \r
+\r
 }\r