MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens
Per NVM Express Spec, software should notify NVME HW when shutdown occurs. The NVME controller requires notification for shutdown as part of its management of internal structures. Even with FUA, failing to notify the NVME controller to shutdown power off causes the NVME controller to take quite some time to organize its tables on the next power on. This time exceeds the normal timeout, so we would fail to boot the NVME disk. The host should set the Shutdown Notification (CC.SHN) field to 01b to indicate a normal shutdown operation. The controller indicates when shutdown processing is completed by updating the Shutdown Status (CSTS.SHST) field to 10b. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
NVM Express specification.
|
||||
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -34,6 +34,7 @@
|
||||
#include <Protocol/DiskInfo.h>
|
||||
#include <Protocol/DriverSupportedEfiVersion.h>
|
||||
#include <Protocol/StorageSecurityCommand.h>
|
||||
#include <Protocol/ResetNotification.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@ -721,4 +722,24 @@ NvmeDumpStatus (
|
||||
IN NVME_CQ *Cq
|
||||
);
|
||||
|
||||
/**
|
||||
Register the shutdown notification through the ResetNotification protocol.
|
||||
|
||||
Register the shutdown notification when mNvmeControllerNumber increased from 0 to 1.
|
||||
**/
|
||||
VOID
|
||||
NvmeRegisterShutdownNotification (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Unregister the shutdown notification through the ResetNotification protocol.
|
||||
|
||||
Unregister the shutdown notification when mNvmeControllerNumber decreased from 1 to 0.
|
||||
**/
|
||||
VOID
|
||||
NvmeUnregisterShutdownNotification (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user