]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Nt32Pkg: Add LoadFileOnFv2 driver in DSC/FDF
authorLiming Gao <liming.gao@intel.com>
Mon, 25 Jul 2016 14:00:27 +0000 (22:00 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 1 Aug 2016 04:58:39 +0000 (12:58 +0800)
After add LoadFileOnFv2, PlatformBootManagerLib doesn't need to find Shell
application from FV.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/Nt32Pkg.fdf

index 007e18a956c46e18f37df6830be4192e151f1652..e2c3a4e5f4bb0a98cd13c400c4d7ee11215a61e8 100644 (file)
@@ -57,91 +57,6 @@ PlatformBootManagerDiagnostics (
   Status = PlatformBootManagerMemoryTest (MemoryTestLevel);\r
 }\r
 \r
-/**\r
-  Return the index of the load option in the load option array.\r
-\r
-  The function consider two load options are equal when the \r
-  OptionType, Attributes, Description, FilePath and OptionalData are equal.\r
-\r
-  @param Key    Pointer to the load option to be found.\r
-  @param Array  Pointer to the array of load options to be found.\r
-  @param Count  Number of entries in the Array.\r
-\r
-  @retval -1          Key wasn't found in the Array.\r
-  @retval 0 ~ Count-1 The index of the Key in the Array.\r
-**/\r
-INTN\r
-PlatformFindLoadOption (\r
-  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,\r
-  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,\r
-  IN UINTN                              Count\r
-  )\r
-{\r
-  UINTN                             Index;\r
-\r
-  for (Index = 0; Index < Count; Index++) {\r
-    if ((Key->OptionType == Array[Index].OptionType) &&\r
-        (Key->Attributes == Array[Index].Attributes) &&\r
-        (StrCmp (Key->Description, Array[Index].Description) == 0) &&\r
-        (CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize (Key->FilePath)) == 0) &&\r
-        (Key->OptionalDataSize == Array[Index].OptionalDataSize) &&\r
-        (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0)) {\r
-      return (INTN) Index;\r
-    }\r
-  }\r
-\r
-  return -1;\r
-}\r
-\r
-VOID\r
-PlatformRegisterFvBootOption (\r
-  EFI_GUID                         *FileGuid,\r
-  CHAR16                           *Description,\r
-  UINT32                           Attributes\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINTN                             OptionIndex;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION      *BootOptions;\r
-  UINTN                             BootOptionCount;\r
-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;\r
-  EFI_LOADED_IMAGE_PROTOCOL         *LoadedImage;\r
-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
-\r
-  Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);\r
-  DevicePath = AppendDevicePathNode (\r
-                 DevicePathFromHandle (LoadedImage->DeviceHandle),\r
-                 (EFI_DEVICE_PATH_PROTOCOL *) &FileNode\r
-                 );\r
-\r
-  Status = EfiBootManagerInitializeLoadOption (\r
-             &NewOption,\r
-             LoadOptionNumberUnassigned,\r
-             LoadOptionTypeBoot,\r
-             Attributes,\r
-             Description,\r
-             DevicePath,\r
-             NULL,\r
-             0\r
-             );\r
-  if (!EFI_ERROR (Status)) {\r
-    BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
-\r
-    OptionIndex = PlatformFindLoadOption (&NewOption, BootOptions, BootOptionCount);\r
-\r
-    if (OptionIndex == -1) {\r
-      Status = EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN) -1);\r
-      ASSERT_EFI_ERROR (Status);\r
-    }\r
-    EfiBootManagerFreeLoadOption (&NewOption);\r
-    EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
-  }\r
-}\r
-\r
 /**\r
   Do the platform specific action before the console is connected.\r
 \r
@@ -159,9 +74,6 @@ PlatformBootManagerBeforeConsole (
   UINTN                        Index;\r
   EFI_STATUS                   Status;\r
   WIN_NT_SYSTEM_CONFIGURATION  *Configuration;\r
-  EFI_INPUT_KEY                Enter;\r
-  EFI_INPUT_KEY                F2;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
 \r
   GetVariable2 (L"Setup", &gEfiWinNtSystemConfigGuid, (VOID **) &Configuration, NULL);\r
   if (Configuration != NULL) {\r
@@ -200,24 +112,6 @@ PlatformBootManagerBeforeConsole (
       EfiBootManagerUpdateConsoleVariable (ErrOut, gPlatformConsole[Index].DevicePath, NULL);\r
     }\r
   }\r
-\r
-  //\r
-  // Register ENTER as CONTINUE key\r
-  //\r
-  Enter.ScanCode    = SCAN_NULL;\r
-  Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;\r
-  EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
-  //\r
-  // Map F2 to Boot Manager Menu\r
-  //\r
-  F2.ScanCode    = SCAN_F2;\r
-  F2.UnicodeChar = CHAR_NULL;\r
-  EfiBootManagerGetBootManagerMenu (&BootOption);\r
-  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);\r
-  //\r
-  // Register UEFI Shell\r
-  //\r
-  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
 }\r
 \r
 /**\r
@@ -238,6 +132,9 @@ PlatformBootManagerAfterConsole (
 {\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Black;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  White;\r
+  EFI_INPUT_KEY                  Enter;\r
+  EFI_INPUT_KEY                  F2;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION   BootOption;\r
 \r
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;\r
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;\r
@@ -245,6 +142,20 @@ PlatformBootManagerAfterConsole (
   EfiBootManagerConnectAll ();\r
   EfiBootManagerRefreshAllBootOption ();\r
 \r
+  //\r
+  // Register ENTER as CONTINUE key\r
+  //\r
+  Enter.ScanCode    = SCAN_NULL;\r
+  Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;\r
+  EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
+  //\r
+  // Map F2 to Boot Manager Menu\r
+  //\r
+  F2.ScanCode    = SCAN_F2;\r
+  F2.UnicodeChar = CHAR_NULL;\r
+  EfiBootManagerGetBootManagerMenu (&BootOption);\r
+  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);\r
+\r
   PlatformBootManagerDiagnostics (QUICK, TRUE);\r
   \r
   PrintXY (10, 10, &White, &Black, L"F2    to enter Boot Manager Menu.                                            ");\r
index ada0a2dd033b080cdd821705cc78a242cdeea873..e3f9326e22f235de8e060a1654777d0f6bb90612 100644 (file)
   MdeModulePkg/Application/VariableInfo/VariableInfo.inf\r
 \r
   MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf\r
+  MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf\r
 \r
 ###################################################################################################\r
 #\r
index d7b2696ce3d8bab16be9211319a9b3eceeae3511..39046ec4bc088ebf9c3e7cfa8b6d321993087db3 100644 (file)
@@ -282,7 +282,7 @@ FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
     SECTION RAW = MdeModulePkg/Logo/Logo.bmp\r
   }\r
 \r
-\r
+INF MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf\r
 ################################################################################\r
 #\r
 # Rules are use with the [FV] section's module INF type to define\r