[edk2-devel] [PATCH] UefiPayloadPkg: Get platform specific logic from protocol for BDS driver
Guo Dong
guo.dong at intel.com
Wed Jun 2 05:07:18 UTC 2021
It would be better if having function comments in the PlatformBootManagerOverride.h.
Reviewed-by: Guo Dong <guo.dong at intel.com>
> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu at intel.com>
> Sent: Wednesday, May 26, 2021 1:53 AM
> To: devel at edk2.groups.io
> Cc: Ma, Maurice <maurice.ma at intel.com>; Dong, Guo
> <guo.dong at intel.com>; You, Benjamin <benjamin.you at intel.com>
> Subject: [PATCH] UefiPayloadPkg: Get platform specific logic from protocol
> for BDS driver
>
> Currently, BDS driver will link a PlatformBootManagerLib, which contains
> platform
> sepcific 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 at intel.com>
> Cc: Guo Dong <guo.dong at intel.com>
> Cc: Benjamin You <benjamin.you at intel.com>
>
> Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
> ---
> UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h |
> 44 ++++++++++++++++++++++++++++++++++++++++++++
> UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> | 25 ++++++++++++++++++++++++-
>
> UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.i
> nf | 3 ++-
> UefiPayloadPkg/UefiPayloadPkg.dec | 4 +++-
> 4 files changed, 73 insertions(+), 3 deletions(-)
>
> diff --git
> a/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
> b/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
> new file mode 100644
> index 0000000000..0641cc4218
> --- /dev/null
> +++ b/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
> @@ -0,0 +1,44 @@
> +/** @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__
>
> +
>
> +typedef
>
> +VOID
>
> +(EFIAPI *PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE)
> (
>
> + VOID
>
> + );
>
> +
>
> +typedef
>
> +VOID
>
> +(EFIAPI *PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE)
> (
>
> + VOID
>
> + );
>
> +
>
> +typedef
>
> +VOID
>
> +(EFIAPI *PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK)
> (
>
> + UINT16 TimeoutRemain
>
> + );
>
> +
>
> +typedef
>
> +VOID
>
> +(EFIAPI
> *PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT) (
>
> + VOID
>
> + );
>
> +
>
> +typedef struct {
>
> + PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE
> BeforeConsole;
>
> + PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE
> AfterConsole;
>
> + PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK
> WaitCallback;
>
> + PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT
> UnableToBoot;
>
> +} PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL;
>
> +
>
> +extern GUID gPldPlatformBootManagerOverrideProtocolGuid;
>
> +
>
> +#endif
>
> diff --git
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> index 7fa3a048b7..525977c15e 100644
> ---
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> +++
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> @@ -2,13 +2,16 @@
> This file include all platform action which can be customized
>
> 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
>
>
>
> **/
>
>
>
> #include "PlatformBootManager.h"
>
> #include "PlatformConsole.h"
>
> +#include <Protocol/PlatformBootManagerOverride.h>
>
> +
>
> +PLD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL
> *mPldPlatformBootManagerOverrideInstance = NULL;
>
>
>
> VOID
>
> InstallReadyToLock (
>
> @@ -156,6 +159,16 @@ PlatformBootManagerBeforeConsole (
> EFI_INPUT_KEY F2;
>
> EFI_INPUT_KEY Down;
>
> EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
>
> + EFI_STATUS Status;
>
> +
>
> + Status = gBS->LocateProtocol
> (&gPldPlatformBootManagerOverrideProtocolGuid, NULL, (VOID **)
> &mPldPlatformBootManagerOverrideInstance);
>
> + if (EFI_ERROR (Status)) {
>
> + mPldPlatformBootManagerOverrideInstance = NULL;
>
> + }
>
> + if (mPldPlatformBootManagerOverrideInstance != NULL){
>
> + mPldPlatformBootManagerOverrideInstance->BeforeConsole();
>
> + return;
>
> + }
>
>
>
> //
>
> // Register ENTER as CONTINUE key
>
> @@ -213,6 +226,10 @@ PlatformBootManagerAfterConsole (
> EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
>
> EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
>
>
>
> + if (mPldPlatformBootManagerOverrideInstance != NULL){
>
> + mPldPlatformBootManagerOverrideInstance->AfterConsole();
>
> + return;
>
> + }
>
> Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
>
> White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
>
>
>
> @@ -244,6 +261,9 @@ PlatformBootManagerWaitCallback (
> UINT16 TimeoutRemain
>
> )
>
> {
>
> + if (mPldPlatformBootManagerOverrideInstance != NULL){
>
> + mPldPlatformBootManagerOverrideInstance->WaitCallback
> (TimeoutRemain);
>
> + }
>
> return;
>
> }
>
>
>
> @@ -260,6 +280,9 @@ PlatformBootManagerUnableToBoot (
> VOID
>
> )
>
> {
>
> + if (mPldPlatformBootManagerOverrideInstance != NULL){
>
> + mPldPlatformBootManagerOverrideInstance->UnableToBoot();
>
> + }
>
> return;
>
> }
>
>
>
> diff --git
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi
> b.inf
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi
> b.inf
> index 1f5a0bcad0..14997c1183 100644
> ---
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi
> b.inf
> +++
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi
> b.inf
> @@ -1,7 +1,7 @@
> ## @file
>
> # 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
>
> #
>
> ##
>
> @@ -57,6 +57,7 @@
> gEfiBootLogoProtocolGuid ## CONSUMES
>
> gEfiDxeSmmReadyToLockProtocolGuid
>
> gEfiSmmAccess2ProtocolGuid
>
> + gPldPlatformBootManagerOverrideProtocolGuid
>
>
>
> [Pcd]
>
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec
> b/UefiPayloadPkg/UefiPayloadPkg.dec
> index 99cb3311a6..d9c5775e76 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dec
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dec
> @@ -3,7 +3,7 @@
> #
>
> # 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
>
> #
>
> ##
>
> @@ -43,6 +43,8 @@
> #
>
> gPlatformGOPPolicyGuid = { 0xec2e931b, 0x3281, 0x48a5, { 0x81,
> 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } }
>
>
>
> + gPldPlatformBootManagerOverrideProtocolGuid = { 0xdb3fc2df, 0x7376,
> 0x4a8d, { 0x82, 0xab, 0x91, 0x54, 0xa1, 0x36, 0xa6, 0x5a } }
>
> +
>
>
> ##########################################################
> ######################
>
> #
>
> # PCD Declarations section - list of all PCDs Declared by this Package
>
> --
> 2.30.0.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75938): https://edk2.groups.io/g/devel/message/75938
Mute This Topic: https://groups.io/mt/83096149/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list