summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-11-22 22:05:07 +0800
committerJiewen Yao <jiewen.yao@intel.com>2018-07-26 23:06:43 +0800
commit818d60f48b2f5ed1f930705e013e0cabc04bb3dd (patch)
treee9ad3c29ec708aece2b8f84cbdc0ee4843c17bde
parent1f71fd55b3612cf28e4dddccb9ecd2e4918b3378 (diff)
downloadedk2-818d60f48b2f5ed1f930705e013e0cabc04bb3dd.tar.gz
edk2-818d60f48b2f5ed1f930705e013e0cabc04bb3dd.tar.bz2
edk2-818d60f48b2f5ed1f930705e013e0cabc04bb3dd.zip
MdeModulePkg/DxeCore: Install UEFI mem attrib table at EndOfDxe.
So that the SMM can consume it to set page protection for the UEFI runtime page with EFI_MEMORY_RO attribute. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
-rw-r--r--MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 35156aea14..ec8fec2a42 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -241,6 +241,23 @@ InstallMemoryAttributesTableOnReadyToBoot (
}
/**
+ Install initial MemoryAttributesTable on EndOfDxe.
+ Then SMM can consume this information.
+
+ @param[in] Event The Event this notify function registered to.
+ @param[in] Context Pointer to the context data registered to the Event.
+**/
+VOID
+EFIAPI
+InstallMemoryAttributesTableOnEndOfDxe (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ InstallMemoryAttributesTable ();
+}
+
+/**
Initialize MemoryAttrubutesTable support.
**/
VOID
@@ -251,18 +268,35 @@ CoreInitializeMemoryAttributesTable (
{
EFI_STATUS Status;
EFI_EVENT ReadyToBootEvent;
+ EFI_EVENT EndOfDxeEvent;
//
// Construct the table at ReadyToBoot.
//
Status = CoreCreateEventInternal (
EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK - 1,
+ TPL_CALLBACK,
InstallMemoryAttributesTableOnReadyToBoot,
NULL,
&gEfiEventReadyToBootGuid,
&ReadyToBootEvent
);
ASSERT_EFI_ERROR (Status);
+
+ //
+ // Construct the initial table at EndOfDxe,
+ // then SMM can consume this information.
+ // Use TPL_NOTIFY here, as such SMM code (TPL_CALLBACK)
+ // can run after it.
+ //
+ Status = CoreCreateEventInternal (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ InstallMemoryAttributesTableOnEndOfDxe,
+ NULL,
+ &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
return ;
}