MdeModulePkg/NvmExpressPei: Consume S3StorageDeviceInitList LockBox

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409

For the NvmExpressPei driver, this commit will update the driver to
consume the S3StorageDeviceInitList LockBox in S3 phase. The purpose is to
perform an on-demand (partial) NVM Express device
enumeration/initialization to benefit the S3 resume performance.

Cc: Jian J Wang <jian.j.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Hao Wu
2019-01-21 14:14:19 +08:00
parent 2e15b750c4
commit 05fd2a9268
5 changed files with 236 additions and 1 deletions

View File

@@ -88,6 +88,59 @@ NextDevicePathNode (
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
}
/**
Get the size of the current device path instance.
@param[in] DevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL
structure.
@param[out] InstanceSize The size of the current device path instance.
@param[out] EntireDevicePathEnd Indicate whether the instance is the last
one in the device path strucure.
@retval EFI_SUCCESS The size of the current device path instance is fetched.
@retval Others Fails to get the size of the current device path instance.
**/
EFI_STATUS
GetDevicePathInstanceSize (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINTN *InstanceSize,
OUT BOOLEAN *EntireDevicePathEnd
)
{
EFI_DEVICE_PATH_PROTOCOL *Walker;
if (DevicePath == NULL || InstanceSize == NULL || EntireDevicePathEnd == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// Find the end of the device path instance
//
Walker = DevicePath;
while (Walker->Type != END_DEVICE_PATH_TYPE) {
Walker = NextDevicePathNode (Walker);
}
//
// Check if 'Walker' points to the end of an entire device path
//
if (Walker->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
*EntireDevicePathEnd = TRUE;
} else if (Walker->SubType == END_INSTANCE_DEVICE_PATH_SUBTYPE) {
*EntireDevicePathEnd = FALSE;
} else {
return EFI_INVALID_PARAMETER;
}
//
// Compute the size of the device path instance
//
*InstanceSize = ((UINTN) Walker - (UINTN) (DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
return EFI_SUCCESS;
}
/**
Check the validity of the device path of a NVM Express host controller.