]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement.
authorLi, Zhihao <zhihao.li@intel.com>
Mon, 25 Apr 2022 08:47:27 +0000 (16:47 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 9 May 2022 02:04:11 +0000 (02:04 +0000)
REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3912

UefiCpuPkg define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.

VariableSmm and VariableStandaloneMM driver in MdeModulePkg need
to use this services but MdeModulePkg can't depend on UefiCpuPkg.

Thus, the solution is moving SmmCpuRendezvouslib.h from UefiCpuPkg
to MdePkg and creating SmmCpuRendezvousLib NullLib version
implementation in MdePkg as dependency for the pkg that can't
depend on UefiCpuPkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
MdePkg/Include/Library/SmmCpuRendezvousLib.h [new file with mode: 0644]
MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c [new file with mode: 0644]
MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf [new file with mode: 0644]
MdePkg/MdeLibs.dsc.inc
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc
UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h [deleted file]
UefiCpuPkg/UefiCpuPkg.dec

diff --git a/MdePkg/Include/Library/SmmCpuRendezvousLib.h b/MdePkg/Include/Library/SmmCpuRendezvousLib.h
new file mode 100644 (file)
index 0000000..82e459e
--- /dev/null
@@ -0,0 +1,27 @@
+/** @file\r
+  SMM CPU Rendezvous library header file.\r
+\r
+  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef SMM_CPU_RENDEZVOUS_H_\r
+#define SMM_CPU_RENDEZVOUS_H_\r
+\r
+/**\r
+  This routine wait for all AP processors to arrive in SMM.\r
+\r
+  @param[in]  BlockingMode  Blocking mode or non-blocking mode.\r
+\r
+  @retval EFI_SUCCESS       All processors checked in to SMM.\r
+  @retval EFI_TIMEOUT       Wait for all APs until timeout.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmWaitForAllProcessor (\r
+  IN  BOOLEAN  BlockingMode\r
+  );\r
+\r
+#endif\r
diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
new file mode 100644 (file)
index 0000000..474195b
--- /dev/null
@@ -0,0 +1,29 @@
+/** @file\r
+  SMM CPU Rendezvous sevice implement.\r
+\r
+  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/SmmCpuRendezvousLib.h>\r
+\r
+/**\r
+  This routine wait for all AP processors to arrive in SMM.\r
+\r
+  @param[in] BlockingMode  Blocking mode or non-blocking mode.\r
+\r
+  @retval EFI_SUCCESS  All avaiable APs arrived.\r
+  @retval EFI_TIMEOUT  Wait for all APs until timeout.\r
+  @retval OTHER        Fail to register SMM CPU Rendezvous service Protocol.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmWaitForAllProcessor (\r
+  IN BOOLEAN  BlockingMode\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
new file mode 100644 (file)
index 0000000..7c9bac9
--- /dev/null
@@ -0,0 +1,26 @@
+## @file\r
+# SMM CPU Rendezvous service lib.\r
+#\r
+# This is SMM CPU rendezvous service lib that wait for all\r
+# APs to enter SMM mode.\r
+#\r
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = SmmCpuRendezvousLibNull\r
+  FILE_GUID                      = 1e5790ea-d013-4d7b-9047-b4342a762027\r
+  MODULE_TYPE                    = DXE_SMM_DRIVER\r
+  LIBRARY_CLASS                  = SmmCpuRendezvousLib|MM_STANDALONE DXE_SMM_DRIVER\r
+\r
+[Sources]\r
+  SmmCpuRendezvousLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
index 015ce46f7d3b4d79558a626e885453c985668ba5..fc6f385b304d6fa216ca49e925c79f86fb804bdb 100644 (file)
@@ -5,7 +5,7 @@
 # by using "!include MdePkg/MdeLibs.dsc.inc" to specify the library instances\r
 # of some EDKII basic/common library classes.\r
 #\r
-# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2021 - 2022, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #    SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
@@ -14,3 +14,4 @@
 [LibraryClasses]\r
   RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf\r
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf\r
+  SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf\r
index faeb28c80cbdec33bcdb6bc4b160fcc7cae39a0e..f1ebf9e251c19b485889e65af3243497b85ddef5 100644 (file)
@@ -4,7 +4,7 @@
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of\r
 # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.\r
 #\r
-# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>\r
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>\r
 #\r
   #\r
   CcProbeLib|Include/Library/CcProbeLib.h\r
 \r
+  ## @libraryclass  Provides function for SMM CPU Rendezvous Library.\r
+  SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h\r
+\r
 [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]\r
   ##  @libraryclass  Provides services to generate random number.\r
   #\r
index c8d282882ec18fd58fdd7b6e42320907027fb03e..3d8874e64782f8744f4e1502600bf6ad0193f9a9 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # EFI/PI MdePkg Package\r
 #\r
-# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>\r
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 # (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r
 #\r
 \r
   MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf\r
   MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf\r
+  MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf\r
 \r
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]\r
   #\r
diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h b/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h
deleted file mode 100644 (file)
index 82e459e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/** @file\r
-  SMM CPU Rendezvous library header file.\r
-\r
-  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef SMM_CPU_RENDEZVOUS_H_\r
-#define SMM_CPU_RENDEZVOUS_H_\r
-\r
-/**\r
-  This routine wait for all AP processors to arrive in SMM.\r
-\r
-  @param[in]  BlockingMode  Blocking mode or non-blocking mode.\r
-\r
-  @retval EFI_SUCCESS       All processors checked in to SMM.\r
-  @retval EFI_TIMEOUT       Wait for all APs until timeout.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmWaitForAllProcessor (\r
-  IN  BOOLEAN  BlockingMode\r
-  );\r
-\r
-#endif\r
index 525cde463435efd57941cc3da4f10a3e95f2dc24..1951eb294c6c35eb71eca56f2aaab72fbdae8f54 100644 (file)
@@ -62,9 +62,6 @@
   ##  @libraryclass  Provides function for loading microcode.\r
   MicrocodeLib|Include/Library/MicrocodeLib.h\r
 \r
-  ## @libraryclass  Provides function for SMM CPU Rendezvous Library.\r
-  SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h\r
-\r
 [Guids]\r
   gUefiCpuPkgTokenSpaceGuid      = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}\r
   gMsegSmramGuid                 = { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1, 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}\r