summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-12-08 18:57:29 +0800
committerStar Zeng <star.zeng@intel.com>2017-12-12 18:30:07 +0800
commitc6ded48cdd38b8e44e01c6cfd12348ca9dd09a87 (patch)
treeaf736589d3fbcded1cf1a691ef3ad0ec281e4d3a /MdeModulePkg/Core/PiSmmCore
parent7b9b55b2ef7be13608605dc58a54b9ca04be4e40 (diff)
downloadedk2-c6ded48cdd38b8e44e01c6cfd12348ca9dd09a87.tar.gz
edk2-c6ded48cdd38b8e44e01c6cfd12348ca9dd09a87.tar.bz2
edk2-c6ded48cdd38b8e44e01c6cfd12348ca9dd09a87.zip
MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS
Otherwise, LegacyBoot may be triggered wrongly by other code in UEFI OS, or vice versa. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmCore.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 4aef9b70a1..dbb89932e7 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -157,6 +157,7 @@ SmmLegacyBootHandler (
{
EFI_STATUS Status;
EFI_HANDLE SmmHandle;
+ UINTN Index;
//
// Install SMM Legacy Boot protocol.
@@ -173,6 +174,16 @@ SmmLegacyBootHandler (
SmiHandlerUnRegister (DispatchHandle);
+ //
+ // It is legacy boot, unregister ExitBootService SMI handler.
+ //
+ for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType != NULL; Index++) {
+ if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventExitBootServicesGuid)) {
+ SmiHandlerUnRegister (mSmmCoreSmiHandlers[Index].DispatchHandle);
+ break;
+ }
+ }
+
return Status;
}
@@ -201,6 +212,7 @@ SmmExitBootServicesHandler (
{
EFI_STATUS Status;
EFI_HANDLE SmmHandle;
+ UINTN Index;
//
// Install SMM Exit Boot Services protocol.
@@ -215,6 +227,16 @@ SmmExitBootServicesHandler (
SmiHandlerUnRegister (DispatchHandle);
+ //
+ // It is UEFI boot, unregister LegacyBoot SMI handler.
+ //
+ for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType != NULL; Index++) {
+ if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventLegacyBootGuid)) {
+ SmiHandlerUnRegister (mSmmCoreSmiHandlers[Index].DispatchHandle);
+ break;
+ }
+ }
+
return Status;
}