From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.52]) by mx.groups.io with SMTP id smtpd.web11.14558.1674047066297166486 for ; Wed, 18 Jan 2023 05:04:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=3Ra6pgRE; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.101.52, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RrODy5OuD18yzRSlE2JODusvEjZv+zuGwrEjiXadm2xt+8TIEiP02LpFvkVADKChO15Eahx7IAtBDcf8Mt3U1dQUVJw07AsmYvCNVr7TdxN/IJf8zRGSkiwGLUrZkon6LVomk/G43jzg9+Irio3iBe3OhpjirRjZIMjQZvejcuZ6Cjc+Rp7OHkLBCyh8fobsoMPV78uVNcTwWHP4NEb6aZCTgT2vf9E9z2XZRhp5Fx0KrbpmZCRi5B6+ZQSSAR4CDGp33EX83zo/FoSUvM+c+3RDmdrVeCEkatCwgyQsBDbSlBAJg8M7E1HEGSR2CoKVowHNuFx4gckNxG2TTn4Y0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eqbDMwx+XodBq7HdoGxwemG7/rIhwFMaulUqMHIAb9c=; b=HPpYiYRj011AuBUCNLaS0bnfDGUOz9nFh2Ik2npcQPmF33DoTchZH6yMCdAZRA9hL/02ACXYqqZJxbZEcuMHnoxnf+ZK7Nh7GZaeUa67GBGUPqVejyQxNAyi1ZpHwKOBy7+pK1IgTJmwsBO2TGFcoWaEWOE9QW2YhawfBSET1ZvBN6vZEigppNnbA3IckA7ykQwvSiPsfwhbO82Cszn3hit0zlJUxCVdgG7VRJGxmy5EBGe9peOuyEiPo3Yas52T8m2XtlxWrLfEdBBI91ceqJD5zvucpPTasQLf85prtdk1Zjz/yB5cnberqQYwa8UHq/Dq5BTzJyNse76wfbTnjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eqbDMwx+XodBq7HdoGxwemG7/rIhwFMaulUqMHIAb9c=; b=3Ra6pgREKJi6eji5Nv45evVVgC9eoIRzQ1e9X9YR6LC5mHhuFoa0Dv+4xoCXRmvQKlXD30U6y7y7Y/2fHqmA67szR8/K5LzU0oUSWEc9ZPSOWKN0jEJqgWBgTvxQvMS6th55E1f3esvyOsJ/VvzPmUrFJkFQ0suaVJaS/r45xpo= Received: from DM6PR12CA0022.namprd12.prod.outlook.com (2603:10b6:5:1c0::35) by BN9PR12MB5226.namprd12.prod.outlook.com (2603:10b6:408:11f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Wed, 18 Jan 2023 13:04:23 +0000 Received: from DM6NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::40) by DM6PR12CA0022.outlook.office365.com (2603:10b6:5:1c0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.19 via Frontend Transport; Wed, 18 Jan 2023 13:04:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT113.mail.protection.outlook.com (10.13.173.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.24 via Frontend Transport; Wed, 18 Jan 2023 13:04:23 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 18 Jan 2023 07:04:22 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 18 Jan 2023 05:04:22 -0800 Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 18 Jan 2023 07:04:20 -0600 From: "Abdul Lateef Attar" To: CC: Abdul Lateef Attar , Oram Isaac W , Eric Dong , Liming Gao Subject: [PATCH v3 2/2] BoardModulePkg: Adds PCD to load UEFI Shell image Date: Wed, 18 Jan 2023 18:34:13 +0530 Message-ID: <8b3714f5b58493ad5d09cd156fa1b8dce2da0c0a.1674047008.git.abdattar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Return-Path: AbdulLateef.Attar@amd.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT113:EE_|BN9PR12MB5226:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bfb9948-ca67-4611-296f-08daf954850d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aY2G2RNej+/rAUml3gxkrlRURtRXX/yCKKnIr2ZzZ6z4WPE8Ur49XTW6Ji19WzazcdY3YG6eeiwVmXBR8rkIo69kHr30TKL7iyh7i249mNKmBj3qldbJ0tEDWGUMRnWNwJdcw8Qr+uUFDMfWde+cVbPBTbkb9Rsh8mITre5tydpaix1lpEtgdj1zP3MYZDWzpC7Qp7L/Xwpzes41R0T+rrIOe1acYVpvDkAFFXBuYJSS2xzRC9+it6NmK57DBwJHXd8r2hVYzPdskZ3bP+JKtynPH+b924oIgx3ciH5i6Ut1UEcUP0IuhKwDn7D7+tSyWaKOid20GbxJczBOLr7ZeVlh2qIFEkBXagghMku/dXpYLw49BmY/EB0KQUqSbuUiyntI5qu6IjtHqcQgTxoXnth+ptiti4wWn/MOkdSFipxNZcEDVjgVTvHTzZKDkPLRPeiM4x3Gbu+yce5x67XW1+e9SFgZ4FVMN21AuoE7FsGSnpwKBlZC+nlixcKN35oF9VynSdGsSV6WPFBBvFhcjahGR9BzOz+oDVlKfnpSdEH4C575ptfF05u58SiVlwAG7kq0E5+0lpX4okPefbSEMeCutU6CPqHcjC2/lI2ajS+Yb3z62l0sOWd7/f9566Q5O5w1BkN1ljZ6uFph8GDO7NeXm8GUQN10288yh9KbnLbp/lUbbpH8Iz0k3UVN6l9gnSjOsc55T3UF1bdXdIp8pvVWV2T1zp0/enzV83Uxw0I= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(136003)(396003)(346002)(451199015)(40470700004)(46966006)(36840700001)(4326008)(70586007)(70206006)(2616005)(41300700001)(26005)(6916009)(47076005)(426003)(8676002)(186003)(36756003)(82310400005)(5660300002)(83380400001)(336012)(36860700001)(82740400003)(8936002)(7696005)(40480700001)(316002)(54906003)(81166007)(478600001)(356005)(2906002)(40460700003)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2023 13:04:23.0366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9bfb9948-ca67-4611-296f-08daf954850d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5226 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Abdul Lateef Attar 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 Cc: Eric Dong Cc: Liming Gao Signed-off-by: Abdul Lateef Attar --- .../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/In= tel/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.=0D #=0D # Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
=0D +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -266,6 +267,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize|0x00000000|UINT32|0x200= 0002B=0D gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUOffset|0x00000000|UINT32|0x2= 000002C=0D =0D + # GUID of Shell file to be loaded, default value is gUefiShellFileGuid d= efine in ShellPkg.dec=0D + gMinPlatformPkgTokenSpaceGuid.PcdShellFile|{GUID({0x7c04a583, 0x9e3e, 0x= 4f1c, {0xad, 0x65, 0xe0, 0x52, 0x68, 0xd0, 0xb4, 0xd1}})}|VOID*|0x20000230= =0D + gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc|L"Internal UEFI Shell 2.0= "|VOID*|0x20000231=0D +=0D [PcdsDynamic, PcdsDynamicEx]=0D gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x90000019=0D gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|= 0x00|UINT8|0x0001004B=0D diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBds= HookLib.inf b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBd= sHookLib.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.=0D #=0D # Copyright (c) 2019, Intel Corporation. All rights reserved.
=0D +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -59,6 +60,8 @@ [Pcd] gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleInputDevicePath ## CON= SUMES=0D gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleOutputDevicePath ## CON= SUMES=0D gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath ## CON= SUMES=0D + gMinPlatformPkgTokenSpaceGuid.PcdShellFile ## CON= SUMES=0D + gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc ## CON= SUMES=0D =0D [Sources]=0D BoardBdsHook.h=0D diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBoo= tOption.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBoot= Option.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.=0D =0D Copyright (c) 2019, Intel Corporation. All rights reserved.
=0D +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
=0D +=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D =0D #include "BoardBdsHook.h"=0D =0D +EFI_GUID gUefiShellFileGuid =3D {0};=0D +#define UEFI_HARD_DRIVE_NAME L"UEFI Hard Drive"=0D +EFI_GUID mUiFile =3D {=0D + 0x462CAA21, 0x7614, 0x4503, { 0x83, 0x6E, 0x8A, 0xB6, 0xF4, 0x66, 0x23, = 0x31 }=0D +};=0D +EFI_GUID mBootMenuFile =3D {=0D + 0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, = 0x1D }=0D +};=0D +=0D BOOLEAN mContinueBoot =3D FALSE;=0D BOOLEAN mBootMenuBoot =3D FALSE;=0D BOOLEAN mPxeBoot =3D FALSE;=0D @@ -186,14 +197,6 @@ CreateFvBootOption ( return Status;=0D }=0D =0D -EFI_GUID mUiFile =3D {=0D - 0x462CAA21, 0x7614, 0x4503, { 0x83, 0x6E, 0x8A, 0xB6, 0xF4, 0x66, 0x23, = 0x31 }=0D -};=0D -EFI_GUID mBootMenuFile =3D {=0D - 0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, = 0x1D }=0D -};=0D -=0D -=0D /**=0D Return the index of the load option in the load option array.=0D =0D @@ -333,11 +336,6 @@ PlatformBootManagerWaitCallback ( }=0D =0D =0D -EFI_GUID gUefiShellFileGuid =3D { 0x7C04A583, 0x9E3E, 0x4f1c, { 0xAD, 0x65= , 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 } };=0D -=0D -#define INTERNAL_UEFI_SHELL_NAME L"Internal UEFI Shell 2.0"=0D -#define UEFI_HARD_DRIVE_NAME L"UEFI Hard Drive"=0D -=0D /**=0D Registers default boot option=0D **/=0D @@ -352,7 +350,8 @@ RegisterDefaultBootOption ( =0D ShellData =3D NULL;=0D ShellDataSize =3D 0;=0D - RegisterFvBootOption (&gUefiShellFileGuid, INTERNAL_UEFI_SHELL_NA= ME, (UINTN) -1, LOAD_OPTION_ACTIVE, (UINT8 *)ShellData, ShellDataSize);=0D + CopyMem (&gUefiShellFileGuid, PcdGetPtr (PcdShellFile), sizeof (GUID))= ;=0D + RegisterFvBootOption (&gUefiShellFileGuid, (CHAR16 *) PcdGetPtr (PcdSh= ellFileDesc), (UINTN) -1, LOAD_OPTION_ACTIVE, (UINT8 *)ShellData, ShellData= Size);=0D =0D //=0D // Boot Menu=0D @@ -557,7 +556,7 @@ BootOptionPriority ( return 6;=0D =0D }=0D - if (StrCmp (BootOption->Description, INTERNAL_UEFI_SHELL_NAME) =3D=3D = 0) {=0D + if (StrCmp (BootOption->Description, (CHAR16 *) PcdGetPtr (PcdShellFil= eDesc)) =3D=3D 0) {=0D if (PcdGetBool (PcdBootToShellOnly)) {=0D return 0;=0D }=0D --=20 2.25.1