REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3218
Adds an INF for StandaloneMmCpuFeaturesLib, which supports building
the SmmCpuFeaturesLib code for Standalone MM. Minimal code changes
are made to allow reuse of existing code for Standalone MM.
The original INF file names are left intact (continue to use SMM
terminology) to retain backward compatibility with platforms that
use those INFs. Similarly, the pre-existing C file names are
unchanged to be consistent with the INF file names.
Note that all references in library source files to PiSmm.h have
been changed to PiMm.h for consistency.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Message-Id: <
20210217213227.1277-6-mikuback@linux.microsoft.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include <Library/DebugLib.h>\r
\r
#include "SmmStm.h"\r
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include "CpuFeaturesLib.h"\r
\r
/**\r
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include <Library/SmmCpuFeaturesLib.h>\r
#include <Library/BaseLib.h>\r
#include <Library/MtrrLib.h>\r
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include <Library/SmmCpuFeaturesLib.h>\r
#include "CpuFeaturesLib.h"\r
\r
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include <Library/BaseLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
--- /dev/null
+/** @file\r
+Standalone MM CPU specific programming.\r
+\r
+Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <PiMm.h>\r
+#include <Library/PcdLib.h>\r
+#include "CpuFeaturesLib.h"\r
+\r
+/**\r
+ Gets the maximum number of logical processors from the PCD PcdCpuMaxLogicalProcessorNumber.\r
+\r
+ This access is abstracted from the PCD services to enforce that the PCD be\r
+ FixedAtBuild in the Standalone MM build of this driver.\r
+\r
+ @return The value of PcdCpuMaxLogicalProcessorNumber.\r
+\r
+**/\r
+UINT32\r
+GetCpuMaxLogicalProcessorNumber (\r
+ VOID\r
+ )\r
+{\r
+ return FixedPcdGet32 (PcdCpuMaxLogicalProcessorNumber);\r
+}\r
+\r
+/**\r
+ The Standalone MM library constructor.\r
+\r
+ @param[in] ImageHandle Image handle of this driver.\r
+ @param[in] SystemTable A Pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS This constructor always returns success.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+StandaloneMmCpuFeaturesLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_MM_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ CpuFeaturesLibInitialization ();\r
+\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+## @file\r
+# Standalone MM CPU specific programming.\r
+#\r
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) Microsoft Corporation.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = StandaloneMmCpuFeaturesLib\r
+ MODULE_UNI_FILE = SmmCpuFeaturesLib.uni\r
+ FILE_GUID = BB554A2D-F5DF-41D3-8C62-46476A2B2B18\r
+ MODULE_TYPE = MM_STANDALONE\r
+ VERSION_STRING = 1.0\r
+ PI_SPECIFICATION_VERSION = 0x00010032\r
+ LIBRARY_CLASS = SmmCpuFeaturesLib\r
+ CONSTRUCTOR = StandaloneMmCpuFeaturesLibConstructor\r
+\r
+[Sources]\r
+ CpuFeaturesLib.h\r
+ StandaloneMmCpuFeaturesLib.c\r
+ SmmCpuFeaturesLibCommon.c\r
+ SmmCpuFeaturesLibNoStm.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ UefiCpuPkg/UefiCpuPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ DebugLib\r
+ MemoryAllocationLib\r
+ PcdLib\r
+\r
+[FixedPcd]\r
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOMETIMES_CONSUMES\r
\r
**/\r
\r
-#include <PiSmm.h>\r
+#include <PiMm.h>\r
#include <Library/DebugLib.h>\r
\r
#include "SmmStm.h"\r
UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf\r
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf\r
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf\r
+ UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf\r
UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf\r
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf\r
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf\r