#include "PlatformBootManager.h"\r
#include "PlatformConsole.h"\r
#include <Protocol/PlatformBootManagerOverride.h>\r
+#include <Guid/BootManagerMenu.h>\r
+#include <Library/HobLib.h>\r
\r
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL *mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;\r
\r
return;\r
}\r
\r
+/**\r
+ Get/update PcdBootManagerMenuFile from GUID HOB which will be assigned in bootloader.\r
+\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval other Some error occurs.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformBootManagerLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+)\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Size;\r
+ VOID *GuidHob;\r
+ UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;\r
+ UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU *BootManagerMenuFile;\r
+\r
+ GuidHob = GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid);\r
+\r
+ if (GuidHob == NULL) {\r
+ //\r
+ // If the HOB is not create, the default value of PcdBootManagerMenuFile will be used.\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob);\r
+ if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) {\r
+ BootManagerMenuFile = (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU *) GET_GUID_HOB_DATA (GuidHob);\r
+ if (BootManagerMenuFile->Header.Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, FileName)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ Size = sizeof (BootManagerMenuFile->FileName);\r
+ Status = PcdSetPtrS (PcdBootManagerMenuFile, &Size, &BootManagerMenuFile->FileName);\r
+ ASSERT_EFI_ERROR (Status);\r
+ } else {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
MODULE_TYPE = DXE_DRIVER\r
VERSION_STRING = 1.0\r
LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER\r
-\r
+ CONSTRUCTOR = PlatformBootManagerLibConstructor\r
\r
#\r
# The following information is for reference only and not required by the build tools.\r
HiiLib\r
PrintLib\r
PlatformHookLib\r
+ HobLib\r
\r
[Guids]\r
gEfiEndOfDxeEventGroupGuid\r
+ gEdkiiBootManagerMenuFileGuid\r
\r
[Protocols]\r
gEfiGenericMemTestProtocolGuid ## CONSUMES\r
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits\r
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity\r
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile\r
!endif\r
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }\r
\r
gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 }\r
\r
!endif\r
\r
[PcdsPatchableInModule.common]\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }\r
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7\r
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F\r
!if $(SOURCE_DEBUG_ENABLE)\r