]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices
authorHao Wu <hao.a.wu@intel.com>
Mon, 19 Mar 2018 07:02:59 +0000 (15:02 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 20 Mar 2018 07:54:15 +0000 (15:54 +0800)
Within function CoreExitBootServices(), this commit will move the call
of:

MemoryProtectionExitBootServicesCallback();

before:

SaveAndSetDebugTimerInterrupt (FALSE);
and
gCpu->DisableInterrupt (gCpu);

The reason is that, within MemoryProtectionExitBootServicesCallback(),
APIs like RaiseTpl and RestoreTpl maybe called. An example will be:

DebugLib (using PeiDxeDebugLibReportStatusCode instance)
 |
 v
ReportStatusCodeLib (using DxeReportStatusCodeLib instance)
 |
 v
Raise/RestoreTpl

The call of Raise/RestoreTpl APIs will re-enable BSP interrupts. Hence,
this commit refine the calling sequence to ensure BSP interrupts before
leaving CoreExitBootServices().

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c

index 62a597edafcfd33e43b6eb991af706eda0c123df..07c740346242fb229b077575766402fb3667da8f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DXE Core Main Entry Point\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -805,6 +805,8 @@ CoreExitBootServices (
     (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)\r
     );\r
 \r
+  MemoryProtectionExitBootServicesCallback();\r
+\r
   //\r
   // Disable interrupt of Debug timer.\r
   //\r
@@ -815,8 +817,6 @@ CoreExitBootServices (
   //\r
   gCpu->DisableInterrupt (gCpu);\r
 \r
-  MemoryProtectionExitBootServicesCallback();\r
-\r
   //\r
   // Clear the non-runtime values of the EFI System Table\r
   //\r