From: Abdul Lateef Attar <abdullateef.at...@amd.com>

defines two PCDs, PcdShellFile and PcdShellFileDesc,
which holds the GUID and description of the UEFI shell file to be loaded.

A PCDs based solution gives flexibility to the user to load different
images, by just overriding the DSC file.

The user can load a diagnostic image or test image during
PCDBootToShellOnly or later stages.

Cc: Oram Isaac W <isaac.w.o...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Signed-off-by: Abdul Lateef Attar <abdullateef.at...@amd.com>
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  5 ++++
 .../BoardBdsHookLib/BoardBdsHookLib.inf       |  3 ++
 .../Library/BoardBdsHookLib/BoardBootOption.c | 29 +++++++++----------
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 2953e9527224..e6f714b1816f 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -7,6 +7,7 @@
 # for the build infrastructure.

 #

 # Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>

+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>

 #

 # SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -266,6 +267,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize|0x00000000|UINT32|0x2000002B

   
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUOffset|0x00000000|UINT32|0x2000002C

 

+  # GUID of Shell file to be loaded, default value is gUefiShellFileGuid 
define in ShellPkg.dec

+  gMinPlatformPkgTokenSpaceGuid.PcdShellFile|{GUID({0x7c04a583, 0x9e3e, 
0x4f1c, {0xad, 0x65, 0xe0, 0x52, 0x68, 0xd0, 0xb4, 0xd1}})}|VOID*|0x20000230

+  gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc|L"Internal UEFI Shell 
2.0"|VOID*|0x20000231

+

 [PcdsDynamic, PcdsDynamicEx]

   gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x90000019

   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|0x00|UINT8|0x0001004B

diff --git 
a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf 
b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
index 69f3fcb55222..7a1dbe62eafd 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
@@ -2,6 +2,7 @@
 # Module Information file for the Bds Hook Library.

 #

 # Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>

+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>

 #

 # SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -59,6 +60,8 @@ [Pcd]
   gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleInputDevicePath    ## CONSUMES

   gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleOutputDevicePath   ## CONSUMES

   gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath         ## CONSUMES

+  gMinPlatformPkgTokenSpaceGuid.PcdShellFile                        ## CONSUMES

+  gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc                    ## CONSUMES

 

 [Sources]

   BoardBdsHook.h

diff --git 
a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c 
b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
index dec3ce93ef71..05b9fa7ac682 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
@@ -2,12 +2,23 @@
   Driver for Platform Boot Options support.

 

 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>

+Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>

+

 SPDX-License-Identifier: BSD-2-Clause-Patent

 

 **/

 

 #include "BoardBdsHook.h"

 

+EFI_GUID gUefiShellFileGuid = {0};

+#define UEFI_HARD_DRIVE_NAME          L"UEFI Hard Drive"

+EFI_GUID mUiFile = {

+  0x462CAA21, 0x7614, 0x4503, { 0x83, 0x6E, 0x8A, 0xB6, 0xF4, 0x66, 0x23, 0x31 
}

+};

+EFI_GUID mBootMenuFile = {

+  0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, 0x1D 
}

+};

+

 BOOLEAN    mContinueBoot  = FALSE;

 BOOLEAN    mBootMenuBoot  = FALSE;

 BOOLEAN    mPxeBoot       = FALSE;

@@ -186,14 +197,6 @@ CreateFvBootOption (
   return Status;

 }

 

-EFI_GUID mUiFile = {

-  0x462CAA21, 0x7614, 0x4503, { 0x83, 0x6E, 0x8A, 0xB6, 0xF4, 0x66, 0x23, 0x31 
}

-};

-EFI_GUID mBootMenuFile = {

-  0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, 0x1D 
}

-};

-

-

 /**

   Return the index of the load option in the load option array.

 

@@ -333,11 +336,6 @@ PlatformBootManagerWaitCallback (
 }

 

 

-EFI_GUID gUefiShellFileGuid = { 0x7C04A583, 0x9E3E, 0x4f1c, { 0xAD, 0x65, 
0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 } };

-

-#define INTERNAL_UEFI_SHELL_NAME      L"Internal UEFI Shell 2.0"

-#define UEFI_HARD_DRIVE_NAME          L"UEFI Hard Drive"

-

 /**

    Registers default boot option

 **/

@@ -352,7 +350,8 @@ RegisterDefaultBootOption (
 

     ShellData = NULL;

     ShellDataSize = 0;

-    RegisterFvBootOption (&gUefiShellFileGuid,      INTERNAL_UEFI_SHELL_NAME, 
(UINTN) -1, LOAD_OPTION_ACTIVE, (UINT8 *)ShellData, ShellDataSize);

+    CopyMem (&gUefiShellFileGuid, PcdGetPtr (PcdShellFile), sizeof (GUID));

+    RegisterFvBootOption (&gUefiShellFileGuid, (CHAR16 *) PcdGetPtr 
(PcdShellFileDesc), (UINTN) -1, LOAD_OPTION_ACTIVE, (UINT8 *)ShellData, 
ShellDataSize);

 

   //

   // Boot Menu

@@ -557,7 +556,7 @@ BootOptionPriority (
       return 6;

 

     }

-    if (StrCmp (BootOption->Description, INTERNAL_UEFI_SHELL_NAME) == 0) {

+    if (StrCmp (BootOption->Description, (CHAR16 *) PcdGetPtr 
(PcdShellFileDesc)) == 0) {

       if (PcdGetBool (PcdBootToShellOnly)) {

         return 0;

       }

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98803): https://edk2.groups.io/g/devel/message/98803
Mute This Topic: https://groups.io/mt/96353002/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to