From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: hao.a.wu@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Wed, 12 Jun 2019 00:49:35 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2019 00:49:34 -0700 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 12 Jun 2019 00:49:33 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Jun 2019 00:49:33 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Jun 2019 00:49:33 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.185]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0439.000; Wed, 12 Jun 2019 15:49:31 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Xu, Wei6" CC: "Wang, Jian J" , "Zhang, Chao B" Subject: Re: [edk2-devel][Patch v2 6/7] MdeModulePkg/DxeIpl: Support Capsule On Disk. Thread-Topic: [edk2-devel][Patch v2 6/7] MdeModulePkg/DxeIpl: Support Capsule On Disk. Thread-Index: AQHVG7VVliO/+6P3jUGplCUwjs9fXKaWKkRQ Date: Wed, 12 Jun 2019 07:49:30 +0000 Message-ID: References: <20190605154203.11012-1-wei6.xu@intel.com> <20190605154203.11012-7-wei6.xu@intel.com> In-Reply-To: <20190605154203.11012-7-wei6.xu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Xu= , > Wei6 > Sent: Wednesday, June 05, 2019 11:42 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J; Wu, Hao A; Zhang, Chao B; Xu, Wei6 > Subject: [edk2-devel][Patch v2 6/7] MdeModulePkg/DxeIpl: Support Capsule > On Disk. >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1852 >=20 > If Capsule On Disk mode, call Capsule On Disk Load PPI to load > capsules. When it fails, still goes to Firmware Update boot path. > BDS will clear corresponding indicator and reboot later on. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Chao B Zhang > Signed-off-by: Wei6 Xu > --- > MdeModulePkg/Core/DxeIplPeim/DxeIpl.h | 3 ++- > MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 20 ++++++++++-------- > MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 37 > ++++++++++++++++++++++++++++++++- > 3 files changed, 49 insertions(+), 11 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h > b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h > index 063fefb414..90b5b5b211 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h > +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h > @@ -1,10 +1,10 @@ > /** @file > Master header file for DxeIpl PEIM. All source files in this module s= hould > include this file for common definitions. >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > #ifndef __PEI_DXEIPL_H__ > @@ -19,10 +19,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include > #include > #include > #include > #include > +#include > #include >=20 > #include > #include > #include > diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > index 62bb3f3077..ff036d8688 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > @@ -3,11 +3,11 @@ > # > # This module produces a special PPI named the DXE Initial Program Loa= d > (IPL) > # PPI to discover and dispatch the DXE Foundation and components that = are > # needed to run the DXE Foundation. > # > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. > +# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved. > # Copyright (c) 2017, AMD Incorporated. All rights reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > @@ -74,21 +74,23 @@ >=20 > [LibraryClasses.ARM, LibraryClasses.AARCH64] > ArmMmuLib >=20 > [Ppis] > - gEfiDxeIplPpiGuid ## PRODUCES > - gEfiPeiDecompressPpiGuid ## PRODUCES > - gEfiEndOfPeiSignalPpiGuid ## SOMETIMES_PRODUCES # Not produce= d > on S3 boot path > - gEfiPeiReadOnlyVariable2PpiGuid ## SOMETIMES_CONSUMES > - gEfiPeiLoadFilePpiGuid ## SOMETIMES_CONSUMES > - gEfiPeiS3Resume2PpiGuid ## SOMETIMES_CONSUMES # Consumed > on S3 boot path > - gEfiPeiRecoveryModulePpiGuid ## SOMETIMES_CONSUMES # > Consumed on recovery boot path > + gEfiDxeIplPpiGuid ## PRODUCES > + gEfiPeiDecompressPpiGuid ## PRODUCES > + gEfiEndOfPeiSignalPpiGuid ## SOMETIMES_PRODUCES # Not > produced on S3 boot path > + gEfiPeiReadOnlyVariable2PpiGuid ## SOMETIMES_CONSUMES > + gEfiPeiLoadFilePpiGuid ## SOMETIMES_CONSUMES > + gEfiPeiS3Resume2PpiGuid ## SOMETIMES_CONSUMES # > Consumed on S3 boot path > + gEfiPeiRecoveryModulePpiGuid ## SOMETIMES_CONSUMES # > Consumed on recovery boot path > ## SOMETIMES_CONSUMES > ## UNDEFINED # HOB > gEfiVectorHandoffInfoPpiGuid > - gEfiPeiMemoryDiscoveredPpiGuid ## SOMETIMES_CONSUMES > + gEfiPeiMemoryDiscoveredPpiGuid ## SOMETIMES_CONSUMES > + gEfiPeiBootInCapsuleOnDiskModePpiGuid ## SOMETIMES_CONSUMES > + gEdkiiPeiCapsuleOnDiskPpiGuid ## SOMETIMES_CONSUMES # > Consumed on firmware update boot path >=20 > [Guids] > ## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation" > ## SOMETIMES_PRODUCES ## HOB > gEfiMemoryTypeInformationGuid > diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c > b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c > index c6e5b83309..9dc2d4485f 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c > +++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c > @@ -1,11 +1,11 @@ > /** @file > Last PEIM. > Responsibility of this module is to load the DXE Core from a Firmware > Volume. >=20 > Copyright (c) 2016 HP Development Company, L.P. > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > #include "DxeIpl.h" > @@ -263,17 +263,38 @@ DxeLoadCore ( > UINTN Instance; > UINT32 AuthenticationState; > UINTN DataSize; > EFI_PEI_S3_RESUME2_PPI *S3Resume; > EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery; > + EFI_PEI_CAPSULE_ON_DISK_PPI *PeiCapsuleOnDisk; > EFI_MEMORY_TYPE_INFORMATION > MemoryData[EfiMaxMemoryType + 1]; > + VOID *CapsuleOnDiskModePpi; > + BOOLEAN IsCapsuleOnDiskMode; > + > + IsCapsuleOnDiskMode =3D FALSE; >=20 > // > // if in S3 Resume, restore configure > // > BootMode =3D GetBootModeHob (); >=20 > + // > + // If Capsule On Disk mode, call storage stack to read Capsule Reloca= tion > file > + // IoMmmu is highly recommmended to enable before reading > + // > + if (BootMode =3D=3D BOOT_ON_FLASH_UPDATE) { > + Status =3D PeiServicesLocatePpi ( > + &gEfiPeiBootInCapsuleOnDiskModePpiGuid, > + 0, > + NULL, > + &CapsuleOnDiskModePpi > + ); > + if (!EFI_ERROR(Status)) { > + IsCapsuleOnDiskMode =3D TRUE; > + } > + } > + Suggest to merge the above logic with the below=20 else if (IsCapsuleOnDiskMode) {...} chunk of codes together. In such case, the logic seems a bit cleaner and 'IsCapsuleOnDiskMode' can also be dropped. Best Regards, Hao Wu > if (BootMode =3D=3D BOOT_ON_S3_RESUME) { > Status =3D PeiServicesLocatePpi ( > &gEfiPeiS3Resume2PpiGuid, > 0, > NULL, > @@ -328,10 +349,24 @@ DxeLoadCore ( > } > REPORT_STATUS_CODE (EFI_PROGRESS_CODE, > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START)); > // > // Now should have a HOB with the DXE core > // > + } else if (IsCapsuleOnDiskMode) { > + Status =3D PeiServicesLocatePpi ( > + &gEdkiiPeiCapsuleOnDiskPpiGuid, > + 0, > + NULL, > + (VOID **) &PeiCapsuleOnDisk > + ); > + > + // > + // Whether failed, still goes to Firmware Update boot path. BDS wil= l clear > corresponding indicator and reboot later on > + // > + if (!EFI_ERROR (Status)) { > + Status =3D PeiCapsuleOnDisk->LoadCapsuleOnDisk (PeiServices, > PeiCapsuleOnDisk); > + } > } >=20 > if (GetFirstGuidHob ((CONST EFI_GUID > *)&gEfiMemoryTypeInformationGuid) =3D=3D NULL) { > // > // Don't build GuidHob if GuidHob has been installed. > -- > 2.16.2.windows.1 >=20 >=20 >=20