From 7837d1249807b4248079699097bc993254235d7a Mon Sep 17 00:00:00 2001 From: Wei6 Xu Date: Thu, 20 Jun 2019 00:27:09 +0800 Subject: [PATCH] MdeModulePkg/CapsuleRuntimeDxe: Introduce PCD to control this feature. https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Capsule- on-Disk-Introducation Introduce PcdCapsuleInRamSupport to turn on/off Capsule In Ram feature. Platform could choose to drop CapsulePei/CapsuleX64 and not to support Capsule In Ram. Cc: Jian J Wang Cc: Hao A Wu Cc: Chao B Zhang Signed-off-by: Wei6 Xu Reviewed-by: Hao A Wu Reviewed-by: Chao B Zhang --- .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf | 1 + .../Universal/CapsuleRuntimeDxe/CapsuleService.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf index 338577e293..9da450722b 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf @@ -90,6 +90,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule ## SOMETIMES_CONSUMES # Populate Image requires reset support. + gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleInRamSupport ## CONSUMES [Pcd.X64] gEfiMdeModulePkgTokenSpaceGuid.PcdCapsulePeiLongModeStackSize ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c index aaf819c4c6..77b8f00062 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c @@ -4,7 +4,7 @@ It installs the Capsule Architectural Protocol defined in PI1.0a to signify the capsule runtime services are ready. -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 **/ @@ -71,6 +71,14 @@ UpdateCapsule ( CHAR16 CapsuleVarName[30]; CHAR16 *TempVarName; + // + // Check if platform support Capsule In RAM or not. + // Platform could choose to drop CapsulePei/CapsuleX64 and do not support Capsule In RAM. + // + if (!PcdGetBool(PcdCapsuleInRamSupport)) { + return EFI_UNSUPPORTED; + } + // // Capsule Count can't be less than one. // @@ -218,6 +226,8 @@ UpdateCapsule ( /** Returns if the capsule can be supported via UpdateCapsule(). + Notice: When PcdCapsuleInRamSupport is unsupported, even this routine returns a valid answer, + the capsule still is unsupported via UpdateCapsule(). @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules being passed into update capsule.