From nobody Thu Oct 31 00:25:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105108+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1684747751573662.3538036053127; Mon, 22 May 2023 02:29:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UqWlYY1788612xfKWhAqL9Uc; Mon, 22 May 2023 02:29:11 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.48]) by mx.groups.io with SMTP id smtpd.web10.18044.1684747750271711970 for ; Mon, 22 May 2023 02:29:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSS5qo+hh/Sq6y7lzpRmZZcQd6qelyx//GQ9fHK5gfu4Ak8W2kixmmEqFF3Dt2IoO8GffBl9Rc9jha5LVGX54ruriJgP58f1c5574wHgmDcD2I38meHNzj08qtSZED5dyfwQ1aJowdmhSpp3D0By0EgKfURQoIJKkrdjRASYAamq1e+s4Kn5jRbXb6zFUJuf0WT4+FTWCLSUYYvc1PgYQOR+IE2v7x/AzOEikouVNG8cxwdc1SXEebnNZ9qoTRkLrYNhaeRLgUa5CzYu2lJFvFaTS1+g2vuI9yHKCduvGIOj+04TBMCRnABpm2gA0wi0D0ilsthLwHEIv0MFksdI/w== 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=N8bkulNT+lZOIgXodAioVfdNNW0ek6R2pMd8qAaX+PQ=; b=GWBOmxX97oXiu4ZMrhbPXph9wD/FXmMnHpIe3ABLggrRnUFVp12GQcxzJxQjwEFi1U5vMUA9ZsBiLMVY42YQ94EAxY2yeGDnVK86BDxp7MTybPE4+BDsWym1/Y3Wp1mZMWDQjaHOidWynJ0Z1QTzSFf1KoF6uorsnhFjAgOltQhEAzaCQV5hnB/eDA12bwTKCYcsOiEjWQnLI8Tbi5Zf3bRnydJJXiehqG3nsjW/EEAYt9mxkOheJIeXNgDz3ettzv8CvVcDgdI5JbJXw08ecSjIZTSinUecZCJE3nfyOBvcrkq1JfhPJ/JMK3DakRVAdcbZbF2VmzsPuO2ojWtITw== 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 X-Received: from MW4PR03CA0051.namprd03.prod.outlook.com (2603:10b6:303:8e::26) by CH2PR12MB4905.namprd12.prod.outlook.com (2603:10b6:610:64::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Mon, 22 May 2023 09:29:07 +0000 X-Received: from CO1NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::8d) by MW4PR03CA0051.outlook.office365.com (2603:10b6:303:8e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28 via Frontend Transport; Mon, 22 May 2023 09:29:07 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105108+1787277+3901457@groups.io; helo=mail02.groups.io; 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 X-Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT088.mail.protection.outlook.com (10.13.175.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.28 via Frontend Transport; Mon, 22 May 2023 09:29:06 +0000 X-Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Mon, 22 May 2023 04:29:04 -0500 X-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; Mon, 22 May 2023 04:29:03 -0500 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Abner Chang Subject: [edk2-devel] [PATCH v2 2/2] AMD/AmdMinBoardkPkg: Implements PeiReportFvLib Library Date: Mon, 22 May 2023 14:58:51 +0530 Message-ID: <19efba7e1a2883cbc9607c81d018d08c2ea734a8.1684747555.git.abdattar@amd.com> In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT088:EE_|CH2PR12MB4905:EE_ X-MS-Office365-Filtering-Correlation-Id: e4f28d77-3f42-480a-524d-08db5aa6fdc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: T1nd6ZFDeeR37i3nTFh4pO7bytg1zFWD/X/iS+N83QVzbWUxqd5Ngn1fpJpK3gXLALZlWl2rBeg45N/mMdpKzlok0pMQXCNS7DshI1FuqXc1oqGZHgSiNFrymZteOEFf0RMZXHOniy6KW5wWKUSC/lSXe/SNNd9yCGdN67H8dvj+JgdSTq9mi1ipzWNm1ScZvtz1q4GDIaZKWHyY8r9VMGzCWKaeFNrQMvt/XwSnt31sZP9tjkz/tmRwzzzTGTTnNiLsVSbSMyjDhz7HxlaqdbbVeyJ5Y4OoxtuxMJ/UUrOmtKJJhbSnWVo2yoL8cqXjALpvptM5VemNrHk64Zf8b93fv+XxFbkcSgielEe49+V4WFbTf+WkkGvwlcuhY//YLPDmzisCgwbroLXhVjt/5+HEq//1RLv4Fe0Ex81ByFhW8Vo/+yGHBpK3nN77MDPJQnglkdrH4oBJxVvwk6CY2TNtv0/Nak0pck8NPOYsDssFhiOtUaU9XZECIpiktWfIW0Xf/yhDRcvpoUOyf3+3SYtRNjTweOTOnnTYtZqmScHJW1ipiBt1JWFdIm5ee9Fp8rekukpn/kHJzqxcoXKdcB8Z6Jk7dBOINlj8IEjcr7cv1wNcqrISrT18pc5ng7gkEdNXfXkk1AY9eLmuk5yXgka/tNgJmLTy8DZ2btbd369iHSmhq57U/40a4o9ewKjVhaweCVyclauQ0H55ZYkBCPBkeFFQ27qQrZfGQZyM1pk1IIPurRwjffaIbVGpyRo6yfh73tdkgi0Cm4ZotUlPgA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2023 09:29:06.9961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4f28d77-3f42-480a-524d-08db5aa6fdc0 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: CO1NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4905 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abdattar@amd.com X-Gm-Message-State: WPpIKatk5CFR1H7i5AYHKqWUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684747751; bh=vRxHAglEJASFowNewqSbGzaybdso9KD4FbjkofMB3eg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nr7WnpaiIAbzn0sMvESpm8UzouP6yx0Zn+ncCvoSVjd85zjZZYK7eqZ3LJKxPm8Ko55 aRfMWnmhHDoSzlgIpOmWVwwETkLzBEDulU9Q1qjbDt20PfzezFMiQ70SF4coC1wZ+14e3 TtT70surtjL+G4y2DCKhk4ADhLfUv61xFJQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684747753754100011 Content-Type: text/plain; charset="utf-8" Customize PeiReportFvLib library for AMD platforms by adding below changes. Installs Advanced Security FV. Adds facility to install FV above 4GB address space. Cc: Abner Chang Signed-off-by: Abdul Lateef Attar Reviewed-by: Abner Chang --- .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec | 8 + .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc | 2 + .../Library/PeiReportFvLib/PeiReportFvLib.inf | 57 +++++ .../Library/PeiReportFvLib/PeiReportFvLib.c | 239 ++++++++++++++++++ 4 files changed, 306 insertions(+) create mode 100644 Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiR= eportFvLib.inf create mode 100644 Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiR= eportFvLib.c diff --git a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec b/Platform/AMD/= AmdMinBoardPkg/AmdMinBoardPkg.dec index 65ba08545021..03d1d77c34eb 100644 --- a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec +++ b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec @@ -33,3 +33,11 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, P= cdsDynamicEx] # PreFetch Memory padding in bytes, default 2MB gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadPMem|0x00200000|UI= NT32|0x10000001 =20 + # PCDs to support loading of FV above 4GB address space + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedBase |0x00= 00000000000000|UINT64|0x10000004 + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvOsBootBase |0x00= 00000000000000|UINT64|0x10000005 + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvUefiBootBase |0x00= 00000000000000|UINT64|0x10000006 + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedSecurityBase |0x00= 00000000000000|UINT64|0x10000007 + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedSecuritySize |0x00= 000000|UINT32|0x10000008 + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedSecurityOffset |0x00= 000000|UINT32|0x10000009 + diff --git a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc b/Platform/AMD/= AmdMinBoardPkg/AmdMinBoardPkg.dsc index 1a8407250c56..be33089a45ef 100644 --- a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc +++ b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc @@ -24,6 +24,7 @@ [Packages] =20 [LibraryClasses] SpcrDeviceLib|AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf + ReportFvLib|AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf =20 [LibraryClasses.common] BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -43,6 +44,7 @@ [Components] =20 [Components.IA32] AmdMinBoardPkg/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf + AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf =20 [Components.X64] AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf diff --git a/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFv= Lib.inf b/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib= .inf new file mode 100644 index 000000000000..23ee503c42be --- /dev/null +++ b/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf @@ -0,0 +1,57 @@ +### @file +# Component information file for the Report Firmware Volume (FV) library. +# +# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D PeiReportFvLib + FILE_GUID =3D 3C207C28-DC43-4A3A-B572-6794C77AB519 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D PEIM + LIBRARY_CLASS =3D ReportFvLib + +[LibraryClasses] + BaseMemoryLib + DebugLib + HobLib + PeiServicesLib + +[Packages] + AmdMinBoardPkg/AmdMinBoardPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + +[Sources] + PeiReportFvLib.c + +[Pcd] + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedBase ## CONSU= MES + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedSecurityBase ## CONSU= MES + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvAdvancedSecuritySize ## CONSU= MES + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvOsBootBase ## CONSU= MES + gAmdMinBoardPkgTokenSpaceGuid.PcdAmdFlashFvUefiBootBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdBootStage ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSU= MES + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSU= MES diff --git a/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFv= Lib.c b/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c new file mode 100644 index 000000000000..f0b2abef611b --- /dev/null +++ b/Platform/AMD/AmdMinBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c @@ -0,0 +1,239 @@ +/** @file + Source code file for Report Firmware Volume (FV) library for AMD platfor= ms. + + @par Note: + This source has the reference of MinPlatformPkgs's PeriReportFvLib.c m= odule. + + Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +VOID +ReportPreMemFv ( + VOID + ) +{ + /// + /// Note : FSP FVs except FSP-T FV are installed in IntelFsp2WrapperPkg = in Dispatch mode. + /// + if (PcdGetBool (PcdFspWrapperBootMode)) { + DEBUG ((DEBUG_INFO, "Install FlashFvFspT - 0x%x, 0x%x\n", PcdGet32 (Pc= dFlashFvFspTBase), PcdGet32 (PcdFlashFvFspTSize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFlashFvFspTBase= ))->FileSystemGuid), + (VOID *)(UINTN)PcdGet32 (PcdFlashFvFspTBase), + PcdGet32 (PcdFlashFvFspTSize), + NULL, + NULL, + 0 + ); + } + + DEBUG ((DEBUG_INFO, "Install FlashFvSecurity - 0x%x, 0x%x\n", PcdGet32 (= PcdFlashFvSecurityBase), PcdGet32 (PcdFlashFvSecuritySize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFlashFvSecurityBa= se))->FileSystemGuid), + (VOID *)(UINTN)PcdGet32 (PcdFlashFvSecurityBase), + PcdGet32 (PcdFlashFvSecuritySize), + NULL, + NULL, + 0 + ); + if (PcdGet8 (PcdBootStage) >=3D 6) { + DEBUG (( + DEBUG_INFO, + "Install FlashFvAdvancedPreMemory - 0x%x, 0x%x\n", + PcdGet32 (PcdFlashFvAdvancedPreMemoryBase), + PcdGet32 (PcdFlashFvAdvancedPreMemorySize) + )); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFlashFvAdvanced= PreMemoryBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet32 (PcdFlashFvAdvancedPreMemoryBase), + PcdGet32 (PcdFlashFvAdvancedPreMemorySize), + NULL, + NULL, + 0 + ); + } +} + +VOID +ReportPostMemFv ( + VOID + ) +{ + EFI_STATUS Status; + EFI_BOOT_MODE BootMode; + EFI_HOB_FIRMWARE_VOLUME3 *Hob3; + EFI_HOB_FIRMWARE_VOLUME *Hob; + + Status =3D PeiServicesGetBootMode (&BootMode); + ASSERT_EFI_ERROR (Status); + + /// + /// Note : FSP FVs except FSP-T FV are installed in IntelFsp2WrapperPkg = in Dispatch mode. + /// + + /// + /// Build HOB for DXE + /// + if (BootMode =3D=3D BOOT_IN_RECOVERY_MODE) { + /// + /// Prepare the recovery service + /// + } else { + DEBUG ((DEBUG_INFO, "Install FlashFvPostMemory - 0x%x, 0x%x\n", PcdGet= 32 (PcdFlashFvPostMemoryBase), PcdGet32 (PcdFlashFvPostMemorySize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFlashFvPostMemo= ryBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet32 (PcdFlashFvPostMemoryBase), + PcdGet32 (PcdFlashFvPostMemorySize), + NULL, + NULL, + 0 + ); + + if (PcdGet64 (PcdAmdFlashFvUefiBootBase) >=3D BASE_4GB) { + Hob =3D NULL; + Hob3 =3D NULL; + DEBUG ((DEBUG_INFO, "Found FvUefiBoot FV above 4GB, creating FV HOBs= .\n")); + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FI= RMWARE_VOLUME), (VOID **)&Hob); + if (!EFI_ERROR (Status)) { + Hob->BaseAddress =3D PcdGet64 (PcdAmdFlashFvUefiBootBase); + Hob->Length =3D PcdGet32 (PcdFlashFvUefiBootSize); + } + + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_F= IRMWARE_VOLUME3), (VOID **)&Hob3); + if (!EFI_ERROR (Status)) { + Hob3->BaseAddress =3D PcdGet64 (PcdAmdFlashFvUefiBootBase= ); + Hob3->Length =3D PcdGet32 (PcdFlashFvUefiBootSize); + Hob3->AuthenticationStatus =3D 0; + Hob3->ExtractedFv =3D FALSE; + } + } else { + DEBUG ((DEBUG_INFO, "Install FlashFvUefiBoot - 0x%lx, 0x%x\n", PcdGe= t64 (PcdAmdFlashFvUefiBootBase), PcdGet32 (PcdFlashFvUefiBootSize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet64 (PcdAmdFlashFvUef= iBootBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet64 (PcdAmdFlashFvUefiBootBase), + PcdGet32 (PcdFlashFvUefiBootSize), + NULL, + NULL, + 0 + ); + } + + if (PcdGet64 (PcdAmdFlashFvOsBootBase) >=3D BASE_4GB) { + Hob =3D NULL; + Hob3 =3D NULL; + DEBUG ((DEBUG_INFO, "Found FvOsBoot FV above 4GB, creating FV HOBs.\= n")); + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FI= RMWARE_VOLUME), (VOID **)&Hob); + if (!EFI_ERROR (Status)) { + Hob->BaseAddress =3D PcdGet64 (PcdAmdFlashFvOsBootBase); + Hob->Length =3D PcdGet32 (PcdFlashFvOsBootSize); + } + + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_F= IRMWARE_VOLUME3), (VOID **)&Hob3); + if (!EFI_ERROR (Status)) { + Hob3->BaseAddress =3D PcdGet64 (PcdAmdFlashFvOsBootBase); + Hob3->Length =3D PcdGet32 (PcdFlashFvOsBootSize); + Hob3->AuthenticationStatus =3D 0; + Hob3->ExtractedFv =3D FALSE; + } + } else { + DEBUG ((DEBUG_INFO, "Install FlashFvOsBoot - 0x%lx, 0x%x\n", PcdGet6= 4 (PcdAmdFlashFvOsBootBase), PcdGet32 (PcdFlashFvOsBootSize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet64 (PcdAmdFlashFvOsB= ootBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet64 (PcdAmdFlashFvOsBootBase), + PcdGet32 (PcdFlashFvOsBootSize), + NULL, + NULL, + 0 + ); + } + + if (PcdGet8 (PcdBootStage) >=3D 6) { + if (PcdGet64 (PcdAmdFlashFvAdvancedBase) >=3D BASE_4GB) { + Hob =3D NULL; + Hob3 =3D NULL; + DEBUG ((DEBUG_INFO, "Found FvAdvanced FV above 4GB, creating FV HO= Bs.\n")); + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_= FIRMWARE_VOLUME), (VOID **)&Hob); + if (!EFI_ERROR (Status)) { + Hob->BaseAddress =3D PcdGet64 (PcdAmdFlashFvAdvancedBase); + Hob->Length =3D PcdGet32 (PcdFlashFvAdvancedSize); + } + + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB= _FIRMWARE_VOLUME3), (VOID **)&Hob3); + if (!EFI_ERROR (Status)) { + Hob3->BaseAddress =3D PcdGet64 (PcdAmdFlashFvAdvancedBa= se); + Hob3->Length =3D PcdGet32 (PcdFlashFvAdvancedSize); + Hob3->AuthenticationStatus =3D 0; + Hob3->ExtractedFv =3D FALSE; + } + } else { + DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%lx, 0x%x\n", Pcd= Get64 (PcdAmdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet64 (PcdAmdFlashFvA= dvancedBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet64 (PcdAmdFlashFvAdvancedBase), + PcdGet32 (PcdFlashFvAdvancedSize), + NULL, + NULL, + 0 + ); + } + } + } + + if (PcdGet64 (PcdAmdFlashFvAdvancedSecurityBase) >=3D BASE_4GB) { + Hob =3D NULL; + Hob3 =3D NULL; + DEBUG ((DEBUG_INFO, "Found FvAdvancedSecurity FV above 4GB, creating F= V HOBs.\n")); + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRM= WARE_VOLUME), (VOID **)&Hob); + if (!EFI_ERROR (Status)) { + Hob->BaseAddress =3D PcdGet64 (PcdAmdFlashFvAdvancedSecurityBase); + Hob->Length =3D PcdGet32 (PcdAmdFlashFvAdvancedSecuritySize); + } + + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_FIR= MWARE_VOLUME3), (VOID **)&Hob3); + if (!EFI_ERROR (Status)) { + Hob3->BaseAddress =3D PcdGet64 (PcdAmdFlashFvAdvancedSecuri= tyBase); + Hob3->Length =3D PcdGet32 (PcdAmdFlashFvAdvancedSecuri= tySize); + Hob3->AuthenticationStatus =3D 0; + Hob3->ExtractedFv =3D FALSE; + } + } else { + DEBUG ((DEBUG_INFO, "Install FvAdvancedSecurity - 0x%lx, 0x%x\n", PcdG= et64 (PcdAmdFlashFvAdvancedSecurityBase), PcdGet32 (PcdAmdFlashFvAdvancedSe= curitySize))); + PeiServicesInstallFvInfo2Ppi ( + &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet64 (PcdAmdFlashFvAdvan= cedSecurityBase))->FileSystemGuid), + (VOID *)(UINTN)PcdGet64 (PcdAmdFlashFvAdvancedSecurityBase), + PcdGet32 (PcdAmdFlashFvAdvancedSecuritySize), + NULL, + NULL, + 0 + ); + } + + // + // Report resource HOB for flash FV + // + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + (EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE), + (UINTN)PcdGet32 (PcdFlashAreaBaseAddress), + (UINTN)PcdGet32 (PcdFlashAreaSize) + ); + BuildMemoryAllocationHob ( + (UINTN)PcdGet32 (PcdFlashAreaBaseAddress), + (UINTN)PcdGet32 (PcdFlashAreaSize), + EfiMemoryMappedIO + ); +} --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105108): https://edk2.groups.io/g/devel/message/105108 Mute This Topic: https://groups.io/mt/99061261/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-