* [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS
@ 2017-12-11 8:36 Star Zeng
2017-12-11 13:20 ` Yao, Jiewen
0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2017-12-11 8:36 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Jiewen Yao
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>
---
MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 6d266933868d..d516e9dcea34 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;
}
--
2.7.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS
2017-12-11 8:36 [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS Star Zeng
@ 2017-12-11 13:20 ` Yao, Jiewen
0 siblings, 0 replies; 2+ messages in thread
From: Yao, Jiewen @ 2017-12-11 13:20 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org
Reviewed-by: jiewen.yao@intel.com
> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, December 11, 2017 4:36 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] 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>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22
> ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
> index 6d266933868d..d516e9dcea34 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;
> }
>
> --
> 2.7.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-11 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 8:36 [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS Star Zeng
2017-12-11 13:20 ` Yao, Jiewen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox