public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Xu, Wei6" <wei6.xu@intel.com>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [edk2-devel][Patch v2 6/7] MdeModulePkg/DxeIpl: Support Capsule On Disk.
Date: Wed, 12 Jun 2019 07:49:30 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C8EDBD3@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190605154203.11012-7-wei6.xu@intel.com>

> -----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.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1852
> 
> 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.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Chao B Zhang <chao.b.zhang@intel.com>
> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
> ---
>  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(-)
> 
> 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 should
>    include this file for common definitions.
> 
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #ifndef __PEI_DXEIPL_H__
> @@ -19,10 +19,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Ppi/FirmwareVolumeInfo.h>
>  #include <Ppi/GuidedSectionExtraction.h>
>  #include <Ppi/LoadFile.h>
>  #include <Ppi/S3Resume2.h>
>  #include <Ppi/RecoveryModule.h>
> +#include <Ppi/CapsuleOnDisk.h>
>  #include <Ppi/VectorHandoffInfo.h>
> 
>  #include <Guid/MemoryTypeInformation.h>
>  #include <Guid/MemoryAllocationHob.h>
>  #include <Guid/FirmwareFileSystem2.h>
> 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 Load
> (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.<BR>
> +#  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
>  #  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -74,21 +74,23 @@
> 
>  [LibraryClasses.ARM, LibraryClasses.AARCH64]
>    ArmMmuLib
> 
>  [Ppis]
> -  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
> +  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
> 
>  [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.
> 
>  Copyright (c) 2016 HP Development Company, L.P.
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #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 = FALSE;
> 
>    //
>    // if in S3 Resume, restore configure
>    //
>    BootMode = GetBootModeHob ();
> 
> +  //
> +  // If Capsule On Disk mode, call storage stack to read Capsule Relocation
> file
> +  // IoMmmu is highly recommmended to enable before reading
> +  //
> +  if (BootMode == BOOT_ON_FLASH_UPDATE) {
> +    Status = PeiServicesLocatePpi (
> +               &gEfiPeiBootInCapsuleOnDiskModePpiGuid,
> +               0,
> +               NULL,
> +               &CapsuleOnDiskModePpi
> +               );
> +    if (!EFI_ERROR(Status)) {
> +      IsCapsuleOnDiskMode = TRUE;
> +    }
> +  }
> +


Suggest to merge the above logic with the below 

  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 == BOOT_ON_S3_RESUME) {
>      Status = 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 = PeiServicesLocatePpi (
> +               &gEdkiiPeiCapsuleOnDiskPpiGuid,
> +               0,
> +               NULL,
> +               (VOID **) &PeiCapsuleOnDisk
> +               );
> +
> +    //
> +    // Whether failed, still goes to Firmware Update boot path. BDS will clear
> corresponding indicator and reboot later on
> +    //
> +    if (!EFI_ERROR (Status)) {
> +      Status = PeiCapsuleOnDisk->LoadCapsuleOnDisk (PeiServices,
> PeiCapsuleOnDisk);
> +    }
>    }
> 
>    if (GetFirstGuidHob ((CONST EFI_GUID
> *)&gEfiMemoryTypeInformationGuid) == NULL) {
>      //
>      // Don't build GuidHob if GuidHob has been installed.
> --
> 2.16.2.windows.1
> 
> 
> 


  reply	other threads:[~2019-06-12  7:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 15:41 [edk2-devel][Patch v2 0/7] Implement Capsule On Disk Xu, Wei6
2019-06-05 15:41 ` [edk2-devel][Patch v2 1/7] MdePkg: Add Pei Boot In CapsuleOnDisk Mode Ppi definition Xu, Wei6
2019-06-05 21:42   ` Felix Polyudov
2019-06-12  7:48   ` Wu, Hao A
2019-06-12  8:28     ` Liming Gao
2019-06-05 15:41 ` [edk2-devel][Patch v2 2/7] MdeModulePkg: Add Capsule On Disk related definition Xu, Wei6
2019-06-12  7:48   ` Wu, Hao A
2019-06-12  8:43     ` Xu, Wei6
2019-06-05 15:41 ` [edk2-devel][Patch v2 3/7] MdeModulePkg: Add CapsuleOnDiskLoadPei PEIM Xu, Wei6
2019-06-12  7:49   ` Wu, Hao A
2019-06-19  8:40     ` Xu, Wei6
2019-06-19  8:59       ` Ni, Ray
2019-06-20  0:59         ` Wu, Hao A
2019-06-05 15:42 ` [edk2-devel][Patch v2 4/7] MdeModulePkg/BdsDxe: Support Capsule On Disk Xu, Wei6
2019-06-05 15:42 ` [edk2-devel][Patch v2 5/7] MdeModulePkg/CapsuleRuntimeDxe: Introduce PCD to control this feature Xu, Wei6
2019-06-12  7:49   ` Wu, Hao A
2019-06-19  0:41     ` Zhang, Chao B
2019-06-19  0:59       ` Wu, Hao A
2019-06-19  1:13         ` Zhang, Chao B
2019-06-19  2:22           ` Wu, Hao A
2019-06-05 15:42 ` [edk2-devel][Patch v2 6/7] MdeModulePkg/DxeIpl: Support Capsule On Disk Xu, Wei6
2019-06-12  7:49   ` Wu, Hao A [this message]
2019-06-05 15:42 ` [edk2-devel][Patch v2 7/7] MdeModulePkg: Add Capsule On Disk APIs into CapsuleLib Xu, Wei6
2019-06-12  7:49   ` Wu, Hao A
2019-06-19  7:55     ` Xu, Wei6
2019-06-19  8:16       ` Wu, Hao A
2019-06-19  8:19         ` Wu, Hao A
2019-06-19  8:23           ` Xu, Wei6
2019-06-05 21:53 ` [edk2-devel][Patch v2 0/7] Implement Capsule On Disk Felix Polyudov
2019-06-05 22:36   ` Michael D Kinney
2019-06-06  1:23     ` Zhang, Chao B
2019-06-12  7:47 ` Wu, Hao A
2019-06-12  8:13   ` Zhang, Chao B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A093C8EDBD3@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox