]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
Coreboot*Pkg: Retire CorebootPayloadPkg and CorebootModulePkg
[mirror_edk2.git] / CorebootPayloadPkg / Library / PlatformBootManagerLib / PlatformBootManager.c
diff --git a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
deleted file mode 100644 (file)
index 11e03ca..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/** @file\r
-  This file include all platform action which can be customized\r
-  by IBV/OEM.\r
-\r
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "PlatformBootManager.h"\r
-#include "PlatformConsole.h"\r
-\r
-VOID\r
-InstallReadyToLock (\r
-  VOID\r
-  )\r
-{\r
-  EFI_STATUS                            Status;\r
-  EFI_HANDLE                            Handle;\r
-  EFI_SMM_ACCESS2_PROTOCOL              *SmmAccess;\r
-\r
-  DEBUG((DEBUG_INFO,"InstallReadyToLock  entering......\n"));\r
-  //\r
-  // Inform the SMM infrastructure that we're entering BDS and may run 3rd party code hereafter\r
-  // Since PI1.2.1, we need signal EndOfDxe as ExitPmAuth\r
-  //\r
-  EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);\r
-  DEBUG((DEBUG_INFO,"All EndOfDxe callbacks have returned successfully\n"));\r
-\r
-  //\r
-  // Install DxeSmmReadyToLock protocol in order to lock SMM\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **) &SmmAccess);\r
-  if (!EFI_ERROR (Status)) {\r
-    Handle = NULL;\r
-    Status = gBS->InstallProtocolInterface (\r
-                    &Handle,\r
-                    &gEfiDxeSmmReadyToLockProtocolGuid,\r
-                    EFI_NATIVE_INTERFACE,\r
-                    NULL\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  DEBUG((DEBUG_INFO,"InstallReadyToLock  end\n"));\r
-  return;\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
-/**\r
-  Register a boot option using a file GUID in the FV.\r
-\r
-  @param FileGuid     The file GUID name in FV.\r
-  @param Description  The boot option description.\r
-  @param Attributes   The attributes used for the boot option loading.\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
-  Such as:\r
-    Update console variable;\r
-    Register new Driver#### or Boot####;\r
-    Signal ReadyToLock event.\r
-**/\r
-VOID\r
-EFIAPI\r
-PlatformBootManagerBeforeConsole (\r
-  VOID\r
-)\r
-{\r
-  EFI_INPUT_KEY                Enter;\r
-  EFI_INPUT_KEY                F2;\r
-  EFI_INPUT_KEY                Down;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
-\r
-  PlatformConsoleInit ();\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
-  //\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
-  //\r
-  // Also add Down key to Boot Manager Menu since some serial terminals don't support F2 key.\r
-  //\r
-  Down.ScanCode    = SCAN_DOWN;\r
-  Down.UnicodeChar = CHAR_NULL;\r
-  EfiBootManagerGetBootManagerMenu (&BootOption);\r
-  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &Down, NULL);\r
-\r
-  //\r
-  // Install ready to lock.\r
-  // This needs to be done before option rom dispatched.\r
-  //\r
-  InstallReadyToLock ();\r
-\r
-  //\r
-  // Dispatch deferred images after EndOfDxe event and ReadyToLock installation.\r
-  //\r
-  EfiBootManagerDispatchDeferredImages ();\r
-}\r
-\r
-/**\r
-  Do the platform specific action after the console is connected.\r
-\r
-  Such as:\r
-    Dynamically switch output mode;\r
-    Signal console ready platform customized event;\r
-    Run diagnostics like memory testing;\r
-    Connect certain devices;\r
-    Dispatch additional option roms.\r
-**/\r
-VOID\r
-EFIAPI\r
-PlatformBootManagerAfterConsole (\r
-  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
-\r
-  //\r
-  // Register UEFI Shell\r
-  //\r
-  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
-  \r
-  Print (\r
-    L"\n"\r
-    L"F2 or Down      to enter Boot Manager Menu.\n"\r
-    L"ENTER           to boot directly.\n"\r
-    L"\n"\r
-  );\r
-\r
-}\r
-\r
-/**\r
-  This function is called each second during the boot manager waits the timeout.\r
-\r
-  @param TimeoutRemain  The remaining timeout.\r
-**/\r
-VOID\r
-EFIAPI\r
-PlatformBootManagerWaitCallback (\r
-  UINT16          TimeoutRemain\r
-)\r
-{\r
-  return;\r
-}\r
-\r
-/**\r
-  The function is called when no boot option could be launched,\r
-  including platform recovery options and options pointing to applications\r
-  built into firmware volumes.\r
-\r
-  If this function returns, BDS attempts to enter an infinite loop.\r
-**/\r
-VOID\r
-EFIAPI\r
-PlatformBootManagerUnableToBoot (\r
-  VOID\r
-  )\r
-{\r
-  return;\r
-}\r
-\r