From 597d061e0979f30d5f65dff72d489c18ddec35c2 Mon Sep 17 00:00:00 2001 From: Pavithra Gurulingappa Date: Tue, 16 Sep 2025 14:44:52 +0530 Subject: [PATCH] MdeModulePkg/DxeCapsuleLibFmp:Added PCD for EmbeddedDriver Support Currently, there is no mechanism for platforms to enable or disable support for EmbeddedDrivers in capsule updates. This patch introduces a new PCD, PcdEmbeddedDriverSupport, allowing platforms to explicitly control whether capsules containing EmbeddedDrivers are supported. This ensures capsules with embedded drivers are rejected on platforms that do not support them. This is a breaking change.By default, PcdEmbeddedDriverSupport is set to FALSE which disables embedded driver support in capsule updates across all platforms unless explicitly enabled. Platforms must opt-in by setting the PcdEmbeddedDriverSupport to TRUE in order to enable support for capsules containing embedded drivers. Signed-off-by: Pavithra Gurulingappa --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 6 ++++++ MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf | 2 ++ .../Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf | 4 ++++ MdeModulePkg/MdeModulePkg.dec | 9 +++++++++ 4 files changed, 21 insertions(+) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 92813226ad..e90747d80f 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -12,6 +12,7 @@ Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -246,6 +247,11 @@ ValidateFmpCapsule ( return EFI_INVALID_PARAMETER; } + if (!PcdGetBool (PcdCapsuleEmbeddedDriverSupport) && (FmpCapsuleHeader->EmbeddedDriverCount != 0)) { + DEBUG ((DEBUG_ERROR, "FMP Capsule with one or more embedded drivers is not supported by this platform\n")); + return EFI_UNSUPPORTED; + } + ItemOffsetList = (UINT64 *)(FmpCapsuleHeader + 1); // No overflow diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf index 095e062a6e..9f49a3eb93 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf @@ -4,6 +4,7 @@ # Capsule library instance for DXE_DRIVER module types. # # Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -68,6 +69,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCoDRelocationFileName ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleEmbeddedDriverSupport ## CONSUMES [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset ## CONSUMES diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf index ef1fa57c51..5314bbb074 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf @@ -4,6 +4,7 @@ # Capsule library instance for DXE_RUNTIME_DRIVER module types. # # Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -70,5 +71,8 @@ gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event gEdkiiCapsuleOnDiskNameGuid ## SOMETIMES_CONSUMES ## GUID +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleEmbeddedDriverSupport ## CONSUMES + [Depex] gEfiVariableWriteArchProtocolGuid diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 4e842dde8a..0775aa954a 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -10,6 +10,7 @@ # Copyright (c) 2017, AMD Incorporated. All rights reserved.
# Copyright (c) Microsoft Corporation.
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -1696,6 +1697,14 @@ # @Prompt Enable Capsule On Disk support. gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport|FALSE|BOOLEAN|0x0000002d + ## Indicates whether the platform supports processing Capsules that include EmbeddedDrivers. + # Default value is FALSE, meaning embedded drivers are not supported. + # Platforms that require embedded driver support must explicitly opt-in by setting this PCD to TRUE. + # TRUE - Capsule with EmbeddedDriver is supported.
+ # FALSE - Capsule with EmbeddedDriver is not supported.
+ # @Prompt Enable Capsule with EmbeddedDriver support. + gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleEmbeddedDriverSupport|FALSE|BOOLEAN|0x00010021 + ## Maximum permitted encapsulation levels of sections in a firmware volume, # in the DXE phase. Minimum value is 1. Sections nested more deeply are # rejected.