Skip to content

Commit a336f08

Browse files
maheeraeronos-d
authored andcommitted
MdeModulePkg/NvmExpressDxe: Make NVME_GENERIC_TIMEOUT configurable via PCD
Adds gEfiMdeModulePkgTokenSpaceGuid.PcdNvmeGenericTimeout (FixedAtBuild, UINT32, default 5 seconds) so platforms can tune the NVMe generic command timeout without patching the driver. NVME_GENERIC_TIMEOUT now resolves via FixedPcdGet32 to preserve compile-time evaluation and existing behavior at the default value.
1 parent b2c598f commit a336f08

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,14 @@ extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gNvmExpressDriverSupportedEfiV
152152

153153
#define NVME_CONTROLLER_ID 0
154154

155+
// MU_CHANGE [BEGIN] - Set generic timeout based on PcdNvmeGenericTimeout
156+
155157
//
156-
// Time out value for Nvme transaction execution
158+
// Time out value for Nvme transaction execution (in seconds, from PcdNvmeGenericTimeout).
157159
//
158-
#define NVME_GENERIC_TIMEOUT EFI_TIMER_PERIOD_SECONDS (5)
160+
#define NVME_GENERIC_TIMEOUT EFI_TIMER_PERIOD_SECONDS (FixedPcdGet32 (PcdNvmeGenericTimeout))
161+
162+
// MU_CHANGE [END] - Set generic timeout based on PcdNvmeGenericTimeout
159163

160164
//
161165
// Nvme async transfer timer interval, set by experience.

MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
gEfiMdeModulePkgTokenSpaceGuid.PcdNvmeNamespaceFilterId ## CONSUMES
8686
## MU_CHANGE [END] - NVMe namespace filtering
8787

88+
## MU_CHANGE [BEGIN] - Configurable NVMe generic command timeout
89+
[FixedPcd]
90+
gEfiMdeModulePkgTokenSpaceGuid.PcdNvmeGenericTimeout ## CONSUMES
91+
## MU_CHANGE [END] - Configurable NVMe generic command timeout
92+
8893
# [Event]
8994
# EVENT_TYPE_RELATIVE_TIMER ## SOMETIMES_CONSUMES
9095
#

MdeModulePkg/Bus/Pci/NvmExpressDxe/UnitTest/MediaSanitizeUnitTestHost.inf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@
3535
UnitTestLib
3636
PrintLib
3737
MemoryAllocationLib
38+
PcdLib # MU_CHANGE - Configurable NVMe generic command timeout
39+
40+
## MU_CHANGE [BEGIN] - Configurable NVMe generic command timeout
41+
[FixedPcd]
42+
gEfiMdeModulePkgTokenSpaceGuid.PcdNvmeGenericTimeout ## CONSUMES
43+
## MU_CHANGE [END] - Configurable NVMe generic command timeout

MdeModulePkg/MdeModulePkg.dec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,12 @@
14161416
# Size in pages. Current default is roughly 1.6GB.
14171417
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxMemoryTypeInfoPages |0x60000|UINT32|0x40000150
14181418
# MU_CHANGE TCBZ1086 [END]
1419+
1420+
# MU_CHANGE [BEGIN] - Configurable NVMe generic command timeout
1421+
## Timeout, in seconds, used for generic NVMe transactions issued by NvmExpressDxe.
1422+
# @Prompt NVMe generic command timeout (seconds).
1423+
gEfiMdeModulePkgTokenSpaceGuid.PcdNvmeGenericTimeout|5|UINT32|0x40000154
1424+
# MU_CHANGE [END] - Configurable NVMe generic command timeout
14191425

14201426
[PcdsFixedAtBuild, PcdsPatchableInModule]
14211427
## Dynamic type PCD can be registered callback function for Pcd setting action.

0 commit comments

Comments
 (0)