summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorWei6 Xu <wei6.xu@intel.com>2019-06-24 14:50:14 +0800
committerZhang, Chao B <chao.b.zhang@intel.com>2019-06-26 15:10:41 +0800
commite761d18f012421bf7d82da509483c2390798355b (patch)
treec4be614960fe1ed615df6eaacae8d35d438080a3 /MdeModulePkg
parent4ef0b0ac8e89633b8ad0475fa153c97a1dbe5905 (diff)
downloadedk2-e761d18f012421bf7d82da509483c2390798355b.zip
edk2-e761d18f012421bf7d82da509483c2390798355b.tar.gz
edk2-e761d18f012421bf7d82da509483c2390798355b.tar.bz2
MdeModulePkg/DxeIpl: Support Capsule On Disk.
REF: https://github.com/tianocore/tianocore.github.io/wiki/ UEFI-Capsule-on-Disk-Introducation 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> Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeIpl.h3
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf20
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeLoad.c30
3 files changed, 42 insertions, 11 deletions
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
index 063fefb..90b5b5b 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
@@ -2,7 +2,7 @@
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
**/
@@ -21,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Ppi/LoadFile.h>
#include <Ppi/S3Resume2.h>
#include <Ppi/RecoveryModule.h>
+#include <Ppi/CapsuleOnDisk.h>
#include <Ppi/VectorHandoffInfo.h>
#include <Guid/MemoryTypeInformation.h>
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 62bb3f3..abc3217 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -5,7 +5,7 @@
# 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
@@ -76,17 +76,19 @@
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
+ gEdkiiPeiBootInCapsuleOnDiskModePpiGuid ## SOMETIMES_CONSUMES
+ gEdkiiPeiCapsuleOnDiskPpiGuid ## SOMETIMES_CONSUMES # Consumed on firmware update boot path
[Guids]
## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index c6e5b83..d48028c 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -3,7 +3,7 @@
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
**/
@@ -265,7 +265,9 @@ DxeLoadCore (
UINTN DataSize;
EFI_PEI_S3_RESUME2_PPI *S3Resume;
EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery;
+ EDKII_PEI_CAPSULE_ON_DISK_PPI *PeiCapsuleOnDisk;
EFI_MEMORY_TYPE_INFORMATION MemoryData[EfiMaxMemoryType + 1];
+ VOID *CapsuleOnDiskModePpi;
//
// if in S3 Resume, restore configure
@@ -330,6 +332,32 @@ DxeLoadCore (
//
// Now should have a HOB with the DXE core
//
+ } else if (BootMode == BOOT_ON_FLASH_UPDATE) {
+ //
+ // If Capsule On Disk mode, call storage stack to read Capsule Relocation file
+ // IoMmmu is highly recommmended to enable before reading
+ //
+ Status = PeiServicesLocatePpi (
+ &gEdkiiPeiBootInCapsuleOnDiskModePpiGuid,
+ 0,
+ NULL,
+ &CapsuleOnDiskModePpi
+ );
+ if (!EFI_ERROR(Status)) {
+ 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) {