summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorSean Brogan <sean.brogan@microsoft.com>2017-05-24 18:52:24 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-27 01:32:21 +0000
commitd7e36ccbbde76ab39dd8bb21c3712767c2f2c98f (patch)
treec7e80d0bd7fad37e35c70716e4aefe0e7ccbe50b /MdeModulePkg
parent03ad59e631aaab0143c5b1c1d64f27f5da1eb8c4 (diff)
downloadedk2-d7e36ccbbde76ab39dd8bb21c3712767c2f2c98f.tar.gz
edk2-d7e36ccbbde76ab39dd8bb21c3712767c2f2c98f.tar.bz2
edk2-d7e36ccbbde76ab39dd8bb21c3712767c2f2c98f.zip
MdeModulePkg: Add NVMe Long Delay Time Events
Fire an event if a long delay occurs when starting an NVMe device. This can be used by platforms to draw pictures on the screen or take other actions to notify a user or move boot forward. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h2
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf5
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c10
-rw-r--r--MdeModulePkg/Include/Guid/NVMeEventGroup.h16
-rw-r--r--MdeModulePkg/MdeModulePkg.dec7
5 files changed, 38 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
index 4c26b2e1b4..2b9ab8a08e 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
@@ -41,6 +41,8 @@
#include <Library/UefiDriverEntryPoint.h>
#include <Library/ReportStatusCodeLib.h>
+#include <Guid/NVMeEventGroup.h>
+
typedef struct _NVME_CONTROLLER_PRIVATE_DATA NVME_CONTROLLER_PRIVATE_DATA;
typedef struct _NVME_DEVICE_PRIVATE_DATA NVME_DEVICE_PRIVATE_DATA;
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
index dc1990c327..1a29c0b907 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
@@ -41,8 +41,13 @@
NvmExpressHci.h
NvmExpressPassthru.c
+[Guids]
+ gNVMeEnableStartEventGroupGuid
+ gNVMeEnableCompleteEventGroupGuid
+
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
BaseMemoryLib
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
index b90c48731c..e1b0ee6051 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
@@ -8,6 +8,7 @@
**/
#include "NvmExpress.h"
+#include <Guid/NVMeEventGroup.h>
#define NVME_SHUTDOWN_PROCESS_TIMEOUT 45
@@ -399,6 +400,8 @@ NvmeEnableController (
UINT32 Index;
UINT8 Timeout;
+ EfiEventGroupSignal (&gNVMeEnableStartEventGroupGuid);
+
//
// Enable the controller.
// CC.AMS, CC.MPS and CC.CSS are all set to 0.
@@ -410,7 +413,7 @@ NvmeEnableController (
Status = WriteNvmeControllerConfiguration (Private, &Cc);
if (EFI_ERROR (Status)) {
- return Status;
+ goto Cleanup;
}
//
@@ -432,7 +435,7 @@ NvmeEnableController (
Status = ReadNvmeControllerStatus (Private, &Csts);
if (EFI_ERROR (Status)) {
- return Status;
+ goto Cleanup;
}
if (Csts.Rdy) {
@@ -449,6 +452,9 @@ NvmeEnableController (
}
DEBUG ((DEBUG_INFO, "NVMe controller is enabled with status [%r].\n", Status));
+
+Cleanup:
+ EfiEventGroupSignal (&gNVMeEnableCompleteEventGroupGuid);
return Status;
}
diff --git a/MdeModulePkg/Include/Guid/NVMeEventGroup.h b/MdeModulePkg/Include/Guid/NVMeEventGroup.h
new file mode 100644
index 0000000000..bd59b0cb8f
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/NVMeEventGroup.h
@@ -0,0 +1,16 @@
+/** @file
+
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef NVME_EVENT_GROUP_GUID_
+#define NVME_EVENT_GROUP_GUID_
+
+// gNVMeEnableStartEventGroupGuid is used to signal the start of enabling the NVMe controller
+extern EFI_GUID gNVMeEnableStartEventGroupGuid;
+// gNVMeEnableCompleteEventGroupGuid is used to signal that the NVMe controller enable has finished
+extern EFI_GUID gNVMeEnableCompleteEventGroupGuid;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 6ed4c5bf1c..3b484db913 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -413,6 +413,13 @@
## Include/Guid/EndofS3Resume.h
gEdkiiEndOfS3ResumeGuid = { 0x96f5296d, 0x05f7, 0x4f3c, {0x84, 0x67, 0xe4, 0x56, 0x89, 0x0e, 0x0c, 0xb5 } }
+ #
+ # Guids for NVMe Timeout Events
+ # {4754469d-6528-4dfc-84aa-8c8a03a2158b}
+ gNVMeEnableStartEventGroupGuid = { 0x4754469d, 0x6528, 0x4dfc, { 0x84, 0xaa, 0x8c, 0x8a, 0x03, 0xa2, 0x15, 0x8b } }
+ # {da383315-906b-486f-80db-847f268451e4}
+ gNVMeEnableCompleteEventGroupGuid = { 0xda383315, 0x906b, 0x486f, { 0x80, 0xdb, 0x84, 0x7f, 0x26, 0x84, 0x51, 0xe4 } }
+
## Used (similar to Variable Services) to communicate policies to the enforcement engine.
# {DA1B0D11-D1A7-46C4-9DC9-F3714875C6EB}
gVarCheckPolicyLibMmiHandlerGuid = { 0xda1b0d11, 0xd1a7, 0x46c4, { 0x9d, 0xc9, 0xf3, 0x71, 0x48, 0x75, 0xc6, 0xeb }}