diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-03-29 16:33:11 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-05-10 08:45:11 +0800 |
commit | 07a3fecd4c7906d1ec669e3ba9ca8af98ea48f62 (patch) | |
tree | d21147228f57a2655214395f16c105cef133fe94 /MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | |
parent | 9f64a83484ed99f1d98df1487ba39776d30d24d8 (diff) | |
download | edk2-platforms-07a3fecd4c7906d1ec669e3ba9ca8af98ea48f62.tar.xz |
MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory RAM disks
The RamDiskDxe now will report RAM disks with reserved memory type to NFIT
in the ACPI table.
This commit will also make sure that an NVDIMM root device exists in the
\SB scope before reporting any RAM disk to NFIT.
To properly report the NVDIMM root device, one will need to append the
following content in the [Rule.Common.DXE_DRIVER] field in platform FDF
files:
RAW ACPI Optional |.acpi
RAW ASL Optional |.aml
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Diffstat (limited to 'MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c')
-rw-r--r-- | MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c index 7d068b25c9..e65aee8021 100644 --- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c +++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c @@ -34,6 +34,77 @@ EFI_RAM_DISK_PROTOCOL mRamDiskProtocol = { LIST_ENTRY RegisteredRamDisks;
UINTN ListEntryNum;
+//
+// Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.
+//
+EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol = NULL;
+EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol = NULL;
+
+
+/**
+ Check whether EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL are produced.
+ If both protocols are produced, publish all the reserved memory type RAM
+ disks to the NVDIMM Firmware Interface Table (NFIT).
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+RamDiskAcpiCheck (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ LIST_ENTRY *Entry;
+ RAM_DISK_PRIVATE_DATA *PrivateData;
+
+ gBS->CloseEvent (Event);
+
+ //
+ // Locate the EFI_ACPI_TABLE_PROTOCOL.
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAcpiTableProtocolGuid,
+ NULL,
+ (VOID **)&mAcpiTableProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ EFI_D_INFO,
+ "RamDiskAcpiCheck: Cannot locate the EFI ACPI Table Protocol,",
+ "unable to publish RAM disks to NFIT.\n"
+ ));
+ return;
+ }
+
+ //
+ // Locate the EFI_ACPI_SDT_PROTOCOL.
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAcpiSdtProtocolGuid,
+ NULL,
+ (VOID **)&mAcpiSdtProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ EFI_D_INFO,
+ "RamDiskAcpiCheck: Cannot locate the EFI ACPI Sdt Protocol,",
+ "unable to publish RAM disks to NFIT.\n"
+ ));
+ mAcpiTableProtocol = NULL;
+ return;
+ }
+
+ EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
+ RamDiskPublishNfit (PrivateData);
+ }
+}
+
/**
The entry point for RamDiskDxe driver.
@@ -58,6 +129,7 @@ RamDiskDxeEntryPoint ( EFI_STATUS Status;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
VOID *DummyInterface;
+ EFI_EVENT Event;
//
// If already started, return.
@@ -109,6 +181,14 @@ RamDiskDxeEntryPoint ( //
InitializeListHead (&RegisteredRamDisks);
+ Status = EfiCreateEventReadyToBootEx (
+ TPL_CALLBACK,
+ RamDiskAcpiCheck,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
return EFI_SUCCESS;
ErrorExit:
|