]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
Nt32Pkg: Fix PlatformBootManagerLib to respect PcdShellFile.
[mirror_edk2.git] / Nt32Pkg / Library / PlatformBootManagerLib / PlatformBootManager.c
index a527a4233db8f71dd463ebd5c9667a9f78914519..e944105b39254cf82dfa7183daab68464bbecc14 100644 (file)
@@ -15,8 +15,47 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "PlatformBootManager.h"\r
 \r
+/**\r
+  Perform the platform diagnostic, such like test memory. OEM/IBV also\r
+  can customize this function to support specific platform diagnostic.\r
+\r
+  @param MemoryTestLevel  The memory test intensive level\r
+  @param QuietBoot        Indicate if need to enable the quiet boot\r
+\r
+**/\r
+VOID\r
+PlatformBootManagerDiagnostics (\r
+  IN EXTENDMEM_COVERAGE_LEVEL    MemoryTestLevel,\r
+  IN BOOLEAN                     QuietBoot\r
+  )\r
+{\r
+  EFI_STATUS                     Status;\r
+\r
+  //\r
+  // Here we can decide if we need to show\r
+  // the diagnostics screen\r
+  // Notes: this quiet boot code should be remove\r
+  // from the graphic lib\r
+  //\r
+  if (QuietBoot) {\r
+    PlatformBootManagerEnableQuietBoot (PcdGetPtr(PcdLogoFile));\r
+\r
+    //\r
+    // Perform system diagnostic\r
+    //\r
+    Status = PlatformBootManagerMemoryTest (MemoryTestLevel);\r
+    if (EFI_ERROR (Status)) {\r
+      PlatformBootManagerDisableQuietBoot ();\r
+    }\r
 \r
-EFI_GUID mUefiShellFileGuid = { 0x7C04A583, 0x9E3E, 0x4f1c, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 };\r
+    return;\r
+  }\r
+\r
+  //\r
+  // Perform system diagnostic\r
+  //\r
+  Status = PlatformBootManagerMemoryTest (MemoryTestLevel);\r
+}\r
 \r
 /**\r
   Return the index of the load option in the load option array.\r
@@ -178,7 +217,7 @@ PlatformBootManagerBeforeConsole (
   //\r
   // Register UEFI Shell\r
   //\r
-  PlatformRegisterFvBootOption (&mUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
+  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
 }\r
 \r
 /**\r
@@ -197,14 +236,19 @@ PlatformBootManagerAfterConsole (
   VOID\r
   )\r
 {\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Black;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  White;\r
+\r
+  Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;\r
+  White.Blue = White.Green = White.Red = White.Reserved = 0xFF;\r
+\r
   EfiBootManagerConnectAll ();\r
   EfiBootManagerRefreshAllBootOption ();\r
-  Print (\r
-    L"\n"\r
-    L"F2    to enter Boot Manager Menu.\n"\r
-    L"Enter to boot directly.\n"\r
-    L"\n"\r
-    );\r
+\r
+  PlatformBootManagerDiagnostics (QUICK, TRUE);\r
+  \r
+  PrintXY (10, 10, &White, &Black, L"F2    to enter Boot Manager Menu.                                            ");\r
+  PrintXY (10, 30, &White, &Black, L"Enter to boot directly.");\r
 }\r
 \r
 /**\r
@@ -218,5 +262,21 @@ PlatformBootManagerWaitCallback (
   UINT16          TimeoutRemain\r
   )\r
 {\r
-  Print (L"\r%-2d seconds remained...", TimeoutRemain);\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;\r
+  UINT16                        Timeout;\r
+\r
+  Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
+\r
+  Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;\r
+  White.Blue = White.Green = White.Red = White.Reserved = 0xFF;\r
+\r
+  PlatformBootManagerShowProgress (\r
+    White,\r
+    Black,\r
+    L"Start boot option",\r
+    White,\r
+    (Timeout - TimeoutRemain) * 100 / Timeout,\r
+    0\r
+    );\r
 }\r