UefiPayloadPkg: Get platform specific logic via protocol for BDS
Currently, BDS driver will link a PlatformBootManagerLib, which contains platform specific logic. This patch get the platform specific logic from a protocol, so that platform logic for Boot manager can be in another binary. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
parent
11b1c1d4b9
commit
d58016b768
|
@ -0,0 +1,85 @@
|
||||||
|
/** @file
|
||||||
|
This file defines the Univeral Payload Platform BootManager Protocol.
|
||||||
|
|
||||||
|
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_BOOT_MANAGER_OVERRIDE_H__
|
||||||
|
#define __PLATFORM_BOOT_MANAGER_OVERRIDE_H__
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do the platform specific action before the console is connected.
|
||||||
|
|
||||||
|
Such as:
|
||||||
|
Update console variable;
|
||||||
|
Register new Driver#### or Boot####;
|
||||||
|
Signal ReadyToLock event.
|
||||||
|
|
||||||
|
This function will override the default behavior in PlatformBootManagerLib
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE) (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do the platform specific action after the console is connected.
|
||||||
|
|
||||||
|
Such as:
|
||||||
|
Dynamically switch output mode;
|
||||||
|
Signal console ready platform customized event;
|
||||||
|
Run diagnostics like memory testing;
|
||||||
|
Connect certain devices;
|
||||||
|
Dispatch aditional option roms.
|
||||||
|
|
||||||
|
This function will override the default behavior in PlatformBootManagerLib
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE) (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called each second during the boot manager waits the timeout.
|
||||||
|
This function will override the default behavior in PlatformBootManagerLib
|
||||||
|
|
||||||
|
@param TimeoutRemain The remaining timeout.
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK) (
|
||||||
|
UINT16 TimeoutRemain
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is called when no boot option could be launched,
|
||||||
|
including platform recovery options and options pointing to applications
|
||||||
|
built into firmware volumes.
|
||||||
|
|
||||||
|
If this function returns, BDS attempts to enter an infinite loop.
|
||||||
|
This function will override the default behavior in PlatformBootManagerLib
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT) (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Provides an interface to override the default behavior in PlatformBootManagerLib,
|
||||||
|
/// so platform can provide its own platform specific logic through this protocol
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE BeforeConsole;
|
||||||
|
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE AfterConsole;
|
||||||
|
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK WaitCallback;
|
||||||
|
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT UnableToBoot;
|
||||||
|
} UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL;
|
||||||
|
|
||||||
|
extern GUID gUniversalPayloadPlatformBootManagerOverrideProtocolGuid;
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,13 +2,16 @@
|
||||||
This file include all platform action which can be customized
|
This file include all platform action which can be customized
|
||||||
by IBV/OEM.
|
by IBV/OEM.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "PlatformBootManager.h"
|
#include "PlatformBootManager.h"
|
||||||
#include "PlatformConsole.h"
|
#include "PlatformConsole.h"
|
||||||
|
#include <Protocol/PlatformBootManagerOverride.h>
|
||||||
|
|
||||||
|
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL *mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
InstallReadyToLock (
|
InstallReadyToLock (
|
||||||
|
@ -156,6 +159,16 @@ PlatformBootManagerBeforeConsole (
|
||||||
EFI_INPUT_KEY F2;
|
EFI_INPUT_KEY F2;
|
||||||
EFI_INPUT_KEY Down;
|
EFI_INPUT_KEY Down;
|
||||||
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
|
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gUniversalPayloadPlatformBootManagerOverrideProtocolGuid, NULL, (VOID **) &mUniversalPayloadPlatformBootManagerOverrideInstance);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;
|
||||||
|
}
|
||||||
|
if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL){
|
||||||
|
mUniversalPayloadPlatformBootManagerOverrideInstance->BeforeConsole();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register ENTER as CONTINUE key
|
// Register ENTER as CONTINUE key
|
||||||
|
@ -213,6 +226,10 @@ PlatformBootManagerAfterConsole (
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
||||||
|
|
||||||
|
if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL){
|
||||||
|
mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
||||||
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
||||||
|
|
||||||
|
@ -244,6 +261,9 @@ PlatformBootManagerWaitCallback (
|
||||||
UINT16 TimeoutRemain
|
UINT16 TimeoutRemain
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL){
|
||||||
|
mUniversalPayloadPlatformBootManagerOverrideInstance->WaitCallback (TimeoutRemain);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +280,9 @@ PlatformBootManagerUnableToBoot (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL){
|
||||||
|
mUniversalPayloadPlatformBootManagerOverrideInstance->UnableToBoot();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Include all platform action which can be customized by IBV/OEM.
|
# Include all platform action which can be customized by IBV/OEM.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2012 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
@ -57,6 +57,7 @@
|
||||||
gEfiBootLogoProtocolGuid ## CONSUMES
|
gEfiBootLogoProtocolGuid ## CONSUMES
|
||||||
gEfiDxeSmmReadyToLockProtocolGuid
|
gEfiDxeSmmReadyToLockProtocolGuid
|
||||||
gEfiSmmAccess2ProtocolGuid
|
gEfiSmmAccess2ProtocolGuid
|
||||||
|
gUniversalPayloadPlatformBootManagerOverrideProtocolGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Provides drivers and definitions to create uefi payload for bootloaders.
|
# Provides drivers and definitions to create uefi payload for bootloaders.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
@ -43,6 +43,8 @@
|
||||||
#
|
#
|
||||||
gPlatformGOPPolicyGuid = { 0xec2e931b, 0x3281, 0x48a5, { 0x81, 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } }
|
gPlatformGOPPolicyGuid = { 0xec2e931b, 0x3281, 0x48a5, { 0x81, 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } }
|
||||||
|
|
||||||
|
gUniversalPayloadPlatformBootManagerOverrideProtocolGuid = { 0xdb3fc2df, 0x7376, 0x4a8d, { 0x82, 0xab, 0x91, 0x54, 0xa1, 0x36, 0xa6, 0x5a } }
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# PCD Declarations section - list of all PCDs Declared by this Package
|
# PCD Declarations section - list of all PCDs Declared by this Package
|
||||||
|
|
Loading…
Reference in New Issue